File: checkout

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 (99 lines) | stat: -rwxr-xr-x 2,576 bytes parent folder | download
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
#!/bin/sh

# copyright, licensing and documentation at the end

set -e
set -u

usage() {
    perl -MPod::Usage=pod2usage -e"pod2usage(-input => '$0', -verbose=>99, -sections=>[qw(SYNOPSIS DESCRIPTION COMMANDS)])"
    exit 1
}


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

cd "${DPT_PACKAGES:=.}"
for pkg in "$@"; do
    if [ -d "$pkg" ]; then
        echo "Updating existing checkout in ${DPT_PACKAGES}/$pkg"
        cd "$pkg"
        gbp pull --pristine-tar
        git fetch origin refs/notes/commits:refs/notes/commits >|/dev/null 2>&1 || true
        cd - > /dev/null
    else
        gbp clone --all "git@salsa.debian.org:perl-team/modules/packages/$pkg.git"
        cd "$pkg"
        git fetch origin refs/notes/commits:refs/notes/commits >|/dev/null 2>&1 || true

        echo "$pkg ready in ${DPT_PACKAGES}/$pkg"
    fi

    METADATA="$DPT_PACKAGES/$pkg/debian/upstream/metadata"
    if [ -e "$METADATA" ] ; then
        REPO=$(awk '/Repository:/ { print $2 }' "$METADATA")
        if [ -n "$REPO" ]; then
            (
                cd "$DPT_PACKAGES/$pkg"
                if git remote show upstreamvcs > /dev/null 2>&1 ; then
                    git fetch --prune upstreamvcs
                else
                    dpt upstreamvcs
                fi
            ) || true
        fi
    fi
done

exit 0

POD=<<'EOF'
=head1 NAME

dpt-checkout - work on a pkg-perl package

=head1 SYNOPSIS

B<dpt checkout> I<package-name> [I<package-name> ...]

B<dpt co> I<package-name> [I<package-name> ...]

=head1 DESCRIPTION

B<dpt checkout> checks out a working copy for the packaging of a given package.

If you use L<dpt-shell-lib(1)>, B<dpt checkout> even puts you in the
directory of working copy if you checked out only one source package.

If the package directory exists, the clone is updated by calling
L<gbp-pull(1)>. If it doesn't exist, it is cloned off pkg-perl git
repositories via L<gbp-clone(1)>.

If there is an upstream repository information in F<debian/upstream/metadata>,
L<dpt-upstreamvcs(1)> is invoked to add it as a Git remote.

B<dpt co> is an alias for B<dpt checkout>.

=head1 CONFIGURATION

B<dpt checkout> uses the C<DPT_PACKAGES> environment variable. If
C<DPT_PACKAGES> is not defined, the current working directory is used.

See L<dpt-config(5)> for details.

=head1 COPYRIGHT & LICENSE

=over

=item Copyright 2013-2025 gregor herrmann L<gregoa@debian.org>

=item Copyright 2013, 2014 Damyan Ivanov L<dmn@debian.org>

=item Copyright 2013 Axel Beckert L<abe@debian.org>

=back

This program is free software, licensed under the same terms as perl.

=cut
EOF