Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Leap:15.6:Update
xmvn-parent
0002-Make-metadata-UUIDs-reproducible-if-SOURCE...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0002-Make-metadata-UUIDs-reproducible-if-SOURCE_DATE_EPOC.patch of Package xmvn-parent
From 2419d17ea3290e4d25f5629dbeac4df460ec8376 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fridrich=20=C5=A0trba?= <fridrich.strba@bluewin.ch> Date: Wed, 20 Sep 2023 18:46:28 +0200 Subject: [PATCH 2/3] Make metadata UUIDs reproducible if SOURCE_DATE_EPOCH is set --- .../xmvn/tools/install/JavaPackage.java | 14 ++++++++++++-- .../install/impl/DefaultArtifactInstaller.java | 7 ++++++- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/xmvn-tools/xmvn-install/src/main/java/org/fedoraproject/xmvn/tools/install/JavaPackage.java b/xmvn-tools/xmvn-install/src/main/java/org/fedoraproject/xmvn/tools/install/JavaPackage.java index 9835c5b8..0542c838 100644 --- a/xmvn-tools/xmvn-install/src/main/java/org/fedoraproject/xmvn/tools/install/JavaPackage.java +++ b/xmvn-tools/xmvn-install/src/main/java/org/fedoraproject/xmvn/tools/install/JavaPackage.java @@ -58,7 +58,12 @@ public class JavaPackage super( id ); this.basePackageName = basePackageName; this.metadataDir = metadataDir; - metadata.setUuid( UUID.randomUUID().toString() ); + UUID guid = UUID.randomUUID(); + if ( System.getenv( "SOURCE_DATE_EPOCH" ) != null ) + { + guid = UUID.nameUUIDFromBytes( ( System.getenv( "SOURCE_DATE_EPOCH" ) + id + basePackageName + metadataDir.toString() ).getBytes() ); + } + metadata.setUuid( guid.toString() ); } /** @@ -71,11 +76,16 @@ public class JavaPackage private PackageMetadata getSplitMetadata( String namespace ) { PackageMetadata splitMetadata = new PackageMetadata(); - splitMetadata.setUuid( UUID.randomUUID().toString() ); splitMetadata.setProperties( metadata.getProperties() ); List<ArtifactMetadata> allArtifacts = metadata.getArtifacts(); List<ArtifactMetadata> splitArtifacts = allArtifacts.stream().filter( a -> namespace.equals( a.getNamespace() ) ).collect( Collectors.toList() ); + UUID guid = UUID.randomUUID(); + if ( System.getenv( "SOURCE_DATE_EPOCH" ) != null ) + { + guid = UUID.nameUUIDFromBytes( ( System.getenv( "SOURCE_DATE_EPOCH" ) + splitArtifacts.toString() ).getBytes() ); + } + splitMetadata.setUuid( guid.toString() ); splitMetadata.setArtifacts( splitArtifacts ); splitMetadata.setSkippedArtifacts( metadata.getSkippedArtifacts() ); return splitMetadata; diff --git a/xmvn-tools/xmvn-install/src/main/java/org/fedoraproject/xmvn/tools/install/impl/DefaultArtifactInstaller.java b/xmvn-tools/xmvn-install/src/main/java/org/fedoraproject/xmvn/tools/install/impl/DefaultArtifactInstaller.java index 0c83e664..c3fa1bdf 100644 --- a/xmvn-tools/xmvn-install/src/main/java/org/fedoraproject/xmvn/tools/install/impl/DefaultArtifactInstaller.java +++ b/xmvn-tools/xmvn-install/src/main/java/org/fedoraproject/xmvn/tools/install/impl/DefaultArtifactInstaller.java @@ -185,7 +185,12 @@ class DefaultArtifactInstaller am.setNamespace( repo.getNamespace() ); // UUID - am.setUuid( UUID.randomUUID().toString() ); + UUID guid = UUID.randomUUID(); + if ( System.getenv( "SOURCE_DATE_EPOCH" ) != null ) + { + guid = UUID.nameUUIDFromBytes( ( System.getenv( "SOURCE_DATE_EPOCH" ) + repo.getNamespace() + artifact.toString() ).getBytes() ); + } + am.setUuid( guid.toString() ); // Compat version for ( String version : rule.getVersions() ) -- 2.45.2
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor