From dc413989bb1178e9305a1b692e27ba162ad0cf4a Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Wed, 22 Aug 2012 14:04:43 +0200 Subject: WIP: switch from svn to git - archrelease not needed anymore? Signed-off-by: Florian Pritz --- archrelease.in | 55 ++++++++++--------------------------- commitpkg.in | 85 +++++++++++++++++++--------------------------------------- 2 files changed, 42 insertions(+), 98 deletions(-) diff --git a/archrelease.in b/archrelease.in index 533a547..2d68376 100644 --- a/archrelease.in +++ b/archrelease.in @@ -34,53 +34,26 @@ fi trunk=${PWD##*/} -# Normally this should be trunk, but it may be something -# such as 'gnome-unstable' -IFS='/' read -r -d '' -a parts <<< "$PWD" -if [[ "${parts[@]:(-2):1}" == "repos" ]]; then - die 'archrelease: Should not be in repos dir (try from trunk/)' -fi -unset parts - -if [[ $(svn status -q) ]]; then +if [[ $(git status -s | grep -v "^?? ") ]]; then die 'archrelease: You have not committed your changes yet!' fi -pushd .. >/dev/null -IFS=$'\n' read -r -d '' -a known_files < <(svn ls -r HEAD "$trunk") -for file in "${known_files[@]}"; do - if [[ ${file:(-1)} = '/' ]]; then - die "archrelease: subdirectories are not supported in package directories!" - fi -done - -# gracefully handle files containing an "@" character -known_files=("${known_files[@]/%/@}") - -for tag in "$@"; do - stat_busy "Copying ${trunk} to ${tag}" - - if [[ -d repos/$tag ]]; then - declare -a trash - trash=() - while read -r file; do - trash+=("repos/$tag/$file") - done < <(svn ls "repos/$tag") - [[ $trash ]] && svn rm -q "${trash[@]}" - else - mkdir -p "repos/$tag" - svn add --parents -q "repos/$tag" - fi - - # copy all files at once from trunk to the subdirectory in repos/ - svn copy -q -r HEAD ${known_files[@]/#/$trunk/} "repos/$tag/" - - stat_done -done +# TODO: merge with code from commitpkg +if [[ -z $server ]]; then + case "$repo" in + core|extra|testing|staging|kde-unstable|gnome-unstable) + server='gerolde.archlinux.org' ;; + community*|multilib*) + server='aur.archlinux.org' ;; + *) + server='gerolde.archlinux.org' + msg "Non-standard repository $repo in use, defaulting to server $server" ;; + esac +fi stat_busy "Releasing package" printf -v tag_list ", %s" "$@"; tag_list="${tag_list#, }" -svn commit -q -m "archrelease: copy ${trunk} to $tag_list" || abort +ssh $server commit -q -m "archrelease: copy ${trunk} to $tag_list" || abort stat_done popd >/dev/null diff --git a/commitpkg.in b/commitpkg.in index 83976bd..40ba887 100644 --- a/commitpkg.in +++ b/commitpkg.in @@ -56,22 +56,24 @@ case "$cmd" in esac # check if all local source files are under version control -for s in "${source[@]}"; do - if [[ $s != *://* ]] && ! svn status -v "$s@" | grep -q '^[ AMRX~]'; then - die "$s is not under version control" - fi -done +# TODO: FIXME: check if files are in git +#for s in "${source[@]}"; do + #if [[ $s != *://* ]] && ! svn status -v "$s@" | grep -q '^[ AMRX~]'; then + #die "$s is not under version control" + #fi +#done # check if changelog and install files are under version control -for i in 'changelog' 'install'; do - while read -r file; do - # evaluate any bash variables used - eval file=\"$(sed 's/^\(['\''"]\)\(.*\)\1$/\2/' <<< "$file")\" - if ! svn status -v "${file}" | grep -q '^[ AMRX~]'; then - die "${file} is not under version control" - fi - done < <(sed -n "s/^[[:space:]]*$i=//p" PKGBUILD) -done +# TODO: FIXME: check if files are in git +#for i in 'changelog' 'install'; do + #while read -r file; do + ## evaluate any bash variables used + #eval file=\"$(sed 's/^\(['\''"]\)\(.*\)\1$/\2/' <<< "$file")\" + #if ! svn status -v "${file}" | grep -q '^[ AMRX~]'; then + #die "${file} is not under version control" + #fi + #done < <(sed -n "s/^[[:space:]]*$i=//p" PKGBUILD) +#done rsyncopts=(-e ssh -p --chmod=ug=rw,o=r -c -h -L --progress --partial -y) archreleaseopts=() @@ -107,37 +109,26 @@ done if [[ -z $server ]]; then case "$repo" in core|extra|testing|staging|kde-unstable|gnome-unstable) - server='gerolde.archlinux.org' ;; + server='localhost' ;; community*|multilib*) - server='aur.archlinux.org' ;; + server='localhost' ;; *) server='gerolde.archlinux.org' msg "Non-standard repository $repo in use, defaulting to server $server" ;; esac fi -if [[ -n $(svn status -q) ]]; then +if [[ -n $(git status -s | grep -v "^?? ") ]]; then msgtemplate="upgpkg: $pkgbase $(get_full_version)"$'\n\n' if [[ -n $1 ]]; then - stat_busy 'Committing changes to trunk' - svn commit -q -m "${msgtemplate}${1}" || die + stat_busy 'Committing changes' + git commit -a -q -m "${msgtemplate}${1}" || die + git tag "$(get_full_version)" || die stat_done else - msgfile="$(mktemp)" - echo "$msgtemplate" > "$msgfile" - if [[ -n $SVN_EDITOR ]]; then - $SVN_EDITOR "$msgfile" - elif [[ -n $VISUAL ]]; then - $VISUAL "$msgfile" - elif [[ -n $EDITOR ]]; then - $EDITOR "$msgfile" - else - vi "$msgfile" - fi - [[ -s $msgfile ]] || die stat_busy 'Committing changes to trunk' - svn commit -q -F "$msgfile" || die - unlink "$msgfile" + echo "$msgtemplate" | git commit -a -q -e -F - || die + git tag "$(get_full_version)" || die stat_done fi fi @@ -184,9 +175,9 @@ for _arch in ${arch[@]}; do fi done -if [[ ${#commit_arches[*]} -gt 0 ]]; then - archrelease "${archreleaseopts[@]}" "${commit_arches[@]/#/$repo-}" || die -fi +#if [[ ${#commit_arches[*]} -gt 0 ]]; then + #archrelease "${archreleaseopts[@]}" "${commit_arches[@]/#/$repo-}" || die +#fi if [[ ${#uploads[*]} -gt 0 ]]; then new_uploads=() @@ -199,26 +190,6 @@ if [[ ${#uploads[*]} -gt 0 ]]; then uploads=("${new_uploads[@]}") unset new_uploads msg 'Uploading all package and signature files' - rsync "${rsyncopts[@]}" "${uploads[@]}" "$server:staging/$repo/" || die + rsync "${rsyncopts[@]}" "${uploads[@]}" "$server:arch/git-pkgs-test/staging/$repo/" || die fi -if [[ "${arch[*]}" == 'any' ]]; then - if [[ -d ../repos/$repo-i686 && -d ../repos/$repo-x86_64 ]]; then - pushd ../repos/ >/dev/null - stat_busy "Removing $repo-i686 and $repo-x86_64" - svn rm -q $repo-i686 - svn rm -q $repo-x86_64 - svn commit -q -m "Removed $repo-i686 and $repo-x86_64 for $pkgname" - stat_done - popd >/dev/null - fi -else - if [[ -d ../repos/$repo-any ]]; then - pushd ../repos/ >/dev/null - stat_busy "Removing $repo-any" - svn rm -q $repo-any - svn commit -q -m "Removed $repo-any for $pkgname" - stat_done - popd >/dev/null - fi -fi -- cgit v1.2.3-24-g4f1b