[yocto] meta-virtualization -> docker not packaged when using PACKAGE_CLASSES ?= "package_deb"
Sunil Mukundan
sunil.mukundan at gmail.com
Sat May 12 17:44:20 PDT 2018
> The build process aborts at some point within do_rootfs, stating something
like that the package 'docker' could not be found. I tracked down the
problem to docker's
>build/tmp/work/<something>/docker/<version>/deploy-debs/ directory. I
found the following packages:
> docker-contrib_17.06.0+gite639a70fbe999d96354a5bcf560231b7b8aa935c-r0_amd64.deb
> docker-distribution-dev_v2.6.2-r0_amd64.deb
> docker-registry_v2.6.2-r0_amd64.deb
> docker-dbg_17.06.0+gite639a70fbe999d96354a5bcf560231b7b8aa935c-r0_amd64.deb
> docker-distribution-ptest_v2.6.2-r0_amd64.deb
> docker-distribution-dbg_v2.6.2-r0_amd64.deb
> docker-ptest_17.06.0+gite639a70fbe999d96354a5bcf560231b7b8aa935c-r0_amd64.deb
I hit this issue too, basically the 'deb-pkg' building failed while
building the docker package. Since the 'deb_write_pkg' function in
'meta/classes/package_deb.bbclass' file did not catch exceptions and print
out an error when it happens, it failed silently.
Coming to the reason why the deb-pkg building failed:
basically the deb package's CONTROL meta data file has a line that lists a
deb package's dependency. In the case of docker this line ends up looking
like this:
"Depends: foo1, foo2, foo3, virtual/containerd, virtual/runc"
when we pass this CONTROL file to the deb-pkg utility, it barfs saying that
the '/' character is not allowed
sunil at sunil-dev:~/yoctocache/poky/build$
./tmp/work/qemuarm64-poky-linux/core-image-minimal/1.0-r0/recipe-sysroot-native/usr/bin/dpkg-deb
-b
/home/sunil/yoctocache/poky/build/tmp/work/aarch64-poky-linux/docker/17.06.0+gite639a70fbe999d96354a5bcf560231b7b8aa935c-r0/packages-split/docker
/home/sunil/yoctocache/poky/build/tmp/work/aarch64-poky-linux/docker/17.06.0+gite639a70fbe999d96354a5bcf560231b7b8aa935c-r0/deploy-debs/
dpkg-deb: error: parsing file
'/home/sunil/yoctocache/poky/build/tmp/work/aarch64-poky-linux/docker/17.06.0+gite639a70fbe999d96354a5bcf560231b7b8aa935c-r0/packages-split/docker/DEBIAN/control'
near line 23 package 'docker:arm64':
'Depends' field, invalid package name 'virtual/containerd': character '/'
not allowed (only letters, digits and characters '-+._')
Digging a little deeper this "Depends" list is built from the RDEPENDS
variable in the docker_%.bb file and that file uses this style (i.e
virtual/containerd) to list the dependencies. Now removing just replacing
this with 'containerd' instead of 'virtual/containerd' breaks the bitbake
build system and leaving it as-is breaks the deb packager.
The solution i had was to fix the way the 'Depends' list is built in the
'deb_write_pkg' function. bitbake's bb.utils.explode_dep_version2 function
is used to achieve this. So i basically checked and ignored the segment of
the string before the '/' when building the '/' depends list. For
completeness, i also caught the exception and printed a NOTE in the log
informing the user of this situation. I am new to yocto and i am not sure
how the exceptions unroll so i did not really do the right thing there but
atleast this leaves a clue
sunil at sunil-dev:~/yoctocache/poky$ git diff
diff --git a/bitbake/lib/bb/utils.py b/bitbake/lib/bb/utils.py
index c540b49..8c90d64 100644
--- a/bitbake/lib/bb/utils.py
+++ b/bitbake/lib/bb/utils.py
@@ -200,12 +200,19 @@ def explode_dep_versions2(s):
lastver = ""
incmp = False
inversion = False
+
for i in l:
if i[0] == '(':
incmp = True
i = i[1:].strip()
if not i:
continue
+ # deb packages don't allow '/' as a special character
+ # RDEPENDES potentially could have it legitimately
+ if '/' in i:
+ i = i.split('/')[-1]
+ fp.write(str(i))
+ fp.write('\n')
if incmp:
incmp = False
diff --git a/meta/classes/package_deb.bbclass
b/meta/classes/package_deb.bbclass
index 5d29793..bb3efc8 100644
--- a/meta/classes/package_deb.bbclass
+++ b/meta/classes/package_deb.bbclass
@@ -320,6 +320,8 @@ def deb_write_pkg(pkg, d):
stderr=subprocess.STDOUT,
shell=True)
+ except:
+ bb.note("error packaging %s" %(root))
finally:
cleanupcontrol(root)
bb.utils.unlockfile(lf)
With this patch things worked for me. i did not spend time to find out why
it selectively affects on a small subset of people as opposed to everyone
who are using deb packages and meta-virtualization. Hope this helps
- Sunil Mukundan
More information about the yocto
mailing list