Snapcraft 7 refuses to build core18 snap?

Building Nextcloud (a base: core18 snap) appears to be failing, I assume due to the v7 release:

Sorry, an error occurred in Snapcraft:
module 'snapcraft' has no attribute 'sources'
Traceback (most recent call last):
  File "/snap/snapcraft/7720/lib/python3.8/site-packages/snapcraft/cli.py", line 188, in run
    dispatcher.run()
  File "/snap/snapcraft/7720/lib/python3.8/site-packages/craft_cli/dispatcher.py", line 406, in run
    return self._loaded_command.run(self._parsed_command_args)
  File "/snap/snapcraft/7720/lib/python3.8/site-packages/snapcraft/commands/lifecycle.py", line 82, in run
    parts_lifecycle.run(self.name, parsed_args)
  File "/snap/snapcraft/7720/lib/python3.8/site-packages/snapcraft/parts/lifecycle.py", line 135, in run
    yaml_data = process_yaml(snap_project.project_file)
  File "/snap/snapcraft/7720/lib/python3.8/site-packages/snapcraft/parts/lifecycle.py", line 86, in process_yaml
    yaml_data = yaml_utils.load(yaml_file)
  File "/snap/snapcraft/7720/lib/python3.8/site-packages/snapcraft/parts/yaml_utils.py", line 92, in load
    raise errors.LegacyFallback("base is not core22")
snapcraft.errors.LegacyFallback: base is not core22

Did I miss something? Did v7 remove support for non-core22-based snaps, or is that a red herring?

Ah, red herring indeed-- it’s actually the fact that one of my local plugins uses snapcraft.sources. I’ll have to figure out what the alternative is in this new release.

The fix might be as simple as a search and replace from snapcraft to snapcraft_legacy in your custom plugin.

Thanks Kyle, I think we can treat this as regression indeed. You can update the import path or stick to 6 in the meantime.

1 Like

Thank you, @sergiusens. I don’t expect you to maintain APIs forever, but have these been deprecated? Should I be looking to move?

I rely on Nextcloud snap for both work and personal use. For me it is the single most important snap. Please lets help keep it running smoothly.

1 Like

No, this was a mistake; it will eventually be deprecated, but should always work as long as you keep using the base you are using.

Ah, excellent, thank you.

I think we can implement a global package redirector so that once we fall back to core20 and earlier all accesses to snapcraft.* are diverted to snapcraft_legacy.*, but I’ll have a number of tasks in my queue to finish before I can play with that idea.

Heh, I remember doing something similarly fun back in the day, vendoring snapcraft within itself.

Pretty similar, but a bit different :slight_smile:

Any movement on this? Should I log an actual bug?

Hi! Has this been tackled or a bug created?

Thanks!

Please create an issue for this so it can be tracked. If there’s already an issue, it will be marked as a duplicate. (I couldn’t immediately find one.)

Done: https://github.com/snapcore/snapcraft/issues/4285

1 Like

Hi @sergiusens & @dboddie is there any ETA for the release of 7.5.3 to the latest/stable channel? Thanks!

7.5.3 is available in the stable channel.