annotate recipes/kde/enterprise/tags.py @ 528:e51cf2947fab

log tag date
author Bjoern Ricks <bricks@intevation.de>
date Mon, 15 Nov 2010 15:15:52 +0000
parents 4a56ebc53ada
children
rev   line source
358
2524213a6e4f added packager that is able to build only tags for enterprise builds
Bjoern Ricks <bricks@intevation.de>
parents:
diff changeset
1 # Copyright (C) 2007 - 2010 by Intevation GmbH
2524213a6e4f added packager that is able to build only tags for enterprise builds
Bjoern Ricks <bricks@intevation.de>
parents:
diff changeset
2 # Authors:
2524213a6e4f added packager that is able to build only tags for enterprise builds
Bjoern Ricks <bricks@intevation.de>
parents:
diff changeset
3 # Bernhard Herzog <bh@intevation.de>
2524213a6e4f added packager that is able to build only tags for enterprise builds
Bjoern Ricks <bricks@intevation.de>
parents:
diff changeset
4 # Bjoern Ricks <bjoern.ricks@intevation.de>
2524213a6e4f added packager that is able to build only tags for enterprise builds
Bjoern Ricks <bricks@intevation.de>
parents:
diff changeset
5 #
2524213a6e4f added packager that is able to build only tags for enterprise builds
Bjoern Ricks <bricks@intevation.de>
parents:
diff changeset
6 # This program is free software under the GPL (>=v2)
2524213a6e4f added packager that is able to build only tags for enterprise builds
Bjoern Ricks <bricks@intevation.de>
parents:
diff changeset
7 # Read the file COPYING coming with the software for details.
2524213a6e4f added packager that is able to build only tags for enterprise builds
Bjoern Ricks <bricks@intevation.de>
parents:
diff changeset
8
499
e44c9c3f69f8 consolidate enterprise packagers
Bjoern Ricks <bricks@intevation.de>
parents: 498
diff changeset
9 """PackageTrack for kde entperprise tag only builds"""
358
2524213a6e4f added packager that is able to build only tags for enterprise builds
Bjoern Ricks <bricks@intevation.de>
parents:
diff changeset
10
2524213a6e4f added packager that is able to build only tags for enterprise builds
Bjoern Ricks <bricks@intevation.de>
parents:
diff changeset
11 import logging
2524213a6e4f added packager that is able to build only tags for enterprise builds
Bjoern Ricks <bricks@intevation.de>
parents:
diff changeset
12
524
e90a21cfbc3b added an option to fail if a tag could not be found instread of building trunk
Bjoern Ricks <bricks@intevation.de>
parents: 499
diff changeset
13 from treepkg.readconfig import convert_bool
499
e44c9c3f69f8 consolidate enterprise packagers
Bjoern Ricks <bricks@intevation.de>
parents: 498
diff changeset
14 import recipes.kde.enterprise.generic as enterprise
358
2524213a6e4f added packager that is able to build only tags for enterprise builds
Bjoern Ricks <bricks@intevation.de>
parents:
diff changeset
15
499
e44c9c3f69f8 consolidate enterprise packagers
Bjoern Ricks <bricks@intevation.de>
parents: 498
diff changeset
16 class PackageTrack(enterprise.PackageTrack):
358
2524213a6e4f added packager that is able to build only tags for enterprise builds
Bjoern Ricks <bricks@intevation.de>
parents:
diff changeset
17
499
e44c9c3f69f8 consolidate enterprise packagers
Bjoern Ricks <bricks@intevation.de>
parents: 498
diff changeset
18 """In contrast to recipes.kde.enterprise.generic.PackageTrack
e44c9c3f69f8 consolidate enterprise packagers
Bjoern Ricks <bricks@intevation.de>
parents: 498
diff changeset
19 this PackageTrack either builds trunk or newest tag"""
e44c9c3f69f8 consolidate enterprise packagers
Bjoern Ricks <bricks@intevation.de>
parents: 498
diff changeset
20
e44c9c3f69f8 consolidate enterprise packagers
Bjoern Ricks <bricks@intevation.de>
parents: 498
diff changeset
21 revision_packager_cls = enterprise.RevisionPackager
358
2524213a6e4f added packager that is able to build only tags for enterprise builds
Bjoern Ricks <bricks@intevation.de>
parents:
diff changeset
22
524
e90a21cfbc3b added an option to fail if a tag could not be found instread of building trunk
Bjoern Ricks <bricks@intevation.de>
parents: 499
diff changeset
23 extra_config_desc = [("tags_url", str, ""),
e90a21cfbc3b added an option to fail if a tag could not be found instread of building trunk
Bjoern Ricks <bricks@intevation.de>
parents: 499
diff changeset
24 ("tags_pattern", str, ""),
e90a21cfbc3b added an option to fail if a tag could not be found instread of building trunk
Bjoern Ricks <bricks@intevation.de>
parents: 499
diff changeset
25 ("tags_subdir", str, ""),
e90a21cfbc3b added an option to fail if a tag could not be found instread of building trunk
Bjoern Ricks <bricks@intevation.de>
parents: 499
diff changeset
26 ("tags_scm_type", str, None),
e90a21cfbc3b added an option to fail if a tag could not be found instread of building trunk
Bjoern Ricks <bricks@intevation.de>
parents: 499
diff changeset
27 ("tags_rules_url", str, None),
e90a21cfbc3b added an option to fail if a tag could not be found instread of building trunk
Bjoern Ricks <bricks@intevation.de>
parents: 499
diff changeset
28 ("tags_rules_pattern", str, ""),
e90a21cfbc3b added an option to fail if a tag could not be found instread of building trunk
Bjoern Ricks <bricks@intevation.de>
parents: 499
diff changeset
29 ("tags_rules_subdir", str, ""),
e90a21cfbc3b added an option to fail if a tag could not be found instread of building trunk
Bjoern Ricks <bricks@intevation.de>
parents: 499
diff changeset
30 ("tags_rules_scm_type", str, None),
e90a21cfbc3b added an option to fail if a tag could not be found instread of building trunk
Bjoern Ricks <bricks@intevation.de>
parents: 499
diff changeset
31 ("fail_if_tag_not_found", convert_bool, "true")]
e90a21cfbc3b added an option to fail if a tag could not be found instread of building trunk
Bjoern Ricks <bricks@intevation.de>
parents: 499
diff changeset
32
358
2524213a6e4f added packager that is able to build only tags for enterprise builds
Bjoern Ricks <bricks@intevation.de>
parents:
diff changeset
33 def __init__(self, *args, **kw):
524
e90a21cfbc3b added an option to fail if a tag could not be found instread of building trunk
Bjoern Ricks <bricks@intevation.de>
parents: 499
diff changeset
34 self.fail_if_tag_not_found = kw.pop("fail_if_tag_not_found")
358
2524213a6e4f added packager that is able to build only tags for enterprise builds
Bjoern Ricks <bricks@intevation.de>
parents:
diff changeset
35 super(PackageTrack, self).__init__(*args, **kw)
2524213a6e4f added packager that is able to build only tags for enterprise builds
Bjoern Ricks <bricks@intevation.de>
parents:
diff changeset
36
2524213a6e4f added packager that is able to build only tags for enterprise builds
Bjoern Ricks <bricks@intevation.de>
parents:
diff changeset
37 def packager_for_new_revision(self):
2524213a6e4f added packager that is able to build only tags for enterprise builds
Bjoern Ricks <bricks@intevation.de>
parents:
diff changeset
38 logging.info("Checking tags")
2524213a6e4f added packager that is able to build only tags for enterprise builds
Bjoern Ricks <bricks@intevation.de>
parents:
diff changeset
39 self.tag_url = None
2524213a6e4f added packager that is able to build only tags for enterprise builds
Bjoern Ricks <bricks@intevation.de>
parents:
diff changeset
40 self.use_tag_rules = self.found_tag_rules
2524213a6e4f added packager that is able to build only tags for enterprise builds
Bjoern Ricks <bricks@intevation.de>
parents:
diff changeset
41 tag_url, tag_revision = self.tag_detector.newest_tag_revision()
2524213a6e4f added packager that is able to build only tags for enterprise builds
Bjoern Ricks <bricks@intevation.de>
parents:
diff changeset
42 tag_rules_url, tag_rules_revision = self.tag_rules_detector.newest_tag_revision()
2524213a6e4f added packager that is able to build only tags for enterprise builds
Bjoern Ricks <bricks@intevation.de>
parents:
diff changeset
43 logging.info("Found: %s: %s", tag_url, tag_revision)
2524213a6e4f added packager that is able to build only tags for enterprise builds
Bjoern Ricks <bricks@intevation.de>
parents:
diff changeset
44 logging.info("Found rules: %s: %s", tag_rules_url, tag_rules_revision)
2524213a6e4f added packager that is able to build only tags for enterprise builds
Bjoern Ricks <bricks@intevation.de>
parents:
diff changeset
45 if self.use_tag_rules and tag_rules_url is None:
524
e90a21cfbc3b added an option to fail if a tag could not be found instread of building trunk
Bjoern Ricks <bricks@intevation.de>
parents: 499
diff changeset
46 self.use_tag_rules = False
e90a21cfbc3b added an option to fail if a tag could not be found instread of building trunk
Bjoern Ricks <bricks@intevation.de>
parents: 499
diff changeset
47 logging.error("No rules found in tag but tag should be used to" \
e90a21cfbc3b added an option to fail if a tag could not be found instread of building trunk
Bjoern Ricks <bricks@intevation.de>
parents: 499
diff changeset
48 " build package.")
e90a21cfbc3b added an option to fail if a tag could not be found instread of building trunk
Bjoern Ricks <bricks@intevation.de>
parents: 499
diff changeset
49 return
358
2524213a6e4f added packager that is able to build only tags for enterprise builds
Bjoern Ricks <bricks@intevation.de>
parents:
diff changeset
50 if tag_url is not None:
2524213a6e4f added packager that is able to build only tags for enterprise builds
Bjoern Ricks <bricks@intevation.de>
parents:
diff changeset
51 if not self.use_tag_rules:
2524213a6e4f added packager that is able to build only tags for enterprise builds
Bjoern Ricks <bricks@intevation.de>
parents:
diff changeset
52 tag_rules_revision = self.rules_working_copy.last_changed_revision()
2524213a6e4f added packager that is able to build only tags for enterprise builds
Bjoern Ricks <bricks@intevation.de>
parents:
diff changeset
53 revision = (tag_revision, tag_rules_revision)
2524213a6e4f added packager that is able to build only tags for enterprise builds
Bjoern Ricks <bricks@intevation.de>
parents:
diff changeset
54 logging.info("New revision is %s", revision)
2524213a6e4f added packager that is able to build only tags for enterprise builds
Bjoern Ricks <bricks@intevation.de>
parents:
diff changeset
55 if revision not in self.get_revision_numbers():
2524213a6e4f added packager that is able to build only tags for enterprise builds
Bjoern Ricks <bricks@intevation.de>
parents:
diff changeset
56 logging.info("Revision %s has not been packaged yet",
2524213a6e4f added packager that is able to build only tags for enterprise builds
Bjoern Ricks <bricks@intevation.de>
parents:
diff changeset
57 revision)
2524213a6e4f added packager that is able to build only tags for enterprise builds
Bjoern Ricks <bricks@intevation.de>
parents:
diff changeset
58 self.tag_url = tag_url
2524213a6e4f added packager that is able to build only tags for enterprise builds
Bjoern Ricks <bricks@intevation.de>
parents:
diff changeset
59 self.tag_revision = tag_revision
2524213a6e4f added packager that is able to build only tags for enterprise builds
Bjoern Ricks <bricks@intevation.de>
parents:
diff changeset
60 self.tag_rules_url = tag_rules_url
2524213a6e4f added packager that is able to build only tags for enterprise builds
Bjoern Ricks <bricks@intevation.de>
parents:
diff changeset
61 self.tag_rules_revision = tag_rules_revision
526
4a56ebc53ada tag_pkg_parameters is also used in enterprise tags recipe
Bjoern Ricks <bricks@intevation.de>
parents: 524
diff changeset
62 tag_date, tag_change_count = self.tag_detector.tag_pkg_parameters(tag_url)
528
e51cf2947fab log tag date
Bjoern Ricks <bricks@intevation.de>
parents: 526
diff changeset
63 logging.info("Tag date was %s", tag_date)
358
2524213a6e4f added packager that is able to build only tags for enterprise builds
Bjoern Ricks <bricks@intevation.de>
parents:
diff changeset
64 pkg_revision = (self.pkg_revision_template
2524213a6e4f added packager that is able to build only tags for enterprise builds
Bjoern Ricks <bricks@intevation.de>
parents:
diff changeset
65 % dict(pkg_revision=tag_change_count,
2524213a6e4f added packager that is able to build only tags for enterprise builds
Bjoern Ricks <bricks@intevation.de>
parents:
diff changeset
66 rules_revision=revision[1]))
2524213a6e4f added packager that is able to build only tags for enterprise builds
Bjoern Ricks <bricks@intevation.de>
parents:
diff changeset
67 return self.revision_packager_cls(self, tag=tag_url,
2524213a6e4f added packager that is able to build only tags for enterprise builds
Bjoern Ricks <bricks@intevation.de>
parents:
diff changeset
68 pkg_revision=pkg_revision,
2524213a6e4f added packager that is able to build only tags for enterprise builds
Bjoern Ricks <bricks@intevation.de>
parents:
diff changeset
69 pkg_date=tag_date,
2524213a6e4f added packager that is able to build only tags for enterprise builds
Bjoern Ricks <bricks@intevation.de>
parents:
diff changeset
70 *revision)
2524213a6e4f added packager that is able to build only tags for enterprise builds
Bjoern Ricks <bricks@intevation.de>
parents:
diff changeset
71 else:
2524213a6e4f added packager that is able to build only tags for enterprise builds
Bjoern Ricks <bricks@intevation.de>
parents:
diff changeset
72 logging.info("Revision %s has already been packaged.",
2524213a6e4f added packager that is able to build only tags for enterprise builds
Bjoern Ricks <bricks@intevation.de>
parents:
diff changeset
73 revision)
2524213a6e4f added packager that is able to build only tags for enterprise builds
Bjoern Ricks <bricks@intevation.de>
parents:
diff changeset
74
524
e90a21cfbc3b added an option to fail if a tag could not be found instread of building trunk
Bjoern Ricks <bricks@intevation.de>
parents: 499
diff changeset
75 else:
e90a21cfbc3b added an option to fail if a tag could not be found instread of building trunk
Bjoern Ricks <bricks@intevation.de>
parents: 499
diff changeset
76 if self.fail_if_tag_not_found:
e90a21cfbc3b added an option to fail if a tag could not be found instread of building trunk
Bjoern Ricks <bricks@intevation.de>
parents: 499
diff changeset
77 logging.error("Could not find tag for track %s", self.name)
e90a21cfbc3b added an option to fail if a tag could not be found instread of building trunk
Bjoern Ricks <bricks@intevation.de>
parents: 499
diff changeset
78 return
e90a21cfbc3b added an option to fail if a tag could not be found instread of building trunk
Bjoern Ricks <bricks@intevation.de>
parents: 499
diff changeset
79 # tag_url is not set -> build trunk
358
2524213a6e4f added packager that is able to build only tags for enterprise builds
Bjoern Ricks <bricks@intevation.de>
parents:
diff changeset
80 # don't use rules from tags for trunk builds
2524213a6e4f added packager that is able to build only tags for enterprise builds
Bjoern Ricks <bricks@intevation.de>
parents:
diff changeset
81 self.use_tag_rules = False
499
e44c9c3f69f8 consolidate enterprise packagers
Bjoern Ricks <bricks@intevation.de>
parents: 498
diff changeset
82 return super(PackageTrack, self).new_revsision_packager()
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)