Skip to content

Commit cfd82f7

Browse files
committed
Fix grubby build with newer versions of RPM (#2036)
1 parent b0e1a21 commit cfd82f7

File tree

3 files changed

+86
-72
lines changed

3 files changed

+86
-72
lines changed

.github/workflows/validate-cg-manifest.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ ignore_list=" \
2020
dbus-x11 \
2121
grub2-efi-binary-signed-aarch64 \
2222
grub2-efi-binary-signed-x86_64 \
23+
grubby \
2324
initramfs \
2425
installkernel \
2526
kde-filesystem \
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
From 1afddd618629a97479560bedbdcfa11b2c492a0e Mon Sep 17 00:00:00 2001
2+
From: Javier Martinez Canillas <[email protected]>
3+
Date: Fri, 26 Jun 2020 10:02:51 +0200
4+
Subject: [PATCH] Fix build with rpm-4.16
5+
6+
rpmvercmp() was moved to librpmio, so link against this library instead.
7+
8+
Signed-off-by: Javier Martinez Canillas <[email protected]>
9+
---
10+
Makefile | 2 +-
11+
1 file changed, 1 insertion(+), 1 deletion(-)
12+
13+
diff --git a/Makefile b/Makefile
14+
index 1ab58aeb039..a54b053a30b 100644
15+
--- a/Makefile
16+
+++ b/Makefile
17+
@@ -59,7 +59,7 @@ grubby:: $(OBJECTS)
18+
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(grubby_LIBS)
19+
20+
rpm-sort::rpm-sort.o
21+
- $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ -lrpm
22+
+ $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ -lrpmio
23+
24+
clean:
25+
rm -f *.o grubby rpm-sort *~
26+
--
27+
2.26.2

SPECS-EXTENDED/grubby/grubby.spec

Lines changed: 58 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -1,81 +1,70 @@
1+
Summary: Command line tool for updating bootloader configs
2+
Name: grubby
3+
Version: 8.40
4+
Release: 42%{?dist}
5+
License: GPLv2+
16
Vendor: Microsoft Corporation
27
Distribution: Mariner
3-
Name: grubby
4-
Version: 8.40
5-
Release: 41%{?dist}
6-
Summary: Command line tool for updating bootloader configs
7-
License: GPLv2+
8-
URL: https://github.com/rhinstaller/grubby
8+
URL: https://github.com/rhinstaller/grubby
99
# we only pull git snaps at the moment
1010
# git clone [email protected]:rhinstaller/grubby.git
1111
# git archive --format=tar --prefix=grubby-%%{version}/ HEAD |bzip2 > grubby-%%{version}.tar.bz2
1212
# Source0: %%{name}-%%{version}.tar.bz2
13-
Source0: https://github.com/rhboot/grubby/archive/%{version}-1.tar.gz#/%{name}-%{version}.tar.gz
14-
Source1: grubby-bls
15-
Source2: grubby.in
16-
Source3: installkernel.in
17-
Source4: installkernel-bls
18-
Source5: 95-kernel-hooks.install
19-
Patch0001: 0001-remove-the-old-crufty-u-boot-support.patch
20-
Patch0002: 0002-Change-return-type-in-getRootSpecifier.patch
21-
Patch0003: 0003-Add-btrfs-subvolume-support-for-grub2.patch
22-
Patch0004: 0004-Add-tests-for-btrfs-support.patch
23-
Patch0005: 0005-Use-system-LDFLAGS.patch
24-
Patch0006: 0006-Honor-sbindir.patch
25-
Patch0007: 0007-Make-installkernel-to-use-kernel-install-scripts-on-.patch
26-
Patch0008: 0008-Add-usr-libexec-rpm-sort.patch
27-
Patch0009: 0009-Improve-man-page-for-info-option.patch
28-
Patch0010: 0010-Fix-GCC-warnings-about-possible-string-truncations-a.patch
29-
Patch0011: 0011-Fix-stringop-overflow-warning.patch
30-
Patch0012: 0012-Fix-maybe-uninitialized-warning.patch
31-
32-
BuildRequires: gcc
33-
BuildRequires: pkgconfig glib2-devel popt-devel
34-
BuildRequires: libblkid-devel git-core sed make
35-
# for make test / getopt:
36-
BuildRequires: util-linux-ng
37-
BuildRequires: rpm-devel
38-
%ifarch aarch64 i686 x86_64 %{power64}
39-
BuildRequires: grub2-tools-minimal
40-
Requires: grub2-tools-minimal
41-
Requires: grub2-tools
13+
Source0: https://github.com/rhboot/grubby/archive/%{version}-1.tar.gz#/%{name}-%{version}.tar.gz
14+
Source1: grubby-bls
15+
Source2: grubby.in
16+
Source3: installkernel.in
17+
Source4: installkernel-bls
18+
Source5: 95-kernel-hooks.install
19+
Patch0001: 0001-remove-the-old-crufty-u-boot-support.patch
20+
Patch0002: 0002-Change-return-type-in-getRootSpecifier.patch
21+
Patch0003: 0003-Add-btrfs-subvolume-support-for-grub2.patch
22+
Patch0004: 0004-Add-tests-for-btrfs-support.patch
23+
Patch0005: 0005-Use-system-LDFLAGS.patch
24+
Patch0006: 0006-Honor-sbindir.patch
25+
Patch0007: 0007-Make-installkernel-to-use-kernel-install-scripts-on-.patch
26+
Patch0008: 0008-Add-usr-libexec-rpm-sort.patch
27+
Patch0009: 0009-Improve-man-page-for-info-option.patch
28+
Patch0010: 0010-Fix-GCC-warnings-about-possible-string-truncations-a.patch
29+
Patch0011: 0011-Fix-stringop-overflow-warning.patch
30+
Patch0012: 0012-Fix-maybe-uninitialized-warning.patch
31+
Patch0013: 0013-Fix-build-RPM-416.patch
32+
BuildRequires: gcc
33+
BuildRequires: glib2-devel
34+
BuildRequires: grub2-tools-minimal
35+
BuildRequires: libblkid-devel
36+
BuildRequires: make
37+
BuildRequires: pkg-config
38+
BuildRequires: popt-devel
39+
BuildRequires: rpm-devel
40+
BuildRequires: sed
41+
%if %{with_check}
42+
BuildRequires: util-linux-ng
4243
%endif
43-
%ifarch s390 s390x
44-
Requires: s390utils-base
45-
%endif
46-
Requires: findutils
47-
Requires: util-linux
48-
49-
Obsoletes: %{name}-bls < %{version}-%{release}
44+
Requires: findutils
45+
Requires: grub2-tools
46+
Requires: grub2-tools-minimal
47+
Requires: util-linux
5048

5149
%description
5250
This package provides a grubby compatibility script that manages
5351
BootLoaderSpec files and is meant to only be used for legacy compatibility
5452
users with existing grubby users.
5553

5654
%prep
57-
%setup -q -n grubby-%{version}-1
58-
59-
git init
60-
git config user.email "[email protected]"
61-
git config user.name "no one"
62-
git add .
63-
git commit -a -q -m "%{version} baseline"
64-
git am %{patches} </dev/null
65-
git config --unset user.email
66-
git config --unset user.name
55+
%autosetup -p1 -n grubby-%{version}-1
6756

6857
%build
69-
%set_build_flags
70-
make %{?_smp_mflags} LDFLAGS="${LDFLAGS}"
58+
%{set_build_flags}
59+
%make_build LDFLAGS="${LDFLAGS}"
7160

7261
%ifnarch aarch64 %{arm}
7362
%check
74-
make test
63+
%make_build test
7564
%endif
7665

7766
%install
78-
make install DESTDIR=$RPM_BUILD_ROOT mandir=%{_mandir} sbindir=%{_sbindir} libexecdir=%{_libexecdir}
67+
%make_install mandir=%{_mandir} sbindir=%{_sbindir} libexecdir=%{_libexecdir}
7968

8069
mkdir -p %{buildroot}%{_libexecdir}/{grubby,installkernel}/ %{buildroot}%{_sbindir}/
8170
mv -v %{buildroot}%{_sbindir}/grubby %{buildroot}%{_libexecdir}/grubby/grubby
@@ -86,18 +75,11 @@ sed -e "s,@@LIBEXECDIR@@,%{_libexecdir}/grubby,g" %{SOURCE2} \
8675
> %{buildroot}%{_sbindir}/grubby
8776
sed -e "s,@@LIBEXECDIR@@,%{_libexecdir}/installkernel,g" %{SOURCE3} \
8877
> %{buildroot}%{_sbindir}/installkernel
89-
install -D -m 0755 -t %{buildroot}%{_prefix}/lib/kernel/install.d/ %{SOURCE5}
78+
install -D -m 0755 -t %{buildroot}%{_libdir}/kernel/install.d/ %{SOURCE5}
9079

91-
%post
92-
if [ "$1" = 2 ]; then
93-
arch=$(uname -m)
94-
[[ $arch == "s390x" ]] && \
95-
zipl-switch-to-blscfg --backup-suffix=.rpmsave &>/dev/null || :
96-
fi
97-
98-
%package deprecated
99-
Summary: Legacy command line tool for updating bootloader configs
100-
Conflicts: %{name} <= 8.40-18
80+
%package deprecated
81+
Summary: Legacy command line tool for updating bootloader configs
82+
Conflicts: %{name} <= 8.40-18
10183

10284
%description deprecated
10385
This package provides deprecated, legacy grubby. This is for temporary
@@ -110,7 +92,6 @@ scripts which install new kernels and need to find information about the
11092
current boot environment.
11193

11294
%files
113-
%{!?_licensedir:%global license %%doc}
11495
%license COPYING
11596
%dir %{_libexecdir}/grubby
11697
%dir %{_libexecdir}/installkernel
@@ -119,11 +100,10 @@ current boot environment.
119100
%attr(0755,root,root) %{_sbindir}/grubby
120101
%attr(0755,root,root) %{_libexecdir}/installkernel/installkernel-bls
121102
%attr(0755,root,root) %{_sbindir}/installkernel
122-
%attr(0755,root,root) %{_prefix}/lib/kernel/install.d/95-kernel-hooks.install
103+
%attr(0755,root,root) %{_libdir}/kernel/install.d/95-kernel-hooks.install
123104
%{_mandir}/man8/[gi]*.8*
124105

125106
%files deprecated
126-
%{!?_licensedir:%global license %%doc}
127107
%license COPYING
128108
%dir %{_libexecdir}/grubby
129109
%dir %{_libexecdir}/installkernel
@@ -132,9 +112,16 @@ current boot environment.
132112
%attr(0755,root,root) %{_sbindir}/grubby
133113
%attr(0755,root,root) %{_sbindir}/installkernel
134114
%attr(0755,root,root) %{_sbindir}/new-kernel-pkg
135-
%{_mandir}/man8/*.8*
115+
%{_mandir}/man8/*.8*
136116

137117
%changelog
118+
* Fri Jan 28 2022 Thomas Crain <[email protected]> - 8.40-42
119+
- Add Fedora patch file (license: MIT) to fix linking with RPM >= 4.16.0
120+
- Remove git setup steps, apply patches using %%autosetup
121+
- Remove s390x-specific instructions
122+
- Lint spec
123+
- License verified
124+
138125
* Fri Oct 15 2021 Pawel Winogrodzki <[email protected]> - 8.40-41
139126
- Initial CBL-Mariner import from Fedora 32 (license: MIT).
140127

@@ -672,4 +659,3 @@ current boot environment.
672659

673660
* Tue Jun 2 2009 Jeremy Katz <[email protected]> - 6.0.86-1
674661
- initial build after splitting out from mkinitrd
675-

0 commit comments

Comments
 (0)