[build2] Overriding repository location locally

Boris Kolpackov boris at codesynthesis.com
Thu Oct 4 07:41:48 UTC 2018


Per Edin <per.edin at sequence-point.se> writes:

> Is it possible to override a repository path locally? E.g. when working
> offline and a working copy of libhello.git##HEAD is available in
> ~/dev/libhello.

Yes, though there are several slightly different ways to do it
depending on what exactly you are trying to achieve.

Firstly, if you are planning to develop libhello, then you should
just initialize the local clone with bdep-init(1) in the same build
configuration as discussed in "Developing Multiple Packages and
Projects":

https://build2.org/build2-toolchain/doc/build2-toolchain-intro.xhtml#guide-dev-multi

Now, if you just want to use a local cache of libhello, there are two
further options: you can treat it as a local git repository, in which
case the build configuration will have a copy of the libhello package
(just like in the remote repository case). Alternatively, you can treat
it as a local package, in which case the build configuration will "track"
any changes (such as pulls, checkouts, etc) that you make to the local
clone.

Here is an example that shows how to achieve both setups. We first
start with building hello which pulls libhello 1.1.0 from the remote
repository:

$ git clone https://git.build2.org/hello/hello.git
$ cd hello/
$ bdep init -C @gcc cc config.cxx=g++
...
synchronizing:
  new libformat/1.0.0 (required by libhello)
  new libprint/1.0.0 (required by libhello)
  new libhello/1.1.0 (required by hello)
  new hello/1.0.0
...

Now we clone the libhello repository and then use bpkg(1) to replace
the libhello package with the local copy. For interest's sake, let's
replace it with version 1.0.0:

$ cd ../
$ git clone -b 1.0 https://git.build2.org/hello/libhello.git

As a local git repository (copying):

$ bpkg build -d hello-gcc -c libhello/1.0.0 at libhello/
...
  drop libprint/1.0.0 (unused)
  drop libformat/1.0.0 (unused)
  downgrade libhello/1.0.0
  reconfigure hello (dependent of libhello)
...

Or as a package directory (tracking):

$ bpkg build -d hello-gcc -c libhello/libhello/
...
  drop libprint/1.0.0 (unused)
  drop libformat/1.0.0 (unused)
  downgrade libhello/1.0.0
  reconfigure hello (dependent of libhello)
...



More information about the users mailing list