From: Tobias Ulmer Date: Wed, 23 Apr 2014 14:48:25 +0000 (+0200) Subject: Check types of unpack, copy and patch and allow only one per file entry X-Git-Tag: e2factory-2.3.15rc1~206 X-Git-Url: https://git.e2factory.org/?a=commitdiff_plain;h=bdf431c7177ce3a95296dcccdd5fa97ebdad65b1;p=e2factory.git Check types of unpack, copy and patch and allow only one per file entry Signed-off-by: Tobias Ulmer --- 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",