Beispiel #1
0
def main(args, config):
    # get the default section from the config file
    dsection = config._sections['halo']

    if sane(config):
        # Get API key, set in config structure
        dsection["auth_token"] = api.get_auth_token(*[
            dsection[x] for x in ("api_host", "api_key", "api_secret",
                                  "proxy_host", "proxy_port")
        ])
        # Get the policy stuff
        infobundle = fn.get_all_policies(*[
            dsection[x]
            for x in ("api_host", "auth_token", "proxy_host", "proxy_port")
        ])

        fn.get_specific(
            dsection["api_host"],
            dsection["auth_token"],
            dsection["repo_base_path"] or ".",
            infobundle,
            dsection["proxy_host"],
            dsection["proxy_port"],
        )

        # Write files to disk, return bool
        if fn.localcommit(dsection["repo_base_path"]):
            print("Updated files written to disk.")
            print(
                fn.remotepush(dsection["repo_base_path"] or ".",
                              dsection["repo_commit_comment"]))
        else:
            sys.exit("Error message: Failure to write locally!")
def main(args, config):
    # get the default section from the config file
    dsection = config._sections['halo']

    if sane(config):
        # Get API key, set in config structure
        dsection["auth_token"] = api.get_auth_token(
            *[dsection[x] for x in
             ("api_host", "api_key", "api_secret",
              "proxy_host", "proxy_port")])
        # Get the policy stuff
        infobundle = fn.get_all_policies(
            *[dsection[x] for x in
             ("api_host", "auth_token",
              "proxy_host", "proxy_port")])

        fn.get_specific(
            dsection["api_host"],
            dsection["auth_token"],
            dsection["repo_base_path"] or ".",
            infobundle,
            dsection["proxy_host"],
            dsection["proxy_port"],
            )

        # Write files to disk, return bool
        if fn.localcommit(dsection["repo_base_path"]):
            print("Updated files written to disk.")
            print(fn.remotepush(
                dsection["repo_base_path"] or ".",
                dsection["repo_commit_comment"]))
        else:
            sys.exit("Error message: Failure to write locally!")
Beispiel #3
0
def main():
    if len(sys.argv) < 2:
        print "Not enough arguments"
        return 1

    fpath = sys.argv[1]
    if not os.path.exists(fpath):
        print "%s does not exist.." % fpath
        return 1
    if not fpath.endswith("package.yml"):
        print "Unnecessarily anal warning: File is not named package.yml"

    if not sane(fpath):  # then y made for linoox
        return 1

    comp = os.path.join(os.path.dirname(os.path.abspath(fpath)), "..",
                        "component.xml")
    if os.path.exists(comp):
        packageit.component = load_component(comp)
    else:
        comp = os.path.join(os.path.dirname(os.path.abspath(fpath)), "..",
                            "..", "component.xml")
        if os.path.exists(comp):
            packageit.component = load_component(comp)

    pspec = build.BuildPrefix + "/%s.xml" % sanity.name
    actions = build.BuildPrefix + "/actions.py"

    build.BuildDir += "/%s" % sanity.name
    build.InstallDir += "/%s" % sanity.name

    insList = list()
    if sanity.buildDeps:
        for dep in sanity.buildDeps:
            if not sanity._idb.has_package(dep) and dep not in insList:
                insList.append(dep)
    if len(insList) > 0:
        cmd = "eopkg install %s" % (" ".join(insList))
        if not build.LeRoot:
            cmd = "sudo %s" % cmd
        if "--force" in sys.argv:
            cmd += " -y"
        print "\nInstalling build dependencies...."
        ret = subprocess.call(shlex.split(cmd))
        if ret != 0:
            return ret

    build.cleanup()
    sources = sanity.get_sources()
    tars = build.fetch_source(sources)
    if sanity.pkg_extract:
        build.extract(tars)
    else:
        try:
            if not os.path.exists(build.BuildDir):
                os.makedirs(build.BuildDir)
        except Exception, e:
            print "Unable to create build directory: %s" % e
            return 1
