Source: oxygen-icons
Version: 4:14.12.2-1
Severity: wishlist
Tags: patch
User: reproducible-bui...@lists.alioth.debian.org
Usertags: timestamps fileordering

Hi!

While working on the “reproducible builds” effort [1], we have noticed
that oxygen-icons could not be built reproducibly.

The attached patch removes the timestamps from the the generated png icons.
oxygen-icons uses the script symlink_duplicates.sh to find duplicate
files (with fdupes) and create symlinks before packing the files. The
order in which duplicates are found can differ between runs making the
symlinks undeterministic. The provided patch parses the output of fdupes
to sort the groups of duplicated files, making the output deterministic.

Once applied, oxygen-icons can be built reproducibly in our current
experimental framework.

 [1]: https://wiki.debian.org/ReproducibleBuilds

-- 
Dhole
diff -Nru oxygen-icons-14.12.2/debian/changelog 
oxygen-icons-14.12.2/debian/changelog
--- oxygen-icons-14.12.2/debian/changelog       2015-02-16 12:01:41.000000000 
+0100
+++ oxygen-icons-14.12.2/debian/changelog       2015-06-26 13:22:21.000000000 
+0200
@@ -1,3 +1,12 @@
+oxygen-icons (4:14.12.2-2) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Remove timestamps from png to make package build reproducibly 
+  * symlink_duplicates.sh now symlinks files in a reproducible way (by sorting
+    the results of fdupes)
+
+ -- Dhole <dh...@openmailbox.org>  Fri, 26 Jun 2015 13:21:16 +0200
+
 oxygen-icons (4:14.12.2-1) experimental; urgency=medium
 
   * Prepare Debian release.
diff -Nru oxygen-icons-14.12.2/debian/patches/remove_png_timestamps 
oxygen-icons-14.12.2/debian/patches/remove_png_timestamps
--- oxygen-icons-14.12.2/debian/patches/remove_png_timestamps   1970-01-01 
01:00:00.000000000 +0100
+++ oxygen-icons-14.12.2/debian/patches/remove_png_timestamps   2015-06-25 
18:22:02.000000000 +0200
@@ -0,0 +1,25 @@
+Description: Remove png timestamps
+ .
+ oxygen-icons (4:14.12.2-1.1) UNRELEASED; urgency=medium
+ .
+   * Non-maintainer upload.
+   * Remove timestamps from png to make package build reproducibly
+Author: Dhole <dh...@openmailbox.org>
+
+---
+
+--- oxygen-icons-14.12.2.orig/scalable/export_pngs.sh
++++ oxygen-icons-14.12.2/scalable/export_pngs.sh
+@@ -31,10 +31,10 @@ for size in $sizes; do
+         inkscape --without-gui 
--export-png="../"${size}x${size}"/"$iconDir"/"$iconPngName --export-dpi=72 
--export-background-opacity=0 --export-width=$size --export-height=$size 
$smallicon > /dev/null
+      
+      else
+-        convert -filter Sinc -resize ${size}x${size} $iconPngName 
"../"${size}x${size}"/"$iconDir"/"$iconPngName
++        convert -filter Sinc -resize ${size}x${size} $iconPngName +set 
date:create +set date:modify -define png:exclude-chunk=time 
"../"${size}x${size}"/"$iconDir"/"$iconPngName
+      fi
+   else
+-     convert -filter Sinc -resize ${size}x${size} $iconPngName 
"../"${size}x${size}"/"$iconDir"/"$iconPngName
++     convert -filter Sinc -resize ${size}x${size} $iconPngName +set 
date:create +set date:modify -define png:exclude-chunk=time 
"../"${size}x${size}"/"$iconDir"/"$iconPngName
+   fi
+   echo "Converted the icon named "$( echo $iconName | cut -d . -f -1 )" to 
size: " $size
+ done
diff -Nru oxygen-icons-14.12.2/debian/patches/series 
oxygen-icons-14.12.2/debian/patches/series
--- oxygen-icons-14.12.2/debian/patches/series  1970-01-01 01:00:00.000000000 
+0100
+++ oxygen-icons-14.12.2/debian/patches/series  2015-06-25 18:21:42.000000000 
+0200
@@ -0,0 +1 @@
+remove_png_timestamps
diff -Nru oxygen-icons-14.12.2/debian/rules oxygen-icons-14.12.2/debian/rules
--- oxygen-icons-14.12.2/debian/rules   2015-02-16 12:01:41.000000000 +0100
+++ oxygen-icons-14.12.2/debian/rules   2015-06-25 18:15:39.000000000 +0200
@@ -7,7 +7,8 @@
 
 override_dh_auto_build:
        convert 64x64/mimetypes/x-office-document.png \
-           -scale "22x22" 22x22/mimetypes/x-office-document.png
+               -scale "22x22" +set date:create +set date:modify -define 
png:exclude-chunk=time \
+               22x22/mimetypes/x-office-document.png
        $(overridden_command)
 
 override_dh_install:
diff -Nru oxygen-icons-14.12.2/debian/symlink_duplicates.sh 
oxygen-icons-14.12.2/debian/symlink_duplicates.sh
--- oxygen-icons-14.12.2/debian/symlink_duplicates.sh   2015-02-16 
12:01:41.000000000 +0100
+++ oxygen-icons-14.12.2/debian/symlink_duplicates.sh   2015-06-26 
13:20:30.000000000 +0200
@@ -5,13 +5,27 @@
 # $1 Root directory for absolute path calculation
 # $2 Directory for searching duplicate files
 
+# Call fdupes and sort the filenames in the groups of duplicates in the output
+function fdupes_sorted {
+       duplicates=""
+       fdupes ${*:2} | while read line; do
+               if [ -z "$line" ]; then
+                       echo -n "$duplicates" | sort
+                       echo ""
+                       duplicates=""
+               else
+                       duplicates=$duplicates$line$'\n'
+               fi
+       done
+}
+
 echo "Symlinking duplicate files, this may take some time..."
 
 symlink_root=${1/%\//}
 symlink_search_path=$2
 
 target=""
-fdupes -r $symlink_search_path | while read line; do
+fdupes_sorted -r $symlink_search_path | while read line; do
        if [ -z "$line" ]; then
                # New group of duplicate files begins
                target=""

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to