[Git][reproducible-builds/strip-nondeterminism][master] 3 commits: Drop .ar handler; binutils is reproducible. (Closes: #781262, #843811)
Chris Lamb
gitlab at salsa.debian.org
Wed Dec 19 13:24:24 CET 2018
Chris Lamb pushed to branch master at Reproducible Builds / strip-nondeterminism
Commits:
366d60c9 by Chris Lamb at 2018-12-06T16:58:13Z
Drop .ar handler; binutils is reproducible. (Closes: #781262, #843811)
- - - - -
4e2a8d54 by Chris Lamb at 2018-12-06T17:06:38Z
Remove javaproperties handler after Emmanuel Bourg's patch was released in openjdk-11 11.0.1+13-3. (Closes: #914289)
- - - - -
f1faf536 by Chris Lamb at 2018-12-06T17:08:41Z
Release version 1.0.0
- - - - -
13 changed files:
- lib/File/StripNondeterminism.pm
- − lib/File/StripNondeterminism/handlers/ar.pm
- lib/File/StripNondeterminism/handlers/jar.pm
- − lib/File/StripNondeterminism/handlers/javaproperties.pm
- − t/fixtures/ar/one.a.in
- − t/fixtures/ar/one.a.out
- − t/fixtures/javaproperties/configuration.properties.in
- − t/fixtures/javaproperties/configuration.properties.out
- − t/fixtures/javaproperties/pom.properties.in
- − t/fixtures/javaproperties/pom.properties.out
- − t/fixtures/javaproperties/version.properties.in
- − t/fixtures/javaproperties/version.properties.out
- − t/javaproperties.t
Changes:
=====================================
lib/File/StripNondeterminism.pm
=====================================
@@ -25,7 +25,7 @@ use POSIX qw(tzset);
our($VERSION, $canonical_time, $clamp_time);
-$VERSION = '0.45.0'; # <https://semver.org/>
+$VERSION = '1.0.0'; # <https://semver.org/>
sub init() {
$ENV{'TZ'} = 'UTC';
@@ -47,10 +47,6 @@ sub get_normalizer_for_file($) {
return undef if -d $_; # Skip directories
- # ar
- if (m/\.a$/ && _get_file_type($_) =~ m/ar archive/) {
- return _handler('ar');
- }
# cpio
if (m/\.cpio$/ && _get_file_type($_) =~ m/cpio archive/) {
return _handler('cpio');
@@ -93,15 +89,6 @@ sub get_normalizer_for_file($) {
if (m/\.png$/ && _get_file_type($_) =~ m/PNG image data/) {
return _handler('png');
}
- # pom.properties, version.properties
- if (m/\.properties$/) {
- # Loading the handler forces the load of the javaproperties package as well
- my $handler = _handler('javaproperties');
- return $handler
- if
- File::StripNondeterminism::handlers::javaproperties::is_java_properties_file(
- $_);
- }
# zip
if (m/\.(zip|pk3|epub|whl|xpi|htb|zhfst|par)$/
&& _get_file_type($_) =~ m/Zip archive data|EPUB document/) {
@@ -112,7 +99,6 @@ sub get_normalizer_for_file($) {
our %HANDLER_CACHE;
our %KNOWN_HANDLERS = (
- ar => 1,
bflt => 1,
cpio => 1,
gettext => 1,
=====================================
lib/File/StripNondeterminism/handlers/ar.pm deleted
=====================================
@@ -1,98 +0,0 @@
-# Copyright © 2014 Jérémy Bobbio <lunar at debian.org>
-# Copyright © 2014 Niko Tyni <ntyni at debian.org>
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-#
-# Some code borrowed from ArFile
-# Copyright (C) 2007 Stefano Zacchiroli <zack at debian.org>
-# Copyright (C) 2007 Filippo Giunchedi <filippo at debian.org>
-
-package File::StripNondeterminism::handlers::ar;
-
-use strict;
-use warnings;
-
-use Fcntl q/SEEK_SET/;
-
-use File::StripNondeterminism;
-
-sub normalize {
- my ($file) = @_;
-
- my $GLOBAL_HEADER = "!<arch>\n";
- my $GLOBAL_HEADER_LENGTH = length $GLOBAL_HEADER;
-
- my $FILE_HEADER_LENGTH = 60;
- my $FILE_MAGIC = "`\n";
-
- my $buf;
-
- open(my $fh, '+<', $file)
- or die("failed to open $file for read+write: $!");
-
- read $fh, $buf, $GLOBAL_HEADER_LENGTH;
- return 0 if $buf ne $GLOBAL_HEADER;
-
- while (1) {
- my $file_header_start = tell $fh;
- my $count = read $fh, $buf, $FILE_HEADER_LENGTH;
- die "reading $file failed: $!" if !defined $count;
- last if $count == 0;
-
- # http://en.wikipedia.org/wiki/Ar_(Unix)
- #from to Name Format
- #0 15 File name ASCII
- #16 27 File modification date Decimal
- #28 33 Owner ID Decimal
- #34 39 Group ID Decimal
- #40 47 File mode Octal
- #48 57 File size in bytes Decimal
- #58 59 File magic \140\012
-
- die "Incorrect header length"
- if length $buf != $FILE_HEADER_LENGTH;
- die "Incorrect file magic"
- if substr($buf, 58, length($FILE_MAGIC)) ne $FILE_MAGIC;
-
- my $file_mode = oct(substr($buf, 40, 8));
- my $file_size = substr($buf, 48, 10);
-
- die "Incorrect file size"
- if $file_size < 1;
-
- seek $fh, $file_header_start + 16, SEEK_SET;
-
- # mtime
- syswrite $fh,
- sprintf("%-12d", $File::StripNondeterminism::canonical_time // 0);
- # owner
- syswrite $fh, sprintf("%-6d", 0);
- # group
- syswrite $fh, sprintf("%-6d", 0);
- # file mode
- syswrite $fh,
- sprintf("%-8o", ($file_mode & oct(100)) ? oct(755) : oct(644));
-
- # move to next member
- my $padding = $file_size % 2;
- seek $fh,
- $file_header_start + $FILE_HEADER_LENGTH + $file_size + $padding,
- SEEK_SET;
-
- }
-
- return 1;
-}
-
-1;
=====================================
lib/File/StripNondeterminism/handlers/jar.pm
=====================================
@@ -27,7 +27,6 @@ use Archive::Zip;
use File::Basename;
use File::StripNondeterminism::handlers::zip;
use File::StripNondeterminism::handlers::javadoc;
-use File::StripNondeterminism::handlers::javaproperties;
use File::Temp;
sub _jar_filename_cmp($$) {
@@ -82,16 +81,6 @@ sub _jar_normalize_member($$) {
} elsif ($member->fileName() eq 'META-INF/MANIFEST.MF') {
File::StripNondeterminism::handlers::zip::normalize_member($member,
\&_jar_normalize_manifest);
- } elsif (
- $member->fileName() =~ /(pom|version)\.properties$/
- &&File::StripNondeterminism::handlers::javaproperties::is_java_properties_header(
- File::StripNondeterminism::handlers::zip::peek_member(
- $member, 1024
- ))
- ) {
- # maven header should be within first 1kb of file
- File::StripNondeterminism::handlers::zip::normalize_member($member,
- \&File::StripNondeterminism::handlers::javaproperties::normalize);
} elsif ($member->fileName() =~ /\.clj$/) {
# Clojure considers the .class file to be stale if it shares
# the same timestamp of the .clj. We thus adjust the timestamps
=====================================
lib/File/StripNondeterminism/handlers/javaproperties.pm deleted
=====================================
@@ -1,85 +0,0 @@
-#
-# Copyright 2014 Chris West (Faux)
-# Copyright 2016 Chris Lamb <lamby at debian.org>
-#
-# This file is part of strip-nondeterminism.
-#
-# strip-nondeterminism is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# strip-nondeterminism is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with strip-nondeterminism. If not, see <http://www.gnu.org/licenses/>.
-#
-package File::StripNondeterminism::handlers::javaproperties;
-
-use strict;
-use warnings;
-
-use File::StripNondeterminism::Common qw(copy_data);
-use File::Temp;
-use File::Basename;
-
-sub is_java_properties_header($) {
- my ($contents) = @_;
- return $contents
- =~ /#Generated by( Apache)? Maven|#Build Number for ANT|#Generated by org.apache.felix.bundleplugin|#POM properties|#.* runtime configuration/;
-}
-
-sub is_java_properties_file($) {
- my ($filename) = @_;
-
- # If this is a java properties file, '#Generated by Maven', '#Build
- # Number for ANT', or other similar build-tool comment headers should
- # appear in first 1kb
- my $fh;
- my $str;
- return
- open($fh, '<', $filename)
- && read($fh, $str, 1024)
- && is_java_properties_header($str);
-}
-
-sub normalize {
- my ($filename) = @_;
-
- open(my $fh, '<', $filename)
- or die "Unable to open $filename for reading: $!";
- my $tempfile = File::Temp->new(DIR => dirname($filename));
-
- # Strip the generation date comment, which contains a timestamp. It
- # should appear within first 10 lines.
- while (defined(my $line = <$fh>) && $. <= 10) {
- # Yes, there really is no comma here
- if ($line
- =~ /^#\w{3} \w{3} \d{2} \d{2}:\d{2}:\d{2} \w{3,4}([+-]\d{2}:\d{2})? \d{4}\s*$/
- ) {
- $line = '';
- print $tempfile $line;
-
- # Copy through rest of file
- my $bytes_read;
- my $buf;
- while ($bytes_read = read($fh, $buf, 4096)) {
- print $tempfile $buf;
- }
- defined($bytes_read) or die "$filename: read failed: $!";
-
- $tempfile->close;
- copy_data($tempfile->filename, $filename)
- or die "$filename: unable to overwrite: copy_data: $!";
- return 1;
- }
- print $tempfile $line;
- }
-
- return 0;
-}
-
-1;
=====================================
t/fixtures/ar/one.a.in deleted
=====================================
@@ -1,32 +0,0 @@
-!<arch>
-afile/ 1425249797 501 501 100600 1136 `
-cerebral atrophy, n:
- The phenomena which occurs as brain cells become weak and sick, and
-impair the brain's performance. An abundance of these "bad" cells can cause
-symptoms related to senility, apathy, depression, and overall poor academic
-performance. A certain small number of brain cells will deteriorate due to
-everday activity, but large amounts are weakened by intense mental effort
-and the assimilation of difficult concepts. Many college students become
-victims of this dread disorder due to poor habits such as overstudying.
-
-cerebral darwinism, n:
- The theory that the effects of cerebral atrophy can be reversed
-through the purging action of heavy alcohol consumption. Large amounts of
-alcohol cause many brain cells to perish due to oxygen deprivation. Through
-the process of natural selection, the weak and sick brain cells will die
-first, leaving only the healthy cells. This wonderful process leaves the
-imbiber with a healthier, more vibrant brain, and increases mental capacity.
-Thus, the devastating effects of cerebral atrophy are reversed, and academic
-performance actually increases beyond previous levels.
-bfile/ 1425249797 501 501 100644 80 `
-take forceful action:
- Do something that should have been done a long time ago.
-cfile/ 1425249797 501 501 100775 39 `
-Don't Worry, Be Happy.
- -- Meher Baba
-
-dfile/ 1425249797 501 501 100664 256 `
-"Well, well, well! Well if it isn't fat stinking billy goat Billy Boy in
-poison! How art thou, thou globby bottle of cheap stinking chip oil? Come
-and get one in the yarbles, if ya have any yarble, ya eunuch jelly thou!"
- -- Alex in "Clockwork Orange"
=====================================
t/fixtures/ar/one.a.out deleted
=====================================
@@ -1,32 +0,0 @@
-!<arch>
-afile/ 1423159771 0 0 644 1136 `
-cerebral atrophy, n:
- The phenomena which occurs as brain cells become weak and sick, and
-impair the brain's performance. An abundance of these "bad" cells can cause
-symptoms related to senility, apathy, depression, and overall poor academic
-performance. A certain small number of brain cells will deteriorate due to
-everday activity, but large amounts are weakened by intense mental effort
-and the assimilation of difficult concepts. Many college students become
-victims of this dread disorder due to poor habits such as overstudying.
-
-cerebral darwinism, n:
- The theory that the effects of cerebral atrophy can be reversed
-through the purging action of heavy alcohol consumption. Large amounts of
-alcohol cause many brain cells to perish due to oxygen deprivation. Through
-the process of natural selection, the weak and sick brain cells will die
-first, leaving only the healthy cells. This wonderful process leaves the
-imbiber with a healthier, more vibrant brain, and increases mental capacity.
-Thus, the devastating effects of cerebral atrophy are reversed, and academic
-performance actually increases beyond previous levels.
-bfile/ 1423159771 0 0 644 80 `
-take forceful action:
- Do something that should have been done a long time ago.
-cfile/ 1423159771 0 0 755 39 `
-Don't Worry, Be Happy.
- -- Meher Baba
-
-dfile/ 1423159771 0 0 644 256 `
-"Well, well, well! Well if it isn't fat stinking billy goat Billy Boy in
-poison! How art thou, thou globby bottle of cheap stinking chip oil? Come
-and get one in the yarbles, if ya have any yarble, ya eunuch jelly thou!"
- -- Alex in "Clockwork Orange"
=====================================
t/fixtures/javaproperties/configuration.properties.in deleted
=====================================
@@ -1,4 +0,0 @@
-#DITA-OT runtime configuration
-#Tue May 22 16:35:53 UTC 2012
-print_transtypes=pdf2;pdf;legacypdf;odt
-supported_image_extensions=.bmp;.svg;.png;.tif;.jpg;.gif;.jpeg;.tiff;.eps
=====================================
t/fixtures/javaproperties/configuration.properties.out deleted
=====================================
@@ -1,3 +0,0 @@
-#DITA-OT runtime configuration
-print_transtypes=pdf2;pdf;legacypdf;odt
-supported_image_extensions=.bmp;.svg;.png;.tif;.jpg;.gif;.jpeg;.tiff;.eps
=====================================
t/fixtures/javaproperties/pom.properties.in deleted
=====================================
@@ -1,3 +0,0 @@
-#Generated by Maven
-#Mon Oct 27 09:12:51 UTC 2014
-version=2.4
=====================================
t/fixtures/javaproperties/pom.properties.out deleted
=====================================
@@ -1,2 +0,0 @@
-#Generated by Maven
-version=2.4
=====================================
t/fixtures/javaproperties/version.properties.in deleted
=====================================
@@ -1,3 +0,0 @@
-#Build Number for ANT. Do not edit!
-#Wed Feb 04 03:46:03 UTC 2015
-build.number=125
=====================================
t/fixtures/javaproperties/version.properties.out deleted
=====================================
@@ -1,2 +0,0 @@
-#Build Number for ANT. Do not edit!
-build.number=125
=====================================
t/javaproperties.t deleted
=====================================
@@ -1,72 +0,0 @@
-#!perl
-
-#
-# Copyright 2014 Chris West (Faux)
-# Copyright 2015 Andrew Ayer
-#
-# This file is part of strip-nondeterminism.
-#
-# strip-nondeterminism is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# strip-nondeterminism is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with strip-nondeterminism. If not, see <http://www.gnu.org/licenses/>.
-#
-
-use Archive::Zip qw( :ERROR_CODES :CONSTANTS );
-use File::Temp 'tempdir';
-use Test::More tests => 2;
-use File::StripNondeterminism;
-use strict;
-use warnings;
-
-File::StripNondeterminism::init();
-
-my $dir = tempdir( CLEANUP => 1 );
-my $path;
-my $fh;
-my $normalizer;
-
-sub normalise {
- my $path = shift(@_);
-
- $normalizer = File::StripNondeterminism::get_normalizer_for_file($path);
- isnt(undef, $normalizer);
- $normalizer->($path);
-}
-#
-# felix bundle pom.properties
-#
-
-$path = "$dir/foo.jar";
-my $zip = Archive::Zip->new();
-$zip->addString(<<'ORIGINAL'
-#Generated by org.apache.felix.bundleplugin
-#Mon Aug 10 07:12:44 GMT-12:00 2015
-version=1.5
-ORIGINAL
-, 'pom.properties');
-
-unless ($zip->writeToFileNamed($path) == AZ_OK) {
- die("couldn't write test zip");
-}
-
-normalise($path);
-
-my $afterzip = Archive::Zip->new();
-unless ( $afterzip->read($path) == AZ_OK ) {
- die("couldn't read test zip");
-}
-
-is($afterzip->memberNamed('pom.properties')->contents(), <<'EXPECTED'
-#Generated by org.apache.felix.bundleplugin
-version=1.5
-EXPECTED
-);
View it on GitLab: https://salsa.debian.org/reproducible-builds/strip-nondeterminism/compare/43d93c718f205310c647f03ab3b89e768e03977e...f1faf53683983de95a4881563d97d891d798b1c6
--
View it on GitLab: https://salsa.debian.org/reproducible-builds/strip-nondeterminism/compare/43d93c718f205310c647f03ab3b89e768e03977e...f1faf53683983de95a4881563d97d891d798b1c6
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.reproducible-builds.org/pipermail/rb-commits/attachments/20181219/ca78fa4c/attachment.html>
More information about the rb-commits
mailing list