Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rwxr-xr-xbin/db-update72
1 files changed, 36 insertions, 36 deletions
diff --git a/bin/db-update b/bin/db-update
index 4808f2b..55c32db 100755
--- a/bin/db-update
+++ b/bin/db-update
@@ -12,11 +12,6 @@
# TODO: we should delete more packages than just the ones in repositories
# where we move to (think of [extra] -> [community])
-# TODO: enable separate repositories for each architecture
-
-# TODO: operate on `binary_packages_in_repositories` instead of
-# `binary_packages`
-
# shellcheck disable=SC2039,SC2119,SC2120
# shellcheck source=../lib/load-configuration
@@ -255,22 +250,26 @@ for source_stability in \
printf ' FROM `replaced_bpir`'
printf ' JOIN `binary_packages_in_repositories` ON `replaced_bpir`.`id`=`binary_packages_in_repositories`.`id`;\n'
- printf 'SELECT "repositories",`repositories`.`name`'
- printf ' FROM `repositories`'
- printf ' JOIN `rps` ON `rps`.`id`=`repositories`.`id`;\n'
+ printf 'SELECT "repositories",`architectures`.`name`,`repositories`.`name`'
+ printf ' FROM `rps`'
+ printf ' JOIN `repositories` ON `rps`.`id`=`repositories`.`id`'
+ mysql_join_repositories_architectures
+ printf ';\n'
printf 'SELECT "mv.id",`moveable_bpir`.`id`,`moveable_bpir`.`to_repository`'
printf ' FROM `moveable_bpir`;\n'
printf 'SELECT "mv",'
mysql_package_name_query
- printf ',`repositories`.`name`,`new_repo`.`name`'
+ printf ',`r_a`.`name`,`repositories`.`name`,`new_r_a`.`name`,`new_repo`.`name`'
printf ' FROM `moveable_bpir`'
printf ' JOIN `binary_packages_in_repositories` ON `moveable_bpir`.`id`=`binary_packages_in_repositories`.`id`'
mysql_join_binary_packages_in_repositories_binary_packages
mysql_join_binary_packages_in_repositories_repositories
mysql_join_binary_packages_architectures
+ mysql_join_repositories_architectures '' 'r_a'
printf ' JOIN `repositories` AS `new_repo` ON `new_repo`.`id`=`moveable_bpir`.`to_repository`'
+ mysql_join_repositories_architectures 'new_repo' 'new_r_a'
printf ';\n'
printf 'SELECT "rm.id",`replaced_bpir`.`id`'
@@ -278,12 +277,13 @@ for source_stability in \
printf 'SELECT "rm",'
mysql_package_name_query
- printf ',`repositories`.`name`'
+ printf ',`r_a`.`name`,`repositories`.`name`'
printf ' FROM `replaced_bpir`'
printf ' JOIN `binary_packages_in_repositories` ON `replaced_bpir`.`id`=`binary_packages_in_repositories`.`id`'
mysql_join_binary_packages_in_repositories_binary_packages
mysql_join_binary_packages_in_repositories_repositories
mysql_join_binary_packages_architectures
+ mysql_join_repositories_architectures '' 'r_a'
printf ';\n'
} | \
mysql_run_query | \
@@ -313,14 +313,14 @@ for source_stability in \
# receive the repository databases from the master mirror
mkdir "${tmp_dir}/dbs"
- while read -r repo; do
- mkdir "${tmp_dir}/dbs/${repo}"
+ while read -r arch repo; do
+ mkdir -p "${tmp_dir}/dbs/${arch}/${repo}"
# shellcheck disable=SC2086
${master_mirror_rsync_command} \
- "${master_mirror_rsync_directory}/i686/${repo}/${repo}.db."* \
- "${master_mirror_rsync_directory}/i686/${repo}/${repo}.files."* \
- "${tmp_dir}/dbs/${repo}/"
- tar -Oxzf "${tmp_dir}/dbs/${repo}/${repo}.db.tar.gz" --wildcards '*/desc' | \
+ "${master_mirror_rsync_directory}/${arch}/${repo}/${repo}.db."* \
+ "${master_mirror_rsync_directory}/${arch}/${repo}/${repo}.files."* \
+ "${tmp_dir}/dbs/${arch}/${repo}/"
+ tar -Oxzf "${tmp_dir}/dbs/${arch}/${repo}/${repo}.db.tar.gz" --wildcards '*/desc' | \
sed -n '
/^%FILENAME%$/{
N
@@ -341,42 +341,42 @@ for source_stability in \
# remove to-be-deleted packages
# shellcheck disable=SC2094
- cut -d' ' -f2 < \
+ cut -d' ' -f2,3 < \
"${tmp_dir}/rm" | \
sort -u | \
- while read -r repo; do
- grep " $(str_to_regex "${repo}")\$" "${tmp_dir}/rm" | \
+ while read -r arch repo; do
+ grep " $(str_to_regex "${arch} ${repo}")\$" "${tmp_dir}/rm" | \
sed '
- s/\(-[^-]\+\)\{3\} \S\+$//
+ s/\(-[^-]\+\)\{3\} \S\+ \S\+$//
' | \
- xargs -r repo-remove -q "${tmp_dir}/dbs/${repo}/${repo}.db.tar.gz"
+ xargs -r repo-remove -q "${tmp_dir}/dbs/${arch}/${repo}/${repo}.db.tar.gz"
done
# copy and delete moved packages
# shellcheck disable=SC2094
- cut -d' ' -f2,3 < \
+ cut -d' ' -f2,3,4,5 < \
"${tmp_dir}/mv" | \
sort -u | \
- while read -r from_repo to_repo; do
- grep " $(str_to_regex "${from_repo}") $(str_to_regex "${to_repo}")\$" "${tmp_dir}/mv" | \
+ while read -r from_arch from_repo to_arch to_repo; do
+ grep " $(str_to_regex "${from_arch} ${from_repo} ${to_arch} ${to_repo}")\$" "${tmp_dir}/mv" | \
sed '
- s/-[^-]\+ \S\+ \S\+$//
+ s/-[^-]\+\( \S\+\)\{4\}$//
' | \
xargs -r "${base_dir}/bin/repo-copy" \
- "${tmp_dir}/dbs/${from_repo}/${from_repo}.db.tar.gz" \
- "${tmp_dir}/dbs/${to_repo}/${to_repo}.db.tar.gz"
- grep " $(str_to_regex "${from_repo}") $(str_to_regex "${to_repo}")\$" "${tmp_dir}/mv" | \
+ "${tmp_dir}/dbs/${from_arch}/${from_repo}/${from_repo}.db.tar.gz" \
+ "${tmp_dir}/dbs/${to_arch}/${to_repo}/${to_repo}.db.tar.gz"
+ grep " $(str_to_regex "${from_arch} ${from_repo} ${to_arch} ${to_repo}")\$" "${tmp_dir}/mv" | \
sed '
- s/\(-[^-]\+\)\{3\} \S\+ \S\+$//
+ s/\(-[^-]\+\)\{3\}\( \S\+\)\{4\}$//
' | \
xargs -r repo-remove -q \
- "${tmp_dir}/dbs/${from_repo}/${from_repo}.db.tar.gz"
+ "${tmp_dir}/dbs/${from_arch}/${from_repo}/${from_repo}.db.tar.gz"
done
# create real file names of packages, because
# mysql_query_and_delete_unneeded_binary_packages does so, too
sed -i '
- s,^\(\S\+\) \(\S\+\)$,i686/\2/\1,
+ s,^\(\S\+\) \(\S\+\) \(\S\+\)$,\2/\3/\1,
' "${tmp_dir}/rm"
# shellcheck disable=SC2016
@@ -408,7 +408,7 @@ for source_stability in \
s/"$/.sig"/
' "${tmp_dir}/rm"
sed '
- s,^\(\S\+\) \(\S\+\) \(\S\+\)$,rename "i686/\2/\1" "i686/\3/\1"\nrename "i686/\2/\1.sig" "i686/\3/\1.sig",
+ s,^\(\S\+\) \(\S\+\) \(\S\+\) \(\S\+\) \(\S\+\)$,rename "\2/\3/\1" "\4/\5/\1"\nrename "\2/\3/\1.sig" "\4/\5/\1.sig",
' "${tmp_dir}/mv"
echo 'quit'
} | \
@@ -423,12 +423,12 @@ for source_stability in \
fi
# and push our local *.db.tar.gz via rsync
- while read -r repo; do
+ while read -r arch repo; do
# shellcheck disable=SC2086
${master_mirror_rsync_command} \
- "${tmp_dir}/dbs/${repo}/${repo}.db."* \
- "${tmp_dir}/dbs/${repo}/${repo}.files."* \
- "${master_mirror_rsync_directory}/i686/${repo}/"
+ "${tmp_dir}/dbs/${arch}/${repo}/${repo}.db."* \
+ "${tmp_dir}/dbs/${arch}/${repo}/${repo}.files."* \
+ "${master_mirror_rsync_directory}/${arch}/${repo}/"
done < \
"${tmp_dir}/repositories"