diff options
author | Judd Vinet <judd@archlinux.org> | 2006-02-03 00:39:53 +0100 |
---|---|---|
committer | Judd Vinet <judd@archlinux.org> | 2006-02-03 00:39:53 +0100 |
commit | ec1fc664c9e806b1850a637336ad7c56a8931962 (patch) | |
tree | 36edf5ffc492d188b2149d465faa7f39b9d32ec0 /scripts | |
parent | 1bcc87c3feb41dc8004c3d600e3a3501a4060b44 (diff) | |
download | pacman-ec1fc664c9e806b1850a637336ad7c56a8931962.tar.gz pacman-ec1fc664c9e806b1850a637336ad7c56a8931962.tar.xz |
Imported from pacman-2.9.8.tar.gz
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/aurbuild | 24 | ||||
-rwxr-xr-x | scripts/gensync | 36 | ||||
-rwxr-xr-x | scripts/makepkg | 137 | ||||
-rwxr-xr-x | scripts/makeworld | 25 | ||||
-rwxr-xr-x | scripts/pacman-optimize | 8 | ||||
-rwxr-xr-x | scripts/updatesync | 37 |
6 files changed, 192 insertions, 75 deletions
diff --git a/scripts/aurbuild b/scripts/aurbuild new file mode 100755 index 00000000..02346d8d --- /dev/null +++ b/scripts/aurbuild @@ -0,0 +1,24 @@ +#!/bin/bash + +die() { + echo $* + exit 1 +} + +if [ "$1" == "" ]; then + echo "usage: aurbuild <package_name>" + echo + exit 1 +fi +pkgname=$1 +[ -d $pkgname ] && die "Directory '$pkgname' already exists" +[ -f $pkgname ] && die "File '$pkgname' already exists" + +echo "Downloading $pkgname.tar.gz" +wget -q http://aur.archlinux.org/packages/$pkgname/$pkgname.tar.gz || die "Failed to fetch $1.pkg.tar.gz" + +tar zxf $pkgname.tar.gz || die "Extraction failed" +rm -f $pkgname.tar.gz +cd $pkgname || die "Failed to cwd" +makepkg + diff --git a/scripts/gensync b/scripts/gensync index 3cfcbcaa..b80367f3 100755 --- a/scripts/gensync +++ b/scripts/gensync @@ -2,7 +2,7 @@ # # gensync # -# Copyright (c) 2002-2005 by Judd Vinet <jvinet@zeroflux.org> +# Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org> # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -20,7 +20,7 @@ # USA. # -myver='2.9.7' +myver='2.9.8' usage() { echo "gensync $myver" @@ -51,6 +51,18 @@ die() { exit 1 } +check_option() { + local i + for i in ${options[@]}; do + local uc=`echo $i | tr [:lower:] [:upper:]` + local lc=`echo $i | tr [:upper:] [:lower:]` + if [ "$uc" = "$1" -o "$lc" = "$1" ]; then + echo $1 + return + fi + done +} + get_md5checksum() { if [ "$pkgdir" != "" ]; then @@ -69,7 +81,7 @@ get_md5checksum() db_write_entry() { unset pkgname pkgver pkgrel pkgdesc force - unset groups replaces provides depends conflicts + unset groups replaces provides depends conflicts options source $1 || return 1 cd $gstmpdir mkdir $pkgname-$pkgver-$pkgrel || return 1 @@ -107,7 +119,7 @@ db_write_entry() done echo "" >>desc fi - if [ "$force" = "y" -o "$force" = "Y" ]; then + if [ "$force" = "y" -o "$force" = "Y" -o "`check_option FORCE`" ]; then echo "%FORCE%" >>desc echo "" >>desc fi @@ -140,7 +152,7 @@ db_write_entry() if [ $# -lt 2 ]; then usage - exit 0 + exit 1 fi if [ "$1" = "-h" -o "$1" = "--help" ]; then @@ -169,12 +181,14 @@ for file in `find $rootdir/* -name PKGBUILD`; do else pkgfile="$destdir/$pkgname-$pkgver-$pkgrel.pkg.tar.gz" fi - [ -f $pkgfile ] || die "missing package file: $pkgfile" - csize=`du -b $pkgfile | cut -f1` - pkgmd5sum=`get_md5checksum $pkgfile` - [ -z $pkgmd5sum ] && die "error generating checksum for $pkgfile" - db_write_entry $file - [ $? -gt 0 ] && die "error writing entry for $file" + if [ -f $pkgfile ]; then + csize=`du -b $pkgfile | cut -f1` + pkgmd5sum=`get_md5checksum $pkgfile` + [ -z $pkgmd5sum ] && die "error generating checksum for $pkgfile" + db_write_entry $file || die "error writing entry for $file" + else + echo "gensync: missing package: $pkgfile" >&2 + fi done echo "gensync: compressing to $destfile..." >&2 diff --git a/scripts/makepkg b/scripts/makepkg index 6b578524..7ef28e54 100755 --- a/scripts/makepkg +++ b/scripts/makepkg @@ -2,7 +2,7 @@ # # makepkg # -# Copyright (c) 2002-2005 by Judd Vinet <jvinet@zeroflux.org> +# Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org> # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -20,11 +20,31 @@ # USA. # -myver='2.9.7' +myver='2.9.8' startdir=`pwd` PKGDEST=$startdir USE_COLOR="n" +# Options +BUILDSCRIPT="./PKGBUILD" +CLEANUP=0 +CLEANCACHE=0 +DEP_BIN=0 +DEP_SRC=0 +DEP_SUDO=0 +FORCE=0 +GENMD5=0 +INSTALL=0 +KEEPDOCS=0 +NOBUILD=0 +NOCCACHE=0 +NODEPS=0 +NOEXTRACT=0 +NOSTRIP=0 +RMDEPS=0 + +PACMAN_OPTS= + # source Arch's abs.conf if it's present [ -f /etc/abs/abs.conf ] && source /etc/abs/abs.conf @@ -72,11 +92,25 @@ strip_url() { echo $1 | sed 's|^.*://.*/||g' } +check_option() { + local i + for i in ${options[@]}; do + local uc=`echo $i | tr [:lower:] [:upper:]` + local lc=`echo $i | tr [:upper:] [:lower:]` + if [ "$uc" = "$1" -o "$lc" = "$1" ]; then + echo $1 + return + fi + done +} + checkdeps() { local missdep="" local deplist="" - missdep=`pacman -T $*` + [ $# -gt 0 ] || return + + missdep=`pacman $PACMAN_OPTS -T $*` ret=$? if [ "$ret" != "0" ]; then if [ "$ret" = "127" ]; then @@ -116,7 +150,7 @@ handledeps() { if [ "$DEP_BIN" = "1" ]; then # install missing deps from binary packages (using pacman -S) msg "Installing missing dependencies..." - pacman -D $deplist + pacman $PACMAN_OPTS -D $deplist if [ "$?" = "127" ]; then error "Failed to install missing dependencies." exit 1 @@ -131,9 +165,9 @@ handledeps() { FAKEROOTKEY2=$FAKEROOTKEY unset FAKEROOTKEY fi - sudo pacman -D $deplist + sudo pacman $PACMAN_OPTS -D $deplist if [ "$INFAKEROOT" = "1" ]; then - FAKEROOTKEY=$FAKEROOTKEY2 + export FAKEROOTKEY=$FAKEROOTKEY2 unset FAKEROOTKEY2 fi if [ "$?" = "127" ]; then @@ -192,8 +226,10 @@ handledeps() { usage() { echo "makepkg version $myver" - echo "usage: $0 [options]" - echo "options:" + echo + echo "Usage: $0 [options]" + echo + echo "Options:" echo " -b, --builddeps Build missing dependencies from source" echo " -B, --noccache Do not use ccache during build" echo " -c, --clean Clean up work files after build" @@ -214,33 +250,23 @@ usage() { echo " -S, --sudosync Install missing dependencies with pacman and sudo" echo " -w <destdir> Write package to <destdir> instead of the working dir" echo - echo " if -p is not specified, makepkg will look for a PKGBUILD" - echo " file in the current directory." + echo "These options can be passed to pacman:" + echo + echo " --noconfirm Do not ask for confirmation when resolving dependencies" + echo " --noprogressbar Do not show a progress bar when downloading files" + echo + echo "If -p is not specified, makepkg will look for ./PKGBUILD" echo } - -# Options -BUILDSCRIPT="./PKGBUILD" -CLEANUP=0 -CLEANCACHE=0 -DEP_BIN=0 -DEP_SRC=0 -DEP_SUDO=0 -FORCE=0 -GENMD5=0 -INSTALL=0 -NOBUILD=0 -NOCCACHE=0 -NODEPS=0 -NOEXTRACT=0 -NOSTRIP=0 -RMDEPS=0 - ARGLIST=$@ while [ "$#" -ne "0" ]; do case $1 in +# pacman + --noconfirm) PACMAN_OPTS="$PACMAN_OPTS --noconfirm" ;; + --noprogressbar) PACMAN_OPTS="$PACMAN_OPTS --noprogressbar" ;; +# makepkg --clean) CLEANUP=1 ;; --cleancache) CLEANCACHE=1 ;; --syncdeps) DEP_BIN=1 ;; @@ -335,6 +361,9 @@ fi unset pkgname pkgver pkgrel pkgdesc url license groups provides md5sums force unset replaces depends conflicts backup source install build makedepends +unset options +# some applications (eg, blackbox) will not build with some languages +unset LC_ALL LANG umask 0022 if [ ! -f $BUILDSCRIPT ]; then @@ -361,7 +390,8 @@ fi if [ -f $PKGDEST/${pkgname}-${pkgver}-${pkgrel}.pkg.tar.gz -a "$FORCE" = "0" -a "$GENMD5" = "0" ]; then if [ "$INSTALL" = "1" ]; then warning "a package has already been built, installing existing package." - pacman --upgrade $PKGDEST/${pkgname}-${pkgver}-${pkgrel}.pkg.tar.gz + echo pacman $PACMAN_OPTS -U $PKGDEST/${pkgname}-${pkgver}-${pkgrel}.pkg.tar.gz + pacman $PACMAN_OPTS -U $PKGDEST/${pkgname}-${pkgver}-${pkgrel}.pkg.tar.gz exit $? else error "a package has already been built. (use -f to overwrite)" @@ -506,7 +536,7 @@ if [ "$GENMD5" = "0" ]; then case $file in *.tar.gz|*.tar.Z|*.tgz) cmd="tar --use-compress-program=gzip -xf $file" ;; - *.tar.bz2) + *.tar.bz2|*.tbz2) cmd="tar --use-compress-program=bzip2 -xf $file" ;; *.tar) cmd="tar -xf $file" ;; @@ -571,7 +601,6 @@ else exit 0 fi - if [ "`id -u`" = "0" ]; then # chown all source files to root.root chown -R root.root $startdir/src @@ -589,6 +618,15 @@ if [ "$NOBUILD" = "1" ]; then exit 0 fi +# use distcc if requested +if [ "$DISTCC" = "y" ]; then + [ -d /usr/lib/distcc/bin ] && export PATH=/usr/lib/distcc/bin:$PATH + if [ "$INCHROOT" = "1" ]; then + [ -d /var/tmp/fst/.distcc ] || mkdir /var/tmp/fst/.distcc + export DISTCC_DIR=/var/tmp/fst/.distcc + fi +fi + # use ccache if it's available if [ "$NOCCACHE" = "0" ]; then [ -d /usr/lib/ccache/bin ] && export PATH=/usr/lib/ccache/bin:$PATH @@ -602,11 +640,14 @@ 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 -rm -rf pkg/{usr,opt/gnome}/share/gtk-doc +if [ ! "`check_option KEEPDOCS`" -a "$KEEPDOCS" = "0" ]; then + # remove info/doc files + msg "Removing info/doc files..." + cd $startdir + 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 +fi # move /usr/share/man files to /usr/man if [ -d pkg/usr/share/man ]; then @@ -641,7 +682,7 @@ done cd $startdir # strip binaries -if [ "$NOSTRIP" = "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 \ @@ -652,6 +693,18 @@ if [ "$NOSTRIP" = "0" ]; then | grep -v "No such file" | grep -v "format not recognized" fi +# remove libtool (.la) files +if [ "`check_option NOLIBTOOL`" ]; then + msg "Removing libtool .la files..." + find pkg -type f -name "*.la" -exec rm -f -- '{}' \; +fi + +# remove empty directories +if [ "`check_option NOEMPTYDIRS`" ]; then + msg "Removing empty directories..." + find pkg -mindepth 1 -type d -empty -exec rmdir {} \; +fi + # get some package meta info builddate=`LC_ALL= ; LANG= ; date -u "+%a %b %e %H:%M:%S %Y"` if [ "$PACKAGER" != "" ]; then @@ -729,16 +782,16 @@ fi if [ "$RMDEPS" = "1" -a "`id -u`" = "0" -a "$INFAKEROOT" != "1" -a \( ! -z "$deplist" -o ! -z "$makedeplist" \) ]; then msg "Removing installed dependencies..." - pacman -R $makedeplist $deplist + pacman $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 pacman -R $makedeplist $deplist + sudo pacman $PACMAN_OPTS -R $makedeplist $deplist if [ "$INFAKEROOT" = "1" ]; then - FAKEROOTKEY=$FAKEROOTKEY2 + export FAKEROOTKEY=$FAKEROOTKEY2 unset FAKEROOTKEY2 fi fi @@ -746,8 +799,8 @@ fi msg "Finished making: $pkgname (`date`)" if [ "$INSTALL" = "1" -a "`id -u`" = "0" -a "$INFAKEROOT" != "1" ]; then - msg "Running pacman --upgrade..." - pacman --upgrade $PKGDEST/${pkgname}-${pkgver}-${pkgrel}.pkg.tar.gz + msg "Installing package with pacman -U..." + pacman $PACMAN_OPTS -U $PKGDEST/${pkgname}-${pkgver}-${pkgrel}.pkg.tar.gz exit $? fi diff --git a/scripts/makeworld b/scripts/makeworld index 7d4c762c..714ca475 100755 --- a/scripts/makeworld +++ b/scripts/makeworld @@ -2,7 +2,7 @@ # # makeworld # -# Copyright (c) 2002-2005 by Judd Vinet <jvinet@zeroflux.org> +# Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org> # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -20,13 +20,15 @@ # USA. # -version="2.9.7" +version="2.9.8" toplevel=`pwd` usage() { echo "makeworld version $version" - echo "usage: $0 [options] <destdir> <category> [category] ..." - echo "options:" + echo + echo "Usage: $0 [options] <destdir> <category> [category] ..." + echo + echo "Options:" echo " -b, --builddeps Build missing dependencies from source" echo " -c, --clean Clean up work files after build" echo " -d, --nodeps Skip all dependency checks" @@ -36,10 +38,15 @@ usage() { echo " -r, --rmdeps Remove installed dependencies after a successful build" echo " -s, --syncdeps Install missing dependencies with pacman" echo - echo " where <category> is one or more directory names under the ABS root" - echo " eg: makeworld -c /packages base lib editors" + echo "These options can be passed to pacman:" + echo + echo " --noconfirm Do not ask for confirmation when resolving dependencies" + echo " --noprogressbar Do not show a progress bar when downloading files" + echo + echo "Where <category> is one or more directory names under the ABS root" + echo "eg: makeworld -c /packages base lib editors" echo - echo " this should be run from the toplevel directory of ABS (usually /var/abs)" + echo "This should be run from the toplevel directory of ABS (usually /var/abs)" } if [ $# -lt 2 ]; then @@ -50,6 +57,10 @@ fi MAKEPKG_OPTS= for arg in $*; do case $arg in +# pacman + --noconfirm) MAKEPKG_OPTS="$MAKEPKG_OPTS --noconfirm" ;; + --noprogressbar) MAKEPKG_OPTS="$MAKEPKG_OPTS --noprogressbar" ;; +# makepkg --clean) MAKEPKG_OPTS="$MAKEPKG_OPTS -c" ;; --install) MAKEPKG_OPTS="$MAKEPKG_OPTS -i" ;; --syncdeps) MAKEPKG_OPTS="$MAKEPKG_OPTS -s" ;; diff --git a/scripts/pacman-optimize b/scripts/pacman-optimize index cb321f2c..74f3e64b 100755 --- a/scripts/pacman-optimize +++ b/scripts/pacman-optimize @@ -2,7 +2,7 @@ # # pacman-optimize # -# Copyright (c) 2002-2005 by Judd Vinet <jvinet@zeroflux.org> +# Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org> # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -20,7 +20,7 @@ # USA. # -myver='2.9.7' +myver='2.9.8' usage() { echo "pacman-optimize $myver" @@ -77,7 +77,7 @@ touch /tmp/pacman.lck # step 1: sum the old db echo "==> md5sum'ing the old database..." -tar --same-order -c $dbroot 2>/dev/null | md5sum >/tmp/pacsums.old +find $dbroot -type f | sort | xargs md5sum >/tmp/pacsums.old # step 1: copy the entire db directory to a new one echo "==> copying $dbroot..." @@ -87,7 +87,7 @@ cp -a $dbroot $dbroot.new || die_r "error copying $dbroot" echo "==> md5sum'ing the new database..." mv $dbroot $dbroot.bak || die_r "error renaming $dbroot" mv $dbroot.new $dbroot || die_r "error renaming $dbroot.new" -tar --same-order -c $dbroot 2>/dev/null | md5sum >/tmp/pacsums.new +find $dbroot -type f | sort | xargs md5sum >/tmp/pacsums.new # step 3: compare sums echo "==> checking integrity..." diff --git a/scripts/updatesync b/scripts/updatesync index 5385ed66..2f6866d4 100755 --- a/scripts/updatesync +++ b/scripts/updatesync @@ -3,7 +3,7 @@ # updatesync # # Copyright (c) 2004 by Jason Chu <jason@archlinux.org> -# Derived from gensync (c) 2002-2005 Judd Vinet <jvinet@zeroflux.org> +# Derived from gensync (c) 2002-2006 Judd Vinet <jvinet@zeroflux.org> # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -21,7 +21,7 @@ # USA. # -myver='2.9.7' +myver='2.9.8' usage() { echo "updatesync $myver" @@ -54,6 +54,18 @@ die() exit 1 } +check_option() { + local i + for i in ${options[@]}; do + local uc=`echo $i | tr [:lower:] [:upper:]` + local lc=`echo $i | tr [:upper:] [:lower:]` + if [ "$uc" = "$1" -o "$lc" = "$1" ]; then + echo $1 + return + fi + done +} + get_md5checksum() { if [ "$pkgdir" != "" ]; then @@ -72,7 +84,7 @@ get_md5checksum() db_write_entry() { unset pkgname pkgver pkgrel pkgdesc force - unset groups replaces provides depends conflicts + unset groups replaces provides depends conflicts options source $1 || return 1 cd $ustmpdir mkdir $pkgname-$pkgver-$pkgrel || return 1 @@ -110,7 +122,7 @@ db_write_entry() done echo "" >>desc fi - if [ "$force" = "y" -o "$force" = "Y" ]; then + if [ "$force" = "y" -o "$force" = "Y" -o "`check_option FORCE`" ]; then echo "%FORCE%" >>desc echo "" >>desc fi @@ -157,7 +169,7 @@ delete_entry() if [ $# -lt 3 ]; then usage - exit 0 + exit 1 fi if [ "$1" = "-h" -o "$1" = "--help" ]; then @@ -210,12 +222,15 @@ if [ "$action" = "upd" ]; then else pkgfile="$destdir/$pkgname-$pkgver-$pkgrel.pkg.tar.gz" fi - [ -f $pkgfile ] || die "missing package file: $pkgfile" - csize=`du -b $pkgfile | cut -f1` - pkgmd5sum=`get_md5checksum $pkgfile` - [ -z $pkgmd5sum ] && die "error generating checksum for $pkgfile" - echo "updatesync: creating entry for $option" >&2 - db_write_entry $option || die "error writing entry for $option" + if [ -f $pkgfile ]; then + csize=`du -b $pkgfile | cut -f1` + pkgmd5sum=`get_md5checksum $pkgfile` + [ -z $pkgmd5sum ] && die "error generating checksum for $pkgfile" + echo "updatesync: creating entry for $option" >&2 + db_write_entry $option || die "error writing entry for $option" + else + echo "updatesync: missing package: $pkgfile" >&2 + fi else # DELETE delete_entry $option |