dbrgn / heroku-buildpack-python-sklearn

Python buildpack with Numpy 1.7.0, SciPy 0.11.0 and a current version of Scikit-learn.
MIT License
31 stars 28 forks source link

Buildpack incompatible with building in /app ("cp: cannot stat '/app/!(tmp)': No such file or directory") #12

Open edmorley opened 3 years ago

edmorley commented 3 years ago

Hi

I'm on the team that maintains Heroku's build system and official buildpacks, and wanted to let you know about a future incompatibility with this buildpack.

The directory in which the Heroku build system performs builds is currently a path like/tmp/build_<hash>.

In the near future this path will be changing to /app so that the build-time and run-time app locations are the same path - in order to resolve a number of long standing bugs, and reduce the number of hacks buildpacks have to use to work around non-relocatable languages/toolchains.

Once this change comes into effect this buildpack will error like so:

remote: -----> Python app detected
remote: cp: cannot stat '/app/!(tmp)': No such file or directory

This is because the buildpack tries to move the contents of /app to a temporary location, followed by moving BUILD_DIR (which is now /app) into /app.

To reproduce, the new behaviour can be enabled manually (ahead of it being the new default), using:

heroku labs:enable build-in-app-dir -a my_app_name

To fix, the file moves (at both the start and end of the build) need to be put behind a conditional that first checks if BUILD_DIR is already /app: https://github.com/dbrgn/heroku-buildpack-python-sklearn/blob/bd938080ddc2bb396bf0798496b5f8d14cdcfed7/bin/compile#L42-L55 https://github.com/dbrgn/heroku-buildpack-python-sklearn/blob/bd938080ddc2bb396bf0798496b5f8d14cdcfed7/bin/compile#L202-L203

dbrgn commented 3 years ago

Hi @edmorley. Thanks for the information! I haven't touched this repository in years, it's not maintained anymore. README links to a fork that used to be active, not sure if it still is.

I'll archive the repo to avoid future confusion.

Cheers!