Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
PMS, version comparing, _p suffix [SOLVED]
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
halcon
l33t
l33t


Joined: 15 Dec 2019
Posts: 629

PostPosted: Sat Apr 17, 2021 4:29 pm    Post subject: PMS, version comparing, _p suffix [SOLVED] Reply with quote

Hi!

Could anyone explain me the sense of the lines #11 and #17 of the Algorithm 3.5?

As far as I understand, suffix _p is more than no suffix, and other suffixes are less than no suffix. That logic is being confirmed by Funtoo page.

But the lines #11 and #17 are doing an absolutely other thing. They reverse the suffix order, and their conditions (at the lines #8 and #14) do not even consider another (least) suffix value.

Why not make the order (in the Algorithm 3.6) so:
Code:
_alpha < _beta < _pre < _rc <  <NO_SUFFIX>  < _p

and not return in the Algorithm 3.5 just
Code:
if Asn > Bsn then
return  A > B
else if Asn < Bsn then
return  A < B
?

EDIT

That ^^, actually, would be correct for one suffix only, right? For multiple suffixes the logic should be more complicated?

I am not an expert in software releases... Please correct me if I am wrong:
pre_alpha < pre_alpha_p < rc_alpha < rc_alpha_p < alpha < alpha_p < pre_beta < pre_beta_p < rc_beta < rc_beta_p < beta < beta_p < pre < pre_p < rc < rc_p < no_suffix < p
Does this list include all the possible combinations?
Maybe some combinations are not used?
_________________
A wife asks her husband, a programmer:
- Could you please go shopping for me and buy one carton of milk, and if they have eggs, get 6?
He comes back with 6 cartons of milk.
- Why did you buy 6 cartons of milk?
- They had eggs.


Last edited by halcon on Sat Apr 17, 2021 10:16 pm; edited 1 time in total
Back to top
View user's profile Send private message
GDH-gentoo
Veteran
Veteran


Joined: 20 Jul 2019
Posts: 1530
Location: South America

PostPosted: Sat Apr 17, 2021 7:20 pm    Post subject: Re: PMS, version comparing, _p suffix Reply with quote

Parsing formal specifications is quite the brain excercise, isn't it :D

halcon wrote:
Could anyone explain me the sense of the lines #11 and #17 of the Algorithm 3.5?

Lines #8 to #12 cover the case in which A has more suffixes than B, but if the extra suffixes are removed, A is identical to B. If A was not identical to B with the extra suffixes removed, the loop in lines #4 to #6 would have yielded the comparison's result for some value of i, so the algorithm finishes and line #7 is never reached. Therefore, they cover the case in which A and B are of the form:

A ::= common-part first-extra-suffix [ more-suffixes ] -- [] means "optionally present"
B ::= common-part

For example, common-part could be 1.32.43q_alpha3_rc7. In that case, A > B if first-extra-suffix is _p unsigned-integer, matching your understanding that <NO_SUFFIX> < _p, and A < B in any other case, matching your understanding that "anything else" < <NO_SUFFIX>.

Then, for example:

1.32.43q_alpha3_rc7_p10_beta1 > 1.32.43q_alpha3_rc7

but:

1.32.43q_alpha3_rc7_pre10_beta1 < 1.32.43q_alpha3_rc7

Here, using the notation of Algorithm 3.5, As_0 and Bs_0 are _alpha3, As_1 and Bs_1 are _rc7, Asn is 4, Bsn is 2, As_2 is either _p10 or _pre10, depending on the example, As_3 is _beta1, and As_Bsn is As_2.

(Using _ for subscripts, and ignoring the fact that such a convoluted version is highly unlikely in real cases :))

Lines #14 to #18 cover a similar case, but when B is the one with more suffixes.

halcon wrote:
I am not an expert in software releases... Please correct me if I am wrong:
pre_alpha < pre_alpha_p < rc_alpha < rc_alpha_p
Yes.

halcon wrote:
rc_alpha_p < alpha
No, the opposite, because _alpha < _rc (line #5 for i == 0).

halcon wrote:
alpha < alpha_p < pre_beta < pre_beta_p < rc_beta < rc_beta_p
Yes.

halcon wrote:
rc_beta_p < beta
No, the opposite, because _beta < _rc (line #5 for i == 0).

halcon wrote:
beta < beta_p < pre < pre_p < rc < rc_p < no_suffix < p
Yes.
Back to top
View user's profile Send private message
halcon
l33t
l33t


Joined: 15 Dec 2019
Posts: 629

PostPosted: Sat Apr 17, 2021 8:42 pm    Post subject: Re: PMS, version comparing, _p suffix Reply with quote

GDH-gentoo wrote:
Parsing formal specifications is quite the brain excercise, isn't it :D

Yes, one of these :)

GDH-gentoo wrote:
Lines #8 to #12 cover the case in which A has more suffixes than B, but if the extra suffixes are removed, A is identical to B. If A was not identical to B with the extra suffixes removed, the loop in lines #4 to #6 would have yielded the comparison's result for some value of i, so the algorithm finishes and line #7 is never reached.

Oh, indeed! Thanks for resolving that :)

