RFE: automatic cache reuse
As discussed in apkg build MR, apkg
already caches outputs of individual steps (archive, source package) in pkg/
so these should be reused automatically when no changes were introduced to the project since their creation.
Following needs to be implemented:
a check for project changes
apkg
needs to know if project files changed since last package/source package/archive creation.
I'm thinking about adding a function to get current project checksum:
project.checksum()
This would work differently for git-managed repo and for projects without VCS (such as unpacked upstream tarball) so a new interface should be introduced for this along these lines:
vcs
├── git.py
├── hg.py
└── plain.py
apkg
would autodetect VCS used and compute project checksum using respective vcs.*
module. For projects without VCS, this would be done by checksuming entire project dir but excluding pkg/
:
# this but without pkg/
$ tar c . | md5sum
d0bdfdcebea3460de4a24062902b0669 -
save current project checksum and output filenames when creating archive/source package/package
On each successful creation of an archive, a source package, or a package, resulting output filename and current project checksum need to be saved.
Suggested locations:
pkg/cache/archives
pkg/cache/srcpkgs
pkg/cache/pkgs
reuse cached files when project checksum didn't change
make-archive
, srcpkg
, and build
should skip build and return cached files if the project checksum didn't change since their creation.
Caching can be disabled disabled using new --no-cache
.
Cache can be cleaned by deleting pkg
.