File: checkout-upstream

package info (click to toggle)
systemd 230-7~bpo8+2
  • links: PTS, VCS
  • area: main
  • in suites: jessie-backports
  • size: 35,908 kB
  • sloc: ansic: 276,817; xml: 47,140; makefile: 5,349; sh: 3,681; python: 2,234; perl: 1,833
file content (58 lines) | stat: -rwxr-xr-x 1,869 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
#!/bin/sh
# Prepare systemd source package in current directory for testing an upstream
# commit, branch, or PR, without Debian patches. This replaces everything
# except the debian/ directory with an upstream checkout.
# NEVER run this in your actual packaging work directory! This is only meant
# for upstream CI.
#
# Author: Martin Pitt <martin.pitt@ubuntu.com>

set -eu
test -x debian/rules
if [ -z "${TEST_UPSTREAM:-}" ]; then
    echo "Not in upstream testing mode. Do *not* run this script unless you know what you are doing." >&2
    exit 1
fi
if [ -n "${UPSTREAM_PULL_REQUEST:-}" ]; then
    FETCH="git fetch -fu origin refs/pull/$UPSTREAM_PULL_REQUEST/head:pr"
    CO='git checkout pr'
    DESC="PR #$UPSTREAM_PULL_REQUEST"
elif [ -n "${UPSTREAM_HEAD:-}" ]; then
    FETCH=''
    CO="git checkout $UPSTREAM_HEAD"
    DESC="$UPSTREAM_HEAD"
else
    echo "WARNING: $0: Neither UPSTREAM_PULL_REQUEST nor UPSTREAM_HEAD set, ignoring" >&2
    exit 0
fi

mkdir -p debian/tmp
(cd debian/tmp
 git clone https://github.com/systemd/systemd.git upstream || (rm -rf upstream; sleep 60; git clone https://github.com/systemd/systemd.git upstream)
 cd upstream
 $FETCH
 $CO)
UPSTREAM_VER=$(cd debian/tmp/upstream; git describe | sed 's/^v//')

# clean out original upstream sources and patches
find -mindepth 1 -maxdepth 1 -name debian -prune -o -print0 | xargs -0n1 rm -rf
rm -rf debian/patches

# replace with checkout
mv debian/tmp/upstream/* .
rm -rf debian/tmp

# craft changelog
cat << EOF > debian/changelog.new
systemd (${UPSTREAM_VER}-0) UNRELEASED; urgency=low

  * Automatic build from upstream $DESC

 -- systemd test <pkg-systemd-maintainers@lists.alioth.debian.org>  $(date -R)

EOF
cat debian/changelog >> debian/changelog.new
mv debian/changelog.new debian/changelog

# disable tests which are not for upstream
sed -i '/# NOUPSTREAM/ q' debian/tests/control