X-Original-To: alpine-devel@lists.alpinelinux.org Received: from lithium.8pit.net (lithium.8pit.net [81.4.121.103]) by lists.alpinelinux.org (Postfix) with ESMTP id 9B66F5C41B4; Wed, 13 Jul 2016 14:02:43 +0000 (GMT) Received: from localhost (p3EE0E856.dip0.t-ipconnect.de [62.224.232.86]) by lithium.8pit.net (OpenSMTPD) with ESMTPSA id 82de6277 TLS version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO; Wed, 13 Jul 2016 16:02:40 +0200 (CEST) From: =?UTF-8?q?S=C3=B6ren=20Tempel?= To: alpine-devel@lists.alpinelinux.org Subject: [alpine-devel] [PATCH 2/2] abuild: simplify $pkgver handling in snapshot() Date: Wed, 13 Jul 2016 16:02:27 +0200 Message-Id: <20160713140227.12362-2-soeren+git@soeren-tempel.net> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20160713140227.12362-1-soeren+git@soeren-tempel.net> References: <20160713140227.12362-1-soeren+git@soeren-tempel.net> X-Mailinglist: alpine-devel Precedence: list List-Id: Alpine Development List-Unsubscribe: List-Post: List-Help: List-Subscribe: Drop $verbase and simply use the version specified in $pkgver for tarballs. I don't know why this wasn't done before but this seems to be the easiest approach. --- abuild.in | 49 +++++++++++++++++++------------------------------ 1 file changed, 19 insertions(+), 30 deletions(-) diff --git a/abuild.in b/abuild.in index a0637c9..7e18885 100644 --- a/abuild.in +++ b/abuild.in @@ -2066,7 +2066,6 @@ all() { # # Revision to checkout is optional but recommended. If you specify $disturl # your distfile will automatically be uploaded with rsync to the url provided. -# Base version defaults to 0 except if specified by $verbase. snapshot() { # included for compatiblity with old APKBUILDs @@ -2084,52 +2083,45 @@ snapshot() { [ -z "$vcsurls" ] && die "Missing repository url in APKBUILD!" [ -n "$reporev" ] && warning "The \$reporev variable is deprecated." - local _date=$(date +%Y%m%d) - local _format="tar.gz" # remove any repositories left in srcdir abuild clean mkdir -p "$srcdir" && cd "$srcdir" - local scr= ver= url= rver= type= + local fmt=tar.gz scr= ver= url= type= for url in $vcsurls; do echo "$url" | grep -q + 2>/dev/null || \ die "VCS type for '$url' wasn't specified." - type="${url%+*}" - url="${url##*+}" - ver="${url##*\#}" - url="${url%\#*}" + type="${url%+*}" # Extract VCS type from URL. + url="${url##*+}" # Remove VCS type from URL. + ver="${url##*\#}" # Extract revision from URL. + url="${url%\#*}" # Remove revision from URL. + scr="$pkgname-${url##*/}-$pkgver" [ -z "${ver}" ] && warning "Please specify a revision to checkout for '$url'." case "$type" in svn) - rver=${verbase:-0}_svn${_date} - scr="$pkgname-${url##*/}-$rver" - command -v svn >/dev/null || \ die "Missing svn! Install subverion to support svn export." - [ -n "$ver" ] && local _rev="-r $ver" - msg "Creating svn snapshot: $scr" - svn co $_rev "$url" $scr || return 1 - tar zcf $scr.$_format $scr || return 1 + [ -n "$ver" ] && local rev="-r $ver" + msg "Creating svn snapshot for '$url'" + svn co $rev "$url" $scr || return 1 + tar zcf $scr.$fmt $scr || return 1 ;; git) - rver=${verbase:-0}_git${_date} - scr="$pkgname-${url##*/}-$rver" - command -v git >/dev/null || \ die "Missing git! Install git to support git clone." - local _rev="${ver:-HEAD}" - [ "$_rev" = "HEAD" ] && local _depth="--depth=1" - msg "Creating git snapshot: $scr" + local rev="${ver:-HEAD}" + [ "$rev" = "HEAD" ] && local _depth="--depth=1" + msg "Creating git snapshot for '$url'" git clone $_depth --bare "$url" $scr || return 1 git --git-dir $scr archive \ - -o $scr.$_format \ - --format=$_format \ - --prefix=$pkgname-$rver/ $_rev \ + -o $scr.$fmt \ + --format=$fmt \ + --prefix=$scr/ $rev \ || return 1 ;; *) die "Unsupported VCS type: '${type}'" ;; @@ -2139,16 +2131,13 @@ snapshot() { if [ -n "$disturl" ]; then command -v rsync >/dev/null || \ die "Missing rsync! Install rsync to enable automatic uploads." - msg "Uploading to $disturl" - rsync --progress -La $scr $disturl || return 1 + msg "Uploading '$scr' to '$disturl'" + rsync --progress -La $scr.$fmt $disturl || return 1 fi done cd "$startdir" - # set the pkgver to current date and update checksum - sed -i -e "s/^pkgver=.*/pkgver=${rver}/" \ - APKBUILD || return 1 - abuild checksum + [ -n "$disturl" ] && abuild checksum } usage() { -- 2.9.0 --- Unsubscribe: alpine-devel+unsubscribe@lists.alpinelinux.org Help: alpine-devel+help@lists.alpinelinux.org ---