BUG. snapcraft clean my-part -s build: "no such option: -s"

-s option does not work in of 3.5.1

Here is the help:
Options:
-s, --step [pull|build|stage|prime|strip]
only clean the specified step and those that
depend on it.
Example:
$ snapcraft clean my-part -s build
Error: no such option: -s

But --step works fine.
This issue broke all my scripts.

1 Like

This option was removed in snapcraft 3.0 for whenever the base keyword is used. Auto-rebuild takes place or you can clean the entire part.

“snapcraft clean -h” still shows -s as a valid options

1 Like

What version of snapcraft are you using?

Do I have an option to use particular version? It self updates every time through snapd without asking. And breaking current build scripts. Thanks to automatic updates that cannot be disabled.

It’s snapcraft 3.8 / Ubuntu 18.04 (updated from 16.04 a couple of days ago). “-s” is still all over the place, I remember seeing many snapcraft diagnostic messages stating something like “…you need to run snapcraft clean -s prime…”
Screenshot%20from%202019-09-26%2015-19-05

Ok, this option is only available when not using a base in your snapcraft.yaml. Using the long option --step does work. I will add a fix for the short option now.

Thanks for the report.

Here’s the PR

1 Like

I’m a bit unclear as to whether it is possible to clean a specific step when a base is in use. I can’t even get the long option to work using the current snapcraft snap stable channel, and a snapcraft.yaml with a base

$ snap --version
snap    2.42
snapd   2.42
series  16
ubuntu  16.04
kernel  4.15.0-66-generic

$ snapcraft --version
snapcraft, version 3.8

$ snapcraft clean btcd --step build
Usage: snapcraft clean [OPTIONS] <part>...

Error: no such option: --step

$ snap info snapcraft
name:      snapcraft
summary:   easily create snaps
publisher: Canonical✓
contact:   snaps@canonical.com
license:   unset
description: |
  Package, distribute, and update any app for Linux and IoT.
  
  Snaps are containerised software packages that are simple to create and install. They auto-update
  and are safe to run. And because they bundle their dependencies, they work on all major Linux
  systems without modification.
commands:
  - snapcraft
snap-id:      vMTKRaLjnOJQetI78HjntT37VuoyssFE
tracking:     stable
refresh-date: 5 days ago, at 12:03 EEST
channels:
  stable:    3.8                  2019-09-11 (3440) 60MB classic
  candidate: 3.8                  2019-09-09 (3440) 60MB classic
  beta:      ↑                                           
  edge:      3.8+git124.g0077d826 2019-10-29 (3667) 61MB classic
installed:   3.8                             (3440) 60MB classic

$ snapcraft clean --help
Usage: snapcraft clean [OPTIONS] <part>...

  Remove a part's assets.

  Examples:
      snapcraft clean
      snapcraft clean my-part

Options:
  --use-lxd           Forces snapcraft to use LXD for this clean command.
  --destructive-mode  Forces snapcraft to try and use the current host to
                      clean.
  -h, --help          Show this message and exit.

Same story with 3.8+git124.g0077d826

No, we removed this option when using bases and plan to introduce a better cli for it in the future

Is there any workaround in the meantime?