serpent-os/boulder-d-legacy

Implement git as an upstream source

Closed this issue · 2 comments

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 plain git command. The process of fetching would look like this:

  1. 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,
    1. 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.
    2. 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.
    3. If any of the above step fails, then report the user about it, delete the directory, and continue as if nothing happened.
  2. git clone --recursive-submodules ...
  3. git checkout $REQUESTED_REF
  4. The rest will be the same as the plain source.

I'd be glad to implement this if accepted.

Ikey proposed the option to mirror the approach used by Avalanche on Matrix, so closing.

ermo commented

This is not in yet?