Patchwork [01,of,10,v2] buildrpm: introduce --prepare for preparing without actually building rpms

login
register
mail settings
Submitter Mads Kiilerich
Date Aug. 31, 2014, 11:41 a.m.
Message ID <4e1db429819c46d7160f.1409485291@localhost.localdomain>
Download mbox | patch
Permalink /patch/5657/
State Accepted
Headers show

Comments

Mads Kiilerich - Aug. 31, 2014, 11:41 a.m.
# HG changeset patch
# User Mads Kiilerich <madski@unity3d.com>
# Date 1409482266 -7200
#      Sun Aug 31 12:51:06 2014 +0200
# Node ID 4e1db429819c46d7160f33e7cf9087c5ae281d8f
# Parent  ca6d28307d6fd64a0ff9d9504b91f07b1601dc36
buildrpm: introduce --prepare for preparing without actually building rpms

Patch

diff --git a/contrib/buildrpm b/contrib/buildrpm
--- a/contrib/buildrpm
+++ b/contrib/buildrpm
@@ -7,6 +7,20 @@ 
 # - CentOS 5
 # - centOS 6
 
+BUILD=1
+while [ "$1" ]; do
+    case "$1" in
+    --prepare )
+        shift
+        BUILD=
+        ;;
+    * )
+        echo "Invalid parameter $1!" 1>&2
+        exit 1
+        ;;
+    esac
+done
+
 cd "`dirname $0`/.."
 
 specfile=contrib/mercurial.spec
@@ -95,9 +109,14 @@  for l in sys.stdin.readlines():
 
 fi
 
-rpmbuild --define "_topdir $rpmdir" -ba $rpmspec --clean
-if [ $? = 0 ]; then
-    echo
-    echo "Packages are in $rpmdir:"
-    ls -l $rpmdir/*RPMS/*
+if [ "$BUILD" ]; then
+    rpmbuild --define "_topdir $rpmdir" -ba $rpmspec --clean
+    if [ $? = 0 ]; then
+        echo
+        echo "Built packages for $version-$release:"
+        find $rpmdir/*RPMS/ -type f -newer $rpmspec
+    fi
+else
+    echo "Prepared sources for $version-$release $rpmspec are in $rpmdir/SOURCES/ - use like:"
+    echo "rpmbuild --define '_topdir $rpmdir' -ba $rpmspec --clean"
 fi