Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
nielsreijers opened this issue Apr 9, 2024 · 1 comment
Open

Comments

@nielsreijers
Copy link
Contributor

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:

  • A simple git fetch --tags https://github.com/canonical/multipass.git seems sufficient to pull the upstream tags into the forked repository, so the "Building" section in README.md could be expanded with something like:

If you're working on a forked repository:

cd <multipass>
git fetch --tags https://github.com/canonical/multipass.git
  • Alternatively the CMake process could probably be modified to ignore the version number if tags are not available or set it to some dummy value. But I'm not 100% sure since I don't know if it's being used for more than just setting the output of multipass --version.

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

@nielsreijers nielsreijers added documentation needs triage Issue needs to be triaged labels Apr 9, 2024
@luis4a0
Copy link
Contributor

luis4a0 commented Apr 15, 2024

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!

@townsend2010 townsend2010 removed the needs triage Issue needs to be triaged label Apr 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants