Selaa lähdekoodia

build(deb): support webui-only builds against an older server

control.webui depended on smartbotic-vectorapi (>= {{VERSION}}), and
{{VERSION}} expands to the full upstream-revision. A webui revision bump
therefore demanded a matching server package, forcing a server rebuild
even for a static-asset change - and rebuilding the server relinks it
against whatever libsmartbotic-db-client the build base carries.

- add {{UPSTREAM_VERSION}} (version without the deb revision) and use it
  for the webui's dependency: the webui is Architecture: all with no ABI
  surface, so pinning it to the server's packaging revision was too tight
- add SKIP_SERVER_DEB=1 to build only the arch:all webui package, with no
  server binary required
fszontagh 1 kuukausi sitten
vanhempi
sitoutus
6ec8a29155
2 muutettua tiedostoa jossa 15 lisäystä ja 2 poistoa
  1. 14 1
      packaging/deb/create-debs.sh
  2. 1 1
      packaging/deb/templates/control.webui

+ 14 - 1
packaging/deb/create-debs.sh

@@ -35,7 +35,11 @@ calc_installed_size() {
 build_deb() {
     local pkg_name="$1" staging_dir="$2" arch="$3"
     local installed_size; installed_size="$(calc_installed_size "$staging_dir")"
-    sed -i -e "s/{{VERSION}}/${DEB_VERSION}/g" -e "s/{{INSTALLED_SIZE}}/${installed_size}/g" "$staging_dir/DEBIAN/control"
+    # {{VERSION}} is the full deb version (upstream-revision); {{UPSTREAM_VERSION}}
+    # omits the revision, for inter-package deps that track the API version rather
+    # than the packaging revision (lets the webui ship without bumping the server).
+    sed -i -e "s/{{VERSION}}/${DEB_VERSION}/g" -e "s/{{UPSTREAM_VERSION}}/${VERSION}/g" \
+           -e "s/{{INSTALLED_SIZE}}/${installed_size}/g" "$staging_dir/DEBIAN/control"
     find "$staging_dir" -type d -exec chmod 0755 {} +
     find "$staging_dir/DEBIAN" -type f -exec chmod 0644 {} +
     for f in postinst prerm postrm preinst; do
@@ -47,6 +51,14 @@ build_deb() {
 }
 
 # ---- Package 1: smartbotic-vectorapi (server) ----
+# SKIP_SERVER_DEB=1 builds only the arch:all webui package. Use when shipping a
+# webui-only change to a host whose server must not move (e.g. one pinned to an
+# older libsmartbotic-db-client — rebuilding the server against a newer client
+# would force that ABI upgrade).
+PKG1=""
+if [ "${SKIP_SERVER_DEB:-0}" = "1" ]; then
+    echo "--- smartbotic-vectorapi: SKIPPED (SKIP_SERVER_DEB=1) ---"
+else
 echo "--- smartbotic-vectorapi ---"
 PKG1="$(mktemp -d)"; trap 'rm -rf "$PKG1"' EXIT
 mkdir -p "$PKG1/DEBIAN" "$PKG1/usr/bin" "$PKG1/etc/smartbotic-vectorapi" \
@@ -66,6 +78,7 @@ cp "$SCRIPTS_DIR/server.prerm"    "$PKG1/DEBIAN/prerm"
 cp "$SCRIPTS_DIR/server.postrm"   "$PKG1/DEBIAN/postrm"
 printf '/etc/smartbotic-vectorapi/config.json\n' > "$PKG1/DEBIAN/conffiles"
 build_deb "smartbotic-vectorapi" "$PKG1" "amd64"
+fi
 
 # ---- Package 2: smartbotic-vectorapi-webui (static assets) ----
 echo "--- smartbotic-vectorapi-webui ---"

+ 1 - 1
packaging/deb/templates/control.webui

@@ -9,5 +9,5 @@ Description: Smartbotic VectorAPI — web administration console
 Homepage: https://smartbotics.ai
 Section: contrib/utils
 Priority: optional
-Depends: smartbotic-vectorapi (>= {{VERSION}})
+Depends: smartbotic-vectorapi (>= {{UPSTREAM_VERSION}})
 Installed-Size: {{INSTALLED_SIZE}}