Rework the macros for better srpm use.
Signed-off-by: Peter Jones <pjones@redhat.com>
This commit is contained in:
parent
700a7cbdab
commit
ce43d30f37
@ -1,7 +1,7 @@
|
||||
From 8c4a55209bcb054b610c613ac2f1b2ad25253a20 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Jones <pjones@redhat.com>
|
||||
Date: Tue, 1 May 2018 12:54:05 -0400
|
||||
Subject: [PATCH 1/5] Simplify %efi_arch_upper
|
||||
Subject: [PATCH 01/11] Simplify %efi_arch_upper
|
||||
|
||||
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||
---
|
||||
|
@ -1,7 +1,7 @@
|
||||
From 4f7a7e6084bfbc28f194ab63a76239a622c7baad Mon Sep 17 00:00:00 2001
|
||||
From: Peter Jones <pjones@redhat.com>
|
||||
Date: Tue, 1 May 2018 12:55:44 -0400
|
||||
Subject: [PATCH 2/5] Add a changelog entry to the .spec for version 2.
|
||||
Subject: [PATCH 02/11] Add a changelog entry to the .spec for version 2.
|
||||
|
||||
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||
---
|
||||
|
@ -1,7 +1,7 @@
|
||||
From 341b613d7b920292129ae689e9f7588073a08431 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Jones <pjones@redhat.com>
|
||||
Date: Tue, 1 May 2018 13:26:18 -0400
|
||||
Subject: [PATCH 3/5] efi-rpm-macros.spec.in: use autosetup
|
||||
Subject: [PATCH 03/11] efi-rpm-macros.spec.in: use autosetup
|
||||
|
||||
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||
---
|
||||
|
@ -1,7 +1,7 @@
|
||||
From d50b6eb13b00579e89747baa6a6be142930f3f94 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Jones <pjones@redhat.com>
|
||||
Date: Tue, 1 May 2018 13:39:47 -0400
|
||||
Subject: [PATCH 4/5] Add %efi_alt_arch and %efi_alt_arch_upper
|
||||
Subject: [PATCH 04/11] Add %efi_alt_arch and %efi_alt_arch_upper
|
||||
|
||||
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||
---
|
||||
|
@ -1,7 +1,7 @@
|
||||
From 1103d2ae35a3702b79b5dc32fc72b7b21711829e Mon Sep 17 00:00:00 2001
|
||||
From: Peter Jones <pjones@redhat.com>
|
||||
Date: Tue, 1 May 2018 13:45:29 -0400
|
||||
Subject: [PATCH 5/5] Return %{nil} instead of "" on unsupported arches
|
||||
Subject: [PATCH 05/11] Return %{nil} instead of "" on unsupported arches
|
||||
|
||||
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||
---
|
||||
|
@ -1,7 +1,7 @@
|
||||
From 3f4b280e8578d4de3d03b4af205106813a2fdbd1 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Jones <pjones@redhat.com>
|
||||
Date: Tue, 1 May 2018 14:44:17 -0400
|
||||
Subject: [PATCH 6/6] %efi_arch: turns out %{nil} is definitely not what we
|
||||
Subject: [PATCH 06/11] %efi_arch: turns out %{nil} is definitely not what we
|
||||
want.
|
||||
|
||||
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||
|
@ -1,7 +1,7 @@
|
||||
From 09efa919eb4a85bd77fe8d482f4c369e1fc29ed7 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Jones <pjones@redhat.com>
|
||||
Date: Tue, 1 May 2018 15:42:01 -0400
|
||||
Subject: [PATCH 7/7] Make a macros.efi-srpm that defines %{efi}
|
||||
Subject: [PATCH 07/11] Make a macros.efi-srpm that defines %{efi}
|
||||
|
||||
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||
---
|
||||
|
@ -1,7 +1,7 @@
|
||||
From a4358f78316160cf29e177daedf9562e6a0505f2 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Jones <pjones@redhat.com>
|
||||
Date: Wed, 2 May 2018 10:09:19 -0400
|
||||
Subject: [PATCH 8/8] Add %{efi_has_alt_arch} ("0" or "1")
|
||||
Subject: [PATCH 08/11] Add %{efi_has_alt_arch} ("0" or "1")
|
||||
|
||||
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||
---
|
||||
|
@ -1,7 +1,7 @@
|
||||
From 309396c167bcd9ae6219e70e7e2b93ec5b773939 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Jones <pjones@redhat.com>
|
||||
Date: Wed, 2 May 2018 10:48:28 -0400
|
||||
Subject: [PATCH 9/9] Add efi-filesystem subpackage
|
||||
Subject: [PATCH 09/11] Add efi-filesystem subpackage
|
||||
|
||||
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||
---
|
||||
|
@ -1,7 +1,7 @@
|
||||
From 625cc7b2fdba3e489865c42fddc48b72b3bfecd4 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Jones <pjones@redhat.com>
|
||||
Date: Wed, 2 May 2018 11:26:04 -0400
|
||||
Subject: [PATCH 10/10] efi-rpm-macros.spec: don't use efi-rpm-macros
|
||||
Subject: [PATCH 10/11] efi-rpm-macros.spec: don't use efi-rpm-macros
|
||||
definitions for paths
|
||||
|
||||
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||
|
209
0011-Do-it-differently.patch
Normal file
209
0011-Do-it-differently.patch
Normal file
@ -0,0 +1,209 @@
|
||||
From 4031861b2964d24079827dea48a8e667cf96fd33 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Jones <pjones@redhat.com>
|
||||
Date: Thu, 3 May 2018 09:38:48 -0400
|
||||
Subject: [PATCH 11/11] Do it differently.
|
||||
|
||||
---
|
||||
Makefile | 5 ++--
|
||||
efi-rpm-macros.spec.in | 10 +++----
|
||||
macros.efi-srpm.in | 61 ++++++++++++++++++++++++++++++++++++++++-
|
||||
macros.efi.in | 73 --------------------------------------------------
|
||||
4 files changed, 68 insertions(+), 81 deletions(-)
|
||||
|
||||
diff --git a/Makefile b/Makefile
|
||||
index cf7cf956e8a..a3e20ec0bea 100644
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -18,7 +18,8 @@ EFI_ESP_ROOT ?= /boot/efi
|
||||
EFI_ARCHES ?= x86_64 aarch64 %{arm} %{ix86}
|
||||
EFI_VENDOR ?=
|
||||
|
||||
-TARGETS = macros.efi macros.efi-srpm efi-rpm-macros.spec
|
||||
+# TARGETS = macros.efi macros.efi-srpm efi-rpm-macros.spec
|
||||
+TARGETS = macros.efi-srpm efi-rpm-macros.spec
|
||||
|
||||
check_efi_vendor :
|
||||
ifeq ($(EFI_VENDOR),)
|
||||
@@ -34,7 +35,7 @@ clean :
|
||||
install : | check_efi_vendor
|
||||
install : $(TARGETS)
|
||||
install -d -m 0755 $(DESTDIR)/$(MACRODIR)
|
||||
- install -m 0644 macros.efi $(DESTDIR)/$(MACRODIR)/
|
||||
+ # install -m 0644 macros.efi $(DESTDIR)/$(MACRODIR)/
|
||||
install -m 0644 macros.efi-srpm $(DESTDIR)/$(MACRODIR)/
|
||||
if [[ "$(EFI_ESP_ROOT)" != /boot ]] ; then \
|
||||
install -d -m 0755 $(DESTDIR)/boot ; \
|
||||
diff --git a/efi-rpm-macros.spec.in b/efi-rpm-macros.spec.in
|
||||
index 1835d20e08f..0ab82ca295d 100644
|
||||
--- a/efi-rpm-macros.spec.in
|
||||
+++ b/efi-rpm-macros.spec.in
|
||||
@@ -46,11 +46,11 @@ machine bootloaders and tools.
|
||||
%install
|
||||
%make_install EFI_VENDOR=%{_efi_vendor_}
|
||||
|
||||
-%files
|
||||
-%{!?_licensedir:%global license %%doc}
|
||||
-%license LICENSE
|
||||
-%doc README
|
||||
-%{_rpmmacrodir}/macros.efi
|
||||
+#%%files
|
||||
+#%%{!?_licensedir:%%global license %%%%doc}
|
||||
+#%%license LICENSE
|
||||
+#%%doc README
|
||||
+#%%{_rpmmacrodir}/macros.efi
|
||||
|
||||
%files -n efi-srpm-macros
|
||||
%{!?_licensedir:%global license %%doc}
|
||||
diff --git a/macros.efi-srpm.in b/macros.efi-srpm.in
|
||||
index 7192b07ba6c..2630f28e72e 100644
|
||||
--- a/macros.efi-srpm.in
|
||||
+++ b/macros.efi-srpm.in
|
||||
@@ -17,4 +17,63 @@
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
-%efi @@EFI_ARCHES@@
|
||||
+%_efi_rpm_macros_setup() %{expand:%{lua:
|
||||
+ -- test if our arch matches
|
||||
+ local function ifarch(archmacro)
|
||||
+ local target = rpm.expand(" %{_target_cpu} ")
|
||||
+ local arches = rpm.expand(" " .. archmacro .. " ")
|
||||
+ local match = string.match(arches, target)
|
||||
+ if not (match == nil) then
|
||||
+ return true
|
||||
+ end
|
||||
+ end
|
||||
+ -- give us the arch...
|
||||
+ local function getarch()
|
||||
+ if ifarch("ia64") then
|
||||
+ return("ia64")
|
||||
+ elseif ifarch("x86_64") then
|
||||
+ return("x64")
|
||||
+ elseif ifarch("%{ix86}") then
|
||||
+ return("ia32")
|
||||
+ elseif ifarch("aarch64") then
|
||||
+ return("aa64")
|
||||
+ elseif ifarch("%{arm}") then
|
||||
+ return("arm")
|
||||
+ end
|
||||
+ end
|
||||
+ -- alt arch
|
||||
+ local function getaltarch()
|
||||
+ if ifarch("x86_64") then
|
||||
+ return("ia32")
|
||||
+ else
|
||||
+ return(nil)
|
||||
+ end
|
||||
+ end
|
||||
+ -- make some macros
|
||||
+ local done = rpm.expand("%{?_efi}")
|
||||
+ if done == nil or done == "" then
|
||||
+ local alt = getaltarch()
|
||||
+ print("%global _efi @@EFI_ARCHES@@\\n")
|
||||
+ print("%global _efi_vendor @@EFI_VENDOR@@\\n")
|
||||
+ print("%global _efi_arch " .. getarch() .. "\\n")
|
||||
+ print("%global _efi_arch_upper " .. string.upper(getarch()) .. "\\n")
|
||||
+ if not (alt == nil or alt == "") then
|
||||
+ print("%global _efi_alt_arch " .. alt .. "\\n")
|
||||
+ print("%global _efi_alt_arch_upper " .. string.upper(alt) .. "\\n")
|
||||
+ end
|
||||
+ end
|
||||
+}}%{expand:%{?_efi_alt_arch:%global efi_alt_arch %%{_efi_alt_arch}%global efi_alt_arch_upper %%{_efi_alt_arch_upper}}}
|
||||
+
|
||||
+%efi_rpm_macros_version %{expand:%{_efi_rpm_macros_setup}}@@EFI_RPM_MACROS_VERSION@@
|
||||
+
|
||||
+%efi %{expand:%{_efi_rpm_macros_setup}}%{expand:%{_efi}}
|
||||
+%efi_vendor %{expand:%{_efi_rpm_macros_setup}}%{expand:%{_efi_vendor}}
|
||||
+
|
||||
+%efi_esp_root @@EFI_ESP_ROOT@@
|
||||
+%efi_esp_efi %{efi_esp_root}/EFI
|
||||
+%efi_esp_boot %{efi_esp_efi}/BOOT
|
||||
+%efi_esp_dir %{expand:%{_efi_rpm_macros_setup}}%{efi_esp_efi}/%{efi_vendor}
|
||||
+
|
||||
+%efi_arch %{expand:%{_efi_rpm_macros_setup}}%{_efi_arch}
|
||||
+%efi_arch_upper %{expand:%{_efi_rpm_macros_setup}}%{_efi_arch_upper}
|
||||
+%efi_has_alt_arch %{expand:%{_efi_rpm_macros_setup}}0%{?_efi_alt_arch:1}
|
||||
diff --git a/macros.efi.in b/macros.efi.in
|
||||
index 66139a257d5..56c9ea0138a 100644
|
||||
--- a/macros.efi.in
|
||||
+++ b/macros.efi.in
|
||||
@@ -16,76 +16,3 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
#
|
||||
-
|
||||
-%efi @@EFI_ARCHES@@
|
||||
-
|
||||
-%efi_vendor @@EFI_VENDOR@@
|
||||
-
|
||||
-%efi_esp_root @@EFI_ESP_ROOT@@
|
||||
-%efi_esp_efi %{efi_esp_root}/EFI
|
||||
-%efi_esp_boot %{efi_esp_efi}/BOOT
|
||||
-%efi_esp_dir %{efi_esp_efi}/%{efi_vendor}
|
||||
-
|
||||
-%efi_arch %{lua:
|
||||
--- test if our arch matches
|
||||
-local function ifarch(archmacro)
|
||||
- local target = rpm.expand(" %{_target_cpu} ")
|
||||
- local arches = rpm.expand(" " .. archmacro .. " ")
|
||||
- local match = string.match(arches, target)
|
||||
- if not (match == nil) then
|
||||
- return true
|
||||
- end
|
||||
-end
|
||||
--- Do the work
|
||||
-if ifarch("x86_64") then
|
||||
- print("x64")
|
||||
-elseif ifarch("%{ix86}") then
|
||||
- print("ia32")
|
||||
-elseif ifarch("aarch64") then
|
||||
- print("aa64")
|
||||
-elseif ifarch("%{arm}") then
|
||||
- print("arm")
|
||||
-elseif ifarch("ia64") then
|
||||
- print("ia64")
|
||||
-else
|
||||
- rpm.expand("%%{error:Not an EFI architecture}")
|
||||
- print("")
|
||||
-end
|
||||
-}
|
||||
-
|
||||
-%efi_arch_upper %{lua:
|
||||
- local arch = rpm.expand("%{efi_arch}")
|
||||
- print(string.upper(arch))
|
||||
-}
|
||||
-
|
||||
-%efi_alt_arch %{lua:
|
||||
--- test if our arch matches
|
||||
-local function ifarch(archmacro)
|
||||
- local target = rpm.expand(" %{_target_cpu} ")
|
||||
- local arches = rpm.expand(" " .. archmacro .. " ")
|
||||
- local match = string.match(arches, target)
|
||||
- if not (match == nil) then
|
||||
- return true
|
||||
- end
|
||||
-end
|
||||
--- Do the work
|
||||
-if ifarch("x86_64") then
|
||||
- print("ia32")
|
||||
-else
|
||||
- print("")
|
||||
-end
|
||||
-}
|
||||
-
|
||||
-%efi_alt_arch_upper %{lua:
|
||||
- local arch = rpm.expand("%{efi_alt_arch}")
|
||||
- print(string.upper(arch))
|
||||
-}
|
||||
-
|
||||
-%efi_has_alt_arch %{lua:
|
||||
- local arch = rpm.expand("%{efi_alt_arch}")
|
||||
- if arch == "" then
|
||||
- print("0")
|
||||
- else
|
||||
- print("1")
|
||||
- end
|
||||
-}
|
||||
--
|
||||
2.14.3
|
||||
|
@ -1,7 +1,7 @@
|
||||
Summary: Common RPM Macros for building EFI-related packages
|
||||
Name: efi-rpm-macros
|
||||
Version: 2
|
||||
Release: 5%{?dist}
|
||||
Release: 6%{?dist}
|
||||
Group: Development/System
|
||||
License: GPLv3+
|
||||
URL: https://github.com/rhboot/%{name}/
|
||||
@ -21,6 +21,7 @@ Patch0007: 0007-Make-a-macros.efi-srpm-that-defines-efi.patch
|
||||
Patch0008: 0008-Add-efi_has_alt_arch-0-or-1.patch
|
||||
Patch0009: 0009-Add-efi-filesystem-subpackage.patch
|
||||
Patch0010: 0010-efi-rpm-macros.spec-don-t-use-efi-rpm-macros-definit.patch
|
||||
Patch0011: 0011-Do-it-differently.patch
|
||||
|
||||
%global debug_package %{nil}
|
||||
%global _efi_vendor_ %(eval sed -n -e 's/rhel/redhat/' -e 's/^ID=//p' /etc/os-release)
|
||||
@ -56,11 +57,11 @@ machine bootloaders and tools.
|
||||
%install
|
||||
%make_install EFI_VENDOR=%{_efi_vendor_}
|
||||
|
||||
%files
|
||||
%{!?_licensedir:%global license %%doc}
|
||||
%license LICENSE
|
||||
%doc README
|
||||
%{_rpmmacrodir}/macros.efi
|
||||
#%%files
|
||||
#%%{!?_licensedir:%%global license %%%%doc}
|
||||
#%%license LICENSE
|
||||
#%%doc README
|
||||
#%%{_rpmmacrodir}/macros.efi
|
||||
|
||||
%files -n efi-srpm-macros
|
||||
%{!?_licensedir:%global license %%doc}
|
||||
@ -76,6 +77,9 @@ machine bootloaders and tools.
|
||||
%dir /boot/efi/EFI/%{_efi_vendor_}
|
||||
|
||||
%changelog
|
||||
* Thu May 03 2018 Peter Jones <pjones@redhat.com> - 2-6
|
||||
- Rework the macros for better srpm use.
|
||||
|
||||
* Wed May 02 2018 Peter Jones <pjones@redhat.com> - 2-5
|
||||
- Add efi-filesystem subpackage
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user