snapcraft "stage: [ -f ] " causes FileNotFound on second run

Bug #1604258 reported by Chad Miller
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
snapcraft (Ubuntu)
New
Undecided
Unassigned

Bug Description

I have a snapcraft with two parts, one "copy" and one "cmake". I am debugging files used in the "copy" part.

$ snapcraft clean -s build wrapper && snapcraft --debug

My yaml has

----

parts:
  wrapper:
    plugin: copy
    files:
      dekkowrapper: dekkowrapper

  dekko:
    plugin: cmake
    source: https://git.launchpad.net/dekko
    source-type: git
    ...
    stage:
      - -usr/share/pkgconfig/*.pc

----

First run, snapcraft runs normally. Then I clean the copy part and run again.

$ snapcraft clean -s build wrapper && snapcraft --debug
Cleaning priming area for wrapper
Cleaning staging area for wrapper
Cleaning build for wrapper
Skipping pull desktop/qt5 (already ran)
'dekko' has prerequisites that need to be staged: desktop/qt5
Skipping pull desktop/qt5 (already ran)
Skipping build desktop/qt5 (already ran)
Skipping stage desktop/qt5 (already ran)
Skipping pull dekko (already ran)
Skipping pull wrapper (already ran)
Skipping build desktop/qt5 (already ran)
'dekko' has prerequisites that need to be staged: desktop/qt5
Skipping pull desktop/qt5 (already ran)
Skipping build desktop/qt5 (already ran)
Skipping stage desktop/qt5 (already ran)
Skipping build dekko (already ran)
Preparing to build wrapper
Building wrapper
Skipping stage desktop/qt5 (already ran)
'dekko' has prerequisites that need to be staged: desktop/qt5
Skipping pull desktop/qt5 (already ran)
Skipping build desktop/qt5 (already ran)
Skipping stage desktop/qt5 (already ran)
Skipping stage dekko (already ran)
Staging wrapper
Skipping prime desktop/qt5 (already ran)
'dekko' has prerequisites that need to be staged: desktop/qt5
Skipping pull desktop/qt5 (already ran)
Skipping build desktop/qt5 (already ran)
Skipping stage desktop/qt5 (already ran)
Priming dekko
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/snapcraft/internal/common.py", line 187, in link_or_copy
    os.link(source_path, destination, follow_symlinks=False)
FileNotFoundError: [Errno 2] No such file or directory: '/home/cmiller/work/canonical/snaps/dekko/stage/usr/share/pkgconfig/iso-codes.pc' -> '/home/cmiller/work/canonical/snaps/dekko/prime/usr/share/pkgconfig/iso-codes.pc'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/bin/snapcraft", line 31, in <module>
    snapcraft.main.main()
  File "/usr/lib/python3/dist-packages/snapcraft/main.py", line 202, in main
    return run(args, project_options)
  File "/usr/lib/python3/dist-packages/snapcraft/main.py", line 258, in run
    lifecycle.snap(project_options, args['<directory>'], args['--output'])
  File "/usr/lib/python3/dist-packages/snapcraft/internal/lifecycle.py", line 256, in snap
    snap = execute('prime', project_options)
  File "/usr/lib/python3/dist-packages/snapcraft/internal/lifecycle.py", line 98, in execute
    _Executor(config, project_options).run(step, part_names)
  File "/usr/lib/python3/dist-packages/snapcraft/internal/lifecycle.py", line 127, in run
    self._run_step(step, part, part_names, dirty, recursed)
  File "/usr/lib/python3/dist-packages/snapcraft/internal/lifecycle.py", line 165, in _run_step
    getattr(part, step)()
  File "/usr/lib/python3/dist-packages/snapcraft/internal/pluginhandler.py", line 391, in prime
    _migrate_files(snap_files, snap_dirs, self.stagedir, self.snapdir)
  File "/usr/lib/python3/dist-packages/snapcraft/internal/pluginhandler.py", line 673, in _migrate_files
    common.link_or_copy(src, dst, follow_symlinks=follow_symlinks)
  File "/usr/lib/python3/dist-packages/snapcraft/internal/common.py", line 189, in link_or_copy
    shutil.copy2(source, destination, follow_symlinks=follow_symlinks)
  File "/usr/lib/python3.5/shutil.py", line 251, in copy2
    copyfile(src, dst, follow_symlinks=follow_symlinks)
  File "/usr/lib/python3.5/shutil.py", line 114, in copyfile
    with open(src, 'rb') as fsrc:
FileNotFoundError: [Errno 2] No such file or directory: '/home/cmiller/work/canonical/snaps/dekko/stage/usr/share/pkgconfig/iso-codes.pc'

ProblemType: Bug
DistroRelease: Ubuntu 16.04
Package: snapcraft 2.12.1
Uname: Linux 4.5.0-040500-generic x86_64
ApportVersion: 2.20.1-0ubuntu2.1
Architecture: amd64
CurrentDesktop: GNOME
Date: Tue Jul 19 02:49:59 2016
EcryptfsInUse: Yes
PackageArchitecture: all
SourcePackage: snapcraft
UpgradeStatus: No upgrade log present (probably fresh install)

Revision history for this message
Chad Miller (cmiller) wrote :
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.