Existing snapcraft.yaml not building a snap

Hi,

I am having the snapcraft.yaml which was working earlier. But now the same is not working with Snapcraft command.

I am getting the following error

<== Finished processing package [1 of 1]: ‘talker’
Cleaning up newly installed Catkin packages…
Staging run-system
Traceback (most recent call last):
File “/usr/bin/snapcraft”, line 9, in
load_entry_point(‘snapcraft==2.39.3’, ‘console_scripts’, ‘snapcraft’)()
File “/usr/lib/python3/dist-packages/pkg_resources/init.py”, line 542, in load_entry_point

File “/usr/lib/python3/dist-packages/snapcraft/file_utils.py”, line 191, in create_similar_directory
stat = os.stat(source, follow_symlinks=follow_symlinks)
FileNotFoundError: [Errno 2] No such file or directory: ‘/home/xxxx/yyyy/zzzzz/parts/run-system/install/bin’

I am not finding any answers to solve this problem.

If anyone knows please reply me your solution.

Regards,
Lingaa

It’s difficult to know without seeing your snapcraft.yaml. Any chance that can be pasted here?

Hi kyrofa,

I am using snap for ROS.
Below is the snapcraft.yaml

name: ros-app
version: ‘1.0’
grade: stable
confinement: strict
summary: ROS App Snap
description: Contains talker ROS packages and a talker.launch file.

plugs:

Mount the content shared from ros-base into $SNAP/ros-base

ros-base:
content: ros-base-v1
interface: content
target: /ros-base

apps:

launch-project:

run:
command: run-ros-app
plugs: [network, network-bind, ros-base]

parts:

The source here is the tarred staging area of the ros-base snap.

ros-base:
plugin: dump
source: ros-base.tar.bz2

# This is only used for building-- filter it out of the final snap.
prime: [-*]

ros-app:
plugin: catkin
rosdistro: kinetic
include-roscore: false
underlay:
# Build-time location of the underlay
# On Pi Platform
# build-path: $SNAPCRAFT_STAGE/opt/ros/kinetic

  # On Ubuntu machine
  build-path: /opt/ros/kinetic

  # Run-time location of the underlay
  run-path: $SNAP/ros-base/opt/ros/kinetic
# list of catking packages in the snap
catkin-packages:
  - talker      
after: [ros-base]

run-system:
plugin: dump
stage: [bin/run-system]
prime: [bin/run-system]

mountpoint:
plugin: nil
install: mkdir $SNAPCRAFT_PART_INSTALL/ros-base

The complete error occurs when running Snapcraft command.

Staging mountpoint
Staging ros-app
Staging run-system
Traceback (most recent call last):
File “/usr/bin/snapcraft”, line 9, in
load_entry_point(‘snapcraft==2.39.3’, ‘console_scripts’, ‘snapcraft’)()
File “/usr/lib/python3/dist-packages/pkg_resources/init.py”, line 542, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File “/usr/lib/python3/dist-packages/pkg_resources/init.py”, line 2569, in load_entry_point
return ep.load()
File “/usr/lib/python3/dist-packages/pkg_resources/init.py”, line 2229, in load
return self.resolve()
File “/usr/lib/python3/dist-packages/pkg_resources/init.py”, line 2235, in resolve
module = import(self.module_name, fromlist=[‘name’], level=0)
File “/usr/lib/python3/dist-packages/snapcraft/cli/main.py”, line 43,in
run(prog_name=‘snapcraft’)
File “/usr/lib/python3/dist-packages/click/core.py”, line 716, in call
return self.main(*args, **kwargs)
File “/usr/lib/python3/dist-packages/click/core.py”, line 696, in main
rv = self.invoke(ctx)
File “/usr/lib/python3/dist-packages/click/core.py”, line 1037, in invoke
return Command.invoke(self, ctx)
File “/usr/lib/python3/dist-packages/click/core.py”, line 889, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/usr/lib/python3/dist-packages/click/core.py”, line 534, in invoke
return callback(*args, **kwargs)
File “/usr/lib/python3/dist-packages/click/decorators.py”, line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File “/usr/lib/python3/dist-packages/snapcraft/cli/_runner.py”, line 72, in run
ctx.forward(lifecyclecli.commands[‘snap’])
File “/usr/lib/python3/dist-packages/click/core.py”, line 552, in forward
return self.invoke(cmd, **kwargs)
File “/usr/lib/python3/dist-packages/click/core.py”, line 534, in invoke
return callback(*args, **kwargs)
File “/usr/lib/python3/dist-packages/snapcraft/cli/lifecycle.py”, line 139, in snap
project_options, directory=directory, output=output)
File “/usr/lib/python3/dist-packages/snapcraft/internal/lifecycle/_packer.py”, line 46, in snap
execute(‘prime’, project_options)
File “/usr/lib/python3/dist-packages/snapcraft/internal/lifecycle/_runner.py”, line 79, in execute
_Executor(config, project_options).run(step, part_names)
File “/usr/lib/python3/dist-packages/snapcraft/internal/lifecycle/_runner.py”, line 185, in run
self._run_step(step, part, part_names)
File “/usr/lib/python3/dist-packages/snapcraft/internal/lifecycle/_runner.py”, line 222, in _run_step
getattr(part, step)()
File “/usr/lib/python3/dist-packages/snapcraft/internal/pluginhandler/init.py”, line 477, in stage
self.stagedir, fixup_func=fixup_func)
File “/usr/lib/python3/dist-packages/snapcraft/internal/pluginhandler/init.py”, line 822, in _migrate_files
snapcraft.file_utils.create_similar_directory(src, dst)
File “/usr/lib/python3/dist-packages/snapcraft/file_utils.py”, line 191, in create_similar_directory
stat = os.stat(source, follow_symlinks=follow_symlinks)
FileNotFoundError: [Errno 2] No such file or directory: ‘/home/xxxx/yyyy/ros-app/parts/run-system/install/bin’

