]> git.pld-linux.org Git - packages/rpm-build-tools.git/blobdiff - builder.sh
- fix log4j name
[packages/rpm-build-tools.git] / builder.sh
index 2cdf9d778b8f30bf1cbab04e8d3754d2cad2483d..c9dd23dfc1a1e762ace26fd7c70cc88adfaa2528 100644 (file)
@@ -1,4 +1,8 @@
 #!/bin/ksh
+# 
+# This program is free software, distributed under the terms of
+# the GNU General Public License Version 2.
+#
 # -----------
 # Exit codes:
 #        0 - succesful
@@ -22,7 +26,7 @@
 RCSID='$Id$'
 r=${RCSID#* * }
 rev=${r%% *}
-VERSION="v0.18/$rev"
+VERSION="v0.20/$rev"
 VERSIONSTRING="\
 Build package utility from PLD Linux CVS repository
 $VERSION (C) 1999-2007 Free Penguins".
@@ -48,6 +52,7 @@ ADD5=""
 NO5=""
 ALWAYS_CVSUP=${ALWAYS_CVSUP:-"yes"}
 CVSROOT=""
+GREEDSRC=""
 
 # user agent when fetching files
 USER_AGENT="PLD/Builder($VERSION)"
@@ -210,7 +215,7 @@ Usage: builder [-D|--debug] [-V|--version] [--short-version] [-a|--as_anon] [-b|
 [-g|--get] [-h|--help] [--http] [{-l|--logtofile} <logfile>] [-m|--mr-proper]
 [-q|--quiet] [--date <yyyy-mm-dd> [-r <cvstag>] [{-T|--tag <cvstag>]
 [-Tvs|--tag-version-stable] [-Ts|--tag-stable] [-Tv|--tag-version]
-[{-Tp|--tag-prefix} <prefix>] [{-tt|--test-tag}]
+[{-Tp|--tag-prefix} <prefix>] [{-tt|--test-tag}] [--use-greed-sources]
 [-nu|--no-urls] [-v|--verbose] [--opts <rpm opts>] [--short-circuit]
 [--show-bconds] [--with/--without <feature>] [--define <macro> <value>]
 <package>[.spec][:cvstag]
@@ -312,6 +317,9 @@ Usage: builder [-D|--debug] [-V|--version] [--short-version] [-a|--as_anon] [-b|
 -u, --try-upgrade   - check version, and try to upgrade package
 -un, --try-upgrade-with-float-version
                     - as above, but allow float version
+--use-greed-sources
+                    - try download source from tag head if don't find it in
+                      current tag      
 -U, --update        - refetch sources, don't use distfiles, and update md5 comments
 -Upi, --update-poldek-indexes
                     - refresh or make poldek package index files.
@@ -410,6 +418,10 @@ minirpm() {
 %__php_api_requires() %{nil}
 %php_major_version ERROR
 %php_api_version ERROR
+%requires_xorg_xserver_extension %{nil}
+%requires_xorg_xserver_xinput %{nil}
+%requires_xorg_xserver_font %{nil}
+%requires_xorg_xserver_videodrv %{nil}
 %py_ver ERROR
 %perl_vendorarch ERROR
 %perl_vendorlib ERROR
@@ -606,8 +618,12 @@ init_builder()
        fi
 
        if [ "$NOINIT" != "yes" ] ; then
-               SOURCE_DIR="`eval $RPM $RPMOPTS --define '"name $ASSUMED_NAME"' --eval '%{_sourcedir}'`"
-               SPECS_DIR="`eval $RPM $RPMOPTS --define '"name $ASSUMED_NAME"' --eval '%{_specdir}'`"
+               local extra
+               if [ "$ASSUMED_NAME" ]; then
+                       extra="--define 'name $ASSUMED_NAME'"
+               fi
+               SOURCE_DIR="`eval $RPM $RPMOPTS $extra --eval '%{_sourcedir}'`"
+               SPECS_DIR="`eval $RPM $RPMOPTS $extra --eval '%{_specdir}'`"
        else
                SOURCE_DIR="."
                SPECS_DIR="."
@@ -1036,7 +1052,11 @@ get_files()
 
                        # the md5 check must be moved elsewhere as if we've called from update_md5 the md5 is wrong.
                        if [ ! -f "$fp" -a "$FAIL_IF_NO_SOURCES" != "no" ]; then
-                               Exit_error err_no_source_in_repo $i
+                               if [ -n "GREEDSRC" ]; then
+                                       get_greed_sources $i
+                               else
+                                       Exit_error err_no_source_in_repo $i
+                               fi
                        fi
 
                        # we check md5 here just only to refetch immediately
@@ -1140,6 +1160,8 @@ tag_files()
                local fp=`nourl "$i"`
                if [ -f "$fp" ]; then
                        tag_files="$tag_files $fp"
+               elif [ -n "GREEDSRC" ]; then
+                       get_greed_sources $i
                else
                        Exit_error err_no_source_in_repo $i
                fi
@@ -1148,11 +1170,18 @@ tag_files()
        if [ "$tag_files" ]; then
                if [ "$TAG_VERSION" = "yes" ]; then
                        update_shell_title "tag sources: $TAGVER"
+                       printf "Tagging %d files\n" $(echo $tag_files | wc -w)
                        cvs $OPTIONS $TAGVER $tag_files || exit
                fi
                if [ -n "$TAG" ]; then
                        update_shell_title "tag sources: $TAG"
-                       cvs $OPTIONS $TAG $tag_files || exit
+
+                       while [ "$tag_files" ]; do
+                               local chunk=$(echo $tag_files | tr ' ' '\n' | head -n 100)
+                               printf "Tagging %d files\n" $(echo $chunk | wc -w)
+                               cvs $OPTIONS $TAG $chunk || exit
+                               tag_files=$(echo $tag_files | tr ' ' '\n' | tail +101)
+                       done
                fi
        fi
 
@@ -1190,6 +1219,8 @@ branch_files()
                local fp=`nourl "$i"`
                if [ -f "$fp" ]; then
                        tag_files="$tag_files $fp"
+               elif [ -n "GREEDSRC" ]; then
+                       get_greed_sources $i
                else
                        Exit_error err_no_source_in_repo $i
                fi
@@ -1828,6 +1859,18 @@ init_rpm_dir() {
        echo "- edit $SOURCE_DIR/CVS/Root"
 }
 
+get_greed_sources() {
+       CVSROOT=":pserver:cvs@$CVS_SERVER:/cvsroot"
+       if [ -n "BE_VERBOSE" ]; then
+               echo "Try greed download: $1 from: $CVSROOT"
+       fi
+       cvs -d $CVSROOT get SOURCES/$1
+       if [ $? != 0 ]; then
+               Exit_error err_no_source_in_repo $1
+       fi
+       
+}
+
 #---------------------------------------------
 # main()
 
@@ -1880,7 +1923,7 @@ while [ $# -gt 0 ]; do
                -c | --clean )
                        CLEAN="--clean --rmspec --rmsource"; shift ;;
                -cf | --cvs-force )
-                       CVS_FORCE="-F"; shift;;
+                       CVS_FORCE="-F -B"; shift;;
                -d | --cvsroot )
                        shift; CVSROOT="${1}"; shift ;;
                -g | --get )
@@ -2033,6 +2076,9 @@ while [ $# -gt 0 ]; do
                --init-rpm-dir)
                        COMMAND="init_rpm_dir"
                        shift ;;
+               --use-greed-sources )
+                       GREEDSRC="1"
+                       shift;;
                -u | --try-upgrade )
                        TRY_UPGRADE="1"; shift ;;
                -un | --try-upgrade-with-float-version )
This page took 0.036187 seconds and 4 git commands to generate.