-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpushtogithub
executable file
·73 lines (65 loc) · 3.18 KB
/
pushtogithub
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
#!/bin/bash -e
SCRIPTDIR=`dirname $(readlink -f $0)`
source <($SCRIPTDIR/afpg_readconfig.py main:gitdir main:tmp main:AFPGCONFIG main:netrcfile main:githubproject)
$SCRIPTDIR/afpg_readconfig.py main:gitdir main:tmp main:AFPGCONFIG main:netrcfile main:githubproject
function pushifexists {
exists=`git show-ref $1` || true
if [ -n "$exists" ]; then
git push -f -u github $1
fi
}
for PACKAGE in $(cat $AFPGCONFIG/whitelist.pushtogithub ) ; do
echo processing $PACKAGE
if [[ $PACKAGE == lib* ]]; then
PACKAGEDIR=${PACKAGE:0:4}/$PACKAGE
else
PACKAGEDIR=${PACKAGE:0:1}/$PACKAGE
fi
cd $gitdir/$PACKAGEDIR
if [[ `git for-each-ref refs/tags refs/heads | md5sum | cut -d ' ' -f 1` != `md5sum .git/lastgithubpush | cut -d ' ' -f 1` ]] ; then
#github doesn't like + signs in repo names, use - instead (could potentially cause conflicts but probablly won't)
GITHUBREPO=$(echo $PACKAGE | sed s/+/-/)
#this shouldn't be needed anymore, it was a fixup for a problem that
#has been fixed in github.
#/build/dscdirtogit/fixup-authorless-commits
curl --netrc-file $netrcfile https://api.github.com/orgs/raspbian-packages/repos -d '{"name":"'$GITHUBREPO'"}'
git remote rm github || true
#git remote add github [email protected]:raspbian-packages/$GITHUBREPO.git
git remote add github https://github.com/$githubproject/$GITHUBREPO.git
git config credential.helper "netrc -f ~/github-login"
if [[ $PACKAGE == libreoffice ]]; then
#unfortunately stretch's libreoffice can't be pushed to github due to
#large files.
git push -u github `git tag | grep -v 5. | grep -v 6. | grep -v 7.`
elif [[ $PACKAGE == rustc ]]; then
#unfortunately this version contains a large bootstrap tarball in the source package which github doesn't like.
git push -u github `git tag | grep -v 1.24.1+dfsg1-1_deb8u4`
elif [[ $PACKAGE == cargo ]]; then
#unfortunately this version contains a large bootstrap tarball in the source package which github doesn't like.
git push -u github `git tag | grep -v 0.35.0-2_deb8u1`
else
git push -u github --tags
fi
for MAINSUITE in "$@"; do
if [[ $PACKAGE == libreoffice ]] && ([[ $MAINSUITE == stretch ]] || [[ $MAINSUITE == buster ]] || [[ $MAINSUITE == bullseye ]] ); then
#unfortunately stretch's libreoffice can't be pushed to github due to
#large files.
true
elif [[ $PACKAGE == rustc ]] && ( [[ $MAINSUITE == jessie ]] ); then
#unfortunately this package can't be pushed right now due to large files.
#(stage0 compiler tarballs)
true
elif [[ $PACKAGE == cargo ]] && ( [[ $MAINSUITE == jessie ]] ); then
#unfortunately this package can't be pushed right now due to large files.
#(stage0 compiler tarballs)
true
else
source <($SCRIPTDIR/afpg_readconfig.py $MAINSUITE:STAGINGSUITE $MAINSUITE:UPSTREAMSUITE)
pushifexists $MAINSUITE
pushifexists $STAGINGSUITE
pushifexists $UPSTREAMSUITE
fi
done
git for-each-ref refs/tags refs/heads > .git/lastgithubpush
fi
done