On Mon, Oct 16, 2023, 12:06 PM Bruce Ashfield <[email protected]>
wrote:

> On Wed, Oct 4, 2023 at 12:02 PM Joshua Watt <[email protected]> wrote:
> >
> > The OCI_IMAGE_TAG variable can contain a ":" if the user wants to give
> > the image a name and a tag, as in:
> >
> >     OCI_IMAGE_TAG = "${IMAGE_BASENAME}:latest"
> >
> > However, while this is valid for tag name, the ":" is illegal in OCI
> > image file names so replace it with "_" when naming the symlinks
>
> I haven't experimented with this yet, but as I mentioned on IRC
> some time ago, we really don't want to change the symlinks
> unless absolutely possible.
>
> I'm still trying to understand the first RFC patch before getting into
> the question of the symlink.
>
> But my question on this is ... who / what is declaring it illegal to
> have a : on the symlink name ? Is one of the OE/bitbake
> components ? umoci ? podman ? something else ?
>

Skopeo and podman both have this restriction. They allow specifying a tag
inside an image with a :tag suffix, so you can't have an OCI file/directory
named "foo:latest" because they assume that means a file/directory named
"foo" and the tag "latest" inside it.


> Bruce
>
> >
> > Signed-off-by: Joshua Watt <[email protected]>
> > ---
> >  classes/image-oci-umoci.inc | 10 +++++++---
> >  1 file changed, 7 insertions(+), 3 deletions(-)
> >
> > diff --git a/classes/image-oci-umoci.inc b/classes/image-oci-umoci.inc
> > index 58e4668..adca6c1 100644
> > --- a/classes/image-oci-umoci.inc
> > +++ b/classes/image-oci-umoci.inc
> > @@ -105,6 +105,10 @@ IMAGE_CMD:oci() {
> >      fi
> >      umoci config --image $image_name:${OCI_IMAGE_TAG} --author
> ${OCI_IMAGE_AUTHOR_EMAIL}
> >
> > +    # OCI_IMAGE_TAG may contain ":", but these are not allowed in OCI
> file
> > +    # names so replace them
> > +    image_tag="${@d.getVar("OCI_IMAGE_TAG").replace(":", "_")}"
> > +
> >      # make a tar version of the image direcotry
> >      #  1) image_name.tar: compatible with oci tar format, blobs and
> rootfs
> >      #     are at the top level. Can load directly from something like
> podman
> > @@ -118,13 +122,13 @@ IMAGE_CMD:oci() {
> >         tar -cf "$image_name-dir.tar" "$image_name"
> >
> >         # create a convenience symlink
> > -       ln -sf "$image_name.tar"
> "${IMAGE_BASENAME}-${OCI_IMAGE_TAG}-oci.tar"
> > -       ln -sf "$image_name-dir.tar"
> "${IMAGE_BASENAME}-${OCI_IMAGE_TAG}-oci-dir.tar"
> > +       ln -sf "$image_name.tar" "${IMAGE_BASENAME}-$image_tag-oci.tar"
> > +       ln -sf "$image_name-dir.tar"
> "${IMAGE_BASENAME}-$image_tag-oci-dir.tar"
> >      fi
> >
> >      # We could make this optional, since the bundle is directly
> runnable via runc
> >      rm -rf $image_bundle_name
> >
> >      # This is the OCI image directory, which is technically the "image"
> as specified
> > -    ln -sf $image_name ${IMAGE_BASENAME}-${OCI_IMAGE_TAG}-oci
> > +    ln -sf $image_name ${IMAGE_BASENAME}-$image_tag-oci
> >  }
> > --
> > 2.34.1
> >
> >
> > 
> >
>
>
> --
> - Thou shalt not follow the NULL pointer, for chaos and madness await
> thee at its end
> - "Use the force Harry" - Gandalf, Star Trek II
>
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#8373): 
https://lists.yoctoproject.org/g/meta-virtualization/message/8373
Mute This Topic: https://lists.yoctoproject.org/mt/101758365/21656
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/meta-virtualization/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to