-
-
Notifications
You must be signed in to change notification settings - Fork 324
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] Install() and InstallAs() migrated to using a command generator as default #3573
base: master
Are you sure you want to change the base?
Conversation
…LLDIRCOPY for use by Install() and InstallAs()
…LLDIRCOPY for use by Install() and InstallAs() and purged platform specific settings from install.py
…s() logic to use a generator to create the command. Break out variables for INSTALL{FILE,DIR}COPY[FLAGS] as a different command is run by default for copying files and directories. Some doc updates.
Tagging @chasinglogic as it was originally his PR. |
src/engine/SCons/Tool/install.py
Outdated
if len(target) == 1: | ||
copyingdirs = [s for s in source if s.isdir()] | ||
if copyingdirs: | ||
return '$INSTALLDIRCOPY $INSTALLDIRCOPYFLAGS $SOURCES/ $TARGET' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if the /
is necessary? It seems like it could lead to some weird situations when there are more than one source.
env.Install(
target="public",
source=[
"web/html",
"web/js",
"web/css",
]
)
Would expand to something like cp --recursive web/js web/html web/css/ public
? Which would still work but it would also work without this weird extra slash.
It's possible depending on how you want this to work you may need to specify $TARGET/
however.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had /. instead of /'s in my local changes. I just pushed them..
(As advised by: https://unix.stackexchange.com/questions/412259/how-can-i-copy-a-directory-and-rename-it-in-the-same-command )
The current /.'s allow install and installAs to work as they did previously.
And with your example above it works as expected:
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
cp --preserve=all --recursive web/css/. public/css
cp --preserve=all --recursive web/html/. public/html
cp --preserve=all --recursive web/js/. public/js
scons: done building targets.
$ tree web/
web/
├── css
│ ├── file1
│ ├── file2
│ └── subdir
│ └── file3
├── html
│ ├── file1
│ ├── file2
│ └── subdir
│ └── file3
└── js
├── file1
├── file2
└── subdir
└── file3
$ tree public/
public/
├── css
│ ├── file1
│ ├── file2
│ └── subdir
│ └── file3
├── html
│ ├── file1
│ ├── file2
│ └── subdir
│ └── file3
└── js
├── file1
├── file2
└── subdir
└── file3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
<para> | ||
Flags to add to the command line for copying a file as part of the Install() and InstallAs() builders. | ||
</para> | ||
<para> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should there be an explanation of why these flags were chosen? (i.e. to preserve ownership and permission modes)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good. Adding.
One other thought (probably outside the scope of these changes) we've been talking about how to do privileged installations similar to a We considered creating a new Alternatively it could be left as an exercise for the user to use an OverrideEnvironment like so:
But that's obviously slightly less ergonomic (it doesn't even handle Windows) and requires more intimate knowledge of the implementation for the Install builder. |
@chasinglogic - yup I think privileged install is outside the scope. But that said with these changes users can now set the appropriate variables and it's possible. |
This is really a philosophy thing: should a build tool ever do priviliged stuff? I'd personally hope - never. |
…alized linux copy flags from platform/linux to install.py
… few tests where outputs changed
…nstall-as-command
…opying INSTALLFILECOPY into INSTALLDIRCOPYFLAGS should have been INSTALLFILECOPYFLAGS
@chasinglogic - I can't get the windows version of this to work. When it calls xcopy to copy a single file it's always prompting:
Did you run into this? |
…permissions/etc match source..
Hey @bdbaddog sorry for the slow turn around was moving to another country :D It seems like you figured it out already |
Per discussion with @bdbaddog, I think having a separate overridable copy operation for directories isn't something that should be included. Imagine I want my install to be a tree of symlinks. If I override |
@bdbaddog - I'm revising my prior statement. I never had too much time to discuss this change with @chasinglogic, but I think there are three things going on here:
Given that, I think it is important that customization for both file installation and directory installation be provided. If we only provided the customization for file installation, and implemented directory installation via a python function that used the file installation customization, then the Ninja layer would still be unable to see how directories were to be installed. I'll take a look through this review with an eye towards whether the current state meets these needs and think about what I would like the final shape to look like. |
@acmorrow that's summed up perfectly |
Much of the difficulty with this review is that the code reformatting has made it look much more complex than it really is. |
@acmorrow - thoughts? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FWIW this LGTM. It accomplishes almost all of the goals the original work set out to.
The only outlier is the installVersionedLib which I seem to remember there being a good reason to leave it as a Python func (and really isn't important for Ninja anyway).
There's lots of commented out code that should be cleaned up IMO (didn't comment on all of it). But this looks like it should be merged to me.
type = 'file' | ||
return 'Install %s: "%s" as "%s"' % (type, source, target) | ||
|
||
# def stringFunc(target, source, env): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should probably just delete this?
Continue the work from PR #3535
Benchmark vs original logic
Using MongoDB's install-all-meta which does a lot of real world install calls (insert # here)
Win32
on NVME SSD
on HD
Contributor Checklist:
master/src/CHANGES.txt
directory (and read theREADME.txt
in that directory)