Bug 11260 - [meta-swupd] core-image-minimal-swupd fails to build
Summary: [meta-swupd] core-image-minimal-swupd fails to build
Status: RESOLVED NOTABUG
Alias: None
Product: Other YP Layers
Classification: Build System, Metadata & Runtime
Component: layers (show other bugs)
Version: unspecified
Hardware: x86 Multiple
: Undecided normal
Target Milestone: ---
Assignee: Patrick Ohly
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2017-03-28 12:49 UTC by BogDan Vatra
Modified: 2017-03-30 08:27 UTC (History)
2 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: Don't know


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description BogDan Vatra 2017-03-28 12:49:46 UTC
Steps to reproduce:
$ git clone git://git.yoctoproject.org/poky.git (I'm at 71e48a361731dd)
$ cd poky
$ . oe-init-build-env
$ . toaster start
- create a new project (rpi3)
- add "meta-raspberrypi" layer
- change machine to "raspberrypi3"
- build code-image-minimal (the build should succeed)
- add "meta-swupd" layer
- add

[quote]
OS_VERSION="1"
DISTRO_FEATURES_append=" systemd"
VIRTUAL-RUNTIME_init_manager="systemd"
DISTRO_FEATURES_BACKFILL_CONSIDERED="sysvinit"
PACKAGE_CONFIG_remove="stateless"
[/quote]
to toaster.conf
 - building core-image-minimal-swupd fails with the following error:

[error]
Error executing a python function in exec_python_func() autogenerated:

The stack trace of python calls that resulted in this exception/failure was:
File: 'exec_python_func() autogenerated', lineno: 2, function: <module>
     0001:
 *** 0002:do_fetch_swupd_inputs(d)
     0003:
File: '/mnt/sda1/yocto/poky_master/_toaster_clones/_git___git.yoctoproject.org_meta-swupd_master/classes/swupd-image.bbclass', lineno: 263, function: do_fetch_swupd_inputs
     0259:        bb.debug(2, 'Skipping update input staging for non-base image %s' % d.getVar('PN', True))
     0260:        return
     0261:
     0262:    # Get information from remote update repo.
 *** 0263:    swupd.bundles.download_old_versions(d)
     0264:}
     0265:do_fetch_swupd_inputs[dirs] = "${SWUPDIMAGEDIR}"
     0266:addtask do_fetch_swupd_inputs before do_swupd_update
     0267:
File: '/mnt/sda1/yocto/poky_master/_toaster_clones/_git___git.yoctoproject.org_meta-swupd_master/lib/swupd/bundles.py', lineno: 231, function: download_old_versions
     0227:    latest_versions = {}
     0228:    for format in range(3, current_format + 1):
     0229:        try:
     0230:            url = '%s/version/format%d/latest' % (content_url, format)
 *** 0231:            response = urllib.request.urlopen(url)
     0232:            version = int(response.read())
     0233:            latest_versions[format] = version
     0234:            formatdir = os.path.join(www_dir, 'version', 'format%d' % format)
     0235:            bb.utils.mkdirhier(formatdir)
File: '/usr/lib/python3.5/urllib/request.py', lineno: 163, function: urlopen
     0159:    elif _opener is None:
     0160:        _opener = opener = build_opener()
     0161:    else:
     0162:        opener = _opener
 *** 0163:    return opener.open(url, data, timeout)
     0164:
     0165:def install_opener(opener):
     0166:    global _opener
     0167:    _opener = opener
File: '/usr/lib/python3.5/urllib/request.py', lineno: 466, function: open
     0462:        for processor in self.process_request.get(protocol, []):
     0463:            meth = getattr(processor, meth_name)
     0464:            req = meth(req)
     0465:
 *** 0466:        response = self._open(req, data)
     0467:
     0468:        # post-process response
     0469:        meth_name = protocol+"_response"
     0470:        for processor in self.process_response.get(protocol, []):
File: '/usr/lib/python3.5/urllib/request.py', lineno: 484, function: _open
     0480:            return result
     0481:
     0482:        protocol = req.type
     0483:        result = self._call_chain(self.handle_open, protocol, protocol +
 *** 0484:                                  '_open', req)
     0485:        if result:
     0486:            return result
     0487:
     0488:        return self._call_chain(self.handle_open, 'unknown',
File: '/usr/lib/python3.5/urllib/request.py', lineno: 444, function: _call_chain
     0440:        # could.  Otherwise, they return the response.
     0441:        handlers = chain.get(kind, ())
     0442:        for handler in handlers:
     0443:            func = getattr(handler, meth_name)
 *** 0444:            result = func(*args)
     0445:            if result is not None:
     0446:                return result
     0447:
     0448:    def open(self, fullurl, data=None, timeout=socket._GLOBAL_DEFAULT_TIMEOUT):
File: '/usr/lib/python3.5/urllib/request.py', lineno: 1282, function: http_open
     1278:
     1279:class HTTPHandler(AbstractHTTPHandler):
     1280:
     1281:    def http_open(self, req):
 *** 1282:        return self.do_open(http.client.HTTPConnection, req)
     1283:
     1284:    http_request = AbstractHTTPHandler.do_request_
     1285:
     1286:if hasattr(http.client, 'HTTPSConnection'):
File: '/usr/lib/python3.5/urllib/request.py', lineno: 1256, function: do_open
     1252:        try:
     1253:            try:
     1254:                h.request(req.get_method(), req.selector, req.data, headers)
     1255:            except OSError as err: # timeout error
 *** 1256:                raise URLError(err)
     1257:            r = h.getresponse()
     1258:        except:
     1259:            h.close()
     1260:            raise
Exception: urllib.error.URLError: <urlopen error [Errno -2] Name or service not known>
[/error]
Comment 1 Patrick Ohly 2017-03-30 06:07:55 UTC
Please have a look at the code. The comments about SWUPD_VERSION_URL and SWUPD_CONTENT_URL explain how to do the initial build.

Documentation and error handling could be better. Patches welcome...

# The information about where to find version information and actual
# content is needed in several places:
# - the swupd client in the image gets configured such that it uses that as default
# - swupd server needs information about the previous build
#
# The version URL determines what the client picks as the version that it updates to.
# The content URL must have all builds ever produced and is expected to also
# have the corresponding version information.
#
# To build the very first version of an image, set these to empty.
# Errors while accessing the server (as the non-existent download.example.com)
# or not having any previous build on that server are fatal. The latter
# is necessary to detect misconfiguration.
SWUPD_VERSION_URL ??= "http://download.example.com/updates/my-distro/milestone/${MACHINE}/${SWUPD_IMAGE_PN}"
SWUPD_CONTENT_URL ??= "http://download.example.com/updates/my-distro/builds/${MACHINE}/${SWUPD_IMAGE_PN}"
Comment 2 BogDan Vatra 2017-03-30 07:20:38 UTC
A normal user will not find that information easily.
IMHO you should just move it to docs ....
Comment 3 BogDan Vatra 2017-03-30 07:56:37 UTC
I added those lines to my local.conf but it still not working, same error as in my description.
Can you please try the same steps on your side?
Comment 4 Patrick Ohly 2017-03-30 08:27:30 UTC
(In reply to comment #2)
> A normal user will not find that information easily.
> IMHO you should just move it to docs ....

The repo is a community effort. Patches welcome.

(In reply to comment #3)
> I added those lines to my local.conf but it still not working, same error as
> in my description.

Which lines?

You need to build with *empty* URLs, not with the ones that are already set.