diff options
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/abs | 51 | ||||
-rwxr-xr-x | scripts/gensync | 2 | ||||
-rwxr-xr-x | scripts/makepkg | 197 | ||||
-rwxr-xr-x | scripts/makeworld | 24 | ||||
-rwxr-xr-x | scripts/pacsync | 6 |
5 files changed, 173 insertions, 107 deletions
diff --git a/scripts/abs b/scripts/abs deleted file mode 100755 index 37e39be8..00000000 --- a/scripts/abs +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/bash - -myver='2.2' -ABS_ROOT=/usr/abs - -usage() { - echo "abs $myver" - echo "usage: $0" - echo - echo "abs will synchronize PKGBUILD scripts from the CVS repository" - echo "into /usr/abs. You can follow different package trees by editing" - echo "/etc/abs/supfile.arch" - echo - exit 0 -} - -update() { - if [ ! `type -p cvsup` ]; then - echo "abs: cvsup was not found in PATH. Install cvsup" - exit 1 - fi - - if [ ! -d "$ABS_ROOT" ]; then - echo "abs: directory $ABS_ROOT does not exist" - exit 1 - fi - - if [ "`id -u`" != "0" ]; then - echo "abs: you must be root to update your ABS tree" - exit 1 - fi - - for sup in `find /etc/abs -name "supfile.*"`; do - cd $ABS_ROOT && cvsup -L 1 -r 0 -g -c .sup $sup - done -} - -for opt in "$@"; do - case $opt in - -h|--help) - usage - exit 0 ;; - *) - echo "abs: invalid option \"$opt\"" - exit 1 ;; - esac -done - -update - -exit 0 diff --git a/scripts/gensync b/scripts/gensync index 841fae8d..8c6dd320 100755 --- a/scripts/gensync +++ b/scripts/gensync @@ -1,6 +1,6 @@ #!/bin/bash -myver='2.2' +myver='2.3' usage() { echo "gensync $myver" diff --git a/scripts/makepkg b/scripts/makepkg index 7304987d..d8c3938c 100755 --- a/scripts/makepkg +++ b/scripts/makepkg @@ -1,6 +1,6 @@ #!/bin/bash -myver='2.2' +myver='2.3' startdir=`pwd` [ -f /etc/makepkg.conf ] && source /etc/makepkg.conf @@ -13,14 +13,51 @@ msg() { echo $* >&2 } +checkdeps() { + local missdep=`pacman -T $*` + local deplist="" + + missdep=`pacman -T $*` + ret=$? + if [ "$ret" != "0" ]; then + if [ "$ret" = "127" ]; then + msg "==> Missing Dependencies:" + msg "" + nl=0 + for dep in $missdep; do + echo -ne "$dep " >&2 + if [ "$nl" = "1" ]; then + nl=0 + echo -ne "\n" >&2 + # add this dep to the list + depname=`echo $dep | sed 's|=.*$||' | sed 's|>.*$||' | sed 's|<.*$||'` + deplist="$deplist $depname" + continue + fi + nl=1 + done + msg "" + else + msg "==> ERROR: pacman returned a fatal error." + exit 1 + fi + fi + echo $deplist +} + + if [ "$1" = "--help" -o "$1" = "-h" ]; then shift echo "makepkg version $myver" echo "usage: $0 [options] [build_script]" - echo "options:" - echo " -c, --clean Clean up work files after build" - echo " -i, --install Install package after successful build" - echo " -h, --help This help" + echo "options:" + echo " -c, --clean Clean up work files after build" + echo " -d, --syncdeps Install missing dependencies with pacman" + echo " -b, --builddeps Build missing dependencies from source" + echo " -n, --nodeps Skip all dependency checks" + echo " -i, --install Install package after successful build" + echo " -f, --force Overwrite existing package" + echo " -h, --help This help" echo echo " if build_script is not specified, makepkg will look for a PKGBUILD" echo " file in the current directory." @@ -28,8 +65,13 @@ if [ "$1" = "--help" -o "$1" = "-h" ]; then exit 0 fi +# Options CLEANUP=0 INSTALL=0 +DEP_BIN=0 +DEP_SRC=0 +NODEPS=0 +FORCE=0 BUILDSCRIPT="./PKGBUILD" for arg in $*; do @@ -37,9 +79,21 @@ for arg in $*; do -c|--clean) CLEANUP=1 ;; + -d|--syncdeps) + DEP_BIN=1 + ;; + -b|--builddeps) + DEP_SRC=1 + ;; + -n|--nodeps) + NODEPS=1 + ;; -i|--install) INSTALL=1 ;; + -f|--force) + FORCE=1 + ;; *) BUILDSCRIPT=$arg ;; @@ -79,35 +133,69 @@ if [ `echo $pkgrel | grep '-'` ]; then exit 1 fi -if [ `type -p pacman` ]; then +if [ -f ${pkgname}-${pkgver}-${pkgrel}.pkg.tar.gz -a "$FORCE" = "0" ]; then + msg "==> ERROR: a package has already been built. (use -f to overwrite)" + exit 1 +fi + +unset deplist +if [ `type -p pacman` -a "$NODEPS" = "0" ]; then msg "==> Checking Dependencies..." - missdep=`pacman -T ${depends[@]}` - ret=$? - if [ "$ret" != "0" ]; then - if [ "$ret" = "127" ]; then - msg "==> ERROR: Dependency Check Failed:" - msg "" - nl=0 - for dep in $missdep; do - echo -ne "$dep " >&2 - if [ "$nl" = "1" ]; then - nl=0 - echo -ne "\n" >&2 - continue + deplist=`checkdeps ${depends[@]}` + if [ "$deplist" != "" ]; then + if [ "$DEP_BIN" = "1" ]; then + # install missing deps from binary packages (using pacman -S) + msg "==> Installing missing dependencies..." + pacman -D $deplist + if [ "$?" = "127" ]; then + msg "==> ERROR: Failed to install missing dependencies." + exit 1 fi - nl=1 - done - msg "" - else - msg "==> ERROR: pacman returned a fatal error." - fi - exit 1 + # TODO: check deps again to make sure they were resolved + elif [ "$DEP_SRC" = "1" ]; then + # install missing deps by building them from source. + # we look for each package name in $ABSROOT and build it. + if [ "$ABSROOT" = "" ]; then + msg "==> ERROR: The ABSROOT environment variable is not defined." + exit 1 + fi + # TODO: handle version comparators (eg, glibc>=2.2.5) + msg "==> Building missing dependencies..." + for dep in $deplist; do + candidates=`find $ABSROOT -type d -name "$dep"` + if [ "$candidates" = "" ]; then + msg "==> ERROR: Could not find \"$dep\" under $ABSROOT" + exit 1 + fi + success=0 + for pkgdir in $candidates; do + if [ -f $pkgdir/PKGBUILD ]; then + cd $pkgdir + makepkg -i -c -b + if [ $? -eq 0 ]; then + success=1 + break + fi + fi + done + if [ "$success" = "0" ]; then + msg "==> ERROR: Failed to build \"$dep\"" + exit 1 + fi + done + # TODO: check deps again to make sure they were resolved + else + exit 1 + fi fi +elif [ "$NODEPS" = "1" ]; then + msg "==> WARNING: skipping dependency checks." else msg "==> WARNING: pacman was not found in PATH. skipping dependency checks." fi d=`date` +cd $startdir msg "==> Making package $pkgname ($d)" # extract source @@ -172,6 +260,44 @@ if [ $? -gt 0 ]; then exit 2 fi +# remove info/doc files +cd $startdir +rm -rf pkg/usr/info pkg/usr/share/info +rm -rf pkg/usr/doc pkg/usr/share/doc + +# move /usr/share/man files to /usr/man +if [ -d pkg/usr/share/man ]; then + mkdir -p pkg/usr/man + cp -a pkg/usr/share/man/* pkg/usr/man/ + rm -rf pkg/usr/share/man +fi + +# compress man pages +if [ -d pkg/usr/man ]; then + msg "==> Compressing man pages..." + for i in `find pkg/usr/man -type f`; do + ext=`echo $i | sed 's|.*\.||g'` + fn=`echo $i | sed 's|.*/||g'` + if [ "$ext" != "gz" ]; then + # update symlinks to this manpage + for ln in `find pkg/usr/man -lname "$fn"`; do + rm -f $ln + ln -sf ${fn}.gz ${ln}.gz + done + # compress the original + gzip -9 $i + fi + done +fi + + +# strip binaries +cd $startdir +msg "==> Stripping debugging symbols from libraries..." +find pkg/{,usr,usr/local,opt/*}/lib -type f -exec /usr/bin/strip --strip-debug '{}' ';' 2>&1 +msg "==> Stripping symbols from binaries..." +find pkg/{,usr,usr/local,opt/*}/{bin,sbin} -type f -exec /usr/bin/strip '{}' ';' 2>&1 + # get some package meta info builddate=`date -u "+%a %b %d %k:%M:%S %Y"` if [ "$PACKAGER" != "" ]; then @@ -210,25 +336,6 @@ if [ "$install" != "" ]; then cp $startdir/$install $startdir/pkg/._install fi -# remove info/doc files -cd $startdir -rm -rf pkg/usr/info pkg/usr/share/info -rm -rf pkg/usr/doc pkg/usr/share/doc - -# move /usr/share/man files to /usr/man -if [ -d pkg/usr/share/man ]; then - mkdir -p pkg/usr/man - cp -a pkg/usr/share/man/* pkg/usr/man/ - rm -rf pkg/usr/share/man -fi - -# strip binaries -cd $startdir -msg "==> Stripping debugging symbols from libraries..." -find pkg/{,usr,usr/local}/lib -type f -exec /usr/bin/strip --strip-debug '{}' ';' 2>&1 -msg "==> Stripping symbols from binaries..." -find pkg/{,usr,usr/local}/{bin,sbin} -type f -exec /usr/bin/strip '{}' ';' 2>&1 - # tar it up msg "==> Compressing package..." cd $startdir/pkg diff --git a/scripts/makeworld b/scripts/makeworld index 7cf04a76..4591c145 100755 --- a/scripts/makeworld +++ b/scripts/makeworld @@ -1,15 +1,19 @@ #!/bin/bash toplevel=`pwd` -version="2.2" +version="2.3" usage() { echo "makeworld version $version" echo "usage: $0 [options] <destdir> <category> [category] ..." echo "options:" - echo " -c, --clean Clean up work files after build" - echo " -i, --install Install package after successful build" - echo " -h, --help This help" + echo " -c, --clean Clean up work files after build" + echo " -d, --syncdeps Install missing dependencies with pacman" + echo " -b, --builddeps Build missing dependencies from source" + echo " -n, --nodeps Skip all dependency checks" + echo " -i, --install Install package after successful build" + echo " -f, --force Overwrite existing packages" + echo " -h, --help This help" echo echo " where <category> is one or more directory names under the ABS root" echo " eg: makeworld -c /packages base lib editors" @@ -31,6 +35,18 @@ for arg in $*; do -i|--install) MAKEPKG_OPTS="$MAKEPKG_OPTS -i" ;; + -d|--syncdeps) + MAKEPKG_OPTS="$MAKEPKG_OPTS -d" + ;; + -b|--builddeps) + MAKEPKG_OPTS="$MAKEPKG_OPTS -b" + ;; + -n|--nodeps) + MAKEPKG_OPTS="$MAKEPKG_OPTS -n" + ;; + -f|--force) + MAKEPKG_OPTS="$MAKEPKG_OPTS -f" + ;; *) dest=$arg shift diff --git a/scripts/pacsync b/scripts/pacsync deleted file mode 100755 index dd9a9ef9..00000000 --- a/scripts/pacsync +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh - -echo -echo "Pacman 2.0+ no longer comes with pacsync. Use 'pacman -S' instead." -echo " (see 'pacman -S --help' or the manpage for syntax)" -echo |