Port several fixes from the F28 tree and a WIP tree.

Signed-off-by: Peter Jones <pjones@redhat.com>
This commit is contained in:
Peter Jones 2018-07-11 15:52:37 -04:00
parent 91f9e5a07c
commit a52365a0df
5 changed files with 109 additions and 53 deletions

1
.gitignore vendored
View file

@ -9,3 +9,4 @@ kojilogs
.*.git/
tmp/
.*.sw?
results_grub2/

View file

@ -0,0 +1,43 @@
From b5c1a6068757af5b45297f7a981677681a534c2e Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Tue, 10 Jul 2018 16:54:02 -0400
Subject: [PATCH] Force everything to use python3
But this still means you need to do PYTHON=python=3 ./autogen.sh if you
run the world's worst tooling before you patch.
Signed-off-by: Peter Jones <pjones@redhat.com>
---
conf/Makefile.common | 4 ++--
gentpl.py | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/conf/Makefile.common b/conf/Makefile.common
index d2fedeaa3a5..3d21ed54031 100644
--- a/conf/Makefile.common
+++ b/conf/Makefile.common
@@ -128,11 +128,11 @@ BUILT_SOURCES =
.PRECIOUS: $(top_srcdir)/Makefile.util.am
$(top_srcdir)/Makefile.util.am: $(top_srcdir)/gentpl.py $(top_srcdir)/Makefile.util.def $(top_srcdir)/Makefile.utilgcry.def
- python $^ > $@.new || (rm -f $@.new; exit 1)
+ python3 $^ > $@.new || (rm -f $@.new; exit 1)
mv $@.new $@
.PRECIOUS: $(top_srcdir)/grub-core/Makefile.core.am
$(top_srcdir)/grub-core/Makefile.core.am: $(top_srcdir)/gentpl.py $(top_srcdir)/grub-core/Makefile.core.def $(top_srcdir)/grub-core/Makefile.gcry.def
if [ "x$$GRUB_CONTRIB" != x ]; then echo "You need to run ./autogen.sh manually." >&2; exit 1; fi
- python $^ > $@.new || (rm -f $@.new; exit 1)
+ python3 $^ > $@.new || (rm -f $@.new; exit 1)
mv $@.new $@
diff --git a/gentpl.py b/gentpl.py
index bf8439fa743..6ab9eb3af71 100644
--- a/gentpl.py
+++ b/gentpl.py
@@ -1,4 +1,4 @@
-#! /usr/bin/python
+#! /usr/bin/env python3
# GRUB -- GRand Unified Bootloader
# Copyright (C) 2010,2011,2012,2013 Free Software Foundation, Inc.
#

View file

@ -60,7 +60,7 @@ while [ $# -gt 0 ]; do
--commit)
commit=1
;;
--nocommit)
--nocommit|--no-commit|--nc)
# --nocommit implies nobumpspec, but --bumpspec after it will
# force bumpspec to get run.
commit=0
@ -69,7 +69,7 @@ while [ $# -gt 0 ]; do
--bumpspec)
bumpspec=2
;;
--nobumpspec)
--nobumpspec|--no-bumpspec|--nb)
bumpspec=0
;;
*)

View file

