Source: ruby-sqlite3
Version: 1.3.9-2
Severity: wishlist
Tags: patch
User: reproducible-bui...@lists.alioth.debian.org
Usertags: randomness

Hi!

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

The attached patch changes the FAQ generator to use slugs instead of
object ids. Once applied, ruby-sqlite3 can be built reproducibly in our
current experimental framework.

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

-- 
Lunar                                .''`. 
lu...@debian.org                    : :Ⓐ  :  # apt-get install anarchism
                                    `. `'` 
                                      `-   
From 7289d73c3c7a88f09822696d7f4fe4e05268f531 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Bobbio?= <lu...@debian.org>
Date: Sun, 19 Apr 2015 13:59:42 +0200
Subject: [PATCH] Use slugs instead of object ids for internal links in FAQ

This makes the package build reproducibly.
---
 debian/changelog                     |  8 ++++++++
 debian/patches/series                |  1 +
 debian/patches/use-slugs-in-faq.diff | 36 ++++++++++++++++++++++++++++++++++++
 3 files changed, 45 insertions(+)
 create mode 100644 debian/patches/use-slugs-in-faq.diff

diff --git a/debian/changelog b/debian/changelog
index e35c5cb..8f01248 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
+ruby-sqlite3 (1.3.9-2.0~reproducible1) UNRELEASED; urgency=low
+
+  * debian/patches/use-slugs-in-faq.diff: use slugs instead of
+    object ids for internal links in FAQ. This makes the package
+    build reproducibly.
+
+ -- Jérémy Bobbio <lu...@debian.org>  Sun, 19 Apr 2015 11:50:10 +0000
+
 ruby-sqlite3 (1.3.9-2) unstable; urgency=medium
 
   * Team upload.
diff --git a/debian/patches/series b/debian/patches/series
index 3a38c2e..c6f46f4 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1,2 @@
 handle-big-endian.diff
+use-slugs-in-faq.diff
diff --git a/debian/patches/use-slugs-in-faq.diff b/debian/patches/use-slugs-in-faq.diff
new file mode 100644
index 0000000..dd65e36
--- /dev/null
+++ b/debian/patches/use-slugs-in-faq.diff
@@ -0,0 +1,36 @@
+Description: Use slugs in FAQ instead of object_id
+ In order to make the FAQ build reproducibly we use “slugs” for
+ internal links instead of object ids.
+Author: Jérémy Bobbio <lu...@debian.org>
+
+--- ruby-sqlite3-1.3.9.orig/faq/faq.rb
++++ ruby-sqlite3-1.3.9/faq/faq.rb
+@@ -1,6 +1,10 @@
+ require 'yaml'
+ require 'redcloth'
+ 
++def slugify( str )
++  str.downcase.strip.gsub(' ', '-').gsub(/[^\w-]/, '')
++end
++
+ def process_faq_list( faqs )
+   puts "<ul>"
+   faqs.each do |faq|
+@@ -20,7 +24,7 @@ def process_faq_list_item( faq )
+     puts question_text
+     process_faq_list answer
+   else
+-    print "<a href='##{question.object_id}'>#{question_text}</a>"
++    print "<a href='##{slugify(question)}'>#{question_text}</a>"
+   end
+ 
+   puts "</li>"
+@@ -43,7 +47,7 @@ def process_faq_description( faq, path )
+     title = RedCloth.new( path ).to_html.gsub( %r{</?p>}, "" )
+     answer = RedCloth.new( answer || "" )
+ 
+-    puts "<a name='#{question.object_id}'></a>"
++    puts "<a name='#{slugify(question)}'></a>"
+     puts "<div class='faq-title'>#{title}</div>"
+     puts "<div class='faq-answer'>#{add_api_links(answer.to_html)}</div>"
+   end
-- 
1.9.1

Attachment: signature.asc
Description: Digital signature

Reply via email to