[pacman-dev] My makepkg changes/updates
Last email of the day, hopefully. Here is my current diff on makepkg, not really meant to be applied in its current state but at least letting you know what I am working on and hopefully I can get some feedback out of it. I'll make a cleaner diff in a few days and hopefully this script will start to look a little better. 1. Adds --repackage option and $REPKG variable, should be noted by a comment in the code. The diff does some weird things where I had to indent a whole big block of code, so I'd recommend just trying to look at it as a whole at that part (basically the whole 'build' section). 2. Adds and removes blank lines to be more consistent, or maybe just more for my own readability. Also adds a description of makepkg. 3. Removes keepdocs and nostrip options (on the command line). 4. Removes hardcoded references to /var/cache/pacman/src. 5. Fixes a syntax warning in the architecture detection. 6. Adds a missing / in the cp statement for source file copying. 7. Lets you see my scattered/random TODOs throughout the code. -Dan --- pacman-lib.orig/scripts/makepkg 2006-12-20 21:30:06.000000000 -0500 +++ pacman-lib/scripts/makepkg 2006-12-20 22:19:46.000000000 -0500 @@ -1,6 +1,6 @@ #!/bin/bash # -# makepkg +# makepkg - make packages compatable for use with pacman # # Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org> # Copyright (c) 2005 by Aurelien Foret <orelien@chez.com> @@ -44,19 +44,21 @@ FORCE=0 GENINTEG=0 INSTALL=0 -DOWNLOAD="" NOBUILD=0 NODEPS=0 NOEXTRACT=0 RMDEPS=0 +REPKG=0 LOGGING=0 PACMAN_OPTS= -INFAKEROOT= +# determine if we are running with fakeroot if [ "$1" = "-F" ]; then INFAKEROOT=1 shift +else + INFAKEROOT=0 fi ### SUBROUTINES ### @@ -68,6 +70,7 @@ echo " $1" >&2 fi } + msg() { if [ "$USE_COLOR" = "Y" -o "$USE_COLOR" = "y" ]; then echo -e "\033[1;32m==>\033[1;0m \033[1;1m$1\033[1;0m" >&2 @@ -91,6 +94,7 @@ echo "==> WARNING: $1" >&2 fi } + error() { if [ "$USE_COLOR" = "Y" -o "$USE_COLOR" = "y" ]; then echo -e "\033[1;31m==> ERROR:\033[1;0m \033[1;1m$1\033[1;0m" >&2 @@ -239,6 +243,7 @@ fi missingdeps=1 fi + # rerun any additional sh scripts found in /etc/profile.d/ for i in /etc/profile.d/*.sh do @@ -246,8 +251,6 @@ . $i &>/dev/null fi done - # some applications (eg, blackbox) will not build with some languages - unset LC_ALL LANG return $missingdeps } @@ -269,18 +272,15 @@ echo " -h, --help This help" echo " -i, --install Install package after successful build" echo " -j <jobs> Set MAKEFLAGS to \"-j<jobs>\" before building" - echo " -k, --keepdocs Keep doc and info directories" echo " -L, --log Log package build process" echo " -m, --nocolor Disable colorized output messages" - echo " -n, --nostrip Do not strip symbols from binaries/libraries" echo " -o, --nobuild Download and extract files only" echo " -p <buildscript> Use an alternate build script (instead of '$BUILDSCRIPT')" echo " -r, --rmdeps Remove installed dependencies after a successful build" + # fix flyspray feature request #2978 + echo " -R, --repackage Repackage contents of $startdir/pkg without building" echo " -s, --syncdeps Install missing dependencies with pacman" echo " -S, --sudosync Install missing dependencies with pacman and sudo" - # fix flyspray feature request #5223 - Dan McGee <dpmcgee@gmail.com> - echo " -t <sourcedir> Cache source files in <sourcedir>" - echo " -w <destdir> Write package to <destdir> instead of the working dir" echo echo "These options can be passed to pacman:" echo @@ -294,15 +294,12 @@ ARGLIST=$@ if [ -f /etc/makepkg.conf ]; then - source /etc/makepkg.conf + source /etc/makepkg3.conf else - error "/etc/makepkg.conf not found. cannot continue" + error "/etc/makepkg3.conf not found. Cannot continue." exit 1 fi -#Let's be courteous and support frugalware's extensions -[ -e /usr/lib/frugalware/fwmakepkg ] && . /usr/lib/frugalware/fwmakepkg - while [ "$#" -ne "0" ]; do case $1 in # pacman @@ -319,12 +316,11 @@ --noextract) NOEXTRACT=1 ;; --install) INSTALL=1 ;; --force) FORCE=1 ;; - --keepdocs) KEEPDOCS=1 ;; - --nostrip) NOSTRIP=1 ;; --nobuild) NOBUILD=1 ;; --nocolor) USE_COLOR="n" ;; --geninteg) GENINTEG=1 ;; --rmdeps) RMDEPS=1 ;; + --repackage) REPKG=1 ;; --log) LOGGING=1 ;; --help) usage @@ -335,7 +331,7 @@ exit 1 ;; -*) - while getopts "bBcCdefghij:kLmnop:rsSt:w:-" opt; do + while getopts "bBcCdefghij:Lmop:rRsS-" opt; do case $opt in b) DEP_SRC=1 ;; B) USE_CCACHE=0 ;; @@ -346,30 +342,27 @@ f) FORCE=1 ;; g) GENINTEG=1 ;; h) - usage - exit 0 - ;; + usage + exit 0 + ;; i) INSTALL=1 ;; j) export MAKEFLAGS="-j$OPTARG" ;; - k) KEEPDOCS=1 ;; L) LOGGING=1 ;; m) USE_COLOR="n" ;; - n) NOSTRIP=1 ;; o) NOBUILD=1 ;; p) BUILDSCRIPT=$OPTARG ;; r) RMDEPS=1 ;; + R) REPKG=1 ;; s) DEP_BIN=1 ;; S) DEP_SUDO=1 ;; - t) SRCDEST=$OPTARG ;; - w) PKGDEST=$OPTARG ;; -) - OPTIND=0 - break - ;; + OPTIND=0 + break + ;; *) - usage - exit 1 - ;; + usage + exit 1 + ;; esac done ;; @@ -386,6 +379,7 @@ exit 1 fi +#TODO: is this necessary? # convert a (possibly) relative path to absolute cd $PKGDEST 2>/dev/null if [ $? -ne 0 ]; then @@ -396,20 +390,18 @@ cd $OLDPWD if [ "$CLEANCACHE" = "1" ]; then + # fix flyspray feature request #5223 if [ -n "$SRCDEST" ]; then msg "Cleaning up source files from the cache." - rm -rf /var/cache/pacman/src/* - rm -rf "${SRCDEST}"/* - exit 0 - else - if [ "$EUID" = "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." + rm -rf "$SRCDEST"/* + if [ $? -ne 0 ]; then + error "Problem removing files; you may not have correct permissions in $SRCDEST" exit 1 + else + exit 0 fi + else + error "Source destination must be defined in makepkg.conf." fi fi @@ -452,7 +444,7 @@ error "pkgrel is not allowed to contain hyphens." exit 1 fi -if ! in_array $CARCH ${arch[@]}; then +if [ ! "in_array $CARCH ${arch[@]}" ]; then error "$pkgname is not available for the '$CARCH' architecture." plain "Note that many packages may need a line added to their $BUILDSCRIPT" plain "such as arch=('$CARCH')." @@ -504,7 +496,7 @@ msg "Making package: $pkgname $pkgver-$pkgrel ($(date))" unset deplist makedeplist -# fix flyspray bug #5973 - Dan McGee <dpmcgee@gmail.com> +# fix flyspray bug #5973 if [ $(type -p pacman) -a "$NODEPS" = "0" -a "$GENINTEG" = "0" -a "$NOBUILD" = "0" ]; then msg "Checking Runtime Dependencies..." deplist=$(checkdeps ${depends[@]}) @@ -524,7 +516,9 @@ if [ $? -gt 0 ]; then exit 1 fi -elif [ "$NODEPS" = "1" -o "$GENINTEG" = "1" -o "$NOBUILD" = "1" ]; then +elif [ "$GENINTEG" = "1" -o "$NOBUILD" = "1" ]; then + msg "skipping dependency checks." +elif [ "$NODEPS" = "1" ]; then warning "skipping dependency checks." else warning "pacman was not found in PATH. skipping dependency checks." @@ -537,16 +531,13 @@ mkdir -p src cd $startdir/src for netfile in ${source[@]}; do - file=$(strip_url $netfile) + file=$(strip_url "$netfile") if [ -f "../$file" ]; then - msg " Found $file in build dir" + msg2 "Found $file in build dir" cp "../$file" . elif [ -f "$SRCDEST/$file" ]; then - msg " Using cached copy of $file" - cp "$SRCDEST$file" . - elif [ -f "/var/cache/pacman/src/$file" ]; then - msg " Using cached copy of $file" - cp "/var/cache/pacman/src/$file" . + msg2 "Using cached copy of $file" + cp "$SRCDEST/$file" . else # check for a download utility if [ -z "$FTPAGENT" ]; then @@ -566,33 +557,28 @@ msg "Aborting..." exit 1 fi - msg " Downloading $file" + msg2 "Downloading $file" $FTPAGENT "$netfile" 2>&1 # fix flyspray bug #3289 ftpret=$? if [ $ftpret -gt 0 ]; then error "Failure while downloading $file" msg "Aborting..." - rm "$file" - exit 1 + #rm "$file" exit 1 fi - if [ "$EUID" = "0" -a "$INFAKEROOT" != "1" ]; then - mkdir -p /var/cache/pacman/src && cp $file /var/cache/pacman/src - if [ -n "$SRCDEST" ]; then - mkdir -p $SRCDEST && cp "$file" $SRCDEST - elif [ "$EUID" = "0" -a "$INFAKEROOT" != "1" ]; then - mkdir -p /var/cache/pacman/src && cp "$file" /var/cache/pacman/src - else + if [ -n "$SRCDEST" ]; then + mkdir -p $SRCDEST && cp "$file" $SRCDEST + if [ $? -ne 0 ]; then + warning "You do not have correct permissions to cache source in $SRCDEST" cp "$file" .. - fi + else + cp "$file" .. fi fi done - - -if [ "$NOEXTRACT" = "1" ]; then +if [ "$NOEXTRACT" = "1" -o "$REPKG" = "1" ]; then warning "Skipping source integrity checks -- using existing src/ tree" else for integ in ${INTEGRITY_CHECK[@]}; do @@ -635,7 +621,7 @@ fi done plain "" - #Validate integrity checks + #Validate integrity checks else integrity_sums=($(eval echo \${${integrity_name}s[@]})) @@ -645,6 +631,7 @@ idx=0 for netfile in "${source[@]}"; do file=$(strip_url "$netfile") + #TODO is there a reason this is echo and not msg/msg2? echo -n " $file ... " >&2 echo "${integrity_sums[$idx]} $file" | $integrity_name -c -
/dev/null 2>&1 if [ $? -ne 0 ]; then @@ -671,8 +658,8 @@ fi
#Extract sources -if [ "$NOEXTRACT" = "1" ]; then - warning "Skipping source extraction -- using existing src/ tree" +if [ "$NOEXTRACT" = "1" -o "$REPKG" = "1" ]; then + warning "Skipping source extraction -- using existing src/ tree" else msg "Extracting Sources..." for netfile in "${source[@]}"; do @@ -699,7 +686,7 @@ cmd="bunzip2 -f $file" ;; esac if [ "$cmd" != "" ]; then - msg " $cmd" + msg2 "$cmd" $cmd if [ $? -ne 0 ]; then # unzip will return a 1 as a warning, it is not an error @@ -713,71 +700,73 @@ done fi -if [ "$EUID" = "0" ]; then - # chown all source files to root.root - chown -R root.root $startdir/src -fi - -# check for existing pkg directory -if [ -d $startdir/pkg ]; then - msg "Removing existing pkg/ directory..." - rm -rf $startdir/pkg -fi -mkdir -p $startdir/pkg - -if [ "$NOBUILD" = "1" ]; then - msg "Sources are ready." - exit 0 -fi - -# use distcc if requested -if [ "$USE_DISTCC" = "y" ]; then - [ -d /usr/lib/distcc/bin ] && export PATH=/usr/lib/distcc/bin:$PATH -fi - -# use ccache if it's available -if [ "$USE_CCACHE" = "1" ]; then - [ -d /usr/lib/ccache/bin ] && export PATH=/usr/lib/ccache/bin:$PATH -fi - -# build -msg "Starting build()..." +if [ "$REPKG" = "0" ]; then + if [ "$EUID" = "0" ]; then + # chown all source files to root.root + chown -R root.root $startdir/src + fi -#check for "exit on syntax error" shell option -echo $SHELLOPTS | grep errexit 2>&1 >/dev/null -set_e=$? + # check for existing pkg directory + if [ -d $startdir/pkg ]; then + msg "Removing existing pkg/ directory..." + rm -rf $startdir/pkg + fi + mkdir -p $startdir/pkg -if [ "$LOGGING" = "1" ]; then - BUILDLOG="${startdir}/${pkgname}-${pkgver}-${pkgrel}-${CARCH}.log" - if [ -f "$BUILDLOG" ]; then - i=1 - while true; do - if [ -f "$BUILDLOG.$i" ]; then - i=$(($i +1)) - else - break - fi - done - mv "$BUILDLOG" "$BUILDLOG.$i" + if [ "$NOBUILD" = "1" ]; then + msg "Sources are ready." + exit 0 fi - #use 'errexit' to bail on syntax error - [ $set_e -eq 1 ] && set -e - build 2>&1 | tee "$BUILDLOG" - [ $set_e -eq 1 ] && set +e + # use distcc if requested + if [ "$USE_DISTCC" = "y" ]; then + [ -d /usr/lib/distcc/bin ] && export PATH=/usr/lib/distcc/bin:$PATH + fi + + # use ccache if it's available + if [ "x$USE_CCACHE" = "1" ]; then + [ -d /usr/lib/ccache/bin ] && export PATH=/usr/lib/ccache/bin:$PATH + fi + + # build + msg "Starting build()..." + + #check for "exit on syntax error" shell option + echo $SHELLOPTS | grep errexit 2>&1 >/dev/null + set_e=$? + + if [ "x$LOGGING" = "1" ]; then + BUILDLOG="${startdir}/${pkgname}-${pkgver}-${pkgrel}-${CARCH}.log" + if [ -f "$BUILDLOG" ]; then + i=1 + while true; do + if [ -f "$BUILDLOG.$i" ]; then + i=$( ($i +1)) + else + break + fi + done + mv "$BUILDLOG" "$BUILDLOG.$i" + fi - if [ ${PIPESTATUS[0]} -gt 0 ]; then - error "Build Failed. Aborting..." - exit 2 - fi -else - #use 'errexit' to bail on syntax error - [ $set_e -eq 1 ] && set -e - build 2>&1 - [ $set_e -eq 1 ] && set +e - if [ $? -gt 0 ]; then - error "Build Failed. Aborting..." - exit 2 + #use 'errexit' to bail on syntax error + [ $set_e -eq 1 ] && set -e + build 2>&1 | tee "$BUILDLOG" + [ $set_e -eq 1 ] && set +e + + if [ ${PIPESTATUS[0]} -gt 0 ]; then + error "Build Failed. Aborting..." + exit 2 + fi + else + #use 'errexit' to bail on syntax error + [ $set_e -eq 1 ] && set -e + build 2>&1 + [ $set_e -eq 1 ] && set +e + if [ $? -gt 0 ]; then + error "Build Failed. Aborting..." + exit 2 + fi fi fi @@ -788,6 +777,8 @@ rm -rf pkg/usr/info pkg/usr/share/info rm -rf pkg/usr/doc pkg/usr/share/doc rm -rf pkg/{usr,opt/gnome}/share/gtk-doc + # fix flyspray bug #5021 + #rm -rf ${DOC_DIRS[@]} fi # move /usr/share/man files to /usr/man
2006/12/21, Dan McGee <dpmcgee@gmail.com>:
Last email of the day, hopefully. Here is my current diff on makepkg, not really meant to be applied in its current state but at least letting you know what I am working on and hopefully I can get some feedback out of it. I'll make a cleaner diff in a few days and hopefully this script will start to look a little better.
1. Adds --repackage option and $REPKG variable, should be noted by a comment in the code. The diff does some weird things where I had to indent a whole big block of code, so I'd recommend just trying to look at it as a whole at that part (basically the whole 'build' section). 2. Adds and removes blank lines to be more consistent, or maybe just more for my own readability. Also adds a description of makepkg. 3. Removes keepdocs and nostrip options (on the command line). 4. Removes hardcoded references to /var/cache/pacman/src. 5. Fixes a syntax warning in the architecture detection. 6. Adds a missing / in the cp statement for source file copying. 7. Lets you see my scattered/random TODOs throughout the code.
Nice work! Few questions: 1) Why you have changed /etc/makepkg.conf to /etc/makepkg3.conf ? I don't see the point of this. Even when there are two versions of makepkg in system - they should work with one makepkg.conf as there are no confliction options anyway. 2) what's the difference between msg and msg2 (except colors, I mean whet is the use for both of them) ? And suggestions: 1) it would be nice if makepkg -Sr (-sr) uninstall makedepends after build failure too 2) something like --preclean option that would clean directory like --clean but _before_ build - useful for some software that won't build after failure when files not cleaned. -- Roman Kyrylych (Роман Кирилич)
Nice work! Few questions: 1) Why you have changed /etc/makepkg.conf to /etc/makepkg3.conf ? I don't see the point of this. Even when there are two versions of makepkg in system - they should work with one makepkg.conf as there are no confliction options anyway. That is because I have them installed side-by-side, and I just kept everything in my diff. It won't be that way in any release version. This new makepkg (makpkg3) does have a few different settings, and this way also allows me to play with settings without changing my real makepkg settings.
2) what's the difference between msg and msg2 (except colors, I mean whet is the use for both of them) ? msg is the standard message that has always been used. Aaron, I believe, added a msg2, so I thought I'd put it to good use. It is further indented than a message; think of it more as a 'sub-message', just expanding on a more important message above it. I applied it to any of the messages that were formally indented using hardcoded spaces.
And suggestions: 1) it would be nice if makepkg -Sr (-sr) uninstall makedepends after build failure too That is one of the next things I have to look at, and that will likely involve a bit more changes than my other patches have been/will have been.
2) something like --preclean option that would clean directory like --clean but _before_ build - useful for some software that won't build after failure when files not cleaned. You may need to explain this one more to me. The pkg/ directory is always deleted before a build; are you referring to the src/ directory? In any case, I'm not sure if this needs to be an option, as most users would know what 'rm -rf src/' would do, but correct me if I'm mistaken.
Hi, On Thu, Dec 21, 2006 at 10:22:21AM -0500, Dan McGee wrote:
Nice work! Few questions: 1) Why you have changed /etc/makepkg.conf to /etc/makepkg3.conf ? I don't see the point of this. Even when there are two versions of makepkg in system - they should work with one makepkg.conf as there are no confliction options anyway.
I like the idea of user-specific setting: Source ~/.makepkg.conf after the system wide configuration, like: if [ -f ~/.makepkg.conf ]; then source ~/.makepkg.conf fi This would allow multiple developers on one SYSTEM customize settings. Jürgen
I like the idea of user-specific setting: Source ~/.makepkg.conf after the system wide configuration [snip] I like the idea, locally patched and I'll submit it with some other changes. -Dan
2006/12/21, Dan McGee <dpmcgee@gmail.com>:
2) something like --preclean option that would clean directory like --clean but _before_ build - useful for some software that won't build after failure when files not cleaned. You may need to explain this one more to me. The pkg/ directory is always deleted before a build; are you referring to the src/ directory? In any case, I'm not sure if this needs to be an option, as most users would know what 'rm -rf src/' would do, but correct me if I'm mistaken.
Yes, I mean src, and IIRC filelist is not deleted too. Anyway, that's not critical. Nevermind. -- Roman Kyrylych (Роман Кирилич)
On 12/20/06, Dan McGee <dpmcgee@gmail.com> wrote:
Last email of the day, hopefully. Here is my current diff on makepkg,
Applied what you have. As well as Jürgen's change. Re: a few things
+#TODO: is this necessary? # convert a (possibly) relative path to absolute cd $PKGDEST 2>/dev/null No idea... I left that in there
+#TODO is there a reason this is echo and not msg/msg2? echo -n " $file ... " >&2 Yes, because msg/msg2 don't accept/use the -n option
I like the idea of removing _package specific_ options from command line params. If you can change it in the PKGBUILD file, it doesn't really need a command line option - so good call. I also agree with the removal of command line srcdest/pkgdest... the usage of it doesn't make sense to me... I don't know when someone would want one specific package in an odd place. Anyway, I applied this by hand as I don't have sophisticated patching stuff at work (haven't installed cygwin yet) and it lets me see what you are doing in alot of it. So, if I did break something by doing this, let me know.
I'm checking to see if stuff broke now...because I now see my local script won't run. Oops. :) Thanks for the clarifications on the echo. I think that $PKGDEST check can go now if we eliminate the options for command line destination of the package. I killed it in my local copy, and it is in the patch below to fix small mistakes you made while patching. The patch has some indentation changes after you reformatted it with tabs, makes for easier reading; vim got confused with some of the do loops and case statements. It also fixes a few minor typos found, and makes my --repackage stuff a bit more clear. It is pretty straightforward and a lot shorter than that last one. -Dan --- pacman-lib.orig/scripts/makepkg 2006-12-21 12:52:59.000000000 -0500 +++ pacman-lib/scripts/makepkg 2006-12-21 13:11:02.000000000 -0500 @@ -293,16 +293,17 @@ ARGLIST=$@ +#source makepkg.conf; fail if it is not found if [ -f /etc/makepkg.conf ]; then source /etc/makepkg.conf else - error "/etc/makepkg.conf not found. cannot continue" + error "/etc/makepkg.conf not found. Cannot continue." exit 1 fi #Source user-specific makepkg.conf overrides if [ -f ~/.makepkg.conf ]; then - source ~/.makepkg.conf + source ~/.makepkg.conf fi while [ "$#" -ne "0" ]; do @@ -328,13 +329,13 @@ --repackage) REPKG=1 ;; --log) LOGGING=1 ;; --help) - usage - exit 0 - ;; + usage + exit 0 + ;; --*) - usage - exit 1 - ;; + usage + exit 1 + ;; -*) while getopts "bBcCdefghij:Lmop:rRsS-" opt; do case $opt in @@ -384,21 +385,11 @@ exit 1 fi -# TODO: is this necessary? -# convert a (possibly) relative path to absolute -cd $PKGDEST 2>/dev/null -if [ $? -ne 0 ]; then - error "Package destination directory does not exist or permission denied." - exit 1 -fi -PKGDEST=$(pwd) -cd $OLDPWD - if [ "$CLEANCACHE" = "1" ]; then #fix flyspray feature request #5223 if [ -n "$SRCDEST" ]; then msg "Cleaning up source files from the cache." - rm -rf "$SRCDEST"/* + rm -rf "$SRCDEST/*" if [ $? -ne 0 ]; then error "Problem removing files; you may not have correct permissions in $SRCDEST" exit 1 @@ -450,7 +441,7 @@ error "pkgrel is not allowed to contain hyphens." exit 1 fi -if [ ! in_array $CARCH ${arch[@]}]; then +if [ ! in_array $CARCH ${arch[@]} ]; then error "$pkgname is not available for the '$CARCH' architecture." plain "Note that many packages may need a line added to their $BUILDSCRIPT" plain "such as arch=('$CARCH')." @@ -503,7 +494,9 @@ unset deplist makedeplist # fix flyspray bug #5973 -if [ $(type -p pacman) -a "$NODEPS" = "0" -a "$GENINTEG" = "0" -a "$NOBUILD" = "0" ]; then +if [ "$NODEPS" = "1" -o "$GENINTEG" = "1" -o "$NOBUILD" = "1" -o "$REPKG" = "1" ]; then + warning "skipping dependency checks." +elif [ $(type -p pacman) ]; then msg "Checking Runtime Dependencies..." deplist=$(checkdeps ${depends[@]}) handledeps $deplist @@ -522,10 +515,6 @@ if [ $? -gt 0 ]; then exit 1 fi -elif [ "$GENINTEG" = "1" -o "$NOBUILD" = "1" ]; then - msg "skipping dependency checks." -elif [ "$NODEPS" = "1" ]; then - warning "skipping dependency checks." else warning "pacman was not found in PATH. skipping dependency checks." fi @@ -585,7 +574,7 @@ fi done -if [ "$NOEXTRACT" = "1" -o "$REPKG" ]; then +if [ "$NOEXTRACT" = "1" -o "$REPKG" = "1" ]; then warning "Skipping source integrity checks -- using existing src/ tree" else for integ in ${INTEGRITY_CHECK[@]}; do @@ -704,14 +693,18 @@ fi fi done -fi - -if [ "$REPKG" = "0" ]; then if [ "$EUID" = "0" ]; then # chown all source files to root.root chown -R root.root $startdir/src fi +fi +if [ "$NOBUILD" = "1" ]; then + msg "Sources are ready." + exit 0 +elif [ "$REPKG" = "1" ]; then + warning "Skipping build -- using existing pkg/ tree" +else # check for existing pkg directory if [ -d $startdir/pkg ]; then msg "Removing existing pkg/ directory..." @@ -719,11 +712,6 @@ fi mkdir -p $startdir/pkg - if [ "$NOBUILD" = "1" ]; then - msg "Sources are ready." - exit 0 - fi - # use distcc if requested if [ "$USE_DISTCC" = "y" ]; then [ -d /usr/lib/distcc/bin ] && export PATH=/usr/lib/distcc/bin:$PATH @@ -794,23 +782,23 @@ # compress man pages msg "Compressing man pages..." find $startdir/pkg/{usr{,/local},opt/*}/man -type f 2>/dev/null | while read i ; do -ext="${i##*.}" -fn="${i##*/}" -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" + ext="${i##*.}" + fn="${i##*/}" + 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" fi done cd $startdir # strip binaries -if [ ! "$(check_option NOSTRIP)" -a "$NOSTIP" = "0" ]; then +if [ ! "$(check_option NOSTRIP)" -a "$NOSTRIP" = "0" ]; then msg "Stripping debugging symbols from libraries..." find pkg/{,usr,usr/local,opt/*}/lib -type f -not -name "*.dll" -not -name "*.exe" \ -exec /usr/bin/strip --strip-debug '{}' \; 2>&1 \
Done and done One note: On 12/21/06, Dan McGee <dpmcgee@gmail.com> wrote:
- rm -rf "$SRCDEST"/* + rm -rf "$SRCDEST/*"
This won't glob anymore. It will try to remove a literal file named "*" e.g. $ mkdir "a b" $ touch "a b/foo" $ ls "a b/*" ls: cannot access a b/*: No such file or directory $ ls "a b"/* a b/foo
One note: On 12/21/06, Dan McGee <dpmcgee@gmail.com> wrote:
- rm -rf "$SRCDEST"/* + rm -rf "$SRCDEST/*"
This won't glob anymore. It will try to remove a literal file named "*" ahh, quite correct.
Final patch, fixes small issues: $ cat diff234pm.diff Index: makepkg =================================================================== RCS file: /home/cvs-pacman/pacman-lib/scripts/makepkg,v retrieving revision 1.24 diff -u -u -r1.24 makepkg --- makepkg 21 Dec 2006 19:11:22 -0000 1.24 +++ makepkg 21 Dec 2006 19:34:08 -0000 @@ -293,7 +293,7 @@ ARGLIST=$@ -#Source user-specific makepkg.conf overrides +#Source makepkg.conf; fail if it is not found if [ -f /etc/makepkg.conf ]; then source /etc/makepkg.conf else @@ -303,7 +303,7 @@ #Source user-specific makepkg.conf overrides if [ -f ~/.makepkg.conf ]; then - source ~/.makepkg.conf + source ~/.makepkg.conf fi while [ "$#" -ne "0" ]; do @@ -494,8 +494,8 @@ unset deplist makedeplist # fix flyspray bug #5973 -if [ "$NODEPS" = "1" -o "$GENINTEG" = "1" -o "$NOBUILD" = "1" ]; then - warning "skipping dependecy checks" +if [ "$NODEPS" = "1" -o "$GENINTEG" = "1" -o "$NOBUILD" = "1" -o "$REPKG" = "1" ]; then + warning "skipping dependency checks" elif [ $(type -p pacman) ]; then msg "Checking Runtime Dependencies..." deplist=$(checkdeps ${depends[@]})
On 12/21/06, Dan McGee <dpmcgee@gmail.com> wrote:
Final patch, fixes small issues:
Tada! Thanks man, you're awesome
FYI, and I think it is quicker to fix by hand than submit a patch- you left the + sign on one of the new lines in makepkg.conf.in (the DOC_DIRS stuff). -Dan
participants (4)
-
Aaron Griffin
-
Dan McGee
-
Jürgen Hötzel
-
Roman Kyrylych