From 33b49685e863aac16b071bfde551e63d257fbcce Mon Sep 17 00:00:00 2001 From: Tobias Ulmer Date: Thu, 6 Feb 2014 12:13:40 +0100 Subject: [PATCH] LicenceID includes the licence name Makes no sense to hash it twice. Fixes bz#124 Signed-off-by: Tobias Ulmer --- plugins/collect_project.lua | 3 --- plugins/files.lua | 10 ++++------ plugins/git.lua | 9 ++++----- 3 files changed, 8 insertions(+), 14 deletions(-) diff --git a/plugins/collect_project.lua b/plugins/collect_project.lua index a98c096..3ab8f5e 100644 --- a/plugins/collect_project.lua +++ b/plugins/collect_project.lua @@ -156,9 +156,6 @@ local function collect_project_resultid(info, resultname) if not rc then return nil, re end end for _,l in ipairs(licence.licences_sorted) do - rc, re = hash.hash_line(hc, l:get_name()) - if not rc then return nil, re end - -- We collect all licences. So we cannot be sure to catch -- them via results/sources. Include them explicitly here. local lid, re = l:licenceid(info) diff --git a/plugins/files.lua b/plugins/files.lua index c214adc..41a748e 100644 --- a/plugins/files.lua +++ b/plugins/files.lua @@ -495,14 +495,12 @@ function files.sourceid(info, sourcename, sourceset) hash.hash_line(hc, src.name) hash.hash_line(hc, src.type) hash.hash_line(hc, src._env:id()) - for _,l in ipairs(src.licences) do - local alicence = licence.licences[l] - hash.hash_line(hc, l) - local licenceid, re = alicence:licenceid(info) - if not licenceid then + for _,ln in ipairs(src.licences) do + local lid, re = licence.licences[ln]:licenceid(info) + if not lid then return false, re end - hash.hash_line(hc, licenceid) + hash.hash_line(hc, lid) end for _,f in ipairs(src.file) do local fileid, re = e2tool.fileid(info, f) diff --git a/plugins/git.lua b/plugins/git.lua index 6382373..7fb5c45 100644 --- a/plugins/git.lua +++ b/plugins/git.lua @@ -536,13 +536,12 @@ function git.sourceid(info, sourcename, sourceset) hash.hash_line(hc, src.name) hash.hash_line(hc, src.type) hash.hash_line(hc, src._env:id()) - for _,l in ipairs(src.licences) do - hash.hash_line(hc, l) -- XXX: redundant - local licenceid, re = licence.licences[l]:licenceid(info) - if not licenceid then + for _,ln in ipairs(src.licences) do + local lid, re = licence.licences[ln]:licenceid(info) + if not lid then return false, re end - hash.hash_line(hc, licenceid) + hash.hash_line(hc, lid) end -- git specific --hash.hash_line(hc, src.branch) -- 2.39.5