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

Sort Partition IDs Logically #872

Merged
merged 2 commits into from Mar 20, 2019

Conversation

Projects
None yet
3 participants
@shundhammer
Copy link
Contributor

commented Mar 14, 2019

Trello

https://trello.com/c/uJDzzpFV/

Bugzilla

No corresponding bug

Problem

Partition IDs (types) were not sorted in any meaningful way in the partitioner.

Fix

Introduced a sort order on the Ruby level of that type (enum which is imported and mapped from libstorage-ng).

We now have a table in the Ruby code for the desired sort order and a spaceship operator (<=>) that uses that table so the normal Ruby sort function can be used:

https://github.com/yast/yast-storage-ng/pull/872/files#diff-ecc44dd40509958fa302edf2358c7f8fR60

Of course the partitioner still only shows those types that are actually applicable, not just every value of that enum.

Values that are not in that sort order table are sorted at the end.

part-sort-order

Notice

This is for SLE-15 SP2. We need to wait until we have a branch for SLE-15 SP1, so for now there is no change log entry and no version bump to avoid complaints of the OBS change log check scripts for entries being out of chronological order.

@coveralls

This comment has been minimized.

Copy link

commented Mar 14, 2019

Coverage Status

Coverage increased (+0.0008%) to 97.376% when pulling 4c6209e on shundhammer:huha-ptype-order into 45913b5 on yast:master.

@shundhammer shundhammer changed the title Sort Partition IDs Logically [Post-SLE-15-SP1] Sort Partition IDs Logically Mar 14, 2019

@dgdavid
Copy link
Member

left a comment

👍 LGTM, just a minor comment.

it "sorts Linux Native before Linux Swap" do
linux = Y2Storage::PartitionId::LINUX
swap = Y2Storage::PartitionId::SWAP
expect(linux.sort_order < swap.sort_order).to eq true

This comment has been minimized.

Copy link
@dgdavid

dgdavid Mar 18, 2019

Member

NP: You also can use

expect(linux.sort_order).to be < swap.sort_order

which seems more readable to me.

This comment has been minimized.

Copy link
@shundhammer

shundhammer Mar 18, 2019

Author Contributor

OK, good idea.

@shundhammer shundhammer changed the base branch from master to pre-SLE-15-SP2 Mar 20, 2019

@shundhammer shundhammer changed the title [Post-SLE-15-SP1] Sort Partition IDs Logically Sort Partition IDs Logically Mar 20, 2019

@shundhammer shundhammer merged commit aa182cc into yast:pre-SLE-15-SP2 Mar 20, 2019

3 checks passed

codeclimate All good!
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
coverage/coveralls Coverage increased (+0.0008%) to 97.376%
Details

@joseivanlopez joseivanlopez referenced this pull request Mar 27, 2019

Merged

Merge pre-SLE-15-SP2 #883

@shundhammer shundhammer deleted the shundhammer:huha-ptype-order branch Mar 28, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.