Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Why recreate this PR (it is the same as #122)
We have found a race condition in freight so we are going to create a new PR to fix it. However, we didn't anticipate that freight's development will stay dormant for so long so we used master branch in the original PR. As such we have created a new branch to host this PR and keep master for our own use.
Background
We currently have an apt repo hosted on GitHub Pages. This was set up a long time ago and we are having multiple issues with it. Most importantly we are hitting GitHub Pages' storage quota.
Motivation of this PR
We ran out of space because we store identical copies of many packages for different distros, which is why we are very interested with
freight
since duplicated files are actually hard links, so no wasted spaces. Unfortunatelygit
only supports symbolic links, and treat hard links as separate files that happen to have identical content. As such this PR adds the functionality to create an apt repo with symbolic links.Compromise
We cannot only create symbolic link between
VARLIB
andVARCACHE
, since each distro inVARLIB
requires an copy of the package. As such we need to store all packages in a new locationVARPOOL
first, then bothVARLIB
andVARCACHE
are symbolic linked to this location.The current implementation has the unfortunate side-effect with package removal:
VARPOOL
?VARLIB
?VARCACHE
?VARPOOL
VARLIB
VARPOOL
VARCACHE
f-cache
This basically means
--keep
option is always on forfreight cache
sinceVARCACHE
is pointing atVARPOOL
. It is possible to makeVARCACHE
pointing atVARLIB
like the case with hard link, but that is equal to have--keep
option always off. Since the switch is gonna be broken either way we settle with the current implementation to have less complex code, and deleting an existing package then rebuilding index is easier than adding a package after the fact.Testing
Currently
bats-core
doesn't support loading test scripts, so we cannot have a file for generic tests and 2 files with differentsetup()
: 1 for hard link and 1 for symbolic link. Instead the same tests are run twice with different init arguments.3 tests are disabled for symbolic link repo: 1 for checking hard link is working, and 2 for
--keep
option which is broken here. All other tests passed.Sample use case
Currently there is a trivial testing repo already set up with this PR.