aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/obs/gerrit_binpkgs.sh
blob: 1e4ae26d88bd8b207bffb8a87fc51346927ee813 (plain)
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
#!/bin/sh -e
SCRIPTS_OBS_DIR="$(realpath "$(dirname "$0")")"

DISTRO="$1"
if [ -z "$DISTRO" ]; then
	echo "usage: gerrit-binpkgs.sh DISTRO"
	echo "examples:"
	echo "  gerrit-binpkgs.sh debian:12"
	echo "  gerrit-binpkgs.sh almalinux:8"
	exit 1
fi

GIT_REPO_DIR="$(git rev-parse --show-toplevel 2>/dev/null || true)"
if [ -z "$GIT_REPO_DIR" ]; then
	echo "ERROR: run inside a git repository of an Osmocom project"
	exit 1
fi

CACHE_DIR="$SCRIPTS_OBS_DIR/_cache"
PROJECT_NAME="$(basename "$GIT_REPO_DIR")"

# Copy the source dir into the cache dir. It will be mounted inside the docker
# containers for building source and binary packages (so using a symlink does
# not work). Use rsync so it is very fast.
echo ":: Copying the source to the cache dir"
mkdir -p "$CACHE_DIR"
rsync -a --delete "$GIT_REPO_DIR" "$CACHE_DIR"

echo ":: Building the source package"
"$SCRIPTS_OBS_DIR"/build_srcpkg.py \
	--docker \
	--feed master \
	--git-skip-fetch \
	--git-skip-checkout \
	"$PROJECT_NAME"

echo ":: Building the binary packages"
"$SCRIPTS_OBS_DIR"/build_binpkg.py \
	--docker "$DISTRO" \
	"$PROJECT_NAME"