Exemplo n.º 1
0
def list_targets(option, opt, val, parser):
    host = config.get("submit", "host")
    if host is None:
        raise Error, "no submit host defined in repsys.conf"
    createsrpm = get_helper("create-srpm")
    #TODO make it configurable
    command = "ssh %s %s --list" % (host, createsrpm)
    execcmd(command, show=True)
    sys.exit(0)
Exemplo n.º 2
0
def list_targets(option, opt, val, parser):
    host = config.get("submit", "host")
    if host is None:
        raise Error("no submit host defined in repsys.conf")
    createsrpm = get_helper("create-srpm")
    #TODO make it configurable
    args = ["ssh", host, createsrpm, "--list"]
    execcmd(args, show=true)
    sys.exit(0)  # it is invoked via optparse callback, thus we need to
Exemplo n.º 3
0
def list_targets(option, opt, val, parser):
    host = config.get("submit", "host")
    if host is None:
        raise Error, "no submit host defined in repsys.conf"
    createsrpm = get_helper("create-srpm")
    #TODO make it configurable
    command = "ssh %s %s --list" % (host, createsrpm)
    execcmd(command, show=True)
    sys.exit(0)
Exemplo n.º 4
0
def list_targets(option, opt, val, parser):
    host = config.get("submit", "host")
    if host is None:
        raise Error, "no submit host defined in repsys.conf"
    createsrpm = get_helper("create-srpm")
    #TODO make it configurable
    args = ["ssh", host, createsrpm, "--list"]
    execcmd(args, show=True)
    sys.exit(0) # it is invoked via optparse callback, thus we need to
Exemplo n.º 5
0
def submit(urls,
           target,
           define=[],
           submithost=None,
           port=None,
           atonce=False,
           debug=False,
           keeplog=False):
    if submithost is None:
        submithost = config.get("submit", "host")
        if submithost is None:
            raise Error, "no submit host defined in configuration"
    if port is None:
        port = config.getint("submit", "port", "22")

    # runs a create-srpm in the server through ssh, which will make a
    # copy of the rpm in the export directory
    createsrpm = get_helper("create-srpm")
    baseargs = ["ssh", "-p", str(port), submithost, createsrpm, "-t", target]
    if debug:
        baseargs.append("--debug")
    if keeplog:
        baseargs.append("--keeplog")
    for entry in reversed(define):
        baseargs.append("--define")
        baseargs.append(entry)
    cmdsargs = []
    if len(urls) == 1:
        # be compatible with server-side repsys versions older than 1.6.90
        url, rev = layout.split_url_revision(urls[0])
        baseargs.append("-r")
        baseargs.append(str(rev))
        baseargs.append(url)
        cmdsargs.append(baseargs)
    elif atonce:
        cmdsargs.append(baseargs + urls)
    else:
        cmdsargs.extend((baseargs + [url]) for url in urls)
    for cmdargs in cmdsargs:
        status, output = execcmd(cmdargs, noerror=1)
        if status == 0:
            print "Package submitted!"
        else:
            sys.stderr.write(output)
            sys.stderr.write("\n")
            sys.exit(status)
Exemplo n.º 6
0
def upload_binary(topdir, filename):
    filepath = os.path.join(topdir, 'SOURCES', filename)
    if not os.path.exists(filepath):
        raise Error("'%s' was not found" % filepath)
    sha1sum = file_hash(filepath)
    if binary_exists(sha1sum):
        return
    host = config.get("binrepo", "upload_host")
    upload_bin_helper = get_helper("upload-bin")
    command = ["ssh", host, upload_bin_helper, filename]
    try:
        filein = open(filepath, 'r')
    except Error as e:
        raise Error("Could not open file %s\n" % filepath)
    status, output = execcmd(*command,
                             show=True,
                             collecterr=True,
                             stdin=filein)
