summaryrefslogtreecommitdiff
path: root/db-update
diff options
context:
space:
mode:
Diffstat (limited to 'db-update')
-rwxr-xr-xdb-update38
1 files changed, 25 insertions, 13 deletions
diff --git a/db-update b/db-update
index 1fddb8a..8cf61fc 100755
--- a/db-update
+++ b/db-update
@@ -1,19 +1,26 @@
#!/bin/bash
-. "$(dirname $0)/db-functions"
-. "$(dirname $0)/config"
+. "$(dirname "$(readlink -e "$0")")/config"
+. "$(dirname "$(readlink -e "$0")")/db-functions"
if [ $# -ge 1 ]; then
- warning "Calling $(basename $0) with a specific repository is no longer supported"
+ warning "Calling ${0##*/} with a specific repository is no longer supported"
exit 1
fi
# Find repos with packages to release
-repos=($(find "${STAGING}" -mindepth 1 -maxdepth 1 -type d ! -empty -printf '%f ' 2>/dev/null))
+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
@@ -30,19 +37,24 @@ for repo in ${repos[@]}; do
fi
for pkg in ${pkgs[@]}; do
if [ -h "${pkg}" ]; then
- die "Package ${repo}/$(basename ${pkg}) is a symbolic link"
+ die "Package ${repo}/${pkg##*/} is a symbolic link"
fi
if ! check_pkgfile "${pkg}"; then
- die "Package ${repo}/$(basename ${pkg}) is not consistent with its meta data"
+ 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}/$(basename ${pkg}) already exists in another repository"
+ die "Package ${repo}/${pkg##*/} already exists in another repository"
fi
done
- # This is fucking obnoxious
- #if ! check_splitpkgs ${repo} ${pkgs[@]}; then
- # die "Missing split packages for ${repo}"
- #fi
+ if ! check_splitpkgs ${repo} ${pkgs[@]}; then
+ die "Missing split packages for ${repo}"
+ fi
else
die "Could not read ${STAGING}"
fi
@@ -55,7 +67,7 @@ for repo in ${repos[@]}; do
add_pkgs=()
arch_pkgs=($(getpkgfiles "${STAGING}/${repo}/"*-${pkgarch}${PKGEXT} 2>/dev/null))
for pkg in ${arch_pkgs[@]} ${any_pkgs[@]}; do
- pkgfile="$(basename ${pkg})"
+ pkgfile="${pkg##*/}"
msg2 "${pkgfile} (${pkgarch})"
# any packages might have been moved by the previous run
if [ -f "${pkg}" ]; then
@@ -69,7 +81,7 @@ for repo in ${repos[@]}; do
if [ -f "$FTP_BASE/${PKGPOOL}/${pkgfile}.sig" ]; then
ln -s "../../../${PKGPOOL}/${pkgfile}.sig" "$FTP_BASE/$repo/os/${pkgarch}"
fi
- add_pkgs[${#add_pkgs[*]}]=${pkgfile}
+ add_pkgs[${#add_pkgs[*]}]=${pkgfile}
done
if [ ${#add_pkgs[@]} -ge 1 ]; then
arch_repo_add "${repo}" "${pkgarch}" ${add_pkgs[@]}