예제 #1
0
파일: bzr.py 프로젝트: decathorpe/builpy
def get_srcrev_bzr(pkgname, srcname):
    """
    builpy.bzr.get_srcrev_bzr()
    function that returns the current revision number of the source branch
    """
    goto_srcdir(pkgname, srcname)
    rev = subprocess.check_output(["bzr", "revno"]).decode().rstrip('\n\r')
    goto_basedir()

    dbg(pkgname + " repo is at revno: " + rev)
    return rev
예제 #2
0
파일: git.py 프로젝트: decathorpe/builpy
def get_srcrev_git(pkgname, srcname):
    """
    builpy.git.get_srcrev_git()
    function that returns the current commit id of the repository
    """
    goto_srcdir(pkgname, srcname)
    rev = subprocess.check_output(["git", "rev-parse", "HEAD"]).decode()
    rev = rev.rstrip('\r\n')[0:8]
    goto_basedir()

    dbg(pkgname + " repo is at commit: " + rev)
    return rev
예제 #3
0
파일: git.py 프로젝트: decathorpe/builpy
def src_update_git(pkgname, srcname):
    """
    builpy.git.src_update_git()
    function that updates the specified git repository
    """
    rev_old = get_srcrev_git(pkgname, srcname)

    goto_srcdir(pkgname, srcname)
    if DEBUG:
        subprocess.call(["git", "pull", "--rebase"])
    else:
        subprocess.call(["git", "pull", "--rebase", "--quiet"])
    goto_basedir()

    rev_new = get_srcrev_git(pkgname, srcname)

    if rev_new != rev_old:
        return rev_new
    else:
        return 0
예제 #4
0
파일: bzr.py 프로젝트: decathorpe/builpy
def src_export_bzr(pkgname, srcname, pkgvers, keep=True):
    """
    builpy.bzr.src_export_bzr()
    function that exports the specified bzr branch or lightweight checkout
    to a .tar.gz archive
    """
    rev = get_srcrev_bzr(pkgname, srcname)

    strvers = format_version_bzr(pkgvers, rev)
    strpkgv = pkgname + "-" + strvers

    filename = "../" + strpkgv + ".tar.gz"

    goto_srcdir(pkgname, srcname)
    subprocess.call(["bzr", "export", filename])
    if not keep:
        subprocess.call(["rm", "-r", srcname])
    goto_basedir()

    dbg("Export to ../" + strpkgv + ".tar.gz successful.")
예제 #5
0
파일: bzr.py 프로젝트: decathorpe/builpy
def src_update_bzr(pkgname, srcname):
    """
    builpy.bzr.src_update_bzr()
    function that updates the specified bzr branch or lightweight checkout
    """

    rev_old = get_srcrev_bzr(pkgname, srcname)

    goto_srcdir(pkgname, srcname)
    if DEBUG:
        subprocess.call(["bzr", "pull"])
    else:
        subprocess.call(["bzr", "pull", "--quiet"])
    goto_basedir()

    rev_new = get_srcrev_bzr(pkgname, srcname)

    if rev_new != rev_old:
        return rev_new
    else:
        return 0
예제 #6
0
파일: git.py 프로젝트: decathorpe/builpy
def src_export_git(pkgname, srcname, pkgvers, keep=True):
    """
    builpy.git.src_export_git()
    function that exports the specified git repository
    """
    rev = get_srcrev_git(pkgname, srcname)

    version_str = format_version_git(pkgvers, rev)
    pkgpver_str = pkgname + "-" + version_str

    prefix_str = "--prefix=" + pkgpver_str + "/"
    target_str = "../" + pkgpver_str + ".tar.gz"

    goto_srcdir(pkgname, srcname)
    ret_code = subprocess.call(["git", "archive", prefix_str, "HEAD", "--output", target_str])
    if not keep:
        subprocess.call(["rm", "-r", srcname])
    goto_basedir()

    if ret_code:
        print("ERROR: Export to " + target_str + ".tar.gz not successful.")
    else:
        dbg("Export to " + target_str + ".tar.gz successful.")