Parts: source: and relative path


#1

Hi!
I have question:
Is this valid parts entry?


    energo-kod-editor1:
        plugin: cmake
        source: ../!-Libs/EnergoKodEditor1
        source-type: local
        build-packages:
        - build-essential
        - qttools5-dev

I have asked because I got folwing error:


NotADirectoryError: '/root/!-Libs/EnergoKodEditor1' is not a directory

thanks and best regards
Szyk Cech


#2

i fear the source: argument is parsed by bash somehow in the process … in bash the exclamation mark has a special meaning (history expansion) … try escaping it with a backslash like:

source: ../\!-Libs/EnergoKodEditor1


#3

Now I have got:


NotADirectoryError: '/root/\\!-Libs/EnergoKodEditor1' is not a directory

#4

Instead of escaping, quotes should be added around the value. ! has a meaning in yaml too (not just bash :slight_smile: )


#5

You still have the same output, NotADirectory, so is EnergoKodEditor1 a directory?


#6

Also just noticed the .., please ensure that local sources are part of the project tree and do not live outside of it.


#7

You still have the same output, NotADirectory, so is EnergoKodEditor1 a directory?

Yes. It is sub dir in my dir with all libs I use:

/home/szyk/!-EnergoKod/!-Libs/EnergoKodEditor1

among others…
My projects (exes) are in:

/home/szyk/!-EnergoKod/

There is

/home/szyk/!-EnergoKod/Textprofan2

I create snap for it.

Also just noticed the …, please ensure that local sources are part of the project tree and do not live outside of it.

What is wrong with have dedicated dir for libs? I have

/home/szyk/!-EnergoKod/!-Libs
for my libs and
/home/szyk/!-EnergoKod/!-Libs/3rdparty
for all foreign libs.
I find it easy to maintain all libs and install all of them in to system with just one script which I call when needed…
I tried in the past keep libs in each of my projects, but it was nightmare with keep them up to date, and build and install them to the system. Now I have centralized dir for all of my libs and it works perfectly (except snap)…

I quote relative dir and this part is like this:


    energo-kod-editor1:
        plugin: cmake
        source: "../!-Libs/EnergoKodEditor1"
        source-type: local
        build-packages:
        - build-essential
        - qttools5-dev

But error still is the same:

NotADirectoryError: '/root/!-Libs/EnergoKodEditor1' is not a directory

#8

Can you paste more of the output? The only way these sources would be picked up is if you call snapcraft with --destructive-mode


#9

e[0;32mPulling energo-kod-editor1 e[0m
Sorry, an error occurred in Snapcraft:
Traceback (most recent call last):
  File "/snap/snapcraft/2832/bin/snapcraft", line 11, in 
    load_entry_point('snapcraft==3.4', 'console_scripts', 'snapcraft')()
  File "/snap/snapcraft/2832/lib/python3.5/site-packages/snapcraft/cli/__main__.py", line 81, in run
    run_snapcraft(prog_name="snapcraft")
  File "/snap/snapcraft/2832/lib/python3.5/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/snap/snapcraft/2832/lib/python3.5/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/snap/snapcraft/2832/lib/python3.5/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/snap/snapcraft/2832/lib/python3.5/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/snap/snapcraft/2832/lib/python3.5/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/snap/snapcraft/2832/lib/python3.5/site-packages/snapcraft/cli/lifecycle.py", line 272, in snap
    _execute(steps.PRIME, parts=[], pack_project=True, output=output, **kwargs)
  File "/snap/snapcraft/2832/lib/python3.5/site-packages/snapcraft/cli/lifecycle.py", line 77, in _execute
    lifecycle.execute(step, project_config, parts)
  File "/snap/snapcraft/2832/lib/python3.5/site-packages/snapcraft/internal/lifecycle/_runner.py", line 94, in execute
    executor.run(step, part_names)
  File "/snap/snapcraft/2832/lib/python3.5/site-packages/snapcraft/internal/lifecycle/_runner.py", line 148, in run
    self._handle_step(part_names, part, step, current_step, cli_config)
  File "/snap/snapcraft/2832/lib/python3.5/site-packages/snapcraft/internal/lifecycle/_runner.py", line 162, in _handle_step
    getattr(self, "_run_{}".format(current_step.name))(part)
  File "/snap/snapcraft/2832/lib/python3.5/site-packages/snapcraft/internal/lifecycle/_runner.py", line 204, in _run_pull
    self._run_step(step=steps.PULL, part=part, progress="Pulling")
  File "/snap/snapcraft/2832/lib/python3.5/site-packages/snapcraft/internal/lifecycle/_runner.py", line 281, in _run_step
    getattr(part, step.name)()
  File "/snap/snapcraft/2832/lib/python3.5/site-packages/snapcraft/internal/pluginhandler/__init__.py", line 441, in pull
    self._runner.pull()
  File "/snap/snapcraft/2832/lib/python3.5/site-packages/snapcraft/internal/pluginhandler/_runner.py", line 70, in pull
    "override-pull", self._override_pull_scriptlet, self._sourcedir
  File "/snap/snapcraft/2832/lib/python3.5/site-packages/snapcraft/internal/pluginhandler/_runner.py", line 137, in _run_scriptlet
    scriptlet_name, function_call.strip()
  File "/snap/snapcraft/2832/lib/python3.5/site-packages/snapcraft/internal/pluginhandler/_runner.py", line 193, in _handle_builtin_function
    function(**function_args)
  File "/snap/snapcraft/2832/lib/python3.5/site-packages/snapcraft/internal/pluginhandler/__init__.py", line 460, in _do_pull
    self.source_handler.pull()
  File "/snap/snapcraft/2832/lib/python3.5/site-packages/snapcraft/internal/sources/_local.py", line 40, in pull
    copy_function=self.copy_function,
  File "/snap/snapcraft/2832/lib/python3.5/site-packages/snapcraft/file_utils.py", line 200, in link_or_copy_tree
    raise NotADirectoryError("{!r} is not a directory".format(source_tree))
NotADirectoryError: '/root/!-Libs/EnergoKodEditor1' is not a directory
We would appreciate it if you anonymously reported this issue.
No other data than the traceback and the version of snapcraft in use will be sent.
Would you like to send this error data? (Yes/No/Always/View) [no]: 

#10

/root/!-Libs/EnergoKodEditor1 is the key here, that path does not exist in the build environment because only the snapcraft project tree gets mounted into that environment.

Your options are:

  • setup the environment on your own and run snapcraft --destructive-mode.
  • put the resources on a network accessible resource.

#11

Your options are:

setup the environment on your own and run snapcraft --destructive-mode.

I am far from any destruction in my system…

put the resources on a network accessible resource.

Do you mean use GitHub?

But how about symbolic links from my /home/szyk/!-EnergoKod/!-Libs/* to /home/szyk/!-EnergoKod/Textprofan2/Libs/* ?!? Maybe this could work?


#12

But how about symbolic links from my /home/szyk/!-EnergoKod/!-Libs/* to /home/szyk/!-EnergoKod/Textprofan2/Libs/* ?!? Maybe this could work?

Suprisingly this not work either! Are symbolic links prohibited in source paths?
I loged to the multipass shell snapcraft-textprofan2 and /root/project/Libs is empty!