diff options
author | Erich Eckner <git@eckner.net> | 2018-04-04 15:04:57 +0200 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2018-04-04 15:04:57 +0200 |
commit | 4373d24cb27dcafcbb43af4ef24eb6ae1957aa39 (patch) | |
tree | 9d857f94e62fa16d1ff103601511cc5e4c2ed39b /lib | |
parent | 632513b74765481788ac7405bf28da24b8ae9ed5 (diff) | |
download | builder-4373d24cb27dcafcbb43af4ef24eb6ae1957aa39.tar.xz |
lib/mysql-functions: mysql_add_package_source: save time of commit, too
Diffstat (limited to 'lib')
-rwxr-xr-x | lib/mysql-functions | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/lib/mysql-functions b/lib/mysql-functions index a1e5a64..6ea3c4e 100755 --- a/lib/mysql-functions +++ b/lib/mysql-functions @@ -80,6 +80,8 @@ mysql_add_package_source() { local uses_upstream local uses_modification local repo + local repo_path + local commit_time if git -C "${repo_paths__archlinux32}" archive "$3" -- "$4/$1" >/dev/null 2>&1; then uses_modification=1 @@ -87,15 +89,20 @@ mysql_add_package_source() { uses_modification=0 fi uses_upstream=0 + commit_time=$(date '+%s') for repo in ${repo_names}; do if [ "${repo}" = 'archlinux32' ]; then continue fi - if eval 'git -C "${repo_paths__'"${repo}"'}" archive "$2" -- "$1/repos/$4-*/PKGBUILD" 2>/dev/null' | \ + eval 'repo_path="${repo_paths__'"${repo}"'}"' + if git -C "${repo_path}" archive "$2" -- "$1/repos/$4-*/PKGBUILD" 2>/dev/null | \ tar -t 2>/dev/null | \ sed 's,-x86_64/,-any/,' | \ 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" + ) fi done @@ -112,11 +119,11 @@ mysql_add_package_source() { printf 'INSERT IGNORE INTO package_sources' printf ' (' printf '`%s`, ' ${names} - printf '`uses_upstream`,`uses_modification`' + printf '`uses_upstream`,`uses_modification`,`commit_time`' printf ') SELECT' printf ' from_base64("%s"), ' ${values% *} - printf ' `upstream_repositories`.`id`,%s,%s' \ - ${uses_upstream} ${uses_modification} + printf ' `upstream_repositories`.`id`,%s,%s,from_unixtime(%s)' \ + "${uses_upstream}" "${uses_modification}" "${commit_time}" printf ' FROM `upstream_repositories`' printf ' WHERE `upstream_repositories`.`name` = from_base64("%s");' \ "${values##* }" |