summaryrefslogtreecommitdiffstats
path: root/scripts/firstrun/20-fedpkg
blob: 978e1cd1903373b8acf47a240fd575c7c64c8e96 (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
# vim:ft=sh:
source config
DESTROOT="${CFG_DIR_WRKSPC}"
PKGCMD=fedpkg
BUILDSYS=koji
POI=$(cat <<-EOF
	active/eot-utils
	closed/luci
	active/python-robofab
EOF
)

# grep: suppress also broken pipe message (?)
yum list installed | grep -qs ${PKGCMD} || su -c "yum install ${PKGCMD}"

mkdir -p "${DESTROOT}/g${BUILDSYS}"
pushd "${DESTROOT}/g${BUILDSYS}" >/dev/null

for pkg in ${POI}; do
	dname=$(dirname ${pkg})
	bname=$(basename ${pkg})
	mkdir -p ${dname}
	pushd ${dname} >/dev/null
	test -d ${bname} || ${PKGCMD} clone ${bname}
	cd ${bname}
	branch=$(${PKGCMD} switch-branch --list | tail -n2 | head -n1 | cut -d/ -f2)
	if [ "$(git rev-parse --abbrev-ref HEAD)" != "${BRANCH}" ]; then
		${PKGCMD} switch-branch ${branch}
		${PKGCMD} prep  # incl. downloading source
	fi
	popd >/dev/null
done

popd >/dev/null
unset local pkg bname dname branch
unset DESTROOT PKGCMD BUILDSYS POI