]> git.pld-linux.org Git - packages/rpm-build-tools.git/blobdiff - builder_.sh
- requires_ge as nil
[packages/rpm-build-tools.git] / builder_.sh
index de5f96649ea324f5663cc703d6438a977efb6e65..f9d2db7d59e807f495a26f6c7307a050f2c8b6c8 100644 (file)
 # - funny bug, if source-md5 is set then builder will download from distfiles even if there is no url present:
 #   Source10:  forwardfix.pl
 #   # Source10-md5:    8bf85f7368933a4e0cb4f875bac28733
-
-RCSID='$Id$'
-r=${RCSID#* * }
-rev=${r%% *}
+# - builder --help:
+#      basename: missing operand
+#      Try `basename --help' for more information.
+#      -- and the normal usage info --
+
+PROGRAM=${0##*/}
+APPDIR=$(d=$0; [ -L "$d" ] && d=$(readlink -f "$d"); dirname "$d")
+RCSID='$Id$' r=${RCSID#* * } rev=${r%% *}
 VERSION="v0.35/$rev"
 VERSIONSTRING="\
 Build package utility from PLD Linux CVS repository
@@ -208,6 +212,15 @@ else
        RPMBUILD="rpmbuild"
 fi
 
+#
+# sanity checks
+#
+if [ -d $HOME/rpm/SOURCES ]; then
+       echo "ERROR: ~/rpm/{SPECS,SOURCES} structure is obsolete" >&2
+       echo "ERROR: get rid of your ~/rpm/SOURCES" >&2
+       exit 1
+fi
+
 #
 # are we using cvs-nserver ?
 #
@@ -445,6 +458,7 @@ minirpm() {
 %x8664 x86_64 amd64 ia32e
 %alt_kernel %{nil}
 %_alt_kernel %{nil}
+%bootstrap_release() %{1}
 %requires_releq_kernel_up(s:n:) %{nil}
 %requires_releq_kernel_smp(s:n:) %{nil}
 %requires_releq_kernel(s:n:) %{nil}
@@ -487,6 +501,8 @@ minirpm() {
 %remove_etc_shells(p) %{p:<lua>}
 %lua_add_etc_shells()  %{nil}
 %lua_remove_etc_shells() %{nil}
+%required_jdk %{nil}
+%buildrequires_jdk %{nil}
 EOF
        if [ "$NOINIT" = "yes" ] ; then
                cat >> $BUILDER_MACROS <<'EOF'
@@ -549,7 +565,7 @@ rpm_dump() {
 
 get_icons() {
        update_shell_title "get icons"
-       ICONS=$(awk '/^Icon:/ {print $2}' ${ASSUMED_NAME}/${SPECFILE})
+       ICONS=$(awk '/^Icon:/ {print $2}' $PACKAGE_DIR/${SPECFILE})
        if [ -z "$ICONS" ]; then
                return
        fi
@@ -1375,6 +1391,27 @@ check_buildarch() {
        fi
 }
 
+# from relup.sh
+set_release() {
+       local specfile="$1"
+       local rel="$2"
+       local newrel="$3"
+       sed -i -e "
+               s/^\(%define[ \t]\+_\?rel[ \t]\+\)$rel\$/\1$newrel/
+               s/^\(Release:[ \t]\+\)$rel\$/\1$newrel/
+       " $specfile
+}
+
+set_version() {
+       local specfile="$1"
+       local ver="$2"
+       local newver="$3"
+       sed -i -e "
+               s/^\(%define[ \t]\+_\?ver[ \t]\+\)$ver\$/\1$newver/
+               s/^\(Version:[ \t]\+\)$ver\$/\1$newver/
+       " $specfile
+}
+
 build_package() {
        update_shell_title "build_package"
        if [ -n "$DEBUG" ]; then
@@ -1385,29 +1422,29 @@ build_package() {
        cd "$PACKAGE_DIR"
 
        if [ -n "$TRY_UPGRADE" ]; then
+               local TNOTIFY TNEWVER TOLDVER
                update_shell_title "build_package: try_upgrade"
+
                if [ -n "$FLOAT_VERSION" ]; then
-                       TNOTIFY=$(./pldnotify.awk $SPECFILE -n) || exit 1
+                       TNOTIFY=$($APPDIR/pldnotify.awk ${BE_VERBOSE:+-vDEBUG=1} $SPECFILE -n) || exit 1
                else
-                       TNOTIFY=$(./pldnotify.awk $SPECFILE) || exit 1
+                       TNOTIFY=$($APPDIR/pldnotify.awk ${BE_VERBOSE:+-vDEBUG=1} $SPECFILE) || exit 1
                fi
 
                TNEWVER=$(echo $TNOTIFY | awk '{ match($4,/\[NEW\]/); print $5 }')
 
                if [ -n "$TNEWVER" ]; then
                        TOLDVER=`echo $TNOTIFY | awk '{ print $3; }'`
-                       echo "New version found, updating spec file to version " $TNEWVER
+                       echo "New version found, updating spec file from $TOLDVER to version $TNEWVER"
                        if [ "$REVERT_BROKEN_UPGRADE" = "yes" ]; then
                                cp -f $SPECFILE $SPECFILE.bak
                        fi
                        chmod +w $SPECFILE
-                       eval "perl -pi -e 's/Version:\t"$TOLDVER"/Version:\t"$TNEWVER"/gs' $SPECFILE"
-                       eval "perl -pi -e 's/Release:\t[1-9]{0,4}/Release:\t0.1/' $SPECFILE"
+                       set_release $SPECFILE $PACKAGE_RELEASE 0.1
+                       set_version $SPECFILE $PACKAGE_VERSION $TNEWVER
                        parse_spec
                        NODIST="yes" get_files $SOURCES $PATCHES
                        update_md5 $SOURCES
-
-                       unset TOLDVER TNEWVER TNOTIFY
                fi
        fi
        cd "$PACKAGE_DIR"
This page took 0.072595 seconds and 4 git commands to generate.