Repository navigation
Description
This issue was originally created at: 2010-03-04 07:54:44.
This issue was reported by: alterdepp.
alterdepp said at 2010-03-04 07:54:44
When I create a zip-file with the zip-builder I want to choose the relative source-dir of the contained source-files. I thought this would be possible with chdir:
env.Zip('b.zip', ['x/y/a.txt', 'x/y/z/b.txt'], chdir='x/y')
So the content of the zipfile b.zip should be:
- a.txt
- z/b.txt
Unfortunately the zip-builder did't work this way. I thought SCons will give the correct paths to the builder, but it doesn't. So I changed the builder to use relative paths for source-files and an absolute path for the target.
alterdepp said at 2010-03-04 07:55:33
Created an attachment (id=696)
Patch for tool/zip.py
gregnoel said at 2010-03-10 03:14:38
Bug party triage. Needs more discussion. Mark as 2.1 p2 so it will resurface as soon as the 2.0 conversion is done.
Synopsis of the alternatives:
Virtually all builders have problems when the chdir option is used. Names must be remapped relative to the new directory and such mapping is the user's responsibility. Therefore, this issue should be marked INVALID unless it's a solution that will work for all builders. (In particular, the patch likely won't work in the presence of repositories or a variant directory. And it's not clear what would happen if the same target file is used in multiple calls, each with a different chdir value.)
On the other hand, issue #1890 adds semantics to the Tar() builder such that a archive entry is specified as ('archive-name', 'actual-file'), where the first component is used for the name in the archive and the second is converted into a File node (if it isn't already) that provides the contents. A simple string is converted into a duple by copying the string into the first component and evaluating it via File() for the second. The Python zipfile module seems to offer similar functionality; the same strategy could be adopted and would provide functionality equivalent to that proposed, albeit somewhat verbosely.
Another option is to specify filenames as currently, but process files as in the previous alternative and use the chdir value to remap names relative to that directory. No chdir would actually be done, so the builder would be safe when the
--jobs=Ncommand-line option is used. This would probably require a new option to the Builder() function to identify which builders wanted to process the chdir option themselves.Lastly, proceed as in the previous alternative, but add a new verb so that it's clear(er) that no chdir takes place ('src_dir' was proposed as the verb for the directory root).
alterdepp said at 2010-03-10 08:02:04
I have variant directories and create a zipfile in each of them. Multiple calls, each with a different chdir value should work, too (not yet tested).
gregnoel said at 2010-07-21 17:06:14
Bug party triage. Assign to Greg to start a discussion on mailing list, then assign to Jason to implement the API that's the consensus of the discussion.
gregnoel said at 2010-07-23 20:19:07
Message to start discussion posted in developer mailing list[1].
[1] https://scons.tigris.org/ds/viewMessage.do?dsForumId=1268&dsMessageId=2637474 [tigris links no longer work]
Reassigning to Jason.
gregnoel said at 2010-09-06 13:04:38
Created an attachment (id=794)
zip of example files from tar builder
gregnoel said at 2010-09-27 18:03:38
Bug party triage. Review again three meeting hence.
gregnoel said at 2010-09-27 18:04:33
Bug party triage. Review again three meeting hence.
alterdepp attached zip.patch at 2010-03-04 07:55:33.
Patch for tool/zip.py
gregnoel attached greg.zip at 2010-09-06 13:04:38.
zip of example files from tar builder
Activity