* Fix parsing of "@" dependencies. Colin Watson. Closes: #667022.
* Fix NameError re "f" in restriction parsing.
Martin Pitt. Closes: #647882.
+ * Improve handling of schroot root-users and root-groups.
+ Colin Watson. Closes: #667001.
Packaging fixes:
* Add Recommends against pbuilder, whose dependency resolver adt-run
import VirtSubproc as vsp
capabilities = []
+def pw_uid(exp_name):
+ try:
+ return pwd.getpwnam(exp_name).pw_uid
+ except KeyError:
+ return None
+
+def gr_gid(exp_name):
+ try:
+ return grp.getgrnam(exp_name).gr_gid
+ except KeyError:
+ return None
+
+def match(exp_names, ids, extract_id):
+ for exp_name in [n for n in exp_names.split(',') if n]:
+ if extract_id(exp_name) in ids:
+ return True
+ return False
+
def parse_args():
global schroot, debuglevel
if regexp.search('snapshot',cfg['type']):
capabilities.append('revert')
- if [True
- for exp_name in cfg['root-users'].split(',')
- for got_uid in [os.getuid()]
- if got_uid == pwd.getpwnam(exp_name).pw_uid
- ] or [True
- for exp_name in cfg['root-groups'].split(',')
- for got_gid in [os.getgid()] + os.getgroups()
- if got_gid == grp.getgrnam(exp_name).gr_gid
- ]:
+ if (match(cfg['root-users'], [os.getuid()], pw_uid) or
+ match(cfg['root-groups'], [os.getgid()] + os.getgroups(), gr_gid)):
capabilities.append('root-on-testbed')
def hook_open():