1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- #! /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 :
|