From 8ebe821650ad219ee23fdff9a814c65e0b2316c8 Mon Sep 17 00:00:00 2001 From: zouzhimin Date: Thu, 29 Feb 2024 17:46:13 +0800 Subject: [PATCH] Add rpm make rule for testing (cherry picked from commit b31414165051d3341510b12acf6282d599ccc71e) --- Add-rpm-make-rule-for-testing.patch | 154 ++++++++++++++++++++++++++++ gfs2-utils.spec | 6 +- 2 files changed, 159 insertions(+), 1 deletion(-) create mode 100644 Add-rpm-make-rule-for-testing.patch diff --git a/Add-rpm-make-rule-for-testing.patch b/Add-rpm-make-rule-for-testing.patch new file mode 100644 index 0000000..08d1c9d --- /dev/null +++ b/Add-rpm-make-rule-for-testing.patch @@ -0,0 +1,154 @@ +From 7e17886e413313827470a5bf5723511c34e5d8dd Mon Sep 17 00:00:00 2001 +From: Andrew Price +Date: May 04 2023 09:40:44 +0000 +Subject: Add rpm make rule for testing + + +'make rpm' generates a minimal gfs2-utils.spec from gfs2-utils.spec.in +and builds the rpm directly from the source tree. + +The spec files are kept in tests/ to make sure they're not used for +anything else. The rpm rule depends on the clean rule as the spec file +needs to be regenerated each time in order to set the correct git +version. + +An example resulting rpm is: + + rpmbuild/x86_64/gfs2-utils-3.5.1.1.dev-2.ge3f9cb1.x86_64.rpm + +Where 3.5.1.1.dev is the package version and 2.ge3f9cb1 is generated by +'git describe', where HEAD is 2 commits along from the latest annotated +tag and its commit hash is e3f9cb1. If there are outstanding changes in +the working tree, ".dirty" is appended after the commit hash. + +When the source tree is not a git tree, the appended rpm release is 0. + +Signed-off-by: Andrew Price + +--- + +diff --git a/Makefile.am b/Makefile.am +index f04c1d3..05bc0f6 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -33,3 +33,25 @@ SUBDIRS = \ + + maintainer-clean-local: + rm -rf m4 ++ ++RPMSPEC = tests/gfs2-utils.spec ++GITVERSION := \ ++ $(shell git describe --dirty 2>/dev/null | grep - | cut -d- -f2- | tr - .) ++RPMRELEASE = $(or $(GITVERSION), "0") ++ ++$(RPMSPEC): $(RPMSPEC).in $(top_builddir)/config.status ++ cd $(top_builddir) && ./config.status $@ ++ ++RPMBUILDDIR = "$(abs_builddir)/rpmbuild" ++RPMBUILDOPTS = \ ++ --buildroot $(RPMBUILDDIR)/buildroot \ ++ --define "_sourcedir $(abs_builddir)" \ ++ --define "_specdir $(abs_builddir)" \ ++ --define "_builddir $(abs_builddir)" \ ++ --define "_srcrpmdir $(RPMBUILDDIR)" \ ++ --define "_rpmdir $(RPMBUILDDIR)" \ ++ --define "rpmrelease $(RPMRELEASE)" ++ ++rpm: $(RPMSPEC) ++ mkdir -p $(RPMBUILDDIR) ++ rpmbuild $(RPMBUILDOPTS) -bb $(RPMSPEC) +diff --git a/configure.ac b/configure.ac +index b8d123b..36a5cde 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -234,6 +234,7 @@ AC_CONFIG_FILES([Makefile + doc/Makefile + tests/Makefile + tests/atlocal ++ tests/gfs2-utils.spec + po/Makefile.in + ]) + +diff --git a/tests/Makefile.am b/tests/Makefile.am +index 691fb37..e3db6f0 100644 +--- a/tests/Makefile.am ++++ b/tests/Makefile.am +@@ -7,13 +7,16 @@ EXTRA_DIST = \ + $(TESTSUITE_AT) \ + $(TESTSCRIPTS) \ + package.m4 \ ++ gfs2-utils.spec.in \ + atlocal.in + + DISTCLEANFILES = \ + atlocal \ + atconfig + +-CLEANFILES = testvol ++CLEANFILES = \ ++ testvol \ ++ gfs2-utils.spec + + noinst_PROGRAMS = nukerg + +diff --git a/tests/gfs2-utils.spec.in b/tests/gfs2-utils.spec.in +new file mode 100644 +index 0000000..5b3a62b +--- /dev/null ++++ b/tests/gfs2-utils.spec.in +@@ -0,0 +1,54 @@ ++# Spec file only used for testing. Don't use for distro packaging. ++ ++# Don't require a changelog ++%global source_date_epoch_from_changelog 0 ++ ++Name: gfs2-utils ++Version: @PACKAGE_VERSION@ ++Release: %{rpmrelease} ++License: GPLv2+ and LGPLv2+ ++Group: System Environment/Kernel ++Summary: Utilities for managing the global file system (GFS2) ++BuildRequires: ncurses-devel ++BuildRequires: kernel-headers ++BuildRequires: automake ++BuildRequires: libtool ++BuildRequires: zlib-devel ++BuildRequires: gettext-devel ++BuildRequires: bison ++BuildRequires: flex ++BuildRequires: libblkid-devel ++BuildRequires: libuuid-devel ++BuildRequires: check-devel ++Source: https://releases.pagure.org/gfs2-utils/gfs2-utils-%{version}.tar.gz ++URL: https://pagure.io/gfs2-utils ++ ++%build ++./configure ++make clean ++make %{_smp_mflags} V=1 ++ ++%install ++make -C gfs2 install DESTDIR=%{buildroot} ++rm -f %{buildroot}/usr/sbin/gfs2_trace ++rm -f %{buildroot}/usr/sbin/gfs2_lockcapture ++ ++%description ++gfs2-utils test rpm ++ ++%files ++%doc doc/COPYING.* doc/COPYRIGHT doc/*.txt ++%doc doc/README.contributing doc/README.licence ++%{_sbindir}/fsck.gfs2 ++%{_sbindir}/gfs2_grow ++%{_sbindir}/gfs2_jadd ++%{_sbindir}/mkfs.gfs2 ++%{_sbindir}/gfs2_convert ++%{_sbindir}/gfs2_edit ++%{_sbindir}/tunegfs2 ++%{_sbindir}/glocktop ++%{_libexecdir}/gfs2_withdraw_helper ++%{_mandir}/man8/*gfs2* ++%{_mandir}/man8/glocktop* ++%{_mandir}/man5/* ++%{_prefix}/lib/udev/rules.d/82-gfs2-withdraw.rules + diff --git a/gfs2-utils.spec b/gfs2-utils.spec index efd60f2..77a80fe 100644 --- a/gfs2-utils.spec +++ b/gfs2-utils.spec @@ -1,11 +1,12 @@ Name: gfs2-utils Version: 3.5.1 -Release: 1 +Release: 2 Summary: Utilities for managing the global file system (GFS2) License: GPLv2+ and LGPLv2+ URL: https://pagure.io/gfs2-utils Source0: https://releases.pagure.org/gfs2-utils/gfs2-utils-%{version}.tar.gz +Patch0: Add-rpm-make-rule-for-testing.patch BuildRequires: ncurses-devel kernel-headers automake libtool zlib-devel gettext-devel BuildRequires: bison flex libblkid-devel libuuid-devel check-devel bzip2-devel make @@ -55,6 +56,9 @@ rm -f %{buildroot}%{_defaultdocdir}/gfs2-utils/README.licence %changelog +* Tue Feb 27 2024 zouzhimin - 3.5.1-2 +- Add rpm make rule for testing + * Tue Oct 10 2023 Ge Wang - 3.5.1-1 - Update to version 3.5.1 -- Gitee