facebook / watchman

Watches files and records, or triggers actions, when they change.

Home Page:https://facebook.github.io/watchman/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`watchman --version` always return `0.0.0` when building from source

derfsubterfuge opened this issue · comments

I'm on Fedora 39. I followed the build from source instructions and augmented them with the final steps of prebuilt binaries. Whenever I run watchman --version I get 0.0.0 instead of the actual version. How do I correct this? Do I need to add a version.txt file somewhere?

Commands that I ran:

  # From build from source
  WATCHMAN_VERSION="v2024.03.25.00"
  WATCHMAN_BUILD_DIR="$(mktemp -d)"
  cd $WATCHMAN_BUILD_DIR
  wget "https://github.com/facebook/watchman/archive/refs/tags/$WATCHMAN_VERSION.tar.gz"
  tar -xvzf "$WATCHMAN_VERSION.tar.gz"
  cd "watchman-$(echo $WATCHMAN_VERSION | sed 's/v//g')"
  sudo dnf install -y cargo
  sudo ./install-system-packages.sh
  ./autogen.sh

  # From prebuilt binaries
  cd built
  sudo mkdir -p /usr/local/{bin,lib} /usr/local/var/run/watchman
  sudo cp bin/* /usr/local/bin
  sudo cp lib/* /usr/local/lib
  sudo chmod 755 /usr/local/bin/watchman
  sudo chmod 2777 /usr/local/var/run/watchman

  # Cleanup
  cd "$HOME"
  rm -rf $WATCHMAN_BUILD_DIR

  # Version command that returns 0.0.0
  watchman --version

You can override by setting WATCHMAN_VERSION_OVERRIDE to the desired version. See

watchman/CMakeLists.txt

Lines 92 to 103 in 4744a9d

# A nonsensical version that doesn't correspond to any manually
# released version.
set(PACKAGE_VERSION "0.0.0")
set(WATCHMAN_VERSION_OVERRIDE "" CACHE STRING "Use this version code for \
Watchman version instead of the default computed from the repo")
set(WATCHMAN_BUILDINFO_OVERRIDE "" CACHE STRING "Use this version code for \
Watchman build info instead of the default (nothing)")
if (WATCHMAN_VERSION_OVERRIDE)
set(PACKAGE_VERSION "${WATCHMAN_VERSION_OVERRIDE}")
elseif(DEFINED ENV{WATCHMAN_VERSION_OVERRIDE})
set(PACKAGE_VERSION "$ENV{WATCHMAN_VERSION_OVERRIDE}")
.

Fedora linux

Similar issue on Fedora

# dnf info watchman
Last metadata expiration check: 0:05:38 ago on Wed 17 Apr 2024 06:21:34 AM UTC.
Installed Packages
Name         : watchman
Version      : 2021.05.10.00
Release      : 24.fc39
Architecture : x86_64
Size         : 1.5 M
Source       : watchman-2021.05.10.00-24.fc39.src.rpm
Repository   : @System
From repo    : updates
Summary      : File alteration monitoring service
URL          : https://facebook.github.io/watchman/
License      : Apache-2.0
Description  : Watchman exists to watch files and record when they actually change. It can also
             : trigger actions (such as rebuilding assets) when matching files change.
# watchman --version
0.0.0

Package info shows that version is 2021.05.10.00, but watchman itself shows 0.0.0.