1
0
mirror of https://git.FreeBSD.org/ports.git synced 2025-01-13 07:34:50 +00:00

add targets master-sites-all, master-sites, patch-sites-all, patch-sites

which print a sorted list of the respective sites (used e.g. by FreshPorts)
This commit is contained in:
Oliver Eikemeier 2004-07-07 14:51:17 +00:00
parent e41c0a0867
commit 512239b93f
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=113148
4 changed files with 174 additions and 2 deletions

View File

@ -1368,6 +1368,38 @@ makesum:
.endif
.endif
.PHONY: master-sites-all
.if !target(master-sites-all)
master-sites-all:
@${_FETCHDISTFILES_ENV}; \
set -- -t ''; \
. '${DISTFILES_SH}'
.endif
.PHONY: master-sites
.if !target(master-sites)
master-sites:
@${_FETCHDISTFILES_ENV}; \
set -- -t 'DEFAULT'; \
. '${DISTFILES_SH}'
.endif
.PHONY: patch-sites-all
.if !target(patch-sites-all)
patch-sites-all:
@${_FETCHDISTFILES_ENV}; \
set -- -T ''; \
. '${DISTFILES_SH}'
.endif
.PHONY: patch-sites
.if !target(patch-sites)
patch-sites:
@${_FETCHDISTFILES_ENV}; \
set -- -T 'DEFAULT'; \
. '${DISTFILES_SH}'
.endif
.PHONY: migratesum
.if !target(migratesum)
migratesum:

View File

@ -568,6 +568,48 @@ do_fetch()
done
}
###
# do_list_sites lists {MASTER,PATCH}_SITES
###
do_list_sites()
{
[ $# -eq 2 ] || return 1
local select
case "$1" in
MASTER)
files="$DISTFILES";;
PATCH)
files="$PATCHFILES";;
*)
return 1;;
esac
if [ -n "$2" ]; then
select="$2"
else
select=`echo "$files" | $TR -s ' \t' '\n' | $AWK '
/.+:/ {
sub(/.+:/, "")
g=split($0, a, /,/)
for (i in a)
group[a[i]]=1
next
}
{ group["DEFAULT"]=1 }
END {
for (g in group)
print g
}'`
fi
SORTED_MASTER_SITES_TMP=`get_master_sites_sorted "$1" "$select"`
echo $_MASTER_SITE_OVERRIDE \
$SORTED_MASTER_SITES_TMP $_MASTER_SITE_BACKUP
}
### missing size ###
###
@ -991,6 +1033,8 @@ do_migratesum2()
# main
###
opt_list_master=false
opt_list_patch=false
opt_fetch_list=false
opt_makesum=false
opt_migratesum=false
@ -999,8 +1043,12 @@ opt_fetch=false
opt_fetch_all=false
opt_missing_size=false
while getopts "LmMNfFS" opt; do
while getopts "LmMNfFSt:T:" opt; do
case "$opt" in
t) list_master="${OPTARG}";
opt_list_master=true;;
T) list_patch="${OPTARG}";
opt_list_patch=true;;
L) opt_fetch_list=true;;
m) opt_makesum=true;;
M) opt_migratesum=true;;
@ -1014,6 +1062,12 @@ done
shift $(($OPTIND-1))
$opt_list_master &&
{ do_list_sites "MASTER" "$list-master" || exit 1; }
$opt_list_patch &&
{ do_list_sites "PATCH" "$list_patch" || exit 1; }
$opt_fetch_list &&
{ do_fetch_list || exit 1; }

View File

@ -1368,6 +1368,38 @@ makesum:
.endif
.endif
.PHONY: master-sites-all
.if !target(master-sites-all)
master-sites-all:
@${_FETCHDISTFILES_ENV}; \
set -- -t ''; \
. '${DISTFILES_SH}'
.endif
.PHONY: master-sites
.if !target(master-sites)
master-sites:
@${_FETCHDISTFILES_ENV}; \
set -- -t 'DEFAULT'; \
. '${DISTFILES_SH}'
.endif
.PHONY: patch-sites-all
.if !target(patch-sites-all)
patch-sites-all:
@${_FETCHDISTFILES_ENV}; \
set -- -T ''; \
. '${DISTFILES_SH}'
.endif
.PHONY: patch-sites
.if !target(patch-sites)
patch-sites:
@${_FETCHDISTFILES_ENV}; \
set -- -T 'DEFAULT'; \
. '${DISTFILES_SH}'
.endif
.PHONY: migratesum
.if !target(migratesum)
migratesum:

View File

@ -568,6 +568,48 @@ do_fetch()
done
}
###
# do_list_sites lists {MASTER,PATCH}_SITES
###
do_list_sites()
{
[ $# -eq 2 ] || return 1
local select
case "$1" in
MASTER)
files="$DISTFILES";;
PATCH)
files="$PATCHFILES";;
*)
return 1;;
esac
if [ -n "$2" ]; then
select="$2"
else
select=`echo "$files" | $TR -s ' \t' '\n' | $AWK '
/.+:/ {
sub(/.+:/, "")
g=split($0, a, /,/)
for (i in a)
group[a[i]]=1
next
}
{ group["DEFAULT"]=1 }
END {
for (g in group)
print g
}'`
fi
SORTED_MASTER_SITES_TMP=`get_master_sites_sorted "$1" "$select"`
echo $_MASTER_SITE_OVERRIDE \
$SORTED_MASTER_SITES_TMP $_MASTER_SITE_BACKUP
}
### missing size ###
###
@ -991,6 +1033,8 @@ do_migratesum2()
# main
###
opt_list_master=false
opt_list_patch=false
opt_fetch_list=false
opt_makesum=false
opt_migratesum=false
@ -999,8 +1043,12 @@ opt_fetch=false
opt_fetch_all=false
opt_missing_size=false
while getopts "LmMNfFS" opt; do
while getopts "LmMNfFSt:T:" opt; do
case "$opt" in
t) list_master="${OPTARG}";
opt_list_master=true;;
T) list_patch="${OPTARG}";
opt_list_patch=true;;
L) opt_fetch_list=true;;
m) opt_makesum=true;;
M) opt_migratesum=true;;
@ -1014,6 +1062,12 @@ done
shift $(($OPTIND-1))
$opt_list_master &&
{ do_list_sites "MASTER" "$list-master" || exit 1; }
$opt_list_patch &&
{ do_list_sites "PATCH" "$list_patch" || exit 1; }
$opt_fetch_list &&
{ do_fetch_list || exit 1; }