-
Notifications
You must be signed in to change notification settings - Fork 24
/
repository
executable file
·67 lines (55 loc) · 1.93 KB
/
repository
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
#!/bin/sh
# SPDX-License-Identifier: BSD-3-Clause
# defaults
. /etc/os-release
DEB_DISTRO="${DEB_DISTRO:-$VERSION_CODENAME}"
DEB_ARCH="${DEB_ARCH:-$(dpkg --print-architecture)}"
while getopts a:d:hr: OPTCHAR; do
case "$OPTCHAR" in
a)
DEB_ARCH="$OPTCHAR"
;;
d)
DEB_DISTRO="$OPTARG"
;;
h)
echo "usage: $0 [-a] [-d] [-r]"
echo " -a The architecture to compile for."
echo " -d The Debian/Ubuntu distribution codename to compile for."
echo " -r The ROS distribution codename to compile for."
exit
;;
r)
ROS_DISTRO="$OPTARG"
;;
*)
echo "Error parsing arguments"
exit 1
;;
esac
done
shift "$((OPTIND - 1))"
set -ex
test -d src && vcs export src --exact-with-tags > apt_repo/sources.repos
cd apt_repo
apt-ftparchive packages . > Packages
apt-ftparchive release . > Release
# Github size limit
test -n "$GITHUB_TOKEN" && find . -type f -size +100M -delete
REPOSITORY="$(printf "%s" "$GITHUB_REPOSITORY" | tr / _)"
BRANCH="${PACKAGES_BRANCH:-$DEB_DISTRO-$ROS_DISTRO-$DEB_ARCH}"
echo '```bash' > README.md
echo "echo \"deb [trusted=yes] $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/raw/$BRANCH/ ./\" | sudo tee /etc/apt/sources.list.d/$REPOSITORY.list" >> README.md
echo "echo \"yaml $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/raw/$BRANCH/local.yaml $ROS_DISTRO\" | sudo tee /etc/ros/rosdep/sources.list.d/1-$REPOSITORY.list" >> README.md
echo '```' >> README.md
test -z "$GITHUB_TOKEN" && exit
git init -b "$BRANCH"
test -n "$GIT_LFS" && git lfs track "*.deb" "*.ddeb"
git remote add origin "$(echo "$GITHUB_SERVER_URL/$GITHUB_REPOSITORY.git" | sed "s#https://#https://x-access-token:${GITHUB_TOKEN}@#")"
if [ -n "$SQUASH_HISTORY" ]; then
git fetch origin "$BRANCH" || true
git reset --soft FETCH_HEAD || true
fi
git add .
git -c user.name=Github -c user.email=none commit --message="Generated from $(git -C .. rev-parse --short HEAD)"
git push --force origin "$BRANCH"