Mercurial > treepkg
comparison recipes/kde/enterprise/generic.py @ 349:ae68f75f0e71
treepkg is able to use package descriptions from tags now
author | Bjoern Ricks <bricks@intevation.de> |
---|---|
date | Tue, 11 May 2010 07:37:28 +0000 |
parents | 781074885633 |
children | b41f54880572 |
comparison
equal
deleted
inserted
replaced
348:bcd01f68662c | 349:ae68f75f0e71 |
---|---|
1 # Copyright (C) 2007, 2008, 2009 by Intevation GmbH | 1 # Copyright (C) 2007 - 2010 by Intevation GmbH |
2 # Authors: | 2 # Authors: |
3 # Bernhard Herzog <bh@intevation.de> | 3 # Bernhard Herzog <bh@intevation.de> |
4 # Bjoern Ricks <bjoern.ricks@intevation.de> | |
4 # | 5 # |
5 # This program is free software under the GPL (>=v2) | 6 # This program is free software under the GPL (>=v2) |
6 # Read the file COPYING coming with the software for details. | 7 # Read the file COPYING coming with the software for details. |
7 | 8 |
8 """Base classes for all kde entperprise packagers""" | 9 """Base classes for all kde entperprise packagers""" |
50 | 51 |
51 revision_packager_cls = RevisionPackager | 52 revision_packager_cls = RevisionPackager |
52 | 53 |
53 extra_config_desc = [("tags_url", str, ""), | 54 extra_config_desc = [("tags_url", str, ""), |
54 ("tags_pattern", str, ""), | 55 ("tags_pattern", str, ""), |
55 ("tags_subdir", str, "")] | 56 ("tags_subdir", str, ""), |
57 ("tags_rules_subdir", str, "")] | |
56 | 58 |
57 def __init__(self, *args, **kw): | 59 def __init__(self, *args, **kw): |
58 tags_url = kw.pop("tags_url") | 60 tags_url = kw.pop("tags_url") |
59 tags_pattern = kw.pop("tags_pattern") | 61 tags_pattern = kw.pop("tags_pattern") |
60 tags_subdir = kw.pop("tags_subdir") | 62 tags_subdir = kw.pop("tags_subdir") |
63 tags_rules_subdir = kw.pop("tags_rules_subdir") | |
61 super(PackageTrack, self).__init__(*args, **kw) | 64 super(PackageTrack, self).__init__(*args, **kw) |
62 self.tag_detector = subversion.TagDetector(tags_url, tags_pattern, | 65 self.tag_detector = subversion.TagDetector(tags_url, tags_pattern, |
63 tags_subdir) | 66 tags_subdir) |
67 self.tag_rules_detector = subversion.TagDetector(tags_url, tags_pattern, | |
68 tags_rules_subdir) | |
69 self.use_tag_rules = False | |
70 if tags_rules_subdir: | |
71 self.use_tag_rules = True | |
64 | 72 |
65 def packager_for_new_revision(self): | 73 def packager_for_new_revision(self): |
66 logging.info("Checking tags") | 74 logging.info("Checking tags") |
67 self.tag_url = None | 75 self.tag_url = None |
68 tag_url, tag_revision = self.tag_detector.newest_tag_revision() | 76 tag_url, tag_revision = self.tag_detector.newest_tag_revision() |
77 tag_rules_url, tag_rules_revision = self.tag_rules_detector.newest_tag_revision() | |
69 logging.info("Found: %s: %s", tag_url, tag_revision) | 78 logging.info("Found: %s: %s", tag_url, tag_revision) |
79 if self.use_tag_rules and tag_rules_url is None: | |
80 self.use_tag_rules = False | |
70 if tag_url is not None: | 81 if tag_url is not None: |
71 revision = (tag_revision, | 82 if not self.use_tag_rules: |
72 self.rules_working_copy.last_changed_revision()) | 83 tag_rules_revision = self.rules_working_copy.last_changed_revision() |
84 revision = (tag_revision, tag_rules_revision) | |
73 logging.info("New revision is %s", revision) | 85 logging.info("New revision is %s", revision) |
74 if revision not in self.get_revision_numbers(): | 86 if revision not in self.get_revision_numbers(): |
75 logging.info("Revision %s has not been packaged yet", | 87 logging.info("Revision %s has not been packaged yet", |
76 revision) | 88 revision) |
77 self.tag_url = tag_url | 89 self.tag_url = tag_url |
78 self.tag_revision = tag_revision | 90 self.tag_revision = tag_revision |
91 self.tag_rules_url = tag_rules_url | |
92 self.tag_rules_revision = tag_rules_revision | |
79 tag_date, tag_change_count = self.tag_pkg_parameters(tag_url) | 93 tag_date, tag_change_count = self.tag_pkg_parameters(tag_url) |
80 pkg_revision = (self.pkg_revision_template | 94 pkg_revision = (self.pkg_revision_template |
81 % dict(pkg_revision=tag_change_count, | 95 % dict(pkg_revision=tag_change_count, |
82 rules_revision=revision[1])) | 96 rules_revision=revision[1])) |
83 return self.revision_packager_cls(self, tag=tag_url, | 97 return self.revision_packager_cls(self, tag=tag_url, |
97 self.working_copy.export_tag(self.tag_url, to_dir, | 111 self.working_copy.export_tag(self.tag_url, to_dir, |
98 revision=self.tag_revision) | 112 revision=self.tag_revision) |
99 else: | 113 else: |
100 super(PackageTrack, self).export_sources(to_dir) | 114 super(PackageTrack, self).export_sources(to_dir) |
101 | 115 |
116 def copy_debian_directory(self, to_dir): | |
117 if self.use_tag_rules: | |
118 logging.info("Exporting debian package description from %s to %s", | |
119 self.tag_rules_url, to_dir) | |
120 self.rules_working_copy.export_tag(self.tag_rules_url, to_dir) | |
121 else: | |
122 super(PackageTrack, self).copy_debian_directory(to_dir) | |
123 | |
102 def tag_pkg_parameters(self, tag_url): | 124 def tag_pkg_parameters(self, tag_url): |
103 match = re.search(r"/enterprise[^.]*\.[^.]*\." | 125 match = re.search(r"/enterprise[^.]*\.[^.]*\." |
104 r"(?P<date>[0-9]{8})\.(?P<baserev>[0-9]+)/", | 126 r"(?P<date>[0-9]{8})\.(?P<baserev>[0-9]+)/", |
105 tag_url) | 127 tag_url) |
106 if match: | 128 if match: |