diff options
author | Andreas Grapentin <andreas@grapentin.org> | 2018-05-24 12:05:40 +0200 |
---|---|---|
committer | Andreas Grapentin <andreas@grapentin.org> | 2018-05-24 12:05:40 +0200 |
commit | 81424fbd1645bfe6f649ef0495118e87049a8c87 (patch) | |
tree | 4643e4f7ac7cb3e08a26fedc6edd62d3bbd1e51f | |
parent | 76fcbc94351a90722403d84b1eab8554d1e5d20e (diff) |
updated patching logic
-rw-r--r-- | src/shared/deptree.sh | 4 | ||||
-rw-r--r-- | src/shared/package.sh | 51 | ||||
-rw-r--r-- | src/shared/srcinfo.sh | 2 |
3 files changed, 17 insertions, 40 deletions
diff --git a/src/shared/deptree.sh b/src/shared/deptree.sh index e1ecee7..b4fe43e 100644 --- a/src/shared/deptree.sh +++ b/src/shared/deptree.sh @@ -119,8 +119,8 @@ deptree_add_entry() { elif grep -q "^$r :" "$DEPTREE".FULL; then # elif requestee is in deptree, insert after requestee sed -i "/^$r :/a $1 : [ ] # $r" "$DEPTREE"* - elif [ "x$r" == "x<immediate>" ]; then - # elif requested directly, add to top of file + elif [ "x$r" == "x<immediate>" ] && [ -s "$DEPTREE".FULL ]; then + # elif requested directly, and deptree is not empty, add to top of file sed -i "1i $1 : [ ] # $r" "$DEPTREE"* else # else append to deptree diff --git a/src/shared/package.sh b/src/shared/package.sh index 940c4e8..8e44d95 100644 --- a/src/shared/package.sh +++ b/src/shared/package.sh @@ -146,50 +146,27 @@ package_patch() { pkgbase=$(srcinfo_pkgbase) || return pkgname=$(srcinfo_pkgname) || return + echo -n "checking for package patch ... " local patch="$SRCDIR/patches/$CARCH/$pkgbase$p.$pkgname".patch - echo -n "checking for $CARCH/$(basename "$patch") ... " - local have_patch=yes - if [ ! -f "$patch" ]; then - have_patch=no - fi - echo "$have_patch (needed: $r)" - - if [ "x$have_patch" == "xno" ]; then - patch="$SRCDIR/patches/$CARCH/$pkgbase$p".patch - echo -n "checking for $CARCH/$(basename "$patch") ... " - have_patch=yes - if [ ! -f "$patch" ]; then - have_patch=no - fi - echo "$have_patch (needed: $r)" - fi - - if [ "x$have_patch" == "xno" ]; then - patch="$SRCDIR/patches/generic/$pkgbase$p.$pkgname".patch - echo -n "checking for generic/$(basename "$patch") ... " - have_patch=yes - if [ ! -f "$patch" ]; then - have_patch=no - fi - echo "$have_patch (needed: $r)" + [ -f "$patch" ] || patch="$SRCDIR/patches/$CARCH/$pkgbase$p".patch + [ -f "$patch" ] || patch="$SRCDIR/patches/generic/$pkgbase$p.$pkgname".patch + [ -f "$patch" ] || patch="$SRCDIR/patches/generic/$pkgbase$p".patch + [ -f "$patch" ] || patch="no" + if [ "x$patch" != "xno" ]; then + echo "$(basename "$(dirname "$patch")")/$(basename "$patch")" + else + echo "no" fi - if [ "x$have_patch" == "xno" ]; then - patch="$SRCDIR/patches/generic/$pkgbase$p".patch - echo -n "checking for generic/$(basename "$patch") ... " - have_patch=yes - if [ ! -f "$patch" ]; then - have_patch=no - fi - echo "$have_patch (needed: $r)" - fi - ln -s "$patch" .PATCH + local ln_patch="$patch" + [ "x$patch" == "xno" ] && ln_patch="$SRCDIR/patches/generic/$pkgbase$p.patch" + ln -s "$ln_patch" .PATCH - [ "x$r" == "xyes" ] && [ "x$have_patch" == "xno" ] && return "$ERROR_MISSING" + [ "x$r" == "xyes" ] && [ "x$patch" == "xno" ] && return "$ERROR_MISSING" cp PKGBUILD{,.orig} - [ ! -e "$patch" ] || patch -Np1 -i "$patch" || return + [ "x$patch" == "xno" ] || patch -Np1 -i "$patch" || return cp PKGBUILD{,.in} # force regeneration of .SRCINFO diff --git a/src/shared/srcinfo.sh b/src/shared/srcinfo.sh index b870325..db2af59 100644 --- a/src/shared/srcinfo.sh +++ b/src/shared/srcinfo.sh @@ -35,7 +35,7 @@ srcinfo_pkgbase() { } srcinfo_pkgname() { - basename $(pwd) + basename "$(pwd)" } srcinfo_builddeps() { |