Update to latest upstream version with renamed package and consistent use of "jigawatts"

Drop library patch which is no longer needed.

Resolves: rhbz#1972029
This commit is contained in:
Andrew John Hughes 2021-08-28 05:37:22 +01:00 committed by Andrew Hughes
parent c368530e92
commit 61f6326497
4 changed files with 12 additions and 67 deletions

1
.gitignore vendored
View File

@ -1 +1,2 @@
/e814e2f0a9390b19a4073b074d43de8a0d121b8d.zip /e814e2f0a9390b19a4073b074d43de8a0d121b8d.zip
/a5f8e31a4a967059498f820c5728f1deb0736c69.zip

View File

@ -1,19 +1,17 @@
%global uname jigawatts %global uname jigawatts
%global uversion e814e2f0a9390b19a4073b074d43de8a0d121b8d %global uversion a5f8e31a4a967059498f820c5728f1deb0736c69
%global dversion %(echo %{uversion} | sed s/-/_/) %global dversion %(echo %{uversion} | sed s/-/_/)
%global aarch64 aarch64 arm64 armv8 %global aarch64 aarch64 arm64 armv8
%global shortcommit %(c=%{uversion}; echo ${c:0:7}) %global shortcommit %(c=%{uversion}; echo ${c:0:7})
%global commitdate 20210802 %global commitdate 20210827
Name: %{uname} Name: %{uname}
Version: 0.2 Version: 0.2
Release: 0.3.%{commitdate}%{shortcommit}%{?dist} Release: 0.4.%{commitdate}%{shortcommit}%{?dist}
Summary: Java CRIU helper Summary: Java CRIU helper
License: GPLv2 with exceptions License: GPLv2 with exceptions
URL: https://github.com/chflood/%{uname} URL: https://github.com/chflood/%{uname}
Source0: https://github.com/gnu-andrew/jigawatts/archive/%{uversion}.zip Source0: https://github.com/chflood/%{uname}/archive/%{uversion}.zip
Patch0: load_library.patch
BuildRequires: java-devel BuildRequires: java-devel
BuildRequires: criu-devel BuildRequires: criu-devel
@ -41,7 +39,6 @@ Javadoc for %{name}
%prep %prep
%setup -q -n %{uname}-%{uversion} %setup -q -n %{uname}-%{uversion}
%patch0 -p1
./autogen.sh ./autogen.sh
@ -62,13 +59,18 @@ rm -rf $RPM_BUILD_ROOT
%dir %{_defaultlicensedir}/%{name} %dir %{_defaultlicensedir}/%{name}
%license %{_defaultlicensedir}/%{name}/LICENSE.md %license %{_defaultlicensedir}/%{name}/LICENSE.md
%dir %{_javadir}/%{name} %dir %{_javadir}/%{name}
%{_javadir}/%{name}/jigawatt.jar %{_javadir}/%{name}/%{uname}.jar
%{_libdir}/libJigawatts.so %{_libdir}/libJigawatts.so
%files javadoc %files javadoc
%{_javadocdir}/%{name} %{_javadocdir}/%{name}
%changelog %changelog
* Sat Aug 28 2021 Andrew Hughes <gnu.andrew@redhat.com> - 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 <gnu.andrew@redhat.com> - 0.2-0.3.20210802a3007aa * Mon Aug 02 2021 Andrew Hughes <gnu.andrew@redhat.com> - 0.2-0.3.20210802a3007aa
- Rewrite to use autotools build system, avoiding need for Maven dependencies missing in RHEL 9. - 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. - This also ensures use of the standard build flags and installs the jar in the expected location.

View File

@ -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<Hook>();
restoreHooks = new ArrayList<Hook>();

View File

@ -1 +1 @@
SHA512 (e814e2f0a9390b19a4073b074d43de8a0d121b8d.zip) = 5ca78cb7a923a97075be8c61bf017bce56d68c6fb9e132e6474ddc877fbb51e9ef46d03cc2d3b3353c4b9385af7a0684e65377f61b32e9812423b991ee5391cf SHA512 (a5f8e31a4a967059498f820c5728f1deb0736c69.zip) = a10721ed47a0faed55d544c3cad9e36b63cc580bef9f38b1ce845990c5cd4403c99b7be29d057ca67837e3743534ef8be1a58b3dc1e20d2bf7ebda81e266ef45