confusing behaviour using the root of the repo as source

Bug #1660885 reported by Leo Arias
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Snapcraft
New
Undecided
Unassigned

Bug Description

The new default for snapcraft will be to have the snapcraft.yaml in the snap directory.
That seems like a nice feature, and some people don't want to add the yaml to their root, so they will be happy for sure.

However, we have the common practice of using . as the source. Now, the meaning of . is confusing.

Lets say I have my snapcraft project in /home/elopio/project.

If I put the snapcraft.yaml in /home/elopio/project, source: . will mean /home/elopio/project as the source.

If I put the snapcraft.yaml in /home/elopio/project/snap, source: . will still mean /home/elopio/project. I find this slightly confusing.

And there's also a not-so-uncommon practice of putting the snapcraft.yaml in a subdirectory, and run snapcraft from that subdir.

If I put the snapcraft.yaml in /home/elopio/project/packaging, source: .. will mean /home/elopio/project.

If I put the snapcraft.yaml in /home/elopio/project/snap, source: .. will mean /home/elopio, which is wrong.

I'm not really sure what to do about this, or even if we have to do anything about this. I'm open this bug for discussion.

Revision history for this message
Leo Arias (elopio) wrote :

Maybe, we could use a variable for cwd, the directory where snapcraft is called from.

That way we could have /home/elopio/project/snap/snapcraft.yaml with source: $SNAPCRAFT_ROOT
and /home/elopio/project/packaging/snap/snapcraft.yaml with source: $SNAPCRAFT_ROOT/..

However, I don't think $SNAPCRAFT_ROOT is the perfect name.

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.