From ff77753d98ee151daa3be382bf08b136a38694a9 Mon Sep 17 00:00:00 2001 From: bizhiyuan Date: Fri, 9 Aug 2024 17:41:37 +0800 Subject: [PATCH] Add support for building with mock and delete -S git from %autosetup (cherry picked from commit 1a54b4cbacd22cf29d9fa0a0d32cd73f0ff04810) --- ...d-Add-support-for-building-with-mock.patch | 58 +++++++++++++++++++ ...rt-rpm-Add-gcc-as-a-build-dependency.patch | 25 ++++++++ ...e-the-tar-file-as-part-of-make-clean.patch | 24 ++++++++ booth.spec | 11 +++- 4 files changed, 116 insertions(+), 2 deletions(-) create mode 100644 backport-build-Add-support-for-building-with-mock.patch create mode 100644 backport-rpm-Add-gcc-as-a-build-dependency.patch create mode 100644 backport-rpm-Remove-the-tar-file-as-part-of-make-clean.patch diff --git a/backport-build-Add-support-for-building-with-mock.patch b/backport-build-Add-support-for-building-with-mock.patch new file mode 100644 index 0000000..e21df72 --- /dev/null +++ b/backport-build-Add-support-for-building-with-mock.patch @@ -0,0 +1,58 @@ +From 4f87eb50aac9323ffed4d1e89620c9b60e75bcd7 Mon Sep 17 00:00:00 2001 +From: Chris Lumens +Date: Mon, 6 May 2024 09:46:50 -0400 +Subject: [PATCH 17/20] build: Add support for building with mock. + +The makefile target includes the name of the mock chroot you want to use +when building. Most of the time for booth, you'd use it like so: + +$ make mock-centos-stream+epel-9-x86_64 + +You may wish to change the release or arch, but due to the build +requirement on asciidoctor, it looks like epel always needs to be +included. +--- + Makefile.am | 13 ++++++++++++- + 1 file changed, 12 insertions(+), 1 deletion(-) + +diff --git a/Makefile.am b/Makefile.am +index 675b23b..1148203 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -88,6 +88,9 @@ TESTS = test/runtests.py + + SUBDIRS = src docs conf + ++MOCK_DIR = $(abs_builddir)/mock ++MOCK_OPTIONS ?= --resultdir="$(MOCK_DIR)" --no-cleanup-after ++ + coverity: + cov-build --dir=cov make + cov-analyze --dir cov --concurrency --wait-for-license +@@ -121,7 +124,7 @@ lint: + + clean-local: + rm -rf test/*.pyc test/__pycache__ test/runtests.py test/boothtestenv.py cov* $(SPEC) +- -rm -rf $(TARFILE) ++ -rm -rf booth-*.rpm $(TARFILE) + + dist-clean-local: + rm -f autoconf automake autoheader +@@ -240,6 +243,14 @@ rpm: clean + $(MAKE) $(SPEC) $(TARFILE) + rpmbuild $(RPMBUILDOPTS) -ba $(SPEC) + ++mock-%: clean srpm ++ mock $(MOCK_OPTIONS) --root=$* --no-cleanup-after --rebuild \ ++ "$(abs_top_builddir)"/*.src.rpm ++ ++.PHONY: mock-clean ++mock-clean: ++ -rm -rf "$(MOCK_DIR)" ++ + gen_start_date = 2000-01-01 + .PHONY: gen-ChangeLog + gen-ChangeLog: +-- +2.25.1 + diff --git a/backport-rpm-Add-gcc-as-a-build-dependency.patch b/backport-rpm-Add-gcc-as-a-build-dependency.patch new file mode 100644 index 0000000..856c349 --- /dev/null +++ b/backport-rpm-Add-gcc-as-a-build-dependency.patch @@ -0,0 +1,25 @@ +From bb3dcf151e3b7849d5d4f3c079dec6f56891e753 Mon Sep 17 00:00:00 2001 +From: Chris Lumens +Date: Mon, 6 May 2024 09:36:00 -0400 +Subject: [PATCH 15/20] rpm: Add gcc as a build dependency. + +This is required to make building with mock work. +--- + booth.spec.in | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/booth.spec.in b/booth.spec.in +index 4961763..1846500 100644 +--- a/booth.spec.in ++++ b/booth.spec.in +@@ -64,6 +64,7 @@ Source1: %name-rpmlintrc + BuildRequires: @asciidoc@ + BuildRequires: autoconf + BuildRequires: automake ++BuildRequires: gcc + BuildRequires: pkgconfig + %if 0%{?suse_version} + BuildRequires: glib2-devel +-- +2.25.1 + diff --git a/backport-rpm-Remove-the-tar-file-as-part-of-make-clean.patch b/backport-rpm-Remove-the-tar-file-as-part-of-make-clean.patch new file mode 100644 index 0000000..630582b --- /dev/null +++ b/backport-rpm-Remove-the-tar-file-as-part-of-make-clean.patch @@ -0,0 +1,24 @@ +From dadab7c9340632f157e48deac0f82292e75f95ae Mon Sep 17 00:00:00 2001 +From: Chris Lumens +Date: Mon, 6 May 2024 09:43:08 -0400 +Subject: [PATCH 16/20] rpm: Remove the tar file as part of "make clean". + +--- + Makefile.am | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/Makefile.am b/Makefile.am +index b646658..675b23b 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -121,6 +121,7 @@ lint: + + clean-local: + rm -rf test/*.pyc test/__pycache__ test/runtests.py test/boothtestenv.py cov* $(SPEC) ++ -rm -rf $(TARFILE) + + dist-clean-local: + rm -f autoconf automake autoheader +-- +2.25.1 + diff --git a/booth.spec b/booth.spec index 2cb6589..7558112 100644 --- a/booth.spec +++ b/booth.spec @@ -24,7 +24,7 @@ %bcond_with run_build_tests %bcond_with include_unit_test -%global release 2 +%global release 3 ## User and group to use for nonprivileged services (should be in sync with pacemaker) %global uname hacluster @@ -52,6 +52,9 @@ Patch01: backport-Fix-typo-in-wait_child.patch Patch02: backport-Refactor-Fix-problems-found-by-clang.patch patch03: backport-Refactor-foreach_-node-ticket-apply-more-universally.patch patch04: backport-Refactor-rename-foreach_-node-ticket-macros-to-upper.patch +patch05: backport-rpm-Add-gcc-as-a-build-dependency.patch +patch06: backport-rpm-Remove-the-tar-file-as-part-of-make-clean.patch +patch07: backport-build-Add-support-for-building-with-mock.patch # direct build process dependencies BuildRequires: autoconf @@ -182,7 +185,7 @@ Automated tests for running Booth, ticket manager for multi-site clusters. # BUILD # %prep -%autosetup -n %{name}-%{version} -S git_am -p 1 +%autosetup -n %{name}-%{version} -p 1 %build ./autogen.sh @@ -300,6 +303,10 @@ VERBOSE=1 make check %{_usr}/lib/ocf/resource.d/booth/sharedrsc %changelog +* Mon Aug 12 2024 bizhiyuan -1.2-3 +- Add support for building with mock +- delete "-S git" from %autosetup + * Fri Aug 09 2024 bizhiyuan -1.2-2 - Fix typo in wait_child - Refactor: foreach_{node,ticket}: apply more universally -- Gitee