Merge lp://qastaging/~mterry/snapcraft/lifecycle-fixes into lp://qastaging/~snappy-dev/snapcraft/core

Proposed by Michael Terry
Status: Merged
Approved by: Ricardo Salveti
Approved revision: 74
Merged at revision: 72
Proposed branch: lp://qastaging/~mterry/snapcraft/lifecycle-fixes
Merge into: lp://qastaging/~snappy-dev/snapcraft/core
Diff against target: 556 lines (+186/-123)
13 files modified
bin/snapcraft (+1/-1)
runtests.sh (+2/-0)
snapcraft/__init__.py (+12/-21)
snapcraft/cmds.py (+3/-3)
snapcraft/plugin.py (+67/-21)
snapcraft/plugins/autotools_project.py (+4/-7)
snapcraft/plugins/go14.py (+14/-17)
snapcraft/plugins/go14_project.py (+10/-18)
snapcraft/plugins/make_project.py (+2/-7)
snapcraft/plugins/tgz_content.py (+5/-6)
snapcraft/plugins/ubuntu.py (+10/-12)
snapcraft/yaml.py (+6/-6)
tests/unit/test_plugin.py (+50/-4)
To merge this branch: bzr merge lp://qastaging/~mterry/snapcraft/lifecycle-fixes
Reviewer Review Type Date Requested Status
Ricardo Salveti (community) Approve
Michael Vogt (community) Approve
Review via email: mp+264155@code.qastaging.launchpad.net

Commit message

Clean up part lifecycle logic a bit.

- Drop stage() and snap() calls from plugins. The core code now handles those. Plugins do get a new snapFiles() call that allows them to specify whitelist and blacklist globs. (To be expanded in the future by letting the user blacklist more files from yaml.)

- Add new parts/XXX/install directory. This is a sort of staging area for the staging area. It's useful in three ways: (1) We can detect two parts trying to install the same file into staging (though this isn't implemented yet); (2) We can restrict the whitelist globs from a part to only match the filenames that are in install/ (since otherwise it could match files from other parts in the combined staging area); (3) And we can build other parts against only the parts that they specify (using after/requires) rather than any part that happened to get installed into staging. These changes leave staging as just a play area for the user (to either edit or build their own code against).

- Unify existing plugin code a bit to use the same directories. All source code in src/, all binary code in build/ (even downloaded binary code), and all installed code in install/.

And I did some minor unrelated cleanup is also in this branch for convenience:

- When running locally, prepend (rather than append) our local snapcraft python module, so that any installed version doesn't get picked up instead.

- Allow skipping the plainbox tests via environment variable in runtests.sh

Description of the change

Clean up part lifecycle logic a bit.

- Drop stage() and snap() calls from plugins. The core code now handles those. Plugins do get a new snapFiles() call that allows them to specify whitelist and blacklist globs. (To be expanded in the future by letting the user blacklist more files from yaml.)

- Add new parts/XXX/install directory. This is a sort of staging area for the staging area. It's useful in three ways: (1) We can detect two parts trying to install the same file into staging (though this isn't implemented yet); (2) We can restrict the whitelist globs from a part to only match the filenames that are in install/ (since otherwise it could match files from other parts in the combined staging area); (3) And we can build other parts against only the parts that they specify (using after/requires) rather than any part that happened to get installed into staging. These changes leave staging as just a play area for the user (to either edit or build their own code against).

- Unify existing plugin code a bit to use the same directories. All source code in src/, all binary code in build/ (even downloaded binary code), and all installed code in install/.

And I did some minor unrelated cleanup is also in this branch for convenience:

- When running locally, prepend (rather than append) our local snapcraft python module, so that any installed version doesn't get picked up instead.

- Allow skipping the plainbox tests via environment variable in runtests.sh

This is part1. I'll probably do a second part2 branch to clean up some details around the install/ directory (notably, building parts only against other parts' install/ directories and detecting staging collisions).

To post a comment you must log in.
Revision history for this message
Michael Vogt (mvo) wrote :

Nice, I like that branch a lot. I have some comments inside, but nothing important so feel free to ignore (or not, as you want).

review: Approve
Revision history for this message
Michael Terry (mterry) wrote :

Add comments in response. Will add some comments to code to address your nits and then top-approve.

Revision history for this message
Snappy Tarmac (snappydevtarmac) wrote :

The attempt to merge lp:~mterry/snapcraft/lifecycle-fixes into lp:snapcraft failed. Below is the output from the failed tests.

Pulling mock-part
Skipping pull mock-part (already ran)

++ pwd
+ export PATH=/tmp/tarmac/branch.NH6Ejl/bin:/usr/bin:/bin
+ PATH=/tmp/tarmac/branch.NH6Ejl/bin:/usr/bin:/bin
++ pwd
+ export PYTHONPATH=/tmp/tarmac/branch.NH6Ejl:
+ PYTHONPATH=/tmp/tarmac/branch.NH6Ejl:
+ SRC_PATHS='bin snapcraft tests/unit'
+ pep8 bin snapcraft tests/unit --ignore=E501
+ pyflakes3 bin snapcraft tests/unit
+ cd tests/unit
+ python3 -m unittest
..
----------------------------------------------------------------------
Ran 2 tests in 0.019s

OK
+ '[' -z '' ']'
+ cd tests/plainbox
++ mktemp -d
+ temp_dir=/home/tarmac/tmp/tmp.RdIkVR22Sh
+ ./manage.py develop -d /home/tarmac/tmp/tmp.RdIkVR22Sh
usage: manage.py [--help] [--version] [options]
manage.py: error: unrecognized arguments: -d /home/tarmac/tmp/tmp.RdIkVR22Sh

Revision history for this message
Ricardo Salveti (rsalveti) wrote :

Nice mr, getting closer to what we defined in IoM.

review: Approve
Revision history for this message
Snappy Tarmac (snappydevtarmac) wrote :

The attempt to merge lp:~mterry/snapcraft/lifecycle-fixes into lp:snapcraft failed. Below is the output from the failed tests.

Pulling mock-part
Skipping pull mock-part (already ran)

++ pwd
+ export PATH=/tmp/tarmac/branch.lrX7lU/bin:/usr/bin:/bin
+ PATH=/tmp/tarmac/branch.lrX7lU/bin:/usr/bin:/bin
++ pwd
+ export PYTHONPATH=/tmp/tarmac/branch.lrX7lU:
+ PYTHONPATH=/tmp/tarmac/branch.lrX7lU:
+ SRC_PATHS='bin snapcraft tests/unit'
+ pep8 bin snapcraft tests/unit --ignore=E501
+ pyflakes3 bin snapcraft tests/unit
+ cd tests/unit
+ python3 -m unittest
..
----------------------------------------------------------------------
Ran 2 tests in 0.014s

OK
+ '[' -z '' ']'
+ cd tests/plainbox
++ mktemp -d
+ temp_dir=/home/tarmac/tmp/tmp.oTnbYTFHws
+ ./manage.py develop -d /home/tarmac/tmp/tmp.oTnbYTFHws
usage: manage.py [--help] [--version] [options]
manage.py: error: unrecognized arguments: -d /home/tarmac/tmp/tmp.oTnbYTFHws

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches