diff options
author | Stefan Schmidt <stefan@datenfreihafen.org> | 2009-10-26 15:50:07 +0100 |
---|---|---|
committer | Stefan Schmidt <stefan@datenfreihafen.org> | 2009-10-26 15:50:07 +0100 |
commit | 247688aaac7b4f57740a327ebd6c33660642fa98 (patch) | |
tree | 83120eb26b1285db62fef3c5421f523ff38f7afd /classes | |
parent | 77cfe0930b039016848f590ebf736442c03a9975 (diff) | |
parent | 66c4fef12cbe7f2a453748b8b025b2597a13e0c7 (diff) |
Merge branch 'org.openembedded.dev' of git.openembedded.org:openembedded into org.openembedded.dev
Diffstat (limited to 'classes')
-rw-r--r-- | classes/gitver.bbclass | 32 | ||||
-rw-r--r-- | classes/update-rc.d.bbclass | 14 |
2 files changed, 33 insertions, 13 deletions
diff --git a/classes/gitver.bbclass b/classes/gitver.bbclass index 92c053ae24..5b4ba8d1e1 100644 --- a/classes/gitver.bbclass +++ b/classes/gitver.bbclass @@ -8,20 +8,14 @@ GITVER = "${@get_git_pv('${S}', d)}" -def gitver_mark_dependency(d): - from bb.data import expand - from bb.parse import mark_dependency - from os.path import abspath - - fn = abspath(expand("${S}/.git/HEAD", d)) - mark_dependency(d, fn) - def get_git_pv(path, d, tagadjust=None): from subprocess import Popen, PIPE - from os.path import join + import os from bb import error + from bb.parse import mark_dependency - env = {"GIT_DIR": join(d.getVar("S", True), ".git")} + gitdir = os.path.abspath(os.path.join(d.getVar("S", True), ".git")) + env = { "GIT_DIR": gitdir } def popen(cmd, **kwargs): kwargs["stderr"] = PIPE @@ -39,7 +33,23 @@ def get_git_pv(path, d, tagadjust=None): return return stdout.rstrip() - gitver_mark_dependency(d) + # Force the recipe to be reparsed so the version gets bumped + # if the active branch is switched, or if the branch changes. + mark_dependency(d, os.path.join(gitdir, "HEAD")) + + ref = popen(["git", "symbolic-ref", "HEAD"]) + reffile = os.path.join(gitdir, ref) + if ref and os.path.exists(reffile): + mark_dependency(d, reffile) + else: + # The ref might be hidden in packed-refs. Force a reparse if anything + # in the working copy changes. + mark_dependency(d, os.path.join(gitdir, "index")) + + # Catch new tags. + tagdir = os.path.join(gitdir, "refs", "tags") + if os.path.exists(tagdir): + mark_dependency(d, tagdir) ver = popen(["git", "describe", "--tags"], cwd=path) if not ver: diff --git a/classes/update-rc.d.bbclass b/classes/update-rc.d.bbclass index 91af859392..00ec37cfb8 100644 --- a/classes/update-rc.d.bbclass +++ b/classes/update-rc.d.bbclass @@ -16,17 +16,27 @@ update-rc.d $OPT ${INITSCRIPT_NAME} ${INITSCRIPT_PARAMS} updatercd_prerm() { if test "x$D" = "x"; then - ${INIT_D_DIR}/${INITSCRIPT_NAME} stop + if test "$1" = "upgrade" -o "$1" = "remove"; then + ${INIT_D_DIR}/${INITSCRIPT_NAME} stop + fi fi } +# Note: to be Debian compliant, we should only invoke update-rc.d remove +# at the "purge" step, but opkg does not support it. So instead we also +# run it at the "remove" step if the init script no longer exists. + updatercd_postrm() { if test "x$D" != "x"; then OPT="-r $D" else OPT="" fi -update-rc.d $OPT ${INITSCRIPT_NAME} remove +if test "$1" = "remove" -o "$1" = "purge"; then + if ! test -e "${INIT_D_DIR}/${INITSCRIPT_NAME}"; then + update-rc.d $OPT ${INITSCRIPT_NAME} remove + fi +fi } |