Update my email address for Debian work.
[debian_inform6-library.git] / debian / repack
blob73ba954a26eb5f694e8f0daaf269e32335c4b63f
1 #! /bin/bash
3 # debian/repack
4 # Part of the Debian package ‘inform6-library’.
6 # Copyright © 2010–2016 Ben Finney <bignose@debian.org>
8 # This is free software; you may copy, modify, and/or distribute this
9 # work under the terms of the GNU General Public License as published
10 # by the Free Software Foundation; version 3 of that License or later.
11 # No warranty expressed or implied.
12 # See the file ‘/usr/share/common-licenses/GPL-3’ for details.
14 # Convert the pristine upstream source to the Debian upstream source.
16 # This program is designed for use with the ‘uscan(1)’ tool, as the
17 # “action” parameter for the ‘debian/watch’ configuration file.
19 set -o errexit
20 set -o errtrace
21 set -o pipefail
22 set -o nounset
24 program_dir="$(dirname "$(realpath --strip "$0")")"
25 source "${program_dir}"/source_package_build.bash
27 function usage() {
28 local progname=$(basename $0)
29 printf "$progname --upstream-version VERSION FILENAME\n"
32 if [ $# -ne 3 ] ; then
33 usage
34 exit 1
37 upstream_version="$2"
38 downloaded_file="$3"
40 target_filename="${upstream_tarball_basename}.tar.gz"
41 target_working_file="${working_dir}/${target_filename}"
42 target_file="$(dirname "${downloaded_file}")/${target_filename}"
44 repack_dir="${working_dir}/${upstream_dirname}"
46 printf "Unpacking pristine upstream source ‘%s’:\n" "${downloaded_file}"
48 extract_tarball_to_working_dir "${downloaded_file}"
50 upstream_source_dirname=$(ls -1 "${working_dir}")
51 upstream_source_dir="${working_dir}/${upstream_source_dirname}"
53 printf "Repackaging upstream source from ‘%s’ to ‘%s’:\n" \
54 "${upstream_source_dir}" "${repack_dir}"
56 mv "${upstream_source_dir}" "${repack_dir}"
58 printf "Removing non-source files:\n"
60 nonsource_files=(
61 # Generated files without corresponding source form.
62 infglk.h
66 for f in "${nonsource_files[@]}" ; do
67 rm -f -v "${repack_dir}"/$f
68 done
70 printf "Rebuilding DFSG-free upstream source tarball:\n"
72 archive_working_dir_to_tarball "${upstream_dirname}" "${target_working_file}"
74 printf "Moving completed upstream tarball to ‘%s’:\n" "${target_file}"
76 rm -v "${downloaded_file}"
77 mv "${target_working_file}" "${target_file}"
79 printf "Done.\n"
82 # Local variables:
83 # coding: utf-8
84 # mode: shell-script
85 # indent-tabs-mode: nil
86 # End:
87 # vim: fileencoding=utf-8 filetype=bash expandtab :