Binary files osc-0.117/osc/babysitter.pyc and osc-0.117lbt/osc/babysitter.pyc differ
diff -uNr osc-0.117/osc/build.py osc-0.117lbt/osc/build.py
--- osc-0.117/osc/build.py	2009-04-22 12:16:00.000000000 +0100
+++ osc-0.117lbt/osc/build.py	2009-05-08 21:57:40.396766503 +0100
@@ -278,6 +278,18 @@
         buildargs.append('--with %s' % opts._with)
     if opts.without:
         buildargs.append('--without %s' % opts.without)
+    if opts.build_abuild_id or config['build-abuild-id']:
+        buildidre = re.compile('^[0-9]{1,5}:[0-9]{1,5}$')
+        if opts.build_abuild_id:
+            if not buildidre.match(opts.build_abuild_id):
+                print >>sys.stderr, 'Error: build-abuild-id arg must be 2 colon separated numerics: "uid:gid"'
+                return 1
+            buildargs.append('--build-abuild-id %s' % opts.build_abuild_id)
+        elif config['build-abuild-id']:
+            if not buildidre.match(config['build-abuild-id']):
+                print >>sys.stderr, 'Error: build-abuild-id config must be 2 colon separated numerics: "uid:gid"'
+                return 1
+            buildargs.append('--build-abuild-id %s' % config['build-abuild-id'])
 # FIXME: quoting
 #    if opts.define:
 #        buildargs.append('--define "%s"' % opts.define)
Binary files osc-0.117/osc/cmdln.pyc and osc-0.117lbt/osc/cmdln.pyc differ
diff -uNr osc-0.117/osc/commandline.py osc-0.117lbt/osc/commandline.py
--- osc-0.117/osc/commandline.py	2009-04-23 10:25:38.000000000 +0100
+++ osc-0.117lbt/osc/commandline.py	2009-04-29 22:16:12.198461134 +0100
@@ -1979,6 +1979,9 @@
                   help='Run build as root. The default is to build as '
                   'unprivileged user. Note that a line "# norootforbuild" '
                   'in the spec file will invalidate this option.')
+    @cmdln.option('--build-abuild-id', metavar='uid:gid',
+                  help='specify the numeric uid:gid pair to assign to the '
+                  'unprivileged "abuild" user')
     @cmdln.option('--local-package', action='store_true',
                   help='build a package which does not exist on the server')
     @cmdln.option('--alternative-project', metavar='PROJECT',
@@ -1999,9 +2002,9 @@
         of the 'osc repos' output. BUILD_DESCR is either a RPM spec file, or a
         Debian dsc file.
 
-        The command honours packagecachedir and build-root settings in .oscrc,
-        if present. You may want to set su-wrapper = 'sudo' in .oscrc, and
-        configure sudo with option NOPASSWD for /usr/bin/build.
+        The command honours packagecachedir, build-root and build-abuild-id
+        settings in .oscrc, if present. You may want to set su-wrapper = 'sudo'
+        in .oscrc, and configure sudo with option NOPASSWD for /usr/bin/build.
 
         If neither --clean nor --noinit is given, build will reuse an existing
         build-root again, removing unneeded packages and add missing ones. This
Binary files osc-0.117/osc/commandline.pyc and osc-0.117lbt/osc/commandline.pyc differ
diff -uNr osc-0.117/osc/conf.py osc-0.117lbt/osc/conf.py
--- 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-cmd': '/usr/bin/build',
              'build-type' : '', # may be empty for chroot, kvm or xen
              'build-root': '/var/tmp/build-root',
+             'build-abuild-id': '399:399',
              'build-device': '', # required for VM builds
              'build-memory' : '',# required for VM builds
              'build-swap' : '',  # optional for VM builds
@@ -85,6 +86,12 @@
 # /srv/oscbuild/%%(repo)s-%%(arch)s-%%(project)s-%%(package)s
 #build-root = %(build-root)s
 
+# Numeric uid:gid to assign to the "abuild" user in the build-root
+# This is convenient when sharing the buildroot with ordinary userids
+# on the host.
+# This should not be 0
+build-abuild-id = 399:399
+
 # extra packages to install when building packages locally (osc build)
 # this corresponds to osc build's -x option and can be overridden with that
 # -x '' can also be given on the command line to override this setting, or

