Accepting request 1201943 from Java:packages

preserve manifest modification time

OBS-URL: https://build.opensuse.org/request/show/1201943
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/xmvn?expand=0&rev=22
This commit is contained in:
Ana Guerrero 2024-09-19 19:17:41 +00:00 committed by Git OBS Bridge
commit 2393f9bea7
9 changed files with 75 additions and 17 deletions

View File

@ -0,0 +1,35 @@
From 3c2036e15f127c4ab90eb2312af27e13711d5a24 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fridrich=20=C5=A0trba?= <fridrich.strba@bluewin.ch>
Date: Wed, 18 Sep 2024 18:31:24 +0200
Subject: [PATCH 4/4] Reproducible manifest modification time
---
.../org/fedoraproject/xmvn/tools/install/JarUtils.java | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/xmvn-tools/xmvn-install/src/main/java/org/fedoraproject/xmvn/tools/install/JarUtils.java b/xmvn-tools/xmvn-install/src/main/java/org/fedoraproject/xmvn/tools/install/JarUtils.java
index 815d19a6..844510b6 100644
--- a/xmvn-tools/xmvn-install/src/main/java/org/fedoraproject/xmvn/tools/install/JarUtils.java
+++ b/xmvn-tools/xmvn-install/src/main/java/org/fedoraproject/xmvn/tools/install/JarUtils.java
@@ -249,12 +249,17 @@ public final class JarUtils
try ( ZipFile jar = new ZipFile( backupPath.toFile() );
ZipArchiveOutputStream os = new ZipArchiveOutputStream( targetJar.toFile() ) )
{
- try ( InputStream mfIs = jar.getInputStream( jar.getEntry( MANIFEST_PATH ) ) )
+ ZipArchiveEntry jarEntry = jar.getEntry( MANIFEST_PATH );
+ try ( InputStream mfIs = jar.getInputStream( jarEntry ) )
{
Manifest mf = new Manifest( mfIs );
updateManifest( artifact, mf );
// write manifest
ZipArchiveEntry newManifestEntry = new ZipArchiveEntry( MANIFEST_PATH );
+ if ( jarEntry != null )
+ {
+ newManifestEntry.setTime( jarEntry.getTime() );
+ }
os.putArchiveEntry( newManifestEntry );
mf.write( os );
os.closeArchiveEntry();
--
2.46.0

View File

@ -1,3 +1,11 @@
-------------------------------------------------------------------
Wed Sep 18 16:33:37 UTC 2024 - Fridrich Strba <fstrba@suse.com>
- Added patch:
* 0004-Reproducible-manifest-modification-time.patch
+ preserve manifest modification time when injecting additional
attributes
-------------------------------------------------------------------
Thu Jul 18 11:07:04 UTC 2024 - Fridrich Strba <fstrba@suse.com>

View File

@ -31,6 +31,7 @@ Source1: %{parent}-build.tar.xz
Patch0: 0001-Do-not-leave-a-stray-options-file-in-the-generated-j.patch
Patch1: 0002-Make-metadata-UUIDs-reproducible-if-SOURCE_DATE_EPOC.patch
Patch2: 0003-Reproducible-javadoc-notimestamp-option-and-some-aut.patch
Patch3: 0004-Reproducible-manifest-modification-time.patch
BuildRequires: %{parent}-api = %{version}
BuildRequires: %{parent}-core = %{version}
BuildRequires: ant

View File

@ -1,3 +1,11 @@
-------------------------------------------------------------------
Wed Sep 18 16:33:37 UTC 2024 - Fridrich Strba <fstrba@suse.com>
- Added patch:
* 0004-Reproducible-manifest-modification-time.patch
+ preserve manifest modification time when injecting additional
attributes
-------------------------------------------------------------------
Thu Jul 18 11:07:04 UTC 2024 - Fridrich Strba <fstrba@suse.com>

View File

@ -29,6 +29,7 @@ Source0: https://github.com/fedora-java/%{parent}/releases/download/%{ver
Patch0: 0001-Do-not-leave-a-stray-options-file-in-the-generated-j.patch
Patch1: 0002-Make-metadata-UUIDs-reproducible-if-SOURCE_DATE_EPOC.patch
Patch2: 0003-Reproducible-javadoc-notimestamp-option-and-some-aut.patch
Patch3: 0004-Reproducible-manifest-modification-time.patch
BuildRequires: %{parent}-api = %{version}
BuildRequires: %{parent}-core = %{version}
BuildRequires: fdupes
@ -101,7 +102,7 @@ find -name ResolverIntegrationTest.java -delete
%pom_remove_dep -r :::test:
%pom_xpath_inject "pom:project/pom:build/pom:plugins/pom:plugin[pom:artifactId='maven-plugin-plugin']/pom:configuration" '
<goalPrefix>xmvn-mojo</goalPrefix>' xmvn-mojo
<goalPrefix>${project.artifactId}</goalPrefix>' xmvn-mojo
pushd %{name}
%{mvn_file} :{*} %{parent}/@1

View File

@ -1,3 +1,11 @@
-------------------------------------------------------------------
Wed Sep 18 16:33:37 UTC 2024 - Fridrich Strba <fstrba@suse.com>
- Added patch:
* 0004-Reproducible-manifest-modification-time.patch
+ preserve manifest modification time when injecting additional
attributes
-------------------------------------------------------------------
Thu Jul 18 11:07:04 UTC 2024 - Fridrich Strba <fstrba@suse.com>

View File

@ -29,6 +29,7 @@ Source0: https://github.com/fedora-java/%{parent}/releases/download/%{ver
Patch0: 0001-Do-not-leave-a-stray-options-file-in-the-generated-j.patch
Patch1: 0002-Make-metadata-UUIDs-reproducible-if-SOURCE_DATE_EPOC.patch
Patch2: 0003-Reproducible-javadoc-notimestamp-option-and-some-aut.patch
Patch3: 0004-Reproducible-manifest-modification-time.patch
BuildRequires: javapackages-local
BuildRequires: xmvn-resolve
BuildRequires: mvn(org.apache.maven.plugins:maven-compiler-plugin)

View File

@ -1,3 +1,11 @@
-------------------------------------------------------------------
Wed Sep 18 16:33:37 UTC 2024 - Fridrich Strba <fstrba@suse.com>
- Added patch:
* 0004-Reproducible-manifest-modification-time.patch
+ preserve manifest modification time when injecting additional
attributes
-------------------------------------------------------------------
Thu Jul 18 11:07:04 UTC 2024 - Fridrich Strba <fstrba@suse.com>

View File

@ -30,6 +30,7 @@ Source1: %{parent}-build.tar.xz
Patch0: 0001-Do-not-leave-a-stray-options-file-in-the-generated-j.patch
Patch1: 0002-Make-metadata-UUIDs-reproducible-if-SOURCE_DATE_EPOC.patch
Patch2: 0003-Reproducible-javadoc-notimestamp-option-and-some-aut.patch
Patch3: 0004-Reproducible-manifest-modification-time.patch
BuildRequires: ant
BuildRequires: apache-commons-compress
BuildRequires: apache-commons-io
@ -37,7 +38,7 @@ BuildRequires: atinject
BuildRequires: beust-jcommander >= 1.82
BuildRequires: fdupes
BuildRequires: java-devel >= 1.8
BuildRequires: javapackages-local
BuildRequires: javapackages-local >= 6
BuildRequires: modello >= 2.0.0
BuildRequires: objectweb-asm
BuildRequires: sisu-inject
@ -157,19 +158,6 @@ find -name ResolverIntegrationTest.java -delete
rm -f xmvn-core/src/test/java/org/fedoraproject/xmvn/resolver/JavaHomeResolverTest.java
%endif
for i in api core; do
%pom_xpath_inject "pom:project" "
<groupId>org.fedoraproject.xmvn</groupId>
<version>%{version}</version>" %{parent}-${i}
%pom_remove_parent %{parent}-${i}
done
for i in install resolve subst; do
%pom_xpath_inject "pom:project" "
<groupId>org.fedoraproject.xmvn</groupId>
<version>%{version}</version>" %{parent}-tools/%{parent}-${i}
%pom_remove_parent %{parent}-tools/%{parent}-${i}
done
%build
mkdir -p lib
build-jar-repository -s lib \
@ -196,11 +184,11 @@ done
# poms
install -dm 0755 %{buildroot}%{_mavenpomdir}/%{parent}
for i in api core; do
install -pm 0644 %{parent}-${i}/pom.xml %{buildroot}%{_mavenpomdir}/%{parent}/%{parent}-${i}.pom
%{mvn_install_pom} %{parent}-${i}/pom.xml %{buildroot}%{_mavenpomdir}/%{parent}/%{parent}-${i}.pom
%add_maven_depmap %{parent}/%{parent}-${i}.pom %{parent}/%{parent}-${i}.jar -f ${i}
done
for i in install resolve subst; do
install -pm 0644 %{parent}-tools/%{parent}-${i}/pom.xml %{buildroot}%{_mavenpomdir}/%{parent}/%{parent}-${i}.pom
%{mvn_install_pom} %{parent}-tools/%{parent}-${i}/pom.xml %{buildroot}%{_mavenpomdir}/%{parent}/%{parent}-${i}.pom
%add_maven_depmap %{parent}/%{parent}-${i}.pom %{parent}/%{parent}-${i}.jar -f ${i}
done