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

Bug 1459222 - Allow release version numbers on beta (for RCs) #17

Merged
merged 2 commits into from Mar 5, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Expand Up @@ -2,6 +2,11 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).

## [0.2.5] - 2019-03-05
### Changed
* Allow release version numbers on beta (for RCs)


## [0.2.4] - 2018-10-08
### Fixed
* Looking up for an ESR previous snap doesn't raise anymore
Expand Down
24 changes: 12 additions & 12 deletions pushsnapscript/snap_store.py
Expand Up @@ -24,15 +24,15 @@
log = logging.getLogger(__name__)


_VERSION_TYPE_PER_CHANNEL = {
'edge': VersionType.BETA,
'beta': VersionType.BETA,
'candidate': VersionType.RELEASE,
'stable': VersionType.RELEASE,

'esr': VersionType.ESR,
'esr/stable': VersionType.ESR,
'esr/candidate': VersionType.ESR,
_VERSION_TYPES_PER_CHANNEL = {
'edge': (VersionType.BETA,),
'beta': (VersionType.BETA, VersionType.RELEASE,),
'candidate': (VersionType.RELEASE,),
'stable': (VersionType.RELEASE,),

'esr': (VersionType.ESR,),
'esr/stable': (VersionType.ESR,),
'esr/candidate': (VersionType.ESR,),
}

# TODO: Parametrize this once we have other products
Expand Down Expand Up @@ -100,7 +100,7 @@ def _store_session(macaroon_location):
def _release_if_needed(store, channel, snap_file_path):
# We can't easily know what's the revision and the version of the current and the latest snap.
# That's why this function fetches all availables revisions, transforms the data, and then
# finds what's current and latest,
# finds what's current and latest.
all_revisions = _list_all_revisions(store)
metadata_per_revision = _pluck_metadata(all_revisions)
metadata_per_revision = _filter_versions_that_are_not_the_same_type(metadata_per_revision, channel)
Expand Down Expand Up @@ -149,12 +149,12 @@ def _pluck_metadata(snap_revisions):


def _filter_versions_that_are_not_the_same_type(metadata_per_revision, channel):
expected_version_type = _VERSION_TYPE_PER_CHANNEL[channel]
expected_version_types = _VERSION_TYPES_PER_CHANNEL[channel]

return {
revision: revision_metadata
for revision, revision_metadata in metadata_per_revision.items()
if revision_metadata['version'].version_type == expected_version_type
if revision_metadata['version'].version_type in expected_version_types
}


Expand Down
3 changes: 3 additions & 0 deletions pushsnapscript/test/test_snap_store.py
Expand Up @@ -251,6 +251,9 @@ def test_pluck_metadata():
2: {
'version': GeckoSnapVersion.parse('63.0b2-1'),
},
3: {
'version': GeckoSnapVersion.parse('62.0-1'),
},
4: {
'version': GeckoSnapVersion.parse('63.0b3-1'),
},
Expand Down
2 changes: 1 addition & 1 deletion version.txt
@@ -1 +1 @@
0.2.4
0.2.5