From 967137ab0e6e548df055f9c553f0c548c6435e3c Mon Sep 17 00:00:00 2001 From: "Adam C. Stephens" Date: Fri, 13 Dec 2024 08:58:09 -0500 Subject: [PATCH] incus: 6.7.0 -> 6.8.0 https://github.com/lxc/incus/releases/tag/v6.8.0 --- nixos/tests/incus/incusd-options.nix | 2 +- pkgs/by-name/in/incus/1377-reverse.patch | 77 ------------------------ pkgs/by-name/in/incus/package.nix | 8 +-- pkgs/by-name/in/incus/update.py | 45 +++++++------- 4 files changed, 27 insertions(+), 105 deletions(-) delete mode 100644 pkgs/by-name/in/incus/1377-reverse.patch diff --git a/nixos/tests/incus/incusd-options.nix b/nixos/tests/incus/incusd-options.nix index 634d236b05d9f..494abd1549d3f 100644 --- a/nixos/tests/incus/incusd-options.nix +++ b/nixos/tests/incus/incusd-options.nix @@ -18,7 +18,7 @@ import ../make-test-python.nix ( container-image-metadata = "${ releases.incusContainerMeta.${pkgs.stdenv.hostPlatform.system} - }/tarball/nixos-system-${pkgs.stdenv.hostPlatform.system}.tar.xz"; + }/tarball/nixos-image-lxc-*-${pkgs.stdenv.hostPlatform.system}.tar.xz"; container-image-rootfs = "${ releases.incusContainerImage.${pkgs.stdenv.hostPlatform.system} }/nixos-lxc-image-${pkgs.stdenv.hostPlatform.system}.squashfs"; diff --git a/pkgs/by-name/in/incus/1377-reverse.patch b/pkgs/by-name/in/incus/1377-reverse.patch deleted file mode 100644 index 860b8693271ce..0000000000000 --- a/pkgs/by-name/in/incus/1377-reverse.patch +++ /dev/null @@ -1,77 +0,0 @@ ---- b/internal/server/device/tpm.go -+++ a/internal/server/device/tpm.go -@@ -202,13 +202,11 @@ - }, - } - -+ proc, err := subprocess.NewProcess("swtpm", []string{"socket", "--tpm2", "--tpmstate", fmt.Sprintf("dir=%s", tpmDevPath), "--ctrl", fmt.Sprintf("type=unixio,path=%s", socketPath)}, "", "") -- proc, err := subprocess.NewProcess("swtpm", []string{"socket", "--tpm2", "--tpmstate", fmt.Sprintf("dir=%s", tpmDevPath), "--ctrl", fmt.Sprintf("type=unixio,path=swtpm-%s.sock", d.name)}, "", "") - if err != nil { - return nil, err - } - -- proc.Cwd = tpmDevPath -- - // Start the TPM emulator. - err = proc.Start(context.Background()) - if err != nil { ---- b/internal/server/instance/drivers/driver_qemu.go -+++ a/internal/server/instance/drivers/driver_qemu.go -@@ -3668,7 +3668,7 @@ - - // Add TPM device. - if len(runConf.TPMDevice) > 0 { -+ err = d.addTPMDeviceConfig(&cfg, runConf.TPMDevice) -- err = d.addTPMDeviceConfig(&cfg, runConf.TPMDevice, fdFiles) - if err != nil { - return "", nil, err - } -@@ -4852,7 +4852,7 @@ - return monHook, nil - } - -+func (d *qemu) addTPMDeviceConfig(cfg *[]cfgSection, tpmConfig []deviceConfig.RunConfigItem) error { --func (d *qemu) addTPMDeviceConfig(cfg *[]cfgSection, tpmConfig []deviceConfig.RunConfigItem, fdFiles *[]*os.File) error { - var devName, socketPath string - - for _, tpmItem := range tpmConfig { -@@ -4863,16 +4863,9 @@ - } - } - -- fd, err := unix.Open(socketPath, unix.O_PATH, 0) -- if err != nil { -- return err -- } -- -- tpmFD := d.addFileDescriptor(fdFiles, os.NewFile(uintptr(fd), socketPath)) -- - tpmOpts := qemuTPMOpts{ - devName: devName, -+ path: socketPath, -- path: fmt.Sprintf("/proc/self/fd/%d", tpmFD), - } - *cfg = append(*cfg, qemuTPM(&tpmOpts)...) - ---- b/shared/subprocess/proc.go -+++ a/shared/subprocess/proc.go -@@ -27,7 +27,6 @@ - Name string `yaml:"name"` - Args []string `yaml:"args,flow"` - Apparmor string `yaml:"apparmor"` -- Cwd string `yaml:"cwd"` - PID int64 `yaml:"pid"` - Stdin io.ReadCloser `yaml:"-"` - Stdout io.WriteCloser `yaml:"-"` -@@ -154,11 +153,6 @@ - cmd.Stderr = p.Stderr - cmd.Stdin = p.Stdin - cmd.SysProcAttr = p.SysProcAttr -- -- if p.Cwd != "" { -- cmd.Dir = p.Cwd -- } -- - if cmd.SysProcAttr == nil { - cmd.SysProcAttr = &syscall.SysProcAttr{} - } diff --git a/pkgs/by-name/in/incus/package.nix b/pkgs/by-name/in/incus/package.nix index 65985513e517e..551987d1c16e1 100644 --- a/pkgs/by-name/in/incus/package.nix +++ b/pkgs/by-name/in/incus/package.nix @@ -1,6 +1,6 @@ import ./generic.nix { - hash = "sha256-k7DHJRbhUJwamEOW8B7wdCWQyYEUtsIHwuHh20lpLmA="; - version = "6.7.0"; - vendorHash = "sha256-u12zYcKiHNUH1kWpkMIyixtK9t+G4N2QerzOGsujjFQ="; - patches = [ ./1377-reverse.patch ]; + hash = "sha256-Ir+cT+2xA+L4kBXhwA0XXE/D8zjMPGYiwW0VrEdobZ4="; + version = "6.8.0"; + vendorHash = "sha256-CDLq41AB2Y9nYlTuXZaAOgwXIin9CbqSXCFoigsc14A="; + patches = [ ]; } diff --git a/pkgs/by-name/in/incus/update.py b/pkgs/by-name/in/incus/update.py index 1db118a596f91..e0a23f2fd65fb 100755 --- a/pkgs/by-name/in/incus/update.py +++ b/pkgs/by-name/in/incus/update.py @@ -16,10 +16,10 @@ nixpkgs_path = os.environ["PWD"] attr = "incus" -file = f"pkgs/by-name/in/incus/package.nix" +file = "pkgs/by-name/in/incus/package.nix" if args.lts: attr = "incus-lts" - file = f"pkgs/by-name/in/incus/lts.nix" + file = "pkgs/by-name/in/incus/lts.nix" tags = ( run(["list-git-tags", "--url=https://github.com/lxc/incus"], capture_output=True) @@ -30,7 +30,7 @@ latest_version = "0" for tag in tags: - if args.regex != None and not re.match(args.regex, tag): + if args.regex is not None and not re.match(args.regex, tag): continue if LooseVersion(tag) > LooseVersion(latest_version): @@ -53,23 +53,19 @@ run(["update-source-version", attr, latest_version, f"--file={file}"]) -current_vendor_hash = ( - run( - [ - "nix-instantiate", - ".", - "--eval", - "--strict", - "-A", - f"{attr}.goModules.drvAttrs.outputHash", - "--json", - ], - capture_output=True, +file_content: str + +with open(file, "r+") as f: + file_content = f.read() + file_content = re.sub( + 'vendorHash = "sha256-.*"', + 'vendorHash = "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="', + file_content, ) - .stdout.decode("utf-8") - .strip() - .strip('"') -) + f.seek(0) + f.write(file_content) + +print("Generating new vendorHash") latest_vendor_hash = ( run( @@ -80,8 +76,11 @@ .strip() ) -with open(file, "r+") as f: - file_content = f.read() - file_content = re.sub(current_vendor_hash, latest_vendor_hash, file_content) - f.seek(0) +file_content = file_content.replace( + "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=", latest_vendor_hash +) + +with open(file, "w") as f: f.write(file_content) + +print("Done")