johnerichumphries / fabricate

Automatically exported from code.google.com/p/fabricate
0 stars 1 forks source link

In theory, anything listing a directory should have all filenames of that directory as a dependency. #46

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
A command might do "gcc -c *.c". If a new file is added to that directory, it 
should cause re-running the gcc command.

For the strace runner, this could be achieved by tracking 'getdents' and 
similar syscalls, and recording in the dependencies that the command depends on 
the directory entries of the directory.

However, implementing this is probably somewhat difficult, and might cause a 
lot of spurious dependencies.

Original issue reported on code.google.com by nuutti.k...@gmail.com on 6 Jul 2013 at 6:27

GoogleCodeExporter commented 9 years ago
Do you have a concrete case where tracking file opens doesn't work? Until I see 
one, I'd be disinclined to implement this.

Original comment by pjimen...@gmail.com on 9 Jul 2013 at 9:43

GoogleCodeExporter commented 9 years ago
Added an example build script. Uncommenting the 'baz' line will cause the 
'baz.txt' file to be added but does not cause rerunning of the zip command.

Original comment by nuutti.k...@gmail.com on 9 Jul 2013 at 11:42

Attachments:

GoogleCodeExporter commented 9 years ago
Just use:

def package():
    files = glob.glob('*.txt')
    run('7z', 'a', 'pkg.zip', *files, shell=True)

Then the command changes if the directory contents change.

Making a default dependency on *everything* inside *every* directory opened can 
make huge unnecessary dependencies.

Original comment by ele...@gmail.com on 9 Jul 2013 at 11:56

GoogleCodeExporter commented 9 years ago
Not default dependency on everything inside every directory, but only those 
directories for which "readdir" (or "getdents" as the syscall is) has been 
called.

Also, in my real use case, the command is "ipkg_build" which takes a directory 
instead a list of files, so I can not easily give all the files separately.

Original comment by nuutti.k...@gmail.com on 9 Jul 2013 at 12:00