Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

RFE: Handle DistTag #589

Closed
wladmis opened this issue Oct 30, 2018 · 26 comments
Closed

RFE: Handle DistTag #589

wladmis opened this issue Oct 30, 2018 · 26 comments
Assignees

Comments

@wladmis
Copy link
Contributor

wladmis commented Oct 30, 2018

In ALT we use disttag as one of build id of package builds (it stores repository_name.buildtask.subtask), so we need that rpm can handle it.

In this message I proposed a format like name[-[epoch:]version-[release[-disttag]]][.arch], but not everybody likes it 'cause its ambiguity. Lets discuss what the format it should be so we can implement it.

@Conan-Kudo
Copy link
Member

I think probably the most sane format would be name[-[epoch:]version-[release[.disttag]]][.arch]. That extends nicely and overlays cleanly over most Linux distributions' usages of a DistTag.

In addition, I would expect that the DistTag would be part of the filename format for both source and binary packages. I can currently force this for binary packages, but I'm not sure how to for source packages.

@wladmis
Copy link
Contributor Author

wladmis commented Oct 31, 2018

I think probably the most sane format would be name[-[epoch:]version-[release[.disttag]]][.arch].

Thanks for reply, but this format has same disadvantage as that I've proposed, and unlike "dash" symbol a "dot" symbol is a valid symbol for release, so if it will be separator for disttag it will be even worse for parsing.

@ignatenkobrain
Copy link
Contributor

  • Is different disttag for same EVR -- alternatives or ordered number?
  • I don't like either . or - because those are widely used everywhere so you basically need to change all software which are parsing EVR.

@wladmis
Copy link
Contributor Author

wladmis commented Nov 1, 2018

* Is different disttag for same EVR -- alternatives or ordered number?

Alternatives.

* I don't like either `.` or `-` because those are widely used everywhere so you basically need to change all software which are parsing EVR.

That's true. That is one of reason why I begin the discussion.

wladmis added a commit to wladmis/rpm that referenced this issue Nov 7, 2018
…pm-software-management#589)

ALT uses DistTag to differ various package builds of the same package
NEVR, so dbiFindByLabelArch tries to match the package against
name[-[epoch:]version[-release]][/disttag][.arch].

Signed-off-by: Vladimir D. Seleznev <vseleznv@altlinux.org>
@wladmis wladmis mentioned this issue Nov 7, 2018
@mlschroe
Copy link
Contributor

mlschroe commented Nov 9, 2018

ignatenkobrain: I don't think it makes sense to allow the disttag in dependencies, aka EVR. It's for the "canonical" package name, i.e. NEVRA.

In other words, 'rpm -qa' should print it and thus 'rpm -q' should understand it. It should also be a part of the filename, so '/' should not be used as a separator IMHO.

@wladmis
Copy link
Contributor Author

wladmis commented Nov 10, 2018

ignatenkobrain: I don't think it makes sense to allow the disttag in dependencies, aka EVR. It's for the "canonical" package name, i.e. NEVRA.

Definitely it does not make sense to allow DistTag in dependencies because DistTag shows an alternative build: generally, there is no order. Meanwhile dependencies has EVR on the set of which comparison operations are defined, which cannot be defined for DistTag.

In other words, 'rpm -qa' should print it and thus 'rpm -q' should understand it. It should also be a part of the filename, so '/' should not be used as a separator IMHO.

I'm not sure should DistTag be or not a part of the filename, it seems to be safer if it wouldn't, but if it would then the filename will be more descriptive.

Let's decide which format dbiFindByLabelArch() should match. I propose N[-V[-R]][/D][.A], the reasoning is that this collision proofed against any other fields name, version, release and arch, it's compatible with the current format, it's easy to parse and requires a little changes in the source code. @ignatenkobrain proposes N@D:E-V-R.A, but this seems a bit strange, I would change this to N[@D][-[E:]V[-R]][.A] that is fine to me, compatible with current format and allow plainly put the DistTag value to the filename as it is in the full format record. @Conan-Kudo is for N[-[E:]V[-R][.D]][.A] or N[-[E:]V[-R][-D]][.A] but I don't like neither of these cause its issues.

