Exemple #1
0
def link_upstream_tarball(releaseType):
    #Find out the tarball link name
    upstream_name = os.path.basename( os.getcwd() )
    #paragraphs = deb822.Packages.iter_paragraphs(open('./debian/copyright', 'r'));
    #upstream_name = next(paragraphs)['Upstream-Name']
    
    changelog = Changelog()
    changelog.parse_changelog(open('./debian/changelog', 'r'))
    src_package_name = changelog.get_package()
    upstream_version = changelog.get_version().upstream_version
    #Handle packages with updated tarballs
    #e.g. 5.0.0a version instead of 5.0.0
    last_char = upstream_version[-1]
    if last_char.isalpha():
        real_upstream_version = upstream_version.rstrip(last_char)
    else:
        real_upstream_version = upstream_version
    
    link_name = '../' + src_package_name + '_' + upstream_version + '.orig.tar.xz'
    #Find out the tarball link target path
    cwd = os.path.dirname(os.path.realpath(__file__))
    config_tarball_loc = json.load(open(cwd + "/../conf/tarball-locations.json"))
    config_versions = json.load(open(cwd + "/../conf/versions.json"))
    link_target = os.path.expanduser(config_tarball_loc[releaseType]) 
    link_target += '/' + config_versions[releaseType] + '/'
    link_target += upstream_name + '-' + real_upstream_version + ".tar.xz"
    #Create the link
    try:
        os.symlink(link_target,link_name)
    except:
        pass
Exemple #2
0
 def generate_changelog_file(self):
     changelog = self.debian_file('changelog')
     if os.path.isfile(changelog):
         changes = Changelog(file=open(changelog, 'r'))
         deb_version = changes.get_version()
         deb_version.debian_revision = str(
             int(deb_version.debian_revision) + 1)
         change = 'Rebuild with newer debler'
     else:
         changes = Changelog()
         deb_version = '.'.join([str(v) for v in self.app.version]) + '-1'
         change = 'Build with debler'
     changes.new_block(
         package=self.deb_name,
         version=deb_version,
         distributions=config.distribution,
         urgency='low',
         author=config.maintainer,
         date=datetime.now(
             tz=tzlocal()).strftime('%a, %d %b %Y %H:%M:%S %z'))
     self.deb_version = deb_version
     changes.add_change('\n  * ' + change + '\n')
     with open(changelog, 'w') as f:
         changes.write_to_open_file(f)
Exemple #3
0
import sys

import reprepro_bundle
import reprepro_bundle_compose
import reprepro_bundle_appserver
import re

from distutils.core import setup

from debian.changelog import Changelog

with open('debian/changelog', 'rb') as reader:
    chlog = Changelog(reader, max_blocks=1)
version = chlog.get_version().full_version

long_description = re.sub(' +', ' ', reprepro_bundle.__doc__.strip())
long_description = re.sub('\n ', '\n', long_description)

description = '''Python3 API and command line tools to manage delivery bundles and delivery workflows in form of apt-repositories created by reprepro'''

settings = dict(name='reprepro-bundle-tools',
                version=version,
                packages=[
                    'reprepro_bundle', 'reprepro_bundle_compose',
                    'reprepro_bundle_appserver', 'reprepro_management_service'
                ],
                author='Christoph Lutz',
                author_email='*****@*****.**',
                description=description,
                long_description=long_description,
                license='EUPL 1.0+',
Exemple #4
0
    def _add_changelog(self, package, baseline_date, replacements):
        # TODO: evaluate baseline by package
        package_changelog_path = None
        package_name = self._get_package_value('package', package)
        if os.path.isfile(
                os.path.join(self.raw_input, package_name,
                             'changelog.Debian.gz')):
            package_changelog_path = os.path.join(self.raw_input, package_name,
                                                  'changelog.Debian.gz')
        elif os.path.isfile(
                os.path.join(self.raw_input, package_name, 'changelog.gz')):
            package_changelog_path = os.path.join(self.raw_input, package_name,
                                                  'changelog.gz')
        else:
            logging.warning(
                "No changelog found for package '{}'.".format(package_name))

        if package_changelog_path:
            with gzip.open(package_changelog_path) as fh:
                try:
                    changelog = Changelog(fh)
                except UnicodeDecodeError as e:
                    raise FatalError(
                        "Failed to parse changelog of {}:\n{}".format(
                            package_name, str(e)))

                if not changelog.package or not changelog.date or not changelog.author:
                    logging.warning(
                        "The changelog of package '{}' is incomplete.".format(
                            package_name))
                    return

                package_dict = dict()
                package_dict['author'] = changelog.author
                package_dict['date'] = changelog.date
                package_dict['short_date'] = self._parse_date(
                    changelog.date).strftime("%d. %B %Y")
                package_dict['version'] = str(changelog.get_version())
                package_dict['package'] = changelog.package

                change_blocks = list()
                for change_block in changelog:
                    changeblock_date = self._parse_date(change_block.date)

                    if changeblock_date <= baseline_date:
                        break

                    if change_block.version <= Version(
                            self.baseline_versions.get(package_name, '0.0.0')):
                        break

                    block_dict = dict()
                    block_dict['author'] = change_block.author
                    block_dict['date'] = change_block.date
                    block_dict['short_date'] = changeblock_date.strftime(
                        "%d. %B %Y")
                    block_dict['version'] = str(change_block.version)
                    block_dict['package'] = change_block.package
                    block_dict['distributions'] = change_block.distributions
                    block_dict['urgency'] = change_block.urgency
                    changes = self._apply_replacements(change_block.changes(),
                                                       replacements)
                    block_dict['changes'] = ChangesAnnotator(
                        package_name).annotate(changes)
                    change_blocks.append(block_dict)

                package_dict['change_blocks'] = change_blocks

                package['changelog'] = package_dict
Exemple #5
0
parser.add_argument("-o", "--outdir", type=str, help="output directory")
parser.add_argument("-j", "--no_jenkinsfile", action='store_true')

args = parser.parse_args()

outdir = args.outdir
if not args.outdir:
    outdir = args.bzr.split("/")[-1]

subprocess.call(["./do_convert.sh", args.bzr, outdir])
changelog_file = outdir + "/debian/changelog"

changelog = Changelog()
changelog.parse_changelog(open(changelog_file))

l_version_ = changelog.get_version()
l_version = l_version_.__str__()

r_version = l_version.split("+")[0]

# Bump version number to make sure we are one version above
if not "." in r_version:
    if r_version.isdigit():
        n_version = str(int(r_version) + 1)
    else:
        n_version = r_version + "1"
else:
    dot_split = r_version.split(".")
    print(dot_split[-1].isdigit())
    if dot_split[-1].isdigit():
        dot_split[-1] = str(int(dot_split[-1]) + 1)