comparison treepkg/packager.py @ 502:35759274aeb4

Expose package time and a short revision to the version templates.
author Andre Heinecke <aheinecke@intevation.de>
date Mon, 25 Oct 2010 08:18:21 +0000
parents e44c9c3f69f8
children 44a005311f62
comparison
equal deleted inserted replaced
501:fd52f1e231ba 502:35759274aeb4
95 The addionals parameter may contain a dictionary with additional 95 The addionals parameter may contain a dictionary with additional
96 variables used in the version template. 96 variables used in the version template.
97 97
98 Default variables that can be resolved are: 98 Default variables that can be resolved are:
99 revision - The revision of the package 99 revision - The revision of the package
100 short_revision - the first seven characters of the revision
100 rules_revision - The revision of the packaging rules 101 rules_revision - The revision of the packaging rules
101 pkg_date - The current date in the form: YYYYMMDD 102 pkg_date - The current date in the form: YYYYMMDD
103 pkg_time - The current ime in the form: HHMM
102 pkg_revision - The number of times a new package has 104 pkg_revision - The number of times a new package has
103 been created from this track. 105 been created from this track.
104 upstream_version - The version parsed from the sources or 106 upstream_version - The version parsed from the sources or
105 package descriptions by 107 package descriptions by
106 determine_upstream_version. Default: "0" 108 determine_upstream_version. Default: "0"
107 """ 109 """
108 revision = self.revision 110 revision = self.revision
109 rules_revision = self.parent.rules_revision 111 rules_revision = self.parent.rules_revision
110 pkg_revision = self.parent.pkg_revision 112 pkg_revision = self.parent.pkg_revision
113 short_revision = revision
114 if len(pkg_revision) > 7:
115 short_revision = short_revision[:7]
111 pkg_date = time.strftime("%Y%m%d", time.localtime()) 116 pkg_date = time.strftime("%Y%m%d", time.localtime())
117 pkg_time = time.strftime("%H%M", time.localtime())
112 upstream_version = self.determine_upstream_version(directory) 118 upstream_version = self.determine_upstream_version(directory)
113 version_dict = locals().copy() 119 version_dict = locals().copy()
114 if type(additionals).__name__=='dict': 120 if type(additionals).__name__=='dict':
115 version_dict.update(additionals) 121 version_dict.update(additionals)
116 return self.track.version_template % version_dict 122 return self.track.version_template % version_dict
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)