Patchwork [08,of,22] buildrpm: introduce --prepare for preparing without actually building rpms

login
register
mail settings
Submitter Mads Kiilerich
Date May 20, 2014, 2:10 a.m.
Message ID <0315b1a374c026070f0d.1400551803@mk-desktop>
Download mbox | patch
Permalink /patch/4830/
State Superseded
Commit 4c4385eb26bc4638ff0308a8b86f8dea247c852f
Headers show

Comments

Mads Kiilerich - May 20, 2014, 2:10 a.m.
# HG changeset patch
# User Mads Kiilerich <madski@unity3d.com>
# Date 1400551681 -7200
#      Tue May 20 04:08:01 2014 +0200
# Node ID 0315b1a374c026070f0dd40beabbd78441aea6f1
# Parent  5af66dd01b59fe9be2e918f8f1840a9690342469
buildrpm: introduce --prepare for preparing without actually building rpms

Patch

diff --git a/contrib/buildrpm b/contrib/buildrpm
--- a/contrib/buildrpm
+++ b/contrib/buildrpm
@@ -13,6 +13,7 @@  else
     echo "Using \$REV=$REV for --rev" 1>&2
 fi
 RPMBUILDDIR="$PWD/rpmbuild"
+BUILD=1
 while [ "$1" ]; do
     case "$1" in
     -r | --rev )
@@ -25,6 +26,10 @@  while [ "$1" ]; do
         RPMBUILDDIR="$1"
         shift
         ;;
+    --prepare )
+        shift
+        BUILD=
+        ;;
     * )
         echo "Invalid parameter $1!" 1>&2
         exit 1
@@ -87,9 +92,13 @@  sed \
     -T '* {date(date|localdate, "%a %b %d %Y")} {author} {sub("-rc-1$", "-0.rc", sub(r"(?<=^\d\.\d)(?=(-rc)?-1$)", ".0", "{latesttag}-1"))}.{latesttagdistance}.{node|short}\n{if(tags,"- {tags}\n")}- {desc|firstline}\n\n'
 ) > $rpmspec
 
-rpmbuild --define "_topdir $RPMBUILDDIR" -ba $rpmspec --clean
-if [ $? = 0 ]; then
-    echo
-    echo "Packages are in $RPMBUILDDIR:"
-    ls -l $RPMBUILDDIR/*RPMS/*
+if [ "$BUILD" ]; then
+    rpmbuild --define "_topdir $RPMBUILDDIR" -ba $rpmspec --clean
+    if [ $? = 0 ]; then
+        echo
+        echo "Built packages:"
+        find $RPMBUILDDIR/*RPMS/ -type f -newer $rpmspec
+    fi
+else
+    echo "Prepared sources for $rpmspec in $RPMBUILDDIR/SOURCES/"
 fi