def _commit(package, resource, message):
    log.info("Commit resource")
    deploymentpackage = DeploymentPackage(config, package)
    try:
        deploymentpackage.commit(resource, message)
    except DeploymentError, e:
        log.error("Committing failed: %s" % e)
        return
def _commit(package, resource, message):
    log.info("Commit resource")
    deploymentpackage = DeploymentPackage(config, package)
    try:
        deploymentpackage.commit(resource, message)
    except DeploymentError, e:
        log.error("Committing failed: %s" % e)
        return
def exportliveversion(args):
    log.info("Export live version")
    deploymentpackage = DeploymentPackage(config, args.package[0])
    deploymentpackage.check_env(config.env)
    try:
        deploymentpackage.export_version()
    except DeploymentError, e:
        log.error("Exporting failed: %s" % e)
        return
def release(cargs):
    log.info("Release package")
    deploymentpackage = DeploymentPackage(config, cargs.package[0])
    deploymentpackage.check_env(config.env)
    try:
        deploymentpackage.release()
    except DeploymentError, e:
        log.error("Releasing failed: %s" % e)
        return
def tag(args):
    log.info("Tag package")
    deploymentpackage = DeploymentPackage(config, args.package[0])
    deploymentpackage.check_env(config.env)
    try:
        deploymentpackage.tag()
    except DeploymentError, e:
        log.error("Tagging failed: %s" % e)
        return
def merge(cargs):
    log.info("Merge resource to RC")
    deploymentpackage = DeploymentPackage(config, cargs.package[0])
    resource = None
    if cargs.resource:
        resource = cargs.resource[0]
    try:
        deploymentpackage.merge(resource)
    except DeploymentError, e:
        log.error("Merging failed: %s" % e)
        return
def merge(cargs):
    log.info("Merge resource to RC")
    deploymentpackage = DeploymentPackage(config, cargs.package[0])
    resource = None
    if cargs.resource:
        resource = cargs.resource[0]
    try:
        deploymentpackage.merge(resource)
    except DeploymentError, e:
        log.error("Merging failed: %s" % e)
        return
def _creatercbranch(all, packages):
    if all:
        packages = config.as_dict('packages').keys()
    for package in packages:
        deploymentpackage = DeploymentPackage(config, package)
        deploymentpackage.check_env("rc")
        try:
            deploymentpackage.creatercbranch()
        except DeploymentError, e:
            log.error("Creating RC branch failed: %s" % e)
            continue
        except Exception, e:
            log.error("An error occured: %s" % e)
def _exportrcsource(_all, packages):
    if _all:
        packages = config.as_dict('packages').keys()
    log.info("Export rc source")
    for package in packages:
        #XXX check env of package match
        deploymentpackage = DeploymentPackage(config, package)
        try:
            deploymentpackage.export_rc()
        except DeploymentError, e:
            log.error("Exporting failed: %s" % e)
            continue
        except Exception, e:
            log.error("An error occured: %s" % e)
def _exportrcsource(_all, packages):
    if _all:
        packages = config.as_dict('packages').keys()
    log.info("Export rc source")
    for package in packages:
        #XXX check env of package match
        deploymentpackage = DeploymentPackage(config, package)
        try:
            deploymentpackage.export_rc()
        except DeploymentError, e:
            log.error("Exporting failed: %s" % e)
            continue
        except Exception, e:
            log.error("An error occured: %s" % e)
def info(args):
    packages = sorted(config.as_dict('packages').keys())
    maxlen = max([len(_) for _ in packages])

    def fill(msg, ml=maxlen):
        return "%s%s" % (msg, ' ' * (ml - len(msg)))

    cols = ("%s " * 5)
    log.info(cols % (maxlen * '-', 10 * '-', 10 * '-', 10 * '-', 10 * '-'))
    log.info(cols % (
        fill('package'),
        fill('repo (%s)' % config.env, 10),
        fill('live', 10),
        fill('rc-branch', 10),
        fill('location', 10),
    ))
    log.info(cols % (maxlen * '-', 10 * '-', 10 * '-', 10 * '-', 10 * '-'))
    for package in sorted(config.as_dict('packages').keys(), key=str.lower):
        dp = DeploymentPackage(config, package)
        p_env = dp.package_options['env']
        rc = dp.rc_source and 'yes' or (p_env == 'rc' and p_env or '---')
        log.info(cols % (
            fill(package),
            fill(dp.version, 10),
            fill(dp.live_version or 'not set', 10),
            fill(rc, 10),
            fill(config.package(package), 10),
        ))
    log.info(cols % (maxlen * '-', 10 * '-', 10 * '-', 10 * '-', 10 * '-'))
