| |
@@ -147,6 +147,16 @@
|
| |
|
| |
_changelog_pattern = re.compile(r"^%changelog(\s|$)", re.I)
|
| |
|
| |
+ def validateDatestamp(self, datestamp):
|
| |
+ try:
|
| |
+ time.strptime(datestamp, "%a %b %d %H:%M:%S %Z %Y")
|
| |
+ except ValueError:
|
| |
+ try:
|
| |
+ time.strptime(datestamp, "%a %b %d %Y")
|
| |
+ except ValueError:
|
| |
+ raise BumpSpecError('Bad datestamp: %s\n' % datestamp)
|
| |
+ return datestamp
|
| |
+
|
| |
def addChangelogEntry(self, evr, entry, email):
|
| |
for i in range(len(self.lines)):
|
| |
if SpecFile._changelog_pattern.match(self.lines[i]):
|
| |
@@ -154,7 +164,9 @@
|
| |
evrstring = ' - %s' % evr
|
| |
else:
|
| |
evrstring = ''
|
| |
- if opts.legacy_datestamp:
|
| |
+ if opts.datestamp:
|
| |
+ date = self.validateDatestamp(opts.datestamp)
|
| |
+ elif opts.legacy_datestamp:
|
| |
date = time.strftime("%a %b %e %Y", time.gmtime())
|
| |
else:
|
| |
date = time.strftime("%a %b %e %T %Z %Y", time.localtime())
|
| |
@@ -290,6 +302,8 @@
|
| |
"(simple spec files only)")
|
| |
parser.add_option("-D", "--legacy-datestamp", default=False, action='store_true',
|
| |
help="use legacy datestamp for changelog entries")
|
| |
+ parser.add_option("-d", "--datestamp",
|
| |
+ help="changelog date string (default: today)")
|
| |
parser.add_option("-V", "--verbose", default=False, action='store_true',
|
| |
help="more output")
|
| |
parser.add_option("-v", "--version", default=False, action='store_true',
|
| |