Closed hongquan closed 5 years ago
Done. The method is to:
Reserve a folder on RPi to store Pip cache. My convention is, if the working folder of buildkite-agent is /var/lib/buildkite-agent/builds/quan-pi-one-2/fossasia/build-susibian, the pip cache folder will be /var/lib/buildkite-agent/builds/quan-pi-one-2/fossasia/Pip-cache.
Update pi-gen to accept an environment variable, $DIR_CACHE_PIP
, which points to that folder. When the variable is not empty, pi-gen will mount (with bind
method) that folder to [build-folder]/rootfs/root/.cache/pip. Because pi-gen
will run our susi_linux install script in chroot environment, our script (and pip
) will see the location as /root/.cache/pip and save cache there. When the install script finishes, the cache folder is unmounted.
Currently, the OS image building process takes sometimes to download and install Python packages. I think we can reduce build time by caching downloaded Python packages (in ~/.cache/pip). Note that those cached files won't be included in the final image.