mock README,1.2,1.3 mock.py,1.2,1.3

Seth Vidal (skvidal) fedora-extras-commits at redhat.com
Mon May 16 15:04:46 UTC 2005


Author: skvidal

Update of /cvs/fedora/mock
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv12631

Modified Files:
	README mock.py 
Log Message:

- default now the default config file
- checks for membership in mock group before running
- run yum update if the chroot is set to not be cleaned out



Index: README
===================================================================
RCS file: /cvs/fedora/mock/README,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- README	16 May 2005 06:27:02 -0000	1.2
+++ README	16 May 2005 15:04:44 -0000	1.3
@@ -25,14 +25,9 @@
 - outputs little unless it needs to.
 
 
-TODO: make readme
-TODO: make mock check the user's groups and error nicely if they are not in
-      the mock group
 TODO: make other UID/GID's than 500 work
 TODO: document more
 TODO: man page?
-TODO: make default.cfg the default config file to look ast
 TODO: symlink fedora-development-i386-core.cfg to default.cfg
-TODO: if clean is not set then run 'yum update' on the tree instead
 TODO: changelog
 TODO: check on it working with yum 2.2.X on FC3/EL4, too.


Index: mock.py
===================================================================
RCS file: /cvs/fedora/mock/mock.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- mock.py	16 May 2005 06:27:02 -0000	1.2
+++ mock.py	16 May 2005 15:04:44 -0000	1.3
@@ -26,6 +26,8 @@
 import tempfile
 import shutil
 import types
+import grp
+import pwd
 from optparse import OptionParser
 
 __VERSION__ = '0.1'
@@ -143,7 +145,11 @@
     def prep(self):
         self.state('Starting Prep')
         self._prep_install()
-        cmd = 'groupinstall %s' % self.config['buildgroup']
+        if self.config['clean']:
+            cmd = 'groupinstall %s' % self.config['buildgroup']
+        else:
+            cmd = 'update'
+
         self.yum(cmd)
         self._prep_build()
         self.state('Finished Prep')
@@ -556,7 +562,8 @@
     usage = "usage: mock [options] /path/to/srpm"
     parser = OptionParser(usage=usage, version=__VERSION__)
     parser.add_option("-r", action="store", type="string", dest="chroot",
-                      default='chroot.cfg', help="chroot name/config file name default: %default")
+                      default='default', 
+                      help="chroot name/config file name default: %default")
     parser.add_option("--no-clean", action ="store_true", dest="dirty", 
              help="do not clean chroot before building")
     parser.add_option("--arch", action ="store", dest="arch", 
@@ -569,6 +576,20 @@
     return parser.parse_args()
     
 def main():
+    # before we go on, make sure the user is a member of the 'mock' group.
+    member = False
+    for item in os.getgroups():
+        try:
+            grptup = grp.getgrgid(item)
+        except KeyError, e:
+            continue
+        if grptup[0] == 'mock':
+            member = True
+
+    if not member:
+        print "You need to be a member of the mock group for this to work"
+        sys.exit(1)
+        
     # config path
     config_path='/etc/mock'
     




More information about the scm-commits mailing list