Initial import (#1573521).

Signed-off-by: Peter Jones <pjones@redhat.com>
This commit is contained in:
Peter Jones 2018-05-01 13:03:22 -04:00
parent 9286257b44
commit 23f10ecd26
8 changed files with 297 additions and 0 deletions

7
.gitignore vendored Normal file
View File

@ -0,0 +1,7 @@
*~
*.rpm
*.tar.*
.*.sw?
.build-*.log
efi-rpm-macros-*/
x86_64/

View File

@ -0,0 +1,47 @@
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
Signed-off-by: Peter Jones <pjones@redhat.com>
---
macros.efi.in | 25 ++-----------------------
1 file changed, 2 insertions(+), 23 deletions(-)
diff --git a/macros.efi.in b/macros.efi.in
index 953dcfb1200..d935fd23da1 100644
--- a/macros.efi.in
+++ b/macros.efi.in
@@ -53,27 +53,6 @@ end
}
%efi_arch_upper %{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
- print("")
-end
+ local arch = rpm.expand("%{efi_arch}")
+ print(string.upper(arch))
}
--
2.14.3

View File

@ -0,0 +1,26 @@
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.
Signed-off-by: Peter Jones <pjones@redhat.com>
---
efi-rpm-macros.spec.in | 3 +++
1 file changed, 3 insertions(+)
diff --git a/efi-rpm-macros.spec.in b/efi-rpm-macros.spec.in
index 882f679aca9..c89fb6caf5e 100644
--- a/efi-rpm-macros.spec.in
+++ b/efi-rpm-macros.spec.in
@@ -43,5 +43,8 @@ Source0: https://github.com/rhboot/%{name}/releases/download/%{version}/%{name}-
%{_rpmmacrodir}/*
%changelog
+* Tue May 01 2018 Peter Jones <pjones@redhat.com> - 2-1
+- Lots of rpmlint fixups and the like.
+
* Mon Apr 30 2018 Peter Jones <pjones@redhat.com> - 1-1
- First shot at building it.
--
2.14.3

View File

@ -0,0 +1,44 @@
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
Signed-off-by: Peter Jones <pjones@redhat.com>
---
efi-rpm-macros.spec.in | 13 ++-----------
1 file changed, 2 insertions(+), 11 deletions(-)
diff --git a/efi-rpm-macros.spec.in b/efi-rpm-macros.spec.in
index c89fb6caf5e..fa68b1dd7b1 100644
--- a/efi-rpm-macros.spec.in
+++ b/efi-rpm-macros.spec.in
@@ -6,8 +6,7 @@ Group: Development/System
License: GPLv3+
URL: https://github.com/rhboot/%{name}/
ExclusiveArch: @@EFI_ARCHES@@
-#BuildRequires: git
-BuildRequires: sed
+BuildRequires: git sed
Requires: rpm
BuildArch: noarch
@@ -20,15 +19,7 @@ Source0: https://github.com/rhboot/%{name}/releases/download/%{version}/%{name}-
%{name} provides a set of RPM macros for use in EFI-related packages.
%prep
-%setup -q
-#git init
-#git config user.email "example@example.com"
-#git config user.name "RPM Ninjas"
-#git add .
-#git commit -a -q -m "%%{version} baseline."
-#git am %%{patches} </dev/null
-#git config --unset user.email
-#git config --unset user.name
+%autosetup -S git
%build
%make_build EFI_VENDOR=%{_efi_vendor_} clean all
--
2.14.3

View File

@ -0,0 +1,71 @@
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
Signed-off-by: Peter Jones <pjones@redhat.com>
---
README | 18 ++++++++++--------
macros.efi.in | 23 +++++++++++++++++++++++
2 files changed, 33 insertions(+), 8 deletions(-)
diff --git a/README b/README
index 23601c763b0..c3474a1d863 100644
--- a/README
+++ b/README
@@ -8,11 +8,13 @@ EFI_VENDOR the vendor name for your EFI System Partition directory
The following rpm macros are set:
-%efi the arches that EFI packages should be built on, suitable for use with %ifarch
-%efi_vendor the vendor name for your EFI System Partition directory
-%efi_esp_root the directory where the EFI system Partition is mounted
-%efi_esp_efi the full path to \EFI on the EFI System Partition
-%efi_esp_boot the full path to \EFI\BOOT on the EFI System Partition
-%efi_esp_dir the full path to your vendor directory on the EFI System Partition
-%efi_arch the EFI architecture name, e.g. x64
-%efi_arch_upper the EFI architecture name in upper case, e.g. X64
+%efi the arches that EFI packages should be built on, suitable for use with %ifarch
+%efi_vendor the vendor name for your EFI System Partition directory
+%efi_esp_root the directory where the EFI system Partition is mounted
+%efi_esp_efi the full path to \EFI on the EFI System Partition
+%efi_esp_boot the full path to \EFI\BOOT on the EFI System Partition
+%efi_esp_dir the full path to your vendor directory on the EFI System Partition
+%efi_arch the EFI architecture name, e.g. x64
+%efi_arch_upper the EFI architecture name in upper case, e.g. X64
+%efi_alt_arch the EFI architecture name for other arches that build on this one (i.e. ia32 on x64)
+%efi_alt_arch_upper the upper case version of %efi_alt_arch
diff --git a/macros.efi.in b/macros.efi.in
index d935fd23da1..e03b9011e9d 100644
--- a/macros.efi.in
+++ b/macros.efi.in
@@ -56,3 +56,26 @@ end
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))
+}
--
2.14.3

View File

@ -0,0 +1,55 @@
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
Signed-off-by: Peter Jones <pjones@redhat.com>
---
macros.efi.in | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/macros.efi.in b/macros.efi.in
index e03b9011e9d..a0bd67d9b69 100644
--- a/macros.efi.in
+++ b/macros.efi.in
@@ -48,13 +48,17 @@ elseif ifarch("%{arm}") then
elseif ifarch("ia64") then
print("ia64")
else
- print("")
+ print("%{nil}")
end
}
%efi_arch_upper %{lua:
local arch = rpm.expand("%{efi_arch}")
- print(string.upper(arch))
+ if arch == '%{nil}'
+ print(arch)
+ else
+ print(string.upper(arch))
+ end
}
%efi_alt_arch %{lua:
@@ -71,11 +75,15 @@ end
if ifarch("x86_64") then
print("ia32")
else
- print("")
+ print("%{nil}")
end
}
%efi_alt_arch_upper %{lua:
local arch = rpm.expand("%{efi_alt_arch}")
- print(string.upper(arch))
+ if arch == '%{nil}'
+ print(arch)
+ else
+ print(string.upper(arch))
+ end
}
--
2.14.3

46
efi-rpm-macros.spec Normal file
View File

@ -0,0 +1,46 @@
Summary: Common RPM Macros for building EFI-related packages
Name: efi-rpm-macros
Version: 2
Release: 1%{?dist}
Group: Development/System
License: GPLv3+
URL: https://github.com/rhboot/%{name}/
ExclusiveArch: x86_64 aarch64 %{arm} %{ix86}
BuildRequires: git sed
Requires: rpm
BuildArch: noarch
Source0: https://github.com/rhboot/%{name}/releases/download/%{version}/%{name}-%{version}.tar.bz2
Patch0001: 0001-Simplify-efi_arch_upper.patch
Patch0002: 0002-Add-a-changelog-entry-to-the-.spec-for-version-2.patch
Patch0003: 0003-efi-rpm-macros.spec.in-use-autosetup.patch
Patch0004: 0004-Add-efi_alt_arch-and-efi_alt_arch_upper.patch
Patch0005: 0005-Return-nil-instead-of-on-unsupported-arches.patch
%global debug_package %{nil}
%global _efi_vendor_ %(eval sed -n -e 's/rhel/redhat/' -e 's/^ID=//p' /etc/os-release)
%description
%{name} provides a set of RPM macros for use in EFI-related packages.
%prep
%autosetup -S git
%build
%make_build EFI_VENDOR=%{_efi_vendor_} clean all
%install
%make_install EFI_VENDOR=%{_efi_vendor_}
%files
%{!?_licensedir:%global license %%doc}
%license LICENSE
%doc README
%{_rpmmacrodir}/*
%changelog
* Tue May 01 2018 Peter Jones <pjones@redhat.com> - 2-1
- Lots of rpmlint fixups and the like.
* Mon Apr 30 2018 Peter Jones <pjones@redhat.com> - 1-1
- First shot at building it.

1
sources Normal file
View File

@ -0,0 +1 @@
SHA512 (efi-rpm-macros-2.tar.bz2) = d232aedc3ed9e833d4d60a63360a6f68bb4696947204045c95ef938e135744d64caa0c17bed35b1f8d9d74a86ed198f89eb52b5c7d4ebaa4c4cf66a88d2bc418