blob: c4bd33b65d3b13ff62f9e1568c31a3f1c732f9f9 (
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
|
#!/bin/bash
. "$(dirname "$(readlink -e "$0")")/config"
. "$(dirname "$(readlink -e "$0")")/db-functions"
if [ $# -ge 1 ]; then
warning "Calling ${0##*/} with a specific repository is no longer supported"
exit 1
fi
# Find repos with packages to release
staging_repos=($(find "${STAGING}" -mindepth 1 -type f -name "*${PKGEXT}" -printf '%h\n' | sort -u))
if [ $? -ge 1 ]; then
die "Could not read ${STAGING}"
fi
repos=()
for staging_repo in ${staging_repos[@]##*/}; do
if in_array "${staging_repo}" "${PKGREPOS[@]}"; then
repos+=("${staging_repo}")
fi
done
# TODO: this might lock too much (architectures)
for repo in "${repos[@]}"; do
for pkgarch in "${ARCHES[@]}"; do
repo_lock ${repo} ${pkgarch} || exit 1
done
done
# check if packages are valid
for repo in "${repos[@]}"; do
pkgs=($(getpkgfiles "${STAGING}/${repo}/"*${PKGEXT}))
if [ $? -eq 0 ]; then
if [ ${#pkgs[@]} -gt 0 ] && ! check_repo_permission "${repo}"; then
die "You don't have permission to update packages in ${repo}"
fi
for pkg in "${pkgs[@]}"; do
if [ -h "${pkg}" ]; then
die "Package ${repo}/${pkg##*/} is a symbolic link"
fi
if ! check_pkgfile "${pkg}"; then
die "Package ${repo}/${pkg##*/} is not consistent with its meta data"
fi
if ${REQUIRE_SIGNATURE} && ! pacman-key -v "${pkg}.sig" >/dev/null 2>&1; then
die "Package ${repo}/${pkg##*/} does not have a valid signature"
fi
if ! check_pkgxbs "${pkg}" "${repo}"; then
die "Package ${repo}/${pkg##*/} is not consistent with xbs"
fi
if ! check_pkgrepos "${pkg}"; then
die "Package ${repo}/${pkg##*/} already exists in another repository"
fi
done
if ! check_splitpkgs ${repo} ${pkgs[@]}; then
die "Missing split packages for ${repo}"
fi
else
die "Could not read ${STAGING}"
fi
done
for repo in "${repos[@]}"; do
msg "Updating [${repo}]..."
any_pkgs=($(getpkgfiles "${STAGING}/${repo}/"*-any${PKGEXT} 2>/dev/null))
for pkgarch in "${ARCHES[@]}"; do
add_pkgs=()
arch_pkgs=($(getpkgfiles "${STAGING}/${repo}/"*-${pkgarch}${PKGEXT} 2>/dev/null))
for pkg in "${arch_pkgs[@]}" "${any_pkgs[@]}"; do
pkgfile="${pkg##*/}"
msg2 "${pkgfile} (${pkgarch})"
# any packages might have been moved by the previous run
if [ -f "${pkg}" ]; then
mv "${pkg}" "$FTP_BASE/${PKGPOOL}"
fi
ln -s "../../../${PKGPOOL}/${pkgfile}" "$FTP_BASE/$repo/os/${pkgarch}"
# also move signatures
if [ -f "${pkg}.sig" ]; then
mv "${pkg}.sig" "$FTP_BASE/${PKGPOOL}"
fi
if [ -f "$FTP_BASE/${PKGPOOL}/${pkgfile}.sig" ]; then
ln -s "../../../${PKGPOOL}/${pkgfile}.sig" "$FTP_BASE/$repo/os/${pkgarch}"
fi
add_pkgs+=("${pkgfile}")
done
if [ ${#add_pkgs[@]} -ge 1 ]; then
arch_repo_add "${repo}" "${pkgarch}" "${add_pkgs[@]}"
fi
done
done
for repo in "${repos[@]}"; do
for pkgarch in "${ARCHES[@]}"; do
repo_unlock ${repo} ${pkgarch}
done
done
cd "${STAGING}"
while read -r file; do
pub="${FTP_BASE}/${file}"
if [[ -f $pub ]]; then
warning "file already exists: %s" "${file}"
else
mkdir -p -- "${pub%/*}"
mv -vn "$file" "$pub"
fi
done < <(find other sources -type f)
|