comparison treepkg/readconfig.py @ 304:6cffb43a28ca

Add a way to specify svn subset checkouts where only parts of a source tree are checked out. The subset can be specified in the configuration file on a per-track basis. This feature was already present for some of the kde enterprise packagers but is now part of the base classes.
author Bernhard Herzog <bh@intevation.de>
date Thu, 26 Nov 2009 20:20:57 +0000
parents e82fb08781a2
children 3781e9958eba
comparison
equal deleted inserted replaced
303:df01eb4dbfc5 304:6cffb43a28ca
21 if s in ("false", "no", "0"): 21 if s in ("false", "no", "0"):
22 return False 22 return False
23 raise ValueError("cannot determine boolean value of %r" % (s,)) 23 raise ValueError("cannot determine boolean value of %r" % (s,))
24 24
25 25
26 def convert_subversion_subset(raw):
27 """Converts the string representation an svn subset into internal form
28 The format in the config file is typically:
29 svn_url: svn://example.com/repository/trunk
30 svn_subset: -N .
31 subdir1
32 subdir2
33
34 Each line of the svn_subset value consists of an optional flag
35 followed by a subdirectory. Empty lines are ignored. Each
36 non-empty line is split into words using shlex.split, so whitespace
37 characters can be included in filenames using e.g. quotes (see the
38 shlex documentation for details). The only flag supported is -N
39 which indicates that the subdirectory on that line is not to be
40 checked out recursively. If -N is given on a line, svn checkout
41 will be called with -N as parameter.
42
43 The example above will be converted into the internal form [('.',
44 False), ('subdir1', True), ('subdir2', True)] used by the
45 treepkg.subversion module.
46 """
47 subset = []
48 for line in raw.splitlines():
49 split = shlex.split(line)
50 if len(split) < 1:
51 # ignore empty lines
52 continue
53 subdir = split[-1]
54 recurse = True
55 flags = split[:-1]
56 if flags:
57 if flags == ["-N"]:
58 recurse = False
59 else:
60 raise ValueError("Only -N is supported as flag, but flags = %r"
61 % (flags,))
62 subset.append((subdir, recurse))
63 return subset
64
65
26 packager_desc = [ 66 packager_desc = [
27 "name", "base_dir", "svn_url", ("rules_svn_url", str, ""), "packager_class", 67 "name", "base_dir",
68 "svn_url", ("svn_subset", convert_subversion_subset, ""),
69 ("rules_svn_url", str, ""), "packager_class",
28 ("root_cmd", shlex.split, "sudo"), "pbuilderrc", 70 ("root_cmd", shlex.split, "sudo"), "pbuilderrc",
29 "deb_email", "deb_fullname", ("deb_build_options", str, ""), 71 "deb_email", "deb_fullname", ("deb_build_options", str, ""),
30 "pkg_revision_template", ("pkg_basename", str, ""), 72 "pkg_revision_template", ("pkg_basename", str, ""),
31 ("handle_dependencies", convert_bool), 73 ("handle_dependencies", convert_bool),
32 ("signing_key_id", str, ""), 74 ("signing_key_id", str, ""),
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)