index : builder | |
Archlinux32 build system | gitolite user |
summaryrefslogtreecommitdiff |
author | Erich Eckner <git@eckner.net> | 2023-05-23 19:48:25 +0200 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2023-05-23 19:48:25 +0200 |
commit | bb5923cf4f2b494723e8de820273d5fb029cde94 (patch) | |
tree | eff85875684eebb665de560c078ba16ef8586950 /lib | |
parent | 54fed084ba0855d6fe6b223669d3ccff420fbf17 (diff) |
-rwxr-xr-x | lib/common-functions | 41 |
diff --git a/lib/common-functions b/lib/common-functions index b6b9095..b0bb362 100755 --- a/lib/common-functions +++ b/lib/common-functions @@ -458,20 +458,9 @@ extract_source_directory() { if [ -n "${revision}" ] \ && [ "${revision}" != '0000000000000000000000000000000000000000' ]; then local pkgbase_translated - for substitution in '' 's@+@plus@g' 's@+@-@g' 's@^tree$@unix-tree@'; do - pkgbase_translated=$( - printf '%s\n' "${pkgbase}" \ - | sed "${substitution}" - ) - curl -LSs "https://buildmaster.archlinux32.org/upstream-packages/${pkgbase_translated}-${revision}.tar.gz" \ - | tar -xz --strip-components=1 -C "${output}" -- "${pkgbase_translated}-${revision}" 2>/dev/null \ - && break - done - if [ ! -f "${output}/PKGBUILD" ]; then - >&2 printf 'failed to download/extract a PKGBUILD from upstream archlinux for %s %s\n' \ - "${pkgbase}" "${revision}" - exit 1 - fi + pkgbase_translated=$(gitlab_project_name_to_path "${pkgbase}") + curl -LSs "https://buildmaster.archlinux32.org/upstream-packages/${pkgbase_translated}-${revision}.tar.gz" \ + | tar -xz --strip-components=1 -C "${output}" -- "${pkgbase_translated}-${revision}" printf '\n' >> \ "${output}/PKGBUILD" fi @@ -1035,3 +1024,27 @@ expand_blacklist_architectures() { | sort -u rm "$1" } + +# taken verbatim from upstream archlinux: +# https://gitlab.archlinux.org/archlinux/devtools/-/raw/master/src/lib/api/gitlab.sh + +# Convert arbitrary project names to GitLab valid path names. +# +# GitLab has several limitations on project and group names and also maintains +# a list of reserved keywords as documented on their docs. +# https://docs.gitlab.com/ee/user/reserved_names.html +# +# 1. replace single '+' between word boundaries with '-' +# 2. replace any other '+' with literal 'plus' +# 3. replace any special chars other than '_', '-' and '.' with '-' +# 4. replace consecutive '_-' chars with a single '-' +# 5. replace 'tree' with 'unix-tree' due to GitLab reserved keyword +gitlab_project_name_to_path() { + local name=$1 + printf "%s" "${name}" \ + | sed -E 's/([a-zA-Z0-9]+)\+([a-zA-Z]+)/\1-\2/g' \ + | sed -E 's/\+/plus/g' \ + | sed -E 's/[^a-zA-Z0-9_\-\.]/-/g' \ + | sed -E 's/[_\-]{2,}/-/g' \ + | sed -E 's/^tree$/unix-tree/g' +} |