I have a simple question and I don't know the answer:
What should a default value of a version-control-system reference for a module
component ("ref" value in modulemd YAML document) look like?
If a module document looks like this:
document: modulemd-packager
version: 3
data:
name: A
stream: B
components:
rpms:
foo:
rationale: API.
ref: C
bar:
rationale: API.
there are people concerned with the missing "ref:" line for package
"bar".
(Compare to "ref: C" for package "foo".) They want a sane default
value so
they do not have to repeat it over and over again.
What's actually the default? Current specification
<
https://github.com/fedora-modularity/libmodulemd/blob/main/yaml_specs/mod...
reads:
If no ref is given, the build system is permitted to make reasonable
assumptions about the correct default value. Otherwise, the fall-back is
the default branch for the git repository (commonly 'master').
So the specification is clear that it's implementation-defined. (I.e. how MBS
is configured.) But there are two concerns:
(1) "master" is not a good default for Fedora because Fedora renamed
"master"
branch to "rawhide"/"main". MBS developers know about it and want to
move to
"main" <
https://pagure.io/fm-orchestrator/issue/1735>. The
"main" would become
the "reasonable default value" configured in Fedora's MBS instance.
(2) There are people questioning even this git-ish "reasonable default value"
<
https://pagure.io/fm-orchestrator/issue/1226>,
<
https://pagure.io/modularity/issue/142>. They would like to see the
component ref to default to a branch name of the module YAML file:
Whatever the name of the branch is in module repository, the same branch
must be used for the referred components. If there is not branch like this
for the specified component, then master is used.
What do say current packaging guidelines
<
https://docs.fedoraproject.org/en-US/modularity/policies/naming-guideline...
using upstream major versions as branches is recommended
Well, that's a value no machine can figure out. That won't help us in
selecting a proper default for MBS. (Actually I saw a request to change the
recommended branch from an "upstream major version" to
"stream-MODULE-STREAM"
with an explanation that the latter prevents from conflicts if multiple
modules want to include a different version of the package.)
What do packagers use in Fedora 36?
# zcat
/var/cache/dnf/fedora-modular-f440a08391e7b71d/repodata/32db3716d3542119dfbb23f3880a7fcbf17e5720669de9570db941aedcf475a8-modules.yaml.gz
| grep ref: |sort | uniq -c | sort -n -r
115 ref: f33
56 ref: f34
14 ref: rawhide
5 ref: stream-postgresql-11
3 ref: 1.22
3 ref: stream-postgresql-12
2 ref: 1.21
2 ref: 1.20
2 ref: 1
2 ref: stream-6.0
2 ref: latest
1 ref: 9.2
1 ref: 82lts
1 ref: 8.10
1 ref: 6.2
1 ref: 6.1
1 ref: 6.0
1 ref: 5f5f293e
1 ref: 4.0
1 ref: 16
1 ref: 14
1 ref: 1.23
1 ref: 1.14
1 ref: 10.7
1 ref: 10.6
1 ref: 10.5
1 ref: stream-1.20
1 ref: stream-postgresql-14
1 ref: stream-postgresql-10
1 ref: stream-mainline
1 ref: nextcloud-22
1 ref: nextcloud-21
1 ref: nextcloud-19
1 ref: nextcloud-18
1 ref: nextcloud-stable
1 ref: mariadb-10.7
1 ref: mariadb-10.6
1 ref: mariadb-10.5
Plenty of them refer to a Fedora release branch (f34), a large amount of them
point to Rawhide, the rest uses a stream value or module-stream value.
As we can see, different people have different opinions. Based on that I was
thinking about adding a new top-level "ref" into modulemd-packager-v3 format.
A packager could define it's own default value. Moreover, it could
support some kind of templating like this:
data:
name: NAME
stream: STREAM
configurations:
- context: CONTEXT
platform: PLATFORM
buildopts:
ref: stream-%n-%s-%c-%p
components:
rpms:
foo:
ref: A_GIT_TREE_ISH
bar:
would expand to:
components:
rpms:
foo:
ref: A_GIT_TREE_ISH
bar:
ref: stream-NAME-STREAM-CONTEXT-PLATFORM
That would address this request <
https://pagure.io/modularity/issue/109> where
a packager wants use different braches for different Fedora (platform)
versions. There could be a formatting string "%b" expanding to a branch name
the module document. However, this new feature would require some changes on
various places (format specification, libmodulemd, MBS) and it would still
won't address the default. The dafault when packager does not want to type
anything.
A similar approach was already proposed in
<
https://pagure.io/modularity/issue/142#comment-579336> by introducing
"ref: __REF_STREAM__" and "ref: __REF_PLATFORM__" special values.
However, adding a new option or new special values has already been disliked
with:
However, where I propose to follow convention over configuration, you are
adding more configuration. Where I propose to simplify and remove things,
you propose more stuff.
I believe a motivation for relying on no explicit reference is to have the
module document portable. E.g. creating a new stream of ruby would mean only
copying the same document into a new branch and MBS would automacically
started using RPM components from the new branch. The packager coul save his
sed-fu for more compelling occasions. On the other hand, locally developed
modules which does not reside in any git tree have simply no branch.
Can we reach a consesus? Can developers of Fedora recommend a default that
would be less questionable?
-- Petr