Auto connections of wine-base-stable, wine-base-devel and wine-base-staging

The snap declaration for wine-platform-runtime has:

{
  "allow-auto-connection": [
    {
      "slot-attributes": {
        "content": "wine-runtime"
      },
      "plug-attributes": {
        "content": "$SLOT(content)"
      }
    }
  ]
}

but the snap.yaml for photoscape has:

plugs:
  wine-platform-runtime:
    interface: content
    target: $SNAP/wine-runtime
    default-provider: wine-platform-runtime

The content interface says: " content (slot and plug) : an arbitrary identifier for content type. Defaults to either local slot name or local plug name for slot/plug definitions respetively.". Since photoscape doesn’t have “content” listed in the plug, it is defaulting to the interface reference, ie “wine-platform-runtime”. Based on the snap declaration, “wine-platform-runtime” != “wine-runtime”, so it is not a candidate for auto-connection.

Photoscape needs to adjust the plugs to be either:

plugs:
  wine-platform-runtime:
    interface: content
    content: wine-runtime
    target: $SNAP/wine-runtime
    default-provider: wine-platform-runtime

or:

plugs:
  wine-runtime:
    interface: content
    target: $SNAP/wine-runtime
    default-provider: wine-platform-runtime

then it should work.

1 Like

@jdstrand

The photoscape snap in the beta channel has the following plug declaration in meta/snap.yaml:

  wine-5-stable:
    interface: content
    target: $SNAP/wine-platform
    default-provider: wine-platform-5-stable
  wine-runtime:
    interface: content
    target: $SNAP/wine-runtime
    default-provider: wine-platform-runtime

This seems to be what you propose.

However, when I install it, it does not get auto-connected.

I pushed a version with differently-named plugs in the edge channel to try out other names, so that might be what you were looking at.

Hrm, I did install --beta, but I looked in the store at the snap.yaml, which was pointing to edge. I can confirm that the beta snap has:

  wine-runtime:
    interface: content
    target: $SNAP/wine-runtime
    default-provider: wine-platform-runtime

and that it did not auto-connect.

Out of curiosity, I updated photoscape’s snap declaration to have:

  "content": {
    "allow-auto-connection": [
      {
        "slot-attributes": {
          "content": "wine-runtime"
        },
        "plug-attributes": {
          "content": "$SLOT(content)"
        },
        "slots-per-plug": "*"
      },
      {
        "slot-attributes": {
          "content": "gtk-3-themes"
        },
        "plug-attributes": {
          "content": "$SLOT(content)"
        },
        "slots-per-plug": "*"
      },
      {
        "slot-attributes": {
          "content": "icon-themes"
        },
        "plug-attributes": {
          "content": "$SLOT(content)"
        },
        "slots-per-plug": "*"
      },
      {
        "slot-attributes": {
          "content": "sound-themes"
        },
        "plug-attributes": {
          "content": "$SLOT(content)"
        },
        "slots-per-plug": "*"
      },
      {
        "slot-attributes": {
          "content": "gtk-2-themes"
        },
        "plug-attributes": {
          "content": "$SLOT(content)"
        },
        "slots-per-plug": "*"
      },
      {
        "slot-attributes": {
          "content": "gnome-3-28-1804"
        },
        "plug-attributes": {
          "content": "$SLOT(content)"
        },
        "slots-per-plug": "*"
      }
    ]
  }

and found that it did auto-connect, but based on Plug/slot declaration rules: greedy plugs it seemed like it should not have made a difference since there weren’t multiple “candidate pairs” AFAICS (I’ve since removed that temporary snap declaration).

@pedronis, can you comment? photoscape --beta has this in snap.yaml:

plugs:
  gnome-3-28-1804:
    interface: content
    target: $SNAP/gnome-platform
    default-provider: gnome-3-28-1804
  gtk-3-themes:
    interface: content
    target: $SNAP/data-dir/themes
    default-provider: gtk-common-themes
  icon-themes:
    interface: content
    target: $SNAP/data-dir/icons
    default-provider: gtk-common-themes
  sound-themes:
    interface: content
    target: $SNAP/data-dir/sounds
    default-provider: gtk-common-themes
  wine-5-stable:
    interface: content
    target: $SNAP/wine-platform
    default-provider: wine-platform-5-stable
  wine-runtime:
    interface: content
    target: $SNAP/wine-runtime
    default-provider: wine-platform-runtime

