comparison recipes/kde_enterprise_3_5/base.py @ 286:4376c5315c72

kdepim 3.5 recipes: Use the official tag date as the date in the package version and include the number of changes to the tag in the package revision.
author Bernhard Herzog <bh@intevation.de>
date Tue, 04 Aug 2009 10:32:33 +0000
parents cd10b835d9b8
children faeeac2c4c71
comparison
equal deleted inserted replaced
285:bfcb6bef7f58 286:4376c5315c72
6 # Read the file COPYING coming with the software for details. 6 # Read the file COPYING coming with the software for details.
7 7
8 """Base classes for all kdepim packagers""" 8 """Base classes for all kdepim packagers"""
9 9
10 import os 10 import os
11 import re
11 import time 12 import time
12 import logging 13 import logging
13 14
14 import treepkg.packager 15 import treepkg.packager
15 import treepkg.subversion 16 import treepkg.subversion as subversion
16 17
17 18
18 class BaseSourcePackager(treepkg.packager.SourcePackager): 19 class BaseSourcePackager(treepkg.packager.SourcePackager):
19 20
20 changemsg_template = "Update to SVN enterprise35 branch rev. %(revision)d" 21 changemsg_template = "Update to SVN enterprise35 branch rev. %(revision)d"
57 self.version_template = kw.pop("version_template") 58 self.version_template = kw.pop("version_template")
58 tags_url = kw.pop("tags_url") 59 tags_url = kw.pop("tags_url")
59 tags_pattern = kw.pop("tags_pattern") 60 tags_pattern = kw.pop("tags_pattern")
60 tags_subdir = kw.pop("tags_subdir") 61 tags_subdir = kw.pop("tags_subdir")
61 super(BasePackageTrack, self).__init__(*args, **kw) 62 super(BasePackageTrack, self).__init__(*args, **kw)
62 self.tag_detector = treepkg.subversion.TagDetector(tags_url, 63 self.tag_detector = subversion.TagDetector(tags_url, tags_pattern,
63 tags_pattern, 64 tags_subdir)
64 tags_subdir)
65 65
66 def packager_for_new_revision(self): 66 def packager_for_new_revision(self):
67 logging.info("Checking tags") 67 logging.info("Checking tags")
68 self.tag_url = None 68 self.tag_url = None
69 tag_url, tag_revision = self.tag_detector.newest_tag_revision() 69 tag_url, tag_revision = self.tag_detector.newest_tag_revision()
75 if revision not in self.get_revision_numbers(): 75 if revision not in self.get_revision_numbers():
76 logging.info("Revision %s has not been packaged yet", 76 logging.info("Revision %s has not been packaged yet",
77 revision) 77 revision)
78 self.tag_url = tag_url 78 self.tag_url = tag_url
79 self.tag_revision = tag_revision 79 self.tag_revision = tag_revision
80 return self.revision_packager_cls(self, tag=tag_url, *revision) 80 tag_date, tag_change_count = self.tag_pkg_parameters(tag_url)
81 pkg_revision = self.debrevision_prefix + str(tag_change_count)
82 return self.revision_packager_cls(self, tag=tag_url,
83 pkg_revision=pkg_revision,
84 pkg_date=tag_date,
85 *revision)
81 else: 86 else:
82 logging.info("Revision %s has already been packaged.", 87 logging.info("Revision %s has already been packaged.",
83 revision) 88 revision)
84 89
85 return super(BasePackageTrack, self).packager_for_new_revision() 90 return super(BasePackageTrack, self).packager_for_new_revision()
91 super(BasePackageTrack, self).export_sources(to_dir) 96 super(BasePackageTrack, self).export_sources(to_dir)
92 97
93 def export_tag(self, tag_url, to_dir, revision=None): 98 def export_tag(self, tag_url, to_dir, revision=None):
94 logging.info("Exporting sources from %s to %r", 99 logging.info("Exporting sources from %s to %r",
95 tag_url, to_dir) 100 tag_url, to_dir)
96 treepkg.subversion.export(tag_url, to_dir, revision=revision) 101 subversion.export(tag_url, to_dir, revision=revision)
102
103 def tag_pkg_parameters(self, tag_url):
104 match = re.search(r"/enterprise[^.]*\.[^.]*\."
105 r"(?P<date>[0-9]{8})\.(?P<baserev>[0-9]+)/",
106 tag_url)
107 if match:
108 date = match.group("date")
109 baserev = int(match.group("baserev"))
110 xml_log = subversion.log_xml(tag_url, baserev)
111 revisions = subversion.extract_tag_revisions(xml_log)
112 tag_change_count = len(revisions)
113 return (date, tag_change_count)
114 else:
115 raise RuntimeError("Cannot determine tag parameters from %r"
116 % tag_url)
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)