summaryrefslogtreecommitdiffstats
path: root/meta/classes/package_deb.bbclass
diff options
context:
space:
mode:
authorRichard Purdie <rpurdie@linux.intel.com>2010-07-02 00:05:38 +0100
committerRichard Purdie <rpurdie@linux.intel.com>2010-07-02 00:06:50 +0100
commit968d00de157bcc614cc7c47a4a36db29d677ab89 (patch)
tree403601f6dcd3e5c5a69075010bfa5353b0e118a4 /meta/classes/package_deb.bbclass
parent8a020432658e49579078b6a1194405feae7eb439 (diff)
downloadpoky-968d00de157bcc614cc7c47a4a36db29d677ab89.tar.gz
package_deb.bbclass: Fix packaging functions to use versioned dependency package functions correctly
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
Diffstat (limited to 'meta/classes/package_deb.bbclass')
-rw-r--r--meta/classes/package_deb.bbclass74
1 files changed, 39 insertions, 35 deletions
diff --git a/meta/classes/package_deb.bbclass b/meta/classes/package_deb.bbclass
index cd8d1dfc69..edec2a47f6 100644
--- a/meta/classes/package_deb.bbclass
+++ b/meta/classes/package_deb.bbclass
@@ -20,13 +20,13 @@ python package_deb_fn () {
20 20
21addtask package_deb_install 21addtask package_deb_install
22python do_package_deb_install () { 22python do_package_deb_install () {
23 pkg = bb.data.getVar('PKG', d, 1) 23 pkg = bb.data.getVar('PKG', d, True)
24 pkgfn = bb.data.getVar('PKGFN', d, 1) 24 pkgfn = bb.data.getVar('PKGFN', d, True)
25 rootfs = bb.data.getVar('IMAGE_ROOTFS', d, 1) 25 rootfs = bb.data.getVar('IMAGE_ROOTFS', d, True)
26 debdir = bb.data.getVar('DEPLOY_DIR_DEB', d, 1) 26 debdir = bb.data.getVar('DEPLOY_DIR_DEB', d, True)
27 apt_config = bb.data.expand('${STAGING_ETCDIR_NATIVE}/apt/apt.conf', d) 27 apt_config = bb.data.expand('${STAGING_ETCDIR_NATIVE}/apt/apt.conf', d)
28 stagingbindir = bb.data.getVar('STAGING_BINDIR_NATIVE', d, 1) 28 stagingbindir = bb.data.getVar('STAGING_BINDIR_NATIVE', d, True)
29 tmpdir = bb.data.getVar('TMPDIR', d, 1) 29 tmpdir = bb.data.getVar('TMPDIR', d, True)
30 30
31 if None in (pkg,pkgfn,rootfs): 31 if None in (pkg,pkgfn,rootfs):
32 raise bb.build.FuncFailed("missing variables (one or more of PKG, PKGFN, IMAGE_ROOTFS)") 32 raise bb.build.FuncFailed("missing variables (one or more of PKG, PKGFN, IMAGE_ROOTFS)")
@@ -68,28 +68,28 @@ python do_package_deb_install () {
68python do_package_deb () { 68python do_package_deb () {
69 import re, copy 69 import re, copy
70 70
71 workdir = bb.data.getVar('WORKDIR', d, 1) 71 workdir = bb.data.getVar('WORKDIR', d, True)
72 if not workdir: 72 if not workdir:
73 bb.error("WORKDIR not defined, unable to package") 73 bb.error("WORKDIR not defined, unable to package")
74 return 74 return
75 75
76 outdir = bb.data.getVar('DEPLOY_DIR_DEB', d, 1) 76 outdir = bb.data.getVar('DEPLOY_DIR_DEB', d, True)
77 if not outdir: 77 if not outdir:
78 bb.error("DEPLOY_DIR_DEB not defined, unable to package") 78 bb.error("DEPLOY_DIR_DEB not defined, unable to package")
79 return 79 return
80 80
81 dvar = bb.data.getVar('D', d, 1) 81 dvar = bb.data.getVar('D', d, True)
82 if not dvar: 82 if not dvar:
83 bb.error("D not defined, unable to package") 83 bb.error("D not defined, unable to package")
84 return 84 return
85 bb.mkdirhier(dvar) 85 bb.mkdirhier(dvar)
86 86
87 packages = bb.data.getVar('PACKAGES', d, 1) 87 packages = bb.data.getVar('PACKAGES', d, True)
88 if not packages: 88 if not packages:
89 bb.debug(1, "PACKAGES not defined, nothing to package") 89 bb.debug(1, "PACKAGES not defined, nothing to package")
90 return 90 return
91 91
92 tmpdir = bb.data.getVar('TMPDIR', d, 1) 92 tmpdir = bb.data.getVar('TMPDIR', d, True)
93 93
94 if os.access(os.path.join(tmpdir, "stamps", "DEB_PACKAGE_INDEX_CLEAN"),os.R_OK): 94 if os.access(os.path.join(tmpdir, "stamps", "DEB_PACKAGE_INDEX_CLEAN"),os.R_OK):
95 os.unlink(os.path.join(tmpdir, "stamps", "DEB_PACKAGE_INDEX_CLEAN")) 95 os.unlink(os.path.join(tmpdir, "stamps", "DEB_PACKAGE_INDEX_CLEAN"))
@@ -100,14 +100,14 @@ python do_package_deb () {
100 100
101 for pkg in packages.split(): 101 for pkg in packages.split():
102 localdata = bb.data.createCopy(d) 102 localdata = bb.data.createCopy(d)
103 pkgdest = bb.data.getVar('PKGDEST', d, 1) 103 pkgdest = bb.data.getVar('PKGDEST', d, True)
104 root = "%s/%s" % (pkgdest, pkg) 104 root = "%s/%s" % (pkgdest, pkg)
105 105
106 lf = bb.utils.lockfile(root + ".lock") 106 lf = bb.utils.lockfile(root + ".lock")
107 107
108 bb.data.setVar('ROOT', '', localdata) 108 bb.data.setVar('ROOT', '', localdata)
109 bb.data.setVar('ROOT_%s' % pkg, root, localdata) 109 bb.data.setVar('ROOT_%s' % pkg, root, localdata)
110 pkgname = bb.data.getVar('PKG_%s' % pkg, localdata, 1) 110 pkgname = bb.data.getVar('PKG_%s' % pkg, localdata, True)
111 if not pkgname: 111 if not pkgname:
112 pkgname = pkg 112 pkgname = pkg
113 bb.data.setVar('PKG', pkgname, localdata) 113 bb.data.setVar('PKG', pkgname, localdata)
@@ -121,7 +121,7 @@ python do_package_deb () {
121 bb.data.update_data(localdata) 121 bb.data.update_data(localdata)
122 basedir = os.path.join(os.path.dirname(root)) 122 basedir = os.path.join(os.path.dirname(root))
123 123
124 pkgoutdir = os.path.join(outdir, bb.data.getVar('PACKAGE_ARCH', localdata, 1)) 124 pkgoutdir = os.path.join(outdir, bb.data.getVar('PACKAGE_ARCH', localdata, True))
125 bb.mkdirhier(pkgoutdir) 125 bb.mkdirhier(pkgoutdir)
126 126
127 os.chdir(root) 127 os.chdir(root)
@@ -133,7 +133,7 @@ python do_package_deb () {
133 except ValueError: 133 except ValueError:
134 pass 134 pass
135 if not g and bb.data.getVar('ALLOW_EMPTY', localdata) != "1": 135 if not g and bb.data.getVar('ALLOW_EMPTY', localdata) != "1":
136 bb.note("Not creating empty archive for %s-%s-%s" % (pkg, bb.data.getVar('PV', localdata, 1), bb.data.getVar('PR', localdata, 1))) 136 bb.note("Not creating empty archive for %s-%s-%s" % (pkg, bb.data.getVar('PV', localdata, True), bb.data.getVar('PR', localdata, True)))
137 bb.utils.unlockfile(lf) 137 bb.utils.unlockfile(lf)
138 continue 138 continue
139 139
@@ -149,7 +149,7 @@ python do_package_deb () {
149 raise bb.build.FuncFailed("unable to open control file for writing.") 149 raise bb.build.FuncFailed("unable to open control file for writing.")
150 150
151 fields = [] 151 fields = []
152 pe = bb.data.getVar('PE', d, 1) 152 pe = bb.data.getVar('PE', d, True)
153 if pe and int(pe) > 0: 153 if pe and int(pe) > 0:
154 fields.append(["Version: %s:%s-%s\n", ['PE', 'PV', 'PR']]) 154 fields.append(["Version: %s:%s-%s\n", ['PE', 'PV', 'PR']])
155 else: 155 else:
@@ -169,10 +169,10 @@ python do_package_deb () {
169 def pullData(l, d): 169 def pullData(l, d):
170 l2 = [] 170 l2 = []
171 for i in l: 171 for i in l:
172 data = bb.data.getVar(i, d, 1) 172 data = bb.data.getVar(i, d, True)
173 if data is None: 173 if data is None:
174 raise KeyError(f) 174 raise KeyError(f)
175 if i == 'DPKG_ARCH' and bb.data.getVar('PACKAGE_ARCH', d, 1) == 'all': 175 if i == 'DPKG_ARCH' and bb.data.getVar('PACKAGE_ARCH', d, True) == 'all':
176 data = 'all' 176 data = 'all'
177 l2.append(data) 177 l2.append(data)
178 return l2 178 return l2
@@ -192,30 +192,34 @@ python do_package_deb () {
192 192
193 bb.build.exec_func("mapping_rename_hook", localdata) 193 bb.build.exec_func("mapping_rename_hook", localdata)
194 194
195 rdepends = bb.utils.explode_deps(unicode(bb.data.getVar("RDEPENDS", localdata, 1) or "")) 195 rdepends = bb.utils.explode_dep_versions(bb.data.getVar("RDEPENDS", localdata, True) or "")
196 rdepends = [dep for dep in rdepends if not '*' in dep] 196 for dep in rdepends:
197 rrecommends = bb.utils.explode_deps(unicode(bb.data.getVar("RRECOMMENDS", localdata, 1) or "")) 197 if '*' in dep:
198 rrecommends = [rec for rec in rrecommends if not '*' in rec] 198 del rdepends[dep]
199 rsuggests = bb.utils.explode_deps(unicode(bb.data.getVar("RSUGGESTS", localdata, 1) or "")) 199 rrecommends = bb.utils.explode_dep_versions(bb.data.getVar("RRECOMMENDS", localdata, True) or "")
200 rprovides = bb.utils.explode_deps(unicode(bb.data.getVar("RPROVIDES", localdata, 1) or "")) 200 for dep in rrecommends:
201 rreplaces = bb.utils.explode_deps(unicode(bb.data.getVar("RREPLACES", localdata, 1) or "")) 201 if '*' in dep:
202 rconflicts = bb.utils.explode_deps(unicode(bb.data.getVar("RCONFLICTS", localdata, 1) or "")) 202 del rrecommends[dep]
203 rsuggests = bb.utils.explode_dep_versions(bb.data.getVar("RSUGGESTS", localdata, True) or "")
204 rprovides = bb.utils.explode_dep_versions(bb.data.getVar("RPROVIDES", localdata, True) or "")
205 rreplaces = bb.utils.explode_dep_versions(bb.data.getVar("RREPLACES", localdata, True) or "")
206 rconflicts = bb.utils.explode_dep_versions(bb.data.getVar("RCONFLICTS", localdata, True) or "")
203 if rdepends: 207 if rdepends:
204 ctrlfile.write(u"Depends: %s\n" % bb.utils.join_deps(rdepends)) 208 ctrlfile.write("Depends: %s\n" % unicode(bb.utils.join_deps(rdepends)))
205 if rsuggests: 209 if rsuggests:
206 ctrlfile.write(u"Suggests: %s\n" % bb.utils.join_deps(rsuggests)) 210 ctrlfile.write("Suggests: %s\n" % unicode(bb.utils.join_deps(rsuggests)))
207 if rrecommends: 211 if rrecommends:
208 ctrlfile.write(u"Recommends: %s\n" % bb.utils.join_deps(rrecommends)) 212 ctrlfile.write("Recommends: %s\n" % unicode(bb.utils.join_deps(rrecommends)))
209 if rprovides: 213 if rprovides:
210 ctrlfile.write(u"Provides: %s\n" % bb.utils.join_deps(rprovides)) 214 ctrlfile.write("Provides: %s\n" % unicode(bb.utils.join_deps(rprovides)))
211 if rreplaces: 215 if rreplaces:
212 ctrlfile.write(u"Replaces: %s\n" % bb.utils.join_deps(rreplaces)) 216 ctrlfile.write("Replaces: %s\n" % unicode(bb.utils.join_deps(rreplaces)))
213 if rconflicts: 217 if rconflicts:
214 ctrlfile.write(u"Conflicts: %s\n" % bb.utils.join_deps(rconflicts)) 218 ctrlfile.write("Conflicts: %s\n" % unicode(bb.utils.join_deps(rconflicts)))
215 ctrlfile.close() 219 ctrlfile.close()
216 220
217 for script in ["preinst", "postinst", "prerm", "postrm"]: 221 for script in ["preinst", "postinst", "prerm", "postrm"]:
218 scriptvar = bb.data.getVar('pkg_%s' % script, localdata, 1) 222 scriptvar = bb.data.getVar('pkg_%s' % script, localdata, True)
219 if not scriptvar: 223 if not scriptvar:
220 continue 224 continue
221 try: 225 try:
@@ -228,7 +232,7 @@ python do_package_deb () {
228 scriptfile.close() 232 scriptfile.close()
229 os.chmod(os.path.join(controldir, script), 0755) 233 os.chmod(os.path.join(controldir, script), 0755)
230 234
231 conffiles_str = bb.data.getVar("CONFFILES", localdata, 1) 235 conffiles_str = bb.data.getVar("CONFFILES", localdata, True)
232 if conffiles_str: 236 if conffiles_str:
233 try: 237 try:
234 conffiles = file(os.path.join(controldir, 'conffiles'), 'w') 238 conffiles = file(os.path.join(controldir, 'conffiles'), 'w')
@@ -240,7 +244,7 @@ python do_package_deb () {
240 conffiles.close() 244 conffiles.close()
241 245
242 os.chdir(basedir) 246 os.chdir(basedir)
243 ret = os.system("PATH=\"%s\" fakeroot dpkg-deb -b %s %s" % (bb.data.getVar("PATH", localdata, 1), root, pkgoutdir)) 247 ret = os.system("PATH=\"%s\" fakeroot dpkg-deb -b %s %s" % (bb.data.getVar("PATH", localdata, True), root, pkgoutdir))
244 if ret != 0: 248 if ret != 0:
245 bb.utils.unlockfile(lf) 249 bb.utils.unlockfile(lf)
246 raise bb.build.FuncFailed("dpkg-deb execution failed") 250 raise bb.build.FuncFailed("dpkg-deb execution failed")