From ab53ee1e7c832453392c87c7f07961826ff9f16e Mon Sep 17 00:00:00 2001 From: Andrew Fyfe Date: Wed, 11 Apr 2007 21:30:48 +0100 Subject: autotool scripts/makeworld - move scripts/makeworld to scripts/makeworld.in - add -V --version options to scripts/makeworld.in - add autotool commands to generate scripts/makeworld Signed-off-by: Andrew Fyfe --- configure.ac | 1 + scripts/Makefile.am | 2 +- scripts/makeworld | 172 ---------------------------------------------- scripts/makeworld.in | 189 +++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 191 insertions(+), 173 deletions(-) delete mode 100755 scripts/makeworld create mode 100755 scripts/makeworld.in diff --git a/configure.ac b/configure.ac index 6c1bfd35..b3bc443e 100644 --- a/configure.ac +++ b/configure.ac @@ -220,6 +220,7 @@ scripts/Makefile scripts/abs scripts/gensync scripts/makepkg +scripts/makeworld doc/Makefile etc/Makefile etc/makepkg.conf diff --git a/scripts/Makefile.am b/scripts/Makefile.am index 0c6a06fb..9d67270a 100644 --- a/scripts/Makefile.am +++ b/scripts/Makefile.am @@ -16,7 +16,7 @@ bin_SCRIPTS = \ EXTRA_DIST = abs.in \ gensync.in \ makepkg.in \ - makeworld \ + makeworld.in \ pacman-optimize \ rankmirrors \ repo-add \ diff --git a/scripts/makeworld b/scripts/makeworld deleted file mode 100755 index b9d318c6..00000000 --- a/scripts/makeworld +++ /dev/null @@ -1,172 +0,0 @@ -#!/bin/bash -# -# makeworld -# -# Copyright (c) 2002-2006 by Judd Vinet -# -# 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 -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, -# USA. -# - -version="3.0.0" -toplevel=$(pwd) - -usage() { - echo "makeworld version $version" - echo "usage: $0 [options] [category] ..." - 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" - echo " -C, --cleancache Clean up source files from the cache" - echo " -d, --nodeps Skip all dependency checks" - echo " -e, --noextract Do not extract source files (use existing src/ dir)" - echo " -f, --force Overwrite existing packages" - echo " -i, --install Install package after successful build" - echo " -m, --nocolor Disable colorized output messages" - echo " -h, --help This help" - echo " -o, --nobuild Download and extract files only" - echo " -r, --rmdeps Remove installed dependencies after a successful build" - echo " -s, --syncdeps Install missing dependencies with pacman" - echo " -S, --usesudo Use sudo when running pacman commands" - echo - 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 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)" -} - -if [ $# -lt 2 ]; then - usage - exit 1 -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" ;; - --usesudo) MAKEPKG_OPTS="$MAKEPKG_OPTS -S" ;; - --builddeps) MAKEPKG_OPTS="$MAKEPKG_OPTS -b" ;; - --nodeps) MAKEPKG_OPTS="$MAKEPKG_OPTS -d" ;; - --force) MAKEPKG_OPTS="$MAKEPKG_OPTS -f" ;; - --rmdeps) MAKEPKG_OPTS="$MAKEPKG_OPTS -r" ;; - --noccache) MAKEPKG_OPTS="$MAKEPKG_OPTS -B" ;; - --cleancache) MAKEPKG_OPTS="$MAKEPKG_OPTS -C" ;; - --noextract) MAKEPKG_OPTS="$MAKEPKG_OPTS -e" ;; - --nobuild) MAKEPKG_OPTS="$MAKEPKG_OPTS -o" ;; - --nocolor) MAKEPKG_OPTS="$MAKEPKG_OPTS -m" ;; - --help) - usage - exit 0 - ;; - --*) - usage - exit 1 - ;; - -*) - while getopts "chisSbdfrBCemoS-" opt; do - case $opt in - c) MAKEPKG_OPTS="$MAKEPKG_OPTS -c" ;; - i) MAKEPKG_OPTS="$MAKEPKG_OPTS -i" ;; - s) MAKEPKG_OPTS="$MAKEPKG_OPTS -s" ;; - b) MAKEPKG_OPTS="$MAKEPKG_OPTS -b" ;; - d) MAKEPKG_OPTS="$MAKEPKG_OPTS -d" ;; - f) MAKEPKG_OPTS="$MAKEPKG_OPTS -f" ;; - r) MAKEPKG_OPTS="$MAKEPKG_OPTS -r" ;; - B) MAKEPKG_OPTS="$MAKEPKG_OPTS -B" ;; - C) MAKEPKG_OPTS="$MAKEPKG_OPTS -C" ;; - e) MAKEPKG_OPTS="$MAKEPKG_OPTS -e" ;; - m) MAKEPKG_OPTS="$MAKEPKG_OPTS -m" ;; - o) MAKEPKG_OPTS="$MAKEPKG_OPTS -o" ;; - S) MAKEPKG_OPTS="$MAKEPKG_OPTS -S" ;; - h) - usage - exit 0 - ;; - -) - OPTIND=0 - break - ;; - esac - done - ;; - *) - dest=$arg - shift - break - ;; - esac - shift - if [ "$dest" != "" ]; then - break - fi -done - -if [ "$dest" = "" ]; then - usage - exit 1 -fi - -# convert a (possibly) relative path to absolute -cd "$dest" -dest="$(pwd)" -cd - &>/dev/null - -sd=$(date +"[%b %d %H:%M]") - -for category in $*; do - for port in $(find "$toplevel/$category" -maxdepth 1 -mindepth 1 -type d | sort); do - cd $port - if [ -f PKGBUILD ]; then - . PKGBUILD - buildstatus=0 - if [ ! -f "$dest/$pkgname-$pkgver-$pkgrel.pkg.tar.gz" ]; then - PKGDEST="$dest" makepkg $MAKEPKG_OPTS -m 2>>$toplevel/makepkg.log - 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 - fi - done -done -ed=$(date +"[%b %d %H:%M]") - -echo "makeworld complete." >>$toplevel/build.log -echo " started: $sd" >>$toplevel/build.log -echo " finished: $ed" >>$toplevel/build.log - -exit 0 - -# vim: set ts=2 sw=2 noet: diff --git a/scripts/makeworld.in b/scripts/makeworld.in new file mode 100755 index 00000000..acbd2830 --- /dev/null +++ b/scripts/makeworld.in @@ -0,0 +1,189 @@ +#!/bin/bash +# +# makeworld +# +# Copyright (c) 2002-2007 by Judd Vinet +# +# 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 +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, +# USA. +# + +version="@PACKAGE_VERSION@" +toplevel=$(pwd) + +usage() { + echo "makeworld version $version" + echo "usage: $0 [options] [category] ..." + 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" + echo " -C, --cleancache Clean up source files from the cache" + echo " -d, --nodeps Skip all dependency checks" + echo " -e, --noextract Do not extract source files (use existing src/ dir)" + echo " -f, --force Overwrite existing packages" + echo " -i, --install Install package after successful build" + echo " -m, --nocolor Disable colorized output messages" + echo " -h, --help This help" + echo " -o, --nobuild Download and extract files only" + echo " -r, --rmdeps Remove installed dependencies after a successful build" + echo " -s, --syncdeps Install missing dependencies with pacman" + echo " -S, --usesudo Use sudo when running pacman commands" + echo + 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 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)" +} + +version() { + printf "makeworld (pacman) %s\n" "$version" + printf "Copyright (C) 2002-2007 Judd Vinet .\n" + echo + printf "This is free software; see the source for copying conditions.\n" + printf "There is NO WARRANTY, to the extent permitted by the law.\n" + echo +} + +if [ $# -lt 2 ]; then + usage + exit 1 +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" ;; + --usesudo) MAKEPKG_OPTS="$MAKEPKG_OPTS -S" ;; + --builddeps) MAKEPKG_OPTS="$MAKEPKG_OPTS -b" ;; + --nodeps) MAKEPKG_OPTS="$MAKEPKG_OPTS -d" ;; + --force) MAKEPKG_OPTS="$MAKEPKG_OPTS -f" ;; + --rmdeps) MAKEPKG_OPTS="$MAKEPKG_OPTS -r" ;; + --noccache) MAKEPKG_OPTS="$MAKEPKG_OPTS -B" ;; + --cleancache) MAKEPKG_OPTS="$MAKEPKG_OPTS -C" ;; + --noextract) MAKEPKG_OPTS="$MAKEPKG_OPTS -e" ;; + --nobuild) MAKEPKG_OPTS="$MAKEPKG_OPTS -o" ;; + --nocolor) MAKEPKG_OPTS="$MAKEPKG_OPTS -m" ;; + --help) + usage + exit 0 + ;; + --version) + version + exit 0 + ;; + --*) + usage + exit 1 + ;; + -*) + while getopts "chisSbdfrBCemoSV-" opt; do + case $opt in + c) MAKEPKG_OPTS="$MAKEPKG_OPTS -c" ;; + i) MAKEPKG_OPTS="$MAKEPKG_OPTS -i" ;; + s) MAKEPKG_OPTS="$MAKEPKG_OPTS -s" ;; + b) MAKEPKG_OPTS="$MAKEPKG_OPTS -b" ;; + d) MAKEPKG_OPTS="$MAKEPKG_OPTS -d" ;; + f) MAKEPKG_OPTS="$MAKEPKG_OPTS -f" ;; + r) MAKEPKG_OPTS="$MAKEPKG_OPTS -r" ;; + B) MAKEPKG_OPTS="$MAKEPKG_OPTS -B" ;; + C) MAKEPKG_OPTS="$MAKEPKG_OPTS -C" ;; + e) MAKEPKG_OPTS="$MAKEPKG_OPTS -e" ;; + m) MAKEPKG_OPTS="$MAKEPKG_OPTS -m" ;; + o) MAKEPKG_OPTS="$MAKEPKG_OPTS -o" ;; + S) MAKEPKG_OPTS="$MAKEPKG_OPTS -S" ;; + h) + usage + exit 0 + ;; + V) + version + exit 0 + ;; + -) + OPTIND=0 + break + ;; + esac + done + ;; + *) + dest=$arg + shift + break + ;; + esac + shift + if [ "$dest" != "" ]; then + break + fi +done + +if [ "$dest" = "" ]; then + usage + exit 1 +fi + +# convert a (possibly) relative path to absolute +cd "$dest" +dest="$(pwd)" +cd - &>/dev/null + +sd=$(date +"[%b %d %H:%M]") + +for category in $*; do + for port in $(find "$toplevel/$category" -maxdepth 1 -mindepth 1 -type d | sort); do + cd $port + if [ -f PKGBUILD ]; then + . PKGBUILD + buildstatus=0 + if [ ! -f "$dest/$pkgname-$pkgver-$pkgrel.pkg.tar.gz" ]; then + PKGDEST="$dest" makepkg $MAKEPKG_OPTS -m 2>>$toplevel/makepkg.log + 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 + fi + done +done +ed=$(date +"[%b %d %H:%M]") + +echo "makeworld complete." >>$toplevel/build.log +echo " started: $sd" >>$toplevel/build.log +echo " finished: $ed" >>$toplevel/build.log + +exit 0 + +# vim: set ts=2 sw=2 noet: -- cgit v1.2.3-70-g09d2