<?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>14017</bug_id>
          
          <creation_ts>2020-08-20 03:06:32 +0000</creation_ts>
          <short_desc>buildhistory-collect-srcrevs wrongly outputs glibc SRCREV</short_desc>
          <delta_ts>2021-11-24 10:13:34 +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>OE-Core</product>
          <component>oe-core other</component>
          <version>unspecified</version>
          <rep_platform>x86</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>Medium</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>4.0 M1</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Yann Dirson">ydirson</reporter>
          <assigned_to name="Richard Purdie">richard.purdie</assigned_to>
          <cc>ernstp</cc>
    
    <cc>randy.macleod</cc>
    
    <cc>richard.purdie</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>87990</commentid>
    <comment_count>0</comment_count>
    <who name="Yann Dirson">ydirson</who>
    <bug_when>2020-08-20 03:06:32 +0000</bug_when>
    <thetext>In dunfell 3.1.2, buildhistory-collect-srcrevs notably outputs the following:

SRCREV_pn-glibc = &quot;109474122400ca7d60782b131dc867a5c1f2fe55&quot;
SRCREV_pn-nativesdk-glibc = &quot;109474122400ca7d60782b131dc867a5c1f2fe55&quot;


However those are explicitly set (and this surely should not be output there), though not using a simple SRCREV but using SRC_URI naming:

SRCREV_glibc ?= &quot;109474122400ca7d60782b131dc867a5c1f2fe55&quot;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>87994</commentid>
    <comment_count>1</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2020-08-20 07:54:15 +0000</bug_when>
    <thetext>The hashes shown look correct. Can you explain the problem that you see in more detail?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>88000</commentid>
    <comment_count>2</comment_count>
    <who name="Yann Dirson">ydirson</who>
    <bug_when>2020-08-20 12:07:15 +0000</bug_when>
    <thetext>I expect to get only those SRCREV&apos;s that are determined at runtime through AUTOREV.  In fact I was contemplating checking for buildhistory-collect-srcrevs output to ensure no AUTOREV gets into a release, for reproducibility purposes.

I wouldnot be surprised to see it appear with &quot;-a&quot;, but I can&apos;t see in what the glibc usecase is so special that it warrants listing its srcrev without &quot;-a&quot;.

I&apos;m also suspecting that SRCREV_pn-glibc could be plain wrong, as setting it seems unlikely to override a variable named SRCREV_glibc.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>88647</commentid>
    <comment_count>3</comment_count>
    <who name="Ernst Persson">ernstp</who>
    <bug_when>2020-11-20 07:52:04 +0000</bug_when>
    <thetext>I have the same issue.
This is because the main SRCREV in the glibc recipe is not set I think.

I ran bitbake -e glibc &gt; env-glibc.txt

grep -E &quot;^SRCREV&quot; env-glibc.txt

SRCREV=&quot;INVALID&quot;
SRCREV_glibc=&quot;6fdf971c9dbf7dac9bea552113fe4694015bbc4d&quot;
SRCREV_localedef=&quot;cd9f958c4c94a638fa7b2b4e21627364f1a1a655&quot;


