1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
|
#! /bin/bash
#
# debian/repack
# Part of the Debian package ‘python-coverage’.
#
# Copyright © 2010–2016 Ben Finney <bignose@debian.org>
#
# This is free software; you may copy, modify, and/or distribute this
# work under the terms of the Apache License, version 2.0 as published
# by the Apache Software Foundation. No warranty expressed or implied.
# See the file ‘/usr/share/common-licenses/Apache-2.0’ 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 ‘%s’:\n" "${downloaded_file}"
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 ‘%s’ to ‘%s’:\n" \
"${upstream_source_dir}" "${repack_dir}"
mv "${upstream_source_dir}" "${repack_dir}"
printf "Removing non-source files:\n"
nonsource_files=(
# Compiled JavaScript files without corresponding source.
coverage/htmlfiles/jquery.min.js
coverage/htmlfiles/jquery.debounce.min.js
coverage/htmlfiles/jquery.tablesorter.min.js
tests/qunit/jquery.tmpl.min.js
)
for f in "${nonsource_files[@]}" ; do
rm -rv "${repack_dir}/$f"
done
printf "Rebuilding DFSG-free upstream source tarball:\n"
archive_working_dir_to_tarball "${upstream_dirname}" "${target_working_file}"
printf "Moving completed upstream tarball to ‘%s’:\n" "${target_file}"
rm -v "${downloaded_file}"
mv "${target_working_file}" "${target_file}"
printf "Done.\n"
# Local variables:
# coding: utf-8
# mode: shell-script
# indent-tabs-mode: nil
# End:
# vim: fileencoding=utf-8 filetype=bash expandtab :
|