def package_update(package, refresh=False): """ builpy.action.package_update() This function is executed if the "update" sub-command is supplied to builpy. """ pkg_check(package) if refresh: print("Refreshing sources is not yet implemented.") src_export(package) if not src_check(package): update = get_source(package) if get_srctype(package) != "url": spec_update(package) src_export(package) else: update = src_update(package) if update: spec_update(package) spec_bump(package, "Update to new upstream snapshot.") src_export(package) return update
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
def format_version(pkgname, ver, rev): """ builpy.vcs.format_version() generic function that returns the package version in a standard format """ srctype = get_srctype(pkgname) if srctype == "bzr": return format_version_bzr(ver, rev) elif srctype == "git": return format_version_git(ver, rev) elif srctype == "url": return format_version_url(ver) else: dbg("Source type is not supported.")
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.")
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.")
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