Patchwork [v2] log_srcrev.bbclass: add a bbclass for logging SRCREVs

login
register
mail settings
Submitter Constantin Musca
Date Feb. 26, 2013, 3:04 p.m.
Message ID <1361891080-5035-1-git-send-email-constantinx.musca@intel.com>
Download mbox | patch
Permalink /patch/45131/
State New
Headers show

Comments

Constantin Musca - Feb. 26, 2013, 3:04 p.m.
- add a task which creates a file for each package with the following
format:

${BB_FILENAME},${SRC_URI},${SRCREV},${FROM_AUTOREV}

[YOCTO #3041]

Signed-off-by: Constantin Musca <constantinx.musca@intel.com>
---
 meta/classes/log_srcrev.bbclass | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
 create mode 100644 meta/classes/log_srcrev.bbclass
Otavio Salvador - Feb. 26, 2013, 4:56 p.m.
On Tue, Feb 26, 2013 at 12:04 PM, Constantin Musca
<constantinx.musca@intel.com> wrote:
> - add a task which creates a file for each package with the following
> format:
>
> ${BB_FILENAME},${SRC_URI},${SRCREV},${FROM_AUTOREV}
>
> [YOCTO #3041]
>
> Signed-off-by: Constantin Musca <constantinx.musca@intel.com>

What is the use-case for this?
Saul Wold - Feb. 26, 2013, 5:25 p.m.
On 02/26/2013 08:56 AM, Otavio Salvador wrote:
> On Tue, Feb 26, 2013 at 12:04 PM, Constantin Musca
> <constantinx.musca@intel.com> wrote:
>> - add a task which creates a file for each package with the following
>> format:
>>
>> ${BB_FILENAME},${SRC_URI},${SRCREV},${FROM_AUTOREV}
>>
>> [YOCTO #3041]
>>
>> Signed-off-by: Constantin Musca <constantinx.musca@intel.com>
>
> What is the use-case for this?
>
I could reply with see bug #3041!

There is a need to have the actual SRCREVs from AUTOREV'ed package 
version, so a build can be reproduced at a later date or so you know 
what SRCREV went into a given release.

Sau!
Otavio Salvador - Feb. 26, 2013, 5:33 p.m.
On Tue, Feb 26, 2013 at 2:25 PM, Saul Wold <sgw@linux.intel.com> wrote:
> On 02/26/2013 08:56 AM, Otavio Salvador wrote:
>>
>> On Tue, Feb 26, 2013 at 12:04 PM, Constantin Musca
>> <constantinx.musca@intel.com> wrote:
>>>
>>> - add a task which creates a file for each package with the following
>>> format:
>>>
>>> ${BB_FILENAME},${SRC_URI},${SRCREV},${FROM_AUTOREV}
>>>
>>> [YOCTO #3041]
>>>
>>> Signed-off-by: Constantin Musca <constantinx.musca@intel.com>
>>
>>
>> What is the use-case for this?
>>
> I could reply with see bug #3041!
>
> There is a need to have the actual SRCREVs from AUTOREV'ed package version,
> so a build can be reproduced at a later date or so you know what SRCREV went
> into a given release.

I know I could read the bug but this ought to be in commit log. It
seems like a buildhistory thing from my POV, not another class thingy.

Patch

diff --git a/meta/classes/log_srcrev.bbclass b/meta/classes/log_srcrev.bbclass
new file mode 100644
index 0000000..d5d0284
--- /dev/null
+++ b/meta/classes/log_srcrev.bbclass
@@ -0,0 +1,15 @@ 
+python do_log_srcrev () {
+    srcrev = d.getVar('SRCREV', True)
+    if srcrev:
+        bbfile = d.getVar('BB_FILENAME', True)
+        src_uri = d.getVar('SRC_URI', True)
+        from_autorev = 'yes' if d.getVar('SRCREV', False) == 'AUTOINC' else 'no'
+
+        srcrevfile = d.expand('${TMPDIR}/srcrevs/${MULTIMACH_TARGET_SYS}/${BP}-${PV}')
+        bb.utils.mkdirhier(os.path.dirname(srcrevfile))
+
+        with open(srcrevfile, 'w') as f:
+            f.write(','.join([bbfile, src_uri, srcrev, from_autorev]))
+}
+
+addtask do_log_srcrev after do_fetch