Closed junaruga closed 7 years ago
Memo: After talking with @hhorak, I decided to add rpmlb --platform
option.
@hhorak one more question, do you know CentOS's macro name such as Fedora: %{?fc25}
, RHEL: %{el7}
?
one more question, do you know CentOS's macro name such as Fedora: %{?fc25}, RHEL: %{el7}?
I could solve above thing.
Download centos-release
package from below site, and unpack the RPM file.
https://centos-packages.com/7/package/centos-release/
Then
$ cat ./etc/rpm/macros.dist
# dist macros.
%centos_ver 7
%centos 7
%rhel 7
%dist .el7.centos
%el7 1
<mock-chroot> sh-4.2# cat /etc/rpm/macros.dist
# dist macros.
%rhel 7
%dist .el7
%el7 1
$ cat /usr/lib/rpm/macros.d/macros.dist
# dist macros.
%fedora 25
%dist .fc25
%fc25 1
I decided the specification for the platform element feature considering current situation.
At first, I prefer to use rpmlb --dist string
than rpmlb --platform string
to specify platform.
Because the name dist
is used in above RPM macro and .travis.yml
to describe platform.
COLLECTION_ID/packages/PACKAGE/dist
: This is a conditional statement for PACKAGE.$DIST
environment variable is in the actual command in cmd
element: This can be a conditional statement for each actual command in cmd
element.Available dist option's value.
--dist el
--dist el7
--dist fc
--dist fc25
--dist centos
--dist centos7
I show you examples in the recipe file.
rubygem-rspec-mocks
is built for all the el
platforms.
- rubygem-rspec-mocks:
replaced_macros:
need_bootstrap_set: 1
dist: 'el'
rubygem-rspec-mocks
is built for only el6
and el7
platforms.
- rubygem-rspec-mocks:
replaced_macros:
need_bootstrap_set: 1
dist: 'el[67]'
rubygem-flexmock
's command line sed -i '/^BuildRequires.*rubygem(rspec)$/ s/^/#/' rubygem-flexmock.spec
is run for only all the centos platforms.
- rubygem-flexmock:
macros:
_with_bootstrap: 1
cmd:
# Hack around flexmock bootstrap
- |
if [[ "${DIST}" =~ centos ]]; then
sed -i '/^BuildRequires.*rubygem(rspec)$/ s/^/#/' rubygem-flexmock.spec
fi
- sed -i '/^%check$/,/^popd$/ s/^/#/' rubygem-flexmock.spec
I think that this specification is a bit off from what we actually need. I do not thing that we would need platform specific packages, rather a platform specific features.
Example for what I would want from the feature:
- rubygem-flexmock:
dist:
el:
macros: # add macro only on el platform
_with_bootstrap: 1
fc25:
cmd: # execute only on fedora 25
- sed -i 's/rh-ruby24/rh-ruby23/g' rubygem-flexmock.spec
replaced_macros: # top-level – default for all platforms
need_bootstrap_set: 1
I realize this is much more complicated to implement, so if we need this feature fast, I would settle for if
statements in cmd
s – and worked on expanding the possibilities afterwards.
I do not thing that we would need platform specific packages, rather a platform specific features.
I think we sill need the platform specific packages. Because below is an actual case that we need platform specific packages. https://github.com/sclorg/rhscl-rebuild-recipes/blob/master/mysql-mariadb.yml#L27
Your below suggested idea (dist/fc25/cmd
) may look good.
But I prefer that is not for this PR.
So, I wish someone will implement that kind of feature in the future.
Because this PR's platform feature works for your requirement like this.
- rubygem-flexmock:
cmd: |
if [[ "${DIST}" =~ el ]]; then
sed -i 'something' rubygem-flexmock.spec for "_with_bootstrap: 1"
elif [[ "${DIST}" =~ fc25 ]]; then
sed -i 's/rh-ruby24/rh-ruby23/g' rubygem-flexmock.spec
if
replaced_macros: # top-level – default for all platforms
need_bootstrap_set: 1
Because below is an actual case that we need platform specific packages.
Point taken, that I did not know 😊.
Your below suggested idea (dist/fc25/cmd) may look good. But I prefer that is not for this PR.
OK, lets keep it as it is then, and I will file a separate issue.
Done. The document is later.
This ticket is to manage implementing
platforms
element https://github.com/sclorg/rhscl-rebuild-recipesCOLLECTION_ID/packages/PACKAGE/platforms
Format
The
platforms
file format is inspired from.travis.yml
'sbranches
element. https://docs.travis-ci.com/user/customizing-the-build/#Building-Specific-BranchesCOLLECTION_ID/packages/PACKAGE
is omitted in below examples.The platform string is such as
fc23
,fc24
,fc\d+
,el6
,el7
,el\d+
. (=> How about CentOS?) White list can use regular expressions that is inspired fromInternal Logic
How to know current building platform that is used to build RPM package is Fedora, CentOS or RHEL from a RPM spec file's directory?
If it is in the RPM file, we can know using below macro. But this way is not fit this time.
On fedora rawhide mock environment
On RHEL7 mock environment