Next, I think it is reasonable to add a new rpmlib feature. rpm that can handle the new format should provides this feature, and a package that was built with non-empty DistTag should requires this feature. Of course we cannot backdate this requirement for existing packages with non-empty DistTag, but this can add this requirement for new packages. @Conan-Kudo actually I don't like the name rpmlib(DistTagInVersionComparison) cause the feature is not about "version comparison", it's about "build matching".

In other words, 'rpm -qa' should print it

For now rpm -qa prints NVRA but I also think that printring NEVRA+DistTag in the format would be more informative, but I also cannot be sure that this change does not break something.

Please, comment.

@wladmis
Copy link
Contributor Author

wladmis commented Nov 10, 2018

Let's decide which the format dbiFindByLabelArch() should match.

@Conan-Kudo
Copy link
Member

@wladmis What do you mean by "build matching"? I'm not sure I understand what you're saying here...

@wladmis
Copy link
Contributor Author

wladmis commented Nov 10, 2018

@wladmis What do you mean by "build matching"? I'm not sure I understand what you're saying here...

It may be more clear by example. As there are different builds of the same NEVR, there can be situation that two (or more) different builds can be simultaneously installed in the system. It's not a normal situation, but quite real when for some reason system upgrade breaks. And there are two different foo-1.0-1 with disttag1 and disttag2. rpm should be able to handle this and there should be a way to tell what build we what to erase. For example:

rpm -e foo-1.0-1/disttag1

or this way in depend what format rpm will use:

rpm -e foo@disttag1-1.0-1

PR #594 uses first variant.

@Conan-Kudo
Copy link
Member

That is effectively what OpenMandriva Lx3 does. And that's functionally saying that it's part of the version comparison, because you've made it a property of selecting a package.

@mlschroe
Copy link
Contributor

(Package selection is not version comparison, e.g. the package name is part of the package selection but not of version comparison.)

(It's currently pretty hard to have to packages installed with the same NEVR, as rpm will switch to that weird "package refresh" mode that does not do the uninstall part. That code really has to die, I don't know of any benefits and it's the cause of nasty surprises.)

What's the point of an rpmlib() dependency if the disttag is not a part of the dependency resolution? I don't understand the need for it.

@imz
Copy link

imz commented Nov 11, 2018

I think probably the most sane format would be name[-[epoch:]version-[release[.disttag]]][.arch].
That extends nicely and overlays cleanly over most Linux distributions' usages of a DistTag.

I think this is bad because this would make it impossible to split release.disttag.arch correctly without knowing the version of rpm. (Remember that . is allowed in release.)

But this property is already broken because rpm -qa used to print name-version-release, then changed to name-version-release.arch

...proposed a format like name[-[epoch:]version-[release[-disttag]]][.arch], but not everybody likes it 'cause its ambiguity. Lets discuss what the format it should be so we can implement it.

That's also bad for splitting name-version-release-disttag.arch correctly (for similar reasons): - is allowed in name, so finding the release and version is a matter of counting the dashes from the end.

So unfortunately, the existing separators are bad for this purpose, although that would be nice to re-use one of them for the sake of extensibility.

But for their usage to be "extensible", they must have been not allowed in either name or release (or other fields). It's better to forget about . and -, and introduce something that would allow to split confidently.

I think that being able to put this value in the filename can be desired. And it's better to have the same format, so / is bad.

Hmmm

Perhaps, use : again? Something like: name-[epoch:]version-release[:disttag].arch without changing the trailing .arch to be compatible with those consumers who parse this and expect the tail after the last dot to be arch. (They might get the release as release:disttag after parsing, but as long as this is invalid as a release for rpm, that's OK, because they would fail if they tried to use this string as a release, and the failure would indicate that they need an upgrade of their code.)

@imz
Copy link

imz commented Nov 11, 2018 via email

@imz
Copy link

imz commented Nov 11, 2018 via email

@imz
Copy link

imz commented Nov 11, 2018 via email

@imz
Copy link

imz commented Nov 11, 2018 via email

@wladmis
Copy link
Contributor Author

wladmis commented Nov 11, 2018

I think that being able to put this value in the filename can be desired. And it's better to have the same format, so / is bad.

Even if / is bad for filenames, we can use it for the format, and separate DistTag with some other symbol lile . or : in the filename. It would be ugly, I don't like it, but it is an option for that case.

In the interest of moving conversations about what character SHOULD be used as a separator for DistTag, I point you at the PCRE regex that has been in use for almost a decade here.

http://rpm5.org/cvs/fileview?f=rpm/macros/macros.in&v=1.39.2.52

See the 2 (one commented out) definitions of %evr_tuple_match. Both PCRE's as written assume a ':' separator for both Epoch and DistTag.

I take look at

%pattern_Disttag	^[A-Za-z0-9]+$

In ALT . is a valid symbol for DistTag and widely used for now.

Perhaps, use : again? Something like: name-[epoch:]version-release[:disttag].arch without changing the trailing .arch to be compatible with those consumers who parse this and expect the tail after the last dot to be arch. (They might get the release as release:disttag after parsing, but as long as this is invalid as a release for rpm, that's OK, because they would fail if they tried to use this string as a release, and the failure would indicate that they need an upgrade of their code.)

I take a look if : is good separator but it is valid symbol for release for ALT, so I decided to not using it when I was preparing the PR. But it seems to be invalid for others and it seems that no package in ALT actually use : in its release.

@imz @n3npq so you are voting for :?

@ignatenkobrain @Conan-Kudo your opinions?

@imz
Copy link

imz commented Nov 11, 2018 via email

@imz
Copy link

imz commented Nov 11, 2018 via email

@mlschroe
Copy link
Contributor

Or we keep the disttag out of the EVR comparison, like proposed by @wladmis. I believe this is much saner.

@imz
Copy link

imz commented Nov 11, 2018 via email

@wladmis
Copy link
Contributor Author

wladmis commented Nov 11, 2018

However, from ALT's point of view and ALT's practice, conceptually, there is a kind of package dependency which can be satisfied only if another package's disttag is equal to the value specified in this dependency.

I think it is off topic. I want to tell about this later, but this requires some background, for example, ALT rpm-build optimizes subpackages interdependencies (dependecies between packages built from one source package) to strict dependency. Historically, these strict dependecies was like name = EVR, but now it is even stricter because it contain a DistTag, as it can be seen in @imz example. But this can be only for packages built from one source code. Here is the code that optimize interdeps. I think this scheme won't be plainly adopted by other distributions but this is a concept you can view on and think about.

@pmatilai
Copy link
Member

I see @n3npq has been deleting his posts in the masses again, in this ticket and elsewhere, right after getting out of the previous ban for doing so. Enough is enough, @n3npq. This time the ban is until further notice, starting now.

@wladmis wladmis changed the title RFE: Handle disttag RFE: Handle DistTag Nov 12, 2018
@wladmis
Copy link
Contributor Author

wladmis commented Nov 14, 2018

@Conan-Kudo recently I take a brief look at OpenMandriva Lx3. It uses %name-%version-%release-%disttag%distepoch.%arch.rpm for filename, each of its rpm package provides name = %|epoch?{%{epoch}:}|%version-%release:%distepoch, which is nice.

There is no distepoch in rpm.org, and in ALT there are different branches with no linear order, so I propose follow format for package matching:

name[-[epoch:]version[-release]][:disttag][.arch],

and may be %name = %|epoch?{%{epoch}:}|%version-%release:%disttag to package provides,

and %name-%version-%release:%disttag.%arch.rpm for package filename.

Package format for dbiFindByLabelArch() to match: name[-[epoch:]version[-release]][:disttag][.arch].

@Conan-Kudo @ignatenkobrain @pmatilai @ffesti are you agree with that? If you are then I will write the code to PR.

@Conan-Kudo
Copy link
Member

I don't have a problem with it if @pmatilai and @ffesti are okay with it.

But the filename should use a dash instead of a colon to avoid issues with parsing file paths.

@ffesti ffesti added this to Needs triage in Ticket Review (Outdated) Mar 3, 2020
@ffesti ffesti moved this from Needs triage to Maybe in Ticket Review (Outdated) Jul 21, 2022
@dmnks
Copy link
Contributor

dmnks commented Jul 21, 2022

FWIW, this may or may not interfere with #2031.

@rpm-software-management rpm-software-management locked and limited conversation to collaborators Jan 16, 2024
@ffesti ffesti converted this issue into discussion #2845 Jan 16, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
No open projects
Development

No branches or pull requests

8 participants