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:-""}
40 echo SOURCE_DIR=%{_sourcedir}
41 echo SPECS_DIR=%{_specdir}"
43 #---------------------------------------------
49 Usage: builder [-V] [--version] [-a] [--as_anon] [-b] [--build]
50 [-d <cvsroot>] [--cvsroot <cvsroot>] [-g] [--get] [-h] [--help]
51 [-l <logfile>] [--logtofile <logfile>] [-q] [--quiet]
52 [-v] [--verbose] <package>.spec
54 -V, --version - output builder version
55 -a, --as_anon - get files via pserver as cvs@cvs.pld.org.pl,
56 -b, --build - get all files from CVS repo and build
57 package from <package>.spec,
58 -d, --cvsroot - setup \$CVSROOT,
59 -g, --get - get <package>.spec and all relayted files from
61 -h, --help - this message,
62 -l, --logtofile - log all to file,
63 -q, --quiet - be quiet,
64 -v, --verbose - be verbose,
71 sed -e "s/^Summary:*/Summary:\%dump/I" $SPECFILE > $SPECFILE.__
73 SOURCES="`rpm -bp --test $SPECFILE.__ 2>&1 | awk '/ SOURCE[0-9]+/ {print $3}'`"
74 PATCHES="`rpm -bp --test $SPECFILE.__ 2>&1 | awk '/ PATCH[0-9]+/ {print $3}'`"
75 ICON="`rpm -bp --test $SPECFILE.__ 2>&1 | awk '/^Icon:/ {print $2}' ${SPEC}`"
76 PACKAGE_NAME="`rpm -bp --test $SPECFILE.__ 2>&1 | awk '/ name/ {print $3}'`"
77 PACKAGE_VERSION="`rpm -bp --test $SPECFILE.__ 2>&1 | awk '/ PACKAGE_VERSION/ {print $3}'`"
78 PACKAGE_RELEASE="`rpm -bp --test $SPECFILE.__ 2>&1 | awk '/ PACKAGE_RELEASE/ {print $3}'`"
82 if [ "$BE_VERBOSE" != "" ]; then
83 echo -e "- Sources :\n " $SOURCES
84 echo -e "- Patches :\n " $PATCHES
85 if [ "$ICON" != "" ]; then
86 echo -e "- Icon :\n " $ICON
88 echo -e "- Icon : *no package icon*"
90 echo -e "- Name : " $PACKAGE_NAME
91 echo -e "- Version : " $PACKAGE_VERSION
92 echo -e "- Release : " $PACKAGE_RELEASE
101 "err_no_spec_in_cmdl" )
102 echo "ERROR: spec file name not specified.";
104 "err_no_spec_in_repo" )
105 echo "Error: spec file not stored in CVS repo.";
107 "err_no_source_in_repo" )
108 echo "Error: some source, apatch or icon files not stored in CVS repo.";
111 echo "Error: package build failed.";
118 DUMB_SPEC_FILE=`mktemp -q /tmp/bilder.XXXXXX`
119 echo $dumb_spec > $DUMB_SPEC_FILE
120 `rpm -bp $DUMB_SPEC_FILE | egrep -e "SOURCE_DIR|SPECS_DIR"`
121 rm -f $DUMB_SPEC_FILE
129 if [ "$CVSROOT" != ""[; then
130 cvs -d "$CVSROOT" up $SPECFILE
135 if [ "$?" != 0 ]; then
136 Exit_error err_no_spec_in_repo;
143 if [ "$CVSROOT" != ""[; then
144 cvs -d "$CVSROOT" up $SOURCES $PATCHES $ICON
150 if [ "$?" != 0 ]; then
151 Exit_error err_no_source_in_repo;
158 rpm -ba -v $QUIET $SPECFILE
160 if [ "$?" != 0 ]; then
161 Exit_error err_build_fail;
166 #---------------------------------------------
169 if [ "$#" == 0 ]; then
174 while test $# -gt 0 ; do
177 COMMAND="version"; shift ;;
179 CVSROOT=":pserver:cvs@cvs.pld.org.pl:/cvsroot"; shift ;;
181 COMMAND="build"; shift ;;
183 shift; CVSROOT="${1}"; shift ;;
185 COMMAND="get"; shift ;;
187 COMMAND="usage"; shift ;;
189 shift; LOGFILE="${1}"; shift ;;
191 QUIET="--quiet"; shift ;;
193 BE_VERBOSE="1"; shift ;;
195 SPECFILE="${1}"; shift ;;
202 if [ "$SPECFILE" != "" ]; then
208 Exit_error err_no_spec_in_cmdl;
213 if [ "$SPECFILE" != "" ]; then
218 Exit_error err_no_spec_in_cmdl;