summaryrefslogtreecommitdiff
path: root/cron-jobs/sourceballs2
blob: e935f868782fb47934017f48b651dd3111918f10 (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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/bin/bash
# Steps
# Traverse ABSLibre
# Makepkg --allsource every package
# Remove the old sourceballs

dirname="$(dirname "$(readlink -e "$0")")"
. "${dirname}/../config"
. "${dirname}/../db-functions"
. "${MAKEPKGCONF}"

pushd "${WORKDIR}" >/dev/null

script_lock

# Adjust the nice level to run at a lower priority
renice +10 -p $$ > /dev/null

# Create a list of all available source package file names
find "${FTP_BASE}/${SRCPOOL}" -xtype f -name "*${SRCEXT}" -printf '%f\n' | sort -u > "${WORKDIR}/available-src-pkgs"

pushd "${SVNREPO}" >/dev/null

for repo in "${PKGREPOS[@]}"; do
	msg "Sourceballing [%s]" "${repo}"

	pushd "$repo" >/dev/null
	find -maxdepth 1 -type d | while read pkg; do
		pushd "${SVNREPO}/$repo/$pkg" >/dev/null

		[[ ! -e ./PKGBUILD ]] && {
			warning "%s is not a package" "$repo/$pkg"
			continue
		}

		# Unset the previous data
		unset pkgbase pkgname pkgver pkgrel
		source PKGBUILD

		unset build package url pkgdesc source md5sums depends makedepends \
			optdepends license arch options check mksource

		for _pkg in "${pkgname[@]}"; do
			unset "package_${_pkg}" >/dev/null 2>&1
		done

		pkgbase=${pkgbase:-$pkgname}
		srcfile="${pkgbase}-${pkgver}-${pkgrel}${SRCEXT}"

		echo "${srcfile}" >> "${WORKDIR}/expected-src-pkgs"

		# Skip already sourceballed
		[ -e "${SRCPKGDEST}/${srcfile}" ] && continue

		makepkg --allsource --ignorearch -c >/dev/null 2>&1

		[ $? -ne 0 ] && plain '%s' "${srcfile}"

	done # end find pkgs
	popd >/dev/null

done # end repos