gtk-themes-common has this snap declaration in slots:

  "content": {
    "allow-auto-connection": [
      {
        "slot-attributes": {
          "content": "gtk-3-themes"
        },
        "plug-attributes": {
          "content": "$SLOT(content)"
        }
      },
      {
        "slot-attributes": {
          "content": "icon-themes"
        },
        "plug-attributes": {
          "content": "$SLOT(content)"
        }
      },
      {
        "slot-attributes": {
          "content": "sound-themes"
        },
        "plug-attributes": {
          "content": "$SLOT(content)"
        }
      },
      {
        "slot-attributes": {
          "content": "gtk-2-themes"
        },
        "plug-attributes": {
          "content": "$SLOT(content)"
        }
      }
    ]
  }

gnome-3-28-1804 has this in its snap declaration for slots:

  "content": {
    "allow-auto-connection": [
      {
        "slot-attributes": {
          "content": "gnome-3-28-1804"
        },
        "plug-attributes": {
          "content": "$SLOT(content)"
        }
      }
    ]
  }

wine-platform-runtime has this in its snap declaration for plugs (I initially said slots):

{
  "content": {
    "allow-auto-connection": [
      {
        "slot-attributes": {
          "content": "wine-runtime"
        },
        "plug-attributes": {
          "content": "$SLOT(content)"
        }
      }
    ]
  }
}
1 Like

Ok, I found the issue (@pedronis, nevermind my previous question).

The wine-platform-runtime snap was not setup like gtk-themes-common and gnome-3-28-1804 like I claimed a long time ago. It was using the snap declaration in its plugs, not its slots. I adjusted the snap declaration for wine-platform-runtime to have in its slots (with nothing in its plugs):

{
  "content": {
    "allow-auto-connection": [
      {
        "slot-attributes": {
          "content": "wine-runtime"
        },
        "plug-attributes": {
          "content": "$SLOT(content)"
        }
      }
    ]
  }
}

then I removed photoscape and wine-platform-runtime from the machine, did a snap refresh to make sure I had all the updated snap declarations and then did:

$ sudo snap install photoscape --beta
photoscape (beta) 3.7 from Merlijn Sebrechts installed

$ snap connections photoscape
Interface                 Plug                        Slot                                Notes
content[gnome-3-28-1804]  photoscape:gnome-3-28-1804  gnome-3-28-1804:gnome-3-28-1804     -
content[gtk-3-themes]     photoscape:gtk-3-themes     gtk-common-themes:gtk-3-themes      -
content[icon-themes]      photoscape:icon-themes      gtk-common-themes:icon-themes       -
content[sound-themes]     photoscape:sound-themes     gtk-common-themes:sound-themes      -
content                   photoscape:wine-5-stable    -                                   -
content[wine-runtime]     photoscape:wine-runtime     wine-platform-runtime:wine-runtime  -
desktop                   photoscape:desktop          :desktop                            -
desktop-legacy            photoscape:desktop-legacy   :desktop-legacy                     -
gsettings                 photoscape:gsettings        :gsettings                          -
home                      photoscape:home             :home                               -
network                   photoscape:network          :network                            -
network-bind              photoscape:network-bind     :network-bind                       -
wayland                   photoscape:wayland          :wayland                            -
x11                       photoscape:x11              :x11                                -

and wine-runtime did auto-connect. Sorry for noise, but glad it is now fixed.

2 Likes

@mmtrt - I noticed that wine-platform-3-stable and wine-platform-4-stable had the same issue, so I updated the snap declarations accordingly to use slots instead of plugs. Please advise if this should be changed back.

I verified with the sos-notepad3 (a different publisher) snap that it is correctly auto-connecting with the change:

content[icon-themes]    sos-notepad3:icon-themes       gtk-common-themes:icon-themes         -
content[wine-3-stable]  sos-notepad3:wine-3-stable     wine-platform-3-stable:wine-3-stable  -
content[wine-runtime]   sos-notepad3:wine-runtime      wine-platform-runtime:wine-runtime    -

To be clear, for connections snapd consults the plug rules in the snap-declaration of the plug providing snap, if there are none then it consults the slot rules in the snap-declaration of the slot providing snap. (If there are no snap-declaration rules then the base declaration is used.)

Plug rules on a slot-only providing snap never come into play.

Yes, hence the corrections to the snap declarations for the provider snaps I just did (they were always meant to go into slots). Thanks for reaffirming.

It’s fine if it doesn’t require changes on consumer snaps, also check for version 4 devel staging which were as requested, these snaps can be of used.

No, this requires no changes to consumer snaps and only makes them actually work. :slight_smile:

I corrected wine-platform-4-devel snap declaration last night with the others, but I could not find a snap that was from a different publisher to test. sos-notepad3 proves it should work (since the same change was made to wine-platform-3-stable), but if you know of a snap from another publisher than yourself that plugs wine-platform-4-devel, feel free to list it here or try to snap install to see if it auto-connects.

1 Like

Thanks a lot for looking into this @jdstrand!

I can confirm that refreshing the photoscape snap to stable and then back to beta automatically connects it to wine-platform-runtime

2 Likes