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.
24 program_dir
="$(dirname "$
(realpath
--strip "$0")")"
25 source "${program_dir}"/source_package_build.bash
28 local progname
=$
(basename $0)
29 printf "$progname --upstream-version VERSION FILENAME\n"
32 if [ $# -ne 3 ] ; then
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"
61 # Generated files without corresponding source form.
66 for f
in "${nonsource_files[@]}" ; do
67 rm -f -v "${repack_dir}"/$f
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}"
85 # indent-tabs-mode: nil
87 # vim: fileencoding=utf-8 filetype=bash expandtab :