Пример #1
0
def src_check(pkgname):
    """
    builpy.check.src_check
    function to check for package source directory
    also checks for package source dir writability
    """
    srcname = get_srcname(pkgname)
    srcdir = os.path.join(BASEDIR, pkgname, srcname)

    if not os.access(srcdir, os.W_OK):
#        raise OSError("Source directory does not exist or is inaccessible.")
        return False

    return True
Пример #2
0
def get_srcrev(pkgname):
    """
    builpy.vcs.get_srcrev()
    generic function that returns the current revision number / commit id
    """
    dbg("Checking revision number / commit id.")
    srcname = get_srcname(pkgname)
    srctype = get_srctype(pkgname)

    if srctype == "bzr":
        return get_srcrev_bzr(pkgname, srcname)
    elif srctype == "git":
        return get_srcrev_git(pkgname, srcname)
    else:
        return None
Пример #3
0
def get_source(pkgname):
    """
    builpy.vcs.get_source()
    generic function that downloads the specified sources from vcs
    """
    srctype = get_srctype(pkgname)
    srcorig = get_srcorig(pkgname)
    srcdest = get_srcname(pkgname)

    if srctype == "bzr":
        return get_source_bzr(pkgname, srcorig, srcdest)
    elif srctype == "git":
        return get_source_git(pkgname, srcorig, srcdest)
    elif srctype == "url":
        return get_source_url(pkgname, srcorig, srcdest)
    else:
        dbg("Source type is not supported.")
Пример #4
0
def src_export(pkgname):
    """
    builpy.vcs.src_export()
    function that exports the specified vcs repository to a tar.gz archive
    """
    pkgvers = get_pkgvers(pkgname)
    srcname = get_srcname(pkgname)
    srctype = get_srctype(pkgname)

    dbg("Exporting " + pkgname + "VCS sources to tarball for use in packaging.")

    if srctype == "bzr":
        src_export_bzr(pkgname, srcname, pkgvers)
    elif srctype == "git":
        src_export_git(pkgname, srcname, pkgvers)
    elif srctype == "url":
        pass
    else:
        dbg("Source type is not supported.")
Пример #5
0
def src_update(pkgname):
    """
    builpy.vcs.src_update()
    generic function that updates the specified vcs repository
    """
    srcname = get_srcname(pkgname)
    srctype = get_srctype(pkgname)

    dbg("Checking " + srcname + " " + srctype + " repo for updates.")

    if srctype == "bzr":
        return src_update_bzr(pkgname, srcname)
    elif srctype == "git":
        return src_update_git(pkgname, srcname)
    elif srctype == "url":
        return 0
    else:
        dbg("Source type is not supported.")
        return 0
Пример #6
0
def get_source_git(pkgname, orig, dest):
    """
    builpy.git.get_source_git()
    function that downloads the specified git repository (whole or shallow)
    """
    srcname = get_srcname(pkgname)
    dbg("Checking out git repository " + orig + " to directory " + dest + ".")

    quietstr = "--quiet"
    if DEBUG:
        quietstr = "--verbose"

    goto_pkgdir(pkgname)
    subprocess.call(["git", "clone", quietstr, orig, dest])
    goto_basedir()

    dbg("Checkout to " + dest + " successful.")
    rev = get_srcrev_git(pkgname, srcname)
    dbg("Revision of checkout: " + rev)

    return rev
Пример #7
0
def get_source_bzr(pkgname, orig, dest):
    """
    builpy.bzr.get_source_bzr()
    function that downloads the specified bzr branch or lightweight checkout
    """
    srcname = get_srcname(pkgname)
    dbg("Checking out bzr repository " + orig + " to directory " + dest + ".")

    quietstr = "--quiet"
    if DEBUG:
        quietstr = "--verbose"

    goto_pkgdir(pkgname)
    subprocess.call(["bzr", "branch", quietstr, orig, "./" + dest])
    goto_basedir()

    dbg("Checkout to " + dest + " successful.")
    rev = get_srcrev_bzr(pkgname, srcname)
    dbg("Revision number of checkout: " + rev)

    return rev