Unverified Commit b9c53291 authored by Jon Seager's avatar Jon Seager
Browse files

multipass: 1.15.1 -> 1.16.0

This commit bumps Canonical Multipass to the
1.16.0 release.

As part of this release, the upstream now uses
upstream grpc, and thus some of the complexity
in the package can be dropped.

On this occasion, I have pulled a slightly newer
pubspec.yaml from the upstream that is yet to be
released which aided running the build with the
Flutter toolchain available in nixpkgs.
parent 203c39cc
Loading
Loading
Loading
Loading
+9 −4
Original line number Diff line number Diff line
@@ -5,7 +5,7 @@
  version,

  autoPatchelfHook,
  flutter327,
  flutter,
  gtkmm3,
  keybinder3,
  lib,
@@ -15,7 +15,7 @@
  protoc-gen-dart,
  qt6,
}:
flutter327.buildFlutterApplication {
flutter.buildFlutterApplication {
  inherit version;
  pname = "multipass-gui";
  src = multipass_src;
@@ -25,9 +25,9 @@ flutter327.buildFlutterApplication {
  pubspecLock = lib.importJSON ./pubspec.lock.json;

  gitHashes = {
    dartssh2 = "sha256-2pypKwurziwGLZYuGaxlS2lzN3UvJp3bRTvvYYxEqRI=";
    dartssh2 = "sha256-9XrxxOamy0uS7kUz6mwWwp4yIBHLX/GSoyxMk/Wwa+4=";
    hotkey_manager_linux = "sha256-aO0h94YZvgV/ggVupNw8GjyZsnXrq3qTHRDtuhNv3oI=";
    tray_menu = "sha256-riiAiBEms+9ARog8i+MR1fto1Yqx+gwbBWyNbNq6VTM=";
    tray_menu = "sha256-TAlRW7VkZWAoHAVlrPeDqS3BsqhQTyCekYQ2b4AEqjU=";
    window_size = "sha256-71PqQzf+qY23hTJvcm0Oye8tng3Asr42E2vfF1nBmVA=";
    xterm = "sha256-h8vIonTPUVnNqZPk/A4ZV7EYCMyM0rrErL9ZOMe4ZBE=";
  };
@@ -49,6 +49,11 @@ flutter327.buildFlutterApplication {
  ];

  preBuild = ''
    # Temporary fix which can be removed in the next release.
    # Already addressed upstream, but part of a larger patch
    # that did not trivially apply.
    substituteInPlace lib/main.dart --replace-fail 'TabBarTheme(' 'TabBarThemeData('

    mkdir -p lib/generated

    # Generate the Dart gRPC code for the Multipass GUI.
+4 −17
Original line number Diff line number Diff line
@@ -6,7 +6,9 @@
  cmake,
  dnsmasq,
  fetchFromGitHub,
  fmt_11,
  git,
  grpc,
  gtest,
  iproute2,
  iptables,
@@ -27,18 +29,6 @@
  xterm,
}:

let
  # This is done here because a CMakeLists.txt from one of it's submodules tries
  # to modify a file, so we grab the source for the submodule here, copy it into
  # the source of the Multipass project which allows the modification to happen.
  grpc_src = fetchFromGitHub {
    owner = "canonical";
    repo = "grpc";
    rev = "ba8e7f72a57b9e0b25783a4d3cea58c79379f194";
    hash = "sha256-DS1UNLCUdbipn5w4p2aVa8LgHHhdJiAfzfEdIXNO69o=";
    fetchSubmodules = true;
  };
in
stdenv.mkDerivation {
  inherit version;
  pname = "multipassd";
@@ -54,8 +44,6 @@ stdenv.mkDerivation {
    # in the Nix build environment. This patch disables the fetch in favour of providing
    # the googletest library from nixpkgs.
    ./cmake_no_fetch.patch
    # Ensures '-Wno-ignored-attributes' is supported by the compiler before attempting to build.
    ./cmake_warning.patch
    # As of Multipass 1.14.0, the upstream started using vcpkg for grabbing C++ dependencies,
    # which doesn't work in the nix build environment. This patch reverts that change, in favour
    # of providing those dependencies manually in this derivation.
@@ -83,9 +71,6 @@ stdenv.mkDerivation {
      --replace-fail "OVMF.fd" "${OVMF.fd}/FV/OVMF.fd" \
      --replace-fail "QEMU_EFI.fd" "${OVMF.fd}/FV/QEMU_EFI.fd"

    # Copy the grpc submodule we fetched into the source code.
    cp -r --no-preserve=mode ${grpc_src} 3rd-party/grpc

    # Configure CMake to use gtest from the nix store since we disabled fetching from the internet.
    cat >> tests/CMakeLists.txt <<'EOF'
      add_library(gtest INTERFACE)
@@ -111,6 +96,8 @@ stdenv.mkDerivation {
  cmakeFlags = [ "-DMULTIPASS_ENABLE_FLUTTER_GUI=false" ];

  buildInputs = [
    fmt_11
    grpc
    gtest
    libapparmor
    libvirt
+2 −2
Original line number Diff line number Diff line
@@ -9,13 +9,13 @@

let
  name = "multipass";
  version = "1.15.1";
  version = "1.16.0";

  multipass_src = fetchFromGitHub {
    owner = "canonical";
    repo = "multipass";
    rev = "refs/tags/v${version}";
    hash = "sha256-ckIvijNWav8gCL8b+Iw84tWS4cpTobJDdHwh/p+Y3NI=";
    hash = "sha256-7P7LZEvZ+ygM0G8C/gMIwq5BOSs4wSVEBNgsaZzBbOk=";
    fetchSubmodules = true;
  };

+1 −1

File changed.

Preview size limit exceeded, changes collapsed.

+3 −19
Original line number Diff line number Diff line
@@ -40,21 +40,6 @@ update_multipass_source() {
    sed -i "s|hash = \".*$|hash = \"${sri_hash}\";|" package.nix
}

# Update the version/hash of the grpc source code in the Nix expression.
update_grpc_source() {
    local version; version="$1"
    echo "Updating grpc source"

    submodule_info="https://raw.githubusercontent.com/canonical/multipass/refs/tags/v${version}/3rd-party/submodule_info.md"
    commit_short="$(curl -s "${submodule_info}" | grep -Po "CanonicalLtd/grpc/compare/v[0-9]+\.[0-9]+\.[0-9]+\.\.\K[0-9a-f]+")"
    commit_hash="$(curl -s "https://github.com/canonical/grpc/commits/${commit_short}" | grep -Po "${commit_short}[0-9a-f]+" | head -n1)"
    sri_hash="$(nix-prefetch-github canonical grpc --rev "${commit_hash}" --fetch-submodules | jq -r '.hash')"

    sed -i "s|rev = \".*$|rev = \"${commit_hash}\";|" multipassd.nix
    sed -i "s|hash = \".*$|hash = \"${sri_hash}\";|" multipassd.nix
}


LATEST_TAG="$(curl -s ${GITHUB_TOKEN:+-u ":$GITHUB_TOKEN"} https://api.github.com/repos/canonical/multipass/releases/latest | jq -r '.tag_name')"
LATEST_VERSION="$(expr "$LATEST_TAG" : 'v\(.*\)')"
CURRENT_VERSION="$(grep -Po "version = \"\K[^\"]+" package.nix)"
@@ -66,12 +51,11 @@ fi

update_pubspec_json "$LATEST_VERSION"

update_dart_pkg_hash dartssh2 andrei-toterman dartssh2
update_dart_pkg_hash hotkey_manager_linux andrei-toterman hotkey_manager
update_dart_pkg_hash tray_menu andrei-toterman tray_menu
update_dart_pkg_hash dartssh2 canonical dartssh2
update_dart_pkg_hash hotkey_manager_linux canonical hotkey_manager
update_dart_pkg_hash tray_menu canonical tray_menu
update_dart_pkg_hash window_size google flutter-desktop-embedding
update_dart_pkg_hash xterm levkropp xterm.dart

update_multipass_source "$LATEST_VERSION"
update_grpc_source "$LATEST_VERSION"
Loading