summaryrefslogtreecommitdiff
path: root/setup.lua
diff options
context:
space:
mode:
authorMichael Forney <mforney@mforney.org>2020-06-21 15:53:13 -0700
committerMichael Forney <mforney@mforney.org>2020-06-22 22:47:59 -0700
commitdead52fd1cd62afe00663acab1091d01f10f0300 (patch)
treea101fcf0b3c674f4765e99b8196eb91a78347323 /setup.lua
parentadc036f58ed4722f363abebce69223af9059b0ad (diff)
Only update local.fspec if the contents changed
Diffstat (limited to 'setup.lua')
-rwxr-xr-xsetup.lua12
1 files changed, 10 insertions, 2 deletions
diff --git a/setup.lua b/setup.lua
index 0ffad7cf..40f2dd82 100755
--- a/setup.lua
+++ b/setup.lua
@@ -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