diff options
| author | Natanael Copa <ncopa@alpinelinux.org> | 2017-03-06 13:29:25 +0100 |
|---|---|---|
| committer | Natanael Copa <ncopa@alpinelinux.org> | 2017-03-06 13:29:25 +0100 |
| commit | 2812dcb4e38e73d8397defe3b86fcc807d60080b (patch) | |
| tree | f43ce96c0705faa8a63b88a6d7718d91a9157651 /secfixes.lua | |
| parent | fb1827e5935350f20d11f2663f53ee7e9b65db9f (diff) | |
| download | alpine-secdb-2812dcb4e38e73d8397defe3b86fcc807d60080b.tar.bz2 alpine-secdb-2812dcb4e38e73d8397defe3b86fcc807d60080b.tar.xz | |
add sanity check of generated yaml
Diffstat (limited to 'secfixes.lua')
| -rw-r--r-- | secfixes.lua | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/secfixes.lua b/secfixes.lua index a9fb853..8dbe71d 100644 --- a/secfixes.lua +++ b/secfixes.lua @@ -40,10 +40,29 @@ function arch_list(a) return str end +function verify_yaml(file) + f = io.open(file) + if f == nil then + return 1 + end + print("Verifying "..file) + local data = yaml.load(f:read("*all")) + for _,p in pairs(data.packages) do + assert(type(p.pkg.name) == "string") + for k,v in pairs(p.pkg.secfixes) do + assert(type(k) == "string", file..": "..p.pkg.name..": not a string: "..tostring(k)) + assert(string.match(k, "^[0-9]+")) + end + end + + f:close() +end + opthelp = [[ --repo=REPO set repository --release=VERSION distro release branch + --verify=FILE verify generated yaml ]] archs = { @@ -55,6 +74,10 @@ archs = { opts, args = require('optarg').from_opthelp(opthelp) +if opts.verify then + os.exit(verify_yaml(opts.verify)) +end + repo = (opts.repo or "main") distroversion = (opts.release or "v3.4") |
