Snapcraft clean part -s clean unexpected behavious in snapcraft, version 2.42.1

snapcraft clean media-codecs -s pull
is checking for each file to remove before cleaning media-codecs, if a single file is missing it returning with an error and cancelling clean step for media-codecs. which is keeing the media-codecs pull step hence the command is failing what it does.

which is resulting in the following error if other snapcraft commands are passed to build package.

snapcraft prime

 Failed to reuse files from previous build: The 'pull' step of 'media-codecs' is out of date:
The 'stage-packages' part property appears to have changed.
To continue, clean that part's 'pull' step, run `snapcraft clean media-codecs -s pull`.

What is expected:
after passing snapcraft clean media-codecs -s pull command pull step of media-codecs part should be cleaned without checking if file exist before deleting it.

How this can be regenerated:

  1. Create a simple snapcraft project with some part with stage-packages in it.
  2. Remove some files from prime location example unwanted man pages.
  3. Do snapcraft clean partname -s pull (partname is name if oart in )
  4. Do snapcraft
    You will end up getting error telling you to do snapcraft clean partname -s pull for forever.

This was not like this before. Hence its a bug.

You shouldn’t remove files from prime area manually in the first place, the error can be avoided by force cleaning the whole contaminated prime area via snapcraft clean -s prime

Is there a way to remove files from prime area using snapcraft.yaml file ?
I really need to remove some unwanted manual pages and locales which will never be used by
my application in future.

I know people there will fix this issue when someone from canonical will face this issue.(I reported lot of issues before and they refused that time by saying that the issue is with my app without even looking in my code, and now they fixed them cause they gone through them.)

Simply the command should either inform user that the clean step was not succeeded or they should avoid checking for each file that was removed somehow.

Refer filesets, stage and prime keyword’s documentation in the snapcraft help plugins output.

1 Like

thanks, but it is still a issue :stuck_out_tongue: