summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2013-10-14 18:41:54 -0400
committerLuke Shumaker <LukeShu@sbcglobal.net>2013-10-14 18:41:54 -0400
commitce88f47d19cb11ebcc02565156deddc6b48df38c (patch)
tree86a35cf7cc0ba5a0c560b5f60f68ca0226b3a419
parent009438b0fffda67810927ee6655cfe112ac13a87 (diff)
db-sync: also generate ${repo}.files databases for imported repos
-rwxr-xr-xdb-sync26
1 files changed, 16 insertions, 10 deletions
diff --git a/db-sync b/db-sync
index 81dee24..684f7e6 100755
--- a/db-sync
+++ b/db-sync
@@ -26,6 +26,8 @@ get_repos() {
rsync ${extra} -mrtlH --no-p --include="*/" \
--include="*.db" \
--include="*${DBEXT}" \
+ --include="*.db" \
+ --include="*${FILESEXT}" \
--exclude="*" \
--delete-after \
rsync://${mirror}/${mirrorpath}/ ${TMPDIR}/$0.$$.cache
@@ -46,9 +48,7 @@ get_blacklist() {
# repo
# arch
get_repo_file() {
-# shopt -s nullglob
-
- echo "${TMPDIR}/$0.$$.cache/${1}/os/${2}/${1}${DBEXT}"
+ echo "${TMPDIR}/$0.$$.cache/${1}/os/${2}/${1}"
}
# Process the databases and get the libre packages
@@ -69,21 +69,27 @@ init() {
for _arch in ${ARCHARCHES[@]}; do
msg "Processing ${_repo}-${_arch}"
- repo_file=$(get_repo_file ${_repo} ${_arch})
+ db_file=$(get_repo_file ${_repo} ${_arch})${DBEXT}
+ files_file=$(get_repo_file ${_repo} ${_arch})${FILESEXT}
- if [ ! -f "${repo_file}" ]; then
- warning "${repo_file} doesn't exist, skipping this repo-arch"
+ if [ ! -f "${db_file}" ]; then
+ warning "%s doesn't exist, skipping this repo-arch" "${db_file}"
+ continue
+ fi
+ if [ ! -f "${files_file}" ]; then
+ warning "%s doesn't exist, skipping this repo-arch" "${files_file}"
continue
fi
# Remove blacklisted packages and count them
# TODO capture all removed packages for printing on debug mode
- msg2 "Removing blacklisted packages: $(
- LC_ALL=C repo-remove ${repo_file} ${blacklist[@]} 2>&1 | \
- grep "\-> Removing" 2>/dev/null| wc -l)"
+ msg2 "Removing blacklisted packages from .db database..."
+ LC_ALL=C repo-remove "${db_file}" "${blacklist[@]}"
+ msg2 "Removing blacklisted packages from .files database..."
+ LC_ALL=C repo-remove "${files_file}" "${blacklist[@]}"
# Get db contents
- db=($(get_repo_content ${repo_file}))
+ db=($(get_repo_content ${db_file}))
msg2 "Process clean db for syncing..."