diff options
author | Levente Polyak <anthraxx@archlinux.org> | 2022-05-18 02:31:26 +0200 |
---|---|---|
committer | Levente Polyak <anthraxx@archlinux.org> | 2022-06-22 01:05:02 +0200 |
commit | d94badcd0be4f1f0bdc85a9e17f622373fcc42b2 (patch) | |
tree | 09755c43df16dd47d8f99c15213c49315219cb71 /src/crossrepomove.in | |
parent | e1a51770b26f3b36f24dc5668253eda23a8c8bcf (diff) | |
download | devtools-d94badcd0be4f1f0bdc85a9e17f622373fcc42b2.tar.xz |
make: split out source files into src folder
Diffstat (limited to 'src/crossrepomove.in')
-rw-r--r-- | src/crossrepomove.in | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/src/crossrepomove.in b/src/crossrepomove.in new file mode 100644 index 0000000..c028d62 --- /dev/null +++ b/src/crossrepomove.in @@ -0,0 +1,86 @@ +#!/bin/bash +# +# SPDX-License-Identifier: GPL-3.0-or-later + +m4_include(lib/common.sh) + +scriptname=${0##*/} + +if [[ -z $1 ]]; then + printf 'Usage: %s [pkgbase]\n' "$scriptname" + exit 1 +fi + +pkgbase="${1}" + +case $scriptname in + extra2community) + source_name='packages' + target_name='community' + source_repo='extra' + target_repo='community' + ;; + community2extra) + source_name='community' + target_name='packages' + source_repo='community' + target_repo='extra' + ;; + *) + die "Couldn't find configuration for %s" "$scriptname" + ;; +esac + +server='repos.archlinux.org' +source_svn="svn+ssh://svn-${source_name}@${server}/srv/repos/svn-${source_name}/svn" +target_svn="svn+ssh://svn-${target_name}@${server}/srv/repos/svn-${target_name}/svn" +source_dbscripts="/srv/repos/svn-${source_name}/dbscripts" +target_dbscripts="/srv/repos/svn-${target_name}/dbscripts" + +setup_workdir + +pushd "$WORKDIR" >/dev/null + +msg "Downloading sources for %s" "${pkgbase}" +svn -q checkout -N "${target_svn}" target_checkout +mkdir -p "target_checkout/${pkgbase}/repos" +svn -q export "${source_svn}/${pkgbase}/trunk" "target_checkout/${pkgbase}/trunk" || die +# shellcheck source=PKGBUILD.proto +. "target_checkout/${pkgbase}/trunk/PKGBUILD" + +msg "Downloading packages for %s" "${pkgbase}" +for _arch in "${arch[@]}"; do + if [[ "${_arch[*]}" == 'any' ]]; then + repo_arch='x86_64' + else + repo_arch=${_arch} + fi + for _pkgname in "${pkgname[@]}"; do + fullver=$(get_full_version "$_pkgname") + pkgpath="/srv/ftp/$source_repo/os/$repo_arch/$_pkgname-$fullver-${_arch}.pkg.tar.*" + # shellcheck disable=2029 + ssh "$server" "cp $pkgpath staging/$target_repo" || die + done +done + +msg "Adding %s to %s" "${pkgbase}" "${target_repo}" +svn -q add "target_checkout/${pkgbase}" +svn -q commit -m"${scriptname}: Moving ${pkgbase} from ${source_repo} to ${target_repo}" target_checkout +pushd "target_checkout/${pkgbase}/trunk" >/dev/null +archrelease "${arch[@]/#/$target_repo-}" || die +popd >/dev/null + +# shellcheck disable=2029 +ssh "${server}" "${target_dbscripts}/db-update" || die + +msg "Removing %s from %s" "${pkgbase}" "${source_repo}" +for _arch in "${arch[@]}"; do + # shellcheck disable=2029 + ssh "${server}" "${source_dbscripts}/db-remove ${source_repo} ${_arch} ${pkgbase}" +done +svn -q checkout -N "${source_svn}" source_checkout +svn -q up "source_checkout/${pkgbase}" +svn -q rm "source_checkout/${pkgbase}" +svn -q commit -m"${scriptname}: Moving ${pkgbase} from ${source_repo} to ${target_repo}" source_checkout + +popd >/dev/null |