[pacman-dev] [PATCH] removedeps refactoring in makepkg and bug #6215 fix
Roman Kyrylych
roman.kyrylych at gmail.com
Sun Jan 14 10:08:44 EST 2007
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 (Роман Кирилич)
More information about the pacman-dev
mailing list