Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xlib/mysql-functions51
1 files changed, 11 insertions, 40 deletions
diff --git a/lib/mysql-functions b/lib/mysql-functions
index 8319580..438e498 100755
--- a/lib/mysql-functions
+++ b/lib/mysql-functions
@@ -107,31 +107,25 @@ mysql_run_query() {
"${query_stdout}"
}
-# mysql_add_package_source $pkgbase $git_revision $old_git_revision $mod_git_revision $upstream_package_repository $srcinfo_file
-# $old_git_revision may be empty, in which case the whole history will be searched (slower)
+# mysql_add_package_source $pkgbase $git_revision $mod_git_revision $upstream_package_repository $srcinfo_file
# shellcheck disable=SC2086
mysql_add_package_source() {
local pkgbase
local git_revision
- local old_git_revision
local mod_git_revision
local upstream_package_repository
local srcinfo_file
pkgbase="$1"
git_revision="$2"
- old_git_revision="${3:+$3..}"
- mod_git_revision="$4"
- upstream_package_repository="$5"
- srcinfo_file="$6"
+ mod_git_revision="$3"
+ upstream_package_repository="$4"
+ srcinfo_file="$5"
local uses_upstream
local uses_modification
local repo
- local repo_path
- local commit_time
- local pkgbuild
local upstream_package_repository_id
if grep -qx 'PKGBUILD_mod = \S\+' "${srcinfo_file}"; then
@@ -141,28 +135,8 @@ mysql_add_package_source() {
fi
if grep -qx 'PKGBUILD = \S\+' "${srcinfo_file}"; then
uses_upstream=1
- eval 'repo_path="${repo_paths__'"$(sed -n 's/^upstream_git_repository = //;T;p' "${srcinfo_file}")"'}"'
- pkgbuild=$(
- sed -n '
- s/^PKGBUILD = //
- T
- p
- ' "${srcinfo_file}"
- )
- # TODO: This is slow and blocks, but is not important enough to
- # block the whole buildmaster -> Make it asynchronous!
- commit_time=$(
- git -C "${repo_path}" log -n 1 --pretty=format:%ct "${old_git_revision}${git_revision}" -- "${pkgbuild}"
- )
- if [ -z "${commit_time}" ]; then
- # We may have modified git_mod_revision!
- commit_time=$(
- git -C "${repo_path}" log -n 1 --pretty=format:%ct "${git_revision}" -- "${pkgbuild}"
- )
- fi
else
uses_upstream=0
- commit_time=$(date '+%s')
fi
upstream_package_repository_id=$(
@@ -187,7 +161,7 @@ mysql_add_package_source() {
{
printf 'INSERT INTO `package_sources`'
- printf ' (`pkgbase`,`git_revision`,`mod_git_revision`,`upstream_package_repository`,`uses_upstream`,`uses_modification`,`commit_time`)'
+ printf ' (`pkgbase`,`git_revision`,`mod_git_revision`,`upstream_package_repository`,`uses_upstream`,`uses_modification`)'
printf ' VALUES ('
printf 'from_base64("%s"),' \
"$(
@@ -205,19 +179,17 @@ mysql_add_package_source() {
printf '%s,' \
"${upstream_package_repository_id}" \
"${uses_upstream}" \
- "${uses_modification}"
- printf 'from_unixtime(%s))' \
- "${commit_time}"
+ "${uses_modification}" | \
+ sed 's/,$/)/'
printf ' ON DUPLICATE KEY UPDATE `id`=LAST_INSERT_ID(`package_sources`.`id`);\n'
printf 'SELECT LAST_INSERT_ID();\n'
} | \
mysql_run_query
}
-# mysql_generate_package_metadata $current_repository_id $package $git_revision $old_git_revision $mod_git_revision $repository
+# mysql_generate_package_metadata $current_repository_id $package $git_revision $mod_git_revision $repository
# 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() {
@@ -227,9 +199,8 @@ mysql_generate_package_metadata() {
current_repository_id="$1"
package="$2"
git_revision="$3"
- old_git_revision="$4"
- mod_git_revision="$5"
- repository="$6"
+ mod_git_revision="$4"
+ repository="$5"
if [[ "${current_repository_id}" = *[!0-9]* ]]; then
>&2 printf 'mysql_generate_package_metadata(): invalid current_repository_id="%s".\n' \
@@ -270,7 +241,7 @@ mysql_generate_package_metadata() {
# add the package source
package_source_id=$(
- mysql_add_package_source "${pkgbase}" "${git_revision}" "${old_git_revision}" "${mod_git_revision}" "${repository}" "${temp_dir}/SRCINFO"
+ mysql_add_package_source "${pkgbase}" "${git_revision}" "${mod_git_revision}" "${repository}" "${temp_dir}/SRCINFO"
)
{