python package not updating during snap creation

Bug #1815358 reported by select on 2019-02-10
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Snapcraft
Undecided
Unassigned

Bug Description

When I run `snapcraft` it creates a snap package.
After I fixed the bug/changed the code I run the `snapcraft` command again but the python package that I build is still in the old version.

First time I run

```
Collecting TermCheat
Installing collected packages: TermCheat
Successfully installed TermCheat-0.1.8
/root/parts/term-cheat/install/usr/bin/python3 setup.py --no-user-cfg install --single-version-externally-managed --user --record install.txt
usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
   or: setup.py --help [cmd1 cmd2 ...]
   or: setup.py --help-commands
   or: setup.py cmd --help

error: option --single-version-externally-managed not recognized
```

After I update the version in the `setup.py` file the `snapcraft` command does not build the python package again
```
Launching a VM.
Skipping pull python-wrapper (already ran)
Skipping pull term-cheat (already ran)
Skipping build python-wrapper (already ran)
Skipping build term-cheat (already ran)
Skipping stage python-wrapper (already ran)
Skipping stage term-cheat (already ran)
Skipping prime python-wrapper (already ran)
Skipping prime term-cheat (already ran)
Determining the version from the project repo (version: git).
The version has been set to '0+git.4eb9359-dirty'
The requested action has already been taken. Consider
specifying parts, or clean the steps you want to run again.
Snapping 'term-cheat' /
Snapped term-cheat_0+git.4eb9359-dirty_amd64.snap
```

The I set the `source-type:` from `git` to `local` a new version builds
```
parts:
  term-cheat:
    plugin: python
    source-type: local
```
`snapcraft` output
```
Installing collected packages: TermCheat
Successfully installed TermCheat-0.1.9
/root/parts/term-cheat/install/usr/bin/python3 setup.py --no-user-cfg install --single-version-externally-managed --user --record install.txt
usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
   or: setup.py --help [cmd1 cmd2 ...]
   or: setup.py --help-commands
   or: setup.py cmd --help
```
When now change `setup.py` again and run `snapcraft` a second time I get the following error
```
Successfully built TermCheat
ERROR: You must give at least one requirement to install (maybe you meant "pip install /root/parts/term-cheat/python-packages"?)
Failed to run '/root/stage/usr/bin/python3 -m pip install --user --no-compile --no-index --find-links /root/parts/term-cheat/python-packages --upgrade --no-deps': Exited with code 1.
Run the same command again with --debug to shell into the environment if you wish to introspect this failure.
An error occurred when trying to execute 'sudo -i snapcraft snap' with 'multipass': returned exit code 2.
(term-cheat)
```

Now I set the `source-type` in the `snapcraft.yaml` back to git and it builds the package again but uses an old version
```
Successfully installed TermCheat-0.1.8
/root/parts/term-cheat/install/usr/bin/python3 setup.py --no-user-cfg install --single-version-externally-managed --user --record install.txt
usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
   or: setup.py --help [cmd1 cmd2 ...]
   or: setup.py --help-commands
   or: setup.py cmd --help

error: option --single-version-externally-managed not recognized
```

I run `snapcraft clean` it removes all installed packages in the vm and I have to reinstall it but it does not update my package. I removed the complete multipass vm and the snapcraft app, no change everything reinstalls but the cached version of the package is used.

The only method I found is to switch between `git` and `local` as `source-type`, so I can build the package once.

I would also love to know where the package is cached. I was digging around for a while but could not find out where the cache is so I could clean it manually.

select (falko-o) wrote :

Ah almost forgot the most important information. The project is

https://github.com/select/term-cheat

my `snapcraft.yaml`

```
name: term-cheat
version: git
summary: Collect and find termial commands.
description: |
  TermCheat is a searchable library of commands that you can copy remix and extend.
icon: img/term-cheat.logo.svg
grade: stable
confinement: classic
base: core18
parts:
  term-cheat:
    plugin: python
    python-version: python3
    source: .
    source-type: git
    python-packages:
      - urwid
      - fuzzywuzzy
      - pyyaml
      - appdirs
      - python-Levenshtein
  python-wrapper:
    plugin: dump
    source: bin
    stage:
      - term-cheat-app
    prime:
      - term-cheat-app
apps:
  term-cheat:
    command: term-cheat-app
```

select (falko-o) wrote :

I also ran `snapcraft clean term-cheat` which also does not clean the cached package

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers