summaryrefslogtreecommitdiffstats
path: root/meta/classes/package_ipk.bbclass
diff options
context:
space:
mode:
Diffstat (limited to 'meta/classes/package_ipk.bbclass')
-rw-r--r--meta/classes/package_ipk.bbclass60
1 files changed, 30 insertions, 30 deletions
diff --git a/meta/classes/package_ipk.bbclass b/meta/classes/package_ipk.bbclass
index eb00932336..7018a600a9 100644
--- a/meta/classes/package_ipk.bbclass
+++ b/meta/classes/package_ipk.bbclass
@@ -11,8 +11,8 @@ PKGWRITEDIRIPK = "${WORKDIR}/deploy-ipks"
11OPKGBUILDCMD ??= "opkg-build" 11OPKGBUILDCMD ??= "opkg-build"
12 12
13OPKG_ARGS += "--force_postinstall --prefer-arch-to-version" 13OPKG_ARGS += "--force_postinstall --prefer-arch-to-version"
14OPKG_ARGS += "${@['', '--no-install-recommends'][d.getVar("NO_RECOMMENDATIONS", True) == "1"]}" 14OPKG_ARGS += "${@['', '--no-install-recommends'][d.getVar("NO_RECOMMENDATIONS") == "1"]}"
15OPKG_ARGS += "${@['', '--add-exclude ' + ' --add-exclude '.join((d.getVar('PACKAGE_EXCLUDE', True) or "").split())][(d.getVar("PACKAGE_EXCLUDE", True) or "") != ""]}" 15OPKG_ARGS += "${@['', '--add-exclude ' + ' --add-exclude '.join((d.getVar('PACKAGE_EXCLUDE') or "").split())][(d.getVar("PACKAGE_EXCLUDE") or "") != ""]}"
16 16
17OPKGLIBDIR = "${localstatedir}/lib" 17OPKGLIBDIR = "${localstatedir}/lib"
18 18
@@ -24,15 +24,15 @@ python do_package_ipk () {
24 24
25 oldcwd = os.getcwd() 25 oldcwd = os.getcwd()
26 26
27 workdir = d.getVar('WORKDIR', True) 27 workdir = d.getVar('WORKDIR')
28 outdir = d.getVar('PKGWRITEDIRIPK', True) 28 outdir = d.getVar('PKGWRITEDIRIPK')
29 tmpdir = d.getVar('TMPDIR', True) 29 tmpdir = d.getVar('TMPDIR')
30 pkgdest = d.getVar('PKGDEST', True) 30 pkgdest = d.getVar('PKGDEST')
31 if not workdir or not outdir or not tmpdir: 31 if not workdir or not outdir or not tmpdir:
32 bb.error("Variables incorrectly set, unable to package") 32 bb.error("Variables incorrectly set, unable to package")
33 return 33 return
34 34
35 packages = d.getVar('PACKAGES', True) 35 packages = d.getVar('PACKAGES')
36 if not packages or packages == '': 36 if not packages or packages == '':
37 bb.debug(1, "No packages; nothing to do") 37 bb.debug(1, "No packages; nothing to do")
38 return 38 return
@@ -56,7 +56,7 @@ python do_package_ipk () {
56 56
57 localdata.setVar('ROOT', '') 57 localdata.setVar('ROOT', '')
58 localdata.setVar('ROOT_%s' % pkg, root) 58 localdata.setVar('ROOT_%s' % pkg, root)
59 pkgname = localdata.getVar('PKG_%s' % pkg, True) 59 pkgname = localdata.getVar('PKG_%s' % pkg)
60 if not pkgname: 60 if not pkgname:
61 pkgname = pkg 61 pkgname = pkg
62 localdata.setVar('PKG', pkgname) 62 localdata.setVar('PKG', pkgname)
@@ -65,7 +65,7 @@ python do_package_ipk () {
65 65
66 bb.data.update_data(localdata) 66 bb.data.update_data(localdata)
67 basedir = os.path.join(os.path.dirname(root)) 67 basedir = os.path.join(os.path.dirname(root))
68 arch = localdata.getVar('PACKAGE_ARCH', True) 68 arch = localdata.getVar('PACKAGE_ARCH')
69 69
70 if localdata.getVar('IPK_HIERARCHICAL_FEED', False) == "1": 70 if localdata.getVar('IPK_HIERARCHICAL_FEED', False) == "1":
71 # Spread packages across subdirectories so each isn't too crowded 71 # Spread packages across subdirectories so each isn't too crowded
@@ -98,7 +98,7 @@ python do_package_ipk () {
98 from glob import glob 98 from glob import glob
99 g = glob('*') 99 g = glob('*')
100 if not g and localdata.getVar('ALLOW_EMPTY', False) != "1": 100 if not g and localdata.getVar('ALLOW_EMPTY', False) != "1":
101 bb.note("Not creating empty archive for %s-%s-%s" % (pkg, localdata.getVar('PKGV', True), localdata.getVar('PKGR', True))) 101 bb.note("Not creating empty archive for %s-%s-%s" % (pkg, localdata.getVar('PKGV'), localdata.getVar('PKGR')))
102 bb.utils.unlockfile(lf) 102 bb.utils.unlockfile(lf)
103 continue 103 continue
104 104
@@ -111,7 +111,7 @@ python do_package_ipk () {
111 bb.fatal("unable to open control file for writing") 111 bb.fatal("unable to open control file for writing")
112 112
113 fields = [] 113 fields = []
114 pe = d.getVar('PKGE', True) 114 pe = d.getVar('PKGE')
115 if pe and int(pe) > 0: 115 if pe and int(pe) > 0:
116 fields.append(["Version: %s:%s-%s\n", ['PKGE', 'PKGV', 'PKGR']]) 116 fields.append(["Version: %s:%s-%s\n", ['PKGE', 'PKGV', 'PKGR']])
117 else: 117 else:
@@ -123,13 +123,13 @@ python do_package_ipk () {
123 fields.append(["License: %s\n", ['LICENSE']]) 123 fields.append(["License: %s\n", ['LICENSE']])
124 fields.append(["Architecture: %s\n", ['PACKAGE_ARCH']]) 124 fields.append(["Architecture: %s\n", ['PACKAGE_ARCH']])
125 fields.append(["OE: %s\n", ['PN']]) 125 fields.append(["OE: %s\n", ['PN']])
126 if d.getVar('HOMEPAGE', True): 126 if d.getVar('HOMEPAGE'):
127 fields.append(["Homepage: %s\n", ['HOMEPAGE']]) 127 fields.append(["Homepage: %s\n", ['HOMEPAGE']])
128 128
129 def pullData(l, d): 129 def pullData(l, d):
130 l2 = [] 130 l2 = []
131 for i in l: 131 for i in l:
132 l2.append(d.getVar(i, True)) 132 l2.append(d.getVar(i))
133 return l2 133 return l2
134 134
135 ctrlfile.write("Package: %s\n" % pkgname) 135 ctrlfile.write("Package: %s\n" % pkgname)
@@ -141,9 +141,9 @@ python do_package_ipk () {
141 raise KeyError(f) 141 raise KeyError(f)
142 # Special behavior for description... 142 # Special behavior for description...
143 if 'DESCRIPTION' in fs: 143 if 'DESCRIPTION' in fs:
144 summary = localdata.getVar('SUMMARY', True) or localdata.getVar('DESCRIPTION', True) or "." 144 summary = localdata.getVar('SUMMARY') or localdata.getVar('DESCRIPTION') or "."
145 ctrlfile.write('Description: %s\n' % summary) 145 ctrlfile.write('Description: %s\n' % summary)
146 description = localdata.getVar('DESCRIPTION', True) or "." 146 description = localdata.getVar('DESCRIPTION') or "."
147 description = textwrap.dedent(description).strip() 147 description = textwrap.dedent(description).strip()
148 if '\\n' in description: 148 if '\\n' in description:
149 # Manually indent 149 # Manually indent
@@ -185,19 +185,19 @@ python do_package_ipk () {
185 elif (v or "").startswith("> "): 185 elif (v or "").startswith("> "):
186 var[dep][i] = var[dep][i].replace("> ", ">> ") 186 var[dep][i] = var[dep][i].replace("> ", ">> ")
187 187
188 rdepends = bb.utils.explode_dep_versions2(localdata.getVar("RDEPENDS", True) or "") 188 rdepends = bb.utils.explode_dep_versions2(localdata.getVar("RDEPENDS") or "")
189 debian_cmp_remap(rdepends) 189 debian_cmp_remap(rdepends)
190 rrecommends = bb.utils.explode_dep_versions2(localdata.getVar("RRECOMMENDS", True) or "") 190 rrecommends = bb.utils.explode_dep_versions2(localdata.getVar("RRECOMMENDS") or "")
191 debian_cmp_remap(rrecommends) 191 debian_cmp_remap(rrecommends)
192 rsuggests = bb.utils.explode_dep_versions2(localdata.getVar("RSUGGESTS", True) or "") 192 rsuggests = bb.utils.explode_dep_versions2(localdata.getVar("RSUGGESTS") or "")
193 debian_cmp_remap(rsuggests) 193 debian_cmp_remap(rsuggests)
194 # Deliberately drop version information here, not wanted/supported by ipk 194 # Deliberately drop version information here, not wanted/supported by ipk
195 rprovides = dict.fromkeys(bb.utils.explode_dep_versions2(localdata.getVar("RPROVIDES", True) or ""), []) 195 rprovides = dict.fromkeys(bb.utils.explode_dep_versions2(localdata.getVar("RPROVIDES") or ""), [])
196 rprovides = collections.OrderedDict(sorted(rprovides.items(), key=lambda x: x[0])) 196 rprovides = collections.OrderedDict(sorted(rprovides.items(), key=lambda x: x[0]))
197 debian_cmp_remap(rprovides) 197 debian_cmp_remap(rprovides)
198 rreplaces = bb.utils.explode_dep_versions2(localdata.getVar("RREPLACES", True) or "") 198 rreplaces = bb.utils.explode_dep_versions2(localdata.getVar("RREPLACES") or "")
199 debian_cmp_remap(rreplaces) 199 debian_cmp_remap(rreplaces)
200 rconflicts = bb.utils.explode_dep_versions2(localdata.getVar("RCONFLICTS", True) or "") 200 rconflicts = bb.utils.explode_dep_versions2(localdata.getVar("RCONFLICTS") or "")
201 debian_cmp_remap(rconflicts) 201 debian_cmp_remap(rconflicts)
202 202
203 if rdepends: 203 if rdepends:
@@ -212,14 +212,14 @@ python do_package_ipk () {
212 ctrlfile.write("Replaces: %s\n" % bb.utils.join_deps(rreplaces)) 212 ctrlfile.write("Replaces: %s\n" % bb.utils.join_deps(rreplaces))
213 if rconflicts: 213 if rconflicts:
214 ctrlfile.write("Conflicts: %s\n" % bb.utils.join_deps(rconflicts)) 214 ctrlfile.write("Conflicts: %s\n" % bb.utils.join_deps(rconflicts))
215 src_uri = localdata.getVar("SRC_URI", True).strip() or "None" 215 src_uri = localdata.getVar("SRC_URI").strip() or "None"
216 if src_uri: 216 if src_uri:
217 src_uri = re.sub("\s+", " ", src_uri) 217 src_uri = re.sub("\s+", " ", src_uri)
218 ctrlfile.write("Source: %s\n" % " ".join(src_uri.split())) 218 ctrlfile.write("Source: %s\n" % " ".join(src_uri.split()))
219 ctrlfile.close() 219 ctrlfile.close()
220 220
221 for script in ["preinst", "postinst", "prerm", "postrm"]: 221 for script in ["preinst", "postinst", "prerm", "postrm"]:
222 scriptvar = localdata.getVar('pkg_%s' % script, True) 222 scriptvar = localdata.getVar('pkg_%s' % script)
223 if not scriptvar: 223 if not scriptvar:
224 continue 224 continue
225 try: 225 try:
@@ -244,15 +244,15 @@ python do_package_ipk () {
244 conffiles.close() 244 conffiles.close()
245 245
246 os.chdir(basedir) 246 os.chdir(basedir)
247 ret = subprocess.call("PATH=\"%s\" %s %s %s" % (localdata.getVar("PATH", True), 247 ret = subprocess.call("PATH=\"%s\" %s %s %s" % (localdata.getVar("PATH"),
248 d.getVar("OPKGBUILDCMD", True), pkg, pkgoutdir), shell=True) 248 d.getVar("OPKGBUILDCMD"), pkg, pkgoutdir), shell=True)
249 if ret != 0: 249 if ret != 0:
250 bb.utils.unlockfile(lf) 250 bb.utils.unlockfile(lf)
251 bb.fatal("opkg-build execution failed") 251 bb.fatal("opkg-build execution failed")
252 252
253 if d.getVar('IPK_SIGN_PACKAGES', True) == '1': 253 if d.getVar('IPK_SIGN_PACKAGES') == '1':
254 ipkver = "%s-%s" % (d.getVar('PKGV', True), d.getVar('PKGR', True)) 254 ipkver = "%s-%s" % (d.getVar('PKGV'), d.getVar('PKGR'))
255 ipk_to_sign = "%s/%s_%s_%s.ipk" % (pkgoutdir, pkgname, ipkver, d.getVar('PACKAGE_ARCH', True)) 255 ipk_to_sign = "%s/%s_%s_%s.ipk" % (pkgoutdir, pkgname, ipkver, d.getVar('PACKAGE_ARCH'))
256 sign_ipk(d, ipk_to_sign) 256 sign_ipk(d, ipk_to_sign)
257 257
258 cleanupcontrol(root) 258 cleanupcontrol(root)
@@ -268,7 +268,7 @@ do_package_write_ipk[sstate-inputdirs] = "${PKGWRITEDIRIPK}"
268do_package_write_ipk[sstate-outputdirs] = "${DEPLOY_DIR_IPK}" 268do_package_write_ipk[sstate-outputdirs] = "${DEPLOY_DIR_IPK}"
269 269
270python do_package_write_ipk_setscene () { 270python do_package_write_ipk_setscene () {
271 tmpdir = d.getVar('TMPDIR', True) 271 tmpdir = d.getVar('TMPDIR')
272 272
273 if os.access(os.path.join(tmpdir, "stamps", "IPK_PACKAGE_INDEX_CLEAN"), os.R_OK): 273 if os.access(os.path.join(tmpdir, "stamps", "IPK_PACKAGE_INDEX_CLEAN"), os.R_OK):
274 os.unlink(os.path.join(tmpdir, "stamps", "IPK_PACKAGE_INDEX_CLEAN")) 274 os.unlink(os.path.join(tmpdir, "stamps", "IPK_PACKAGE_INDEX_CLEAN"))
@@ -278,7 +278,7 @@ python do_package_write_ipk_setscene () {
278addtask do_package_write_ipk_setscene 278addtask do_package_write_ipk_setscene
279 279
280python () { 280python () {
281 if d.getVar('PACKAGES', True) != '': 281 if d.getVar('PACKAGES') != '':
282 deps = ' opkg-utils-native:do_populate_sysroot virtual/fakeroot-native:do_populate_sysroot' 282 deps = ' opkg-utils-native:do_populate_sysroot virtual/fakeroot-native:do_populate_sysroot'
283 d.appendVarFlag('do_package_write_ipk', 'depends', deps) 283 d.appendVarFlag('do_package_write_ipk', 'depends', deps)
284 d.setVarFlag('do_package_write_ipk', 'fakeroot', "1") 284 d.setVarFlag('do_package_write_ipk', 'fakeroot', "1")