예제 #1
0
    child = subprocess.Popen(command,
                             stdin=subprocess.PIPE,
                             stdout=subprocess.PIPE,
                             stderr=subprocess.PIPE,
                             shell=True)
    child.stdin.write(passphrase + '\0')
    ret = child.wait()
    logging.getLogger('koji.plugin.sigul_sign').info(
        'sigul returned with code: %s', ret)
    if ret != 0:
        logging.getLogger('koji.plugin.sigul_sign').error(
            'sigul command failed: %s returned: %s', command,
            child.communicate())
        sys.exit(1)


def sigul_sign_rpm(rpm_name):
    # make sure the key is working
    command = "sigul --batch get-public-key %s" % gpg_key_name
    run_sigul(command)

    # run the actual sign/import command
    command = "sigul --batch sign-rpm --koji-only --store-in-koji --v3-signature %s %s" % (
        gpg_key_name, rpm_name)
    logging.getLogger('koji.plugin.sigul_sign').info(
        'running sigul command: %s', command)
    run_sigul(command)


register_callback('postTag', sigul_sign)
예제 #2
0
#
# Authors:
#       Phil Schuler <*****@*****.**>

import koji
from koji.plugin import register_callback, ignore_error
import sys
if not "/usr/share/koji-hub" in sys.path:
    sys.path.append("/usr/share/koji-hub")
import kojihub
from kojihub import RootExports
import logging
import subprocess
import time

# this should come from config file
testing_tag = 'dist-centos6-testing'


def mash_repo(cbtype, *args, **kws):
    if kws['tag']['name'] != testing_tag:
        return
    child = subprocess.Popen(
        'python /opt/foobar/mash_and_spacewalk/mash_and_spacewalk.py',
        shell=True).pid
    logging.getLogger('koji.plugin.mash').info('started mash with pid: %s',
                                               child)


register_callback('postTag', mash_repo)
예제 #3
0
                             stdout=subprocess.PIPE,
                             stderr=subprocess.PIPE,
                             shell=True)
    child.stdin.write(passphrase + '\0')
    ret = child.wait()
    logging.getLogger('koji.plugin.key_signing').info(
        'sigul returned with code: %s', ret)
    if ret != 0:
        logging.getLogger('koji.plugin.key_signing').error(
            'sigul command failed: %s returned: %s', command,
            child.communicate())
        sys.exit(1)


def key_signing_rpm(rpm_name):
    # Check to make sure the key works
    command = "sigul -c %s --batch get-public-key %s" % (sigul_config,
                                                         gpg_key_name)
    run_sigul(command)

    # Run the actual sign command
    command = ("sigul -c %s --batch sign-rpm --koji-only --store-in-koji"
               " --v3-signature %s %s" %
               (sigul_config, gpg_key_name, rpm_name))
    logging.getLogger('koji.plugin.key_signing').info(
        'running sigul command: %s', command)
    run_sigul(command)


register_callback('postTag', key_signing)
예제 #4
0
       return

    # Get the tag name from the buildroot map
    import sys
    sys.path.insert(0, '/usr/share/koji-hub')
    from kojihub import get_buildroot
    br_id = kws['brmap'].values()[0]
    br = get_buildroot(br_id)
    tag_name = br['tag_name']

    # Get the package paths set up
    from koji import pathinfo
    uploadpath = pathinfo.work()
    rpms = []
    for relpath in kws['rpms']:
        rpms.append( '%s/%s ' % (uploadpath, relpath))

    #Now parse each rpm and also log it
    for rpm in rpms:
        #Create the temp dir
        destdir = tempfile.mkdtemp(suffix='.' + str(os.getpid()), dir=None)
        try:
            parserpm(destdir, rpm, tag_name)
        except Exception, error:
            logging.getLogger('koji.plugin.darkserver').error(str(error))
        #Remove the temp dir
        removedir(destdir)


register_callback('preImport', run_dark_command)
예제 #5
0
        rpm_name = "%s.%s" % (rpm_info['nvr'],rpm_info['arch'])
        sigul_sign_rpm(rpm_name)
       	kojifunctions.writeSignedRPM(rpm_name,gpg_key_id)    

    # and tag it for testing-repo
    kojifunctions.tagBuild(testing_tag,kws['build']['id'])
    logging.getLogger('koji.plugin.sigul_sign').info('package %s was tagged to %s'%(kws['build']['name'],testing_tag))

def run_sigul(command):
    child = subprocess.Popen(command, stdin=subprocess.PIPE,
                             stdout=subprocess.PIPE,
                             stderr=subprocess.PIPE,shell=True)
    child.stdin.write(passphrase + '\0')
    ret = child.wait()
    logging.getLogger('koji.plugin.sigul_sign').info('sigul returned with code: %s',ret)
    if ret != 0:
        logging.getLogger('koji.plugin.sigul_sign').error('sigul command failed: %s returned: %s',command,child.communicate())
        sys.exit(1)

def sigul_sign_rpm(rpm_name):
    # make sure the key is working
    command = "sigul --batch get-public-key %s" % gpg_key_name
    run_sigul(command)

    # run the actual sign/import command
    command = "sigul --batch sign-rpm --koji-only --store-in-koji --v3-signature %s %s" % (gpg_key_name, rpm_name)
    logging.getLogger('koji.plugin.sigul_sign').info('running sigul command: %s',command)    
    run_sigul(command)

register_callback('postTag',sigul_sign)
예제 #6
0
# got tagged for mashing.
# Make sure that user apache can call 'python /path/to/mash_spacewalk.py'
#
# Authors:
#       Phil Schuler <*****@*****.**>

import koji
from koji.plugin import register_callback, ignore_error
import sys

if not "/usr/share/koji-hub" in sys.path:
    sys.path.append("/usr/share/koji-hub")
import kojihub
from kojihub import RootExports
import logging
import subprocess
import time

# this should come from config file
testing_tag = "dist-centos6-testing"


def mash_repo(cbtype, *args, **kws):
    if kws["tag"]["name"] != testing_tag:
        return
    child = subprocess.Popen("python /opt/foobar/mash_and_spacewalk/mash_and_spacewalk.py", shell=True).pid
    logging.getLogger("koji.plugin.mash").info("started mash with pid: %s", child)


register_callback("postTag", mash_repo)