[arch-projects] [DEVTOOLS][PATCH 1/2] Allow makechroot options in archbuild
This will allow, by example, to easily build a package with a custom pkg. staging-x86_64-build -- -cI /var/cache/pacman/pkg/ldoc-1.2.0-1-any.pkg.tar.xz staging-x86_64-build -- -n Signed-off-by: Sébastien Luttringer <seblu@seblu.net> --- archbuild.in | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/archbuild.in b/archbuild.in index 10d33b8..44288df 100644 --- a/archbuild.in +++ b/archbuild.in @@ -3,6 +3,7 @@ m4_include(lib/common.sh) base_packages=(base base-devel sudo) +makechrootpkg_args=(-c -n) cmd="${0##*/}" if [[ "${cmd%%-*}" == 'multilib' ]]; then @@ -18,13 +19,17 @@ chroots='/var/lib/archbuild' clean_first=false usage() { - echo "Usage: $cmd" + echo "Usage: $cmd [options] -- [makechrootpkg args]" + echo ' -h This help' echo ' -c Recreate the chroot before building' echo ' -r <dir> Create chroots in this directory' + echo '' + echo "Default makechrootpkg args: ${makechrootpkg_args[*]}" + echo '' exit 1 } -while getopts 'cr:' arg; do +while getopts 'hcr:' arg; do case "${arg}" in c) clean_first=true ;; r) chroots="$OPTARG" ;; @@ -32,7 +37,10 @@ while getopts 'cr:' arg; do esac done -if [[ "$EUID" != '0' ]]; then +# Pass all arguments after -- right to makepkg +makechrootpkg_args=("${@:$OPTIND}") + +if (( EUID )); then die 'This script must be run as root.' fi @@ -71,4 +79,4 @@ else fi msg "Building in chroot for [${repo}] (${arch})..." -exec setarch "${arch}" makechrootpkg -c -n -r "${chroots}/${repo}-${arch}" +exec setarch "${arch}" makechrootpkg "${makechrootpkg_args[@]}" -r "${chroots}/${repo}-${arch}" -- Sébastien "Seblu" Luttringer
This allow to build in one shot a package depending of a missing package Signed-off-by: Sébastien Luttringer <seblu@seblu.net> --- makechrootpkg.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/makechrootpkg.in b/makechrootpkg.in index 762ad7b..fb91100 100644 --- a/makechrootpkg.in +++ b/makechrootpkg.in @@ -161,8 +161,8 @@ if [[ -n $install_pkg ]]; then rm "$copydir/$pkgname" - # Exit early, we've done all we need to - exit $ret + # If there is no PKGBUILD we have done + [[ -f PKGBUILD ]] || exit $ret fi $update_first && mkarchroot -u "$copydir" -- Sébastien "Seblu" Luttringer
On Wed, Jan 02, 2013 at 01:42:44AM +0100, Sébastien Luttringer wrote:
This will allow, by example, to easily build a package with a custom pkg.
staging-x86_64-build -- -cI /var/cache/pacman/pkg/ldoc-1.2.0-1-any.pkg.tar.xz staging-x86_64-build -- -n
Signed-off-by: Sébastien Luttringer <seblu@seblu.net> --- archbuild.in | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/archbuild.in b/archbuild.in index 10d33b8..44288df 100644 --- a/archbuild.in +++ b/archbuild.in @@ -3,6 +3,7 @@ m4_include(lib/common.sh)
base_packages=(base base-devel sudo) +makechrootpkg_args=(-c -n)
You're proposing making cleaning the chroot the default? Definitely not needed or wanted...
cmd="${0##*/}" if [[ "${cmd%%-*}" == 'multilib' ]]; then @@ -18,13 +19,17 @@ chroots='/var/lib/archbuild' clean_first=false
usage() { - echo "Usage: $cmd" + echo "Usage: $cmd [options] -- [makechrootpkg args]" + echo ' -h This help' echo ' -c Recreate the chroot before building' echo ' -r <dir> Create chroots in this directory' + echo '' + echo "Default makechrootpkg args: ${makechrootpkg_args[*]}" + echo '' exit 1 }
-while getopts 'cr:' arg; do +while getopts 'hcr:' arg; do case "${arg}" in c) clean_first=true ;; r) chroots="$OPTARG" ;; @@ -32,7 +37,10 @@ while getopts 'cr:' arg; do esac done
-if [[ "$EUID" != '0' ]]; then +# Pass all arguments after -- right to makepkg +makechrootpkg_args=("${@:$OPTIND}") + +if (( EUID )); then die 'This script must be run as root.' fi
@@ -71,4 +79,4 @@ else fi
msg "Building in chroot for [${repo}] (${arch})..." -exec setarch "${arch}" makechrootpkg -c -n -r "${chroots}/${repo}-${arch}" +exec setarch "${arch}" makechrootpkg "${makechrootpkg_args[@]}" -r "${chroots}/${repo}-${arch}" -- Sébastien "Seblu" Luttringer
On Wed, Jan 2, 2013 at 1:45 AM, Dave Reisner <d@falconindy.com> wrote:
On Wed, Jan 02, 2013 at 01:42:44AM +0100, Sébastien Luttringer wrote:
This will allow, by example, to easily build a package with a custom pkg.
staging-x86_64-build -- -cI /var/cache/pacman/pkg/ldoc-1.2.0-1-any.pkg.tar.xz staging-x86_64-build -- -n
Signed-off-by: Sébastien Luttringer <seblu@seblu.net> --- archbuild.in | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/archbuild.in b/archbuild.in index 10d33b8..44288df 100644 --- a/archbuild.in +++ b/archbuild.in @@ -3,6 +3,7 @@ m4_include(lib/common.sh)
base_packages=(base base-devel sudo) +makechrootpkg_args=(-c -n)
You're proposing making cleaning the chroot the default? Definitely not needed or wanted...
It always clean the "copy" chroot before build. It's the current behaviour. Cheers, -- Sébastien "Seblu" Luttringer https://www.seblu.net GPG: 0x2072D77A
On 02/01/13 10:45, Dave Reisner wrote:
On Wed, Jan 02, 2013 at 01:42:44AM +0100, Sébastien Luttringer wrote:
This will allow, by example, to easily build a package with a custom pkg.
staging-x86_64-build -- -cI /var/cache/pacman/pkg/ldoc-1.2.0-1-any.pkg.tar.xz staging-x86_64-build -- -n
Signed-off-by: Sébastien Luttringer <seblu@seblu.net> --- archbuild.in | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/archbuild.in b/archbuild.in index 10d33b8..44288df 100644 --- a/archbuild.in +++ b/archbuild.in @@ -3,6 +3,7 @@ m4_include(lib/common.sh)
base_packages=(base base-devel sudo) +makechrootpkg_args=(-c -n)
You're proposing making cleaning the chroot the default? Definitely not needed or wanted...
Cleaning already is the default:
-exec setarch "${arch}" makechrootpkg -c -n -r "${chroots}/${repo}-${arch}" +exec setarch "${arch}" makechrootpkg "${makechrootpkg_args[@]}" -r "${chroots}/${repo}-${arch}"
No change there. There is a difference between "testing-i686-build -c" and "makechrootpkg -c". Anyway, I have to do this all the time with some of my packages and I think it best in these cases to use makechrootpkg directly. In fact... that is all I use. Allan
On Wed, Jan 2, 2013 at 1:50 AM, Allan McRae <allan@archlinux.org> wrote:
On 02/01/13 10:45, Dave Reisner wrote:
On Wed, Jan 02, 2013 at 01:42:44AM +0100, Sébastien Luttringer wrote:
This will allow, by example, to easily build a package with a custom pkg.
staging-x86_64-build -- -cI /var/cache/pacman/pkg/ldoc-1.2.0-1-any.pkg.tar.xz staging-x86_64-build -- -n
Signed-off-by: Sébastien Luttringer <seblu@seblu.net> --- archbuild.in | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/archbuild.in b/archbuild.in index 10d33b8..44288df 100644 --- a/archbuild.in +++ b/archbuild.in @@ -3,6 +3,7 @@ m4_include(lib/common.sh)
base_packages=(base base-devel sudo) +makechrootpkg_args=(-c -n)
You're proposing making cleaning the chroot the default? Definitely not needed or wanted...
Cleaning already is the default:
-exec setarch "${arch}" makechrootpkg -c -n -r "${chroots}/${repo}-${arch}" +exec setarch "${arch}" makechrootpkg "${makechrootpkg_args[@]}" -r "${chroots}/${repo}-${arch}"
No change there.
There is a difference between "testing-i686-build -c" and "makechrootpkg -c".
Anyway, I have to do this all the time with some of my packages and I think it best in these cases to use makechrootpkg directly. In fact... that is all I use.
Glad to see I'm not alone to have this behaviour :) Saving time from writing the path of the chroot everytime and calling twice makechrootpkg convince me to write those 2 patches which allow me to rebuild awesome in one shot. staging-build -- -cnI /var/cache/pacman/pkg/ldoc-1.2.0-1-any.pkg.tar.xz Another enhancement would be to add multiple -I parsing. Good night, -- Sébastien "Seblu" Luttringer https://www.seblu.net GPG: 0x2072D77A
On Tue, Jan 01, 2013 at 07:45:06PM -0500, Dave Reisner wrote:
On Wed, Jan 02, 2013 at 01:42:44AM +0100, Sébastien Luttringer wrote:
This will allow, by example, to easily build a package with a custom pkg.
staging-x86_64-build -- -cI /var/cache/pacman/pkg/ldoc-1.2.0-1-any.pkg.tar.xz staging-x86_64-build -- -n
Signed-off-by: Sébastien Luttringer <seblu@seblu.net> --- archbuild.in | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/archbuild.in b/archbuild.in index 10d33b8..44288df 100644 --- a/archbuild.in +++ b/archbuild.in @@ -3,6 +3,7 @@ m4_include(lib/common.sh)
base_packages=(base base-devel sudo) +makechrootpkg_args=(-c -n)
You're proposing making cleaning the chroot the default? Definitely not needed or wanted...
Nevermind. Not sure what I'm looking at.
cmd="${0##*/}" if [[ "${cmd%%-*}" == 'multilib' ]]; then @@ -18,13 +19,17 @@ chroots='/var/lib/archbuild' clean_first=false
usage() { - echo "Usage: $cmd" + echo "Usage: $cmd [options] -- [makechrootpkg args]" + echo ' -h This help' echo ' -c Recreate the chroot before building' echo ' -r <dir> Create chroots in this directory' + echo '' + echo "Default makechrootpkg args: ${makechrootpkg_args[*]}" + echo '' exit 1 }
-while getopts 'cr:' arg; do +while getopts 'hcr:' arg; do case "${arg}" in c) clean_first=true ;; r) chroots="$OPTARG" ;; @@ -32,7 +37,10 @@ while getopts 'cr:' arg; do esac done
-if [[ "$EUID" != '0' ]]; then +# Pass all arguments after -- right to makepkg +makechrootpkg_args=("${@:$OPTIND}") + +if (( EUID )); then die 'This script must be run as root.' fi
@@ -71,4 +79,4 @@ else fi
msg "Building in chroot for [${repo}] (${arch})..." -exec setarch "${arch}" makechrootpkg -c -n -r "${chroots}/${repo}-${arch}" +exec setarch "${arch}" makechrootpkg "${makechrootpkg_args[@]}" -r "${chroots}/${repo}-${arch}" -- Sébastien "Seblu" Luttringer
participants (3)
-
Allan McRae
-
Dave Reisner
-
Sébastien Luttringer