* Updated Italian translation
[pacman.git] / scripts / makeworld
blob7fe84badd0895d185e965c2e90523e271dc8a93a
1 #!/bin/bash
2 #
3 # makeworld
4 #
5 # Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
6 #
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 2 of the License, or
10 # (at your option) any later version.
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with this program; if not, write to the Free Software
19 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
20 # USA.
23 version="3.0.0"
24 toplevel=$(pwd)
26 usage() {
27 echo "makeworld version $version"
28 echo "usage: $0 [options] <destdir> <category> [category] ..."
29 echo "options:"
30 echo " -b, --builddeps Build missing dependencies from source"
31 echo " -B, --noccache Do not use ccache during build"
32 echo " -c, --clean Clean up work files after build"
33 echo " -C, --cleancache Clean up source files from the cache"
34 echo " -d, --nodeps Skip all dependency checks"
35 echo " -e, --noextract Do not extract source files (use existing src/ dir)"
36 echo " -f, --force Overwrite existing packages"
37 echo " -i, --install Install package after successful build"
38 echo " -m, --nocolor Disable colorized output messages"
39 echo " -h, --help This help"
40 echo " -o, --nobuild Download and extract files only"
41 echo " -r, --rmdeps Remove installed dependencies after a successful build"
42 echo " -s, --syncdeps Install missing dependencies with pacman"
43 echo " -S, --usesudo Use sudo when running pacman commands"
44 echo
45 echo "These options can be passed to pacman:"
46 echo
47 echo " --noconfirm Do not ask for confirmation when resolving dependencies"
48 echo " --noprogressbar Do not show a progress bar when downloading files"
49 echo
50 echo "Where <category> is one or more directory names under the ABS root"
51 echo "eg: makeworld -c /packages base lib editors"
52 echo
53 echo "This should be run from the toplevel directory of ABS (usually /var/abs)"
56 if [ $# -lt 2 ]; then
57 usage
58 exit 1
61 MAKEPKG_OPTS=
62 for arg in $*; do
63 case $arg in
64 # pacman
65 --noconfirm) MAKEPKG_OPTS="$MAKEPKG_OPTS --noconfirm" ;;
66 --noprogressbar) MAKEPKG_OPTS="$MAKEPKG_OPTS --noprogressbar" ;;
67 # makepkg
68 --clean) MAKEPKG_OPTS="$MAKEPKG_OPTS -c" ;;
69 --install) MAKEPKG_OPTS="$MAKEPKG_OPTS -i" ;;
70 --syncdeps) MAKEPKG_OPTS="$MAKEPKG_OPTS -s" ;;
71 --usesudo) MAKEPKG_OPTS="$MAKEPKG_OPTS -S" ;;
72 --builddeps) MAKEPKG_OPTS="$MAKEPKG_OPTS -b" ;;
73 --nodeps) MAKEPKG_OPTS="$MAKEPKG_OPTS -d" ;;
74 --force) MAKEPKG_OPTS="$MAKEPKG_OPTS -f" ;;
75 --rmdeps) MAKEPKG_OPTS="$MAKEPKG_OPTS -r" ;;
76 --noccache) MAKEPKG_OPTS="$MAKEPKG_OPTS -B" ;;
77 --cleancache) MAKEPKG_OPTS="$MAKEPKG_OPTS -C" ;;
78 --noextract) MAKEPKG_OPTS="$MAKEPKG_OPTS -e" ;;
79 --nobuild) MAKEPKG_OPTS="$MAKEPKG_OPTS -o" ;;
80 --nocolor) MAKEPKG_OPTS="$MAKEPKG_OPTS -m" ;;
81 --help)
82 usage
83 exit 0
85 --*)
86 usage
87 exit 1
89 -*)
90 while getopts "chisSbdfrBCemoS-" opt; do
91 case $opt in
92 c) MAKEPKG_OPTS="$MAKEPKG_OPTS -c" ;;
93 i) MAKEPKG_OPTS="$MAKEPKG_OPTS -i" ;;
94 s) MAKEPKG_OPTS="$MAKEPKG_OPTS -s" ;;
95 b) MAKEPKG_OPTS="$MAKEPKG_OPTS -b" ;;
96 d) MAKEPKG_OPTS="$MAKEPKG_OPTS -d" ;;
97 f) MAKEPKG_OPTS="$MAKEPKG_OPTS -f" ;;
98 r) MAKEPKG_OPTS="$MAKEPKG_OPTS -r" ;;
99 B) MAKEPKG_OPTS="$MAKEPKG_OPTS -B" ;;
100 C) MAKEPKG_OPTS="$MAKEPKG_OPTS -C" ;;
101 e) MAKEPKG_OPTS="$MAKEPKG_OPTS -e" ;;
102 m) MAKEPKG_OPTS="$MAKEPKG_OPTS -m" ;;
103 o) MAKEPKG_OPTS="$MAKEPKG_OPTS -o" ;;
104 S) MAKEPKG_OPTS="$MAKEPKG_OPTS -S" ;;
106 usage
107 exit 0
110 OPTIND=0
111 break
113 esac
114 done
117 dest=$arg
118 shift
119 break
121 esac
122 shift
123 if [ "$dest" != "" ]; then
124 break
126 done
128 if [ "$dest" = "" ]; then
129 usage
130 exit 1
133 # convert a (possibly) relative path to absolute
134 cd $dest
135 dest=$(pwd)
136 cd - &>/dev/null
138 sd=$(date +"[%b %d %H:%M]")
140 for category in $*; do
141 for port in $(find $toplevel/$category -maxdepth 1 -mindepth 1 -type d | sort); do
142 cd $port
143 if [ -f PKGBUILD ]; then
144 . PKGBUILD
145 buildstatus=0
146 if [ ! -f $dest/$pkgname-$pkgver-$pkgrel.pkg.tar.gz ]; then
147 makepkg $MAKEPKG_OPTS -m -w $dest 2>>$toplevel/makepkg.log
148 if [ $? -gt 0 ]; then
149 buildstatus=2
150 else
151 buildstatus=1
154 d=$(date +"[%b %d %H:%M]")
155 echo -n "$d " >>$toplevel/build.log
156 case $buildstatus in
157 0) echo "$pkgname already built -- skipping" >>$toplevel/build.log ;;
158 1) echo "$pkgname was built successfully" >>$toplevel/build.log ;;
159 2) echo "$pkgname build failed" >>$toplevel/build.log ;;
160 esac
162 done
163 done
164 ed=$(date +"[%b %d %H:%M]")
166 echo "makeworld complete." >>$toplevel/build.log
167 echo " started: $sd" >>$toplevel/build.log
168 echo " finished: $ed" >>$toplevel/build.log
170 exit 0
172 # vim: set ts=2 sw=2 noet: