I'm using fabricate to, among the more usual software build activities, download and compile an embedded development toolchain. Consequently, there are several instances where I os.chdir into a directory and run('make'). Unfortunately, fabricate doesn't seem to distinguish a 'make' run in one directory (binutils) from a make run in another (gcc) and doesn't run the latter.First, does fabricate have any features that allow me to do what I'm trying to do? or am I don't something wrong?
Looking at the .deps file (which, oddly enough, it seems that fabricate dumps in the cwd the first time run() is executed, which could be brittle if you os.chdir much), it seems that the commands aren't distinguished at all based on which directory they're run in. So I did a quick hack to rectify this and modified two lines of code in fabricate.py so that the command key is now composed of the 'os.cwd() + command'.So second, is this hack on the right track? Another, perhaps better approach, would be to have a .deps file in each working directory.
--Thanks,Greg
You received this message because you are subscribed to the Google Groups "fabricate users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fabricate-use...@googlegroups.com.
To post to this group, send email to fabrica...@googlegroups.com.
Visit this group at http://groups.google.com/group/fabricate-users.
For more options, visit https://groups.google.com/groups/opt_out.
Looking at the .deps file (which, oddly enough, it seems that fabricate dumps in the cwd the first time run() is executed, which could be brittle if you os.chdir much), it seems that the commands aren't distinguished at all based on which directory they're run in. So I did a quick hack to rectify this and modified two lines of code in fabricate.py so that the command key is now composed of the 'os.cwd() + command'.So second, is this hack on the right track?
The .deps file is placed in the directory where the command is run. Fabricate is not a recursive builder, it runs from the top level and uses only one .deps file for a build.
On Sat, Oct 26, 2013 at 5:06 PM, Lex Trotman <ele...@gmail.com> wrote:
[...]Looking at the .deps file (which, oddly enough, it seems that fabricate dumps in the cwd the first time run() is executed, which could be brittle if you os.chdir much), it seems that the commands aren't distinguished at all based on which directory they're run in. So I did a quick hack to rectify this and modified two lines of code in fabricate.py so that the command key is now composed of the 'os.cwd() + command'.So second, is this hack on the right track?oops forgot to say this is completely wrong, the command recorded in the .deps no longer matches the command in the run() call so fabricate will *always* re-run the command.CheersLexI tried to cover all my bases in that regard. I had it alter the command both when recording the deps, as well as when comparing them. But something isn't working right.
Thanks for letting me know I could do run("cd dir; command..."). I didn't know that.
I naively tried run('cd','dir') which didn't work (and doesn't make much sense anyway), which is why I resorted to os.chdir.
--
Actually I forgot the command is run by strace, not a shell, so you need to run it in a shell I think, eg run('bash -c "cd xxx;make"')
On Sat, Oct 26, 2013 at 9:29 PM, Lex Trotman <ele...@gmail.com> wrote:
Actually I forgot the command is run by strace, not a shell, so you need to run it in a shell I think, eg run('bash -c "cd xxx;make"')
yuck.
Actually I forgot the command is run by strace, not a shell, so you need to run it in a shell I think, eg run('bash -c "cd xxx;make"')
Good point. I don't think that was the original intent of shell= so it could probably be fixed.
Actually I forgot the command is run by strace, not a shell, so you need to run it in a shell I think, eg run('bash -c "cd xxx;make"')
If you wanted to do that, wouldn't you use: run("cd xxx; make", shell=True)I think that only runs the strace command in a shell, not the command that strace runs.If I read the code right, the arguments to run are appended to an strace command at fabricate.py:546 call to the function shell(), so the shell=True will apply to the strace, not the arguments to strace.
Prior to running make, I also run 'configure'. I need to see if it has a similar switch.
You received this message because you are subscribed to a topic in the Google Groups "fabricate users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/fabricate-users/zbKeCZKz_BA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to fabricate-use...@googlegroups.com.
I am hoping to address this issue at some point. If I understand correctly it would be solved by implementing a fix for Issue 44 https://code.google.com/p/fabricate/issues/detail?id=44
def toolchain():# binutilsmkdir('downloads')with temp_chdir('downloads'):run('tar','xf','binutils-{}.tar.gz'.format(BINUTILS))with temp_chdir('binutils-{}'.format(BINUTILS)):mkdir('build')with temp_chdir('build'):run('../configure','--prefix={}'.format(BIN_DIR),'--target=arm-none-eabi','--enable-languages=c','--disable-libssp')run('make')run('make','install')