[Python-modules-commits] [cf-python] 01/11: Added repacking.

Klaus Zimmermann zklaus-guest at moszumanska.debian.org
Wed Sep 14 15:09:40 UTC 2016


This is an automated email from the git hooks/post-receive script.

zklaus-guest pushed a commit to branch master
in repository cf-python.

commit 6b4e0475b7fdc87ae7157fa0d46b74c32c42c02f
Author: Klaus Zimmermann <klaus_zimmermann at gmx.de>
Date:   Wed Sep 14 12:03:56 2016 +0200

    Added repacking.
    
    Signed-off-by: Klaus Zimmermann <klaus_zimmermann at gmx.de>
---
 debian/changelog                 |   2 +-
 debian/repack                    | 108 +++++++++++++++++++++++++++++++++++++++
 debian/rules                     |   4 --
 debian/source_package_build.bash |  70 +++++++++++++++++++++++++
 debian/watch                     |   5 +-
 5 files changed, 182 insertions(+), 7 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index b2c2dc2..d036c37 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,4 +1,4 @@
-cf-python (1.3.1-1) UNRELEASED; urgency=medium
+cf-python (1.3.1+dfsg.1-1) UNRELEASED; urgency=medium
 
   * Initial release (Closes: #777315)
 
diff --git a/debian/repack b/debian/repack
new file mode 100755
index 0000000..0a9077f
--- /dev/null
+++ b/debian/repack
@@ -0,0 +1,108 @@
+#!/bin/bash
+#
+# debian/repack
+# Part of the Debian package ‘cf-python’.
+#
+# Copyright © 2013–2014 Ben Finney <ben+debian at benfinney.id.au>
+#             2016 Klaus Zimmermann <klaus_zimmermann at gmx.de>
+# This is free software; see the end of this file for license terms.
+
+# 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-DFSG-free files:\n"
+
+nonfree_fileglobs=(
+    # Pre-built documentation is not source form.
+    docs/build/*
+
+    # (Modified) third party database has problematic
+    # license and can be avoided.
+    cf/etc/udunits
+
+    # Erroneously included backup file
+    test/#test_Field.py#
+)
+
+for fileglob in "${nonfree_fileglobs[@]}" ; do
+    rm -rfv "${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"
+
+
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# “Software”), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+# 
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+# 
+# The Software is provided “as is”, without warranty of any kind,
+# express or implied, including but not limited to the warranties of
+# merchantability, fitness for a particular purpose and noninfringement.
+# In no event shall the authors or copyright holders be liable for any
+# claim, damages or other liability, whether in an action of contract,
+# tort or otherwise, arising from, out of or in connection with the
+# Software or the use or other dealings in the Software.
+
+
+# Local variables:
+# coding: utf-8
+# mode: sh
+# indent-tabs-mode: nil
+# End:
+# vim: fileencoding=utf-8 filetype=bash :
diff --git a/debian/rules b/debian/rules
index 546d090..79ccc98 100755
--- a/debian/rules
+++ b/debian/rules
@@ -8,10 +8,6 @@ export PYBUILD_NAME=cf
 %:
 	dh $@  --with python2,sphinxdoc --buildsystem=pybuild
 
-override_dh_auto_clean:
-	dh_auto_clean
-	rm -rf docs/build/*
-
 override_dh_auto_build:
 	dh_auto_build
 	cd docs && sphinx-build -E -b html source build/html
diff --git a/debian/source_package_build.bash b/debian/source_package_build.bash
new file mode 100644
index 0000000..55e585b
--- /dev/null
+++ b/debian/source_package_build.bash
@@ -0,0 +1,70 @@
+# debian/source_package_build.bash
+# Part of the Debian package ‘cf-python’.
+#
+# Copyright © 2013–2014 Ben Finney <ben+debian at benfinney.id.au>
+# This is free software; see the end of this file for license terms.
+
+# 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 --show-field=Source)
+release_version=$(dpkg-parsechangelog --show-field=Version)
+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}"
+}
+
+
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# “Software”), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+# 
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+# 
+# The Software is provided “as is”, without warranty of any kind,
+# express or implied, including but not limited to the warranties of
+# merchantability, fitness for a particular purpose and noninfringement.
+# In no event shall the authors or copyright holders be liable for any
+# claim, damages or other liability, whether in an action of contract,
+# tort or otherwise, arising from, out of or in connection with the
+# Software or the use or other dealings in the Software.
+
+
+# Local variables:
+# coding: utf-8
+# mode: sh
+# End:
+# vim: fileencoding=utf-8 filetype=bash :
diff --git a/debian/watch b/debian/watch
index a63c20b..cdca509 100644
--- a/debian/watch
+++ b/debian/watch
@@ -1,3 +1,4 @@
 version=3
-opts=uversionmangle=s/(rc|a|b|c)/~$1/ \
-https://pypi.debian.net/cf-python/cf-python-(.+)\.(?:zip|tgz|tbz|txz|(?:tar\.(?:gz|bz2|xz)))
+opts="dversionmangle=s/\+dfsg\.\d+$//,uversionmangle=s/(rc|a|b|c)/~$1/" \
+https://pypi.debian.net/cf-python/cf-python-(.+)\.(?:zip|tgz|tbz|txz|(?:tar\.(?:gz|bz2|xz))) \
+debian debian/repack

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/cf-python.git



More information about the Python-modules-commits mailing list