<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugzilla.yoctoproject.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugzilla.yoctoproject.org/"
          
          maintainer="it-coreprojects-helpdesk@linuxfoundation.org"
>

    <bug>
          <bug_id>11260</bug_id>
          
          <creation_ts>2017-03-28 12:49:46 +0000</creation_ts>
          <short_desc>[meta-swupd] core-image-minimal-swupd fails to build</short_desc>
          <delta_ts>2017-03-30 08:27:30 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>7</classification_id>
          <classification>Build System, Metadata &amp; Runtime</classification>
          <product>Other YP Layers</product>
          <component>layers</component>
          <version>unspecified</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>NOTABUG</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Undecided</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="BogDan Vatra">bogdan</reporter>
          <assigned_to name="Patrick Ohly">patrick.ohly</assigned_to>
          <cc>poky.bs.watcher</cc>
    
    <cc>poky.watcher</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>Don&apos;t know</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>71807</commentid>
    <comment_count>0</comment_count>
    <who name="BogDan Vatra">bogdan</who>
    <bug_when>2017-03-28 12:49:46 +0000</bug_when>
    <thetext>Steps to reproduce:
$ git clone git://git.yoctoproject.org/poky.git (I&apos;m at 71e48a361731dd)
$ cd poky
$ . oe-init-build-env
$ . toaster start
- create a new project (rpi3)
- add &quot;meta-raspberrypi&quot; layer
- change machine to &quot;raspberrypi3&quot;
- build code-image-minimal (the build should succeed)
- add &quot;meta-swupd&quot; layer
- add

[quote]
OS_VERSION=&quot;1&quot;
DISTRO_FEATURES_append=&quot; systemd&quot;
VIRTUAL-RUNTIME_init_manager=&quot;systemd&quot;
DISTRO_FEATURES_BACKFILL_CONSIDERED=&quot;sysvinit&quot;
PACKAGE_CONFIG_remove=&quot;stateless&quot;
[/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: &apos;exec_python_func() autogenerated&apos;, lineno: 2, function: &lt;module&gt;
     0001:
 *** 0002:do_fetch_swupd_inputs(d)
     0003:
File: &apos;/mnt/sda1/yocto/poky_master/_toaster_clones/_git___git.yoctoproject.org_meta-swupd_master/classes/swupd-image.bbclass&apos;, lineno: 263, function: do_fetch_swupd_inputs
     0259:        bb.debug(2, &apos;Skipping update input staging for non-base image %s&apos; % d.getVar(&apos;PN&apos;, 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] = &quot;${SWUPDIMAGEDIR}&quot;
     0266:addtask do_fetch_swupd_inputs before do_swupd_update
     0267:
File: &apos;/mnt/sda1/yocto/poky_master/_toaster_clones/_git___git.yoctoproject.org_meta-swupd_master/lib/swupd/bundles.py&apos;, lineno: 231, function: download_old_versions
     0227:    latest_versions = {}
     0228:    for format in range(3, current_format + 1):
     0229:        try:
     0230:            url = &apos;%s/version/format%d/latest&apos; % (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, &apos;version&apos;, &apos;format%d&apos; % format)
     0235:            bb.utils.mkdirhier(formatdir)
File: &apos;/usr/lib/python3.5/urllib/request.py&apos;, 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: &apos;/usr/lib/python3.5/urllib/request.py&apos;, 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+&quot;_response&quot;
     0470:        for processor in self.process_response.get(protocol, []):
File: &apos;/usr/lib/python3.5/urllib/request.py&apos;, lineno: 484, function: _open
     0480:            return result
     0481:
     0482:        protocol = req.type
     0483:        result = self._call_chain(self.handle_open, protocol, protocol +
 *** 0484:                                  &apos;_open&apos;, req)
     0485:        if result:
     0486:            return result
     0487:
     0488:        return self._call_chain(self.handle_open, &apos;unknown&apos;,
File: &apos;/usr/lib/python3.5/urllib/request.py&apos;, 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: &apos;/usr/lib/python3.5/urllib/request.py&apos;, 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, &apos;HTTPSConnection&apos;):
File: &apos;/usr/lib/python3.5/urllib/request.py&apos;, 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: &lt;urlopen error [Errno -2] Name or service not known&gt;
[/error]</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>71888</commentid>
    <comment_count>1</comment_count>
    <who name="Patrick Ohly">patrick.ohly</who>
    <bug_when>2017-03-30 06:07:55 +0000</bug_when>
    <thetext>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 ??= &quot;http://download.example.com/updates/my-distro/milestone/${MACHINE}/${SWUPD_IMAGE_PN}&quot;
SWUPD_CONTENT_URL ??= &quot;http://download.example.com/updates/my-distro/builds/${MACHINE}/${SWUPD_IMAGE_PN}&quot;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>71892</commentid>
    <comment_count>2</comment_count>
    <who name="BogDan Vatra">bogdan</who>
    <bug_when>2017-03-30 07:20:38 +0000</bug_when>
    <thetext>A normal user will not find that information easily.
IMHO you should just move it to docs ....</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>71894</commentid>
    <comment_count>3</comment_count>
    <who name="BogDan Vatra">bogdan</who>
    <bug_when>2017-03-30 07:56:37 +0000</bug_when>
    <thetext>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?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>71896</commentid>
    <comment_count>4</comment_count>
    <who name="Patrick Ohly">patrick.ohly</who>
    <bug_when>2017-03-30 08:27:30 +0000</bug_when>
    <thetext>(In reply to comment #2)
&gt; A normal user will not find that information easily.
&gt; IMHO you should just move it to docs ....

The repo is a community effort. Patches welcome.

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

Which lines?

You need to build with *empty* URLs, not with the ones that are already set.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>