示例#1
0
def expand_group(group):
    name, rev = layout.split_url_revision(group)
    distro = None
    if "/" in name:
        distro, name = name.rsplit("/", 1)
    found = config.get("submit-groups", name)
    packages = [group]
    if found:
        packages = found.split()
        if rev:
            packages = [("%s@%s" % (package, rev)) for package in packages]
        if distro:
            packages = ["%s/%s" % (distro, package) for package in packages]
    return packages
示例#2
0
def expand_group(group):
    name, rev = layout.split_url_revision(group)
    distro = None
    if "/" in name:
        distro, name = name.rsplit("/", 1)
    found = config.get("submit-groups", name)
    packages = [group]
    if found:
        packages = found.split()
        if rev:
            packages = [("%s@%s" % (package, rev))
                    for package in packages]
        if distro:
            packages = ["%s/%s" % (distro, package)
                    for package in packages]
    return packages
示例#3
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)
示例#4
0
文件: submit.py 项目: bhdn/repsys
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)
示例#5
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)
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)