diff options
author | eik <eik@FreeBSD.org> | 2004-07-07 22:51:17 +0800 |
---|---|---|
committer | eik <eik@FreeBSD.org> | 2004-07-07 22:51:17 +0800 |
commit | 72c46a0db59a7b9155d99c72dcd1ab26bb640157 (patch) | |
tree | 2c29234c4388ccdb15840e8820467a7b29ec9010 | |
parent | e776e42494a5814a191dc58ebbd737bf7fb59d20 (diff) | |
download | freebsd-ports-gnome-72c46a0db59a7b9155d99c72dcd1ab26bb640157.tar.gz freebsd-ports-gnome-72c46a0db59a7b9155d99c72dcd1ab26bb640157.tar.zst freebsd-ports-gnome-72c46a0db59a7b9155d99c72dcd1ab26bb640157.zip |
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)
-rw-r--r-- | devel/portmk/Mk/bsd.port.post.mk | 32 | ||||
-rw-r--r-- | devel/portmk/scripts/distfiles.sh | 56 | ||||
-rw-r--r-- | ports-mgmt/portmk/Mk/bsd.port.post.mk | 32 | ||||
-rw-r--r-- | ports-mgmt/portmk/scripts/distfiles.sh | 56 |
4 files changed, 174 insertions, 2 deletions
diff --git a/devel/portmk/Mk/bsd.port.post.mk b/devel/portmk/Mk/bsd.port.post.mk index c36f5f38a68e..17b8a6db2bdd 100644 --- a/devel/portmk/Mk/bsd.port.post.mk +++ b/devel/portmk/Mk/bsd.port.post.mk @@ -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: diff --git a/devel/portmk/scripts/distfiles.sh b/devel/portmk/scripts/distfiles.sh index 994d40433bba..18916518d922 100644 --- a/devel/portmk/scripts/distfiles.sh +++ b/devel/portmk/scripts/distfiles.sh @@ -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; } diff --git a/ports-mgmt/portmk/Mk/bsd.port.post.mk b/ports-mgmt/portmk/Mk/bsd.port.post.mk index c36f5f38a68e..17b8a6db2bdd 100644 --- a/ports-mgmt/portmk/Mk/bsd.port.post.mk +++ b/ports-mgmt/portmk/Mk/bsd.port.post.mk @@ -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: diff --git a/ports-mgmt/portmk/scripts/distfiles.sh b/ports-mgmt/portmk/scripts/distfiles.sh index 994d40433bba..18916518d922 100644 --- a/ports-mgmt/portmk/scripts/distfiles.sh +++ b/ports-mgmt/portmk/scripts/distfiles.sh @@ -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; } |