Beispiel #4
0
def main():
    if len(sys.argv) < 2:
        print "Not enough arguments"
        return 1

    fpath = sys.argv[1]
    if not os.path.exists(fpath):
        print "%s does not exist.." % fpath
        return 1
    if not fpath.endswith("package.yml"):
        print "Unnecessarily anal warning: File is not named package.yml"

    if not sane(fpath, True): # then y made for linoox
        return 1

    comp = os.path.join(os.path.dirname(os.path.abspath(fpath)), "..", "component.xml")
    if os.path.exists(comp):
        packageit.component = load_component(comp)
    else:
        comp = os.path.join(os.path.dirname(os.path.abspath(fpath)), "..", "..", "component.xml")
        if os.path.exists(comp):
            packageit.component = load_component(comp)


    pspec = build.BuildPrefix + "/%s.xml" % sanity.name
    actions = build.BuildPrefix + "/actions.py"

    build.BuildDir += "/%s" % sanity.name
    build.InstallDir += "/%s" % sanity.name

    insList = list()
    if sanity.buildDeps:
        for dep in sanity.buildDeps:
            if not sanity._idb.has_package(dep) and dep not in insList:
                insList.append(dep)
    if len(insList) > 0:
        cmd = "eopkg install %s" % (" ".join(insList))
        if not build.LeRoot:
            cmd = "sudo %s" % cmd
        if "--force" in sys.argv:
            cmd += " -y"
        print "\nInstalling build dependencies...."
        ret = subprocess.call(shlex.split(cmd))
        if ret != 0:
            return ret

    build.cleanup()
    sources = sanity.get_sources()
    tars = build.fetch_source(sources)
    if sanity.pkg_extract:
        build.extract(tars)
    else:
        try:
            if not os.path.exists(build.BuildDir):
                os.makedirs(build.BuildDir)
        except Exception, e:
            print "Unable to create build directory: %s" % e
            return 1
Beispiel #5
0
        print msg
    else:
        print "Usage: %s" % sys.argv[0]
    sys.exit(ex)

if __name__ == "__main__":
    if len(sys.argv) != 3:
        usage()

    ymlfile = "package.yml"
    if not os.path.exists(ymlfile):
        usage("Specified file does not exist")
    if not ymlfile.endswith(".yml"):
        usage("%s does not look like a valid package.yml file")

    if not sanity.sane(ymlfile):
        print "File does not appear to be valid, aborting"
        sys.exit(1)

    newversion = sys.argv[1]
    url = sys.argv[2]
    file = url.split("/")[-1]

    try:
        r = os.system("wget \"%s\"" % url)
    except:
        print "Failed to download file"
        sys.exit(1)
    if r != 0:
        print "Failed to download file"
        sys.exit(1)
Beispiel #6
0
        print msg
    else:
        print "Usage: %s" % sys.argv[0]
    sys.exit(ex)

if __name__ == "__main__":
    if len(sys.argv) != 3:
        usage()

    ymlfile = "package.yml"
    if not os.path.exists(ymlfile):
        usage("Specified file does not exist")
    if not ymlfile.endswith(".yml"):
        usage("%s does not look like a valid package.yml file")

    if not sanity.sane(ymlfile, checkall=False):
        print "File does not appear to be valid, aborting"
        sys.exit(1)

    newversion = sys.argv[1]
    try:
        d = pisi.version.Version(newversion)
    except Exception, e:
        print("Problematic version string: %s" % e)
        sys.exit(1)

    url = sys.argv[2]
    file = url.split("/")[-1]

    try:
        r = os.system("wget \"%s\"" % url)
Beispiel #7
0
    else:
        print "Usage: %s" % sys.argv[0]
    sys.exit(ex)


if __name__ == "__main__":
    if len(sys.argv) != 3:
        usage()

    ymlfile = "package.yml"
    if not os.path.exists(ymlfile):
        usage("Specified file does not exist")
    if not ymlfile.endswith(".yml"):
        usage("%s does not look like a valid package.yml file")

    if not sanity.sane(ymlfile):
        print "File does not appear to be valid, aborting"
        sys.exit(1)

    newversion = sys.argv[1]
    url = sys.argv[2]
    file = url.split("/")[-1]

    try:
        r = os.system("wget \"%s\"" % url)
    except:
        print "Failed to download file"
        sys.exit(1)
    if r != 0:
        print "Failed to download file"
        sys.exit(1)