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
|
#!/bin/sh
# Documentation, Copyright & Licence below
cd $(git rev-parse --git-dir)/..
. "${DPT__SCRIPTS:-/usr/share/pkg-perl-tools}/lib/dpt-lib.sh"
tag_to_regexp() {
sed -e 's/%(version)s/.*/g;s/^/^/;s/$/$/'
}
get_from_gbp() {
variant=$1
type=$2
value="$(read_gbp_conf | grep -E "${variant}-${type} *= *" | awk -F'= *' '{print $2}' | tail -1)"
if [ -z "${value}" ]; then
if [ "${type}" = "branch" ]; then
if [ "${variant}" = "debian" ]; then
echo "master"
else
echo "${variant}"
fi
elif [ "${type}" = "tag" ]; then
if [ "${variant}" = "debian" ] && [ "$(dpkg-source --print-format .)" = "3.0 (native)" ]; then
echo ".*"
else
echo "${variant}/.*"
fi
else
die "dpt push: get_from_gbp(): Unknown type ${type}"
fi
elif [ "${type}" = "branch" ]; then
echo "${value}"
elif [ "${type}" = "tag" ]; then
echo "${value}" | tag_to_regexp
else
die "dpt push: get_from_gbp(): Unknown type ${type}"
fi
}
read_gbp_conf() {
for gbpconf in .gbp.conf debian/gbp.conf .git/gbp.conf; do
if [ -e "${gbpconf}" ]; then
cat "${gbpconf}"
fi
done | grep -Ev '^[[:space:]]*#'
}
REFS="$(get_from_gbp debian branch)"
for r in $(get_from_gbp upstream branch) pristine-tar refs/notes/commits; do
if git rev-parse --verify --quiet $r > /dev/null; then
REFS="$REFS $r"
fi
done
git push origin $REFS \
$(git tag|grep -E "$(get_from_gbp debian tag)|$(get_from_gbp upstream tag)") \
"$@" \
|| exit $?
POD=<<'EOF'
=head1 NAME
dpt-push - push relevant packaging refs to origin Git remote
=head1 SYNOPSIS
B<dpt push> [ I<git argument...> ]
To be run from packaging working directory.
=head1 DESCRIPTION
B<dpt push> pushes the following refs to the C<origin> remote:
=over
=item C<master> branch (or whatever is set to debian-branch in gbp.conf)
=item C<upstream> branch (or whatever is set to upstream-branch in gbp.conf)
=item C<pristine-tar> branch
=item tags named C<debian/*> (or whatever is set to debian-tag in gbp.conf)
=item tags named C<upstream/*> (or whatever is set to upstream-tag in gbp.conf)
=item all tags, if the package's source format is C<3.0 (native)>
=back
=head1 COPYRIGHT & LICENSE
Copyright: 2013-2015, Damyan Ivanov E<lt>dmn@debian.orgE<gt>
Copyright: 2013-2015, Axel Beckert E<lt>abe@debian.orgE<gt>
Copyright: 2015-2018, gregor herrmann E<lt>gregoa@debian.orgE<gt>
License: Artistic or GPL-1+
=cut
EOF
|