#54 Contradiction concerning epoch usage in versioned dependencies
Closed: Fixed Opened by ndim.

The [http://fedoraproject.org/wiki/Packaging:Guidelines#Requires Packaging Guidelines on "Requires"] state

{{{
Second, the Epoch must be listed when adding a versioned dependency
to achieve robust epoch-version-release comparison.
}}}

Note the use of the word ''must'' without any qualification as to an Epoch: actually needing to be defined. I read this text as follows:

  • Every versioned dependency MUST use %{epoch}:%{version}-%{release}, or rather (as this does not work in absence of an actual explicit Epoch: header), %{?epoch:%{epoch}:}%{version}-%{release}. If the EVR are referring to a different package, there is no issue with %{epoch} being defined, and a constant string like 0:1.2.3-4 both conforms to the Guidelines and works.

  • Using just %{version}-%{release} does NOT conform to the Packaging Guidelines.

The [http://fedoraproject.org/wiki/Packaging:Guidelines#Requiring_Base_Package Packaging Guidelines on "Requiring Base Package"] state

{{{
[...] It is almost always better to over specify the version, so
it is best practice to just use a fully versioned dependency:
Requires: %{name}%{?_isa} = %{version}-%{release}.
Devel packages are an example of a package that must require
their base packages using a fully versioned dependency. [...]

Requires: %{name}%{?_isa} = %{version}-%{release}
}}}

Note that there is no word about the epoch here.

Also note that e.g. [http://fedoraproject.org/wiki/PackagingGuidelines#Packaging_Static_Libraries Packaging Guidelines on "Packaging Static Libraries"] makes no mention of using an epoch in the Provides: foo-static = ... tag.

It appears to me that actually using %{?epoch:%{epoch}:}%{version}-%{release} over %{version}-%{release} only makes sense if Epoch: is actually used in a package.

So I would like to suggest to amend the ''Epoch must be listed'' phrase in a way which avoids suggesting that the Epoch must be listed even when undefined.

Alternatively, probably 90+% of packages and guidelines which refer to %{version}-%{release} in any way would need to be changed, which appears to be a lot of work for little gain.


It's not exactly a contradiction, it's just that the most common case is that Epoch's are not present.

How's this look as a clarification:

{{{
Second, if the package being depended upon has an Epoch then it must be listed when
adding a versioned dependency to achieve robust epoch-version-release comparison. A
quick way to check the Epoch of a package is to run:
rpm --query --qf "%{EPOCH}\n" packagename

If the output is "(none)" then no epoch is set. Otherwise, the number printed is
the Epoch that needs to be added to the versioned dependency.
}}}

Note that recent rpm's (those after el5) have epochnum, so you can do:

rpm --query --qf "%{EPOCHNUM}\n" yum

...and it'll print the right thing.

I fear I may not quite have gotten my point across.

Adding a 0: in front of 1.2.3-5.6 is easy to write, easy to read, and kind of obvious.

The case I am mostly asking about here is when e.g. a plugin subpackage depends on its base package. Then that subpackage would have something like

{{{

Iff there IS an "Epoch:" tag in this spec file

Requires: %{name}-base%{_isa} = %{epoch}:%{version}-%{release}
}}}

{{{

Iff there is NO "Epoch:" tag in this spec file

Requires: %{name}-base%{_isa} = %{version}-%{release}
}}}

Mandating those two solutions for those two case would make sense to me (even though only the epoch-less case is actually listed in [http://fedoraproject.org/wiki/PackagingGuidelines#Requiring_Base_Package]).

However, the wording in the Epoch paragraph (by using the word ''must'') suggests that all packages actually ''must'' use the more complicated variant (complicated to write, complicated to read) even for the large majority of packages lacking an "Epoch:" tag:

{{{

Works whether there is an "Epoch:" tag in this spec file or not

Requires: %{name}-base%{_isa} = %{?epoch:%{epoch}:}%{version}-%{release}
}}}

And the Guidelines have no mention of the %{epoch} macro anywhere, so the model tag lines in the Guidelines contradict the "''must'' list epoch" requirement.

I think I understand and I think that the paragraph I posted covers that....

https://fedoraproject.org/wiki/PackagingDrafts/Epoch_New was approved, (+1:6, 0:0, -1:0)

Also, change sentence in Requires to read:

Second, the Epoch (if used) must be listed when adding a versioned dependency to achieve robust epoch-version-release comparison. See #Epoch for details.

This section will be merged into http://fedoraproject.org/wiki/Packaging:Guidelines#Use_of_Epochs

Announce text:

The section on Epochs was improved, and clarifying language about Epoch use in Requires was added to the Packaging Guidelines:

https://fedoraproject.org/wiki/Packaging:Guidelines#Use_of_Epochs
https://fedoraproject.org/wiki/Packaging:Guidelines#Requires

Metadata Update from @toshio:
- Issue assigned to spot

Metadata