summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMorten Linderud <foxboron@archlinux.org>2020-05-27 17:48:53 +0200
committerLevente Polyak <anthraxx@archlinux.org>2023-03-19 22:02:04 +0100
commit90aba4f84b001bc2063b104d93a1e43810c22cbb (patch)
tree87264a5ba7fcdc149cbb77fc85a51af34ba119cf
parent9297eb344e997b716ee3de9f17c7ebb33cd1791d (diff)
downloaddevtools-90aba4f84b001bc2063b104d93a1e43810c22cbb.tar.xz
git: first iteration of git support
Signed-off-by: Morten Linderud <foxboron@archlinux.org> Adjusted-by: Levente Polyak <anthraxx@archlinux.org>
-rw-r--r--src/archrelease.in52
-rw-r--r--src/commitpkg.in46
-rw-r--r--src/rebuildpkgs.in2
3 files changed, 21 insertions, 79 deletions
diff --git a/src/archrelease.in b/src/archrelease.in
index 3490ee2..e80271b 100644
--- a/src/archrelease.in
+++ b/src/archrelease.in
@@ -34,54 +34,16 @@ if [[ ! -f PKGBUILD ]]; then
die 'archrelease: PKGBUILD not found'
fi
-trunk=${PWD##*/}
+. ./PKGBUILD
+pkgbase=${pkgbase:-$pkgname}
+pkgver=$(get_full_version "$pkgbase")
-# 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/)'
+if git rev-parse "$pkgver" >/dev/null 2>&1; then
+ die "archrelease: the tag $pkgver already exists in the repository!"
fi
-unset parts
-
-if [[ $(svn status -q) ]]; then
- die 'archrelease: You have not committed your changes yet!'
-fi
-
-pushd .. >/dev/null
-mapfile -t known_files < <(svn ls -r HEAD "$trunk")
-wait $! || die "failed to discover committed files"
-
-# gracefully handle files containing an "@" character
-known_files=("${known_files[@]/%/@}")
-
-# update repo directory first to avoid a commit failure
-svn up repos
-
-for tag in "$@"; do
- stat_busy "Copying %s to %s" "${trunk}" "${tag}"
-
- if [[ -d repos/$tag ]]; then
- mapfile -t trash < <(svn ls --recursive "repos/$tag")
- wait $! || die "failed to discover existing files"
- if (( ${#trash[@]} )); then
- trash=("${trash[@]/#/repos/$tag/}")
- svn rm -q "${trash[@]/%/@}"
- fi
- 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
stat_busy "Releasing package"
printf -v tag_list ", %s" "$@"; tag_list="${tag_list#, }"
-svn commit -q -m "archrelease: copy ${trunk} to $tag_list" || abort
+git tag -s -m "archrelease: released $pkgbase-$pkgver to $tag_list" "$pkgver" || abort
+git push --tags || abort
stat_done
-
-popd >/dev/null
diff --git a/src/commitpkg.in b/src/commitpkg.in
index 6b9d727..d57b30c 100644
--- a/src/commitpkg.in
+++ b/src/commitpkg.in
@@ -106,13 +106,13 @@ for key in "${validpgpkeys[@]}"; do
needsversioning+=("keys/pgp/$key.asc")
done
-# assert that they really are controlled by SVN
+# assert that they really are controlled by git
if (( ${#needsversioning[*]} )); then
- # svn status's output is only two columns when the status is unknown
- while read -r status filename; do
- [[ $status = '?' ]] && unversioned+=("$filename")
- done < <(svn status -v "${needsversioning[@]}")
- (( ${#unversioned[*]} )) && die "%s is not under version control" "${unversioned[@]}"
+ for file in "${needsversioning[@]}"; do
+ if ! git ls-files --error-unmatch "$file"; then
+ die "%s is not under version control" "$file"
+ fi
+ done
fi
rsyncopts=(-e ssh -p '--chmod=ug=rw,o=r' -c -h -L --progress --partial -y)
@@ -155,18 +155,18 @@ if [[ -z $server ]]; then
server='repos.archlinux.org'
fi
-if [[ -n $(svn status -q) ]]; then
+if [[ -n $(git status --short --untracked-files=no) ]]; then
msgtemplate="upgpkg: $pkgbase $(get_full_version)"
if [[ -n $1 ]]; then
- stat_busy 'Committing changes to trunk'
- svn commit -q -m "${msgtemplate}: ${1}" || die
+ stat_busy 'Committing changes'
+ git commit -q -m "${msgtemplate}: ${1}" || die
stat_done
else
[[ -z ${WORKDIR:-} ]] && setup_workdir
msgfile=$(mktemp --tmpdir="${WORKDIR}" commitpkg.XXXXXXXXXX)
echo "$msgtemplate" > "$msgfile"
- if [[ -n $SVN_EDITOR ]]; then
- $SVN_EDITOR "$msgfile" || die
+ if [[ -n $GIT_EDITOR ]]; then
+ $GIT_EDITOR "$msgfile" || die
elif [[ -n $VISUAL ]]; then
$VISUAL "$msgfile" || die
elif [[ -n $EDITOR ]]; then
@@ -175,8 +175,8 @@ if [[ -n $(svn status -q) ]]; then
vi "$msgfile" || die
fi
[[ -s $msgfile ]] || die
- stat_busy 'Committing changes to trunk'
- svn commit -q -F "$msgfile" || die
+ stat_busy 'Committing changes'
+ git commit -v -q -F "$msgfile" || die
unlink "$msgfile"
stat_done
fi
@@ -250,23 +250,3 @@ if [[ ${#uploads[*]} -gt 0 ]]; then
msg 'Uploading all package and signature files'
rsync "${rsyncopts[@]}" "${uploads[@]}" "$server:staging/$repo/" || die
fi
-
-if [[ "${arch[*]}" == 'any' ]]; then
- if [[ -d ../repos/$repo-x86_64 ]]; then
- pushd ../repos/ >/dev/null
- stat_busy "Removing %s" "$repo-x86_64"
- svn rm -q "$repo-x86_64"
- svn commit -q -m "Removed $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 %s" "$repo-any"
- svn rm -q "$repo-any"
- svn commit -q -m "Removed $repo-any for $pkgname"
- stat_done
- popd >/dev/null
- fi
-fi
diff --git a/src/rebuildpkgs.in b/src/rebuildpkgs.in
index eddc17f..f58cfab 100644
--- a/src/rebuildpkgs.in
+++ b/src/rebuildpkgs.in
@@ -38,7 +38,7 @@ elif [[ -r "$HOME/.makepkg.conf" ]]; then
fi
bump_pkgrel() {
- # Get the current pkgrel from SVN and update the working copy with it
+ # Get the current pkgrel from git and update the working copy with it
# This prevents us from incrementing out of control :)
pbuild='.svn/text-base/PKGBUILD.svn-base'
oldrel=$(grep 'pkgrel=' $pbuild | cut -d= -f2)