From bdf431c7177ce3a95296dcccdd5fa97ebdad65b1 Mon Sep 17 00:00:00 2001 From: Tobias Ulmer Date: Wed, 23 Apr 2014 16:48:25 +0200 Subject: [PATCH] Check types of unpack, copy and patch and allow only one per file entry Signed-off-by: Tobias Ulmer --- plugins/files.lua | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/plugins/files.lua b/plugins/files.lua index 7367c87..89c33b3 100644 --- a/plugins/files.lua +++ b/plugins/files.lua @@ -100,10 +100,28 @@ function files.validate_source(info, sourcename) e:append("source has file entry for remote file without `sha1` ".. "attribute") end - if not (f.unpack or f.copy or f.patch) then + + local attrcnt = 0 + for _,attr in ipairs({"unpack", "copy", "patch"}) do + if f[attr] ~= nil then + attrcnt = attrcnt + 1 + + if type(f[attr]) ~= "string" then + e:append("'%s' in file entry of source must be a string", attr) + break + end + + end + end + + if attrcnt == 0 then e:append("source has file entry without `unpack, copy or patch' " .. - "attribute") + "attribute") + elseif attrcnt > 1 then + e:append("source has file entry with conflicting unpack, copy or".. + " patch attributes") end + if f.checksum_file then e2lib.warnf("WDEPRECATED", "in source %s:", sourcename) e2lib.warnf("WDEPRECATED", -- 2.39.5