Why does snapcraft copy my home directory?

It copies my home directory with all my directories to parts/gosim/src and parts/gosim/build

All my documents are copied, why!?

Ordinarily it wouldn’t Most likely the source line in one of your parts is a bit wrong.

Can you paste the entire snapcraft.yaml, and put it between three backticks to make it readable.

like this
1 Like
name: gosim
version: "0.20"
summary: Block diagram simulator, like simulink
description: GoSim is a block diagram simulator similar to Simulink. Is uses GNU Octave as a mathematical engine. 
grade: stable
confinement: devmode
    command: java -jar $SNAP/GoSim/gosim.jar
    plugin: gradle
    source: .
    override-build: |
      export JAVA_HOME="/usr/lib/jvm/java-8-openjdk-amd64"
      gradle release -x test -x createGitTag
      unzip /home/cr/Skrivbord/Nymapp/GoSim.zip -d $SNAPCRAFT_PART_INSTALL/
      - unzip
      - openjdk-8-jdk

it’s just a dot, i copied your example:

if it is a java jar file why are the source files needed? Can i just omit the line?

my snap isn’t working btw, i get an error:

thanks in advance

The error messages make it sound like you’ve put the snapcraft.yaml directly in your home directory. Try putting your project in a subdirectory of your home dir and things should work a lot better.

In general, a Snapcraft project is a whole directory hierarchy rather than just the snapcraft.yaml file. As your home dir is going to contain a lot of files unrelated to your project, it is a bad idea to have the project rooted there.

my snapcraft.yaml is in /home/cr/snap/

That is going to have the same effect as putting snapcraft.yaml in your home folder. ./snap is a special folder that snapcraft will treat as “part of a project” with the project folder being the folder that contains ./snap (i.e. your home folder in this case).

You might be able to fudge it with your current folder layout by cd $HOME/snap before running snapcraft, but it is potentially still going to be a problem.

Within a snapcraft project, the yaml file can either be located at snap/snapcraft.yaml, snapcraft.yaml, or .snapcraft.yaml. So you’re still running snapcraft as if your entire home directory is your snapcraft project.

That’s probably also a bad idea, since ~/snap is where snapd puts files belonging to installed snaps. He’d just be trading unwanted files from his home directory for unwanted files from installed snaps.

1 Like

Oops, I completely overlooked that fact. :man_facepalming:

ok, I think I get it, thanks!