[opensuse-buildservice] [PATCH] Add --build-abuild-id to osc and build and add --map-repo to osc

When building locally in a qemu/chroot and debugging I find I want to edit the files in the chroot from my desktop gui editor but they're all owned by 399:399. This pair of patches allows me to set the uid:gid to match my local user and eases this process. usage is: build --build-abuild-id uid:gid or more usually: osc build --build-abuild-id 500:500 osc also accepts (and extends the default) .oscrc settings: build-abuild-id = 500:500 It only supports numeric ids. The osc patch also adds --map-repo to aggregatepac which allows repository mapping(s) to be given as SRC=TARGET[,SRC=TARGET] eg, a real usage: osc aggregatepac -m MerStable_Debian_5.0=Mer0.13_Debian_5.0,MerStable_Ubuntu_9.04=Mer0.13_Ubuntu_9.04 Maemo:Mer:0.13:HW:N8x0 advanced-power Maemo:Mer:Stable:HW:N8x0 https://build.opensuse.org/package/view_file?file=_aggregate&package=advance... David -- "Don't worry, you'll be fine; I saw it work in a cartoon once..."

David Greaves wrote:
When building locally in a qemu/chroot and debugging I find I want to edit the files in the chroot from my desktop gui editor but they're all owned by 399:399.
When needed I hack around that with a script that changes the group and mode to 664 :-)
This pair of patches allows me to set the uid:gid to match my local user and eases this process.
usage is: build --build-abuild-id uid:gid
Quite long, what about just using --uid?
The osc patch also adds --map-repo to aggregatepac which allows repository mapping(s) to be given as SRC=TARGET[,SRC=TARGET]
I'd recommend to post that as separate patch.
+ --build-abuild-id) + ABUILD_ID="$ARG" + if [[ ${BASH_VERSINFO[0]} -ge 3 && ! $ABUILD_ID =~ ^[0-9]{1,5}:[0-9]{1,5}$ ]] ; then
if test -n "${ABUILD_UID//[0-9]/}"; then ... works with bash2 too
if test $BUILD_USER = abuild ; then if ! egrep '^abuild:' >/dev/null <$BUILD_ROOT/etc/passwd ; then - echo 'abuild::399:399:Autobuild:/home/abuild:/bin/bash' >>$BUILD_ROOT/etc/passwd + echo "abuild::${ABUILD_UID}:${ABUILD_GID}:Autobuild:/home/abuild:/bin/bash" >>$BUILD_ROOT/etc/passwd
You should better check whether uids still match.
--- osc-0.117/osc/conf.py 2009-04-22 12:16:00.000000000 +0100 +++ osc-0.117lbt/osc/conf.py 2009-05-08 20:30:51.758699798 +0100 @@ -48,6 +48,7 @@ + 'build-abuild-id': '399:399',
osc shouldn't hard code that setting. Default should be empty ie don't pass the uid option. cu Ludwig -- (o_ Ludwig Nussel //\ V_/_ http://www.suse.de/ SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nuernberg) -- To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-buildservice+help@opensuse.org

Ludwig - I missed your comments first time round - sorry :) I resent the patch unchanged on 31/7. I will revise and resend. Comments below. Ludwig Nussel wrote:
David Greaves wrote:
When building locally in a qemu/chroot and debugging I find I want to edit the files in the chroot from my desktop gui editor but they're all owned by 399:399.
When needed I hack around that with a script that changes the group and mode to 664 :-)
Which is why I made the patch :)
build --build-abuild-id uid:gid Quite long, what about just using --uid?
OK
The osc patch also adds --map-repo to aggregatepac which I'd recommend to post that as separate patch.
I was being lazy. I did.
+ if [[ ${BASH_VERSINFO[0]} -ge 3 && ! $ABUILD_ID =~ ^[0-9]{1,5}:[0-9]{1,5}$ ]] ; then
if test -n "${ABUILD_UID//[0-9]/}"; then ... works with bash2 too Thanks
if test $BUILD_USER = abuild ; then if ! egrep '^abuild:' >/dev/null <$BUILD_ROOT/etc/passwd ; then - echo 'abuild::399:399:Autobuild:/home/abuild:/bin/bash' >>$BUILD_ROOT/etc/passwd + echo "abuild::${ABUILD_UID}:${ABUILD_GID}:Autobuild:/home/abuild:/bin/bash" >>$BUILD_ROOT/etc/passwd
You should better check whether uids still match.
Hmm, you mean if build is run twice without clean and with different uids? I'd be quite tempted to leave that as a "feel free to not aim at your foot" bug :) I'll take a look.
--- osc-0.117/osc/conf.py 2009-04-22 12:16:00.000000000 +0100 +++ osc-0.117lbt/osc/conf.py 2009-05-08 20:30:51.758699798 +0100 @@ -48,6 +48,7 @@ + 'build-abuild-id': '399:399',
osc shouldn't hard code that setting. Default should be empty ie don't pass the uid option. OK
-- "Don't worry, you'll be fine; I saw it work in a cartoon once..." -- To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-buildservice+help@opensuse.org

