pacman/scripts/makeworld

107 lines
2.8 KiB
Text
Raw Normal View History

2002-02-25 19:23:38 +00:00
#!/bin/bash
toplevel=`pwd`
2003-04-19 22:31:38 +00:00
version="2.4.1"
2002-02-25 19:23:38 +00:00
2002-09-16 05:22:13 +00:00
usage() {
echo "makeworld version $version"
2002-08-09 18:03:48 +00:00
echo "usage: $0 [options] <destdir> <category> [category] ..."
2002-09-16 05:22:13 +00:00
echo "options:"
2003-02-27 08:26:02 +00:00
echo " -c, --clean Clean up work files after build"
2003-03-14 17:35:57 +00:00
echo " -s, --syncdeps Install missing dependencies with pacman"
2003-02-27 08:26:02 +00:00
echo " -b, --builddeps Build missing dependencies from source"
2003-03-14 17:35:57 +00:00
echo " -d, --nodeps Skip all dependency checks"
2003-02-27 08:26:02 +00:00
echo " -i, --install Install package after successful build"
echo " -f, --force Overwrite existing packages"
echo " -h, --help This help"
2002-09-16 05:22:13 +00:00
echo
echo " where <category> is one or more directory names under the ABS root"
echo " eg: makeworld -c /packages base lib editors"
2002-03-18 09:36:01 +00:00
echo
echo " this should be run from the toplevel directory of ABS (usually /usr/abs)"
2002-09-16 05:22:13 +00:00
}
if [ $# -lt 2 -o "$1" = "--help" -o "$1" = "-h" ]; then
usage
2002-02-25 19:23:38 +00:00
exit 1
fi
2002-08-09 18:03:48 +00:00
MAKEPKG_OPTS=
2002-09-16 05:22:13 +00:00
for arg in $*; do
case $arg in
2003-04-11 16:58:50 +00:00
--clean) MAKEPKG_OPTS="$MAKEPKG_OPTS -c" ;;
--install) MAKEPKG_OPTS="$MAKEPKG_OPTS -i" ;;
--syncdeps) MAKEPKG_OPTS="$MAKEPKG_OPTS -s" ;;
--builddeps) MAKEPKG_OPTS="$MAKEPKG_OPTS -b" ;;
--nodeps) MAKEPKG_OPTS="$MAKEPKG_OPTS -d" ;;
--force) MAKEPKG_OPTS="$MAKEPKG_OPTS -f" ;;
--*)
usage
exit 1
2002-09-16 05:22:13 +00:00
;;
2003-04-11 16:58:50 +00:00
-*)
while getopts "cisbdf-" opt; do
case $opt in
c) MAKEPKGS_OPTS="$MAKEPKGS_OPTS -c" ;;
i) MAKEPKGS_OPTS="$MAKEPKGS_OPTS -i" ;;
s) MAKEPKGS_OPTS="$MAKEPKGS_OPTS -s" ;;
b) MAKEPKGS_OPTS="$MAKEPKGS_OPTS -b" ;;
d) MAKEPKGS_OPTS="$MAKEPKGS_OPTS -d" ;;
f) MAKEPKGS_OPTS="$MAKEPKGS_OPTS -f" ;;
-)
OPTIND=0
break
;;
esac
done
2003-02-27 08:26:02 +00:00
;;
2002-09-16 05:22:13 +00:00
*)
dest=$arg
shift
break
;;
esac
shift
if [ "$dest" != "" ]; then
break;
fi
done
2002-08-09 18:03:48 +00:00
2002-09-16 05:22:13 +00:00
if [ "$dest" = "" ]; then
usage
exit 1
fi
2002-03-10 22:34:15 +00:00
sd=`date +"[%b %d %H:%M]"`
for category in $*; do
for port in `find $toplevel/$category -type d -maxdepth 1 -mindepth 1 | sort`; do
cd $port
if [ -f PKGBUILD ]; then
. PKGBUILD
buildstatus=0
if [ ! -f $dest/$pkgname-$pkgver-$pkgrel.pkg.tar.gz ]; then
2003-04-11 16:58:50 +00:00
makepkg $MAKEPKG_OPTS -w $dest 2>>$toplevel/makepkg.log
2002-03-10 22:34:15 +00:00
if [ $? -gt 0 ]; then
buildstatus=2
else
buildstatus=1
fi
fi
d=`date +"[%b %d %H:%M]"`
echo -n "$d " >>$toplevel/build.log
case $buildstatus in
0) echo "$pkgname already built -- skipping" >>$toplevel/build.log ;;
1) echo "$pkgname was built successfully" >>$toplevel/build.log ;;
2) echo "$pkgname build failed" >>$toplevel/build.log ;;
esac
2002-02-25 19:23:38 +00:00
fi
2002-03-10 22:34:15 +00:00
done
2002-02-25 19:23:38 +00:00
done
2002-03-10 22:34:15 +00:00
ed=`date +"[%b %d %H:%M]"`
echo "makeworld complete." >>$toplevel/build.log
echo " started: $sd" >>$toplevel/build.log
echo " finished: $ed" >>$toplevel/build.log