nlewo / nix2container

An archive-less dockerTools.buildImage implementation
Apache License 2.0
501 stars 45 forks source link

Skopeo fails to patch on nixos-unstable with skopeo 1.14.0 #100

Closed jbott closed 9 months ago

jbott commented 9 months ago

Nixpkgs recently upgraded skopeo to 1.14.0, which breaks the included patch:

skopeo> unpacking sources
skopeo> unpacking source archive /nix/store/aa75mxj8bkh5dh7f4rrxii58sc9j1js1-source
skopeo> source root is source
skopeo> patching sources
skopeo> updateAutotoolsGnuConfigScriptsPhase
skopeo> configuring
skopeo> building
skopeo> patching file nix/transport.go
skopeo> patching file transports/alltransports/alltransports.go
skopeo> Hunk #1 FAILED at 14.
skopeo> 1 out of 1 hunk FAILED -- saving rejects to file transports/alltransports/alltransports.go.rej

It seems upstream modified the alltransports.go file slightly (commit) so the included patch context is no longer correct.

Current context

    _ "github.com/containers/image/v5/openshift"
    _ "github.com/containers/image/v5/sif"
    _ "github.com/containers/image/v5/tarball"
    // The docker-daemon transport is registeredy by docker_daemon*.go
    // The ostree transport is registered by ostree*.go
    // The storage transport is registered by storage*.go

vs Patch

diff --git a/transports/alltransports/alltransports.go b/transports/alltransports/alltransports.go
index 0bae8b259..34cf925c2 100644
--- a/transports/alltransports/alltransports.go
+++ b/transports/alltransports/alltransports.go
@@ -14,7 +14,7 @@ import (
    _ "github.com/containers/image/v5/openshift"
    _ "github.com/containers/image/v5/sif"
    _ "github.com/containers/image/v5/tarball"
-
+   _ "github.com/containers/image/v5/nix"
    // The ostree transport is registered by ostree*.go
    // The storage transport is registered by storage*.go
    "github.com/containers/image/v5/transports"

Not quite sure how to fix this, since nixos-23.11 is packaging skopeo 1.13.3

nlewo commented 9 months ago

@jbott thanks for the report.

That's actually annoying :/

I think we could update the patch and use filterdiff | patch to temporary avoid patching the transports.go file. We could then use sed to just add the import line in this file. Also, this should be explained in a comment. This could be easily removed for the 24.05 release.

Of course, we really need to take time to try upstreaming this patch into skopeo!