From fc9b9b371bd74a9a57996b2b6d9c12cd532f9924799f6679e2eee4c1741c8d8d Mon Sep 17 00:00:00 2001 From: Fridrich Strba Date: Tue, 19 Sep 2023 06:26:47 +0000 Subject: [PATCH] OBS-URL: https://build.opensuse.org/package/show/Java:packages/apache-ivy?expand=0&rev=72 --- apache-ivy-publication-date.patch | 42 +++++++++++++++++++++++++++++++ apache-ivy.spec | 8 +++--- 2 files changed, 46 insertions(+), 4 deletions(-) create mode 100644 apache-ivy-publication-date.patch diff --git a/apache-ivy-publication-date.patch b/apache-ivy-publication-date.patch new file mode 100644 index 0000000..4a5fafb --- /dev/null +++ b/apache-ivy-publication-date.patch @@ -0,0 +1,42 @@ +--- apache-ivy-2.5.2/src/java/org/apache/ivy/core/cache/DefaultRepositoryCacheManager.java 2023-09-19 08:19:56.006332869 +0200 ++++ apache-ivy-2.5.2/src/java/org/apache/ivy/core/cache/DefaultRepositoryCacheManager.java 2023-09-19 08:20:15.856475360 +0200 +@@ -1472,7 +1472,7 @@ + } + + private Artifact getDefaultMetadataArtifact(ModuleRevisionId mrid) { +- return new DefaultArtifact(mrid, new Date(), "metadata", "metadata", "ivy", true); ++ return new DefaultArtifact(mrid, System.getenv("SOURCE_DATE_EPOCH") != null ? new Date(1000 * Long.parseLong(System.getenv("SOURCE_DATE_EPOCH"))) : new Date(), "metadata", "metadata", "ivy", true); + } + + // not used any more, but may be useful for finer grained locking when downloading artifacts +--- apache-ivy-2.5.2/src/java/org/apache/ivy/core/module/descriptor/DefaultArtifact.java 2023-09-19 08:19:56.009666226 +0200 ++++ apache-ivy-2.5.2/src/java/org/apache/ivy/core/module/descriptor/DefaultArtifact.java 2023-09-19 08:20:27.823227936 +0200 +@@ -100,7 +100,7 @@ + throw new NullPointerException("null arid not allowed"); + } + if (publicationDate == null) { +- publicationDate = new Date(); ++ publicationDate = System.getenv("SOURCE_DATE_EPOCH") != null ? new Date(1000 * Long.parseLong(System.getenv("SOURCE_DATE_EPOCH"))) : new Date(); + } + this.publicationDate = publicationDate; + this.arid = arid; +--- apache-ivy-2.5.2/src/java/org/apache/ivy/core/module/descriptor/DefaultModuleDescriptor.java 2023-09-19 08:19:56.009666226 +0200 ++++ apache-ivy-2.5.2/src/java/org/apache/ivy/core/module/descriptor/DefaultModuleDescriptor.java 2023-09-19 08:21:12.330214087 +0200 +@@ -272,7 +272,7 @@ + this.resolvedRevId = id; + this.status = status; + this.publicationDate = pubDate; +- this.resolvedPublicationDate = publicationDate == null ? new Date() : publicationDate; ++ this.resolvedPublicationDate = publicationDate == null ? (System.getenv("SOURCE_DATE_EPOCH") != null ? new Date(1000 * Long.parseLong(System.getenv("SOURCE_DATE_EPOCH"))) : new Date()) : publicationDate; + this.isDefault = isDefault; + this.parser = XmlModuleDescriptorParser.getInstance(); + } +@@ -308,7 +308,7 @@ + public void setPublicationDate(Date publicationDate) { + this.publicationDate = publicationDate; + if (resolvedPublicationDate == null) { +- resolvedPublicationDate = publicationDate == null ? new Date() : publicationDate; ++ resolvedPublicationDate = publicationDate == null ? (System.getenv("SOURCE_DATE_EPOCH") != null ? new Date(1000 * Long.parseLong(System.getenv("SOURCE_DATE_EPOCH"))) : new Date()) : publicationDate; + } + } + diff --git a/apache-ivy.spec b/apache-ivy.spec index 631f6ce..ba085e2 100644 --- a/apache-ivy.spec +++ b/apache-ivy.spec @@ -31,11 +31,12 @@ Source0: https://archive.apache.org/dist/ant/ivy/%{version}/%{name}-%{ver Source1: ivy.1 Source2: https://repo1.maven.org/maven2/org/apache/ivy/ivy/%{version}/ivy-%{version}.pom Patch0: apache-ivy-global-settings.patch +Patch1: apache-ivy-publication-date.patch BuildRequires: ant BuildRequires: bouncycastle-pg BuildRequires: fdupes BuildRequires: java-devel >= 1.8 -BuildRequires: javapackages-local +BuildRequires: javapackages-local >= 6 BuildRequires: jsch BuildRequires: oro BuildConflicts: java-devel >= 14 @@ -75,11 +76,10 @@ JavaDoc documentation for %{name} %prep %setup -q %patch0 -p1 +%patch1 -p1 cp %{SOURCE2} pom.xml -%pom_remove_parent . - %pom_remove_dep :jsch.agentproxy %if %{without httpclient} @@ -151,7 +151,7 @@ install -p -m644 build/artifact/jars/ivy.jar %{buildroot}%{_javadir}/ivy.jar ln -sf ../ivy.jar %{buildroot}%{_javadir}/%{name}/ivy.jar install -d -m 0755 %{buildroot}/%{_mavenpomdir}/ -install -m 0644 pom.xml %{buildroot}/%{_mavenpomdir}/JPP-ivy.pom +%mvn_install_pom pom.xml %{buildroot}/%{_mavenpomdir}/JPP-ivy.pom # Maven depmap %add_maven_depmap JPP-ivy.pom ivy.jar