Warning: this is an htmlized version!
The original is across this link,
and the conversion rules are here.
#!/usr/bin/env lua51
-- flsfile.lua: extract the important files from a ".fls" file
-- See: (find-es "tex" "latex-recorder")
--      (find-angg ".zshrc" "flsfiles")
-- This file:
-- http://angg.twu.net/LUA/flsfiles.lua
-- http://angg.twu.net/LUA/flsfiles.lua.html
--  (find-angg        "LUA/flsfiles.lua")
-- Eduardo Ochs, 2016feb17
-- Public domain.

--                                 _     _      
--  _ __  _ __ ___  __ _ _ __ ___ | |__ | | ___ 
-- | '_ \| '__/ _ \/ _` | '_ ` _ \| '_ \| |/ _ \
-- | |_) | | |  __/ (_| | | | | | | |_) | |  __/
-- | .__/|_|  \___|\__,_|_| |_| |_|_.__/|_|\___|
-- |_|                                          
--
-- See: (find-es "lua5" "getdefs")

readfile = function (fname)
    local f = assert(io.open(fname, "r"))
    local bigstr = f:read("*a")
    f:close()
    return bigstr
  end
ee_readfile  = function (fname) return readfile(ee_expand(fname)) end
split = function (str, pat)
    local arr = {}
    string.gsub(str, pat or "([^%s]+)", function (word)
        table.insert(arr, word)
      end)
    return arr
  end
ee_expand = function (path)
    path = string.gsub(path, "^~$", "$HOME/", 1)
    path = string.gsub(path, "^~/", "$HOME/", 1)
    path = string.gsub(path, "^%$(%w+)", os.getenv, 1)
    return path
  end
Set = Class {
  type    = "Set",
  new = function () return Set {_={}} end,
  from = function (L) return Set.fromarray(L) end,
  fromarray = function (L)
      local C = Set.new()
      for i,v in ipairs(L) do C._[v]=v end
      return C
    end,
  __add = function (A, B)   -- union
      local C = Set.new()
      for k,v in pairs(A._) do C._[v]=v end
      for k,v in pairs(B._) do C._[v]=v end
      return C
    end,
  __sub = function (A, B)   -- difference
      local C = Set.new()
      for k,v in pairs(A._) do C._[v]=v end
      for k,v in pairs(B._) do C._[v]=nil end
      return C
    end,
  __mul = function (A, B)     -- intersection
      local C = Set.new()
      for k,v in pairs(A._) do if B._[v] then C._[v]=v end end
      return C
    end,
  __len = function (A) print"!" return #(keys(A._)) end,  -- number of elements
  __tostring = function (A)
      return "(Set with "..A:n().." elements)"
    end,
  --
  -- Methods
  __index = {
    has = function (A, k) return A._[k] end,
    n   = function (A) return #keys(A._) end,
    k   = function (A) return  keys(A._) end,
    ks  = function (A) return sorted(keys(A._)) end,
    ksc = function (A, sep) return table.concat(A:ks(), sep or "\n") end,
    gen = function (A)
        return cow(function ()
            for i,v in ipairs(A:ks()) do coy(v) end
          end)
      end,
    add = function (A, key, val)
        A._[key] = val or key
        return A
      end,
    del = function (A, key)
        A._[key] = nil
        return A
      end,
  },
}
coy = coroutine.yield
cow = coroutine.wrap


--  _               _       
-- | |__   ___   __| |_   _ 
-- | '_ \ / _ \ / _` | | | |
-- | |_) | (_) | (_| | |_| |
-- |_.__/ \___/ \__,_|\__, |
--                    |___/ 

flsfiles_nontrivial0 = function (bigstr)
    return cow(function ()
        for li in bigstr:gmatch "[^\n]+" do
          local fn = li:match("^INPUT (.*)")
          if fn and
             not fn:match "/usr/share/" and
             not fn:match "/%.texmf%-var/" and
             not fn:match "%.aux$" and
             not fn:match "%.out$" and
             true
          then
            if fn:match "^%./" then fn = fn:sub(3) end
            coy(fn)
          end
        end
      end)
  end
flsfiles_nontrivial = function (fname)
    return flsfiles_nontrivial0(ee_readfile(fname))
  end
flsfiles_nontrivialset = function (fname)
    local s = Set:new()
    for fn in flsfiles_nontrivial(fname) do s:add(fn) end
    return s
  end

local fname = ...
if fname then
  local s = flsfiles_nontrivialset(fname)
  print(s:ksc())
end

--[[
-- Tests etc
-- (find-LATEX "2015-2-GA-P1-gab.tex")
-- (find-LATEX "2015-2-GA-P1-gab.fls")
-- (find-LATEX "2015-2-GA-P1-gab.files")

* (eepitch-lua51)
* (eepitch-kill)
* (eepitch-lua51)
dofile "flsfiles.lua"
s = flsfiles_nontrivialset "~/LATEX/2015-2-GA-P1-gab.fls"
= s:ksc()
= s:del("/home/edrx/dednat6/dednat6.lua"):ksc()

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
~/LUA/flsfiles.lua ~/LATEX/2015-2-GA-P1-gab.fls |
  grep -v "^/" |
  tee ~/LATEX/2015-2-GA-P1-gab.files

cd ~/LATEX/
zip 2015-2-GA-P1-gab.zip $(~/LUA/flsfiles.lua 2015-2-GA-P1-gab.fls | grep -v "^/")
tar -cvzf 2015-2-GA-P1-gab.tgz $(~/LUA/flsfiles.lua 2015-2-GA-P1-gab.fls | grep -v "^/")
tar -cvzf 2015-2-GA-P1-gab.tgz $(flsfiles 2015-2-GA-P1-gab.fls | grep -v "^/")

# (find-angg ".zshrc" "flsfiles")
cd ~/LATEX/
flsfiles     2015-2-GA-P1-gab.fls
flsfiles-tgz 2015-2-GA-P1-gab.fls 2015-2-GA-P1-gab.tgz
flsfiles-zip 2015-2-GA-P1-gab.fls 2015-2-GA-P1-gab.zip

~/LUA/flsfiles.lua ~/LATEX/2015-2-GA-P1-gab.fls |
  grep -v "^/" |
  tee ~/LATEX/2015-2-GA-P1-gab.files

rm -v   /tmp/z.zip
rm -Rfv /tmp/z/
mkdir   /tmp/z/
cd ~/LATEX/
zip     /tmp/z.zip $(cat 2015-2-GA-P1-gab.files)
cd      /tmp/z/
unzip -d /tmp/z/ /tmp/z.zip
lualatex 2015-2-GA-P1-gab.tex

# (find-fline "/tmp/")
# (find-fline "/tmp/z/")
# (find-fline "/tmp/z.zip")
# (find-man "unzip")
# (find-sh "cd /tmp/z/ && grep diagxy $(find * -type f)")
# (find-sh "cd /tmp/z/ && grep edrxdnt $(find * -type f)")


--]]


-- Local Variables:
-- coding: raw-text-unix
-- End: