From de9ce505bb14390797ea1f9c386f12f7d8ceddd3 Mon Sep 17 00:00:00 2001 From: Deepak Bhole Date: Tue, 12 Sep 2006 22:24:31 +0000 Subject: [PATCH] Fix brp-java-repack-jars to work with builddirs that aren't %name-%version --- brp-java-repack-jars | 33 +++++++++++++++++++++++---------- redhat-rpm-config.spec | 5 ++++- 2 files changed, 27 insertions(+), 11 deletions(-) diff --git a/brp-java-repack-jars b/brp-java-repack-jars index 7ab61a7..9a38347 100644 --- a/brp-java-repack-jars +++ b/brp-java-repack-jars @@ -42,16 +42,23 @@ if [ ! -z "$JARS" ]; then # Get the modtime from the newest ChangeLog. If the project # doesn't have a ChangeLog, Jan 1, 1970 will be used. - CHANGELOGS=`find $RPM_BUILD_DIR/$RPM_PACKAGE_NAME-$RPM_PACKAGE_VERSION -type f -name ChangeLog` DATE="1970-01-01 UTC" - if [ ! -z "$CHANGELOGS" ]; then - for c in $CHANGELOGS; do - TMPDATE=`stat -c %y $c | cut -d " " -f 1-2` - if [ `date --date="$TMPDATE" +%s` -gt `date --date="$DATE" +%s` ]; then - DATE="$TMPDATE" - fi - done - fi + + if [ -z $_PACKAGE_BUILD_DIR ]; then + _PACKAGE_BUILD_DIR=$RPM_BUILD_DIR/$RPM_PACKAGE_NAME-$RPM_PACKAGE_VERSION + fi + + if [ -d $_PACKAGE_BUILD_DIR ]; then + CHANGELOGS=`find $_PACKAGE_BUILD_DIR -type f -name ChangeLog` + if [ ! -z "$CHANGELOGS" ]; then + for c in $CHANGELOGS; do + TMPDATE=`stat -c %y $c | cut -d " " -f 1-2` + if [ `date --date="$TMPDATE" +%s` -gt `date --date="$DATE" +%s` ]; then + DATE="$TMPDATE" + fi + done + fi + fi # move the contents over to the a new directory in order and set # the times. @@ -66,7 +73,13 @@ if [ ! -z "$JARS" ]; then # make the jar pushd $JARDIR > /dev/null - find . -type f -print | LC_ALL=C sort | /usr/bin/zip -q -X -9 $j -@ + + if [ -n "`find -type f`" ]; then + find -type f -print | LC_ALL=C sort | /usr/bin/zip -q -X -9 $j -@ + else + # Put the empty jar back + touch $j + fi popd > /dev/null # Cleanup. diff --git a/redhat-rpm-config.spec b/redhat-rpm-config.spec index 8902622..dbb1af9 100644 --- a/redhat-rpm-config.spec +++ b/redhat-rpm-config.spec @@ -1,7 +1,7 @@ Summary: Red Hat specific rpm configuration files. Name: redhat-rpm-config Version: 8.0.45 -Release: 5 +Release: 6 License: GPL Group: Development/System Source: redhat-rpm-config-%{version}.tar.gz @@ -40,6 +40,9 @@ rm -rf ${RPM_BUILD_ROOT} %{_prefix}/lib/rpm/redhat %changelog +* Tue Sep 12 2006 Deepak Bhole 8.0.45-6 +- Fix brp-java-repack-jars to work with builddirs that aren't %name-%version + * Mon Sep 11 2006 Fernando Nasser - 8.0.45-5 - Fix order of tokens in find command (thanks mikeb@redhat.com)