import optparse
import os
import re
-import socket
import subprocess
import sys
from pprint import pformat
# import 3rd parties
+import debian.changelog
import debian.debian_support
-from debian import changelog
# import local modules
from add_liveboot_request import add_liveboot_request
# this should be part of 'git' lib, but it isn't right now
gitrepo.remotes = {}
for remote in gitrepo.git.remote('-v').split('\n'):
- name, url, type = remote.split()
- type = type.strip('()')
+ name, url, git_type = remote.split()
+ git_type = git_type.strip('()')
if name not in gitrepo.remotes:
- gitrepo.remotes.update({name: {type: url}})
+ gitrepo.remotes.update({name: {git_type: url}})
else:
- gitrepo.remotes[name].update({type: url})
+ gitrepo.remotes[name].update({git_type: url})
# this would also be helpful, but is not yet included in git lib
repo_name = gitrepo.remotes['origin']['fetch'].split('/')[-1].strip('.git')
else:
exit_error()
# .. content related
- cl = changelog.Changelog()
- cl.parse_changelog(open('debian/changelog'))
- curr_name = cl.package
- curr_version = cl.full_version
- curr_dist = cl.distributions
+ changelog = debian.changelog.Changelog()
+ changelog.parse_changelog(open('debian/changelog'))
+ curr_name = changelog.package
+ curr_version = changelog.full_version
+ curr_dist = changelog.distributions
if curr_version == "UNRELEASED":
# Search for the last release (where distribution is not UNRELEASED)
- for block in cl:
- curr_version = cl.distributions
+ for block in changelog:
+ curr_version = changelog.distributions
if curr_version != "UNRELEASED":
break
exit_error()
alexandria_dist = 'unstable'
new_dist = curr_dist + '-dev'
- if cl.distributions == "UNRELEASED":
+ if changelog.distributions == "UNRELEASED":
pattern = "{debversion}~develop{time:%Y%m%d+%H%M}+{build}+{git-commit}"
else:
pattern = "{debversion}+develop{time:%Y%m%d+%H%M}+{build}+{git-commit}"
alexandria_dist = "wheezy-dev-{0}".format(local_branch.replace("/", "-"))
else:
alexandria_dist = 'dev-{0}'.format(local_branch.replace("/", "-"))
- if cl.distributions == "UNRELEASED":
+ if changelog.distributions == "UNRELEASED":
pattern = "{debversion}~experimental{time:%Y%m%d+%H%M}+{build}+{git-commit}"
else:
pattern = "{debversion}+experimental{time:%Y%m%d+%H%M}+{build}+{git-commit}"
# .. and also cleanup existing *orig.tar.gz
if os.path.isdir(BUILD_AREA):
files = [
- os.path.join(BUILD_AREA, file) for file in fnmatch.filter(
+ os.path.join(BUILD_AREA, source_file) for source_file in fnmatch.filter(
os.listdir(BUILD_AREA), '*.orig.tar.gz'
)
]
logger.debug(gitrepo.git.push('origin', 'master'))
logger.info('Changelog autoincremented and pushed back by Jenkins!')
- cl = changelog.Changelog()
- cl.parse_changelog(open('debian/changelog'))
- new_version = cl.full_version
+ changelog = debian.changelog.Changelog()
+ changelog.parse_changelog(open('debian/changelog'))
+ new_version = changelog.full_version
new_tag = new_version.replace('~', '_').replace(':', ',')
except Exception as error:
logger.error('Autoincrement failed. Standard error returned:\n\n%s\n' %
# .. or set approriate versions for our development candidates
else:
logger.info('Project is not respected by autoincrement.')
- cl = changelog.Changelog()
- cl.parse_changelog(open('debian/changelog'))
- add_changelog_entry = new_dist != cl.distributions or new_version != cl.full_version
+ changelog = debian.changelog.Changelog()
+ changelog.parse_changelog(open('debian/changelog'))
+ add_changelog_entry = (new_dist != changelog.distributions or
+ new_version != changelog.full_version)
if add_changelog_entry:
cmd = [
BIN_DCH,
logger.info('Changelog updated by Jenkins using debian_build.py!')
# let me see the first two entries or our adjusted changelog:
- cl = changelog.Changelog()
- cl.parse_changelog(open('debian/changelog'))
+ changelog = debian.changelog.Changelog()
+ changelog.parse_changelog(open('debian/changelog'))
logger.info('New changelog:')
count = 2
- changelog = ""
- for block in cl:
- changelog += str(block)
+ changelog_part = ""
+ for block in changelog:
+ changelog_part += str(block)
count -= 1
if count == 0:
break
- for line in changelog.rstrip().split('\n'):
+ for line in changelog_part.rstrip().split('\n'):
logger.info(' ' + line)
- logger.info("Distribution is {dist} and version is {version}".format(dist=cl.distributions,
- version=cl.version))
+ logger.info("Distribution is {dist} and version is {version}".format(
+ dist=changelog.distributions,
+ version=changelog.version
+ ))
#
# ACT IV: preparations are done, let's build the source