diff options
| author | Stefan Schmidt <stefan@datenfreihafen.org> | 2009-07-31 01:41:16 +0200 |
|---|---|---|
| committer | Stefan Schmidt <stefan@datenfreihafen.org> | 2009-07-31 01:41:16 +0200 |
| commit | 87e71a8da123ca7af82ad467fa8038b9a157c2b2 (patch) | |
| tree | 89ecc0e884e592ab6570d865541511ce1fdb611b /classes | |
| parent | 48a208b2ad3fc088dffd3af0b5bfc424eadf932f (diff) | |
| parent | b73732a25fc76df6934479fd3ece5888c5888dcd (diff) | |
Merge branch 'org.openembedded.dev' of git@git.openembedded.org:openembedded into org.openembedded.dev
Diffstat (limited to 'classes')
| -rw-r--r-- | classes/angstrom.bbclass | 19 | ||||
| -rw-r--r-- | classes/base.bbclass | 4 | ||||
| -rw-r--r-- | classes/image.bbclass | 3 | ||||
| -rw-r--r-- | classes/oestats-client.bbclass | 33 | ||||
| -rw-r--r-- | classes/package.bbclass | 2 | ||||
| -rw-r--r-- | classes/package_deb.bbclass | 2 | ||||
| -rw-r--r-- | classes/package_ipk.bbclass | 2 | ||||
| -rw-r--r-- | classes/package_tar.bbclass | 2 | ||||
| -rw-r--r-- | classes/packagehistory.bbclass | 101 | ||||
| -rw-r--r-- | classes/qt4x11.bbclass | 2 |
10 files changed, 144 insertions, 26 deletions
diff --git a/classes/angstrom.bbclass b/classes/angstrom.bbclass new file mode 100644 index 0000000000..4a810a638a --- /dev/null +++ b/classes/angstrom.bbclass @@ -0,0 +1,19 @@ +# anonymous support class for angstrom +# +# Features: +# +# * blacklist handling, set ANGSTROM_BLACKLIST_pn-blah = "message" +# + +python () { + import bb + + blacklist = bb.data.getVar("ANGSTROM_BLACKLIST", d, 1) + pkgnm = bb.data.getVar("PN", d, 1) + + if blacklist: + bb.note("Angstrom DOES NOT support %s because %s" % (pkgnm, blacklist)) + raise bb.parse.SkipPackage("Angstrom DOES NOT support %s because %s" % (pkgnm, blacklist)) + +} + diff --git a/classes/base.bbclass b/classes/base.bbclass index bc50c67d4b..9c51c0a08e 100644 --- a/classes/base.bbclass +++ b/classes/base.bbclass @@ -885,7 +885,7 @@ def base_get_metadata_svn_revision(path, d): def base_get_metadata_git_branch(path, d): import os - branch = os.popen('cd %s; PATH=%s git symbolic-ref HEAD 2>/dev/null' % (path, d.getVar("BBPATH", 1))).read().rstrip() + branch = os.popen('cd %s; PATH=%s git symbolic-ref HEAD 2>/dev/null' % (path, d.getVar("PATH", 1))).read().rstrip() if len(branch) != 0: return branch.replace("refs/heads/", "") @@ -893,7 +893,7 @@ def base_get_metadata_git_branch(path, d): def base_get_metadata_git_revision(path, d): import os - rev = os.popen("cd %s; PATH=%s git show-ref HEAD 2>/dev/null" % (path, d.getVar("BBPATH", 1))).read().split(" ")[0].rstrip() + rev = os.popen("cd %s; PATH=%s git show-ref HEAD 2>/dev/null" % (path, d.getVar("PATH", 1))).read().split(" ")[0].rstrip() if len(rev) != 0: return rev return "<unknown>" diff --git a/classes/image.bbclass b/classes/image.bbclass index 864230bc91..385043bfc7 100644 --- a/classes/image.bbclass +++ b/classes/image.bbclass @@ -108,7 +108,6 @@ LINGUAS_INSTALL = "${@" ".join(map(lambda s: "locale-base-%s" % s, bb.data.getVa do_rootfs[nostamp] = "1" do_rootfs[dirs] = "${TOPDIR}" do_build[nostamp] = "1" -do_install[nostamp] = "1" # Must call real_do_rootfs() from inside here, rather than as a separate # task, so that we have a single fakeroot context for the whole process. @@ -274,5 +273,5 @@ fi # export the zap_root_password, create_etc_timestamp and remote_init_link EXPORT_FUNCTIONS zap_root_password create_etc_timestamp remove_init_link do_rootfs make_zimage_symlink_relative set_image_autologin rootfs_update_timestamp install_linguas -addtask rootfs after do_compile before do_install +addtask rootfs before do_build after do_install addtask deploy_to after do_rootfs diff --git a/classes/oestats-client.bbclass b/classes/oestats-client.bbclass index 8922496242..e4e6206ac4 100644 --- a/classes/oestats-client.bbclass +++ b/classes/oestats-client.bbclass @@ -5,8 +5,9 @@ # To make use of this class, add to your local.conf: # # INHERIT += "oestats-client" -# OESTATS_SERVER = "some.server.org" +# OESTATS_SERVER = "http://some.server.org" # OESTATS_BUILDER = "some_nickname" +# def oestats_setid(d, val): import bb @@ -19,8 +20,8 @@ def oestats_getid(d): return f.read() def oestats_send(d, server, action, vars = {}, files = {}): - import httplib import bb + import urllib2 # build body output = [] @@ -49,21 +50,17 @@ def oestats_send(d, server, action, vars = {}, files = {}): "Content-type": "multipart/form-data; boundary=%s" % bound, "Content-length": str(len(body))} - # send request - proxy = bb.data.getVar('HTTP_PROXY', d, True ) + proxy = bb.data.getVar('HTTP_PROXY', d, True ) if (proxy): - if (proxy.endswith('/')): - proxy = proxy[:-1] - if (proxy.startswith('http://')): - proxy = proxy[7:] - conn = httplib.HTTPConnection(proxy) - action = "http://%s%s" %(server, action) - else: - conn = httplib.HTTPConnection(server) - conn.request("POST", action, body, headers) - response = conn.getresponse() + phl = urllib2.ProxyHandler({'http' : proxy}) + opener = urllib2.build_opener(phl) + urllib2.install_opener(opener) + + actionURL = "%s%s" %(server, action) + req = urllib2.Request(actionURL, body, headers); + response = urllib2.urlopen(req) data = response.read() - conn.close() + return data def oestats_start(server, builder, d): @@ -111,7 +108,7 @@ def oestats_stop(server, d, failures): 'status': status, }) if status == 'Failed': - bb.note("oestats: build failed, see http://%s%s" % (server,response)) + bb.note("oestats: build failed, see %s%s" % (server, response)) except: bb.note("oestats: error stopping build") @@ -169,7 +166,7 @@ def oestats_task(server, d, task, status): try: response = oestats_send(d, server, "/tasks/", vars, files) if status == 'Failed': - bb.note("oestats: task failed, see http://%s%s" % (server, response)) + bb.note("oestats: task failed, see %s%s" % (server, response)) except: bb.note("oestats: error sending task, disabling stats") oestats_setid(d, "") @@ -184,6 +181,8 @@ python oestats_eventhandler () { return NotHandled server = bb.data.getVar('OESTATS_SERVER', e.data, True) + if not server.startswith('http://') and not server.startswith('https://'): + server = "http://%s" %(server) builder = bb.data.getVar('OESTATS_BUILDER', e.data, True) if not server or not builder: return NotHandled diff --git a/classes/package.bbclass b/classes/package.bbclass index 3360dcb2de..f6bd7c5b4a 100644 --- a/classes/package.bbclass +++ b/classes/package.bbclass @@ -539,7 +539,7 @@ python emit_pkgdata() { allow_empty = bb.data.getVar('ALLOW_EMPTY', d, 1) root = "%s/install/%s" % (workdir, pkg) os.chdir(root) - g = glob('*') + g = glob('*') + glob('.[!.]*') if g or allow_empty == "1": packagedfile = pkgdatadir + '/runtime/%s.packaged' % pkg file(packagedfile, 'w').close() diff --git a/classes/package_deb.bbclass b/classes/package_deb.bbclass index 5127d32f33..e5339a9064 100644 --- a/classes/package_deb.bbclass +++ b/classes/package_deb.bbclass @@ -130,7 +130,7 @@ python do_package_deb () { os.chdir(root) from glob import glob - g = glob('*') + g = glob('*') + glob('.[!.]*') try: del g[g.index('DEBIAN')] del g[g.index('./DEBIAN')] diff --git a/classes/package_ipk.bbclass b/classes/package_ipk.bbclass index 1f1b5c9a79..e3a7522619 100644 --- a/classes/package_ipk.bbclass +++ b/classes/package_ipk.bbclass @@ -186,7 +186,7 @@ python do_package_ipk () { bb.mkdirhier(pkgoutdir) os.chdir(root) from glob import glob - g = glob('*') + g = glob('*') + glob('.[!.]*') try: del g[g.index('CONTROL')] del g[g.index('./CONTROL')] diff --git a/classes/package_tar.bbclass b/classes/package_tar.bbclass index 76f48ca429..cb70a5fae8 100644 --- a/classes/package_tar.bbclass +++ b/classes/package_tar.bbclass @@ -84,7 +84,7 @@ python do_package_tar () { tarfn = bb.data.getVar('PKGFN', localdata, 1) os.chdir(root) from glob import glob - if not glob('*'): + if not glob('*') + glob('.[!.]*'): bb.note("Not creating empty archive for %s-%s" % (pkg, bb.data.expand('${PV}-${PR}${DISTRO_PR}', d, True))) continue ret = os.system("tar -czf %s %s" % (tarfn, '.')) diff --git a/classes/packagehistory.bbclass b/classes/packagehistory.bbclass new file mode 100644 index 0000000000..b435149d22 --- /dev/null +++ b/classes/packagehistory.bbclass @@ -0,0 +1,101 @@ +# Must inherit package first before changing PACKAGEFUNCS +inherit package +PACKAGEFUNCS += "emit_pkghistory" + +PKGHIST_DIR = "${TMPDIR}/pkghistory/${BASEPKG_TARGET_SYS}/" + +# +# Called during do_package to write out metadata about this package +# for comparision when writing future packages +# +python emit_pkghistory() { + packages = bb.data.getVar('PACKAGES', d, True) + pkghistdir = bb.data.getVar('PKGHIST_DIR', d, True) + + + # Should check PACKAGES here to see if anything removed + + def getpkgvar(pkg, var): + val = bb.data.getVar('%s_%s' % (var, pkg), d, 1) + if val: + return val + val = bb.data.getVar('%s' % (var), d, 1) + + return val + + def getlastversion(pkg): + try: + pe = os.path.basename(os.readlink(os.path.join(pkghistdir, pkg, "latest"))) + pv = os.path.basename(os.readlink(os.path.join(pkghistdir, pkg, pe, "latest"))) + pr = os.path.basename(os.readlink(os.path.join(pkghistdir, pkg, pe, pv, "latest"))) + return (pe, pv, pr) + except OSError: + return (None, None, None) + + for pkg in packages.split(): + pe = getpkgvar(pkg, 'PE') or "0" + pv = getpkgvar(pkg, 'PV') + pr = getpkgvar(pkg, 'PR') + destdir = os.path.join(pkghistdir, pkg, pe, pv, pr) + + # + # Find out what the last version was + # Make sure the version did not decrease + # + lastversion = getlastversion(pkg) + (last_pe, last_pv, last_pr) = lastversion + + if last_pe is not None: + r = bb.utils.vercmp((pe, pv, pr), lastversion) + if r < 0: + bb.fatal("Package version for package %s went backwards which would break package feeds from (%s:%s-%s to %s:%s-%s)" % (pkg, last_pe, last_pv, last_pr, pe, pv, pr)) + + write_pkghistory(pkg, pe, pv, pr, d) + + if last_pe is not None: + check_pkghistory(pkg, pe, pv, pr, lastversion) + + write_latestlink(pkg, pe, pv, pr, d) +} + + +def check_pkghistory(pkg, pe, pv, pr, lastversion): + import bb + + (last_pe, last_pv, last_pr) = lastversion + + bb.debug(2, "Checking package history") + # RDEPENDS removed? + # PKG changed? + # Each file list of each package for file removals? + + +def write_pkghistory(pkg, pe, pv, pr, d): + import bb, os + bb.debug(2, "Writing package history") + + pkghistdir = bb.data.getVar('PKGHIST_DIR', d, True) + + verpath = os.path.join(pkghistdir, pkg, pe, pv, pr) + if not os.path.exists(verpath): + os.makedirs(verpath) + +def write_latestlink(pkg, pe, pv, pr, d): + import bb, os + + pkghistdir = bb.data.getVar('PKGHIST_DIR', d, True) + + def rm_link(path): + try: + os.unlink(path) + except OSError: + return + + rm_link(os.path.join(pkghistdir, pkg, "latest")) + rm_link(os.path.join(pkghistdir, pkg, pe, "latest")) + rm_link(os.path.join(pkghistdir, pkg, pe, pv, "latest")) + + os.symlink(os.path.join(pkghistdir, pkg, pe), os.path.join(pkghistdir, pkg, "latest")) + os.symlink(os.path.join(pkghistdir, pkg, pe, pv), os.path.join(pkghistdir, pkg, pe, "latest")) + os.symlink(os.path.join(pkghistdir, pkg, pe, pv, pr), os.path.join(pkghistdir, pkg, pe, pv, "latest")) + diff --git a/classes/qt4x11.bbclass b/classes/qt4x11.bbclass index 923717f8af..aa2e2a174e 100644 --- a/classes/qt4x11.bbclass +++ b/classes/qt4x11.bbclass @@ -1,4 +1,4 @@ -DEPENDS_prepend = "${@["qt4x11 ", ""][(bb.data.getVar('PN', d, 1) == 'qt4-x11-free')]}" +DEPENDS_prepend = "${@["qt4x11 ", ""][(bb.data.getVar('PN', d, 1)[:12] == 'qt4-x11-free')]}" inherit qmake2 |
