cl.parse_changelog(open('debian/changelog'))
new_version = cl.full_version
new_tag = new_version.replace('~', '_').replace(':', ',')
+ add_changelog_entry = True
except Exception as error:
logger.error('Autoincrement failed. Standard error returned:\n\n%s\n' %
error.stderr, exc_info=error)
# .. or set approriate versions for our development candidates
else:
logger.info('Project is not respected by autoincrement.')
- cmd = [
- BIN_DCH,
- '--newversion',
- '{version}'.format(version=new_version),
- '--force-bad-version',
- '--distribution',
- '{dist}'.format(dist=new_dist),
- '--force-distribution',
- '--preserve',
- '--no-auto-nmu',
- '--',
- 'Generated by Jenkins build of commit {commit}'.format(
- commit=curr_commit_hexsha[0:7],
- ),
- ]
+ cl = changelog.Changelog()
+ cl.parse_changelog(open('debian/changelog'))
+ add_changelog_entry = new_dist != cl.distributions or new_version != cl.full_version
+ if add_changelog_entry:
+ cmd = [
+ BIN_DCH,
+ '--newversion',
+ '{version}'.format(version=new_version),
+ '--force-bad-version',
+ '--distribution',
+ '{dist}'.format(dist=new_dist),
+ '--force-distribution',
+ '--preserve',
+ '--no-auto-nmu',
+ '--',
+ 'Generated by Jenkins build of commit {commit}'.format(
+ commit=curr_commit_hexsha[0:7],
+ ),
+ ]
- logger.debug('Executing "{command}" ...'.format(command=' '.join(cmd)))
- dch = subprocess.Popen(
- cmd,
- shell=False,
- close_fds=True,
- stdin=subprocess.PIPE,
- stdout=sys.stdout,
- stderr=sys.stderr,
- cwd=os.getcwd(),
- )
- dch.stdin.write('\n')
- ret = dch.wait()
-
- # we need to commit here else git-buildpackage will use the existing debian/changelog...
- # TODO: Later we should investigate why "--ignore-new" does not work!
- gitrepo.git.add('-A')
- gitrepo.git.commit('-a', '-m', 'add new changelog entry')
+ logger.debug('Executing "{command}" ...'.format(command=' '.join(cmd)))
+ dch = subprocess.Popen(
+ cmd,
+ shell=False,
+ close_fds=True,
+ stdin=subprocess.PIPE,
+ stdout=sys.stdout,
+ stderr=sys.stderr,
+ cwd=os.getcwd(),
+ )
+ dch.stdin.write('\n')
+ ret = dch.wait()
+
+ if add_changelog_entry:
+ # we need to commit here else git-buildpackage will use the existing debian/changelog
+ # TODO: Later we should investigate why "--ignore-new" does not work!
+ gitrepo.git.add('-A')
+ gitrepo.git.commit('-a', '-m', 'add new changelog entry')
if ret:
raise Exception(