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:
-s, --step [pull|build|stage|prime|strip]
only clean the specified step and those that
depend on it.
$ 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…”

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.
  - snapcraft
snap-id:      vMTKRaLjnOJQetI78HjntT37VuoyssFE
tracking:     stable
refresh-date: 5 days ago, at 12:03 EEST
  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.

      snapcraft clean
      snapcraft clean my-part

  --use-lxd           Forces snapcraft to use LXD for this clean command.
  --destructive-mode  Forces snapcraft to try and use the current host to
  -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?

Hi guys, any updates on the -s option or alternative? Snapcraft is now version 5.0. So how can we clean only build stage, without pulling from git another gigabytes of data? I want to make many ad-hoc changes on src stage and try them before going through all “git commit-push-pull” on every single minor change? Snapcraft is not able to detect changes in src directory.

P.S. I’ve discovered that I can delete all files except “pull” from “parts/mypart/state/” to achieve this goal. But it is somehow hacky)

1 Like

I’m also running in to this issue and I can’t find useful information. Docs are all over the place and most are outdated.

My build process are hours for a build, so to be able to re-run “stage” and “prime” is monumental.

  • What is an efficient workflow with snaps today?
  • So, how do I clean a single step now?
  • Is there some docs that covers this?

I didn’t quite get this right so I ended up in having to rebuild (again) waiting another good half a day to rebuild =/

Really need to figure out an efficient workflow here. This is unbearable.