def buildpackage(os_release=None, name=None, upload=True, ubuntu_release=None): """Build a package for the current repository.""" git.assert_in_repository() version = git_version() current_branch = git.current_branch() if os_release is None: os_release = parse_openstack_release(current_branch) deb_branch = discover_debian_branch(current_branch, version, os_release) with git.temporary_merge(deb_branch) as merge: source_package = dpkg_parsechangelog() current_version = source_package["Version"] version['debian'] = get_debian_commit_number() if ubuntu_release: dist = ubuntu_release else: dist = pbuilder.dist_from_release(os_release) dist_release = pbuilder.get_build_env(os_release, ubuntu_release) version['distribution'] = dist release_version = debian_version(current_version, version) local("dch -v {0} -D {1} --force-distribution 'Released'" .format(release_version, dist_release)) local("git add debian/changelog") local("git commit -m \"{0}\"".format("Updated Changelog")) git_buildpackage(current_branch, upstream_tree=merge.old_head, release=os_release, name=name, ubuntu_release=ubuntu_release) # Regenerate the source package information since it's changed # since we updated the changelog. source_package = dpkg_parsechangelog() changes = changes_filepath(source_package) if upload: execute(uploadpackage, changes)
def buildpackage(os_release=None, upload=True): """Build a package for the current repository.""" git.assert_in_repository() version = git_version() current_branch = git.current_branch() if os_release is None: os_release = parse_openstack_release(current_branch) deb_branch = discover_debian_branch(current_branch, version, os_release) with git.temporary_merge(deb_branch) as merge: source_package = dpkg_parsechangelog() current_version = source_package["Version"] version['debian'] = get_debian_commit_number() dist = dist_from_release(os_release) version['distribution'] = dist release_version = debian_version(current_version, version) local("dch -v {0} -D {1}-{2} --force-distribution 'Released'".format( release_version, dist, os_release)) local("git add debian/changelog") local("git commit -m \"{0}\"".format("Updated Changelog")) git_buildpackage(current_branch, upstream_tree=merge.old_head, release=os_release) # Regenerate the source package information since it's changed # since we updated the changelog. source_package = dpkg_parsechangelog() changes = changes_filepath(source_package) if upload: execute(uploadpackage, changes)
def refresh_patches(): git.assert_clean_repository() current_branch = git.current_branch() os_release = parse_openstack_release(current_branch) version = git_version() deb_branch = discover_debian_branch(current_branch, version, os_release) with settings(warn_only=True): local("git checkout %s -- debian" % deb_branch) more_patches = True while more_patches: rv = local("quilt push && quilt refresh") more_patches = rv.return_code == 0 local("quilt pop -a") local("git checkout %s" % deb_branch) local("git add -u") local('git commit -m "Refreshed patches"') local("git checkout %s" % current_branch) local("git clean -fdx")
def get_os_release_from_current_branch(): from hivemind_contrib.packaging import parse_openstack_release current_branch = git.current_branch() return parse_openstack_release(current_branch)