docker: switch to ubuntu:24.04 as base image

Change-Id: I6b7b8b4875e6f850e8ff2e26ca1cc106d5df455a
diff --git a/Dockerfile b/Dockerfile
index 14a5c65..c5833b6 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,7 +1,6 @@
 # syntax=docker/dockerfile:1
 
-FROM ubuntu:23.10 AS build
-ARG SOURCE_DATE_EPOCH
+FROM ubuntu:24.04 AS build
 
 RUN apt-get install -Uy --no-install-recommends \
         dpkg-dev \
@@ -18,11 +17,11 @@
         libssl-dev \
         pkgconf \
         python3 \
-    # use 'apt-get distclean' when we upgrade to ubuntu:24.04
-    && rm -rf /var/lib/apt/lists/*
+    && apt-get distclean
 
 ARG JOBS
-RUN --mount=type=bind,rw,target=/src <<EOF
+ARG SOURCE_DATE_EPOCH
+RUN --mount=rw,target=/src <<EOF
 set -eux
 cd /src
 ./waf configure \
@@ -35,7 +34,6 @@
     --enable-shared
 ./waf build
 ./waf install
-
 mkdir -p /deps/debian
 touch /deps/debian/control
 cd /deps
@@ -43,13 +41,13 @@
     | sed -n 's|^shlibs:Depends=||p' | sed 's| ([^)]*),\?||g' > ndn-cxx
 EOF
 
-FROM ubuntu:23.10 AS runtime
-ARG SOURCE_DATE_EPOCH
 
-RUN --mount=type=bind,from=build,source=/deps,target=/deps \
+FROM ubuntu:24.04 AS runtime
+
+RUN --mount=from=build,source=/deps,target=/deps \
     apt-get install -Uy --no-install-recommends $(cat /deps/ndn-cxx) \
-    && rm -rf /var/lib/apt/lists/*
+    && apt-get distclean
 
-RUN --mount=type=bind,from=build,source=/usr,target=/build \
+RUN --mount=from=build,source=/usr,target=/build \
     cp -av /build/lib/libndn-cxx.so.* /usr/lib/ \
     && cp -av /build/bin/ndnsec* /usr/bin/
diff --git a/wscript b/wscript
index 732b516..0f0ea01 100644
--- a/wscript
+++ b/wscript
@@ -374,10 +374,12 @@
         cmd = ['git', 'describe', '--abbrev=8', '--always', '--match', f'{GIT_TAG_PREFIX}*']
         version_from_git = subprocess.run(cmd, capture_output=True, check=True, text=True).stdout.strip()
         if version_from_git:
-            if version_from_git.startswith(GIT_TAG_PREFIX):
-                Context.g_module.VERSION = version_from_git.lstrip(GIT_TAG_PREFIX)
+            if GIT_TAG_PREFIX and version_from_git.startswith(GIT_TAG_PREFIX):
+                Context.g_module.VERSION = version_from_git[len(GIT_TAG_PREFIX):]
+            elif not GIT_TAG_PREFIX and ('.' in version_from_git or '-' in version_from_git):
+                Context.g_module.VERSION = version_from_git
             else:
-                # no tags matched
+                # no tags matched (or we are in a shallow clone)
                 Context.g_module.VERSION = f'{VERSION_BASE}+git.{version_from_git}'
     except (OSError, subprocess.SubprocessError):
         pass