Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2023-05-20 15:59:15 +0200
committerErich Eckner <git@eckner.net>2023-05-20 15:59:15 +0200
commit9fe27ef5cfd1d6458ca2af84a2e1dd1ae558fea6 (patch)
tree9137239dc229538056fa22c747855e9ae9c6c982 /lib
parent82f9063ea0b5855603a516def56ce1b41f62909e (diff)
lib/common-functions: remove unneeded functions
* this breaks everything * everything was broken anyways
Diffstat (limited to 'lib')
-rwxr-xr-xlib/common-functions160
1 files changed, 23 insertions, 137 deletions
diff --git a/lib/common-functions b/lib/common-functions
index cecd27f..19d608c 100755
--- a/lib/common-functions
+++ b/lib/common-functions
@@ -9,109 +9,6 @@ if [ -z "${base_dir}" ]; then
. '../lib/load-configuration'
fi
-# find_pkgbuilds package repository git_repository git_revision mod_git_revision
-# find the PKGBUILD and modification of $package from $repository
-# sets $PKGBUILD and $PKGBUILD_mod
-
-find_pkgbuilds() {
-
- local package="$1"
- local repository="$2"
- local git_repository="$3"
- local git_revision="$4"
- local mod_git_revision="$5"
-
- local repo_path
- eval 'repo_path="${repo_paths__'"${git_repository}"'}"'
-
- if [ ! "$(git -C "${repo_path}" cat-file -t "${git_revision}" 2> /dev/null)" = "commit" ]; then
- >&2 printf 'Repository %s does not contain commit %s, but it should.\n' \
- "${git_repository}" \
- "${git_revision}"
- return 2
- fi
-
- if [ ! "$(git -C "${repo_paths__archlinux32}" cat-file -t "${mod_git_revision}" 2> /dev/null)" = "commit" ]; then
- >&2 printf 'Repository archlinux32 does not contain commit %s, but it should.\n' \
- "${mod_git_revision}"
- return 2
- fi
-
- PKGBUILD=$(
- git -C "${repo_path}" archive "${git_revision}" -- "${package}/repos/${repository}-*/PKGBUILD" 2> /dev/null | \
- tar -t 2> /dev/null | \
- grep -- '/PKGBUILD$' | \
- grep -v -- '-i686/PKGBUILD$' | \
- grep -v -- '[-/]\(staging\|testing\|unstable\)-[^/]\+/PKGBUILD$' | \
- sort | \
- tail -n1
- )
-
- PKGBUILD_mod=$(
- git -C "${repo_paths__archlinux32}" archive "${mod_git_revision}" -- "${repository}/${package}/PKGBUILD" 2> /dev/null | \
- tar -t "${repository}/${package}/PKGBUILD" 2> /dev/null
- ) || true
-
- if [ -z "${PKGBUILD}" ] && \
- [ -z "${PKGBUILD_mod}" ]; then
- >&2 printf 'Neither PKGBUILD nor modification of PKGBUILD found for package "%s" from %s (%s), revisions %s and %s.\n' \
- "${package}" \
- "${repository}" \
- "${git_repository}" \
- "${git_revision}" \
- "${mod_git_revision}"
- return 1
- fi
-
-}
-
-# find_repository_with_commit commit
-# find the repository which has $commit
-
-find_repository_with_commit() {
-
- local repository
-
- for repository in ${repo_names}; do
- # shellcheck disable=SC2016
- if [ "$(eval git -C "$(printf '"${repo_paths__%s}"' "${repository}")" cat-file -t '"$1"' 2> /dev/null)" = "commit" ]; then
- echo "${repository}"
- return 0
- fi
- done
- >&2 printf 'find_repository_with_commit: Cannot find repository with commit "%s"\n' "$1"
- return 2
-
-}
-
-# find_git_repository_to_package_repository repository
-# find the git repository which tracks the package repository $repository
-
-find_git_repository_to_package_repository() {
-
- local repository
-
- repository=$(
- # shellcheck disable=SC2016
- {
- printf 'SELECT `git_repositories`.`name`'
- printf ' FROM `git_repositories`'
- mysql_join_git_repositories_upstream_repositories
- printf ' WHERE `upstream_repositories`.`name`=from_base64("%s");\n' \
- "$(printf '%s' "$1" | base64 -w0)"
- } | \
- mysql_run_query
- )
- if [ -z "${repository}" ]; then
- >&2 echo "can't find git repository with package repository '$1'"
- exit 1
- else
- echo "${repository}"
- return 0
- fi
-
-}
-
# ls_master_mirror $path
# list content of $path on the master mirror (via rsync)
@@ -315,19 +212,6 @@ make_source_info() {
local mod_git_revision="$4"
local output="$5"
- local git_repo
- local PKGBUILD
- local PKGBUILD_mod
-
- if ! git_repo=$(find_repository_with_commit "${git_revision}") || \
- [ -z "${git_repo}" ]; then
- return 1
- fi
-
- if ! find_pkgbuilds "${package}" "${repository}" "${git_repo}" "${git_revision}" "${mod_git_revision}"; then
- return 1
- fi
-
( # the new shell is intentional
local epoch
@@ -336,12 +220,11 @@ make_source_info() {
tmp_dir=$(mktemp -d "${work_dir}/tmp.make_source_info.XXXXXX")
trap 'rm -rf --one-file-system "${tmp_dir}"' EXIT
- extract_source_directory "${git_repo}" "${git_revision}" "${mod_git_revision}" "${tmp_dir}" '0'
+ extract_source_directory "${package}" "${repository}" "${git_revision}" "${mod_git_revision}" "${tmp_dir}" '0'
{
cd "${tmp_dir}"
# some additional info
- printf 'upstream_git_repository = %s\n' "${git_repo}"
printf 'PKGBUILD = %s\n' "${PKGBUILD}"
printf 'PKGBUILD_mod = %s\n' "${PKGBUILD_mod}"
makepkg --printsrcinfo
@@ -561,35 +444,38 @@ find_package_repository_to_package() {
}
-# extract_source_directory $git_repo $rev $mod_rev $output $sub_pkgrel
+# extract_source_directory $pkgbase $repository $revision $mod_revision $output $sub_pkgrel
# extract files found in the svn/git source directories
# $PKGBUILD and $PKGBUILD_mod are expected to be set correctly
extract_source_directory() {
- local git_repo="$1"
- # shellcheck disable=SC2034
- local rev="$2"
- local mod_rev="$3"
- local output="$4"
- local sub_pkgrel="$5"
+ local pkgbase="$1"
+ local repository="$2"
+ local revision="$3"
+ local mod_revision="$4"
+ local output="$5"
+ local sub_pkgrel="$6"
- if [ -n "${PKGBUILD}" ]; then
- eval 'git -C "${repo_paths__'"${git_repo}"'}" archive "${rev}" -- "${PKGBUILD%/*}"' | \
- tar -x --strip-components=3 -C "${output}"
+ if [ -n "${rev}" ] \
+ && [ "${rev}" != '0000000000000000000000000000000000000000' ]; then
+ # TODO: use cache, here
+ curl -LSs "https://gitlab.archlinux.org/archlinux/packaging/packages/${pkgbase}/-/archive/${revision}/${pkgbase}-${revision}.tar.gz" \
+ |tar -xz -C "${output}"
printf '\n' >> \
"${output}/PKGBUILD"
fi
- if [ -n "${PKGBUILD_mod}" ]; then
- git -C "${repo_paths__archlinux32}" archive "${mod_rev}" -- "${PKGBUILD_mod%/*}" | \
- tar -x --overwrite --exclude 'PKGBUILD' --strip-components=2 -C "${output}" 2> /dev/null || \
- true
- git -C "${repo_paths__archlinux32}" archive "${mod_rev}" -- "${PKGBUILD_mod}" | \
- tar -Ox "${PKGBUILD_mod}" >> \
- "${output}/PKGBUILD"
- printf '\n' >> \
- "${output}/PKGBUILD"
+ if [ -n "${mod_revision}" ] \
+ && [ "${mod_revision}" != '0000000000000000000000000000000000000000' ]; then
+ git -C "${repo_paths__archlinux32}" archive "${mod_revision}" -- "${repository}/${pkgbase}" \
+ |tar -x --overwrite --exclude 'PKGBUILD' --strip-components=2 -C "${output}" 2> /dev/null \
+ ||true
+ git -C "${repo_paths__archlinux32}" archive "${mod_revision}" -- "${repository}/${pkgbase}/PKGBUILD" \
+ |tar -Ox "${PKGBUILD_mod}" \
+ >>"${output}/PKGBUILD"
+ printf '\n' \
+ >>"${output}/PKGBUILD"
fi
# we do not want to update pkgver, so we just undefine it