summaryrefslogtreecommitdiffstats
path: root/contrib/build-rpm
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 15:49:25 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 15:49:25 +0000
commit464df1d5e5ab1322e2dd0a7796939fff1aeefa9a (patch)
tree6a403684e0978f0287d7f0ec0e5aab1fd31a59e1 /contrib/build-rpm
parentInitial commit. (diff)
downloade2fsprogs-upstream.tar.xz
e2fsprogs-upstream.zip
Adding upstream version 1.47.0.upstream/1.47.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'contrib/build-rpm')
-rw-r--r--contrib/build-rpm45
1 files changed, 45 insertions, 0 deletions
diff --git a/contrib/build-rpm b/contrib/build-rpm
new file mode 100644
index 0000000..0b06071
--- /dev/null
+++ b/contrib/build-rpm
@@ -0,0 +1,45 @@
+#!/bin/sh
+
+# enable xtrace output if requested
+if [ -n ${ENABLE_XTRACE:-''} ]; then
+ set -x
+fi
+
+# Build an e2fsprogs RPM from cvs
+
+pwd=`pwd`
+currdir=`basename $pwd`
+pkgname=`grep Name: e2fsprogs.spec | awk '{print $2;}'`
+pkgvers=`grep Version: e2fsprogs.spec | awk '{print $2;}'`
+builddir=${pkgname}-${pkgvers}
+
+# ensure that $TMP is set to something
+TMP=${TMP:-'/tmp'}
+
+cd ..
+tmpdir=`mktemp -d ${RPM_TMPDIR:-$TMP}/rpmtmp.XXXXXX`
+
+# We need to build a tarball for the SRPM using $builddir as the
+# directory name (since that's what RPM will expect it to unpack
+# into). That may require a symlink.
+
+# Make a recursive-symlink copy of the source dir
+cp -sR `pwd`/$currdir $tmpdir/$builddir || exit 1
+
+# Remove any build files from the temporary tarball directory
+[ -f $tmpdir/$builddir/Makefile ] && make -C $tmpdir/$builddir distclean
+
+EXCLUDE="--exclude .hg* --exclude .pc*"
+(cd $tmpdir && tar czfh ${builddir}.tar.gz $EXCLUDE $builddir)
+
+[ "`rpmbuild --version 2> /dev/null`" ] && RPM=rpmbuild || RPM=rpm
+
+$RPM --define "_sourcedir $tmpdir" \
+ --define "_topdir ${RPM_TOPDIR:-$(rpm -E %_topdir)}" \
+ --define "_tmpdir ${RPM_TMPDIR:-$TMP}" \
+ --define "extra_config_flags ${EXTRA_CONFIG_FLAGS:-''}" \
+ -ba $currdir/e2fsprogs.spec
+
+rpm_exit=$?
+rm -rf $tmpdir
+exit $rpm_exit