[CXX-2004] Makepkg fails on Archlinux Created: 22/Apr/20  Updated: 27/Oct/23  Resolved: 22/Apr/20

Status: Closed
Project: C++ Driver
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: John Chen (Inactive) Assignee: Unassigned
Resolution: Works as Designed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends

 Description   

Not entirely sure if this is a build team problem or not but one of the steps we run in our Archlinux build images is to install the mongo-cxx-driver.

We install it via Ansible, which runs commands similar to the following:

curl -O -L https://aur.archlinux.org/cgit/aur.git/snapshot/mongo-cxx-driver.tar.gz
tar -zxvf mongo-cxx-driver.tar.gz
cd mongo-cxx-driver
makepkg -si --noconfirm

This outputs the following error:

fatal: not a git repository (or any of the parent directories): .git
Traceback (most recent call last):
  File "etc/calc_release_version.py", line 171, in <module>
    RELEASE_VER = main()
  File "etc/calc_release_version.py", line 108, in main
    head_tag_ver = check_head_tag()
  File "etc/calc_release_version.py", line 68, in check_head_tag
    tags = check_output(['git', 'tag', '-l']).split()
  File "etc/calc_release_version.py", line 46, in check_output
    return subprocess.check_output(args)
  File "/usr/lib/python3.8/subprocess.py", line 411, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "/usr/lib/python3.8/subprocess.py", line 512, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['git', 'tag', '-l']' returned non-zero exit status 128.
CMake Error at CMakeLists.txt:162 (message):
  BUILD_VERSION not specified and could not be calculated (script invocation
  failed); specify in CMake command, -DBUILD_VERSION=<version>

I looked into the

etc/calc_release_version.py

file and it looks like it's trying to run

git tag -l

, but there doesn't seem to be a .git directory present. Should there be a .git directory present or is there something else I'm missing?



 Comments   
Comment by Roberto Sanchez [ 22/Apr/20 ]

The C++ Driver expects that it will be built in one of two ways:

  1. From a cloned working directory of the mongodb/mongo-cxx-driver Git project
  2. From an extracted directory of the published release tarball

The Arch package lists as its source the Github archive of the repository at the tag of the release version. However, by using the archive of the repository, it attempts to build from a source tree that does not meet either of the above criteria. The correct solution would be for the Arch maintainers to update the package to reference the correct download artifact:

diff --git a/PKGBUILD b/PKGBUILD
index 868777c..536bf83 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -12,8 +12,8 @@ depends=(libmongoc libbson)
 makedepends=(cmake gcc libmongoc libbson boost)
 provides=(libbsoncxx libmongocxx)
 conflicts=(libbsoncxx libmongocxx)
-source=(https://github.com/mongodb/mongo-cxx-driver/archive/r${pkgver}.tar.gz)
-sha256sums=('2a61369e616c4c08310586c339a27bddee0482305e1dcc83ce08e3529cfa5b7a')
+source=(https://github.com/mongodb/mongo-cxx-driver/releases/download/r${pkgver}/mongo-cxx-driver-r${pkgver}.tar.gz)
+sha256sums=('046395b5b03c7b3298adc9cfe2c3e4dd97784d6eaa58b83193d150f05a6b6b82')
 
 build() {
        cd "${pkgname}-r$pkgver/build/"

Alternately, specifying the build version will allow the build to complete with the currently configured artifact:

diff --git a/PKGBUILD b/PKGBUILD
index 868777c..9ca67c2 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -22,6 +22,7 @@ build() {
         -DCMAKE_INSTALL_PREFIX=/usr/ \
         -DCMAKE_CXX_STANDARD=17 \
         -DBSONCXX_POLY_USE_BOOST=1 \
+        -DBUILD_VERSION=${pkgver} \
         ../
        make
 }

Generated at Wed Feb 07 22:04:35 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.