Marcus, Ludwig So this is an old patch that I've refreshed and incorporated feedback. Can you take a look and confirm it's OK for me to push. build patch: http://gitorious.org/opensuse/lbt-build/commit/613eece338ce380536f2a1aac5008... osc patch: http://gitorious.org/opensuse/lbt-osc/commit/d49c59008702edc2439a20ebd1d311d... Ludwig Nussel wrote:
David Greaves wrote:
When building locally in a qemu/chroot and debugging I find I want to edit the files in the chroot from my desktop gui editor but they're all owned by 399:399. This pair of patches allows me to set the uid:gid to match my local user and eases this process.
usage is: build --build-abuild-id uid:gid
Quite long, what about just using --uid?
OK. I'm using --uid in build and --build-uid in osc (since the config is build-uid and the opts is --build-uid) (I never really expect it to come from
+ --build-abuild-id) + ABUILD_ID="$ARG" + if [[ ${BASH_VERSINFO[0]} -ge 3 && ! $ABUILD_ID =~ ^[0-9]{1,5}:[0-9]{1,5}$ ]] ; then
if test -n "${ABUILD_UID//[0-9]/}"; then ... works with bash2 too OK, done
if test $BUILD_USER = abuild ; then if ! egrep '^abuild:' >/dev/null <$BUILD_ROOT/etc/passwd ; then - echo 'abuild::399:399:Autobuild:/home/abuild:/bin/bash' >>$BUILD_ROOT/etc/passwd + echo "abuild::${ABUILD_UID}:${ABUILD_GID}:Autobuild:/home/abuild:/bin/bash" >>$BUILD_ROOT/etc/passwd
You should better check whether uids still match. Done
--- osc-0.117/osc/conf.py 2009-04-22 12:16:00.000000000 +0100 +++ osc-0.117lbt/osc/conf.py 2009-05-08 20:30:51.758699798 +0100 @@ -48,6 +48,7 @@ + 'build-abuild-id': '399:399',
osc shouldn't hard code that setting. Default should be empty ie don't pass the uid option. Done.
I also allowed "caller" as a value to osc --build-uid as suggested by darix. David -- "Don't worry, you'll be fine; I saw it work in a cartoon once..." -- To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-buildservice+help@opensuse.org

We use your earlier patch on our internal version of osc and build. It's very useful for doing incremental builds by being able to rsync in data into the chroot and have the permissions work from inside and out the chroot. On Fri, 2010-02-12 at 16:11 -0600, David Greaves wrote:
Marcus, Ludwig
So this is an old patch that I've refreshed and incorporated feedback.
Can you take a look and confirm it's OK for me to push.
build patch: http://gitorious.org/opensuse/lbt-build/commit/613eece338ce380536f2a1aac5008...
osc patch: http://gitorious.org/opensuse/lbt-osc/commit/d49c59008702edc2439a20ebd1d311d...
Ludwig Nussel wrote:
David Greaves wrote:
When building locally in a qemu/chroot and debugging I find I want to edit the files in the chroot from my desktop gui editor but they're all owned by 399:399. This pair of patches allows me to set the uid:gid to match my local user and eases this process.
usage is: build --build-abuild-id uid:gid
Quite long, what about just using --uid?
OK. I'm using --uid in build and --build-uid in osc (since the config is build-uid and the opts is --build-uid) (I never really expect it to come from
+ --build-abuild-id) + ABUILD_ID="$ARG" + if [[ ${BASH_VERSINFO[0]} -ge 3 && ! $ABUILD_ID =~ ^[0-9]{1,5}:[0-9]{1,5}$ ]] ; then
if test -n "${ABUILD_UID//[0-9]/}"; then ... works with bash2 too OK, done
if test $BUILD_USER = abuild ; then if ! egrep '^abuild:' >/dev/null <$BUILD_ROOT/etc/passwd ; then - echo 'abuild::399:399:Autobuild:/home/abuild:/bin/bash' >>$BUILD_ROOT/etc/passwd + echo "abuild::${ABUILD_UID}:${ABUILD_GID}:Autobuild:/home/abuild:/bin/bash" >>$BUILD_ROOT/etc/passwd
You should better check whether uids still match. Done
--- osc-0.117/osc/conf.py 2009-04-22 12:16:00.000000000 +0100 +++ osc-0.117lbt/osc/conf.py 2009-05-08 20:30:51.758699798 +0100 @@ -48,6 +48,7 @@ + 'build-abuild-id': '399:399',
osc shouldn't hard code that setting. Default should be empty ie don't pass the uid option. Done.
I also allowed "caller" as a value to osc --build-uid as suggested by darix.
David
-- "Don't worry, you'll be fine; I saw it work in a cartoon once..."
-- To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-buildservice+help@opensuse.org

David Greaves wrote:
Marcus, Ludwig
So this is an old patch that I've refreshed and incorporated feedback.
Can you take a look and confirm it's OK for me to push.
build patch: http://gitorious.org/opensuse/lbt-build/commit/613eece338ce380536f2a1aac5008...
osc patch: http://gitorious.org/opensuse/lbt-osc/commit/d49c59008702edc2439a20ebd1d311d...
Fine with me. cu Ludwig -- (o_ Ludwig Nussel //\ V_/_ http://www.suse.de/ SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nuernberg) -- To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-buildservice+help@opensuse.org
participants (3)
-
David Greaves
-
Ludwig Nussel
-
Luke Imhoff