From 61f6326497580077885182b63316b8eb19619998 Mon Sep 17 00:00:00 2001 From: Andrew John Hughes Date: Sat, 28 Aug 2021 05:37:22 +0100 Subject: [PATCH] Update to latest upstream version with renamed package and consistent use of "jigawatts" Drop library patch which is no longer needed. Resolves: rhbz#1972029 --- .gitignore | 1 + jigawatts.spec | 18 +++++++------- load_library.patch | 58 ---------------------------------------------- sources | 2 +- 4 files changed, 12 insertions(+), 67 deletions(-) delete mode 100644 load_library.patch diff --git a/.gitignore b/.gitignore index e367361..f132c2b 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ /e814e2f0a9390b19a4073b074d43de8a0d121b8d.zip +/a5f8e31a4a967059498f820c5728f1deb0736c69.zip diff --git a/jigawatts.spec b/jigawatts.spec index 1f33972..1aa7d59 100644 --- a/jigawatts.spec +++ b/jigawatts.spec @@ -1,19 +1,17 @@ %global uname jigawatts -%global uversion e814e2f0a9390b19a4073b074d43de8a0d121b8d +%global uversion a5f8e31a4a967059498f820c5728f1deb0736c69 %global dversion %(echo %{uversion} | sed s/-/_/) %global aarch64 aarch64 arm64 armv8 %global shortcommit %(c=%{uversion}; echo ${c:0:7}) -%global commitdate 20210802 +%global commitdate 20210827 Name: %{uname} Version: 0.2 -Release: 0.3.%{commitdate}%{shortcommit}%{?dist} +Release: 0.4.%{commitdate}%{shortcommit}%{?dist} Summary: Java CRIU helper License: GPLv2 with exceptions URL: https://github.com/chflood/%{uname} -Source0: https://github.com/gnu-andrew/jigawatts/archive/%{uversion}.zip - -Patch0: load_library.patch +Source0: https://github.com/chflood/%{uname}/archive/%{uversion}.zip BuildRequires: java-devel BuildRequires: criu-devel @@ -41,7 +39,6 @@ Javadoc for %{name} %prep %setup -q -n %{uname}-%{uversion} -%patch0 -p1 ./autogen.sh @@ -62,13 +59,18 @@ rm -rf $RPM_BUILD_ROOT %dir %{_defaultlicensedir}/%{name} %license %{_defaultlicensedir}/%{name}/LICENSE.md %dir %{_javadir}/%{name} -%{_javadir}/%{name}/jigawatt.jar +%{_javadir}/%{name}/%{uname}.jar %{_libdir}/libJigawatts.so %files javadoc %{_javadocdir}/%{name} %changelog +* Sat Aug 28 2021 Andrew Hughes - 0.2-0.4.20210807b2d3751 +- Update to latest upstream version with renamed package and consistent use of "jigawatts" +- Drop library patch which is no longer needed. +- Resolves: rhbz#1972029 + * Mon Aug 02 2021 Andrew Hughes - 0.2-0.3.20210802a3007aa - Rewrite to use autotools build system, avoiding need for Maven dependencies missing in RHEL 9. - This also ensures use of the standard build flags and installs the jar in the expected location. diff --git a/load_library.patch b/load_library.patch deleted file mode 100644 index cb8bf9a..0000000 --- a/load_library.patch +++ /dev/null @@ -1,58 +0,0 @@ -diff --git a/src/main/java/org/openjdk/jigawatts/Jigawatts.java b/src/main/java/org/openjdk/jigawatts/Jigawatts.java -index f2766da..8257eeb 100644 ---- a/src/main/java/org/openjdk/jigawatts/Jigawatts.java -+++ b/src/main/java/org/openjdk/jigawatts/Jigawatts.java -@@ -150,38 +150,26 @@ public class Jigawatts { - return Collections.unmodifiableList(crContext.restoreHooks); - } - -- private static void copyLibrary(String library, String destDir) throws IOException { -- -- String libraryName = System.mapLibraryName(library); -- String libraryFile = destDir + "/" + libraryName; -- -- try (InputStream is = Jigawatts.class.getClassLoader().getResourceAsStream(libraryName); -- FileOutputStream os = new FileOutputStream(libraryFile)) { -- -- byte[] buf = new byte[1024]; -- -- int bytesRead; -- -- while ((bytesRead = is.read(buf)) > 0) { -- os.write(buf, 0, bytesRead); -+ private static void loadLib(String library) { -+ String criuLib = System.mapLibraryName(library); -+ boolean success = false; -+ for (String path: System.getProperty("java.library.path").split(":")) { -+ try { -+ String libPath = path + File.separator + criuLib; -+ System.load(libPath); -+ success = true; -+ break; -+ } catch (UnsatisfiedLinkError e) { -+ continue; - } -+ }; -+ if (!success) { -+ throw new RuntimeException(library + " library not found!"); - } - } - - static { -- -- String libDir = System.getProperty("java.io.tmpdir"); -- String tmpLib = libDir+ "/" + System.mapLibraryName("Jigawatts"); -- -- if (!Files.exists(Paths.get(tmpLib))) { -- try { -- copyLibrary("Jigawatts", libDir); -- } catch (IOException ex) { -- throw new RuntimeException("can't initialize Jigawatts",ex); -- } -- } -- System.load(tmpLib); -- System.loadLibrary("criu"); -+ loadLib("Jigawatts"); - - checkpointHooks = new ArrayList(); - restoreHooks = new ArrayList(); diff --git a/sources b/sources index 2885e2d..86ad0a7 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (e814e2f0a9390b19a4073b074d43de8a0d121b8d.zip) = 5ca78cb7a923a97075be8c61bf017bce56d68c6fb9e132e6474ddc877fbb51e9ef46d03cc2d3b3353c4b9385af7a0684e65377f61b32e9812423b991ee5391cf +SHA512 (a5f8e31a4a967059498f820c5728f1deb0736c69.zip) = a10721ed47a0faed55d544c3cad9e36b63cc580bef9f38b1ce845990c5cd4403c99b7be29d057ca67837e3743534ef8be1a58b3dc1e20d2bf7ebda81e266ef45