NEWS: document the release 0.3
[archives2git.git] / dsc2git
blobfc1aaa937f8d56b39e647dbd7d5ec015149fbc4c
1 #!/bin/sh
2 # dsc2git - wrapper around archives2git
4 # Copyright © 2017 Géraud Meyer <graud@gmx.com>
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License version 2 as
7 # published by the Free Software Foundation.
9 # This program is distributed in the hope that it will be useful, but
10 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
11 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 # for more details.
14 # You should have received a copy of the GNU General Public License along
15 # with this program. If not, see <http://www.gnu.org/licenses/>.
17 help_message () {
18 cat <<"HelpMessage"
19 NAME
20 dsc2git - wrapper around archives2git to process debian source packages
21 SYNOPSIS
22 dsc2git [<dsc2git_opts>] [--] <archives2git_args>
23 DESCRIPTION
24 dsc2git passes the --unpack and --strip-ext options to archives2git so that
25 it unpacks Debian source packages.
26 OPTIONS
27 --dpkg-source-args <args>
28 Line-separated list of arguments passed to dpkg-source(1).
29 --help, --helpm
30 EXAMPLES
31 $ debsnap dash
32 $ git init dash-deb.git; cd dash-deb.git
33 $ IFS=$'\n'
34 $ dsc2git --dpkg-source-args $'--no-check\n--skip-patches' \
35 $(ls -1 ../source-dash/*.dsc |grep -v \~bpo |sort -V)
36 SEE ALSO
37 archives2git(1), dpkg-source(1)
38 HelpMessage
41 # options parsing
42 dpkg_args=
43 while [ $# -gt 0 ]
45 case $1 in
46 --dpkg-source-args) shift; dpkg_args=$1 ;;
47 --help|--helpm) help_message; exit ;;
48 --) shift; break ;;
49 *) break ;;
50 # an unknown option may be an option to archives2git
51 esac
52 shift
53 done
55 set -eu
56 OLDIFS=$IFS
57 IFS='
59 dpkg_args=$(git rev-parse --sq-quote $dpkg_args)
60 IFS=$OLDIFS
61 exec archives2git \
62 --unpack \
63 'archcd=$(pwd -P)/
64 [ x"${arch#./}" = x"$arch" ] && [ x"${arch#../}" = x"$arch" ] && archcd=
65 cd "$TMPDIR"
66 dpkg-source -x '"$dpkg_args"' "$archcd$arch"
67 rm -vf *.orig.tar.*' \
68 --strip-ext 'printf %s "${arch%.dsc}"' \
69 "$@"