Skip to content

Commit ab1f0a9

Browse files
committed
rename a few parameters and internal method names
1 parent 5913227 commit ab1f0a9

File tree

6 files changed

+27
-16
lines changed

6 files changed

+27
-16
lines changed

Diff for: src/main/java/org/codehaus/plexus/archiver/AbstractArchiver.java

+12-4
Original file line numberDiff line numberDiff line change
@@ -1259,10 +1259,10 @@ public String getOverrideGroupName()
12591259
}
12601260

12611261
@Override
1262-
public void configureReproducible( Date outputTimestamp )
1262+
public void configureReproducible( Date lastModifiedDate )
12631263
{
12641264
// 1. force last modified date
1265-
setLastModifiedDate( convertOutputTimestamp( outputTimestamp ) );
1265+
setLastModifiedDate( normalizeLastModifiedDate( lastModifiedDate ) );
12661266

12671267
// 2. sort filenames in each directory when scanning filesystem
12681268
setFilenameComparator( new Comparator<String>()
@@ -1286,8 +1286,16 @@ public int compare( String s1, String s2 )
12861286
setOverrideGroupName( "root" );
12871287
}
12881288

1289-
protected Date convertOutputTimestamp( Date outputTimestamp )
1289+
/**
1290+
* Normalize last modified time value to get reproducible archive entries, based on
1291+
* archive binary format (tar uses UTC timestamp but zip uses local time then requires
1292+
* tweaks to make the value reproducible whatever the current timezone is).
1293+
*
1294+
* @param lastModifiedDate
1295+
* @return
1296+
*/
1297+
protected Date normalizeLastModifiedDate( Date lastModifiedDate )
12901298
{
1291-
return outputTimestamp;
1299+
return lastModifiedDate;
12921300
}
12931301
}

Diff for: src/main/java/org/codehaus/plexus/archiver/Archiver.java

+9-6
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,6 @@ ResourceIterator getResources()
423423
void setFilenameComparator( Comparator<String> filenameComparator );
424424

425425
/**
426-
<<<<<<< reproducible
427426
* @since 4.2.0
428427
*/
429428
void setOverrideUid( int uid );
@@ -464,12 +463,16 @@ ResourceIterator getResources()
464463
String getOverrideGroupName();
465464

466465
/**
467-
* Configure the archiver to get reproducible archives (see <a href="https://reproducible-builds.org/>Reproducible
468-
* Builds</a>). This will require reproducible archive entries order, defined entries timestamp and reproducible
469-
* entries Unix mode.
466+
* Configure the archiver to create archives in a reproducible way (see <a
467+
* href="https://reproducible-builds.org/>Reproducible Builds</a>). This will configure:
468+
* <ul>
469+
* <li>reproducible archive entries order,</li>
470+
* <li>defined entries timestamp</li>
471+
* <li>and reproducible entries Unix mode.</li>
472+
* <ul>
470473
*
471-
* @param outputTimestamp the date to use for archive entries last modified time
474+
* @param lastModifiedDate the date to use for archive entries last modified time
472475
* @since 4.2.0
473476
*/
474-
void configureReproducible( Date outputTimestamp );
477+
void configureReproducible( Date lastModifiedDate );
475478
}

Diff for: src/main/java/org/codehaus/plexus/archiver/diags/DelgatingArchiver.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -400,9 +400,9 @@ public String getOverrideGroupName()
400400
}
401401

402402
@Override
403-
public void configureReproducible( Date outputTimestamp )
403+
public void configureReproducible( Date lastModifiedDate )
404404
{
405-
target.configureReproducible( outputTimestamp );
405+
target.configureReproducible( lastModifiedDate );
406406
}
407407

408408
}

Diff for: src/main/java/org/codehaus/plexus/archiver/diags/NoOpArchiver.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ public String getOverrideGroupName()
415415
}
416416

417417
@Override
418-
public void configureReproducible( Date outputTimestamp )
418+
public void configureReproducible( Date lastModifiedDate )
419419
{
420420

421421
}

Diff for: src/main/java/org/codehaus/plexus/archiver/diags/TrackingArchiver.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,7 @@ public String getOverrideGroupName()
470470
}
471471

472472
@Override
473-
public void configureReproducible( Date outputTimestamp )
473+
public void configureReproducible( Date lastModifiedDate )
474474
{
475475
}
476476
}

Diff for: src/main/java/org/codehaus/plexus/archiver/zip/AbstractZipArchiver.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -836,12 +836,12 @@ protected String getArchiveType()
836836
}
837837

838838
@Override
839-
protected Date convertOutputTimestamp( Date outputTimestamp )
839+
protected Date normalizeLastModifiedDate( Date lastModifiedDate )
840840
{
841841
// timestamp of zip entries at zip storage level ignores timezone: managed in ZipEntry.setTime,
842842
// that turns javaToDosTime: need to revert the operation here to get reproducible
843843
// zip entry time
844-
return new Date( dosToJavaTime( outputTimestamp.getTime() ) );
844+
return new Date( dosToJavaTime( lastModifiedDate.getTime() ) );
845845
}
846846

847847
/**

0 commit comments

Comments
 (0)