changeset 22435:4c4385eb26bc

buildrpm: introduce --prepare for preparing without actually building rpms
author Mads Kiilerich <madski@unity3d.com>
date Sun, 31 Aug 2014 12:51:06 +0200
parents 40ce05b50148
children 96d95b75a63b
files contrib/buildrpm
diffstat 1 files changed, 24 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/buildrpm	Thu Aug 28 22:45:36 2014 +0900
+++ b/contrib/buildrpm	Sun Aug 31 12:51:06 2014 +0200
@@ -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 @@
 
 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