package src:roundcube
tags 736782 + patch
thanks

On 26-Jan-2014, bastien ROUCARIES wrote:
> I could not find the source of:
> roundcube 0.9.5-4 (source)
> 
>     program/js/jquery.min.js
>     program/js/jstz.min.js
>     plugins/jqueryui/js/jquery-ui-1.9.1.custom.min.js

There are other non-source files which should not be redistributed
without confidence they have corresponding source in Debian. The
simpler course is just to remove all those non-source JavaScript
files.

The attached patches against the current Git “master” branch add a
‘debian/repack’ program and invoke it from ‘uscan’.

-- 
 \      “I have never made but one prayer to God, a very short one: ‘O |
  `\           Lord, make my enemies ridiculous!’ And God granted it.” |
_o__)                                                        —Voltaire |
Ben Finney <b...@benfinney.id.au>
From 23266fa6213c2a2b1860b6fd45fa694777f98545 Mon Sep 17 00:00:00 2001
From: Ben Finney <ben+deb...@benfinney.id.au>
Date: Thu, 8 May 2014 11:32:11 +1000
Subject: [PATCH 1/3] Add program for re-pack of the Debian source package.

---
 debian/changelog                 |  9 +++-
 debian/repack                    | 97 ++++++++++++++++++++++++++++++++++++++++
 debian/source_package_build.bash | 52 +++++++++++++++++++++
 3 files changed, 156 insertions(+), 2 deletions(-)
 create mode 100755 debian/repack
 create mode 100644 debian/source_package_build.bash

diff --git a/debian/changelog b/debian/changelog
index 8168a36..adac095 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -13,10 +13,15 @@ roundcube (1.0.0-1) UNRELEASED; urgency=low
     db.inc.php will be zeroed out and we will still patch the
     defaults.inc.php to point to the appropriate DB data (or
     config.inc.php?).
-  * Handle those sourceless files. That's a pain.
   * Check changes to update debian/copyright.
 
- -- Vincent Bernat <ber...@debian.org>  Sat, 12 Apr 2014 09:44:39 +0200
+  [ Ben Finney ]
+
+  * debian/repack, debian/source_package_build.bash:
+    + Add program for re-pack of the Debian source package, to omit
+      non-source files.
+
+ --
 
 roundcube (0.9.5-4) unstable; urgency=low
 
diff --git a/debian/repack b/debian/repack
new file mode 100755
index 0000000..d32ece1
--- /dev/null
+++ b/debian/repack
@@ -0,0 +1,97 @@
+#! /bin/bash
+#
+# debian/repack
+# Part of the Debian package ‘roundcube’.
+#
+# Copyright © 2013–2014 Ben Finney <ben+deb...@benfinney.id.au>
+# This is free software; you may copy, modify and/or distribute this work
+# under the terms of the GNU General Public License, version 3 or later.
+# No warranty expressed or implied. See the file ‘LICENSE’ for details.
+
+# Convert the pristine upstream source to the Debian upstream source.
+#
+# This program is designed for use with the ‘uscan(1)’ tool, as the
+# “action” parameter for the ‘debian/watch’ configuration file.
+
+set -o errexit
+set -o errtrace
+set -o pipefail
+set -o nounset
+
+program_dir="$(dirname "$(realpath --strip "$0")")"
+source "${program_dir}"/source_package_build.bash
+
+function usage() {
+    local progname=$(basename $0)
+    printf "$progname --upstream-version VERSION FILENAME\n"
+}
+
+if [ $# -ne 3 ] ; then
+    usage
+    exit 1
+fi
+
+upstream_version="$2"
+downloaded_file="$3"
+
+target_filename="${upstream_tarball_basename}.tar.gz"
+target_working_file="${working_dir}/${target_filename}"
+target_file="$(dirname "${downloaded_file}")/${target_filename}"
+
+repack_dir="${working_dir}/${upstream_dirname}"
+
+printf "Unpacking pristine upstream source ‘${downloaded_file}’:\n"
+
+extract_tarball_to_working_dir "${downloaded_file}"
+
+upstream_source_dirname=$(ls -1 "${working_dir}")
+upstream_source_dir="${working_dir}/${upstream_source_dirname}"
+
+printf "Repackaging upstream source from ‘${upstream_source_dir}’ to ‘${repack_dir}’:\n"
+
+mv "${upstream_source_dir}" "${repack_dir}"
+
+printf "Removing non-source files:\n"
+
+source_omit_files=(
+        # Third-party libraries in non-source form, and related files.
+        plugins/acl/*.min.js
+        plugins/archive/*.min.js
+        plugins/attachment_reminder/*.min.js
+        plugins/enigma/*.min.js
+        plugins/help/*.min.js
+        plugins/hide_blockquote/*.min.js
+        plugins/jqueryui/
+        plugins/managesieve/*.min.js
+        plugins/markasjunk/*.min.js
+        plugins/newmail_notifier/*.min.js
+        plugins/password/*.min.js
+        plugins/userinfo/*.min.js
+        plugins/vcard_attachments/*.min.js
+        plugins/zipdownload/*.min.js
+        program/js/*.min.js
+        program/js/tiny_mce/
+        )
+
+for fileglob in "${source_omit_files[@]}" ; do
+    rm -v -r "${repack_dir}"/$fileglob
+done
+
+printf "Rebuilding DFSG-free upstream source tarball:\n"
+
+archive_working_dirname_to_tarball "${upstream_dirname}" "${target_working_file}"
+
+printf "Moving completed upstream tarball to ‘${target_file}’:\n"
+
+rm -v "${downloaded_file}"
+mv "${target_working_file}" "${target_file}"
+
+printf "Done.\n"
+
+
+# Local variables:
+# coding: utf-8
+# mode: sh
+# indent-tabs-mode: nil
+# End:
+# vim: fileencoding=utf-8 filetype=bash :
diff --git a/debian/source_package_build.bash b/debian/source_package_build.bash
new file mode 100644
index 0000000..f477d2a
--- /dev/null
+++ b/debian/source_package_build.bash
@@ -0,0 +1,52 @@
+# debian/source_package_build.bash
+# Part of the Debian package ‘roundcube’.
+#
+# Copyright © 2013–2014 Ben Finney <ben+deb...@benfinney.id.au>
+# This is free software; you may copy, modify and/or distribute this work
+# under the terms of the GNU General Public License, version 3 or later.
+# No warranty expressed or implied. See the file ‘LICENSE’ for details.
+
+# Common code for building Debian upstream source package.
+
+working_dir="$(mktemp -d -t)"
+
+exit_sigspecs="ERR EXIT SIGTERM SIGHUP SIGINT SIGQUIT"
+
+function cleanup_exit() {
+    exit_status=$?
+    trap - $exit_sigspecs
+
+    rm -rf "${working_dir}"
+    printf "Cleaned up working directory ‘${working_dir}’\n"
+
+    exit $exit_status
+}
+trap cleanup_exit $exit_sigspecs
+
+package_name=$(dpkg-parsechangelog | sed -n -e 's/^Source: //p')
+release_version=$(dpkg-parsechangelog | sed -n -e 's/^Version: //p')
+upstream_version=$(printf "${release_version}" \
+	| sed -e 's/^[[:digit:]]\+://' -e 's/[-][^-]\+$//')
+upstream_dirname="${package_name}-${upstream_version}.orig"
+upstream_tarball_basename="${package_name}_${upstream_version}.orig"
+
+function extract_tarball_to_working_dir() {
+    # Extract the specified tarball to the program's working directory.
+    local tarball="$1"
+    tar -xzf "${tarball}" --directory "${working_dir}"
+}
+
+function archive_working_dirname_to_tarball() {
+    # Archive the specified directory, relative to the working directory,
+    # to a new tarball of the specified name.
+    local source_dirname="$1"
+    local tarball="$2"
+    GZIP="--best" tar --directory "${working_dir}" -czf "${tarball}" "${source_dirname}"
+}
+
+
+# Local variables:
+# coding: utf-8
+# mode: sh
+# End:
+# vim: fileencoding=utf-8 filetype=bash :
-- 
2.0.0.rc0

From ec32d01374d2b2fdb0429e8e49f6f00896564201 Mon Sep 17 00:00:00 2001
From: Ben Finney <ben+deb...@benfinney.id.au>
Date: Thu, 8 May 2014 11:34:17 +1000
Subject: [PATCH 2/3] =?UTF-8?q?Use=20a=20=E2=80=9C+dfsg.N=E2=80=9D=20suffi?=
 =?UTF-8?q?x=20for=20the=20Debian=20upstream=20version=20string.?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 debian/changelog | 4 +++-
 debian/watch     | 9 ++++++++-
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index adac095..8611c25 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,4 +1,4 @@
-roundcube (1.0.0-1) UNRELEASED; urgency=low
+roundcube (1.0.0+dfsg.1-1) UNRELEASED; urgency=low
 
   * New upstream release.
   * Depends on php-mail-mimedecode. Closes: #740242.
@@ -20,6 +20,8 @@ roundcube (1.0.0-1) UNRELEASED; urgency=low
   * debian/repack, debian/source_package_build.bash:
     + Add program for re-pack of the Debian source package, to omit
       non-source files.
+  * debian/watch:
+    + Handle a “+dfsg.N” suffix for the Debian upstream version string.
 
  --
 
diff --git a/debian/watch b/debian/watch
index 52d2904..e697979 100644
--- a/debian/watch
+++ b/debian/watch
@@ -1,2 +1,9 @@
+# debian/watch
+# Debian uscan file for ‘roundcube’ package.
+# Manpage: ‘uscan(1)’
+
+# Compulsory line, this is a version 3 file.
 version=3
-opts="uversionmangle=s/-(rc|alpha|beta)/~$1/,dversionmangle=s/\+dfsg//" http://sf.net/roundcubemail/roundcubemail-([\d\.]+.*)-dep\.tar\.gz
+
+opts="uversionmangle=s/-(rc|alpha|beta)/~$1/,dversionmangle=s/\+dfsg\.\d+$//" \
+    http://sf.net/roundcubemail/roundcubemail-([\d\.]+.*)-dep\.tar\.gz
-- 
2.0.0.rc0

From 69ad0ba97ffb4b7d798247fd1a79b79da9cab4f1 Mon Sep 17 00:00:00 2001
From: Ben Finney <ben+deb...@benfinney.id.au>
Date: Thu, 8 May 2014 11:34:49 +1000
Subject: [PATCH 3/3] =?UTF-8?q?Re-pack=20the=20pristine=20upstream=20sourc?=
 =?UTF-8?q?e=20as=20the=20=E2=80=9Caction=E2=80=9D=20after=20download.?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 debian/changelog | 2 ++
 debian/watch     | 3 ++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/debian/changelog b/debian/changelog
index 8611c25..43fd9b9 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -22,6 +22,8 @@ roundcube (1.0.0+dfsg.1-1) UNRELEASED; urgency=low
       non-source files.
   * debian/watch:
     + Handle a “+dfsg.N” suffix for the Debian upstream version string.
+    + Re-pack the pristine upstream source as the “action” after download.
+      (Closes: bug#736782)
 
  --
 
diff --git a/debian/watch b/debian/watch
index e697979..5bc841a 100644
--- a/debian/watch
+++ b/debian/watch
@@ -6,4 +6,5 @@
 version=3
 
 opts="uversionmangle=s/-(rc|alpha|beta)/~$1/,dversionmangle=s/\+dfsg\.\d+$//" \
-    http://sf.net/roundcubemail/roundcubemail-([\d\.]+.*)-dep\.tar\.gz
+    http://sf.net/roundcubemail/roundcubemail-([\d\.]+.*)-dep\.tar\.gz \
+    debian debian/repack
-- 
2.0.0.rc0

Attachment: signature.asc
Description: Digital signature

Reply via email to