summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbin/get-package-updates17
-rwxr-xr-xbin/seed-build-list2
-rwxr-xr-xlib/mysql-functions53
3 files changed, 34 insertions, 38 deletions
diff --git a/bin/get-package-updates b/bin/get-package-updates
index 3ae3602..5ff592f 100755
--- a/bin/get-package-updates
+++ b/bin/get-package-updates
@@ -211,19 +211,21 @@ for repo in ${repo_names}; do
# shellcheck disable=SC2016
sed 's|^\(.\t\)\([^/]\+\)/\([^/]\+\)/\(.\+\)$|\2 \1\3/repos/\2-x86_64/\4|' | \
while read -r pkg_repo rest; do
- eval 'printf '"'"'%s %s\n'"'" \
- "$(printf '"${new_repo_revisions__%s}"' "$(find_git_repository_to_package_repository "${pkg_repo}")")" \
+ repo=$(find_git_repository_to_package_repository "${pkg_repo}")
+ eval 'printf '"'"'%s %s %s\n'"'" \
+ "$(printf '"${new_repo_revisions__%s}"' "${repo}")" \
+ "$(printf '"${old_repo_revisions__%s}"' "${repo}")" \
"'${rest}'"
done
else
- sed "s|^|${new_repo_revision} |"
+ sed "s|^|${new_repo_revision} ${old_repo_revision} |"
fi | \
- grep '^\S\+ .\s[^/]\+/repos/[^/]\+/PKGBUILD$' | \
+ grep '^\S\+ \S\+ .\s[^/]\+/repos/[^/]\+/PKGBUILD$' | \
# ignore i686
grep -v -- '-i686/PKGBUILD$' | \
# ignore staging and testing
grep -v -- '[-/]\(staging\|testing\|unstable\)-[^/]\+/PKGBUILD$' | \
- sed 's|^\(\S\+\) \(.\)\t\([^/]\+\)/repos/\([^/]\+\)-[^/-]\+/PKGBUILD$|\2 \3 \1 \4|'
+ sed 's|^\(\S\+ \S\+\) \(.\)\t\([^/]\+\)/repos/\([^/]\+\)-[^/-]\+/PKGBUILD$|\2 \3 \1 \4|'
done | \
sort -u | \
sed '
@@ -235,11 +237,12 @@ done | \
' | \
sort -k1,1 | \
sed 's|^[012] ||' | \
- while read -r mode package git_revision repository; do
+ while read -r mode package git_revision old_git_revision repository; do
if [ "${mode}" = 'D' ]; then
# deleted PKGBUILD
# shellcheck disable=SC2154
git_revision="${new_repo_revisions__archlinux32}"
+ old_git_revision=''
found_package=false
for repository in ${repo_names}; do
eval 'repo_path="${repo_paths__'"${repository}"'}"'
@@ -305,7 +308,7 @@ done | \
mysql_run_query
# shellcheck disable=SC2154
printf '%s ' "${package}" "${git_revision}" "${new_repo_revisions__archlinux32}" "${repository}" >&2
- mysql_generate_package_metadata 'to-be-decided' "${package}" "${git_revision}" "${new_repo_revisions__archlinux32}" "${repository}"
+ mysql_generate_package_metadata 'to-be-decided' "${package}" "${git_revision}" "${old_git_revision}" "${new_repo_revisions__archlinux32}" "${repository}"
printf '\n' >&2
continue
fi
diff --git a/bin/seed-build-list b/bin/seed-build-list
index a4c1097..3a808b6 100755
--- a/bin/seed-build-list
+++ b/bin/seed-build-list
@@ -373,7 +373,7 @@ printf 'CREATE TEMPORARY TABLE `pkgbases` (`pkgbase` VARCHAR(64), `repository` V
printf '%s ' "${pkgbase}" "${git_rev}" "${mod_git_rev}" "${repo}" >&2
printf '%s ' "${pkgbase}" "${git_rev}" "${mod_git_rev}" "${repo}" | \
sed 's/ $/\n/'
- mysql_generate_package_metadata 'build-list' "${pkgbase}" "${git_rev}" "${mod_git_rev}" "${repo}"
+ mysql_generate_package_metadata 'build-list' "${pkgbase}" "${git_rev}" '' "${mod_git_rev}" "${repo}"
printf '\n' >&2
done
diff --git a/lib/mysql-functions b/lib/mysql-functions
index 6ea3c4e..064edcd 100755
--- a/lib/mysql-functions
+++ b/lib/mysql-functions
@@ -71,11 +71,13 @@ mysql_run_query() {
rm "${query_stdout}"
}
-# mysql_add_package_source $pkgbase $git_revision $mod_git_revision $upstream_package_repository
+# mysql_add_package_source $pkgbase $git_revision $old_git_revision $mod_git_revision $upstream_package_repository
+# $old_git_revision may be empty, in which case the whole history will be searched (slower)
# shellcheck disable=SC2086
mysql_add_package_source() {
- local names='pkgbase git_revision mod_git_revision upstream_package_repository'
+ local names='pkgbase git_revision old_git_revision mod_git_revision upstream_package_repository'
+ local name
local values
local uses_upstream
local uses_modification
@@ -101,19 +103,23 @@ mysql_add_package_source() {
grep -qFx "$1/repos/$4-any/PKGBUILD"; then
uses_upstream=1
commit_time=$(
- git -C "${repo_path}" log -n 1 --pretty=format:%ct "$2" -- "$1/repos/$4-*/PKGBUILD"
+ git -C "${repo_path}" log -n 1 --pretty=format:%ct "${3:+$3..}$2" -- "$1/repos/$4-*/PKGBUILD"
)
+ break
fi
done
- for _ in ${names}; do
- values="${values}$(
- printf '%s' "$1" | \
- base64 -w0
- ) "
+ for name in ${names}; do
+ if [ ! "${name}" = 'old_git_revision' ]; then
+ values="${values}$(
+ printf '%s' "$1" | \
+ base64 -w0
+ ) "
+ fi
shift
done
- values="${values% }"
+ values="${values% * }"
+ names="${names% *}"
{
printf 'INSERT IGNORE INTO package_sources'
@@ -180,17 +186,14 @@ mysql_show_binary_package() {
mysql_run_query --html --column-names
}
-# mysql_generate_package_metadata $current_repository $package $git_revision $mod_git_revision $repository
-# or
-# mysql_generate_package_metadata $current_repository $package.$git_revision.$mod_git_revision.$repository
+# mysql_generate_package_metadata $current_repository $package $git_revision $old_git_revision $mod_git_revision $repository
# if sub_pkgrel should be determined automatically
# and
-# mysql_generate_package_metadata $sub_pkgrel $current_repository $package $git_revision $mod_git_revision $repository
-# or
-# mysql_generate_package_metadata $sub_pkgrel $current_repository $package.$git_revision.$mod_git_revision.$repository
+# mysql_generate_package_metadata $sub_pkgrel $current_repository $package $git_revision $old_git_revision $mod_git_revision $repository
# if $sub_pkgrel should be forced
# generate the meta data of a package (dependencies, built packages, ...) in the database
+# $old_git_revision may be empty, in which case the whole history will be searched (slower)
mysql_generate_package_metadata() {
@@ -209,20 +212,10 @@ mysql_generate_package_metadata() {
esac
current_repository="$1"
package="$2"
-
- if [ $# -eq 2 ]; then
- # second form
- repository="${package##*.}"
- package="${package%.*}"
- mod_git_revision="${package##*.}"
- package="${package%.*}"
- git_revision="${package##*.}"
- package="${package%.*}"
- else
- git_revision="$3"
- mod_git_revision="$4"
- repository="$5"
- fi
+ git_revision="$3"
+ old_git_revision="$4"
+ mod_git_revision="$5"
+ repository="$6"
temp_dir=$(mktemp -d 'tmp.mysql-functions.mysql_generate_package_metadata.XXXXXXXXXX' --tmpdir)
trap 'rm -rf --one-file-system "${temp_dir}"' EXIT
@@ -257,7 +250,7 @@ mysql_generate_package_metadata() {
fi
# add the package source
- mysql_add_package_source "${pkgbase}" "${git_revision}" "${mod_git_revision}" "${repository}"
+ mysql_add_package_source "${pkgbase}" "${git_revision}" "${old_git_revision}" "${mod_git_revision}" "${repository}"
printf '.' >&2
# now we encode everything in base64