]> git.pld-linux.org Git - packages/rpm.git/blobdiff - builder
- allow %banner work without heredoc
[packages/rpm.git] / builder
diff --git a/builder b/builder
index da5643699544a2df84397fed8d06d6d0e705665b..c9dd23dfc1a1e762ace26fd7c70cc88adfaa2528 100644 (file)
--- a/builder
+++ b/builder
@@ -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".
@@ -42,11 +46,13 @@ NOCVS=""
 NOCVSSPEC=""
 NODIST=""
 NOINIT=""
+PREFMIRRORS=""
 UPDATE=""
 ADD5=""
 NO5=""
 ALWAYS_CVSUP=${ALWAYS_CVSUP:-"yes"}
 CVSROOT=""
+GREEDSRC=""
 
 # user agent when fetching files
 USER_AGENT="PLD/Builder($VERSION)"
@@ -209,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]
@@ -259,6 +265,7 @@ Usage: builder [-D|--debug] [-V|--version] [--short-version] [-a|--as_anon] [-b|
 -ns, --no-srcs      - don't download Sources
 -ns0, --no-source0  - don't download Source0
 -nn, --no-net       - don't download anything from the net
+-pm, --prefer-mirrors - prefer mirrors (if any) over distfiles for SOURCES
 --no-init           - don't initialize builder paths (SPECS and SOURCES)
 -ske,
 --skip-existing-files - skip existing files in get_files
@@ -310,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.
@@ -408,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
@@ -519,7 +533,7 @@ parse_spec()
        PACKAGE_RELEASE=$(rpm_dump | awk '$2 == "PACKAGE_RELEASE" { print $3; exit}')
 
        if [ "$PACKAGE_NAME" != "$ASSUMED_NAME" ]; then
-               echo "WARNING! Spec name ($ASSUMED_NAME) does not agree with package name ($PACKAGE_NAME)"
+               echo >&2 "WARNING! Spec name ($ASSUMED_NAME) does not agree with package name ($PACKAGE_NAME)"
        fi
 
        if [ -n "$BE_VERBOSE" ]; then
@@ -604,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="."
@@ -943,9 +961,9 @@ get_files()
                                        fi
                                        target="$fp"
 
-                                       # prefer mirror over distfiles if there's mirror
+                                       # optionally prefer mirror over distfiles if there's mirror
                                        # TODO: build url list and then try each url from the list
-                                       if [ -z "$NOMIRRORS" ] && im=$(find_mirror "$i") && [ "$im" != "$i" ]; then
+                                       if [ -n "$PREFMIRRORS" ] && [ -z "$NOMIRRORS" ] && im=$(find_mirror "$i") && [ "$im" != "$i" ]; then
                                                url="$im"
                                        else
                                                url=$(distfiles_url "$i")
@@ -1034,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
@@ -1138,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
@@ -1146,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
 
@@ -1188,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
@@ -1631,8 +1664,8 @@ fetch_build_requires()
                        local DEPS=$(rpm-getdeps $BCOND $SPECFILE 2> /dev/null | awk '/^\+/ { print $3 } ' | _rpm_prov_check | xargs)
 
                        if [ -n "$CNFL" ] || [ -n "$DEPS" ]; then
-                               echo "fetch builderequires: install $DEPS; remove $CNFL"
-                               update_shell_title "poldek: install $DEPS; remove $CNFL"
+                               echo "fetch builderequires: install [$DEPS]; remove [$CNFL]"
+                               update_shell_title "poldek: install [$DEPS]; remove [$CNFL]"
                                $SU_SUDO /usr/bin/poldek -q --update || $SU_SUDO /usr/bin/poldek -q --upa
                        fi
                        if [ -n "$CNFL" ]; then
@@ -1826,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()
 
@@ -1878,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 )
@@ -1918,6 +1963,9 @@ while [ $# -gt 0 ]; do
                        NOSRCS="yes"
                        ALWAYS_CVSUP="no"
                        shift;;
+               -pm | --prefer-mirrors )
+                       PREFMIRRORS="yes"
+                       shift;;
                --no-init )
                        NOINIT="yes"
                        shift;;
@@ -2028,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 )
@@ -2075,7 +2126,7 @@ while [ $# -gt 0 ]; do
                                CVSTAG="${SPECFILE##*:}"
                                SPECFILE="${SPECFILE%%:*}"
                        fi
-                       ASSUMED_NAME="${SPECFILE%%.spec}"
+                       ASSUMED_NAME="$(basename ${SPECFILE%%.spec})"
                        shift
        esac
 done
This page took 0.039985 seconds and 4 git commands to generate.