@ -84,9 +84,9 @@
### fixme
%ifarch aarch64 %{arm}
%global efi_modules " http linux "
%global efi_modules " "
%else
%global efi_modules " backtrace http linuxefi usb usbserial_common usbserial_pl2303 usbserial_ftdi usbserial_usbdebug "
%global efi_modules " backtrace usb usbserial_common usbserial_pl2303 usbserial_ftdi usbserial_usbdebug "
%endif
%ifarch aarch64 %{arm}
@ -164,9 +164,6 @@
%global grubaltefiarch %{alt_target_cpu_name}-efi
%endif
# Figure out the right file path to use
%global efidir %(eval echo $(grep ^ID= /etc/os-release | sed -e 's/^ID=//' -e 's/rhel/redhat/'))
%ifnarch %{efi_only}
%global with_legacy_arch 1
%global grublegacyarch %{legacy_target_cpu_name}-%{platform}
@ -235,6 +232,7 @@ This subpackage provides tools for support of %%{1} platforms. \
%{expand:%%package %{1}} \
Summary: GRUB for EFI systems. \
Group: System Environment/Base \
Requires: efi-filesystem \
Requires: %{name}-common = %{evr} \
Requires: %{name}-tools-minimal >= %{evr} \
Requires: %{name}-tools-extra = %{evr} \
@ -280,7 +278,8 @@ git init \
echo '![[:digit:]][[:digit:]]_*.in' > util/grub.d/.gitignore \
echo '!*.[[:digit:]]' > util/.gitignore \
echo '!config.h' > include/grub/emu/.gitignore \
./autogen.sh \
patch -p1 < %{SOURCE10} \
PYTHON=python3 ./autogen.sh \
git config user.email "%{name}-owner@fedoraproject.org" \
git config user.name "Fedora Ninjas" \
git config gc.auto 0 \
@ -323,7 +322,7 @@ done \
%ifarch x86_64 aarch64 %{arm}
%define mkimage() \
%{4}./grub-mkimage -O %{1} -o %{2}.orig \\\
-p /EFI/%{efidir} -d grub-core ${GRUB_MODULES} \
-p /EFI/%{efi_vendor} -d grub-core ${GRUB_MODULES} \
%{4}./grub-mkimage -O %{1} -o %{3}.orig \\\
-p /EFI/BOOT -d grub-core ${GRUB_MODULES} \
%{expand:%%{pesign -s -i %%{2}.orig -o %%{2} -a %%{5} -c %%{6} -n %%{7}}} \
@ -332,7 +331,7 @@ done \
%else
%define mkimage() \
%{4}./grub-mkimage -O %{1} -o %{2} \\\
-p /EFI/%{efidir} -d grub-core ${GRUB_MODULES} \
-p /EFI/%{efi_vendor} -d grub-core ${GRUB_MODULES} \
%{4}./grub-mkimage -O %{1} -o %{3} \\\
-p /EFI/BOOT -d grub-core ${GRUB_MODULES} \
%{nil}
@ -340,12 +339,14 @@ done \
%define do_efi_build_images() \
GRUB_MODULES=" all_video boot blscfg btrfs \\\
cat chain configfile echo \\\
efifwsetup efinet ext2 fat font gfxmenu gfxterm \\\
gzio halt hfsplus iso9660 jpeg loadenv loopback \\\
lvm lsefi mdraid09 mdraid1x minicmd \\\
cat chain configfile \\\
echo efi_netfs efifwsetup efinet ext2 \\\
fat font gfxmenu gfxterm gzio \\\
halt hfsplus http iso9660 jpeg \\\
loadenv loopback linux lvm lsefi \\\
mdraid09 mdraid1x minicmd net \\\
normal part_apple part_msdos part_gpt \\\
password_pbkdf2 png reboot \\\
password_pbkdf2 png \\\
search search_fs_uuid search_fs_file \\\
search_label serial sleep syslinuxcfg test tftp \\\
video xfs" \
@ -400,15 +401,15 @@ find . '(' -iname gdb_grub \\\
')' \\\
-exec cp {} $RPM_BUILD_ROOT/usr/lib/grub/%{grubaltefiarch}/ \\\; \
find $RPM_BUILD_ROOT -type f -iname "*.mod*" -exec chmod a-x {} '\;' \
install -m 700 %{2} $RPM_BUILD_ROOT/boot/efi/EFI/%{efidir}/%{2} \
install -m 700 %{3} $RPM_BUILD_ROOT/boot/efi/EFI/%{efidir}/%{3} \
install -m 700 %{2} $RPM_BUILD_ROOT%{efi_esp_dir}/%{2} \
install -m 700 %{3} $RPM_BUILD_ROOT%{efi_esp_dir}/%{3} \
cd .. \
%{nil}
%define do_efi_install() \
cd grub-%{1}-%{tarversion} \
install -m 700 -d $RPM_BUILD_ROOT/boot/efi/EFI/%{efidir}/ \
install -m 700 -d $RPM_BUILD_ROOT/boot/efi/EFI/%{efidir}/loader/entries \
install -m 700 -d $RPM_BUILD_ROOT%{efi_esp_dir}/ \
install -m 700 -d $RPM_BUILD_ROOT%{efi_esp_dir}/loader/entries \
install -m 700 -d $RPM_BUILD_ROOT/boot/grub2/ \
make DESTDIR=$RPM_BUILD_ROOT install \
if [ -f $RPM_BUILD_ROOT%{_infodir}/grub.info ]; then \
@ -418,13 +419,17 @@ if [ -f $RPM_BUILD_ROOT%{_infodir}/grub-dev.info ]; then \
rm -f $RPM_BUILD_ROOT%{_infodir}/grub-dev.info \
fi \
find $RPM_BUILD_ROOT -iname "*.module" -exec chmod a-x {} '\;' \
touch $RPM_BUILD_ROOT/boot/efi/EFI/%{efidir}/grub.cfg \
ln -sf ../boot/efi/EFI/%{efidir}/grub.cfg \\\
touch $RPM_BUILD_ROOT%{efi_esp_dir}/grub.cfg \
ln -sf ..%{efi_esp_dir}/grub.cfg \\\
$RPM_BUILD_ROOT%{_sysconfdir}/%{name}-efi.cfg \
install -m 700 %{2} $RPM_BUILD_ROOT/boot/efi/EFI/%{efidir}/%{2} \
install -m 700 %{3} $RPM_BUILD_ROOT/boot/efi/EFI/%{efidir}/%{3} \
install -m 700 %{2} $RPM_BUILD_ROOT%{efi_esp_dir}/%{2} \
install -m 700 %{3} $RPM_BUILD_ROOT%{efi_esp_dir}/%{3} \
install -D -m 700 unicode.pf2 \\\
$RPM_BUILD_ROOT/boot/efi/EFI/%{efidir}/fonts/unicode.pf2\
$RPM_BUILD_ROOT%{efi_esp_dir}/fonts/unicode.pf2 \
${RPM_BUILD_ROOT}/%{_bindir}/%{name}-editenv \\\
${RPM_BUILD_ROOT}%{efi_esp_dir}/grubenv create \
ln -sf ../efi/EFI/%{efi_vendor}/grubenv \\\
$RPM_BUILD_ROOT/boot/grub2/grubenv \
cd .. \
%{nil}
@ -443,6 +448,10 @@ if [ -f $RPM_BUILD_ROOT/%{_libdir}/grub/%{1}/grub2.chrp ]; then \
mv $RPM_BUILD_ROOT/%{_libdir}/grub/%{1}/grub2.chrp \\\
$RPM_BUILD_ROOT/%{_libdir}/grub/%{1}/grub.chrp \
fi \
if [ %{3} -eq 0 ]; then \
${RPM_BUILD_ROOT}/%{_bindir}/%{name}-editenv \\\
${RPM_BUILD_ROOT}/boot/%{name}/grubenv create \
fi \
cd .. \
install -d -m 0755 ${RPM_BUILD_ROOT}/boot/loader/entries \
%{nil}
@ -458,7 +467,7 @@ cp docs/grub.info $RPM_BUILD_ROOT%{_infodir}/%{name}.info \
cp docs/grub-dev.info \\\
$RPM_BUILD_ROOT%{_infodir}/%{name}-dev.info \
# Ghost config file \
install -d -m 0700 ${RPM_BUILD_ROOT}/boot/efi/EFI/%{efidir}/ \
install -d -m 0700 ${RPM_BUILD_ROOT}%{efi_esp_dir}/ \
install -d -m 0700 ${RPM_BUILD_ROOT}/boot/grub2/ \
install -d -m 0755 ${RPM_BUILD_ROOT}/boot/%{name}/themes/system \
install -d -m 0755 ${RPM_BUILD_ROOT}%{_sysconfdir}/default \
@ -466,8 +475,6 @@ install -d -m 0755 ${RPM_BUILD_ROOT}%{_sysconfdir}/sysconfig \
touch ${RPM_BUILD_ROOT}%{_sysconfdir}/default/grub \
ln -sf ../default/grub \\\
${RPM_BUILD_ROOT}%{_sysconfdir}/sysconfig/grub \
ln -sf ../efi/EFI/%{efidir}/grubenv \\\
$RPM_BUILD_ROOT/boot/grub2/grubenv \
touch ${RPM_BUILD_ROOT}/boot/%{name}/grub.cfg \
%{nil}
@ -493,16 +500,15 @@ touch ${RPM_BUILD_ROOT}/boot/%{name}/grub.cfg \
%define define_efi_variant_files() \
%{expand:%%files %{1}} \
%defattr(-,root,root,-) \
%defattr(0700,root,root,-) \
%config(noreplace) %{_sysconfdir}/%{name}-efi.cfg \
%dir %attr(0700,root,root)/boot/efi/EFI/%{efidir} \
%attr(0700,root,root)/boot/efi/EFI/%{efidir}/%{2} \
%dir %attr(0700,root,root)/boot/efi/EFI/%{efidir}/fonts \
%dir %attr(0700,root,root)/boot/efi/EFI/%{efidir}/loader \
%dir %attr(0700,root,root)/boot/efi/EFI/%{efidir}/loader/entries \
%ghost %config(noreplace) %attr(0700,root,root)/boot/efi/EFI/%{efidir}/grub.cfg \
%attr(0700,root,root)%{efi_esp_dir}/%{2} \
%dir %attr(0700,root,root)%{efi_esp_dir}/fonts \
%dir %attr(0700,root,root)%{efi_esp_dir}/loader \
%dir %attr(0700,root,root)%{efi_esp_dir}/loader/entries \
%ghost %config(noreplace) %attr(0700,root,root)%{efi_esp_dir}/grub.cfg \
/boot/grub2/grubenv \
%ghost %config(noreplace) %attr(0700,root,root)/boot/efi/EFI/%{efidir}/grubenv \
%ghost %config(noreplace) %attr(0700,root,root)%{efi_esp_dir}/grubenv \
%{expand:%if 0%{?without_efi_modules} \
%exclude %{_libdir}/grub/%{6} \
%exclude %{_libdir}/grub/%{6}/* \
@ -518,6 +524,6 @@ touch ${RPM_BUILD_ROOT}/boot/%{name}/grub.cfg \
\
%{expand:%%files %{1}-cdboot} \
%defattr(-,root,root,-) \
%attr(0700,root,root)/boot/efi/EFI/%{efidir}/%{3} \
%attr(0700,root,root)/boot/efi/EFI/%{efidir}/fonts \
%attr(0700,root,root)%{efi_esp_dir}/%{3} \
%attr(0700,root,root)%{efi_esp_dir}/fonts \
%{nil}

View file

@ -7,7 +7,7 @@
Name: grub2
Epoch: 1
Version: 2.02
Release: 39%{?dist}
Release: 40%{?dist}
Summary: Bootloader with support for Linux, Multiboot and more
Group: System Environment/Base
License: GPLv3+
@ -22,14 +22,15 @@ Source5: theme.tar.bz2
Source6: gitignore
Source8: strtoull_test.c
Source9: 20-grub.install
Source10: Force-everything-to-use-python3.patch
%include %{SOURCE1}
# generate with do-rebase
%include %{SOURCE2}
BuildRequires: gcc
BuildRequires: flex bison binutils python
BuildRequires: gcc efi-srpm-macros
BuildRequires: flex bison binutils python3
BuildRequires: ncurses-devel xz-devel bzip2-devel
BuildRequires: freetype-devel libusb-devel
BuildRequires: rpm-devel
@ -179,10 +180,11 @@ rm -fr $RPM_BUILD_ROOT
%{expand:%do_alt_efi_install %%{grubaltefiarch} %%{grubaltefiname} %%{grubalteficdname}}
%endif
%if 0%{with_legacy_arch}
%{expand:%do_legacy_install %%{grublegacyarch} %%{alt_grub_target_name}}
%{expand:%do_legacy_install %%{grublegacyarch} %%{alt_grub_target_name} 0%{with_efi_arch}}
%endif
${RPM_BUILD_ROOT}/%{_bindir}/%{name}-editenv ${RPM_BUILD_ROOT}/boot/efi/EFI/%{efidir}/grubenv create
rm -f $RPM_BUILD_ROOT%{_infodir}/dir
ln -s %{name}-set-password ${RPM_BUILD_ROOT}/%{_sbindir}/%{name}-setpassword
echo '.so man8/%{name}-set-password.8' > ${RPM_BUILD_ROOT}/%{_datadir}/man/man8/%{name}-setpassword.8
%ifnarch x86_64
rm -vf ${RPM_BUILD_ROOT}/%{_bindir}/%{name}-render-label
rm -vf ${RPM_BUILD_ROOT}/%{_sbindir}/%{name}-bios-setup
@ -236,19 +238,19 @@ if [ -f /boot/grub2/user.cfg ]; then
if grep -q '^GRUB_PASSWORD=' /boot/grub2/user.cfg ; then
sed -i 's/^GRUB_PASSWORD=/GRUB2_PASSWORD=/' /boot/grub2/user.cfg
fi
elif [ -f /boot/efi/EFI/%{efidir}/user.cfg ]; then
if grep -q '^GRUB_PASSWORD=' /boot/efi/EFI/%{efidir}/user.cfg ; then
elif [ -f %{efi_esp_dir}/user.cfg ]; then
if grep -q '^GRUB_PASSWORD=' %{efi_esp_dir}/user.cfg ; then
sed -i 's/^GRUB_PASSWORD=/GRUB2_PASSWORD=/' \
/boot/efi/EFI/%{efidir}/user.cfg
%{efi_esp_dir}/user.cfg
fi
elif [ -f /etc/grub.d/01_users ] && \
grep -q '^password_pbkdf2 root' /etc/grub.d/01_users ; then
if [ -f /boot/efi/EFI/%{efidir}/grub.cfg ]; then
if [ -f %{efi_esp_dir}/grub.cfg ]; then
# on EFI we don't get permissions on the file, but
# the directory is protected.
grep '^password_pbkdf2 root' /etc/grub.d/01_users | \
sed 's/^password_pbkdf2 root \(.*\)$/GRUB2_PASSWORD=\1/' \
> /boot/efi/EFI/%{efidir}/user.cfg
> %{efi_esp_dir}/user.cfg
fi
if [ -f /boot/grub2/grub.cfg ]; then
install -m 0600 /dev/null /boot/grub2/user.cfg
@ -313,8 +315,8 @@ fi
%exclude /boot/%{name}/themes/system/*
%attr(0700,root,root) %dir /boot/grub2
%exclude /boot/grub2/*
%dir %attr(0700,root,root) /boot/efi/EFI/%{efidir}
%exclude /boot/efi/EFI/%{efidir}/*
%dir %attr(0700,root,root) %{efi_esp_dir}
%exclude %{efi_esp_dir}/*
%license COPYING
%ghost %config(noreplace) /boot/grub2/grubenv
%doc INSTALL
@ -329,14 +331,15 @@ fi
%files tools-minimal
%{_sysconfdir}/prelink.conf.d/grub2.conf
%{_sbindir}/%{name}-get-kernel-settings
%{_sbindir}/%{name}-set-bootflag
%{_sbindir}/%{name}-set-default
%{_sbindir}/%{name}-setpassword
%{_sbindir}/%{name}-set*password
%{_bindir}/%{name}-editenv
%{_bindir}/%{name}-mkpasswd-pbkdf2
%{_datadir}/man/man3/%{name}-get-kernel-settings*
%{_datadir}/man/man8/%{name}-set-default*
%{_datadir}/man/man8/%{name}-setpassword*
%{_datadir}/man/man8/%{name}-set*password*
%{_datadir}/man/man1/%{name}-editenv*
%{_datadir}/man/man1/%{name}-mkpasswd-*
@ -386,7 +389,7 @@ fi
# exclude man pages from tools-minimal
%exclude %{_datadir}/man/man3/%{name}-get-kernel-settings*
%exclude %{_datadir}/man/man8/%{name}-set-default*
%exclude %{_datadir}/man/man8/%{name}-setpassword*
%exclude %{_datadir}/man/man8/%{name}-set*password*
%exclude %{_datadir}/man/man1/%{name}-editenv*
%exclude %{_datadir}/man/man1/%{name}-mkpasswd-*
%exclude %{_datadir}/man/man8/%{name}-macbless*
@ -454,6 +457,9 @@ fi
%endif
%changelog
* Wed Jul 11 2018 Peter Jones <pjones@redhat.com> - 2.02-40
- Port several fixes from the F28 tree and a WIP tree.
* Mon Jul 09 2018 pjones <pjones@redhat.com> - 2.02-39
- Fix my fix of grub2-switch-to-blscfg (javierm and pjones)