Beispiel #12
0
def _set_version(package, version):
    log.info("Set version for package")
    deploymentpackage = DeploymentPackage(config, package)
    path = os.path.join(config.sources_dir, package, 'setup.py')
    if not os.path.exists(path):
        log.error("Invalid package name %s" % package)
    pv = PackageVersion(path)
    pv.version = version
def fullrelease(args):
    """deploy to release on package index

    ./bin/deploy release [packagename]

    - tag version
    - export live version
    - release to package index server
    - commit live versions
    """
    package = args.package[0]
    deploymentpackage = DeploymentPackage(config, package)
    deploymentpackage.check_env(config.env)
    log.info("Complete deployment of final package %s" % package)
    try:
        deploymentpackage.tag()
    except DeploymentError, e:
        log.error("Tagging failed: %s" % e)
        return
def exportliveversion(args):
    log.info("Export live version")
    deploymentpackage = DeploymentPackage(config, args.package[0])
    deploymentpackage.check_env(config.env)
    try:
        deploymentpackage.export_version()
    except DeploymentError, e:
        log.error("Exporting failed: %s" % e)
        return
def release(cargs):
    log.info("Release package")
    deploymentpackage = DeploymentPackage(config, cargs.package[0])
    deploymentpackage.check_env(config.env)
    try:
        deploymentpackage.release()
    except DeploymentError, e:
        log.error("Releasing failed: %s" % e)
        return
def tag(args):
    log.info("Tag package")
    deploymentpackage = DeploymentPackage(config, args.package[0])
    deploymentpackage.check_env(config.env)
    try:
        deploymentpackage.tag()
    except DeploymentError, e:
        log.error("Tagging failed: %s" % e)
        return
def _creatercbranch(all, packages):
    if all:
        packages = config.as_dict('packages').keys()
    for package in packages:
        deploymentpackage = DeploymentPackage(config, package)
        deploymentpackage.check_env("rc")
        try:
            deploymentpackage.creatercbranch()
        except DeploymentError, e:
            log.error("Creating RC branch failed: %s" % e)
            continue
        except Exception, e:
            log.error("An error occured: %s" % e)
def fullrelease(args):
    """deploy to release on package index

    ./bin/deploy release [packagename]

    - tag version
    - export live version
    - release to package index server
    - commit live versions
    """
    package = args.package[0]
    deploymentpackage = DeploymentPackage(config, package)
    deploymentpackage.check_env(config.env)
    log.info("Complete deployment of final package %s" % package)
    try:
        deploymentpackage.tag()
    except DeploymentError, e:
        log.error("Tagging failed: %s" % e)
        return
def _show_version(package):
    deploymentpackage = DeploymentPackage(config, package)
    log.info("Version: %s = %s" % (package, deploymentpackage.version))
def candidate(args):
    """deploy to release candidate

    ./bin/deploy candidate PACKAGENAME VERSIONNUMBER

    - set version
    - commit setup.py
    - create rc branch if not exist
    - export rc sources
    - commit rc sources
    """
    package, newversion = args.package[0], args.version[0]
    deploymentpackage = DeploymentPackage(config, package)
    deploymentpackage.check_env("rc")
    log.info("Complete deployment of release candidate %s with version %s" %
             (package, newversion))
    try:
        changed = _set_version(package, newversion)
        if not changed:
            log.warn(
                "Version {0} was already set, version change skipped.".format(
                    newversion))
        else:
            deploymentpackage.commit('setup.py', 'Version Change')
        deploymentpackage.creatercbranch()
        deploymentpackage.export_rc()
        deploymentpackage.commit_rc_source()
    except DeploymentError, e:
        log.error("Candidate deployment failed: %s" % e)
def candidate(args):
    """deploy to release candidate

    ./bin/deploy candidate PACKAGENAME VERSIONNUMBER

    - set version
    - commit setup.py
    - create rc branch if not exist
    - export rc sources
    - commit rc sources
    """
    package, newversion = args.package[0], args.version[0]
    deploymentpackage = DeploymentPackage(config, package)
    deploymentpackage.check_env("rc")
    log.info("Complete deployment of release candidate %s with version %s" %
             (package, newversion))
    try:
        changed = _set_version(package, newversion)
        if not changed:
            log.warn(
                "Version {0} was already set, version change skipped.".format(
                    newversion
                )
            )
        else:
            deploymentpackage.commit('setup.py', 'Version Change')
        deploymentpackage.creatercbranch()
        deploymentpackage.export_rc()
        deploymentpackage.commit_rc_source()
    except DeploymentError, e:
        log.error("Candidate deployment failed: %s" % e)