annotate recipes/kde_enterprise_4/base.py @ 267:fdee17d71778

Refactor the enterprise4 BasePackageTrack to make it possible to override the tag export in derived classes
author Bernhard Herzog <bh@intevation.de>
date Thu, 30 Apr 2009 10:30:04 +0000
parents 9c0131d2e0e1
children bba100869221
rev   line source
216
89ca9ba349e5 New module with code common to almost all kdepim enterprise 4 recipes
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
1 # Copyright (C) 2007, 2008, 2009 by Intevation GmbH
89ca9ba349e5 New module with code common to almost all kdepim enterprise 4 recipes
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
2 # Authors:
89ca9ba349e5 New module with code common to almost all kdepim enterprise 4 recipes
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
3 # Bernhard Herzog <bh@intevation.de>
89ca9ba349e5 New module with code common to almost all kdepim enterprise 4 recipes
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
4 #
89ca9ba349e5 New module with code common to almost all kdepim enterprise 4 recipes
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
5 # This program is free software under the GPL (>=v2)
89ca9ba349e5 New module with code common to almost all kdepim enterprise 4 recipes
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
6 # Read the file COPYING coming with the software for details.
89ca9ba349e5 New module with code common to almost all kdepim enterprise 4 recipes
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
7
89ca9ba349e5 New module with code common to almost all kdepim enterprise 4 recipes
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
8 """Base classes for all kdepim packagers"""
89ca9ba349e5 New module with code common to almost all kdepim enterprise 4 recipes
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
9
89ca9ba349e5 New module with code common to almost all kdepim enterprise 4 recipes
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
10 import os
89ca9ba349e5 New module with code common to almost all kdepim enterprise 4 recipes
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
11 import time
89ca9ba349e5 New module with code common to almost all kdepim enterprise 4 recipes
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
12 import inspect
265
9c0131d2e0e1 Add automatic detection and builds of svn tags for the kdepim enterprise4
Bernhard Herzog <bh@intevation.de>
parents: 216
diff changeset
13 import re
9c0131d2e0e1 Add automatic detection and builds of svn tags for the kdepim enterprise4
Bernhard Herzog <bh@intevation.de>
parents: 216
diff changeset
14 import logging
216
89ca9ba349e5 New module with code common to almost all kdepim enterprise 4 recipes
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
15
89ca9ba349e5 New module with code common to almost all kdepim enterprise 4 recipes
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
16 import treepkg.packager
265
9c0131d2e0e1 Add automatic detection and builds of svn tags for the kdepim enterprise4
Bernhard Herzog <bh@intevation.de>
parents: 216
diff changeset
17 import treepkg.subversion
9c0131d2e0e1 Add automatic detection and builds of svn tags for the kdepim enterprise4
Bernhard Herzog <bh@intevation.de>
parents: 216
diff changeset
18
9c0131d2e0e1 Add automatic detection and builds of svn tags for the kdepim enterprise4
Bernhard Herzog <bh@intevation.de>
parents: 216
diff changeset
19
9c0131d2e0e1 Add automatic detection and builds of svn tags for the kdepim enterprise4
Bernhard Herzog <bh@intevation.de>
parents: 216
diff changeset
20 class TagDetector(object):
9c0131d2e0e1 Add automatic detection and builds of svn tags for the kdepim enterprise4
Bernhard Herzog <bh@intevation.de>
parents: 216
diff changeset
21
9c0131d2e0e1 Add automatic detection and builds of svn tags for the kdepim enterprise4
Bernhard Herzog <bh@intevation.de>
parents: 216
diff changeset
22 """Class to automatically find SVN tags and help package them
9c0131d2e0e1 Add automatic detection and builds of svn tags for the kdepim enterprise4
Bernhard Herzog <bh@intevation.de>
parents: 216
diff changeset
23
9c0131d2e0e1 Add automatic detection and builds of svn tags for the kdepim enterprise4
Bernhard Herzog <bh@intevation.de>
parents: 216
diff changeset
24 The tags are found using three parameters:
9c0131d2e0e1 Add automatic detection and builds of svn tags for the kdepim enterprise4
Bernhard Herzog <bh@intevation.de>
parents: 216
diff changeset
25 url -- The base url of the SVN tags directory to use
9c0131d2e0e1 Add automatic detection and builds of svn tags for the kdepim enterprise4
Bernhard Herzog <bh@intevation.de>
parents: 216
diff changeset
26 pattern -- A regular expression matching the subdirectories to
9c0131d2e0e1 Add automatic detection and builds of svn tags for the kdepim enterprise4
Bernhard Herzog <bh@intevation.de>
parents: 216
diff changeset
27 consider in the tag directory specified by the url
9c0131d2e0e1 Add automatic detection and builds of svn tags for the kdepim enterprise4
Bernhard Herzog <bh@intevation.de>
parents: 216
diff changeset
28 subdir -- A subdirectory of the directory matched by pattern to
9c0131d2e0e1 Add automatic detection and builds of svn tags for the kdepim enterprise4
Bernhard Herzog <bh@intevation.de>
parents: 216
diff changeset
29 export and use to determine revision number
9c0131d2e0e1 Add automatic detection and builds of svn tags for the kdepim enterprise4
Bernhard Herzog <bh@intevation.de>
parents: 216
diff changeset
30 """
9c0131d2e0e1 Add automatic detection and builds of svn tags for the kdepim enterprise4
Bernhard Herzog <bh@intevation.de>
parents: 216
diff changeset
31
9c0131d2e0e1 Add automatic detection and builds of svn tags for the kdepim enterprise4
Bernhard Herzog <bh@intevation.de>
parents: 216
diff changeset
32 def __init__(self, url, pattern, subdir):
9c0131d2e0e1 Add automatic detection and builds of svn tags for the kdepim enterprise4
Bernhard Herzog <bh@intevation.de>
parents: 216
diff changeset
33 self.url = url
9c0131d2e0e1 Add automatic detection and builds of svn tags for the kdepim enterprise4
Bernhard Herzog <bh@intevation.de>
parents: 216
diff changeset
34 self.pattern = re.compile(pattern)
9c0131d2e0e1 Add automatic detection and builds of svn tags for the kdepim enterprise4
Bernhard Herzog <bh@intevation.de>
parents: 216
diff changeset
35 self.subdir = subdir
9c0131d2e0e1 Add automatic detection and builds of svn tags for the kdepim enterprise4
Bernhard Herzog <bh@intevation.de>
parents: 216
diff changeset
36
9c0131d2e0e1 Add automatic detection and builds of svn tags for the kdepim enterprise4
Bernhard Herzog <bh@intevation.de>
parents: 216
diff changeset
37 def list_tags(self):
9c0131d2e0e1 Add automatic detection and builds of svn tags for the kdepim enterprise4
Bernhard Herzog <bh@intevation.de>
parents: 216
diff changeset
38 matches = []
9c0131d2e0e1 Add automatic detection and builds of svn tags for the kdepim enterprise4
Bernhard Herzog <bh@intevation.de>
parents: 216
diff changeset
39 if self.url:
9c0131d2e0e1 Add automatic detection and builds of svn tags for the kdepim enterprise4
Bernhard Herzog <bh@intevation.de>
parents: 216
diff changeset
40 for tag in treepkg.subversion.list_url(self.url):
9c0131d2e0e1 Add automatic detection and builds of svn tags for the kdepim enterprise4
Bernhard Herzog <bh@intevation.de>
parents: 216
diff changeset
41 if self.pattern.match(tag.rstrip("/")):
9c0131d2e0e1 Add automatic detection and builds of svn tags for the kdepim enterprise4
Bernhard Herzog <bh@intevation.de>
parents: 216
diff changeset
42 matches.append(tag)
9c0131d2e0e1 Add automatic detection and builds of svn tags for the kdepim enterprise4
Bernhard Herzog <bh@intevation.de>
parents: 216
diff changeset
43 return sorted(matches)
9c0131d2e0e1 Add automatic detection and builds of svn tags for the kdepim enterprise4
Bernhard Herzog <bh@intevation.de>
parents: 216
diff changeset
44
9c0131d2e0e1 Add automatic detection and builds of svn tags for the kdepim enterprise4
Bernhard Herzog <bh@intevation.de>
parents: 216
diff changeset
45 def newest_tag_revision(self):
9c0131d2e0e1 Add automatic detection and builds of svn tags for the kdepim enterprise4
Bernhard Herzog <bh@intevation.de>
parents: 216
diff changeset
46 """Determines the newest tag revision and returns (tagurl, revno)
9c0131d2e0e1 Add automatic detection and builds of svn tags for the kdepim enterprise4
Bernhard Herzog <bh@intevation.de>
parents: 216
diff changeset
47 If no tag can be found, the method returns the tuple (None, None).
9c0131d2e0e1 Add automatic detection and builds of svn tags for the kdepim enterprise4
Bernhard Herzog <bh@intevation.de>
parents: 216
diff changeset
48 """
9c0131d2e0e1 Add automatic detection and builds of svn tags for the kdepim enterprise4
Bernhard Herzog <bh@intevation.de>
parents: 216
diff changeset
49 candidates = self.list_tags()
9c0131d2e0e1 Add automatic detection and builds of svn tags for the kdepim enterprise4
Bernhard Herzog <bh@intevation.de>
parents: 216
diff changeset
50 if candidates:
9c0131d2e0e1 Add automatic detection and builds of svn tags for the kdepim enterprise4
Bernhard Herzog <bh@intevation.de>
parents: 216
diff changeset
51 newest = candidates[-1]
9c0131d2e0e1 Add automatic detection and builds of svn tags for the kdepim enterprise4
Bernhard Herzog <bh@intevation.de>
parents: 216
diff changeset
52 subdir = self.subdir
9c0131d2e0e1 Add automatic detection and builds of svn tags for the kdepim enterprise4
Bernhard Herzog <bh@intevation.de>
parents: 216
diff changeset
53 if not subdir.endswith("/"):
9c0131d2e0e1 Add automatic detection and builds of svn tags for the kdepim enterprise4
Bernhard Herzog <bh@intevation.de>
parents: 216
diff changeset
54 subdir += "/"
9c0131d2e0e1 Add automatic detection and builds of svn tags for the kdepim enterprise4
Bernhard Herzog <bh@intevation.de>
parents: 216
diff changeset
55 tag_url = self.url + "/" + newest
9c0131d2e0e1 Add automatic detection and builds of svn tags for the kdepim enterprise4
Bernhard Herzog <bh@intevation.de>
parents: 216
diff changeset
56 tag_subdirs = treepkg.subversion.list_url(tag_url)
9c0131d2e0e1 Add automatic detection and builds of svn tags for the kdepim enterprise4
Bernhard Herzog <bh@intevation.de>
parents: 216
diff changeset
57 if subdir in tag_subdirs:
9c0131d2e0e1 Add automatic detection and builds of svn tags for the kdepim enterprise4
Bernhard Herzog <bh@intevation.de>
parents: 216
diff changeset
58 subdir_url = tag_url + "/" + subdir
9c0131d2e0e1 Add automatic detection and builds of svn tags for the kdepim enterprise4
Bernhard Herzog <bh@intevation.de>
parents: 216
diff changeset
59 revision = treepkg.subversion.last_changed_revision(subdir_url)
9c0131d2e0e1 Add automatic detection and builds of svn tags for the kdepim enterprise4
Bernhard Herzog <bh@intevation.de>
parents: 216
diff changeset
60 return subdir_url, revision
9c0131d2e0e1 Add automatic detection and builds of svn tags for the kdepim enterprise4
Bernhard Herzog <bh@intevation.de>
parents: 216
diff changeset
61 return None, None
9c0131d2e0e1 Add automatic detection and builds of svn tags for the kdepim enterprise4
Bernhard Herzog <bh@intevation.de>
parents: 216
diff changeset
62
216
89ca9ba349e5 New module with code common to almost all kdepim enterprise 4 recipes
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
63
89ca9ba349e5 New module with code common to almost all kdepim enterprise 4 recipes
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
64
89ca9ba349e5 New module with code common to almost all kdepim enterprise 4 recipes
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
65 class BaseSourcePackager(treepkg.packager.SourcePackager):
89ca9ba349e5 New module with code common to almost all kdepim enterprise 4 recipes
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
66
89ca9ba349e5 New module with code common to almost all kdepim enterprise 4 recipes
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
67 def __init__(self, *args, **kw):
89ca9ba349e5 New module with code common to almost all kdepim enterprise 4 recipes
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
68 super(BaseSourcePackager, self).__init__(*args, **kw)
89ca9ba349e5 New module with code common to almost all kdepim enterprise 4 recipes
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
69 self.enterprise_version = (time.strftime("%Y%m%d", time.localtime()) \
89ca9ba349e5 New module with code common to almost all kdepim enterprise 4 recipes
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
70 + "." + str(self.revision))
89ca9ba349e5 New module with code common to almost all kdepim enterprise 4 recipes
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
71
89ca9ba349e5 New module with code common to almost all kdepim enterprise 4 recipes
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
72 def determine_package_version(self, directory):
89ca9ba349e5 New module with code common to almost all kdepim enterprise 4 recipes
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
73 enterprise_version = self.enterprise_version
89ca9ba349e5 New module with code common to almost all kdepim enterprise 4 recipes
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
74 return self.track.version_template % locals()
89ca9ba349e5 New module with code common to almost all kdepim enterprise 4 recipes
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
75
89ca9ba349e5 New module with code common to almost all kdepim enterprise 4 recipes
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
76 def do_package(self):
89ca9ba349e5 New module with code common to almost all kdepim enterprise 4 recipes
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
77 pkgbaseversion, pkgbasedir = self.export_sources()
89ca9ba349e5 New module with code common to almost all kdepim enterprise 4 recipes
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
78 self.update_version_numbers(pkgbasedir)
89ca9ba349e5 New module with code common to almost all kdepim enterprise 4 recipes
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
79
89ca9ba349e5 New module with code common to almost all kdepim enterprise 4 recipes
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
80 pkgbasename = self.pkg_basename + "_" + pkgbaseversion
89ca9ba349e5 New module with code common to almost all kdepim enterprise 4 recipes
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
81 origtargz = os.path.join(self.work_dir,
89ca9ba349e5 New module with code common to almost all kdepim enterprise 4 recipes
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
82 pkgbasename + ".orig.tar.gz")
89ca9ba349e5 New module with code common to almost all kdepim enterprise 4 recipes
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
83 self.create_tarball(origtargz, self.work_dir,
89ca9ba349e5 New module with code common to almost all kdepim enterprise 4 recipes
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
84 os.path.basename(pkgbasedir))
89ca9ba349e5 New module with code common to almost all kdepim enterprise 4 recipes
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
85
89ca9ba349e5 New module with code common to almost all kdepim enterprise 4 recipes
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
86 changemsg = ("Update to SVN enterprise4 branch rev. %d"
89ca9ba349e5 New module with code common to almost all kdepim enterprise 4 recipes
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
87 % (self.revision,))
89ca9ba349e5 New module with code common to almost all kdepim enterprise 4 recipes
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
88 self.copy_debian_directory(pkgbasedir, pkgbaseversion,
89ca9ba349e5 New module with code common to almost all kdepim enterprise 4 recipes
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
89 changemsg)
89ca9ba349e5 New module with code common to almost all kdepim enterprise 4 recipes
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
90
89ca9ba349e5 New module with code common to almost all kdepim enterprise 4 recipes
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
91 self.create_source_package(pkgbasedir, origtargz)
89ca9ba349e5 New module with code common to almost all kdepim enterprise 4 recipes
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
92 self.move_source_package(pkgbasename)
89ca9ba349e5 New module with code common to almost all kdepim enterprise 4 recipes
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
93
89ca9ba349e5 New module with code common to almost all kdepim enterprise 4 recipes
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
94
89ca9ba349e5 New module with code common to almost all kdepim enterprise 4 recipes
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
95 class BasePackageTrack(treepkg.packager.PackageTrack):
89ca9ba349e5 New module with code common to almost all kdepim enterprise 4 recipes
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
96
265
9c0131d2e0e1 Add automatic detection and builds of svn tags for the kdepim enterprise4
Bernhard Herzog <bh@intevation.de>
parents: 216
diff changeset
97 extra_config_desc = ["version_template",
9c0131d2e0e1 Add automatic detection and builds of svn tags for the kdepim enterprise4
Bernhard Herzog <bh@intevation.de>
parents: 216
diff changeset
98 ("tags_url", str, ""),
9c0131d2e0e1 Add automatic detection and builds of svn tags for the kdepim enterprise4
Bernhard Herzog <bh@intevation.de>
parents: 216
diff changeset
99 ("tags_pattern", str, ""),
9c0131d2e0e1 Add automatic detection and builds of svn tags for the kdepim enterprise4
Bernhard Herzog <bh@intevation.de>
parents: 216
diff changeset
100 ("tags_subdir", str, "")]
216
89ca9ba349e5 New module with code common to almost all kdepim enterprise 4 recipes
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
101
89ca9ba349e5 New module with code common to almost all kdepim enterprise 4 recipes
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
102 def __init__(self, *args, **kw):
89ca9ba349e5 New module with code common to almost all kdepim enterprise 4 recipes
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
103 self.version_template = kw.pop("version_template")
265
9c0131d2e0e1 Add automatic detection and builds of svn tags for the kdepim enterprise4
Bernhard Herzog <bh@intevation.de>
parents: 216
diff changeset
104 tags_url = kw.pop("tags_url")
9c0131d2e0e1 Add automatic detection and builds of svn tags for the kdepim enterprise4
Bernhard Herzog <bh@intevation.de>
parents: 216
diff changeset
105 tags_pattern = kw.pop("tags_pattern")
9c0131d2e0e1 Add automatic detection and builds of svn tags for the kdepim enterprise4
Bernhard Herzog <bh@intevation.de>
parents: 216
diff changeset
106 tags_subdir = kw.pop("tags_subdir")
216
89ca9ba349e5 New module with code common to almost all kdepim enterprise 4 recipes
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
107 super(BasePackageTrack, self).__init__(*args, **kw)
265
9c0131d2e0e1 Add automatic detection and builds of svn tags for the kdepim enterprise4
Bernhard Herzog <bh@intevation.de>
parents: 216
diff changeset
108 self.tag_detector = TagDetector(tags_url, tags_pattern, tags_subdir)
9c0131d2e0e1 Add automatic detection and builds of svn tags for the kdepim enterprise4
Bernhard Herzog <bh@intevation.de>
parents: 216
diff changeset
109
9c0131d2e0e1 Add automatic detection and builds of svn tags for the kdepim enterprise4
Bernhard Herzog <bh@intevation.de>
parents: 216
diff changeset
110 def packager_for_new_revision(self):
9c0131d2e0e1 Add automatic detection and builds of svn tags for the kdepim enterprise4
Bernhard Herzog <bh@intevation.de>
parents: 216
diff changeset
111 logging.info("Checking tags")
9c0131d2e0e1 Add automatic detection and builds of svn tags for the kdepim enterprise4
Bernhard Herzog <bh@intevation.de>
parents: 216
diff changeset
112 self.tag_url = None
9c0131d2e0e1 Add automatic detection and builds of svn tags for the kdepim enterprise4
Bernhard Herzog <bh@intevation.de>
parents: 216
diff changeset
113 tag_url, tag_revision = self.tag_detector.newest_tag_revision()
9c0131d2e0e1 Add automatic detection and builds of svn tags for the kdepim enterprise4
Bernhard Herzog <bh@intevation.de>
parents: 216
diff changeset
114 logging.info("Found: %s: %s", tag_url, tag_revision)
9c0131d2e0e1 Add automatic detection and builds of svn tags for the kdepim enterprise4
Bernhard Herzog <bh@intevation.de>
parents: 216
diff changeset
115 if tag_url is not None:
9c0131d2e0e1 Add automatic detection and builds of svn tags for the kdepim enterprise4
Bernhard Herzog <bh@intevation.de>
parents: 216
diff changeset
116 revision = (tag_revision,
9c0131d2e0e1 Add automatic detection and builds of svn tags for the kdepim enterprise4
Bernhard Herzog <bh@intevation.de>
parents: 216
diff changeset
117 self.rules_working_copy.last_changed_revision())
9c0131d2e0e1 Add automatic detection and builds of svn tags for the kdepim enterprise4
Bernhard Herzog <bh@intevation.de>
parents: 216
diff changeset
118 logging.info("New revision is %s", revision)
9c0131d2e0e1 Add automatic detection and builds of svn tags for the kdepim enterprise4
Bernhard Herzog <bh@intevation.de>
parents: 216
diff changeset
119 if revision not in self.get_revision_numbers():
9c0131d2e0e1 Add automatic detection and builds of svn tags for the kdepim enterprise4
Bernhard Herzog <bh@intevation.de>
parents: 216
diff changeset
120 logging.info("Revision %s has not been packaged yet",
9c0131d2e0e1 Add automatic detection and builds of svn tags for the kdepim enterprise4
Bernhard Herzog <bh@intevation.de>
parents: 216
diff changeset
121 revision)
9c0131d2e0e1 Add automatic detection and builds of svn tags for the kdepim enterprise4
Bernhard Herzog <bh@intevation.de>
parents: 216
diff changeset
122 self.tag_url = tag_url
9c0131d2e0e1 Add automatic detection and builds of svn tags for the kdepim enterprise4
Bernhard Herzog <bh@intevation.de>
parents: 216
diff changeset
123 return self.revision_packager_cls(self, tag=tag_url, *revision)
9c0131d2e0e1 Add automatic detection and builds of svn tags for the kdepim enterprise4
Bernhard Herzog <bh@intevation.de>
parents: 216
diff changeset
124 else:
9c0131d2e0e1 Add automatic detection and builds of svn tags for the kdepim enterprise4
Bernhard Herzog <bh@intevation.de>
parents: 216
diff changeset
125 logging.info("Revision %s has already been packaged.",
9c0131d2e0e1 Add automatic detection and builds of svn tags for the kdepim enterprise4
Bernhard Herzog <bh@intevation.de>
parents: 216
diff changeset
126 revision)
9c0131d2e0e1 Add automatic detection and builds of svn tags for the kdepim enterprise4
Bernhard Herzog <bh@intevation.de>
parents: 216
diff changeset
127
9c0131d2e0e1 Add automatic detection and builds of svn tags for the kdepim enterprise4
Bernhard Herzog <bh@intevation.de>
parents: 216
diff changeset
128 return super(BasePackageTrack, self).packager_for_new_revision()
9c0131d2e0e1 Add automatic detection and builds of svn tags for the kdepim enterprise4
Bernhard Herzog <bh@intevation.de>
parents: 216
diff changeset
129
9c0131d2e0e1 Add automatic detection and builds of svn tags for the kdepim enterprise4
Bernhard Herzog <bh@intevation.de>
parents: 216
diff changeset
130 def export_sources(self, to_dir):
9c0131d2e0e1 Add automatic detection and builds of svn tags for the kdepim enterprise4
Bernhard Herzog <bh@intevation.de>
parents: 216
diff changeset
131 if self.tag_url is not None:
267
fdee17d71778 Refactor the enterprise4 BasePackageTrack to make it possible to
Bernhard Herzog <bh@intevation.de>
parents: 265
diff changeset
132 self.export_tag(self.tag_url, to_dir)
265
9c0131d2e0e1 Add automatic detection and builds of svn tags for the kdepim enterprise4
Bernhard Herzog <bh@intevation.de>
parents: 216
diff changeset
133 else:
9c0131d2e0e1 Add automatic detection and builds of svn tags for the kdepim enterprise4
Bernhard Herzog <bh@intevation.de>
parents: 216
diff changeset
134 super(BasePackageTrack, self).export_sources(to_dir)
216
89ca9ba349e5 New module with code common to almost all kdepim enterprise 4 recipes
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
135
267
fdee17d71778 Refactor the enterprise4 BasePackageTrack to make it possible to
Bernhard Herzog <bh@intevation.de>
parents: 265
diff changeset
136 def export_tag(self, tag_url, to_dir):
fdee17d71778 Refactor the enterprise4 BasePackageTrack to make it possible to
Bernhard Herzog <bh@intevation.de>
parents: 265
diff changeset
137 logging.info("Exporting sources from %s to %r",
fdee17d71778 Refactor the enterprise4 BasePackageTrack to make it possible to
Bernhard Herzog <bh@intevation.de>
parents: 265
diff changeset
138 tag_url, to_dir)
fdee17d71778 Refactor the enterprise4 BasePackageTrack to make it possible to
Bernhard Herzog <bh@intevation.de>
parents: 265
diff changeset
139 treepkg.subversion.export(tag_url, to_dir)
fdee17d71778 Refactor the enterprise4 BasePackageTrack to make it possible to
Bernhard Herzog <bh@intevation.de>
parents: 265
diff changeset
140
216
89ca9ba349e5 New module with code common to almost all kdepim enterprise 4 recipes
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
141
89ca9ba349e5 New module with code common to almost all kdepim enterprise 4 recipes
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
142 def define_kdepim_packager(basename=None, external_subdirs=None):
89ca9ba349e5 New module with code common to almost all kdepim enterprise 4 recipes
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
143
89ca9ba349e5 New module with code common to almost all kdepim enterprise 4 recipes
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
144 caller_globals = inspect.currentframe().f_back.f_globals
89ca9ba349e5 New module with code common to almost all kdepim enterprise 4 recipes
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
145
89ca9ba349e5 New module with code common to almost all kdepim enterprise 4 recipes
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
146 SourcePackager = caller_globals.get("SourcePackager")
89ca9ba349e5 New module with code common to almost all kdepim enterprise 4 recipes
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
147 if SourcePackager is None:
89ca9ba349e5 New module with code common to almost all kdepim enterprise 4 recipes
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
148 class SourcePackager(BaseSourcePackager):
89ca9ba349e5 New module with code common to almost all kdepim enterprise 4 recipes
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
149 pkg_basename = basename
89ca9ba349e5 New module with code common to almost all kdepim enterprise 4 recipes
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
150
89ca9ba349e5 New module with code common to almost all kdepim enterprise 4 recipes
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
151 class RevisionPackager(treepkg.packager.RevisionPackager):
89ca9ba349e5 New module with code common to almost all kdepim enterprise 4 recipes
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
152 source_packager_cls = SourcePackager
89ca9ba349e5 New module with code common to almost all kdepim enterprise 4 recipes
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
153
89ca9ba349e5 New module with code common to almost all kdepim enterprise 4 recipes
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
154 class PackageTrack(BasePackageTrack):
89ca9ba349e5 New module with code common to almost all kdepim enterprise 4 recipes
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
155 revision_packager_cls = RevisionPackager
89ca9ba349e5 New module with code common to almost all kdepim enterprise 4 recipes
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
156
89ca9ba349e5 New module with code common to almost all kdepim enterprise 4 recipes
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
157 if external_subdirs is not None:
89ca9ba349e5 New module with code common to almost all kdepim enterprise 4 recipes
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
158 svn_external_subdirs = external_subdirs
89ca9ba349e5 New module with code common to almost all kdepim enterprise 4 recipes
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
159
89ca9ba349e5 New module with code common to almost all kdepim enterprise 4 recipes
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
160 caller_globals["PackageTrack"] = PackageTrack
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)