index : asp32 | |
Archlinux32 fork of asp - obsolete | gitolite user |
summaryrefslogtreecommitdiff |
-rw-r--r-- | asp.in | 28 | ||||
-rw-r--r-- | package.inc.sh | 8 |
@@ -126,27 +126,23 @@ initialize() { local remote umask 0022 - startdir=$PWD - if [[ ! -d $ASPROOT ]]; then - log_info 'Initializing ASPROOT in %s' "$ASPROOT" - mkdir -p "$ASPROOT" - fi + export GIT_DIR=$ASPROOT/.git - cd "$ASPROOT" || log_fatal "ASPROOT (%s) does not exist!" "$ASPROOT" + if [[ ! -f $ASPROOT/.asp ]]; then + git init -q "$ASPROOT" || return 1 + for remote in "${ARCH_GIT_REPOS[@]}"; do + git remote add "$remote" "https://git.archlinux.org/svntogit/$remote.git" || return 1 + done - if [[ ! -d $ASPCACHE ]] && ! mkdir -p "$ASPCACHE"; then - log_fatal 'failed to create ASPCACHE (%s)' "$ASPCACHE" + touch "$ASPROOT/.asp" || return 1 fi - [[ -f .asp ]] && return 0 - - git init -q || return 1 - for remote in "${ARCH_GIT_REPOS[@]}"; do - git remote add "$remote" "https://git.archlinux.org/svntogit/$remote.git" - done + if [[ ! -d $ASPCACHE ]]; then + mkdir -p "$ASPCACHE" || return 1 + fi - touch .asp + return 0 } dump_packages() { @@ -340,7 +336,7 @@ dispatch_action() { esac } -initialize +initialize || log_fatal 'failed to initialize asp repository in %s' "$ASPROOT" while getopts ':a:fhV' flag; do case $flag in diff --git a/package.inc.sh b/package.inc.sh index 3a64912..6fcf8c3 100644 --- a/package.inc.sh +++ b/package.inc.sh @@ -147,12 +147,12 @@ package_export() { if (( ! OPT_FORCE )); then # shellcheck disable=SC2154 - mkdir "$startdir/$pkgname" || return + mkdir "$pkgname" || return fi log_info 'exporting %s:%s' "$pkgname" "$subtree" git archive --format=tar "remotes/$remote/packages/$pkgname" "$subtree/" | - tar -C "$startdir" --transform "s,^$subtree,$pkgname," -xf - "$subtree/" + tar --transform "s,^$subtree,$pkgname," -xf - "$subtree/" } package_checkout() { @@ -165,9 +165,9 @@ package_checkout() { git branch -qf --no-track {,}"$remote/packages/$pkgname" quiet_git clone "$ASPROOT" --single-branch --branch "$remote/packages/$pkgname" \ - "$startdir/$pkgname" || return + "$pkgname" || return - git --git-dir="$startdir/$pkgname/.git" config pull.rebase true + git --git-dir="$pkgname/.git" config pull.rebase true } package_get_repos_with_arch() { |