6 # 2 - no spec file name in cmdl parameters
7 # 3 - spec file not stored in repo
8 # 4 - some source, apatch or icon files not stored in repo
9 # 5 - build package no succed
12 Build package utility from PLD CVS repository
13 V 0.5 (C) 1999 Tomasz K³oczko".
15 PATH="/bin:/usr/bin:/usr/sbin:/sbin:/usr/X11R6/bin"
20 CVSROOT=${CVSROOT:-""}
30 #---------------------------------------------
36 Usage: builder [-V] [--version] [-a] [--as_anon] [-b] [--build]
37 [-d <cvsroot>] [--cvsroot <cvsroot>] [-g] [--get] [-h] [--help]
38 [-l <logfile>] [--logtofile <logfile>] [-q] [--quiet]
39 [-v] [--verbose] <package>.spec
41 -V, --version - output builder version
42 -a, --as_anon - get files via pserver as cvs@cvs.pld.org.pl,
43 -b, --build - get all files from CVS repo and build
44 package from <package>.spec,
45 -d, --cvsroot - setup \$CVSROOT,
46 -g, --get - get <package>.spec and all relayted files from
48 -h, --help - this message,
49 -l, --logtofile - log all to file,
50 -q, --quiet - be quiet,
51 -v, --verbose - be verbose,
58 sed -e "s/^Summary:*/Summary:\%dump/I" $SPECFILE > $SPECFILE.__
60 SOURCES="`rpm -bp --test $SPECFILE.__ 2>&1 | awk '/ SOURCE[0-9]+/ {print $3}'`"
61 PATCHES="`rpm -bp --test $SPECFILE.__ 2>&1 | awk '/ PATCH[0-9]+/ {print $3}'`"
62 ICON="`rpm -bp --test $SPECFILE.__ 2>&1 | awk '/^Icon:/ {print $2}' ${SPEC}`"
63 PACKAGE_NAME="`rpm -bp --test $SPECFILE.__ 2>&1 | awk '/ name/ {print $3}'`"
64 PACKAGE_VERSION="`rpm -bp --test $SPECFILE.__ 2>&1 | awk '/ PACKAGE_VERSION/ {print $3}'`"
65 PACKAGE_RELEASE="`rpm -bp --test $SPECFILE.__ 2>&1 | awk '/ PACKAGE_RELEASE/ {print $3}'`"
69 if [ "$BE_VERBOSE" != "" ]; then
70 echo -e "- Sources :\n " $SOURCES
71 echo -e "- Patches :\n " $PATCHES
72 if [ "$ICON" != "" ]; then
73 echo -e "- Icon :\n " $ICON
75 echo -e "- Icon : *no package icon*"
77 echo -e "- Name : " $PACKAGE_NAME
78 echo -e "- Version : " $PACKAGE_VERSION
79 echo -e "- Release : " $PACKAGE_RELEASE
88 "err_no_spec_in_cmdl" )
89 echo "ERROR: spec file name not specified.";
91 "err_no_spec_in_repo" )
92 echo "Error: spec file not stored in CVS repo.";
94 "err_no_source_in_repo" )
95 echo "Error: some source, apatch or icon files not stored in CVS repo.";
98 echo "Error: package build failed.";
105 DUMB_SPEC_FILE=`mktemp -q /tmp/bilder.XXXXXX`
116 echo SOURCE_DIR=%{_sourcedir}
117 echo SPECS_DIR=%{_specdir}" > $DUMB_SPEC_FILE
119 SOURCE_DIR=`rpm -bp $DUMB_SPEC_FILE 2>&1 | grep "^SOURCE_DIR" | sed "s/SOURCE_DIR\=//"`
120 SPECS_DIR=`rpm -bp $DUMB_SPEC_FILE 2>&1 | grep "^SPECS_DIR" |sed "s/SPECS_DIR\=//"`
122 echo aaa \"$SPECS_DIR\"
123 # rm -f $DUMB_SPEC_FILE
132 if [ "$CVSROOT" -n "" ]; then
133 cvs -d "$CVSROOT" up $SPECFILE
138 if [ "$?" != 0 ]; then
139 Exit_error err_no_spec_in_repo;
146 if [ "$CVSROOT" -n ""]; then
147 cvs -d "$CVSROOT" up $SOURCES $PATCHES $ICON
153 if [ "$?" != 0 ]; then
154 Exit_error err_no_source_in_repo;
161 rpm -ba -v $QUIET $SPECFILE
163 if [ "$?" != 0 ]; then
164 Exit_error err_build_fail;
169 #---------------------------------------------
172 if [ "$#" == 0 ]; then
177 while test $# -gt 0 ; do
180 COMMAND="version"; shift ;;
182 CVSROOT=":pserver:cvs@cvs.pld.org.pl:/cvsroot"; shift ;;
184 COMMAND="build"; shift ;;
186 shift; CVSROOT="${1}"; shift ;;
188 COMMAND="get"; shift ;;
190 COMMAND="usage"; shift ;;
192 shift; LOGFILE="${1}"; shift ;;
194 QUIET="--quiet"; shift ;;
196 BE_VERBOSE="1"; shift ;;
198 SPECFILE="${1}"; shift ;;
205 if [ -n "$SPECFILE" ]; then
211 Exit_error err_no_spec_in_cmdl;
216 if [ -n "$SPECFILE" ]; then
221 Exit_error err_no_spec_in_cmdl;