--- makepkg.orig 2006-08-15 14:03:29.000000000 +0100 +++ makepkg 2006-08-15 14:05:31.000000000 +0100 @@ -248,6 +248,7 @@ echo " -r, --rmdeps Remove installed dependencies after a successful build" echo " -s, --syncdeps Install missing dependencies with pacman" echo " -S, --sudosync Install missing dependencies with pacman and sudo" + echo " -t Cache source files in " echo " -w Write package to instead of the working dir" echo echo "These options can be passed to pacman:" @@ -291,7 +292,7 @@ exit 1 ;; -*) - while getopts "bBcCdefghij:mnop:rsSw:-" opt; do + while getopts "bBcCdefghij:mnop:rsSt:w:-" opt; do case $opt in b) DEP_SRC=1 ;; B) NOCCACHE=1 ;; @@ -314,6 +315,7 @@ r) RMDEPS=1 ;; s) DEP_BIN=1 ;; S) DEP_SUDO=1 ;; + t) SRCDEST=$OPTARG ;; w) PKGDEST=$OPTARG ;; -) OPTIND=0 @@ -349,13 +351,19 @@ cd $OLDPWD if [ "$CLEANCACHE" = "1" ]; then - if [ "`id -u`" = "0" -a "$INFAKEROOT" != "1" ]; then + if [ -n "$SRCDEST" ]; then msg "Cleaning up source files from the cache." - rm -rf /var/cache/pacman/src/* + rm -rf $SRCDEST/* exit 0 else - error "You must be root to clean the cache." - exit 1 + if [ "`id -u`" = "0" -a "$INFAKEROOT" != "1" ]; then + msg "Cleaning up source files from the cache." + rm -rf /var/cache/pacman/src/* + exit 0 + else + error "You must be root to clean the cache." + exit 1 + fi fi fi @@ -457,6 +465,9 @@ if [ -f ../$file ]; then msg " Found $file in build dir" cp ../$file . + elif [ -f $SRCDEST/$file ]; then + msg " Using local copy of $file" + cp $SRCDEST/$file . elif [ -f /var/cache/pacman/src/$file ]; then msg " Using local copy of $file" cp /var/cache/pacman/src/$file . @@ -486,7 +497,9 @@ msg "Aborting..." exit 1 fi - if [ "`id -u`" = "0" -a "$INFAKEROOT" != "1" ]; then + if [ -n "$SRCDEST" ]; then + mkdir -p $SRCDEST && cp $file $SRCDEST + elif [ "`id -u`" = "0" -a "$INFAKEROOT" != "1" ]; then mkdir -p /var/cache/pacman/src && cp $file /var/cache/pacman/src else cp $file ..