<?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>4870</bug_id>
          
          <creation_ts>2013-07-19 01:22:40 +0000</creation_ts>
          <short_desc>Allow indirect specification of checksums</short_desc>
          <delta_ts>2017-06-13 11:42:10 +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>BitBake</product>
          <component>bitbake</component>
          <version>unspecified</version>
          <rep_platform>All</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Low</priority>
          <bug_severity>enhancement</bug_severity>
          <target_milestone>Future</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="mulhern">mulhern</reporter>
          <assigned_to name="Richard Purdie">richard.purdie</assigned_to>
          <cc>poky.bs.watcher</cc>
    
    <cc>poky.watcher</cc>
    
    <cc>ross.burton</cc>
    
    <cc>sgw</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>No (bug/feature does not impact docs)</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>34688</commentid>
    <comment_count>0</comment_count>
    <who name="mulhern">mulhern</who>
    <bug_when>2013-07-19 01:22:40 +0000</bug_when>
    <thetext>In some cases the provider of a file also makes the checksum available in a file.

Suggest allow specifying the location of the file that contains the checksum value, as well as the checksum value itself, in SRC_URI string.

The drawback of having the checksum value explicitly in the SRC_URI is that a rapidly changing checksum, say of a data file that may be updated every day, rather than of a source code tarball, that is generally updated less frequently, can not be accommodated.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>74063</commentid>
    <comment_count>1</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2017-06-13 11:42:10 +0000</bug_when>
    <thetext>The checksum is used for both download validation (did this file download correctly?) and security (is this file the one I expected?).  Fetching the checksums from the remote server nullifies the security check so this isn&apos;t something that we&apos;d want to support directly in oe-core, but if you&apos;re happy to compromise then there is a workaround.

Use a do_fetch prefunc (a function that executes before do_fetch runs) to set the checksums based on the remote file.  Here&apos;s a brief proof of concept:

SRC_URI = &quot;https://download.gnome.org/sources/dates/0.4/dates-0.4.7.tar.bz2&quot;
SHASUM_URI = &quot;https://download.gnome.org/sources/dates/0.4/dates-0.4.7.sha256sum&quot;

LICENSE = &quot;GPLv2&quot;
LIC_FILES_CHKSUM = &quot;file://COPYING;md5=d32239bcb673463ab874e80d47fae504&quot;

do_fetch[prefuncs] += &quot;fetch_checksums&quot;
python fetch_checksums() {
    import urllib
    for line in urllib.request.urlopen(d.getVar(&quot;SHASUM_URI&quot;)):
        (sha, filename) = line.decode(&quot;ascii&quot;).strip().split()
        if filename == &quot;dates-0.4.7.tar.bz2&quot;:
            d.setVarFlag(&quot;SRC_URI&quot;, &quot;sha256sum&quot;, sha)
            return
    bb.error(&quot;Could not find remote checksum&quot;)
}


Note that this recipe doesn&apos;t build but it does fetch, that&apos;s just the first small tarball I found.  There&apos;s quite a bit of hardcoding in there, the shamsum URL in the urlopen() call could be generated from the SRC_URI, and the basename in the looop could be extracted from the SRC_URI too.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>