Add a chroot command to mock?

Clark Williams williams at redhat.com
Thu Mar 2 16:09:05 UTC 2006


When cross-building a root filesystem, you need to bootstrap something
we call a "sysroot", which is essentially a software development
environment for the target system (headers and libraries mostly). The
way we do that is we create an empty "root" and as we build RPMS
(starting with GLIBC), we install the -devel packages into that target
root (the sysroot). Our cross toolchains know how to access the sysroot,
so when you compile hello.c, it gets the correct headers and libraries.

To be able to install rpms into the sysroot (which lives in the mock
chroot) I've added a chroot command to my local copy of mock (patch
below).

Anyone object to committing this? 

Clark

Index: mock.py
===================================================================
RCS file: /cvs/fedora/mock/mock.py,v
retrieving revision 1.36
diff -u -r1.36 mock.py
--- mock.py     24 Feb 2006 19:31:57 -0000      1.36
+++ mock.py     2 Mar 2006 15:48:01 -0000
@@ -781,6 +781,12 @@
         my.close()
         print 'Finished initializing root'
         
+    elif args[0] == 'chroot':
+        config_opts['clean'] = False
+        my= Root(config_opts)
+        my.do_chroot(' '.join(args[1:]), True)
+        print 'Finished chroot command'
+
     else:
         if args[0] == 'rebuild':
             if len(args) > 1:
-- 
Clark Williams <williams at redhat.com>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 191 bytes
Desc: This is a digitally signed message part
URL: <http://listman.redhat.com/archives/fedora-buildsys-list/attachments/20060302/23268404/attachment.sig>


More information about the Fedora-buildsys-list mailing list