]> git.e2factory.org Git - e2factory.git/commitdiff
Check types of unpack, copy and patch and allow only one per file entry
authorTobias Ulmer <tu@emlix.com>
Wed, 23 Apr 2014 14:48:25 +0000 (16:48 +0200)
committerTobias Ulmer <tu@emlix.com>
Wed, 16 Nov 2016 14:41:17 +0000 (15:41 +0100)
Signed-off-by: Tobias Ulmer <tu@emlix.com>
plugins/files.lua

index 7367c87a552f4f6bb3ecd9adbd1b9b4123e922b9..89c33b3589dcc428b9aeee98d36f295982b94c4c 100644 (file)
@@ -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",