[BUG] (beta.1) `bpt repo import` leaks temp files
Playing around with a build from release/1.0.0-beta.1 I noticed that bpt repo import sometimes leaks temporary files in the repo directory:
mkdir repro && cd repro/
bpt new foo --dir=foo --split-src-include=false
bpt repo init ./repo --name test
bpt repo import ./repo foo/
# Now any of the below creates a new `bpt-tmp-*.tgz` in `$repo/pkg/`, each time it's run:
bpt repo import ./repo foo/
bpt repo import ./repo foo/ --if-exists=replace
The reason is that the temporary file is never removed when adding the package to the repository fails.
To prevent the same issue from occuring on invalid package revisions, the check of pkg.id.revision should probably happen before creating the temporary directory.
Possible improvement:
Create temporary files in $repo/tmp/ instead of $repo/pkg/. That way, repository maintenance can include just purging that directory without having to care about the actual names of temporary files.
Ah! You found the same bug I found earlier this week. I haven't pushed the fix yet, but I have fixed this in my local copy. There were/are several issues related to package revisions. It will need more polishing before 1.0.0 stable.