Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cli: refactor re-execution into legacy #2571

Merged
merged 20 commits into from
Jun 1, 2019

Conversation

sergiusens
Copy link
Collaborator

@sergiusens sergiusens commented May 28, 2019

This refactor makes it easy to still use the old commands regardless of the
existence of a base in the project and to use the store related commands
from non-legacy regardless of where this is run from.

To achieve this, a new class command inherited from click.Command
was created that can detect if invocation of the legacy code base is
required.

Simple skeletons to handle remote parts, search, update and define,
were created that simply execute into the legacy snapcraft.

Signed-off-by: Sergio Schvezov sergio.schvezov@canonical.com

  • Have you followed the guidelines for contributing?
  • Have you signed the CLA?
  • Have you successfully run ./runtests.sh static?
  • Have you successfully run ./runtests.sh tests/unit?

@sergiusens sergiusens force-pushed the rexec-refactor branch 3 times, most recently from c1b5a84 to 8fb4ca5 Compare May 28, 2019 13:43
snapcraft/cli/legacy.py Outdated Show resolved Hide resolved
@cjp256
Copy link
Contributor

cjp256 commented May 28, 2019

Did some testing: cleanbuild with and without legacy, looked good. Ran unit tests, looked good.

Ran refresh, update, search, and define -- looked good too.

Copy link
Contributor

@cmatsuoka cmatsuoka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

snapcraft/cli/__main__.py Show resolved Hide resolved
@codecov-io
Copy link

codecov-io commented May 29, 2019

Codecov Report

❗ No coverage uploaded for pull request base (master@7c6e7b1). Click here to learn what that means.
The diff coverage is 68.05%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master    #2571   +/-   ##
=========================================
  Coverage          ?   89.01%           
=========================================
  Files             ?      205           
  Lines             ?    13986           
  Branches          ?     2118           
=========================================
  Hits              ?    12450           
  Misses            ?     1083           
  Partials          ?      453
Impacted Files Coverage Δ
snapcraft/cli/__main__.py 0% <0%> (ø)
snapcraft/cli/_command_group.py 100% <100%> (ø)
snapcraft/storeapi/_client.py 100% <100%> (ø)
snapcraft/cli/_options.py 84.21% <100%> (ø)
snapcraft/cli/legacy.py 77.77% <57.14%> (ø)
snapcraft/cli/_command.py 58.33% <58.33%> (ø)
snapcraft/cli/_runner.py 91.83% <66.66%> (ø)
snapcraft/cli/lifecycle.py 86.76% <83.33%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7c6e7b1...76e3fa8. Read the comment docs.

sergiusens added 11 commits May 30, 2019 11:45
This refactor makes it easy to still use the old commands regardless of the
existence of a base in the project and to use the store related commands
from non-legacy regardless of where this is run from.

To acheive this, the decision to re-execute into legacy is in the lifecycle
logic by checking for the existence of a base and by providing hidden
commands for the older, previously unavailable, commands.

Signed-off-by: Sergio Schvezov <sergio.schvezov@canonical.com>
@cjp256
Copy link
Contributor

cjp256 commented May 31, 2019

Did some testing on latest: cleanbuild with and without legacy, refresh, update, search, and define -- all systems seemed fine. LGTM

Copy link
Contributor

@cmatsuoka cmatsuoka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was somewhat difficult to follow because things were added and later removed, but overall it seems to be working.

@sergiusens sergiusens merged commit a1cd034 into canonical:master Jun 1, 2019
@sergiusens sergiusens deleted the rexec-refactor branch June 1, 2019 14:11
clobrano pushed a commit to clobrano-forks/snapcraft that referenced this pull request Jun 8, 2019
This refactor makes it easy to still use the old commands regardless of the
existence of a base in the project and to use the store related commands
from non-legacy regardless of where this is run from.

To achieve this, a new class command inherited from click.Command
was created that can detect if invocation of the legacy code base is
required.

Simple skeletons to handle remote parts, search, update and define,
were created that simply execute into the legacy snapcraft.

Signed-off-by: Sergio Schvezov <sergio.schvezov@canonical.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants