~alpine/aports

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
4 2

[alpine-aports] [PATCH 1/3] abuild: use standard-issue prepare by default

Details
Message ID
<1454365949-60951-1-git-send-email-muh.muhten@gmail.com>
Sender timestamp
1454365947
DKIM signature
missing
Download raw message
Patch: +14 -1
A majority of APKBUILDs currently use exactly the prepare() provided by
newapkbuild verbatim, even for packages where no patches exist, which
has created the expectation that patches listed as sources are applied
by default.

This rev simply adds that default prepare() to abuild (and exposes it as
default_prepare), with no configurability. If needed, default behaviour
can be overridden by providing explicitly prepare().
---
 abuild.in | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/abuild.in b/abuild.in
index 1f330b1..1b94750 100644
--- a/abuild.in
+++ b/abuild.in
@@ -528,8 +528,21 @@ getpkgver() {
	fi
}

default_prepare() {
	local i
	cd "$_builddir"
	for i in $source; do
		case $i in
			*.patch)
				msg "$i"
				patch -p1 -i "$srcdir/$i" || return 1
				;;
		esac
	done
}

prepare() {
	:
	default_prepare
}

build() {
-- 
2.5.4 (Apple Git-61)



---
Unsubscribe:  alpine-aports+unsubscribe@lists.alpinelinux.org
Help:         alpine-aports+help@lists.alpinelinux.org
---

[alpine-aports] [PATCH 2/3] newapkbuild: remove default prepare()

Details
Message ID
<1454365949-60951-2-git-send-email-muh.muhten@gmail.com>
In-Reply-To
<1454365949-60951-1-git-send-email-muh.muhten@gmail.com> (view parent)
Sender timestamp
1454365948
DKIM signature
missing
Download raw message
Patch: +0 -15
Do not add prepare() to new APKBUILDs in the future, as this
functionality is superseded by the addition of the default prepare
patcher in abuild.
---
 newapkbuild.in | 15 ---------------
 1 file changed, 15 deletions(-)

diff --git a/newapkbuild.in b/newapkbuild.in
index a47dcae..64b726b 100644
--- a/newapkbuild.in
+++ b/newapkbuild.in
@@ -224,21 +224,6 @@ __EOF__
		fi
	fi


	# Create the prepare() template
	cat >>APKBUILD<<__EOF__
prepare() {
	local i
	cd "\$_builddir"
	for i in \$source; do
		case \$i in
		*.patch) msg \$i; patch -p1 -i "\$srcdir"/\$i || return 1;;
		esac
	done
}

__EOF__

	# Create build() function
	cat >>APKBUILD<<__EOF__
build() {
-- 
2.5.4 (Apple Git-61)



---
Unsubscribe:  alpine-aports+unsubscribe@lists.alpinelinux.org
Help:         alpine-aports+help@lists.alpinelinux.org
---

[alpine-aports] [PATCH 3/3] abuild: whitespace cleanup?

Details
Message ID
<1454365949-60951-3-git-send-email-muh.muhten@gmail.com>
In-Reply-To
<1454365949-60951-1-git-send-email-muh.muhten@gmail.com> (view parent)
Sender timestamp
1454365949
DKIM signature
missing
Download raw message
Patch: +44 -44
not sure what happened there but it was jarringly inconsistent
---
 abuild.in | 88 +++++++++++++++++++++++++++++++--------------------------------
 1 file changed, 44 insertions(+), 44 deletions(-)

diff --git a/abuild.in b/abuild.in
index 1b94750..2920df6 100644
--- a/abuild.in
+++ b/abuild.in
@@ -2030,52 +2030,52 @@ all() {
# Base version defaults to 0 except if specified by $verbase.

snapshot() {
        # check if we setup vars correctly
        [ -z "$disturl" ] && warning "Missing disturl in APKBUILD, auto uploading disabled."
        [ -z "$svnurl" ] && [ -z "$giturl" ] && die "Missding repository url in APKBUILD!"
        [ -n "$svnurl" ] && [ -n "$giturl" ] && die "You can only use a single repository!"
        local _date=$(date +%Y%m%d)
	# check if we setup vars correctly
	[ -z "$disturl" ] && warning "Missing disturl in APKBUILD, auto uploading disabled."
	[ -z "$svnurl" ] && [ -z "$giturl" ] && die "Missding repository url in APKBUILD!"
	[ -n "$svnurl" ] && [ -n "$giturl" ] && die "You can only use a single repository!"
	local _date=$(date +%Y%m%d)
	local _format="tar.gz"
        # remove any repositories left in srcdir
        abuild clean
        mkdir -p "$srcdir" && cd "$srcdir"
        # clone git repo and archive
        if [ -n "$giturl" ]; then
                local _version=${verbase:-0}_git${_date}
                command -v git >/dev/null || \
                        die "Missing git! Install git to support git clone."
                [ -z "$reporev" ] && local _rev="HEAD" && local _depth="--depth=1"
                msg "Creating git snapshot: $pkgname-$_version"
                git clone $_depth --bare $giturl $pkgname-$_version || return 1
                git --git-dir $pkgname-$_version archive \
	# remove any repositories left in srcdir
	abuild clean
	mkdir -p "$srcdir" && cd "$srcdir"
	# clone git repo and archive
	if [ -n "$giturl" ]; then
		local _version=${verbase:-0}_git${_date}
		command -v git >/dev/null || \
			die "Missing git! Install git to support git clone."
		[ -z "$reporev" ] && local _rev="HEAD" && local _depth="--depth=1"
		msg "Creating git snapshot: $pkgname-$_version"
		git clone $_depth --bare $giturl $pkgname-$_version || return 1
		git --git-dir $pkgname-$_version archive \
			--format=$_format \
                        -o $pkgname-$_version.$_format \
                        --prefix=$pkgname-$_version/ $_rev \
                        || return 1
        fi
        # export svn repo and archive
        if [ -n "$svnurl" ]; then
                local _version=${verbase:-0}_svn${_date}
                command -v svn >/dev/null || \
                        die "Missing svn! Install subverion to support svn export."
                [ -n "$reporev" ] && local _rev="-r $reporev"
                msg "Creating svn snapshot: $pkgname-$_version"
                svn co $_rev $svnurl $pkgname-$_version || return 1
                tar zcf $pkgname-$_version.$_format $pkgname-$_version || return 1
        fi
        # upload to defined distfiles url
        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 $pkgname-$_version.$_format \
                        $disturl || return 1
                cd "$startdir"
                # set the pkgver to current date and update checksum
                sed -i -e "s/^pkgver=.*/pkgver=${_version}/" \
                        APKBUILD || return 1
                abuild checksum
                fi
			-o $pkgname-$_version.$_format \
			--prefix=$pkgname-$_version/ $_rev \
			|| return 1
	fi
	# export svn repo and archive
	if [ -n "$svnurl" ]; then
		local _version=${verbase:-0}_svn${_date}
		command -v svn >/dev/null || \
			die "Missing svn! Install subverion to support svn export."
		[ -n "$reporev" ] && local _rev="-r $reporev"
		msg "Creating svn snapshot: $pkgname-$_version"
		svn co $_rev $svnurl $pkgname-$_version || return 1
		tar zcf $pkgname-$_version.$_format $pkgname-$_version || return 1
	fi
	# upload to defined distfiles url
	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 $pkgname-$_version.$_format \
			$disturl || return 1
		cd "$startdir"
		# set the pkgver to current date and update checksum
		sed -i -e "s/^pkgver=.*/pkgver=${_version}/" \
			APKBUILD || return 1
		abuild checksum
	fi
}

usage() {
-- 
2.5.4 (Apple Git-61)



---
Unsubscribe:  alpine-aports+unsubscribe@lists.alpinelinux.org
Help:         alpine-aports+help@lists.alpinelinux.org
---

Re: [alpine-aports] [PATCH 2/3] newapkbuild: remove default prepare()

Details
Message ID
<56B089FB.9070305@gmail.com>
In-Reply-To
<20160202065025.fc1318a9f038027d2aa32d63@mauras.ch> (view parent)
Sender timestamp
1454410235
DKIM signature
missing
Download raw message
Nothing special. An added prepare() will function correctly and be run 
instead of default prepare.

To clear up some confusion: this patch is intended to apply in the 
context of %1521; default_prepare is *not* implemented yet, I just sent 
in the two patches together.

Only APKBUILDs with no prepare() definition should be affected; there is 
no change to the logic when abuild calls prepare, only the default 
function definition changes from silent no-op to the patching behavior 
newapkbuild generates.

Michael

On 2016-02-02 12:50 AM, Olivier Mauras wrote:
> Hello,
>
> How does that behave if one adds prepare() back in the APKBUILD? prepare() can be used for other things than just patches.
>
> Regards,
> Olivier
>


---
Unsubscribe:  alpine-aports+unsubscribe@lists.alpinelinux.org
Help:         alpine-aports+help@lists.alpinelinux.org
---

Re: [alpine-aports] [PATCH 2/3] newapkbuild: remove default prepare()

Olivier Mauras <olivier@mauras.ch>
Details
Message ID
<20160202065025.fc1318a9f038027d2aa32d63@mauras.ch>
In-Reply-To
<1454365949-60951-2-git-send-email-muh.muhten@gmail.com> (view parent)
Sender timestamp
1454392225
DKIM signature
missing
Download raw message
On Mon,  1 Feb 2016 17:32:28 -0500
Muh Muhten <muh.muhten@gmail.com> wrote:

> Do not add prepare() to new APKBUILDs in the future, as this
> functionality is superseded by the addition of the default prepare
> patcher in abuild.
> ---
>  newapkbuild.in | 15 ---------------
>  1 file changed, 15 deletions(-)
> 
> diff --git a/newapkbuild.in b/newapkbuild.in
> index a47dcae..64b726b 100644
> --- a/newapkbuild.in
> +++ b/newapkbuild.in
> @@ -224,21 +224,6 @@ __EOF__
>  		fi
>  	fi
>  
> -
> -	# Create the prepare() template
> -	cat >>APKBUILD<<__EOF__
> -prepare() {
> -	local i
> -	cd "\$_builddir"
> -	for i in \$source; do
> -		case \$i in
> -		*.patch) msg \$i; patch -p1 -i "\$srcdir"/\$i || return 1;;
> -		esac
> -	done
> -}
> -
> -__EOF__
> -
>  	# Create build() function
>  	cat >>APKBUILD<<__EOF__
>  build() {
> -- 
> 2.5.4 (Apple Git-61)
> 
> 
> 
> ---
> Unsubscribe:  alpine-aports+unsubscribe@lists.alpinelinux.org
> Help:         alpine-aports+help@lists.alpinelinux.org
> ---

Hello,

How does that behave if one adds prepare() back in the APKBUILD? prepare() can be used for other things than just patches.

Regards,
Olivier
Reply to thread Export thread (mbox)