From bec95eeaee02dffb0f1750b9ca2641378bbe9df9 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Fri, 20 Jun 2014 22:00:01 -0400 Subject: I think xbs is in a workable stage. --- Makefile | 10 +-- src/abslibre-tools/librestage | 6 ++ src/libretools.conf | 7 +- src/xbs-abs/Makefile | 6 -- src/xbs-abs/helper-abs | 14 ++-- src/xbs-abs/xbs-abs.conf | 4 +- src/xbs-abslibre/Makefile | 1 - src/xbs-abslibre/helper-abslibre | 136 ++++++++++++++++++++------------------- src/xbs/xbs | 5 +- src/xbs/xbs.conf | 2 +- 10 files changed, 102 insertions(+), 89 deletions(-) diff --git a/Makefile b/Makefile index e7c46ec..dc1c99f 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ include config.mk ################################################################################ # these are the resulting packages -packages=doc libretools libretools-mips64el librelib gitget xbs xbs-abs xbs-abslibre +packages=doc libretools libretools-mips64el librelib gitget # and which directories they contain doc=doc libretools=\ @@ -14,13 +14,13 @@ libretools=\ src/devtools \ src/fullpkg \ src/librefetch \ - src/toru + src/toru \ + src/xbs \ + src/xbs-abs \ + src/xbs-abslibre libretools-mips64el=src/mips64el-tools librelib=src/lib gitget=src/gitget -xbs=src/xbs -xbs-abs=src/xbs-abs -xbs-abslibre=src/xbs-abslibre ################################################################################ diff --git a/src/abslibre-tools/librestage b/src/abslibre-tools/librestage index 63561f7..1bfb200 100755 --- a/src/abslibre-tools/librestage +++ b/src/abslibre-tools/librestage @@ -59,6 +59,11 @@ main() { return 1 fi + if ! xbs status; then + error "There are uncommitted changes in the current directory" + return 1 + fi + # Load configuration load_files libretools check_vars libretools WORKDIR ARCHES || return 1 @@ -82,6 +87,7 @@ main() { canonical="" # is empty for the first iteration, set after that for repo in "${repos[@]}"; do + xbs release "$repo" "$CARCH" mkdir -p "${WORKDIR}/staging/${repo}" if [[ -z $canonical ]]; then canonical="${WORKDIR}/staging/${repo}/${pkgfile##*/}" diff --git a/src/libretools.conf b/src/libretools.conf index 3999849..67810d2 100644 --- a/src/libretools.conf +++ b/src/libretools.conf @@ -27,9 +27,10 @@ REPOS=('core' 'libre' 'extra' 'community' 'libre-testing' 'social' 'sugar' 'pcr' ARCHES=('x86_64' 'i686' 'mips64el') ## ABSLibre -## Used by `createworkdir` -ABSLIBRERECV=git://projects.parabolagnulinux.org/abslibre.git -ABSLIBRESEND=ssh://git@projects.parabolagnulinux.org:1863/srv/git/abslibre.git +# Used by xbs-abslibre +ABSLIBRERECV=git://projects.parabolagnulinux.org/abslibre/abslibre.git +ABSLIBRESEND=ssh://git@projects.parabolagnulinux.org:1863/srv/git/abslibre/abslibre.git +ABSLIBREDEST="$WORKDIR/staging/abslibre" ################################################################################ # librerelease # diff --git a/src/xbs-abs/Makefile b/src/xbs-abs/Makefile index 7582592..ed969eb 100644 --- a/src/xbs-abs/Makefile +++ b/src/xbs-abs/Makefile @@ -4,9 +4,3 @@ pkglibexecdir = $(libexecdir)/xbs/helper-abs.d copy_files = archrelease.in libs = archrelease include ../../common.mk - -archrelease: %: %.in - @echo "GEN $@" - @$(edit) <"$<" >"$@" || { rm -f -- '$@'; false; } - @sed -i '/valid-tags\.sh/d' '$@' || { rm -f -- '$@'; false; } - @chmod 755 "$@" || { rm -f -- '$@'; false; } diff --git a/src/xbs-abs/helper-abs b/src/xbs-abs/helper-abs index d2baf42..387c1a6 100755 --- a/src/xbs-abs/helper-abs +++ b/src/xbs-abs/helper-abs @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Copyright (C) 2013 Luke Shumaker # @@ -140,8 +140,8 @@ move() { local arches=() # this is based off code from dbscripts:db-move for pkgarch in "${ARCHES[@]}" 'any'; do - dir_from="${svndir}/repos/${repo_from}-${pkgarch}" - dir_to="${svndir}/repos/${repo_to}-${pkgarch}" + local dir_from="${svndir}/repos/${repo_from}-${pkgarch}" + local dir_to="${svndir}/repos/${repo_to}-${pkgarch}" if [ -f "${dir_from}/PKGBUILD" ]; then if [ -d "${dir_to}" ]; then @@ -153,6 +153,7 @@ move() { arch_svn add -q "${dir_to}" fi + local file for file in $(arch_svn ls "${dir_from}"); do arch_svn mv -q -r HEAD "${dir_from}/$file@" "${dir_to}/" done @@ -174,7 +175,12 @@ releasepath() { load_config local svndir="${SVNDIR}/$(pac2svn "$repo")/${pkgbase}" arch_svn up -q "${svndir}" - echo "${svndir}/repos/${repo}-${arch}" + local releasepath="${svndir}/repos/${repo}-${arch}" + if [[ -f "${releasepath}/PKGBUILD" ]]; then + printf '%s\n' "$releasepath" + return 0 + fi + return 1 } case "$1" in diff --git a/src/xbs-abs/xbs-abs.conf b/src/xbs-abs/xbs-abs.conf index 3ceba6a..b542707 100644 --- a/src/xbs-abs/xbs-abs.conf +++ b/src/xbs-abs/xbs-abs.conf @@ -3,8 +3,8 @@ SVNDIR=/var/lib/xbs-abs # name url repos... SVNREPOS=( - 'packages svn://svn.archlinux.org/packages core extra testing' - 'commuity svn://svn.archlinux.org/community community community-testing multilib multilib-testing' + 'packages svn://svn.archlinux.org/packages core extra testing staging kde-unstable gnome-unstable' + "commuity svn://svn.archlinux.org/community $(echo {community,multilib}{,-testing,-staging})" ) ARCHES=(i686 x86_64) diff --git a/src/xbs-abslibre/Makefile b/src/xbs-abslibre/Makefile index cbe09fa..5a72444 100644 --- a/src/xbs-abslibre/Makefile +++ b/src/xbs-abslibre/Makefile @@ -1,3 +1,2 @@ -pkgconfdir = $(sysconfdir)/xbs pkglibexecdir = $(libexecdir)/xbs include ../../common.mk diff --git a/src/xbs-abslibre/helper-abslibre b/src/xbs-abslibre/helper-abslibre index 57d8369..ce21b99 100755 --- a/src/xbs-abslibre/helper-abslibre +++ b/src/xbs-abslibre/helper-abslibre @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Copyright (C) 2012-2013 Luke Shumaker # @@ -17,13 +17,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -# Here's the idea: -# We have two sources of abslibre: -# - git - does not include packages imported directly from Arch Linux -# - rsync - is read-only -# They should be identical, except for the mentioned differences. -# - status() { [[ -z $(git status -s .) ]] } @@ -31,25 +24,9 @@ status() { download() { . $(librelib conf) load_files libretools - check_vars libretools WORKDIR ABSLIBRERECV || return 1 - - # Get the Parabola-added git repo - libregit "$ABSLIBRERECV" master "$WORKDIR/abslibre" || return 1 - # This bit configures a 'pushUrl' to use ssh, leaves plain https for - # 'url' (used for fetch). - if [[ -n ${ABSLIBRESEND:-} ]]; then - pushd "$WORKDIR/abslibre" >/dev/null - local pushUrl="$(git config --get remote.origin.pushUrl)" - if [[ $? != 0 ]]; then - git config remote.origin.pushUrl "$ABSLIBRESEND"; - elif [[ $pushUrl != "$ABSLIBRESEND" ]]; then - warning "A %s is configured for %s, but it doesn't match %s" pushUrl "$WORKDIR/abslibre" "$ABSLIBRESEND" - fi - popd >/dev/null - fi + check_vars libretools WORKDIR ABSLIBRERECV ABSLIBRESEND || return 1 - # Get the everything-included tree - abs + gitget -f -p "$ABSLIBRESEND" checkout "$ABSLIBRERECV" "$WORKDIR/abslibre" || return 1 } release() { @@ -59,18 +36,23 @@ release() { . libremessages . $(librelib conf) load_files libretools - check_vars libretools WORKDIR || return 1 - local lookupfile="${WORKDIR}/abslibre.xbs-lookup" - - read mode type sha1 file <<<"$(git ls-tree -d --full-tree HEAD "$(pwd)")" - - lock 9 "$lookupfile.lock" "Waiting for lock on %s" "$lookupfile" - { - sed "/^$repo $arch $pkgbase /d" < "$lookupfile" - echo "$repo $arch $pkgbase $sha1 $path" - } > "$lookupfile.$$" - mv "$lookupfile.$$" "$lookupfile" - lock_close 9 + check_vars libretools WORKDIR ABSLIBREDEST || return 1 + local pkgbase="$(load_PKGBUILD; printf '%s\n' "${pkgbase:-${pkgname}}")" + local pkgdir="${ABSLIBREDEST}/${arch}/${repo}/${pkgbase}" + + lock 9 "${ABSLIBREDEST}/${arch}.lock" "Waiting for a lock on the ABSLibre release directory for ${arch}" + + if [[ -e $pkgdir ]]; then + rm -rf -- "$pkgdir" + fi + mkdir -p -- "$pkgdir" + git ls-files -z | xargs -0 -I{} cp {} "$pkgdir" + + if [[ -e "${ABSLIBREDEST}/${arch}/.git" ]]; then + cd "$pkgdir" + git add . + git commit -q -m "xbs-abslibre: Release ${repo}/${pkgbase} for ${arch} (by $(id -un))" + fi } unrelease() { @@ -81,12 +63,21 @@ unrelease() { . libremessages . $(librelib conf) load_files libretools - check_vars libretools WORKDIR || return 1 - local lookupfile="${WORKDIR}/abslibre.xbs-lookup" + check_vars libretools ABSLIBREDEST || return 1 - lock 9 "$lookupfile.lock" "Waiting for lock on %s" "$lookupfile" - sed -i "/^$repo $arch $pkgbase /d" "$lookupfile" - lock_close 9 + local pkgbase="$(load_PKGBUILD; printf '%s\n' "${pkgbase:-${pkgname}}")" + local pkgdir="${ABSLIBREDEST}/${arch}/${repo}/${pkgbase}" + + lock 9 "${ABSLIBREDEST}/${arch}.lock" "Waiting for a lock on the ABSLibre release directory for ${arch}" + + if [[ -f "${pkgdir}/PKGBUILD" ]]; then + if [[ -e "${ABSLIBREDEST}/${arch}/.git" ]]; then + git rm -qrf -- "$pkgdir" + git commit -q -m "xbs-abslibre: Remove ${repo}/${pkgbase} from ${arch} (by $(id -un))" + else + rm -rf -- "$pkgdir" + fi + fi } move() { @@ -97,14 +88,32 @@ move() { . libremessages . $(librelib conf) load_files libretools - check_vars libretools WORKDIR || return 1 - local lookupfile="${WORKDIR}/abslibre.xbs-lookup" - - lock 9 "$lookupfile.lock" "Waiting for lock on %s" "$lookupfile" - sed -ri "s/^${repo_from} (\S+) $pkgbase /${repo_to} \1 $pkgbase/" "$lookupfile" - # TODO - lock_close 9 - return 1 + check_vars libretools ABSLIBREDEST ARCHES || return 1 + + local mv + local arch + for arch in "${ARCHES[@]}" any; do + lock 9 "${ABSLIBREDEST}/${arch}.lock" "Waiting for a lock on the ABSLibre release directory for ${arch}" + + local dir_from="${ABSLIBREDEST}/${arch}/${repo_from}/${pkgbase}" + local dir_to="${ABSLIBREDEST}/${arch}/${repo_to}/${pkgbase}" + + if [[ -f "${dir_from}/PKGBUILD" ]]; then + if [[ -e "${ABSLIBREDEST}/${arch}/.git" ]]; then + if [[ -e "${dir_to}" ]]; then + git rm -qrf -- "$dir_to" + fi + mkdir -p -- "${dir_to%/*}" + git mv -- "$dir_from" "$dir_to" + git commit -q -m "xbs-abslibre: Move ${pkgbase} from ${repo_from} to ${repo_to} on ${arch} (by $(id -un))" + else + rm -rf -- "$dir_to" + mkdir -p -- "${dir_to%/*}" + mv "$dir_from" "$dir_to" + fi + fi + lock_close 9 + done } releasepath() { @@ -112,22 +121,19 @@ releasepath() { local repo=$2 local arch=$3 - local r=0 + . libremessages . $(librelib conf) load_files libretools - check_vars libretools WORKDIR || r=$? - load_files abs - check_vars abs ABSROOT || r=$? - - local abstree - local dir - for abstree in "$WORKDIR/abslibre" "$ABSROOT"; do - dir="$abstree/$repo/$pkgbase" - if [[ -f "$dir/PKGBUILD" ]]; then - printf '%s\n' "$dir" - return 0 - fi - done + check_vars libretools ABSLIBREDEST || return 1 + local pkgdir="${ABSLIBREDEST}/${arch}/${repo}/${pkgbase}" + + lock 9 "${ABSLIBREDEST}/${arch}.lock" "Waiting for a lock on the ABSLibre release directory for ${arch}" + + if [[ -f "${pkgdir}/PKGBUILD" ]]; then + printf '%s\n' "$pkgdir" + return 0 + fi + return 1 } diff --git a/src/xbs/xbs b/src/xbs/xbs index 6bd1af2..ae424af 100755 --- a/src/xbs/xbs +++ b/src/xbs/xbs @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Copyright (C) 2013 Luke Shumaker # @@ -57,7 +57,8 @@ usage() { flag "move $(_ 'FROMREPO TOREPO PKGBASE')" \ 'Move a pkgbase from one repo to another' flag "releasepath $(_ 'PKGBASE REPO ARCH')" \ - 'Print the path to the staged version of pkgbase' + 'Print the path to the staged version of pkgbase. Exit with a + non-zero value if PKGBASE is not staged for that REPO-ARCH' } status() { diff --git a/src/xbs/xbs.conf b/src/xbs/xbs.conf index caf8d8b..556c133 100644 --- a/src/xbs/xbs.conf +++ b/src/xbs/xbs.conf @@ -1 +1 @@ -BUILDSYSTEM=abs +BUILDSYSTEM=abslibre -- cgit v1.2.3-54-g00ecf