diff options
Diffstat (limited to 'commitpkg.in')
-rw-r--r-- | commitpkg.in | 46 |
1 files changed, 16 insertions, 30 deletions
diff --git a/commitpkg.in b/commitpkg.in index fe9348b..1095006 100644 --- a/commitpkg.in +++ b/commitpkg.in @@ -2,22 +2,6 @@ m4_include(lib/common.sh) -getpkgfile() { - case $# in - 0) - error 'No canonical package found!' - return 1 - ;; - [!1]) - error 'Failed to canonicalize package name -- multiple packages found:' - msg2 '%s' "$@" - return 1 - ;; - esac - - echo "$1" -} - # Source makepkg.conf; fail if it is not found if [[ -r '/etc/makepkg.conf' ]]; then source '/etc/makepkg.conf' @@ -55,24 +39,28 @@ case "$cmd" in ;; esac -# check if all local source files are under version control +# find files which should be under source control +needsversioning=() for s in "${source[@]}"; do - if [[ $s != *://* ]] && ! svn status -v "$s@" | grep -q '^[ AMRX~]'; then - die "%s is not under version control" "$s" - fi + [[ $s != *://* ]] && needsversioning+=("$s") done - -# check if changelog and install files are under version control for i in 'changelog' 'install'; do while read -r file; do # evaluate any bash variables used eval file=\"$(sed 's/^\(['\''"]\)\(.*\)\1$/\2/' <<< "$file")\" - if ! svn status -v "${file}" | grep -q '^[ AMRX~]'; then - die "%s is not under version control" "$file" - fi + needsversioning+=("$file") done < <(sed -n "s/^[[:space:]]*$i=//p" PKGBUILD) done +# assert that they really are controlled by SVN +if (( ${#needsversioning[*]} )); then + # svn status's output is only two columns when the status is unknown + while read -r status filename; do + [[ $status = '?' ]] && unversioned+=("$filename") + done < <(svn status -v "${needsversioning[@]}") + (( ${#unversioned[*]} )) && die "%s is not under version control" "${unversioned[@]}" +fi + rsyncopts=(-e ssh -p --chmod=ug=rw,o=r -c -h -L --progress --partial -y) archreleaseopts=() while getopts ':l:a:s:f' flag; do @@ -95,9 +83,8 @@ for _arch in ${arch[@]}; do for _pkgname in ${pkgname[@]}; do fullver=$(get_full_version $_pkgname) - if pkgfile=$(shopt -s nullglob; - getpkgfile "${PKGDEST+$PKGDEST/}$_pkgname-$fullver-${_arch}".pkg.tar.?z); then - if grep -q "packager = Unknown Packager" <(bsdtar -xOqf $pkgfile .PKGINFO); then + if pkgfile=$(find_cached_package "$_pkgname" "$_arch" "$fullver"); then + if grep -q "packager = Unknown Packager" <(bsdtar -xOqf "$pkgfile" .PKGINFO); then die "PACKAGER was not set when building package" fi fi @@ -147,8 +134,7 @@ for _arch in ${arch[@]}; do for _pkgname in ${pkgname[@]}; do fullver=$(get_full_version $_pkgname) - if ! pkgfile=$(shopt -s nullglob; - getpkgfile "${PKGDEST+$PKGDEST/}$_pkgname-$fullver-${_arch}".pkg.tar.?z); then + if ! pkgfile=$(find_cached_package "$_pkgname" "$fullver" "${_arch}"); then warning "Skipping $_pkgname-$fullver-$_arch: failed to locate package file" skip_arches+=($_arch) continue 2 |