Inside the git cache directory (/var/cache/boulder/upstreams/git), different sources will be split into different folders similar to how Go downloads modules (e.g. github.com/serpent-os/moss -> /var/cache/boulder/upstreams/git/github.com/serpent-os/moss, invent.kde.org/graphics/krita -> /var/cache/boulder/upstreams/git/invent.kde.org/graphics/krita).
Running git
The libgit2 bindings for D seem to be inactive for a long time, so I would consider just running the plain git command. The process of fetching would look like this:
Parse the corresponding directory to store the source (/var/cache/boulder/upstreams/git/github.com/serpent-os/moss) and check if it exists already. If it doesn't, go to step 2 directly. If it does,
git restore . && git clean -xf . to remove any unwanted extra files if the build files were able to get into this directory. Even if they can't, I think it's still worth running this just to be safe.
git fetch to pull in any latest commits and refs. This also serves as a check that this repository upstream is still valid and reachable after the last build.
If any of the above step fails, then report the user about it, delete the directory, and continue as if nothing happened.
Here are my ideas on how this will work:
Directory Layout
Inside the git cache directory (
/var/cache/boulder/upstreams/git
), different sources will be split into different folders similar to how Go downloads modules (e.g.github.com/serpent-os/moss
->/var/cache/boulder/upstreams/git/github.com/serpent-os/moss
,invent.kde.org/graphics/krita
->/var/cache/boulder/upstreams/git/invent.kde.org/graphics/krita
).Running git
The
libgit2
bindings for D seem to be inactive for a long time, so I would consider just running the plaingit
command. The process of fetching would look like this:/var/cache/boulder/upstreams/git/github.com/serpent-os/moss
) and check if it exists already. If it doesn't, go to step 2 directly. If it does,git restore . && git clean -xf .
to remove any unwanted extra files if the build files were able to get into this directory. Even if they can't, I think it's still worth running this just to be safe.git fetch
to pull in any latest commits and refs. This also serves as a check that this repository upstream is still valid and reachable after the last build.git clone --recursive-submodules ...
git checkout $REQUESTED_REF
I'd be glad to implement this if accepted.