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

Allow source-type to specify local #1352

Merged
merged 6 commits into from Jun 20, 2017

Conversation

jocave
Copy link
Contributor

@jocave jocave commented Jun 5, 2017

Allows local overriding of a source-type to local

LP: #1695886

@sergiusens
Copy link
Collaborator

Hey, thanks for this, if no test can we at least get a reason for needing this?

@jocave
Copy link
Contributor Author

jocave commented Jun 5, 2017

Sure, I put a reason on the LP bug, but will reproduce here.

"The recent change to the schema that added an enumeration of valid 'source-types' means that now you cannot specify source-type to be local."

"The particular use case this allows is when you have a remote part with one of the currently valid source types e.g. git, and you want to fast iterate on the part without the requirement to check in to a repo (even one on your local file system). It was previously possible to override the source-type to local by putting any non-valid value in your local snapcraft.yaml source-type field whilst keeping all the other useful stuff like build-packages etc."

@sergiusens
Copy link
Collaborator

Ah, we certainly need a unit test at least for this so we do not regress again.

@come-maiz
Copy link
Contributor

@EduardoVega this is related to the code you touched. If you have some spare minutes, would you mind reviewing it after @jocave adds the test?

@EduardoVega
Copy link
Contributor

Hi @ElOpio , @sergiusens and @jocave . The change looks good. In fact it makes sense to have the local source-type option, so in case it is used, snapcraft will avoid the process to identify the handler for local sources.

Allows local overriding of a source-type to local

LP: #1695886
@@ -60,3 +61,7 @@ def test_extract_and_keep_debfile(self):

with open(deb_download, 'r') as deb_file:
self.assertEqual('Test fake compressed file', deb_file.read())

def test_has_source_handler_entry_on_linux(self):
if sys.platform == 'linux':
Copy link
Contributor

Choose a reason for hiding this comment

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

if sys.platform == 'linux':
self.assertTrue(sources._source_handler['rpm'] is sources.Rpm)
else:
self.assertRaises(KeyError, sources._source_handler['rpm'])
Copy link
Contributor

Choose a reason for hiding this comment

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

You are doing it differently here than in the deb case. Any reason?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, I meant for both to be like the rpm case. Opened atom to find not all files had been saved though!

Copy link
Contributor

@come-maiz come-maiz left a comment

Choose a reason for hiding this comment

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

@jocave your tests feel a little weird, because they are just checking that a dict is properly filled. That doesn't hurt, but it also doesn't provide a lot of value. I was thinking more about something like testing a pull, with source: local in the yaml. We don't seem to have any unit tests like this, which is something we need to change. So what do you think about an integration test instead?

@jocave
Copy link
Contributor Author

jocave commented Jun 14, 2017

@ElOpio sure, I can add an integration test.

Copy link
Contributor

@kyrofa kyrofa left a comment

Choose a reason for hiding this comment

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

This looks great to me. I'm sorry for the regression, and thank you for the fix! I have one small non-blocking request on the integration test.

version: 0.1
summary: one line summary
description: a longer description
icon: icon.png
Copy link
Contributor

Choose a reason for hiding this comment

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

Please toast the icon, it's not necessary anymore (yeah I know, some of our older integration tests still have them, not your fault).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@kyrofa no problem, it's done...

@kyrofa kyrofa added this to the 2.32 milestone Jun 17, 2017
Copy link
Contributor

@come-maiz come-maiz left a comment

Choose a reason for hiding this comment

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

approving. I'll merge it once it's green. Thanks!

@come-maiz come-maiz merged commit 2610a8a into canonical:master Jun 20, 2017
kalikiana pushed a commit to kalikiana/snapcraft that referenced this pull request Aug 3, 2017
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.

None yet

5 participants