After upgrading snapcraft to 2.39.3.

when running snapcraft command
$ snapcraft
Failed to reuse files from previous build: The ‘pull’ step of ‘ros-base’ isout of date:
The ‘parse-info’ part property appears to have changed.
To continue, clean that part’s ‘pull’ step, run snapcraft clean ros-base -s pull.

When running snapcraft clean ros-base -s pull
$ snapcraft clean ros-base -s pull
Cleaning priming area for ros-base
Cleaning staging area for ros-base
Cleaning build for ros-base
Cleaning pulled source for ros-base
Unable to find python2, searched: /home/user/…/ros-base/stage:/home/user/…/ros-base/parts/ros-base/install

Hi,

Earlier I was using “run-system:” in my snapcraft.yaml file.
Please refer my previous snapcraft.yaml file posted earlier.

But I am checking the snapcraft schema. I couldn’t find “run-system:”.

At the moment I can not able to use underlay. In this case I need to include roscore in each snap.

The updated snapcraft.yaml
It contains the command: rosrun talker talker.
But it is meaning less to execute, when calling ros-app.run, it couldn’t find rosrun command. This is what done by the run-system.

============================================
name: ros-app
version: ‘1.0’
grade: devel
confinement: devmode
summary: ROS App Snap
description: Contains talker ROS packages and a talker.launch file.

plugs:

Mount the content shared from ros-base into $SNAP/ros-base

ros-base:
content: ros-base-v1
interface: content
target: /ros-base

apps:
launch-project:
command: rosrun talker talker
plugs: [network, network-bind, ros-base]

parts:

The source here is the tarred staging area of the ros-base snap.

ros-base:
plugin: dump
source: ros-base.tar.bz2

# This is only used for building-- filter it out of the final snap.
prime: [-*]

This is mostly unchanged from the standalone ROS example. Notable

additions are:

- Using Kinetic now (other demo is Indigo)

- Specifically not including roscore

- Making sure we’re building AFTER our underlay

- Specifying the build- and run-time paths of the underlay

ros-app:
plugin: catkin
rosdistro: kinetic
include-roscore: false
underlay:
# Build-time location of the underlay
# On Pi Platform
build-path: $SNAPCRAFT_STAGE/opt/ros/kinetic

  # On Ubuntu machine
  # build-path: /opt/ros/kinetic

  # Run-time location of the underlay
  run-path: $SNAP/ros-base/opt/ros/kinetic
# list of catking packages in the snap
catkin-packages:
  - talker      
after: [ros-base]

We can’t just use roslaunch now, since that’s contained in the

underlay. This part will tweak the environment a little to

utilize the underlay.

run-system:

plugin: dump

stage: [bin/run-system]

prime: [bin/run-system]

We need to create the $SNAP/ros-base mountpoint for the content

being shared.

mountpoint:
plugin: nil
install: mkdir $SNAPCRAFT_PART_INSTALL/ros-base

============================================

Would you mind formatting your code, please? Surround it with ``` characters. It’s difficult to copy/paste what you’ve provided into something I can use :slight_smile: .

Sorry for that. The comments are appearing different when I pasted in the post.

Here is the code. updated snapcraft.yaml. Hope this will help you.

name: ros-app
version: '1.0’
grade: devel
confinement: devmode
summary: ROS App Snap
description: Contains talker ROS packages and a talker.launch file.

plugs:

	ros-base:
	content: ros-base-v1
	interface: content
	target: /ros-base

apps:
	launch-project:
		command: rosrun talker talker
		plugs: [network, network-bind, ros-base]

parts:
	ros-base:
		plugin: dump
		source: ros-base.tar.bz2
	
	prime: [-*]
	
	ros-app:
		plugin: catkin
		rosdistro: kinetic
		include-roscore: false
		
		underlay:
		# Build-time location of the underlay		
		build-path: $SNAPCRAFT_STAGE/opt/ros/kinetic
		
		run-path: $SNAP/ros-base/opt/ros/kinetic
		catkin-packages:
			- talker      
		after: [ros-base]
		
	// run-system:
		// plugin: dump
		// stage: [bin/run-system]
		// prime: [bin/run-system]
		
	mountpoint:
		plugin: nil
		install: mkdir $SNAPCRAFT_PART_INSTALL/ros-base
	ros-base:
		plugin: dump
		source: ros-base.tar.bz2
	
	prime: [-*]

prime: [-*] is dangling. It needs to be indented once more to assign it to ros-base.

		underlay:
		# Build-time location of the underlay
		build-path: $SNAPCRAFT_STAGE/opt/ros/kinetic

incorrect indentation of underlay: - I believe it should be one-level less-indented.

	// run-system:
		// plugin: dump
		// stage: [bin/run-system]
		// prime: [bin/run-system]

your fear that run-system is not expected is wrong. The key used where you see run-system here is freely chosen by the snapcraft.yaml author. It is merely an identifier which can be used in after clauses. The definition you have commented out is using the dump plugin to copy files. I expect it is failing, however, because there is no source provided for it to copy from.

Yeah the source for the run-system part will be .. Is there a bin/run-system available in the root of your project (alonside the snap/ directory)?

Note that this appears to at least be somewhat based on the shared ROS demo in the Snapcraft tree, which continues to build fine for me. Have you compared what you have to it?

Hi, Daniel,

Thanks.
As per Kyrofa, I am not having the bin/run-system in my folder structure.

I think this will fix my problem.

Thanks Kyrofa.