diff options
| author | Michael Forney <mforney@mforney.org> | 2020-06-21 15:53:13 -0700 |
|---|---|---|
| committer | Michael Forney <mforney@mforney.org> | 2020-06-22 22:47:59 -0700 |
| commit | dead52fd1cd62afe00663acab1091d01f10f0300 (patch) | |
| tree | a101fcf0b3c674f4765e99b8196eb91a78347323 | |
| parent | adc036f58ed4722f363abebce69223af9059b0ad (diff) | |
Only update local.fspec if the contents changed
| -rwxr-xr-x | setup.lua | 12 |
1 files changed, 10 insertions, 2 deletions
@@ -87,8 +87,11 @@ local function gen(gendir) f:close() end if next(pkg.fspec) then - local f = assert(io.open(outdir..'/local.fspec', 'w')) - for path, fspec in pairs(pkg.fspec) do + local out = outdir..'/local.fspec' + local tmp = out..'.tmp' + local f = assert(io.open(tmp, 'w')) + for _, path in ipairs(table.keys(pkg.fspec)) do + local fspec = pkg.fspec[path] f:write(('/%s\n'):format(path)) for _, k in ipairs{'type', 'mode', 'source', 'target'} do local v = fspec[k] @@ -99,6 +102,11 @@ local function gen(gendir) f:write('\n') end f:close() + if os.execute(('exec cmp -s %s %s'):format(tmp, out)) then + os.remove(tmp) + else + os.rename(tmp, out) + end table.insert(pkg.inputs.fspec, '$outdir/local.fspec') end if next(pkg.inputs.perms) then |
