index : builder | |
Archlinux32 build system | gitolite user |
summaryrefslogtreecommitdiff |
author | Erich Eckner <git@eckner.net> | 2018-01-31 10:40:35 +0100 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2018-01-31 10:40:35 +0100 |
commit | c310a56816bf44439b1ecc79d8e3b2cd099102a0 (patch) | |
tree | 0aa5ec4cb6a67ebbcb80fd37ef38f1b4bdfdf140 /bin/mysql-functions | |
parent | c2ce72f0fb3218ba977e257508dbe8d19e811e27 (diff) |
-rwxr-xr-x | bin/mysql-functions | 25 |
diff --git a/bin/mysql-functions b/bin/mysql-functions index 44ef851..ac39141 100755 --- a/bin/mysql-functions +++ b/bin/mysql-functions @@ -27,7 +27,25 @@ base64_encode_each() { # shellcheck disable=SC2086 mysql_add_package_source() { local names='pkgbase git_revision mod_git_revision upstream_package_repository' - local values; + local values + local uses_upstream + local uses_modification + + if git -C "${repo_paths__archlinux32}" archive "$3" -- "$4/$1" >/dev/null 2>&1; then + uses_modification=1 + else + uses_modification=0 + fi + uses_upstream=0 + for values in ${repo_names}; do + if eval 'git -C "${repo_paths__'"${values}"'}" 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 + fi + done + for _ in ${names}; do values="${values}$( printf '%s' "$1" | \ @@ -41,14 +59,15 @@ mysql_add_package_source() { printf 'INSERT IGNORE INTO package_sources' printf ' (' printf '`%s`, ' ${names} + printf '`uses_upstream`,`uses_modification`' printf ') SELECT' printf ' from_base64("%s"), ' ${values% *} - printf ' `upstream_repositories`.`id`' + printf ' `upstream_repositories`.`id`,%s,%s' \ + ${uses_upstream} ${uses_modification} printf ' FROM `upstream_repositories`' printf ' WHERE `upstream_repositories`.`name` = from_base64("%s");' \ "${values##* }" } | \ - sed 's|, )|)|g' | \ ${mysql_command} } |