File: new_upstream

package info (click to toggle)
golang-github-xtaci-smux 1.0.7%2Bds-1~bpo8%2B1
  • links: PTS, VCS
  • area: main
  • in suites: jessie-backports-sloppy
  • size: 172 kB
  • sloc: sh: 55; makefile: 2
file content (45 lines) | stat: -rwxr-xr-x 1,451 bytes parent folder | download | duplicates (13)
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
#!/bin/sh

if git diff-index --quiet HEAD --; then
	git fetch --all # -or- git fetch <upstream repo>
else
	echo Working directory not clean. Exiting.
	exit 1
fi

tag=$(git describe --tags $(git rev-list --tags='v[0-9]*' --max-count=1))
ver=$(echo $tag|sed s/^v//)
dstag=upstream/${ver}+ds
rmfiles=$(awk 'BEGIN{RS=ORS="\n\n";FS=OFS="\n"}/Files-Excluded:/' debian/copyright|sed -n -e '/^Files-Excluded:/,${p}'|sed s/Files-Excluded://|sed /^$/d)
if git rev-parse -q --verify "refs/tags/${dstag}" >/dev/null; then
	echo Upstream tag "${dstag}" exists already. Exiting.
	exit 1
fi
if ! git merge $tag; then
	git add -u
fi

# remove all 'Files-Excluded' files listed in debian/copyright, except debian/ folder
for i in $rmfiles; do if [ "$i" != "debian" ]; then git rm -rf "$i"; fi; done
# restore the debian/ folder from previous commit
git checkout HEAD debian/
# since backported patches should be all included in the new release, remove them all here
sed -i '/^backport\//d' debian/patches/series
git add debian/patches/series
git rm debian/patches/backport/*.patch

if git diff-index --quiet HEAD --; then
	git commit --amend -m "Merge upstream tag: $tag"
else
	git commit -m "Merge upstream tag: $tag"
fi

git rm -qrf debian/
git commit -m "Pristine source of ${ver}+ds"

git tag ${dstag}
git reset --hard HEAD^

echo
echo If you need to remove more files, do it now then run script to update the ds tag:
printf \\tdebian/maint-tools/update_ds_tag\\n