File: takeover

package info (click to toggle)
pkg-perl-tools 0.85
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 796 kB
  • sloc: perl: 3,254; sh: 3,244; makefile: 144; python: 18
file content (226 lines) | stat: -rwxr-xr-x 5,259 bytes parent folder | download | duplicates (2)
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
#!/bin/sh

# Copyright: 2008, 2009, 2013, 2014 Damyan Ivanov <dmn@debian.org>
#            2008, 2011, 2018 gregor herrmann <gregoa@debian.org>
#            2008, 2009, Ryan Niebur <ryan@debian.org>
#
# This program is free software; you can redistribute it and/or modify it
# under the same terms as Perl itself.



set -e

MYDIR="$(readlink -f `dirname $0`)"

usage() {
    BN=`basename $0`
    cat <<EOF
Usage: $BN [options] package...

Options:
    -t path     Top location of local repository clones (containing packages/)
                Required. Defaults to the DPT_PACKAGES setting. Cf. dpt-config(5)
    -m URL      URL to a message in which the previous maintainer requests the
                takeover
    -a #        RFA/ITA bug number (conflicts with -m)
    -g URL      Existing Git repository to clone
    -n          Local operation only. Local repository is prepared, but
                nothing is changed on salsa.
    -h          show this text

<package> is the source package name that we take over of. You may list more
than one package.
EOF
    exit 0
}

if [ -n "$DPT_PACKAGES" ]; then
    TOP=${DPT_PACKAGES%/packages}
else
    TOP=""
fi
MAIL=''
RFA=''
GIT=''
LOCAL=''

set -u

while getopts t:m:a:g:hn o; do
    case $o in
        h) usage;;
        m) MAIL=$OPTARG;;
        t) TOP=$OPTARG;;
        a) RFA=$OPTARG;;
        g) GIT=$OPTARG;;
        n) LOCAL=1;;
    esac
done
shift `expr $OPTIND - 1`

if [ -n "$RFA" ] && [ -n "$MAIL" ]; then
    echo "-m and -a cannot be given at the same time"
    exit 1
fi

if [ -n "$GIT" ] && [ $# -gt 1 ]; then
    echo '-g option allows only one package name'
    exit 1;
fi

[ -n "$TOP" ] || usage

TMP=`mktemp -d`

trap "rm -rf $TMP" QUIT INT 0

inject_package()
{
    PACKAGE=$1
    cat <<EOF
***
*** Taking over $PACKAGE
***
EOF

    if [ -n "$GIT" ]; then
        cd $TOP/packages
        git clone $GIT $PACKAGE
        cd $PACKAGE
        for b in `git branch -r|grep -E -v '/HEAD |/master$'|sed -e 's,^  origin/,,'`; do
            git checkout -b $b origin/$b
        done
        git checkout master
        git remote remove origin
        cd ..
    else
        cd $TOP/packages
        gbp import-dscs --debsnap --pristine-tar $PACKAGE
    fi

    cd $PACKAGE

    if [ -z "$LOCAL" ]; then
        dpt salsa pushrepo
    fi

    TXT="Take over for the Debian Perl Group"
    if [ -n "$MAIL" ]; then
        TXT="$TXT on maintainer's request ($MAIL)"
    fi
    if [ -n "$RFA" ]; then
        TXT="$TXT; Closes: #$RFA -- RFA/ITA"
    fi

    dch --no-auto-nmu -i -c debian/changelog "$TXT"
    git add debian/changelog
    git commit -m '[takeover-for-pkg-perl] Document the takeover'

    PC_OPTS="-a -A -C -p \"$PACKAGE\" -c -H -V"
    if [ -n "$LOCAL" ]; then PC_OPTS="$PC_OPTS -n"; fi
    dpt packagecheck $PC_OPTS

    if [ -z "$LOCAL" ]; then
        dpt push
    fi
    rm -rf $TMP
}

[ -n "${1:-}" ] || usage

PACKAGES=''
CURPWD=$(pwd)
while [ -n "${1:-}" ]; do
    inject_package $1
    PACKAGES="$PACKAGES $1"
    shift
    cd $CURPWD
done

if [ -n "$LOCAL" ]; then
    echo "Nothing pushed to salsa"
    echo "You may want to inspect the resulting repositories for"
    echo $PACKAGES
    echo "and run dpt salsa pushrepo"
    echo "to create the salsa repository and push the local"
    echo "repository there"
fi

exit 0

POD=<<EOF
=head1 NAME

dpt-takeover - take over a package for the Debian Perl Group

=head1 SYNOPSIS

B<dpt takeover> -t I<top-directory> [I<option>...] I<package>...

=head1 DESCRIPTION

B<dpt takeover> helps taking over a package and adopting its control files for
maintenance by the Debian Perl group.

B<dpt takeover> first creates a local Git repository either from existing Git
repository specified with the B<-g> option, or by importing all package versions
available on snapshot.debian.org via L<gbp-import-dscs(1)>.

Next B<dpt takeover> adds suitable entries to F<debian/changelog>, using
information given by the B<-m> or the B<-a> options.

Next B<dpt takeover> runs C<dpt-packagecheck -a -A -C -c> to adjust the control
fields.

Finally, the resulting Git repository is pushed to the Debian collaborative
server, L<salsa.debian.org>, unless the B<-n> option is used.

=head1 OPTIONS

=over

=item B<-t> I<top-directory>  B<(mandatory)>

The location of the top level directory, containing F<packages/>.

=item B<-m> I<URL>

The address of the message with which the previous maintainer requests
adoption. It is included in the commit message and F<debian/changelog>.

Conflicts with B<-a>.

=item B<-a> I<number>

RFA/ITA bug number. Suitable C<Closes: #nnnnnn> is added to
F<debian/changelog>.

Conflicts with B<-m>.

=item B<-g> I<URL>

URL of an existing Git repository to clone. If not present L<gbp-import-dscs> is
used to prime the local Git repository from the package versions available on
snapshot.debian.org.

=item B<-n>

Local operation. The resulting Git repository is not pushed to
L<salsa.debian.org>.

=back

=head1 COPYRIGHT & LICENSE

Copyright 2008, 2009, 2013, 2014 Damyan Ivanov <dmn@debian.org>

Copyright 2008, 2011, 2018 gregor herrmann <gregoa@debian.org>

Copyright 2008, 2009, Ryan Niebur <ryan@debian.org>

This program is free software and can be distributed under the same terms as
Perl.

=cut
EOF