[arch-dev-public] [PATCH 1/6] Unify comment style
Signed-off-by: Dan McGee <dan@archlinux.org> --- makechrootpkg | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/makechrootpkg b/makechrootpkg index 2a9f56b..9143f0c 100755 --- a/makechrootpkg +++ b/makechrootpkg @@ -156,7 +156,7 @@ if [ -n "$install_pkg" ]; then mkarchroot -r "pacman -U /$pkgname" "$copydir" ret=$? rm "$copydir/$pkgname" - #exit early, we've done all we need to + # Exit early, we've done all we need to exit $ret fi @@ -167,11 +167,11 @@ fi [ -d "$copydir/build" ] || mkdir "$copydir/build" if [ "$REPACK" != "1" ]; then - #Remove anything in there UNLESS -R (repack) was passed to makepkg + # Remove anything in there UNLESS -R (repack) was passed to makepkg rm -rf "$copydir/build/"* fi -# read .makpekg.conf even if called via sudo +# Read .makepkg.conf even if called via sudo if [ -n "${SUDO_USER}" ]; then makepkg_conf="/$(eval echo ~${SUDO_USER})/.makepkg.conf" else -- 1.7.4.2
This gets rid of the ever-expanding conditional we had before and replaces it with two case statements. The first handles the command name. If it ends with 'pkg', we treat the entire first part of the reponame, unless of course 'commitpkg' was called directly. This allows one to add new symlinks such as 'gnome-unstablepkg'. The second handles the server. Well-known repositories are listed and passed to the appropriate server. All unusual repos are assumed to live on gerolde and sent that direction. Signed-off-by: Dan McGee <dan@archlinux.org> --- commitpkg | 55 ++++++++++++++++++++++++------------------------------- 1 files changed, 24 insertions(+), 31 deletions(-) diff --git a/commitpkg b/commitpkg index dfc2bd1..009c777 100755 --- a/commitpkg +++ b/commitpkg @@ -51,38 +51,31 @@ fi . PKGBUILD pkgbase=${pkgbase:-$pkgname} -# set up repo-specific opts depending on how we were called -server='gerolde.archlinux.org' -if [ "$cmd" == 'extrapkg' ]; then - repo='extra' -elif [ "$cmd" == 'corepkg' ]; then - repo='core' -elif [ "$cmd" == 'testingpkg' ]; then - repo='testing' -elif [ "$cmd" == 'stagingpkg' ]; then - repo='staging' -elif [ "$cmd" == 'communitypkg' ]; then - repo='community' - server='aur.archlinux.org' -elif [ "$cmd" == 'community-testingpkg' ]; then - repo='community-testing' - server='aur.archlinux.org' -elif [ "$cmd" == 'community-stagingpkg' ]; then - repo='community-staging' - server='aur.archlinux.org' -elif [ "$cmd" == 'multilibpkg' ]; then - repo='multilib' - server='aur.archlinux.org' -elif [ "$cmd" == 'multilib-testingpkg' ]; then - repo='multilib-testing' - server='aur.archlinux.org' -else - if [ $# -eq 0 ]; then +case "$cmd" in + commitpkg) + if [ $# -eq 0 ]; then + abort 'usage: commitpkg <reponame> [-l limit] [commit message]' + fi + repo="$1" + shift + ;; + *pkg) + repo="${cmd%pkg}" + ;; + *) abort 'usage: commitpkg <reponame> [-l limit] [commit message]' - fi - repo="$1" - shift -fi + ;; +esac + +case "$repo" in + core|extra|testing|staging) + server='gerolde.archlinux.org' ;; + community*|multilib*) + server='aur.archlinux.org' ;; + *) + server='gerolde.archlinux.org' + echo "Non-standard repository $repo in use, defaulting to server $server" ;; +esac # check if all local source files are under version control for s in ${source[@]}; do -- 1.7.4.2
Signed-off-by: Dan McGee <dan@archlinux.org> --- commitpkg | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/commitpkg b/commitpkg index 009c777..6a100de 100755 --- a/commitpkg +++ b/commitpkg @@ -97,9 +97,9 @@ for i in 'changelog' 'install'; do done # see if any limit options were passed, we'll send them to rsync -unset rsyncopts +rsyncopts="-e ssh -p --chmod 'ug=rw,o=r' -c -h -L --progress --partial" if [ "$1" = '-l' ]; then - rsyncopts="--bwlimit=$2" + rsyncopts="$rsyncopts --bwlimit=$2" shift 2 fi @@ -128,7 +128,7 @@ for _arch in ${arch[@]}; do fi echo -n 'uploading ' - rsync -p --chmod 'ug=rw,o=r' -c -h -L --progress $rsyncopts --partial "${pkgfile}" -e ssh "$server:staging/$repo/${pkgfile##*/}" || abort + rsync $rsyncopts "${pkgfile}" "$server:staging/$repo/${pkgfile##*/}" || abort done archrelease $repo-${_arch} || abort done -- 1.7.4.2
This allows uploads to possibly be smaller if a similar file exists nearby without the same name. Unlikely in most cases, but we might as well take advantage if they do exist: Signed-off-by: Dan McGee <dan@archlinux.org> --- commitpkg | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/commitpkg b/commitpkg index 6a100de..413161c 100755 --- a/commitpkg +++ b/commitpkg @@ -97,7 +97,7 @@ for i in 'changelog' 'install'; do done # see if any limit options were passed, we'll send them to rsync -rsyncopts="-e ssh -p --chmod 'ug=rw,o=r' -c -h -L --progress --partial" +rsyncopts="-e ssh -p --chmod 'ug=rw,o=r' -c -h -L --progress --partial -y" if [ "$1" = '-l' ]; then rsyncopts="$rsyncopts --bwlimit=$2" shift 2 -- 1.7.4.2
Batch them up using a bash array and then pass them all to a single invocation of rsync. Signed-off-by: Dan McGee <dan@archlinux.org> --- Demo of what this should be doing: $ touch /tmp/foobar /tmp/foobaz '/tmp/file with spaces' $ uploads+=('/tmp/foobar') $ uploads+=('/tmp/foobaz') $ uploads+=('/tmp/file with spaces') $ echo ${uploads[@]} /tmp/foobar /tmp/foobaz /tmp/file with spaces $ rsync -e ssh -p -c -h -L --progress "${uploads[@]}" gerolde.archlinux.org:staging/extra/ file with spaces 0 100% 0.00kB/s 0:00:00 (xfer#1, to-check=2/3) foobar 0 100% 0.00kB/s 0:00:00 (xfer#2, to-check=1/3) foobaz 0 100% 0.00kB/s 0:00:00 (xfer#3, to-check=0/3) sent 224 bytes received 69 bytes 195.33 bytes/sec total size is 0 speedup is 0.00 commitpkg | 11 ++++++++--- 1 files changed, 8 insertions(+), 3 deletions(-) diff --git a/commitpkg b/commitpkg index 413161c..ed2254c 100755 --- a/commitpkg +++ b/commitpkg @@ -112,6 +112,8 @@ else fi echo 'done' +declare -a uploads + for _arch in ${arch[@]}; do for _pkgname in ${pkgname[@]}; do fullver=$(get_full_version ${epoch:-0} $pkgver $pkgrel) @@ -126,13 +128,16 @@ for _arch in ${arch[@]}; do echo "skipping ${_arch}" continue 2 fi - - echo -n 'uploading ' - rsync $rsyncopts "${pkgfile}" "$server:staging/$repo/${pkgfile##*/}" || abort + uploads+=("$pkgfile") done archrelease $repo-${_arch} || abort done +if [[ ${#uploads[*]} -gt 0 ]]; then + echo 'uploading all package files' + rsync $rsyncopts "${uploads[@]}" "$server:staging/$repo/" || abort +fi + if [ "${arch[*]}" == 'any' ]; then if [ -d ../repos/$repo-i686 -a -d ../repos/$repo-x86_64 ]; then pushd ../repos/ >/dev/null -- 1.7.4.2
Signed-off-by: Dan McGee <dan@archlinux.org> --- commitpkg | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-) diff --git a/commitpkg b/commitpkg index ed2254c..a0a5628 100755 --- a/commitpkg +++ b/commitpkg @@ -129,12 +129,17 @@ for _arch in ${arch[@]}; do continue 2 fi uploads+=("$pkgfile") + + sigfile="${pkgfile}.sig" + if [ -f "${sigfile}" ]; then + uploads+=("$sigfile") + fi done archrelease $repo-${_arch} || abort done if [[ ${#uploads[*]} -gt 0 ]]; then - echo 'uploading all package files' + echo 'uploading all package and signature files' rsync $rsyncopts "${uploads[@]}" "$server:staging/$repo/" || abort fi -- 1.7.4.2
participants (1)
-
Dan McGee