kerl cleanup doesn't seem to work as described
I might be misunderstanding, but it looks like I should be able to use kerl cleanup on a specific version:
$ ./kerl cleanup
usage: ./kerl cleanup <build_name|all>
However when I run kerl cleanup 20.1, it looks like it removes the entire builds directory:
$ ls -1 .kerl/builds/
20.1
20.2
$ ./kerl cleanup 20.1
Cleaning up compilation products for
Cleaned up compilation products for under /opt/erlang/.kerl/builds
$ ls .kerl/builds
ls: cannot access .kerl/builds: No such file or directory
$ ls .kerl/
archives otp_builds otp_installations otp_releases
I'm using kerl 1.8.1 on CentOS 7.4
$ ./kerl version
1.8.1
$ lsb_release -a
LSB Version: :core-4.1-amd64:core-4.1-noarch
Distributor ID: CentOS
Description: CentOS Linux release 7.4.1708 (Core)
Release: 7.4.1708
Codename: Core
Thanks!
Yikes. Thanks for the note. Definitely need to figure out what's going on here.
So it looks like a simple fix: https://github.com/bmaupin/kerl/commit/921744ea158734a9b7260781d7561746bc08189d
But now it creates 2 more issues:
-
The build folder's deleted but the corresponding entry in the
otp_buildsfile isn't removed. So this prevents that build from being rerun again after being cleaned up:$./kerl build 20.0 20.0 ... $ ./kerl cleanup 20.0 Cleaning up compilation products for 20.0 Cleaned up compilation products for 20.0 under /opt/app/erlang/.kerl/builds $ ./kerl build 20.0 20.0 There's already a build named 20.0 $ cat .kerl/otp_builds 20.0,20.0That's also a simple fix: https://github.com/bmaupin/kerl/commit/b91ccb7fbfe67e36eb38ce1050bf9666ee63c2a5
-
kerl cleanup 20.0doesn't do anything other than delete the build directory. Looking at the source forkerl cleanup all, it looks like it should also clean out the download/git folders, but this would require adding logic for the correct filename patterns to delete.I started working on the logic but it's messy and I wasn't able to finish because it looks like the Git URL would be needed for a proper full cleanup:
if [ "$KERL_BUILD_BACKEND" = "git" ]; then rm "${KERL_DOWNLOAD_DIR:?}/$(make_filename "$rel")" else rm "${KERL_DOWNLOAD_DIR:?}/otp_src_$rel" fi GIT=$(echo -n <git_url> | $MD5SUM | cut -d ' ' -f $MD5SUM_FIELD) rm -rf "${KERL_GIT_DIR:?}/$GIT"
So to sum up: kerl cleanup all works fine, but kerl cleanup 20.0 does even less than kerl delete 20.0 and causes additional problems. I'm not sure what's the best way to move forward.
So sorry about the ridiculous time lag here, but would you consider opening a PR for your modifications so far? I think we could work through a way forward and close this ticket and #263.
Thanks
No worries! I just rebased my fork with the latest changes and created PR #272.
Thanks!
Thank you!