Mercurial > treepkg
annotate recipes/kde/enterprise/generic.py @ 522:7af344f9e704
set the correct tags_rules_pattern if not provided in the config
kw.pop with a default value doesn't work with empty strings
author | Bjoern Ricks <bricks@intevation.de> |
---|---|
date | Thu, 11 Nov 2010 08:26:32 +0000 |
parents | 452c5670ec6b |
children | 10a7fed8bf80 |
rev | line source |
---|---|
349
ae68f75f0e71
treepkg is able to use package descriptions from tags now
Bjoern Ricks <bricks@intevation.de>
parents:
337
diff
changeset
|
1 # Copyright (C) 2007 - 2010 by Intevation GmbH |
271
12facd1b5f19
Implement tag detection for the KDEPIM enterprise 3.5 packages. This is
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
2 # Authors: |
12facd1b5f19
Implement tag detection for the KDEPIM enterprise 3.5 packages. This is
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
3 # Bernhard Herzog <bh@intevation.de> |
349
ae68f75f0e71
treepkg is able to use package descriptions from tags now
Bjoern Ricks <bricks@intevation.de>
parents:
337
diff
changeset
|
4 # Bjoern Ricks <bjoern.ricks@intevation.de> |
271
12facd1b5f19
Implement tag detection for the KDEPIM enterprise 3.5 packages. This is
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
5 # |
12facd1b5f19
Implement tag detection for the KDEPIM enterprise 3.5 packages. This is
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
6 # This program is free software under the GPL (>=v2) |
12facd1b5f19
Implement tag detection for the KDEPIM enterprise 3.5 packages. This is
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
7 # Read the file COPYING coming with the software for details. |
12facd1b5f19
Implement tag detection for the KDEPIM enterprise 3.5 packages. This is
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
8 |
314
2c345bfbfb90
Create generic kde enterprise packager by copying and adapting
Bernhard Herzog <bh@intevation.de>
parents:
309
diff
changeset
|
9 """Base classes for all kde entperprise packagers""" |
271
12facd1b5f19
Implement tag detection for the KDEPIM enterprise 3.5 packages. This is
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
10 |
286
4376c5315c72
kdepim 3.5 recipes: Use the official tag date as the date in the package
Bernhard Herzog <bh@intevation.de>
parents:
283
diff
changeset
|
11 import re |
271
12facd1b5f19
Implement tag detection for the KDEPIM enterprise 3.5 packages. This is
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
12 import time |
12facd1b5f19
Implement tag detection for the KDEPIM enterprise 3.5 packages. This is
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
13 import logging |
12facd1b5f19
Implement tag detection for the KDEPIM enterprise 3.5 packages. This is
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
14 |
12facd1b5f19
Implement tag detection for the KDEPIM enterprise 3.5 packages. This is
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
15 import treepkg.packager |
286
4376c5315c72
kdepim 3.5 recipes: Use the official tag date as the date in the package
Bernhard Herzog <bh@intevation.de>
parents:
283
diff
changeset
|
16 import treepkg.subversion as subversion |
511
e5b66539f893
new variable to set choose the scm for sources and debian dirs
Bjoern Ricks <bricks@intevation.de>
parents:
494
diff
changeset
|
17 import treepkg.git as git |
271
12facd1b5f19
Implement tag detection for the KDEPIM enterprise 3.5 packages. This is
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
18 |
12facd1b5f19
Implement tag detection for the KDEPIM enterprise 3.5 packages. This is
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
19 |
314
2c345bfbfb90
Create generic kde enterprise packager by copying and adapting
Bernhard Herzog <bh@intevation.de>
parents:
309
diff
changeset
|
20 class SourcePackager(treepkg.packager.SourcePackager): |
275
c0cbd133b607
Define changemsg_template in BaseSourcePackager and not in the kdepim
Bernhard Herzog <bh@intevation.de>
parents:
274
diff
changeset
|
21 |
271
12facd1b5f19
Implement tag detection for the KDEPIM enterprise 3.5 packages. This is
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
22 def __init__(self, *args, **kw): |
314
2c345bfbfb90
Create generic kde enterprise packager by copying and adapting
Bernhard Herzog <bh@intevation.de>
parents:
309
diff
changeset
|
23 super(SourcePackager, self).__init__(*args, **kw) |
283
cd10b835d9b8
kdepim recipes: introduce a BaseRevisionPackager that allows the track
Bernhard Herzog <bh@intevation.de>
parents:
280
diff
changeset
|
24 self.enterprise_version = (self.parent.pkg_date + "." |
cd10b835d9b8
kdepim recipes: introduce a BaseRevisionPackager that allows the track
Bernhard Herzog <bh@intevation.de>
parents:
280
diff
changeset
|
25 + str(self.revision)) |
271
12facd1b5f19
Implement tag detection for the KDEPIM enterprise 3.5 packages. This is
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
26 |
12facd1b5f19
Implement tag detection for the KDEPIM enterprise 3.5 packages. This is
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
27 def determine_package_version(self, directory): |
12facd1b5f19
Implement tag detection for the KDEPIM enterprise 3.5 packages. This is
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
28 enterprise_version = self.enterprise_version |
494
31b64ebe4b42
determine upstream_version of a package
Bjoern Ricks <bricks@intevation.de>
parents:
381
diff
changeset
|
29 return super(SourcePackager, self).determine_package_version( |
31b64ebe4b42
determine upstream_version of a package
Bjoern Ricks <bricks@intevation.de>
parents:
381
diff
changeset
|
30 directory, locals()) |
271
12facd1b5f19
Implement tag detection for the KDEPIM enterprise 3.5 packages. This is
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
31 |
276
f3dee156e3e3
Add pkgbaseversion parameter to the prepare_sources_for_tarball method
Bernhard Herzog <bh@intevation.de>
parents:
275
diff
changeset
|
32 def prepare_sources_for_tarball(self, pkgbasedir, pkgbaseversion): |
271
12facd1b5f19
Implement tag detection for the KDEPIM enterprise 3.5 packages. This is
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
33 self.update_version_numbers(pkgbasedir) |
12facd1b5f19
Implement tag detection for the KDEPIM enterprise 3.5 packages. This is
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
34 |
274
2676abfc0e1d
Refactoring: Implement do_package in treepkg.packager.SourcePackager.
Bernhard Herzog <bh@intevation.de>
parents:
273
diff
changeset
|
35 def update_version_numbers(self, pkgbasedir): |
2676abfc0e1d
Refactoring: Implement do_package in treepkg.packager.SourcePackager.
Bernhard Herzog <bh@intevation.de>
parents:
273
diff
changeset
|
36 """Updates the version numbers in the code in pkgbasedir. |
2676abfc0e1d
Refactoring: Implement do_package in treepkg.packager.SourcePackager.
Bernhard Herzog <bh@intevation.de>
parents:
273
diff
changeset
|
37 The default implementation does nothing. Derived classes should |
2676abfc0e1d
Refactoring: Implement do_package in treepkg.packager.SourcePackager.
Bernhard Herzog <bh@intevation.de>
parents:
273
diff
changeset
|
38 override this method if necessary. |
2676abfc0e1d
Refactoring: Implement do_package in treepkg.packager.SourcePackager.
Bernhard Herzog <bh@intevation.de>
parents:
273
diff
changeset
|
39 """ |
271
12facd1b5f19
Implement tag detection for the KDEPIM enterprise 3.5 packages. This is
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
40 |
381
51c447a6792e
merged maemo packager into enterprise packager
Bjoern Ricks <bricks@intevation.de>
parents:
357
diff
changeset
|
41 def get_change_msg(self): |
51c447a6792e
merged maemo packager into enterprise packager
Bjoern Ricks <bricks@intevation.de>
parents:
357
diff
changeset
|
42 return self.changemsg_template % dict(revision=self.revision, |
51c447a6792e
merged maemo packager into enterprise packager
Bjoern Ricks <bricks@intevation.de>
parents:
357
diff
changeset
|
43 pkg_date=self.parent.pkg_date, |
51c447a6792e
merged maemo packager into enterprise packager
Bjoern Ricks <bricks@intevation.de>
parents:
357
diff
changeset
|
44 rules_revision=self.parent.rules_revision) |
271
12facd1b5f19
Implement tag detection for the KDEPIM enterprise 3.5 packages. This is
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
45 |
314
2c345bfbfb90
Create generic kde enterprise packager by copying and adapting
Bernhard Herzog <bh@intevation.de>
parents:
309
diff
changeset
|
46 class RevisionPackager(treepkg.packager.RevisionPackager): |
283
cd10b835d9b8
kdepim recipes: introduce a BaseRevisionPackager that allows the track
Bernhard Herzog <bh@intevation.de>
parents:
280
diff
changeset
|
47 |
314
2c345bfbfb90
Create generic kde enterprise packager by copying and adapting
Bernhard Herzog <bh@intevation.de>
parents:
309
diff
changeset
|
48 source_packager_cls = SourcePackager |
301
3fcebc5cf93c
Do not require subclassing of
Bernhard Herzog <bh@intevation.de>
parents:
293
diff
changeset
|
49 |
283
cd10b835d9b8
kdepim recipes: introduce a BaseRevisionPackager that allows the track
Bernhard Herzog <bh@intevation.de>
parents:
280
diff
changeset
|
50 def __init__(self, *args, **kw): |
cd10b835d9b8
kdepim recipes: introduce a BaseRevisionPackager that allows the track
Bernhard Herzog <bh@intevation.de>
parents:
280
diff
changeset
|
51 self.pkg_date = kw.pop("pkg_date", |
cd10b835d9b8
kdepim recipes: introduce a BaseRevisionPackager that allows the track
Bernhard Herzog <bh@intevation.de>
parents:
280
diff
changeset
|
52 time.strftime("%Y%m%d", time.localtime())) |
314
2c345bfbfb90
Create generic kde enterprise packager by copying and adapting
Bernhard Herzog <bh@intevation.de>
parents:
309
diff
changeset
|
53 super(RevisionPackager, self).__init__(*args, **kw) |
283
cd10b835d9b8
kdepim recipes: introduce a BaseRevisionPackager that allows the track
Bernhard Herzog <bh@intevation.de>
parents:
280
diff
changeset
|
54 |
cd10b835d9b8
kdepim recipes: introduce a BaseRevisionPackager that allows the track
Bernhard Herzog <bh@intevation.de>
parents:
280
diff
changeset
|
55 |
314
2c345bfbfb90
Create generic kde enterprise packager by copying and adapting
Bernhard Herzog <bh@intevation.de>
parents:
309
diff
changeset
|
56 class PackageTrack(treepkg.packager.PackageTrack): |
271
12facd1b5f19
Implement tag detection for the KDEPIM enterprise 3.5 packages. This is
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
57 |
314
2c345bfbfb90
Create generic kde enterprise packager by copying and adapting
Bernhard Herzog <bh@intevation.de>
parents:
309
diff
changeset
|
58 revision_packager_cls = RevisionPackager |
309
3749b8285b93
Do not require subclassing of recipes.kde_enterprise_3_5.base.BasePackageTrack.
Bernhard Herzog <bh@intevation.de>
parents:
301
diff
changeset
|
59 |
314
2c345bfbfb90
Create generic kde enterprise packager by copying and adapting
Bernhard Herzog <bh@intevation.de>
parents:
309
diff
changeset
|
60 extra_config_desc = [("tags_url", str, ""), |
271
12facd1b5f19
Implement tag detection for the KDEPIM enterprise 3.5 packages. This is
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
61 ("tags_pattern", str, ""), |
349
ae68f75f0e71
treepkg is able to use package descriptions from tags now
Bjoern Ricks <bricks@intevation.de>
parents:
337
diff
changeset
|
62 ("tags_subdir", str, ""), |
514
0c2cc67a29aa
set tag scm types to continous scm types if not set by user
Bjoern Ricks <bricks@intevation.de>
parents:
511
diff
changeset
|
63 ("tags_scm_type", str, None), |
511
e5b66539f893
new variable to set choose the scm for sources and debian dirs
Bjoern Ricks <bricks@intevation.de>
parents:
494
diff
changeset
|
64 ("tags_rules_url", str, None), |
514
0c2cc67a29aa
set tag scm types to continous scm types if not set by user
Bjoern Ricks <bricks@intevation.de>
parents:
511
diff
changeset
|
65 ("tags_rules_pattern", str, ""), |
511
e5b66539f893
new variable to set choose the scm for sources and debian dirs
Bjoern Ricks <bricks@intevation.de>
parents:
494
diff
changeset
|
66 ("tags_rules_subdir", str, ""), |
514
0c2cc67a29aa
set tag scm types to continous scm types if not set by user
Bjoern Ricks <bricks@intevation.de>
parents:
511
diff
changeset
|
67 ("tags_rules_scm_type", str, None)] |
271
12facd1b5f19
Implement tag detection for the KDEPIM enterprise 3.5 packages. This is
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
68 |
12facd1b5f19
Implement tag detection for the KDEPIM enterprise 3.5 packages. This is
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
69 def __init__(self, *args, **kw): |
12facd1b5f19
Implement tag detection for the KDEPIM enterprise 3.5 packages. This is
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
70 tags_url = kw.pop("tags_url") |
12facd1b5f19
Implement tag detection for the KDEPIM enterprise 3.5 packages. This is
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
71 tags_pattern = kw.pop("tags_pattern") |
12facd1b5f19
Implement tag detection for the KDEPIM enterprise 3.5 packages. This is
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
72 tags_subdir = kw.pop("tags_subdir") |
511
e5b66539f893
new variable to set choose the scm for sources and debian dirs
Bjoern Ricks <bricks@intevation.de>
parents:
494
diff
changeset
|
73 tags_rules_url = kw.pop("tags_rules_url") |
522
7af344f9e704
set the correct tags_rules_pattern if not provided in the config
Bjoern Ricks <bricks@intevation.de>
parents:
518
diff
changeset
|
74 tags_rules_pattern = kw.pop("tags_rules_pattern") |
349
ae68f75f0e71
treepkg is able to use package descriptions from tags now
Bjoern Ricks <bricks@intevation.de>
parents:
337
diff
changeset
|
75 tags_rules_subdir = kw.pop("tags_rules_subdir") |
514
0c2cc67a29aa
set tag scm types to continous scm types if not set by user
Bjoern Ricks <bricks@intevation.de>
parents:
511
diff
changeset
|
76 tags_scm_type = kw.pop("tags_scm_type") |
0c2cc67a29aa
set tag scm types to continous scm types if not set by user
Bjoern Ricks <bricks@intevation.de>
parents:
511
diff
changeset
|
77 tags_rules_scm_type = kw.pop("tags_rules_scm_type") |
314
2c345bfbfb90
Create generic kde enterprise packager by copying and adapting
Bernhard Herzog <bh@intevation.de>
parents:
309
diff
changeset
|
78 super(PackageTrack, self).__init__(*args, **kw) |
514
0c2cc67a29aa
set tag scm types to continous scm types if not set by user
Bjoern Ricks <bricks@intevation.de>
parents:
511
diff
changeset
|
79 |
522
7af344f9e704
set the correct tags_rules_pattern if not provided in the config
Bjoern Ricks <bricks@intevation.de>
parents:
518
diff
changeset
|
80 if not tags_rules_pattern: |
7af344f9e704
set the correct tags_rules_pattern if not provided in the config
Bjoern Ricks <bricks@intevation.de>
parents:
518
diff
changeset
|
81 tags_rules_pattern = tags_pattern |
514
0c2cc67a29aa
set tag scm types to continous scm types if not set by user
Bjoern Ricks <bricks@intevation.de>
parents:
511
diff
changeset
|
82 if not tags_scm_type: |
0c2cc67a29aa
set tag scm types to continous scm types if not set by user
Bjoern Ricks <bricks@intevation.de>
parents:
511
diff
changeset
|
83 tags_scm_type = self.scm_type |
0c2cc67a29aa
set tag scm types to continous scm types if not set by user
Bjoern Ricks <bricks@intevation.de>
parents:
511
diff
changeset
|
84 if not tags_rules_scm_type: |
0c2cc67a29aa
set tag scm types to continous scm types if not set by user
Bjoern Ricks <bricks@intevation.de>
parents:
511
diff
changeset
|
85 tags_rules_scm_type = self.rules_scm_type |
0c2cc67a29aa
set tag scm types to continous scm types if not set by user
Bjoern Ricks <bricks@intevation.de>
parents:
511
diff
changeset
|
86 |
511
e5b66539f893
new variable to set choose the scm for sources and debian dirs
Bjoern Ricks <bricks@intevation.de>
parents:
494
diff
changeset
|
87 if tags_scm_type == "git": |
518
452c5670ec6b
fix git tag detector usage in enterprise packager
Bjoern Ricks <bricks@intevation.de>
parents:
514
diff
changeset
|
88 self.tag_detector = git.TagDetector(tags_url, tags_pattern, |
452c5670ec6b
fix git tag detector usage in enterprise packager
Bjoern Ricks <bricks@intevation.de>
parents:
514
diff
changeset
|
89 self.checkout_dir) |
511
e5b66539f893
new variable to set choose the scm for sources and debian dirs
Bjoern Ricks <bricks@intevation.de>
parents:
494
diff
changeset
|
90 elif tags_scm_type == "svn": |
e5b66539f893
new variable to set choose the scm for sources and debian dirs
Bjoern Ricks <bricks@intevation.de>
parents:
494
diff
changeset
|
91 self.tag_detector = subversion.TagDetector(tags_url, tags_pattern, |
286
4376c5315c72
kdepim 3.5 recipes: Use the official tag date as the date in the package
Bernhard Herzog <bh@intevation.de>
parents:
283
diff
changeset
|
92 tags_subdir) |
511
e5b66539f893
new variable to set choose the scm for sources and debian dirs
Bjoern Ricks <bricks@intevation.de>
parents:
494
diff
changeset
|
93 else: |
514
0c2cc67a29aa
set tag scm types to continous scm types if not set by user
Bjoern Ricks <bricks@intevation.de>
parents:
511
diff
changeset
|
94 raise treepkg.packager.PackagerError("Unknown scm type \"%s\" for tag" \ |
511
e5b66539f893
new variable to set choose the scm for sources and debian dirs
Bjoern Ricks <bricks@intevation.de>
parents:
494
diff
changeset
|
95 " sources set" % tags_scm_type) |
514
0c2cc67a29aa
set tag scm types to continous scm types if not set by user
Bjoern Ricks <bricks@intevation.de>
parents:
511
diff
changeset
|
96 |
511
e5b66539f893
new variable to set choose the scm for sources and debian dirs
Bjoern Ricks <bricks@intevation.de>
parents:
494
diff
changeset
|
97 if tags_rules_scm_type == "git": |
e5b66539f893
new variable to set choose the scm for sources and debian dirs
Bjoern Ricks <bricks@intevation.de>
parents:
494
diff
changeset
|
98 self.tag_rules_detector = git.TagDetector(tags_rules_url, |
518
452c5670ec6b
fix git tag detector usage in enterprise packager
Bjoern Ricks <bricks@intevation.de>
parents:
514
diff
changeset
|
99 tags_rules_pattern, self.debian_dir) |
511
e5b66539f893
new variable to set choose the scm for sources and debian dirs
Bjoern Ricks <bricks@intevation.de>
parents:
494
diff
changeset
|
100 elif tags_rules_scm_type == "svn": |
e5b66539f893
new variable to set choose the scm for sources and debian dirs
Bjoern Ricks <bricks@intevation.de>
parents:
494
diff
changeset
|
101 self.tag_rules_detector = subversion.TagDetector(tags_rules_url, |
e5b66539f893
new variable to set choose the scm for sources and debian dirs
Bjoern Ricks <bricks@intevation.de>
parents:
494
diff
changeset
|
102 tags_rules_pattern, tags_rules_subdir) |
e5b66539f893
new variable to set choose the scm for sources and debian dirs
Bjoern Ricks <bricks@intevation.de>
parents:
494
diff
changeset
|
103 else: |
514
0c2cc67a29aa
set tag scm types to continous scm types if not set by user
Bjoern Ricks <bricks@intevation.de>
parents:
511
diff
changeset
|
104 raise treepkg.packager.PackagerError("Unknown scm type \"%s\" for tag" \ |
511
e5b66539f893
new variable to set choose the scm for sources and debian dirs
Bjoern Ricks <bricks@intevation.de>
parents:
494
diff
changeset
|
105 " rules set" % tags_rules_scm_type) |
355
8a07fc5e15b3
added some logging output
Bjoern Ricks <bricks@intevation.de>
parents:
354
diff
changeset
|
106 self.found_tag_rules = False |
511
e5b66539f893
new variable to set choose the scm for sources and debian dirs
Bjoern Ricks <bricks@intevation.de>
parents:
494
diff
changeset
|
107 if tags_rules_url: |
355
8a07fc5e15b3
added some logging output
Bjoern Ricks <bricks@intevation.de>
parents:
354
diff
changeset
|
108 self.found_tag_rules = True |
271
12facd1b5f19
Implement tag detection for the KDEPIM enterprise 3.5 packages. This is
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
109 |
12facd1b5f19
Implement tag detection for the KDEPIM enterprise 3.5 packages. This is
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
110 def packager_for_new_revision(self): |
12facd1b5f19
Implement tag detection for the KDEPIM enterprise 3.5 packages. This is
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
111 logging.info("Checking tags") |
12facd1b5f19
Implement tag detection for the KDEPIM enterprise 3.5 packages. This is
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
112 self.tag_url = None |
355
8a07fc5e15b3
added some logging output
Bjoern Ricks <bricks@intevation.de>
parents:
354
diff
changeset
|
113 self.use_tag_rules = self.found_tag_rules |
271
12facd1b5f19
Implement tag detection for the KDEPIM enterprise 3.5 packages. This is
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
114 tag_url, tag_revision = self.tag_detector.newest_tag_revision() |
349
ae68f75f0e71
treepkg is able to use package descriptions from tags now
Bjoern Ricks <bricks@intevation.de>
parents:
337
diff
changeset
|
115 tag_rules_url, tag_rules_revision = self.tag_rules_detector.newest_tag_revision() |
271
12facd1b5f19
Implement tag detection for the KDEPIM enterprise 3.5 packages. This is
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
116 logging.info("Found: %s: %s", tag_url, tag_revision) |
355
8a07fc5e15b3
added some logging output
Bjoern Ricks <bricks@intevation.de>
parents:
354
diff
changeset
|
117 logging.info("Found rules: %s: %s", tag_rules_url, tag_rules_revision) |
349
ae68f75f0e71
treepkg is able to use package descriptions from tags now
Bjoern Ricks <bricks@intevation.de>
parents:
337
diff
changeset
|
118 if self.use_tag_rules and tag_rules_url is None: |
355
8a07fc5e15b3
added some logging output
Bjoern Ricks <bricks@intevation.de>
parents:
354
diff
changeset
|
119 self.use_tag_rules = False # maybe it's better to raise an exception |
271
12facd1b5f19
Implement tag detection for the KDEPIM enterprise 3.5 packages. This is
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
120 if tag_url is not None: |
349
ae68f75f0e71
treepkg is able to use package descriptions from tags now
Bjoern Ricks <bricks@intevation.de>
parents:
337
diff
changeset
|
121 if not self.use_tag_rules: |
ae68f75f0e71
treepkg is able to use package descriptions from tags now
Bjoern Ricks <bricks@intevation.de>
parents:
337
diff
changeset
|
122 tag_rules_revision = self.rules_working_copy.last_changed_revision() |
ae68f75f0e71
treepkg is able to use package descriptions from tags now
Bjoern Ricks <bricks@intevation.de>
parents:
337
diff
changeset
|
123 revision = (tag_revision, tag_rules_revision) |
271
12facd1b5f19
Implement tag detection for the KDEPIM enterprise 3.5 packages. This is
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
124 logging.info("New revision is %s", revision) |
12facd1b5f19
Implement tag detection for the KDEPIM enterprise 3.5 packages. This is
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
125 if revision not in self.get_revision_numbers(): |
12facd1b5f19
Implement tag detection for the KDEPIM enterprise 3.5 packages. This is
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
126 logging.info("Revision %s has not been packaged yet", |
12facd1b5f19
Implement tag detection for the KDEPIM enterprise 3.5 packages. This is
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
127 revision) |
12facd1b5f19
Implement tag detection for the KDEPIM enterprise 3.5 packages. This is
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
128 self.tag_url = tag_url |
280
d2382953b2c8
When building a tagged revision, make sure to explicitly use the
Bernhard Herzog <bh@intevation.de>
parents:
276
diff
changeset
|
129 self.tag_revision = tag_revision |
349
ae68f75f0e71
treepkg is able to use package descriptions from tags now
Bjoern Ricks <bricks@intevation.de>
parents:
337
diff
changeset
|
130 self.tag_rules_url = tag_rules_url |
ae68f75f0e71
treepkg is able to use package descriptions from tags now
Bjoern Ricks <bricks@intevation.de>
parents:
337
diff
changeset
|
131 self.tag_rules_revision = tag_rules_revision |
286
4376c5315c72
kdepim 3.5 recipes: Use the official tag date as the date in the package
Bernhard Herzog <bh@intevation.de>
parents:
283
diff
changeset
|
132 tag_date, tag_change_count = self.tag_pkg_parameters(tag_url) |
293
faeeac2c4c71
Replace debrevision_prefix with pkg_revision_template. Their meaning is
Bernhard Herzog <bh@intevation.de>
parents:
286
diff
changeset
|
133 pkg_revision = (self.pkg_revision_template |
337
781074885633
Check in of local Enterprise recipe changes
Andre Heinecke <aheinecke@intevation.de>
parents:
314
diff
changeset
|
134 % dict(pkg_revision=tag_change_count, |
781074885633
Check in of local Enterprise recipe changes
Andre Heinecke <aheinecke@intevation.de>
parents:
314
diff
changeset
|
135 rules_revision=revision[1])) |
286
4376c5315c72
kdepim 3.5 recipes: Use the official tag date as the date in the package
Bernhard Herzog <bh@intevation.de>
parents:
283
diff
changeset
|
136 return self.revision_packager_cls(self, tag=tag_url, |
4376c5315c72
kdepim 3.5 recipes: Use the official tag date as the date in the package
Bernhard Herzog <bh@intevation.de>
parents:
283
diff
changeset
|
137 pkg_revision=pkg_revision, |
4376c5315c72
kdepim 3.5 recipes: Use the official tag date as the date in the package
Bernhard Herzog <bh@intevation.de>
parents:
283
diff
changeset
|
138 pkg_date=tag_date, |
4376c5315c72
kdepim 3.5 recipes: Use the official tag date as the date in the package
Bernhard Herzog <bh@intevation.de>
parents:
283
diff
changeset
|
139 *revision) |
271
12facd1b5f19
Implement tag detection for the KDEPIM enterprise 3.5 packages. This is
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
140 else: |
12facd1b5f19
Implement tag detection for the KDEPIM enterprise 3.5 packages. This is
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
141 logging.info("Revision %s has already been packaged.", |
12facd1b5f19
Implement tag detection for the KDEPIM enterprise 3.5 packages. This is
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
142 revision) |
357
eb6445552640
added a small comment about the behaviour of this packager
Bjoern Ricks <bricks@intevation.de>
parents:
355
diff
changeset
|
143 |
eb6445552640
added a small comment about the behaviour of this packager
Bjoern Ricks <bricks@intevation.de>
parents:
355
diff
changeset
|
144 # tag has been built -> build trunk |
eb6445552640
added a small comment about the behaviour of this packager
Bjoern Ricks <bricks@intevation.de>
parents:
355
diff
changeset
|
145 # don't use rules from tags for trunk |
354
0970a3cca4a6
only export debian dir from tag if a tag is build
Bjoern Ricks <bricks@intevation.de>
parents:
350
diff
changeset
|
146 self.use_tag_rules = False |
314
2c345bfbfb90
Create generic kde enterprise packager by copying and adapting
Bernhard Herzog <bh@intevation.de>
parents:
309
diff
changeset
|
147 return super(PackageTrack, self).packager_for_new_revision() |
271
12facd1b5f19
Implement tag detection for the KDEPIM enterprise 3.5 packages. This is
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
148 |
12facd1b5f19
Implement tag detection for the KDEPIM enterprise 3.5 packages. This is
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
149 def export_sources(self, to_dir): |
12facd1b5f19
Implement tag detection for the KDEPIM enterprise 3.5 packages. This is
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
150 if self.tag_url is not None: |
314
2c345bfbfb90
Create generic kde enterprise packager by copying and adapting
Bernhard Herzog <bh@intevation.de>
parents:
309
diff
changeset
|
151 logging.info("Exporting sources for tarball from %r to %r", |
2c345bfbfb90
Create generic kde enterprise packager by copying and adapting
Bernhard Herzog <bh@intevation.de>
parents:
309
diff
changeset
|
152 self.tag_url, to_dir) |
2c345bfbfb90
Create generic kde enterprise packager by copying and adapting
Bernhard Herzog <bh@intevation.de>
parents:
309
diff
changeset
|
153 self.working_copy.export_tag(self.tag_url, to_dir, |
2c345bfbfb90
Create generic kde enterprise packager by copying and adapting
Bernhard Herzog <bh@intevation.de>
parents:
309
diff
changeset
|
154 revision=self.tag_revision) |
271
12facd1b5f19
Implement tag detection for the KDEPIM enterprise 3.5 packages. This is
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
155 else: |
314
2c345bfbfb90
Create generic kde enterprise packager by copying and adapting
Bernhard Herzog <bh@intevation.de>
parents:
309
diff
changeset
|
156 super(PackageTrack, self).export_sources(to_dir) |
286
4376c5315c72
kdepim 3.5 recipes: Use the official tag date as the date in the package
Bernhard Herzog <bh@intevation.de>
parents:
283
diff
changeset
|
157 |
349
ae68f75f0e71
treepkg is able to use package descriptions from tags now
Bjoern Ricks <bricks@intevation.de>
parents:
337
diff
changeset
|
158 def copy_debian_directory(self, to_dir): |
ae68f75f0e71
treepkg is able to use package descriptions from tags now
Bjoern Ricks <bricks@intevation.de>
parents:
337
diff
changeset
|
159 if self.use_tag_rules: |
ae68f75f0e71
treepkg is able to use package descriptions from tags now
Bjoern Ricks <bricks@intevation.de>
parents:
337
diff
changeset
|
160 logging.info("Exporting debian package description from %s to %s", |
ae68f75f0e71
treepkg is able to use package descriptions from tags now
Bjoern Ricks <bricks@intevation.de>
parents:
337
diff
changeset
|
161 self.tag_rules_url, to_dir) |
ae68f75f0e71
treepkg is able to use package descriptions from tags now
Bjoern Ricks <bricks@intevation.de>
parents:
337
diff
changeset
|
162 self.rules_working_copy.export_tag(self.tag_rules_url, to_dir) |
ae68f75f0e71
treepkg is able to use package descriptions from tags now
Bjoern Ricks <bricks@intevation.de>
parents:
337
diff
changeset
|
163 else: |
ae68f75f0e71
treepkg is able to use package descriptions from tags now
Bjoern Ricks <bricks@intevation.de>
parents:
337
diff
changeset
|
164 super(PackageTrack, self).copy_debian_directory(to_dir) |
ae68f75f0e71
treepkg is able to use package descriptions from tags now
Bjoern Ricks <bricks@intevation.de>
parents:
337
diff
changeset
|
165 |
286
4376c5315c72
kdepim 3.5 recipes: Use the official tag date as the date in the package
Bernhard Herzog <bh@intevation.de>
parents:
283
diff
changeset
|
166 def tag_pkg_parameters(self, tag_url): |
4376c5315c72
kdepim 3.5 recipes: Use the official tag date as the date in the package
Bernhard Herzog <bh@intevation.de>
parents:
283
diff
changeset
|
167 match = re.search(r"/enterprise[^.]*\.[^.]*\." |
4376c5315c72
kdepim 3.5 recipes: Use the official tag date as the date in the package
Bernhard Herzog <bh@intevation.de>
parents:
283
diff
changeset
|
168 r"(?P<date>[0-9]{8})\.(?P<baserev>[0-9]+)/", |
4376c5315c72
kdepim 3.5 recipes: Use the official tag date as the date in the package
Bernhard Herzog <bh@intevation.de>
parents:
283
diff
changeset
|
169 tag_url) |
4376c5315c72
kdepim 3.5 recipes: Use the official tag date as the date in the package
Bernhard Herzog <bh@intevation.de>
parents:
283
diff
changeset
|
170 if match: |
4376c5315c72
kdepim 3.5 recipes: Use the official tag date as the date in the package
Bernhard Herzog <bh@intevation.de>
parents:
283
diff
changeset
|
171 date = match.group("date") |
350
b41f54880572
removed obsolete cast to int
Bjoern Ricks <bricks@intevation.de>
parents:
349
diff
changeset
|
172 baserev = match.group("baserev") |
286
4376c5315c72
kdepim 3.5 recipes: Use the official tag date as the date in the package
Bernhard Herzog <bh@intevation.de>
parents:
283
diff
changeset
|
173 xml_log = subversion.log_xml(tag_url, baserev) |
4376c5315c72
kdepim 3.5 recipes: Use the official tag date as the date in the package
Bernhard Herzog <bh@intevation.de>
parents:
283
diff
changeset
|
174 revisions = subversion.extract_tag_revisions(xml_log) |
4376c5315c72
kdepim 3.5 recipes: Use the official tag date as the date in the package
Bernhard Herzog <bh@intevation.de>
parents:
283
diff
changeset
|
175 tag_change_count = len(revisions) |
4376c5315c72
kdepim 3.5 recipes: Use the official tag date as the date in the package
Bernhard Herzog <bh@intevation.de>
parents:
283
diff
changeset
|
176 return (date, tag_change_count) |
4376c5315c72
kdepim 3.5 recipes: Use the official tag date as the date in the package
Bernhard Herzog <bh@intevation.de>
parents:
283
diff
changeset
|
177 else: |
4376c5315c72
kdepim 3.5 recipes: Use the official tag date as the date in the package
Bernhard Herzog <bh@intevation.de>
parents:
283
diff
changeset
|
178 raise RuntimeError("Cannot determine tag parameters from %r" |
4376c5315c72
kdepim 3.5 recipes: Use the official tag date as the date in the package
Bernhard Herzog <bh@intevation.de>
parents:
283
diff
changeset
|
179 % tag_url) |