[pacman-dev] [PATCH] removedeps refactoring in makepkg and bug #6215 fix
Hi! I had some time today and decided to fix bug that was reported by myself. :-) While fixing it I also moved duplicate code into removedeps function. Here is the patch: ---[ cut here ]--- --- makepkg3.orig 2007-01-03 22:12:07.000000000 +0200 +++ makepkg3 2007-01-14 16:53:39.000000000 +0200 @@ -255,6 +255,25 @@ return $missingdeps } +removedeps() { + if [ "$RMDEPS" = "1" -a "$EUID" = "0" -a "$INFAKEROOT" != "1" -a \( ! -z "$deplist" -o ! -z "$makedeplist" \) ]; then + msg "Removing installed dependencies..." + pacman3 $PACMAN_OPTS -R $makedeplist $deplist + # fixes bug #6215 + elif [ "$RMDEPS" = "1" -a "$DEP_SUDO" = "1" -a \( ! -z "$deplist" -o ! -z "$makedeplist" \) ]; then + msg "Removing installed dependencies..." + if [ "$INFAKEROOT" = "1" ]; then + export FAKEROOTKEY2=$FAKEROOTKEY + unset $FAKEROOTKEY + fi + sudo pacman3 $PACMAN_OPTS -R $makedeplist $deplist + if [ "$INFAKEROOT" = "1" ]; then + export FAKEROOTKEY=$FAKEROOTKEY2 + unset $FAKEROOTKEY2 + fi + fi +} + usage() { echo "makepkg version $myver" echo @@ -752,21 +771,7 @@ if [ ${PIPESTATUS[0]} -gt 0 ]; then error "Build Failed. Aborting..." # fix flyspray bug #5923 - if [ "$RMDEPS" = "1" -a "$EUID" = "0" -a "$INFAKEROOT" != "1" -a \( ! -z "$deplist" -o ! -z "$makedeplist" \) ]; then - msg "Removing installed dependencies..." - pacman3 $PACMAN_OPTS -R $makedeplist $deplist - elif [ "$RMDEPS" = "1" -a "$DEP_SUDO" = "1" ]; then - msg "Removing installed dependencies..." - if [ "$INFAKEROOT" = "1" ]; then - export FAKEROOTKEY2=$FAKEROOTKEY - unset $FAKEROOTKEY - fi - sudo pacman3 $PACMAN_OPTS -R $makedeplist $deplist - if [ "$INFAKEROOT" = "1" ]; then - export FAKEROOTKEY=$FAKEROOTKEY2 - unset $FAKEROOTKEY2 - fi - fi + removedeps exit 2 fi else @@ -777,21 +782,7 @@ if [ $? -gt 0 ]; then error "Build Failed. Aborting..." # fix flyspray bug #5923 - if [ "$RMDEPS" = "1" -a "$EUID" = "0" -a "$INFAKEROOT" != "1" -a \( ! -z "$deplist" -o ! -z "$makedeplist" \) ]; then - msg "Removing installed dependencies..." - pacman3 $PACMAN_OPTS -R $makedeplist $deplist - elif [ "$RMDEPS" = "1" -a "$DEP_SUDO" = "1" ]; then - msg "Removing installed dependencies..." - if [ "$INFAKEROOT" = "1" ]; then - export FAKEROOTKEY2=$FAKEROOTKEY - unset $FAKEROOTKEY - fi - sudo pacman3 $PACMAN_OPTS -R $makedeplist $deplist - if [ "$INFAKEROOT" = "1" ]; then - export FAKEROOTKEY=$FAKEROOTKEY2 - unset $FAKEROOTKEY2 - fi - fi + removedeps exit 2 fi fi @@ -932,21 +923,7 @@ rm -rf ${pkgname}-${pkgver}-${pkgrel}-${CARCH}.log* fi -if [ "$RMDEPS" = "1" -a "$EUID" = "0" -a "$INFAKEROOT" != "1" -a \( ! -z "$deplist" -o ! -z "$makedeplist" \) ]; then - msg "Removing installed dependencies..." - pacman3 $PACMAN_OPTS -R $makedeplist $deplist -elif [ "$RMDEPS" = "1" -a "$DEP_SUDO" = "1" ]; then - msg "Removing installed dependencies..." - if [ "$INFAKEROOT" = "1" ]; then - FAKEROOTKEY2=$FAKEROOTKEY - unset FAKEROOTKEY - fi - sudo pacman3 $PACMAN_OPTS -R $makedeplist $deplist - if [ "$INFAKEROOT" = "1" ]; then - export FAKEROOTKEY=$FAKEROOTKEY2 - unset FAKEROOTKEY2 - fi -fi +removedeps msg "Finished making: $pkgname ($(date))" ---[ cut here ]--- -- Roman Kyrylych (Роман Кирилич)
I forgot to add sign off it. So here it is: Signed-off-by: Roman Kyrylych <Roman.Kyrylych@gmail.com> ---[ cut here ]--- --- makepkg3.orig 2007-01-03 22:12:07.000000000 +0200 +++ makepkg3 2007-01-14 16:53:39.000000000 +0200 @@ -255,6 +255,25 @@ return $missingdeps } +removedeps() { + if [ "$RMDEPS" = "1" -a "$EUID" = "0" -a "$INFAKEROOT" != "1" -a \( ! -z "$deplist" -o ! -z "$makedeplist" \) ]; then + msg "Removing installed dependencies..." + pacman3 $PACMAN_OPTS -R $makedeplist $deplist + # fixes bug #6215 + elif [ "$RMDEPS" = "1" -a "$DEP_SUDO" = "1" -a \( ! -z "$deplist" -o ! -z "$makedeplist" \) ]; then + msg "Removing installed dependencies..." + if [ "$INFAKEROOT" = "1" ]; then + export FAKEROOTKEY2=$FAKEROOTKEY + unset $FAKEROOTKEY + fi + sudo pacman3 $PACMAN_OPTS -R $makedeplist $deplist + if [ "$INFAKEROOT" = "1" ]; then + export FAKEROOTKEY=$FAKEROOTKEY2 + unset $FAKEROOTKEY2 + fi + fi +} + usage() { echo "makepkg version $myver" echo @@ -752,21 +771,7 @@ if [ ${PIPESTATUS[0]} -gt 0 ]; then error "Build Failed. Aborting..." # fix flyspray bug #5923 - if [ "$RMDEPS" = "1" -a "$EUID" = "0" -a "$INFAKEROOT" != "1" -a \( ! -z "$deplist" -o ! -z "$makedeplist" \) ]; then - msg "Removing installed dependencies..." - pacman3 $PACMAN_OPTS -R $makedeplist $deplist - elif [ "$RMDEPS" = "1" -a "$DEP_SUDO" = "1" ]; then - msg "Removing installed dependencies..." - if [ "$INFAKEROOT" = "1" ]; then - export FAKEROOTKEY2=$FAKEROOTKEY - unset $FAKEROOTKEY - fi - sudo pacman3 $PACMAN_OPTS -R $makedeplist $deplist - if [ "$INFAKEROOT" = "1" ]; then - export FAKEROOTKEY=$FAKEROOTKEY2 - unset $FAKEROOTKEY2 - fi - fi + removedeps exit 2 fi else @@ -777,21 +782,7 @@ if [ $? -gt 0 ]; then error "Build Failed. Aborting..." # fix flyspray bug #5923 - if [ "$RMDEPS" = "1" -a "$EUID" = "0" -a "$INFAKEROOT" != "1" -a \( ! -z "$deplist" -o ! -z "$makedeplist" \) ]; then - msg "Removing installed dependencies..." - pacman3 $PACMAN_OPTS -R $makedeplist $deplist - elif [ "$RMDEPS" = "1" -a "$DEP_SUDO" = "1" ]; then - msg "Removing installed dependencies..." - if [ "$INFAKEROOT" = "1" ]; then - export FAKEROOTKEY2=$FAKEROOTKEY - unset $FAKEROOTKEY - fi - sudo pacman3 $PACMAN_OPTS -R $makedeplist $deplist - if [ "$INFAKEROOT" = "1" ]; then - export FAKEROOTKEY=$FAKEROOTKEY2 - unset $FAKEROOTKEY2 - fi - fi + removedeps exit 2 fi fi @@ -932,21 +923,7 @@ rm -rf ${pkgname}-${pkgver}-${pkgrel}-${CARCH}.log* fi -if [ "$RMDEPS" = "1" -a "$EUID" = "0" -a "$INFAKEROOT" != "1" -a \( ! -z "$deplist" -o ! -z "$makedeplist" \) ]; then - msg "Removing installed dependencies..." - pacman3 $PACMAN_OPTS -R $makedeplist $deplist -elif [ "$RMDEPS" = "1" -a "$DEP_SUDO" = "1" ]; then - msg "Removing installed dependencies..." - if [ "$INFAKEROOT" = "1" ]; then - FAKEROOTKEY2=$FAKEROOTKEY - unset FAKEROOTKEY - fi - sudo pacman3 $PACMAN_OPTS -R $makedeplist $deplist - if [ "$INFAKEROOT" = "1" ]; then - export FAKEROOTKEY=$FAKEROOTKEY2 - unset FAKEROOTKEY2 - fi -fi +removedeps msg "Finished making: $pkgname ($(date))" ---[ cut here ]--- -- Roman Kyrylych (Роман Кирилич)
On 1/16/07, Roman Kyrylych <roman.kyrylych@gmail.com> wrote:
I forgot to add sign off it. So here it is:
Signed-off-by: Roman Kyrylych <Roman.Kyrylych@gmail.com>
Applied! Thanks!
On 1/16/07, Aaron Griffin <aaronmgriffin@gmail.com> wrote:
On 1/16/07, Roman Kyrylych <roman.kyrylych@gmail.com> wrote:
I forgot to add sign off it. So here it is:
Signed-off-by: Roman Kyrylych <Roman.Kyrylych@gmail.com>
Applied! Thanks!
Fixed a small bug with unset, and a typo in the word "dependency". One minor indent fix too. :) -p0 will work better than -p1 with this one. Signed-off-by: Dan McGee <dpmcgee@gmail.com> Index: scripts/makepkg =================================================================== RCS file: /home/cvs-pacman/pacman-lib/scripts/makepkg,v retrieving revision 1.28 diff -u -r1.28 makepkg --- scripts/makepkg 17 Jan 2007 04:54:55 -0000 1.28 +++ scripts/makepkg 17 Jan 2007 05:10:03 -0000 @@ -265,17 +265,16 @@ msg "Removing installed dependencies..." if [ "$INFAKEROOT" = "1" ]; then export FAKEROOTKEY2=$FAKEROOTKEY - unset $FAKEROOTKEY + unset FAKEROOTKEY fi sudo pacman3 $PACMAN_OPTS -R $makedeplist $deplist if [ "$INFAKEROOT" = "1" ]; then export FAKEROOTKEY=$FAKEROOTKEY2 - unset $FAKEROOTKEY2 + unset FAKEROOTKEY2 fi fi } - usage() { echo "makepkg version $myver" echo @@ -516,7 +515,7 @@ unset deplist makedeplist # fix flyspray bug #5973 if [ "$NODEPS" = "1" -o "$GENINTEG" = "1" -o "$NOBUILD" = "1" -o "$REPKG" = "1" ]; then - warning "skipping dependecy checks" + warning "skipping dependency checks" elif [ $(type -p pacman) ]; then msg "Checking Runtime Dependencies..." deplist=$(checkdeps ${depends[@]}) @@ -811,11 +810,11 @@ if [ "$ext" != "gz" -a "$ext" != "bz2" ]; then # update symlinks to this manpage find $startdir/pkg/{usr{,/local},opt/*}/man -lname "$fn" 2> /dev/null | while read ln ; do - rm -f "$ln" - ln -sf "${fn}.gz" "${ln}.gz" - done - # compress the original - gzip -9 "$i" + rm -f "$ln" + ln -sf "${fn}.gz" "${ln}.gz" + done + # compress the original + gzip -9 "$i" fi done
On 1/16/07, Dan McGee <dpmcgee@gmail.com> wrote:
Fixed a small bug with unset, and a typo in the word "dependency". One minor indent fix too. :)
-p0 will work better than -p1 with this one.
Signed-off-by: Dan McGee <dpmcgee@gmail.com>
Merged, thanks
participants (3)
-
Aaron Griffin
-
Dan McGee
-
Roman Kyrylych