Exemplo n.º 7
0
def submit(urls, target, define=[], submithost=None, port=None,
        atonce=False, debug=False, keeplog=False):
    if submithost is None:
        submithost = config.get("submit", "host")
        if submithost is None:
            raise Error, "no submit host defined in configuration"
    if port is None:
        port = config.getint("submit", "port", "22")

    # runs a create-srpm in the server through ssh, which will make a
    # copy of the rpm in the export directory
    createsrpm = get_helper("create-srpm")
    baseargs = ["ssh", "-p", str(port), submithost, createsrpm,
            "-t", target]
    if debug:
        baseargs.append("--debug")
    if keeplog:
        baseargs.append("--keeplog")
    for entry in reversed(define):
        baseargs.append("--define")
        baseargs.append(entry)
    cmdsargs = []
    if len(urls) == 1:
        # be compatible with server-side repsys versions older than 1.6.90
        url, rev = layout.split_url_revision(urls[0])
        baseargs.append("-r")
        baseargs.append(str(rev))
        baseargs.append(url)
        cmdsargs.append(baseargs)
    elif atonce:
        cmdsargs.append(baseargs + urls)
    else:
        cmdsargs.extend((baseargs + [url]) for url in urls)
    for cmdargs in cmdsargs:
        status, output = execcmd(cmdargs, noerror=1)
        if status == 0:
            print "Package submitted!"
        else:
            sys.stderr.write(output)
            sys.stderr.write("\n")
            sys.exit(status)
Exemplo n.º 8
0
def submit(urls, target, define=[], submithost=None, atonce=False, sid=None):
    if submithost is None:
        submithost = config.get("submit", "host")
        if submithost is None:
            # extract the submit host from the svn host
            type, rest = urllib.splittype(pkgdirurl)
            host, path = urllib.splithost(rest)
            user, host = urllib.splituser(host)
            submithost, port = urllib.splitport(host)
            del type, user, port, path, rest
    # runs a create-srpm in the server through ssh, which will make a
    # copy of the rpm in the export directory
    createsrpm = get_helper("create-srpm")
    baseargs = ["ssh", submithost, createsrpm, "-t", target]
    if not sid:
        sid = uuid.uuid4()
    define.append("sid=%s" % sid)
    for entry in reversed(define):
        baseargs.append("--define")
        baseargs.append(entry)
    cmdsargs = []
    if len(urls) == 1:
        # be compatible with server-side repsys versions older than 1.6.90
        url, rev = layout.split_url_revision(urls[0])
        baseargs.append("-r")
        baseargs.append(str(rev))
        baseargs.append(url)
        cmdsargs.append(baseargs)
    elif atonce:
        cmdsargs.append(baseargs + urls)
    else:
        cmdsargs.extend((baseargs + [url]) for url in urls)
    for cmdargs in cmdsargs:
        command = subprocess.list2cmdline(cmdargs)
        status, output = execcmd(command)
        if status == 0:
            print "Package submitted!"
        else:
            sys.stderr.write(output)
            sys.exit(status)
Exemplo n.º 9
0
def submit(urls, target, define=[], submithost=None, atonce=False, sid=None):
    if submithost is None:
        submithost = config.get("submit", "host")
        if submithost is None:
            # extract the submit host from the svn host
            type, rest = urllib.splittype(pkgdirurl)
            host, path = urllib.splithost(rest)
            user, host = urllib.splituser(host)
            submithost, port = urllib.splitport(host)
            del type, user, port, path, rest
    # runs a create-srpm in the server through ssh, which will make a
    # copy of the rpm in the export directory
    createsrpm = get_helper("create-srpm")
    baseargs = ["ssh", submithost, createsrpm, "-t", target]
    if not sid:
        sid = uuid.uuid4()
    define.append("sid=%s" % sid)
    for entry in reversed(define):
        baseargs.append("--define")
        baseargs.append(entry)
    cmdsargs = []
    if len(urls) == 1:
        # be compatible with server-side repsys versions older than 1.6.90
        url, rev = layout.split_url_revision(urls[0])
        baseargs.append("-r")
        baseargs.append(str(rev))
        baseargs.append(url)
        cmdsargs.append(baseargs)
    elif atonce:
        cmdsargs.append(baseargs + urls)
    else:
        cmdsargs.extend((baseargs + [url]) for url in urls)
    for cmdargs in cmdsargs:
        command = subprocess.list2cmdline(cmdargs)
        status, output = execcmd(command)
        if status == 0:
            print "Package submitted!"
        else:
            sys.stderr.write(output)
            sys.exit(status)
Exemplo n.º 10
0
def maintdb(maintdb_args):
    host = config.get("maintdb", "host", "maintdb.mageia.org")
    maintdb_helper = get_helper("maintdb")
    command = ["ssh", host, maintdb_helper] + maintdb_args
    execcmd(command, show=True)
    sys.exit(0)