dependency.lua

Sun, 13 Sep 2009 22:22:47 +0300

author
Tuomo Valkonen <tuomov@iki.fi>
date
Sun, 13 Sep 2009 22:22:47 +0300
changeset 3
b2df1b3f2c83
child 7
038275cd92ed
permissions
-rw-r--r--

Improvements

3
b2df1b3f2c83 Improvements
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
1
b2df1b3f2c83 Improvements
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
2 module("dependency", package.seeall)
b2df1b3f2c83 Improvements
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
3
b2df1b3f2c83 Improvements
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
4 require('lfs')
b2df1b3f2c83 Improvements
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
5
b2df1b3f2c83 Improvements
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
6 function simple_update_check(tgt, srcs)
b2df1b3f2c83 Improvements
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
7 local a=lfs.attributes(tgt)
b2df1b3f2c83 Improvements
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
8 if not a then
b2df1b3f2c83 Improvements
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
9 return true
b2df1b3f2c83 Improvements
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
10 end
b2df1b3f2c83 Improvements
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
11 for _, src in ipairs(srcs) do
b2df1b3f2c83 Improvements
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
12 local b=lfs.attributes(src)
b2df1b3f2c83 Improvements
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
13 if not b or b.modification > a.modification then
b2df1b3f2c83 Improvements
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
14 return true
b2df1b3f2c83 Improvements
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
15 end
b2df1b3f2c83 Improvements
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
16 end
b2df1b3f2c83 Improvements
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
17 return false
b2df1b3f2c83 Improvements
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
18 end

mercurial