canonical / multipass

Multipass orchestrates virtual Ubuntu instances
https://multipass.run
GNU General Public License v3.0
7.76k stars 642 forks source link

Building a forked repository doesn't work because of missing tags #3476

Closed nielsreijers closed 2 months ago

nielsreijers commented 5 months ago

Description of documentation issue or suggestion I made a fork of multipass and tried to build it using the instructions in the README.md. This failed on the cmake ../ step because forking the repository doesn't copy tags.

The issue is in the root CMakeLists.txt which contains the following lines

    126   execute_process(COMMAND git describe --long
    127                   WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
    128                   OUTPUT_VARIABLE GIT_VERSION
    129                   OUTPUT_STRIP_TRAILING_WHITESPACE)
...
    156   string(REGEX MATCH "^v.+-([0-9]+)-(g.+)$" GIT_VERSION_MATCH ${GIT_VERSION})

Since the forked repo has no tags, git describe --long doesn't return anything, and we get an error on line 156:

CMake Error at CMakeLists.txt:156 (string):
  string sub-command REGEX, mode MATCH needs at least 5 arguments total to
  command.

Proposal to fix issue or enact suggestion Forking a repository and trying to build it seems like a common case, so I think it should be possible (without debugging the build process), but there could be two ways to support it:

If you're working on a forked repository:

cd <multipass>
git fetch --tags https://github.com/canonical/multipass.git

Additional context I could send a PR for either, but would like to know the maintainers preferred approach would be here.

luis4a0 commented 5 months ago

Hi @nielsreijers, AFAIK tags are not automatically forked. I think the correct solution would be to document the command to fetch the tags to the build document. We'll take care of that soon. Thanks for reporting!