GDH-gentoo wrote:
1.32.43q_alpha3_rc7_p10_beta1 > 1.32.43q_alpha3_rc7

but:

1.32.43q_alpha3_rc7_pre10_beta1 < 1.32.43q_alpha3_rc7
GDH-gentoo wrote:
ignoring the fact that such a convoluted version is highly unlikely in real cases :))

What do your examples mean at all? How could alpha and beta be there at the same time? :)

GDH-gentoo wrote:
halcon wrote:
rc_alpha_p < alpha
No, the opposite, because _alpha < _rc (line #5 for i == 0).
halcon wrote:
rc_beta_p < beta
No, the opposite, because _beta < _rc (line #5 for i == 0).

And where should be alpha and beta? Please provide the right (full) sequence :)

EDIT

I guess, the right sequence is
alpha < alpha_p < beta < beta_p < pre_alpha < pre_alpha_p < pre_beta < pre_beta_p < rc_alpha < rc_alpha_p < rc_beta < rc_beta_p < pre < pre_p < rc < rc_p < no_suffix < p ?

Yeah, according to this left-to-right-comparison logic, what I meant with pre_alpha (i.e. version before alpha) should actually be alpha_pre...
_________________
A wife asks her husband, a programmer:
- Could you please go shopping for me and buy one carton of milk, and if they have eggs, get 6?
He comes back with 6 cartons of milk.
- Why did you buy 6 cartons of milk?
- They had eggs.
Back to top
View user's profile Send private message
GDH-gentoo
Veteran
Veteran


Joined: 20 Jul 2019
Posts: 1530
Location: South America

PostPosted: Sat Apr 17, 2021 9:18 pm    Post subject: Re: PMS, version comparing, _p suffix Reply with quote

halcon wrote:
What do your examples mean at all? How could alpha and beta be there at the same time? :)
Nothing other that they are valid versions according to section 3.2 of the PMS, and allow me to show the result of the algorithm for a non-trivial case. I guess you could read 1.32.43q_alpha3_beta1 as "the first beta version of the third alpha version of release 1.32.43q" :lol:

halcon wrote:
Please provide the right (full) sequence :)

EDIT

I guess, the right sequence is
alpha < alpha_p < beta < beta_p < pre_alpha < pre_alpha_p < pre_beta < pre_beta_p < rc_alpha < rc_alpha_p < rc_beta < rc_beta_p < pre < pre_p < rc < rc_p < no_suffix < p ?
Nope, it would be:

alpha < alpha_p < beta < beta_p < pre_alpha < pre_alpha_p < pre_beta < pre_beta_p < pre < pre_p < rc_alpha < rc_alpha_p < rc_beta < rc_beta_p < rc < rc_p < no_suffix < p
Back to top
View user's profile Send private message
halcon
l33t
l33t


Joined: 15 Dec 2019
Posts: 629

PostPosted: Sat Apr 17, 2021 10:16 pm    Post subject: Re: PMS, version comparing, _p suffix Reply with quote

GDH-gentoo wrote:
Nothing other that they are valid versions according to section 3.2 of the PMS, and allow me to show the result of the algorithm for a non-trivial case. I guess you could read 1.32.43q_alpha3_beta1 as "the first beta version of the third alpha version of release 1.32.43q" :lol:

ROFL ))

GDH-gentoo wrote:
Nope, it would be:

alpha < alpha_p < beta < beta_p < pre_alpha < pre_alpha_p < pre_beta < pre_beta_p < pre < pre_p < rc_alpha < rc_alpha_p < rc_beta < rc_beta_p < rc < rc_p < no_suffix < p

Yes, sure, I forgot to move pre and pre_p :)

Marking as solved!
_________________
A wife asks her husband, a programmer:
- Could you please go shopping for me and buy one carton of milk, and if they have eggs, get 6?
He comes back with 6 cartons of milk.
- Why did you buy 6 cartons of milk?
- They had eggs.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum