I had an insightful discussion with Sopwith this afternoon, and we discussed the idea of dist tags, and some important discussion arose:
Elliot pointed out that for any given .src.rpm, the name-version-release needs to stay fixed for all builds of that .src.rpm. Otherwise it becomes impossible to track packages back to their source, keep an audit trail, etc.
The problem with using the macros is that if a maintainer does 'make build' on an fc3 box, then they get the dist tag value from that machine in the n-v-r. When they go to check this into CVS (say, into the fc4 branch), its wrong. We don't want someone doing 'make tag' on the FC-4 branch and having n-v-r = foo-1.2-3.fc3.
But at the same time, we also want to avoid forcing the packagers to have to put the dist value into the spec manually. This defeats the entire reason for dist tags, which is to have a single spec that can be used for multiple distributions.
We discussed a lot of options, but Elliot came up with a good idea, which is best explained by giving an example of a new package commit:
- I'm a maintainer, of package logjam. - I make a single spec for all possible fc builds using the documented "approved" dist macros - I set Release: 1 (note, no %{dist}) - I make my src.rpm. - I then run ./cvs-import.sh --use-dist --branch=fc4 logjam-1.0.0-1.src.rpm - The cvs-import script does the following: - Checks my spec to make sure that n-v-r doesn't have %{dist} in it already - Notes the value of the branch that I'm checking this package into - Uses that value and adds the following lines to the top of my spec %define fedora 4 %define dist .fc4 - Appends %{?dist} to the end of Release (so it becomes Release: 1%{?dist} ) - Commits the spec with the added defines into the branch.
Now, with this mechanism, if I want to do multiple branches for a single spec, its easy, cvs-import.sh does the work for me. We keep a single n-v-r per branch, and there is no naming conflicts between branches.
The branch-copy operations would just change the values of the macros, or add the macros near the top if they're not already in the .spec file.
We'd want to add a check in the buildsystem to make sure that people haven't polluted the %{dist} defines, but that shouldn't be terribly difficult.
Now, for people wanting to take their original spec and build it somewhere else, say for RHEL, we could use a set of rpm macros. Elliot and I worked on a simple shell script that parses /etc/redhat-release and returns (depending on the flag chosen):
The version of RHEL for %{_el} (if on RHEL) The version of Fedora for %{_fedora} (if on Fedora) The version of RHL for %{_rhel} (if on RHL) The number of the distro for %{_distnum} The type of the distro for %{_disttype} The dist tag value for %{_dist}
The macros then become as simple as:
%_dist %{expand:%%(/usr/lib/rpm/redhat/dist.sh --dist)} %_distnum %{expand:%%(/usr/lib/rpm/redhat/dist.sh --distnum)} %_disttype %{expand:%%(/usr/lib/rpm/redhat/dist.sh --disttype)} %_rhel %{expand:%%(/usr/lib/rpm/redhat/dist.sh --el)} %_fedora %{expand:%%(/usr/lib/rpm/redhat/dist.sh --fc)} %_rhl %{expand:%%(/usr/lib/rpm/redhat/dist.sh --rhl)}
The script is already checked into CVS for redhat-rpm-config. If you wanted to build off that spec for RHEL, you'd just need to add these 7 lines to your local .rpmmacros file.
This provides a standardized, easy way to do single-spec, multiple distribution packaging. But of course, there are bound to be complications.
Please ponder this implementation, and offer feedback.
Thanks,
~spot
Please ponder this implementation, and offer feedback.
Since no one has offered any feedback, either no one cares, or what I've proposed is acceptable without comment.
Please let me know which one is accurate. :)
~spot
On Sun, 3 Apr 2005, Tom 'spot' Callaway wrote:
Please ponder this implementation, and offer feedback.
Since no one has offered any feedback, either no one cares, or what I've proposed is acceptable without comment.
Please let me know which one is accurate. :)
I didn't reply because CVS and the internal buildsystem do not affect me. But if you want to know my opinion, I think the actual tagging should be done by the buildsystem and not by CVS, RPM or the packager.
I have said this before during the disttag discussions, so nothing new here.
PS Could you clarify again what's inside %{dist}, %{distnum} and %{disttype} ? My buildsystem currently knows:
dist -> fc3 disttag -> 1.fc3 fc3 -> 1
and the necessary dot is added by the buildsystem to disttag. Only dist and fc3 are used inside SPEC files. I think we have to rely on the macro language for granularity anyway (say you want a patch only to apply for fc2 and fc3, not fc1 and fc4).
Kind regards, -- dag wieers, dag@wieers.com, http://dag.wieers.com/ -- [all I want is a warm bed and a kind word and unlimited power]
On Mon, Apr 04, 2005 at 04:39:50AM +0200, Dag Wieers wrote:
On Sun, 3 Apr 2005, Tom 'spot' Callaway wrote:
Please ponder this implementation, and offer feedback.
Since no one has offered any feedback, either no one cares, or what I've proposed is acceptable without comment.
Please let me know which one is accurate. :)
I didn't reply because CVS and the internal buildsystem do not affect me. But if you want to know my opinion, I think the actual tagging should be done by the buildsystem and not by CVS, RPM or the packager.
I have said this before during the disttag discussions, so nothing new here.
Same here. Very early at ATrpms I had the disttag internal to the buildsystem, but this is a very bad choice. It need to be passed from the outside.
Nothing against a patch to rpm that makes it easier to manage the disttag, e.g. different distag for src.rpm that for binary rpm (i.e. no disttag for src.rpm).
On Sun, 03 Apr 2005 20:39:07 -0500, Tom 'spot' Callaway wrote:
Please ponder this implementation, and offer feedback.
Since no one has offered any feedback, either no one cares, or what I've proposed is acceptable without comment.
Please let me know which one is accurate. :)
IMO, the former. I've lost interest in dist tags which require more than appending %{?dist} (or a hardcoded tag) to the release field.
We keep packages in a CVS layout with multiple branch directories, not in a single CVS directory with real CVS-style branches. If we wanted to share a single spec for multiple target distributions, we ought to have a build-system which can pull a src.rpm from a CVS-style branch, a single tag _or_ a specific directory and append a dist tag on-the-fly (e.g. by defining %dist). Then we would really share a single source for multiple platforms.
The process you describe looks too manual and too error-prone to me. It involves automated modification of a spec file during CVS import, adding hardcoded distribution specific constants and leading to CVS contents which differ in multiple branches. To support this process, the package developer needs to keep a pristine src.rpm somewhere else (for pre-commit building and testing of a single src.rpm on multiple platforms) or import a modified fc4 src.rpm into the fc3/fc2 branches and let the script replace the inserted constants. Package development should look different for 98% of the package developers: update working copy, build test packages on all target platforms, test on all target platforms, cvs commit. With constants hardcoded in the spec--just to work around cvs tagging problems--this is changed.
All it takes to add a dist tag, when there is minimal benefit, is to hardcode it in the spec file in the proper branch directory prior to commit. Tools like diff and patch make it convenient enough to duplicate package updates into multiple branch directories.
The other rpm macros are helpful, though.
On Sun, 3 Apr 2005, Tom 'spot' Callaway wrote:
Please ponder this implementation, and offer feedback.
Since no one has offered any feedback, either no one cares, or what I've proposed is acceptable without comment.
Please let me know which one is accurate. :)
There is another alternative: that prior forays through this have left the parties exhausted ;)
- Russ Herrold
packaging@lists.fedoraproject.org