[arch-projects] [devtools] [PATCH 1/4] archrelease: Remove redundant directory check
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de> --- archrelease | 11 +++-------- 1 files changed, 3 insertions(+), 8 deletions(-) diff --git a/archrelease b/archrelease index af75b8f..ec7545e 100755 --- a/archrelease +++ b/archrelease @@ -37,14 +37,9 @@ if [[ -d repos/$1 ]]; then trash+=("repos/$1/$file") done < <(svn ls "repos/$1") svn rm -q "${trash[@]}" -fi -if [[ ! -d repos ]]; then - mkdir repos - svn add -q repos -fi -if [[ ! -d "repos/$1" ]]; then - mkdir "repos/${1}" - svn add -q "repos/${1}" +else + mkdir -p "repos/${1}" + svn add --parents -q "repos/${1}" fi IFS=$'\n' read -r -d '' -a known_files < <(svn ls "trunk") for file in "${known_files[@]}"; do -- 1.7.6
Ensure we do not mess with version control if there are any subdirectories in the package trunk. Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de> --- archrelease | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-) diff --git a/archrelease b/archrelease index ec7545e..0fb3445 100755 --- a/archrelease +++ b/archrelease @@ -31,6 +31,12 @@ fi echo -n "releasing package to ${1}..." pushd .. >/dev/null +IFS=$'\n' read -r -d '' -a known_files < <(svn ls "trunk") +for file in "${known_files[@]}"; do + if [[ ${file:(-1)} = '/' ]]; then + abort "archrelease: subdirectories are not supported in package directories!" + fi +done if [[ -d repos/$1 ]]; then declare -a trash while read -r file; do @@ -41,12 +47,6 @@ else mkdir -p "repos/${1}" svn add --parents -q "repos/${1}" fi -IFS=$'\n' read -r -d '' -a known_files < <(svn ls "trunk") -for file in "${known_files[@]}"; do - if [[ ${file:(-1)} = '/' ]]; then - abort "archrelease: subdirectories are not supported in package directories!" - fi -done for file in "${known_files[@]}"; do svn copy -q -r HEAD "trunk/$file" "repos/${1}/" done -- 1.7.6
This allows for releasing to multiple repositories with a single archrelease invocation, while keeping separate commits: ---- $ archrelease community-{i686,x86_64} releasing package to community-i686...done releasing package to community-x86_64...done ---- Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de> --- archrelease | 39 +++++++++++++++++++++++---------------- 1 files changed, 23 insertions(+), 16 deletions(-) diff --git a/archrelease b/archrelease index 0fb3445..c175d2d 100755 --- a/archrelease +++ b/archrelease @@ -6,7 +6,7 @@ abort() { } if [[ -z $1 ]]; then - abort 'Usage: archrelease <repo>' + abort 'Usage: archrelease <repo>...' fi # TODO: validate repo is really repo-arch @@ -29,7 +29,6 @@ if [[ $(svn status -q) ]]; then abort 'archrelease: You have not committed your changes yet!' fi -echo -n "releasing package to ${1}..." pushd .. >/dev/null IFS=$'\n' read -r -d '' -a known_files < <(svn ls "trunk") for file in "${known_files[@]}"; do @@ -37,19 +36,27 @@ for file in "${known_files[@]}"; do abort "archrelease: subdirectories are not supported in package directories!" fi done -if [[ -d repos/$1 ]]; then - declare -a trash - while read -r file; do - trash+=("repos/$1/$file") - done < <(svn ls "repos/$1") - svn rm -q "${trash[@]}" -else - mkdir -p "repos/${1}" - svn add --parents -q "repos/${1}" -fi -for file in "${known_files[@]}"; do - svn copy -q -r HEAD "trunk/$file" "repos/${1}/" + +for tag in "$@"; do + echo -n "releasing package to ${tag}..." + + if [[ -d repos/$tag ]]; then + declare -a trash + while read -r file; do + trash+=("repos/$tag/$file") + done < <(svn ls "repos/$tag") + svn rm -q "${trash[@]}" + else + mkdir -p "repos/$tag" + svn add --parents -q "repos/$tag" + fi + + for file in "${known_files[@]}"; do + svn copy -q -r HEAD "trunk/$file" "repos/$tag/" + done + + svn commit -q -m "archrelease: copy trunk to $tag" || abort + + echo 'done' done -svn commit -q -m "archrelease: copy trunk to ${1}" || abort popd >/dev/null -echo 'done' -- 1.7.6
On Fri, Aug 19, 2011 at 3:16 AM, Lukas Fleischer <archlinux@cryptocrack.de> wrote:
This allows for releasing to multiple repositories with a single archrelease invocation, while keeping separate commits: Isn't this a perfect example of where we would want a single atomic commit? I like the multiple tags idea, but it seems we should also combine the commits as well.
---- $ archrelease community-{i686,x86_64} releasing package to community-i686...done releasing package to community-x86_64...done ----
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de> --- archrelease | 39 +++++++++++++++++++++++---------------- 1 files changed, 23 insertions(+), 16 deletions(-)
diff --git a/archrelease b/archrelease index 0fb3445..c175d2d 100755 --- a/archrelease +++ b/archrelease @@ -6,7 +6,7 @@ abort() { }
if [[ -z $1 ]]; then - abort 'Usage: archrelease <repo>' + abort 'Usage: archrelease <repo>...' fi
# TODO: validate repo is really repo-arch @@ -29,7 +29,6 @@ if [[ $(svn status -q) ]]; then abort 'archrelease: You have not committed your changes yet!' fi
-echo -n "releasing package to ${1}..." pushd .. >/dev/null IFS=$'\n' read -r -d '' -a known_files < <(svn ls "trunk") for file in "${known_files[@]}"; do @@ -37,19 +36,27 @@ for file in "${known_files[@]}"; do abort "archrelease: subdirectories are not supported in package directories!" fi done -if [[ -d repos/$1 ]]; then - declare -a trash - while read -r file; do - trash+=("repos/$1/$file") - done < <(svn ls "repos/$1") - svn rm -q "${trash[@]}" -else - mkdir -p "repos/${1}" - svn add --parents -q "repos/${1}" -fi -for file in "${known_files[@]}"; do - svn copy -q -r HEAD "trunk/$file" "repos/${1}/" + +for tag in "$@"; do + echo -n "releasing package to ${tag}..." + + if [[ -d repos/$tag ]]; then + declare -a trash + while read -r file; do + trash+=("repos/$tag/$file") + done < <(svn ls "repos/$tag") + svn rm -q "${trash[@]}" + else + mkdir -p "repos/$tag" + svn add --parents -q "repos/$tag" + fi + + for file in "${known_files[@]}"; do + svn copy -q -r HEAD "trunk/$file" "repos/$tag/" + done + + svn commit -q -m "archrelease: copy trunk to $tag" || abort + + echo 'done' done -svn commit -q -m "archrelease: copy trunk to ${1}" || abort popd >/dev/null -echo 'done' -- 1.7.6
On Fri, Aug 19, 2011 at 06:55:56AM -0500, Dan McGee wrote:
On Fri, Aug 19, 2011 at 3:16 AM, Lukas Fleischer <archlinux@cryptocrack.de> wrote:
This allows for releasing to multiple repositories with a single archrelease invocation, while keeping separate commits: Isn't this a perfect example of where we would want a single atomic commit? I like the multiple tags idea, but it seems we should also combine the commits as well.
Well, I wasn't so sure when I wrote this. You could also declare releasing a package to a single repository as atomic. The idea is that there might be situations when we want to release to a single architecture only and that you might want to revert a single architecture release if you accidentally released to the wrong repository (like core-i686 and extra-x86_64). I know that this is quite a stretch, though... If we actually define a package as broken if it supports i686, as well as x86_64, and is released to i686 only, you're probably right.
This allows for releasing to multiple repositories with a single commit: ---- $ archrelease community-{i686,x86_64} copying trunk to community-i686...done copying trunk to community-x86_64...done releasing package...done ---- Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de> --- archrelease | 44 ++++++++++++++++++++++++++++---------------- 1 files changed, 28 insertions(+), 16 deletions(-) diff --git a/archrelease b/archrelease index 0fb3445..287c5e7 100755 --- a/archrelease +++ b/archrelease @@ -6,7 +6,7 @@ abort() { } if [[ -z $1 ]]; then - abort 'Usage: archrelease <repo>' + abort 'Usage: archrelease <repo>...' fi # TODO: validate repo is really repo-arch @@ -29,7 +29,6 @@ if [[ $(svn status -q) ]]; then abort 'archrelease: You have not committed your changes yet!' fi -echo -n "releasing package to ${1}..." pushd .. >/dev/null IFS=$'\n' read -r -d '' -a known_files < <(svn ls "trunk") for file in "${known_files[@]}"; do @@ -37,19 +36,32 @@ for file in "${known_files[@]}"; do abort "archrelease: subdirectories are not supported in package directories!" fi done -if [[ -d repos/$1 ]]; then - declare -a trash - while read -r file; do - trash+=("repos/$1/$file") - done < <(svn ls "repos/$1") - svn rm -q "${trash[@]}" -else - mkdir -p "repos/${1}" - svn add --parents -q "repos/${1}" -fi -for file in "${known_files[@]}"; do - svn copy -q -r HEAD "trunk/$file" "repos/${1}/" + +for tag in "$@"; do + echo -n "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") + svn rm -q "${trash[@]}" + else + mkdir -p "repos/$tag" + svn add --parents -q "repos/$tag" + fi + + for file in "${known_files[@]}"; do + svn copy -q -r HEAD "trunk/$file" "repos/$tag/" + done + + echo 'done' done -svn commit -q -m "archrelease: copy trunk to ${1}" || abort -popd >/dev/null + +echo -n "releasing package..." +printf -v tag_list ", %s" "$@"; tag_list="${tag_list#, }" +svn commit -q -m "archrelease: copy trunk to $tag_list" || abort echo 'done' + +popd >/dev/null -- 1.7.6
Suggest multiple tags when using ZSH completion with archrelease. Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de> --- This obviously needs to get applied after the patch adding the ZSH completion. zsh_completion | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/zsh_completion b/zsh_completion index 29c9657..2551140 100644 --- a/zsh_completion +++ b/zsh_completion @@ -24,7 +24,7 @@ _archco_args=( ) _archrelease_args=( - "1:arch:($_tags[*])" + "*:arch:($_tags[*])" ) _archrm_args=( -- 1.7.6
Make use of archrelease's multi-tag capability invoke it once instead of re-launching it for for each individual tag. Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de> --- commitpkg | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-) diff --git a/commitpkg b/commitpkg index 244581f..416d592 100755 --- a/commitpkg +++ b/commitpkg @@ -172,9 +172,14 @@ for _arch in ${arch[@]}; do abort "Signature ${pkgfile}.sig was not found" fi done - archrelease $repo-${_arch} || abort done +if [[ -n $commit_arch ]]; then + archrelease "$repo-$commit_arch" || abort +else + archrelease "${arch[@]/#/$repo-}" || abort +fi + if [[ ${#uploads[*]} -gt 0 ]]; then echo 'uploading all package and signature files' rsync "${rsyncopts[@]}" "${uploads[@]}" "$server:staging/$repo/" || abort -- 1.7.6
participants (2)
-
Dan McGee
-
Lukas Fleischer