mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-12 04:35:41 +03:00
parent
699f04133b
commit
967137ab0e
4 changed files with 27 additions and 105 deletions
|
@ -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";
|
||||
|
|
|
@ -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{}
|
||||
}
|
|
@ -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 = [ ];
|
||||
}
|
||||
|
|
|
@ -16,10 +16,10 @@ args = parser.parse_args()
|
|||
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 @@ tags = [t.lstrip("v") for t in tags]
|
|||
|
||||
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 @@ print(f"Found new version {latest_version} > {current_version}")
|
|||
|
||||
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 @@ latest_vendor_hash = (
|
|||
.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")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue