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 2 commits into from Mar 20, 2019


None yet
3 participants
Copy link

commented Mar 14, 2019



No corresponding bug


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


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:

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.



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.


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

Copy link

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 Mar 18, 2019


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 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!
continuous-integration/travis-ci/pr The Travis CI build passed
coverage/coveralls Coverage increased (+0.0008%) to 97.376%

@joseivanlopez joseivanlopez referenced this pull request Mar 27, 2019


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.