-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Include HOME in build environment #2582
Conversation
The need to copy things in and out of the container so it can run as the real kivy user is a burden. In fact, the only reason you need to do this is because p4a and other tools store intermediate outputs in the user's home directory instead of in the current directory. Instead, we can fake that by running the container as the current user and setting the HOME environment variable to a writable location in the container. Furthermore, we can mount a volume at this path and cache all of those outputs. Once the container is running as the current user, usage is much simpler as we don't need to worry about ownership of files. The source directory can be mounted directly into the container and made the current working directory. Then the container environment behaves almost exactly like running the commands directly in the current directory. We don't need a user inside the container or have to copy the source tree into the image. This depends on p4a passing through the HOME environment variable during builds. See kivy/python-for-android#2582.
Anything I can do to help this along? Would a test help? |
Hi @dbnicholson !
Feel free to ping me as soon you're ready! |
Ok, I'll beef up the comment. |
0fb489f
to
e4e7546
Compare
Many of the tools run by p4a store intermediate files in the user's home directory. Passing the HOME environment variable to the build environment has 2 positive effects: 1. To completely encapsulate the build, HOME can be set to an alternate directory than the user's actual home directory. Many tools such as p4a have options to override these paths, but that must be done on a case by case basis and it would require that p4a pass through these options or environment variables. 2. In containerized environments the user may not be registered in the accounts database. If the user's home directory can't be found from the HOME environment variable or the accounts database, many tools will fail. An example of this is python2.7 when run by `ndk-build`.
e4e7546
to
c03108b
Compare
Ready for review again. Thanks! |
Oh yeah, showed up on my notifications 4 minutes ago! 😄 Let's wait for the CI to complete 🏁 |
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. Thank you!
Many of the tools run by p4a store intermediate files in the user's home directory. Passing the HOME environment variable to the build environment has 2 positive effects: 1. To completely encapsulate the build, HOME can be set to an alternate directory than the user's actual home directory. Many tools such as p4a have options to override these paths, but that must be done on a case by case basis and it would require that p4a pass through these options or environment variables. 2. In containerized environments the user may not be registered in the accounts database. If the user's home directory can't be found from the HOME environment variable or the accounts database, many tools will fail. An example of this is python2.7 when run by `ndk-build`. (cherry picked from commit 6cf8604)
Many of the tools run by p4a store intermediate files in the user's home directory. Passing the HOME environment variable to the build environment has 2 positive effects: 1. To completely encapsulate the build, HOME can be set to an alternate directory than the user's actual home directory. Many tools such as p4a have options to override these paths, but that must be done on a case by case basis and it would require that p4a pass through these options or environment variables. 2. In containerized environments the user may not be registered in the accounts database. If the user's home directory can't be found from the HOME environment variable or the accounts database, many tools will fail. An example of this is python2.7 when run by `ndk-build`.
Many of the tools run by p4a store intermediate files in the user's home
directory. Passing the HOME environment variable to the build
environment has 2 positive effects:
To completely encapsulate the build, HOME can be set to an alternate
directory than the user's actual home directory. Many tools such as
p4a have options to override these paths, but that must be done on a
case by case basis and it would require that p4a pass through these
options or environment variables.
In containerized environments the user may not be registered in the
accounts database. If the user's home directory can't be found from
the HOME environment variable or the accounts database, many tools
will fail. An example of this is python2.7 when run by
ndk-build
.I don't know if this is the best place to put this, but it seemed the most common location where the build environment is setup.