You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by hb...@apache.org on 2019/09/01 18:10:11 UTC

[maven-source-plugin] 01/01: force Unix mode value to avoid depending on local umask

This is an automated email from the ASF dual-hosted git repository.

hboutemy pushed a commit to branch MSOURCES-120
in repository https://gitbox.apache.org/repos/asf/maven-source-plugin.git

commit 0c01de518046edfe79b4bd39c3ad11d390dfdb95
Author: Hervé Boutemy <hb...@apache.org>
AuthorDate: Sun Sep 1 20:06:55 2019 +0200

    force Unix mode value to avoid depending on local umask
---
 src/it/reproducible/verify.groovy                                | 2 +-
 .../org/apache/maven/plugins/source/AbstractSourceJarMojo.java   | 9 ++++++---
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/src/it/reproducible/verify.groovy b/src/it/reproducible/verify.groovy
index 69b5b1e..46e4124 100644
--- a/src/it/reproducible/verify.groovy
+++ b/src/it/reproducible/verify.groovy
@@ -47,6 +47,6 @@ zipFile.close();
 
 String buf = r.toString()
 
-String expectedSha1 = System.properties['os.name'].toLowerCase().contains( 'windows' ) ? 'c1a0f57e19f6f400da66bee06084a4bdb0d2fc00' : 'c6d46509dffb7ef86212a6089c0a239dccb58b71'
+String expectedSha1 = System.properties['os.name'].toLowerCase().contains( 'windows' ) ? 'c1a0f57e19f6f400da66bee06084a4bdb0d2fc00' : '7bd062f9b45afb7423f3c004c8080ebad4e98754'
 
 assert buf.startsWith( "reproducible-1.0-sources.jar sha1 = $expectedSha1" )
diff --git a/src/main/java/org/apache/maven/plugins/source/AbstractSourceJarMojo.java b/src/main/java/org/apache/maven/plugins/source/AbstractSourceJarMojo.java
index 255be6a..0fa2f79 100644
--- a/src/main/java/org/apache/maven/plugins/source/AbstractSourceJarMojo.java
+++ b/src/main/java/org/apache/maven/plugins/source/AbstractSourceJarMojo.java
@@ -283,8 +283,9 @@ public abstract class AbstractSourceJarMojo
         
         if ( sourceDateEpoch != 0 )
         {
-            archiver.getArchiver().setLastModifiedDate( new Date( 1000L * sourceDateEpoch ) );
-            archiver.getArchiver().setFilenameComparator( new Comparator<String>()
+            JarArchiver j = archiver.getArchiver();
+            j.setLastModifiedDate( new Date( 1000L * sourceDateEpoch ) );
+            j.setFilenameComparator( new Comparator<String>()
             {
                 @Override
                 public int compare( String s1, String s2 )
@@ -292,7 +293,9 @@ public abstract class AbstractSourceJarMojo
                     return s1.compareTo( s2 );
                 }
             } );
-            archiver.getArchiver().setIgnorePermissions( true );
+            j.setFileMode( Archiver.DEFAULT_FILE_MODE ); // notice: overrides execute bit on Unix
+                                                         // (that is already ignored on Windows)
+            j.setDirectoryMode( Archiver.DEFAULT_DIR_MODE );
         }
 
         for ( MavenProject pItem : theProjects )