Source: strigi
Version: 0.7.8-2.1
Severity: wishlist
Tags: patch
User: reproducible-builds@lists.alioth.debian.org
Usertags: randomness
X-Debbugs-Cc: reproducible-builds@lists.alioth.debian.org

Hi!

While working on the "reproducible builds" effort [1], we have noticed
that strigi could not be built reproducibly.
During build several source files are generated by makecode.pl, which
iterates over hashes without sorting the keys.

The attached patch fixes this.

Regards,
 Reiner

[1]: https://wiki.debian.org/ReproducibleBuilds
diff --git a/debian/patches/reproducible_build.patch b/debian/patches/reproducible_build.patch
new file mode 100644
index 0000000..9fdeddc
--- /dev/null
+++ b/debian/patches/reproducible_build.patch
@@ -0,0 +1,78 @@
+Author: Reiner Herrmann <rei...@reiner-h.de>
+Description: Sort keys to generate deterministic source file
+
+--- a/strigidaemon/bin/daemon/dbus/dbuscpp/makecode.pl
++++ b/strigidaemon/bin/daemon/dbus/dbuscpp/makecode.pl
+@@ -334,10 +334,10 @@
+ print FH "    std::string object;\n";
+ print FH "    DBusConnection* const conn;\n";
+ print FH "    DBusObjectInterface* const iface;\n";
+-foreach (keys %responses) {
++foreach (sort keys %responses) {
+     print FH "    void $_(".$responses{$_}.");\n";
+ }
+-foreach (keys %signals) {
++foreach (sort keys %signals) {
+     print FH "    void $_(".$signals{$_}.");\n";
+ }
+ print FH "public:\n";
+@@ -370,7 +370,7 @@
+ print FH "    std::map<std::string, handlerFunction> handlers;\n";
+ print FH "    DBusHandlerResult handleCall(DBusConnection*c,DBusMessage* m);\n";
+ print FH "    std::string getIntrospectionXML();\n";
+-foreach (keys %functionsIn) {
++foreach (sort keys %functionsIn) {
+     print FH "    void $_(DBusMessage* msg, DBusConnection* conn);\n";
+ }
+ print FH "public:\n";
+@@ -378,7 +378,7 @@
+ print FH "};\n";
+ print FH "Private$classname\::Private$classname($classname& i)\n";
+ print FH "        :DBusObjectInterface(\"$interfacename\"), impl(i) {\n";
+-foreach (keys %functionsIn) {
++foreach (sort keys %functionsIn) {
+     print FH "    handlers[\"$_\"] = &Private$classname\::".$_.";\n";
+ }
+ print FH "}\n";
+@@ -400,20 +400,20 @@
+ print FH "Private$classname\::getIntrospectionXML() {\n";
+ print FH "    std::ostringstream xml;\n";
+ print FH "    xml << \"  <interface name='\"+getInterfaceName()+\"'>\\n\"\n";
+-foreach (keys %functionsIn) {
++foreach (sort keys %functionsIn) {
+     if (defined $responses{$_."Response"}) {
+         printASyncIntrospectionXML($_);
+     } else {
+         printIntrospectionXML($_);
+     }
+ }
+-foreach (keys %signals) {
++foreach (sort keys %signals) {
+     printSignalIntrospectionXML($_);
+ }
+ print FH "    << \"  </interface>\\n\";\n";
+ print FH "    return xml.str();\n";
+ print FH "}\n";
+-foreach (keys %functionsIn) {
++foreach (sort keys %functionsIn) {
+     if (defined $responses{$_."Response"}) {
+         printASyncFunctionDefinition($_);
+     } else {
+@@ -439,7 +439,7 @@
+ print FH "$classname\::~$classname() {\n";
+ print FH "    delete iface;\n";
+ print FH "}\n";
+-foreach (keys %responses) {
++foreach (sort keys %responses) {
+     print FH "void\n";
+     print FH "$classname\::$_(".$responses{$_}.") {\n";
+     print FH "    DBusMessage* m = static_cast<DBusMessage*>(msg);\n";
+@@ -453,7 +453,7 @@
+     print FH "    dbus_message_unref(m);\n";
+     print FH "}\n";
+ }
+-foreach (keys %signals) {
++foreach (sort keys %signals) {
+     print FH "void\n";
+     print FH "$classname\::$_(".$signals{$_}.") {\n";
+     print FH "    DBusMessageWriter writer(conn, object.c_str(), \"$interfacename\", \"$_\");\n";
diff --git a/debian/patches/series b/debian/patches/series
index 4458755..ee211c0 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,3 +1,4 @@
 deepgrep_mayhem_fix.diff
 libav10.patch
 ffmpeg_2.9.patch
+reproducible_build.patch
_______________________________________________
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