Control: 765303 + patch

Tested quickly on the icewm package, seems to do the job.

Subject: Collected Debian patches for strip-nondeterminism
Author: Andrew Ayer <a...@andrewayer.name>

Since I am also upstream for this package, there will normally not be
any patches to apply to the upstream source.  However, occasionally
I'll pull up specific upstream commits prior to making an upstream
release.  When this happens, this patch will collect all of those
modifications.

I use Git to maintain both the upstream source and the Debian
packages, and generating individual patches rather than using git
cherry-pick takes extra work for no gain.  Since I'm also upstream,
there's no need to separate the patches for later upstream submission.
Hence, I take this approach with a unified patch when it's necessary.

For full commit history and separated commits, see the upstream Git
repository.
--- strip-nondeterminism-0.014.orig/lib/File/StripNondeterminism.pm
+++ strip-nondeterminism-0.014/lib/File/StripNondeterminism.pm
@@ -29,6 +29,7 @@ use File::StripNondeterminism::handlers:
 use File::StripNondeterminism::handlers::png;
 use File::StripNondeterminism::handlers::javaproperties;
 use File::StripNondeterminism::handlers::zip;
+use File::StripNondeterminism::handlers::gmo;
 
 our($VERSION, $canonical_time);
 
@@ -81,6 +82,10 @@ sub get_normalizer_for_file {
        if (m/\.(zip|pk3|whl|xpi)$/ && _get_file_type($_) =~ m/Zip archive 
data/) {
                return \&File::StripNondeterminism::handlers::zip::normalize;
        }
+       # gmo
+       if (m/\.(mo|gmo)$/ && _get_file_type($_) =~ m/GNU message catalog/) {
+               return \&File::StripNondeterminism::handlers::gmo::normalize;
+       }
        return undef;
 }
 
@@ -94,6 +99,7 @@ sub get_normalizer_by_name {
        return \&File::StripNondeterminism::handlers::png::normalize if $_ eq 
'png';
        return \&File::StripNondeterminism::handlers::javaproperties::normalize 
if $_ eq 'javaproperties';
        return \&File::StripNondeterminism::handlers::zip::normalize if $_ eq 
'zip';
+       return \&File::StripNondeterminism::handlers::gmo::normalize if $_ eq 
'mo';
        return undef;
 }
 
--- /dev/null
+++ strip-nondeterminism-0.014/lib/File/StripNondeterminism/handlers/gmo.pm
@@ -0,0 +1,54 @@
+# Copyright © 2015 Eduard Bloch <bl...@debian.org>
+# All rights reserved.
+# 
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in the
+#    documentation and/or other materials provided with the distribution.
+# 
+# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+
+package File::StripNondeterminism::handlers::gmo;
+use strict;
+use warnings;
+
+sub normalize
+{
+   my $filename = shift;
+   my $headername = "POT-Creation-Date:";
+   my $fd;
+   open($fd, "+<", $filename) or die("error while opening $filename: $!");
+   my $location=0;
+   while(<$fd>)
+   {
+      my $pos = index($_, $headername);
+      if($pos < 0)
+      {
+         $location += length($_);
+         next;
+      }
+      /$headername(\d|\ |-|:|\+)*$/ or last; # invalid date format?
+      my $striplen = (length($_) - $pos - length($headername) - 1);
+      seek($fd, ($location + $pos + length($headername)), 0);
+      syswrite($fd, " "x$striplen);
+   }
+   close($fd) or die("Error rewritting $filename: $!");
+
+   return 1;
+}
+
+1;
_______________________________________________
Reproducible-builds mailing list
Reproducible-builds@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/reproducible-builds

Reply via email to