Buildhistory.bbclass only looks for the main SRCREV when finding &quot;orig_srcrev&quot;:
        with open(srcrevfile, &apos;w&apos;) as f:
            orig_srcrev = d.getVar(&apos;SRCREV&apos;, False) or &apos;INVALID&apos;
            if orig_srcrev != &apos;INVALID&apos;:
                f.write(&apos;# SRCREV = &quot;%s&quot;\n&apos; % orig_srcrev)

buildhistory-collect-srcrevs then uses this commented &quot;# SRCREV&quot; line to determine if the package used an autorev or not (this is related to the --report-all option).
So buildhistory-collect-srcrevs incorrectly thinks glibc was using AUTOREV when it was not.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>88648</commentid>
    <comment_count>4</comment_count>
      <attachid>4750</attachid>
    <who name="Ernst Persson">ernstp</who>
    <bug_when>2020-11-20 08:19:04 +0000</bug_when>
    <thetext>Created attachment 4750
Patch to buildhistory.bbclass

Here&apos;s one way to solve it</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>91972</commentid>
    <comment_count>5</comment_count>
    <who name="Steve Sakoman">steve</who>
    <bug_when>2021-11-11 16:16:07 +0000</bug_when>
    <thetext>Not enough time to make it into 3.1.12</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>91980</commentid>
    <comment_count>6</comment_count>
    <who name="Steve Sakoman">steve</who>
    <bug_when>2021-11-11 20:10:04 +0000</bug_when>
    <thetext>I can confirm that this issue is present in both master and dunfell 3.1.11

In both cases I did a checkout of the desired branch, enabled buildhistory in local.conf, and built core-image-minimal.

I then ran the buildhistory-collect-srcrevs script:

steve@hexa:~/builds/poky/build-master$ ../scripts/buildhistory-collect-srcrevs
# core2-64-poky-linux
SRCREV:pn-bzip2 = &quot;f9061c030a25de5b6829e1abf373057309c734c0&quot;
SRCREV:pn-glibc = &quot;ae37d06c7d127817ba43850f0f898b793d42aea7&quot;


steve@hexa:~/builds/poky/build-dunfell$ ../scripts/buildhistory-collect-srcrevs
# core2-64-poky-linux
SRCREV_pn-glibc = &quot;4f0a61f75385c9a5879cbe7202042e88f692a3c8&quot;

I can also confirm the theory that the main SRCREV for glibc not being set is the source of the issue since we also now seem to have the same situation for glibc and bzip2 in master:

steve@hexa:~/builds/poky/build-master$ bitbake -e glibc &gt; env-glibc.txt
steve@hexa:~/builds/poky/build-master$ grep -E &quot;^SRCREV&quot; env-glibc.txt
SRCREV=&quot;INVALID&quot;
SRCREV_glibc=&quot;ae37d06c7d127817ba43850f0f898b793d42aea7&quot;
SRCREV_localedef=&quot;95c0221703ad970a52445e9eaf91c4aff35eebef&quot;

steve@hexa:~/builds/poky/build-master$ bitbake -e bzip2  &gt; env-glibc.txt
steve@hexa:~/builds/poky/build-master$ grep -E &quot;^SRCREV&quot; env-glibc.txt
SRCREV=&quot;INVALID&quot;
SRCREV_bzip2-tests=&quot;f9061c030a25de5b6829e1abf373057309c734c0&quot;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>91981</commentid>
    <comment_count>7</comment_count>
    <who name="Steve Sakoman">steve</who>
    <bug_when>2021-11-11 22:11:46 +0000</bug_when>
    <thetext>The patch attached to this bug does seem to eliminate the glibc issue in both dunfell and master, however it does not fix the bzip2 case in master:

steve@hexa:~/builds/poky/build-dunfell$ ../scripts/buildhistory-collect-srcrevs
steve@hexa:~/builds/poky/build-dunfell$ 

steve@hexa:~/builds/poky/build-master$ ../scripts/buildhistory-collect-srcrevs
# core2-64-poky-linux
SRCREV:pn-bzip2 = &quot;f9061c030a25de5b6829e1abf373057309c734c0&quot;

I haven&apos;t investigated this further, but wanted to leave a history of my research to date.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>91982</commentid>
    <comment_count>8</comment_count>
    <who name="Steve Sakoman">steve</who>
    <bug_when>2021-11-11 22:28:26 +0000</bug_when>
    <thetext>So the bzip2 base package shouldn&apos;t have a SRCREV associated with it, since it is built from a tarball:

SRC_URI = &quot;https://sourceware.org/pub/${BPN}/${BPN}-${PV}.tar.gz \
           git://sourceware.org/git/bzip2-tests.git;name=bzip2-tests;branch=master \
           file://configure.ac;subdir=${BP} \
           file://Makefile.am;subdir=${BP} \
           file://run-ptest \
           &quot;
SRC_URI[md5sum] = &quot;67e051268d0c475ea773822f7500d0e5&quot;
SRC_URI[sha256sum] = &quot;ab5a03176ee106d3f0fa90e381da478ddae405918153cca248e682cd0c4a2269&quot;

SRCREV_bzip2-tests = &quot;f9061c030a25de5b6829e1abf373057309c734c0&quot;

So this is an odd case where the base package is being built from a tarball and the bzip2-tests are being built from a git repo.

I&apos;m not really sure what the right answer is here! It seems like a lot of machinations in build history to deal with two corner cases, but I have zero history (pun intended) with buildhistory so I would love to hear opinions from those more experienced.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>92059</commentid>
    <comment_count>9</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2021-11-22 15:40:34 +0000</bug_when>
    <thetext>I have sent a couple of patches to the list which I believe should address this issue and put them in master-next</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>92063</commentid>
    <comment_count>10</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2021-11-24 10:13:34 +0000</bug_when>
    <thetext>http://git.yoctoproject.org/cgit.cgi/poky/commit/?id=96f552377a25f21f24aadb6f326f177d56aa9d73</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>4750</attachid>
            <date>2020-11-20 08:19:04 +0000</date>
            <delta_ts>2020-11-20 08:19:04 +0000</delta_ts>
            <desc>Patch to buildhistory.bbclass</desc>
            <filename>buildhistory.patch</filename>
            <type>text/plain</type>
            <size>1409</size>
            <attacher name="Ernst Persson">ernstp</attacher>
            
              <data encoding="base64">ZGlmZiAtLWdpdCBhL21ldGEvY2xhc3Nlcy9idWlsZGhpc3RvcnkuYmJjbGFzcyBiL21ldGEvY2xh
c3Nlcy9idWlsZGhpc3RvcnkuYmJjbGFzcwppbmRleCAxNTYzMjRkMzM5Li4zZjQ0YzdjYWFiIDEw
MDY0NAotLS0gYS9tZXRhL2NsYXNzZXMvYnVpbGRoaXN0b3J5LmJiY2xhc3MKKysrIGIvbWV0YS9j
bGFzc2VzL2J1aWxkaGlzdG9yeS5iYmNsYXNzCkBAIC05NTAsNyArOTUwLDEyIEBAIGRlZiB3cml0
ZV9sYXRlc3Rfc3JjcmV2KGQsIHBrZ2hpc3RkaXIpOgogICAgICAgICAgICAgICAgICAgICAgICAg
dmFsdWUgPSB2YWx1ZS5yZXBsYWNlKCciJywgJycpLnN0cmlwKCkKICAgICAgICAgICAgICAgICAg
ICAgICAgIG9sZF90YWdfc3JjcmV2c1trZXldID0gdmFsdWUKICAgICAgICAgd2l0aCBvcGVuKHNy
Y3JldmZpbGUsICd3JykgYXMgZjoKLSAgICAgICAgICAgIG9yaWdfc3JjcmV2ID0gZC5nZXRWYXIo
J1NSQ1JFVicsIEZhbHNlKSBvciAnSU5WQUxJRCcKKyAgICAgICAgICAgIHBrZyA9IGQuZ2V0VmFy
KCdQTicpCisgICAgICAgICAgICBvcmlnX3NyY3JldiA9IGQuZ2V0VmFyKCdTUkNSRVYnLCBGYWxz
ZSkKKyAgICAgICAgICAgIGlmIG5vdCBvcmlnX3NyY3JldiBvciBvcmlnX3NyY3JldiA9PSAnSU5W
QUxJRCc6CisgICAgICAgICAgICAgICAgb3JpZ19zcmNyZXYgPSBkLmdldFZhcignU1JDUkVWXyVz
JyAlIChwa2cpLCBGYWxzZSkKKyAgICAgICAgICAgIGlmIG5vdCBvcmlnX3NyY3JldjoKKyAgICAg
ICAgICAgICAgICBvcmlnX3NyY3JldiA9ICdJTlZBTElEJwogICAgICAgICAgICAgaWYgb3JpZ19z
cmNyZXYgIT0gJ0lOVkFMSUQnOgogICAgICAgICAgICAgICAgIGYud3JpdGUoJyMgU1JDUkVWID0g
IiVzIlxuJyAlIG9yaWdfc3JjcmV2KQogICAgICAgICAgICAgaWYgbGVuKHNyY3JldnMpID4gMToK
QEAgLTk2NSw3ICs5NzAsNiBAQCBkZWYgd3JpdGVfbGF0ZXN0X3NyY3JldihkLCBwa2doaXN0ZGly
KToKICAgICAgICAgICAgICAgICBmb3IgbmFtZSwgc3JjcmV2IGluIHNvcnRlZCh0YWdfc3JjcmV2
cy5pdGVtcygpKToKICAgICAgICAgICAgICAgICAgICAgZi53cml0ZSgnIyB0YWdfJXMgPSAiJXMi
XG4nICUgKG5hbWUsIHNyY3JldikpCiAgICAgICAgICAgICAgICAgICAgIGlmIG5hbWUgaW4gb2xk
X3RhZ19zcmNyZXZzIGFuZCBvbGRfdGFnX3NyY3JldnNbbmFtZV0gIT0gc3JjcmV2OgotICAgICAg
ICAgICAgICAgICAgICAgICAgcGtnID0gZC5nZXRWYXIoJ1BOJykKICAgICAgICAgICAgICAgICAg
ICAgICAgIGJiLndhcm4oIlJldmlzaW9uIGZvciB0YWcgJXMgaW4gcGFja2FnZSAlcyB3YXMgY2hh
bmdlZCBzaW5jZSBsYXN0IGJ1aWxkIChmcm9tICVzIHRvICVzKSIgJSAobmFtZSwgcGtnLCBvbGRf
dGFnX3NyY3JldnNbbmFtZV0sIHNyY3JldikpCiAKICAgICBlbHNlOgo=
</data>

          </attachment>
      

    </bug>

</bugzilla>