Skip to content

Commit db9a821

Browse files
committed
rpm: build Asciidoctor if not present
If Asciidoctor is not already present, build the gem as an RPM.
1 parent 31c9cf5 commit db9a821

File tree

2 files changed

+74
-9
lines changed

2 files changed

+74
-9
lines changed

rpm/SPECS/rubygem-asciidoctor.spec

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
#global gemdir %(ruby -rubygems -e 'puts Gem::dir' 2>/dev/null)
2+
%global gemdir %(IFS=: R=($(gem env gempath)); echo ${R[${#R[@]}-1]})
3+
%define gem_name asciidoctor
4+
5+
Name: rubygem-%{gem_name}
6+
Version: 2.0.17
7+
Release: 1%{?dist}
8+
Summary: Builds manuals
9+
10+
Group: Applications/Programming
11+
License: N/A
12+
URL: https://rubygems.org/gems/%{gem_name}
13+
Source0: https://rubygems.org/downloads/%{gem_name}-%{version}.gem
14+
BuildRoot: %(echo %{_topdir}/BUILDROOT/%{gem_name}-%{version})
15+
%if 0%{?el7}
16+
BuildRequires: rh-ruby30-ruby, rh-ruby30-build
17+
Requires: rh-ruby30-ruby
18+
%else
19+
BuildRequires: gem
20+
Requires: ruby
21+
%endif
22+
BuildArch: noarch
23+
24+
%description
25+
Builds Manuals
26+
27+
%prep
28+
%if 0%{?el7}
29+
%setup -q -c -T
30+
%else
31+
%setup -q -n %{gem_name}-%{version}
32+
%endif
33+
%if 0%{?el7}
34+
mkdir -p ./usr/local
35+
gem install -V --local --force --install-dir ./%{gemdir} --wrappers --bindir ./usr/local/bin %{SOURCE0}
36+
%endif
37+
38+
%build
39+
%if 0%{?el8}
40+
gem build ../%{gem_name}-%{version}.gemspec
41+
gem install -V --local --build-root . --force --no-document %{gem_name}-%{version}.gem
42+
%endif
43+
44+
%install
45+
mkdir -p ${RPM_BUILD_ROOT}
46+
cp -a ./usr ${RPM_BUILD_ROOT}/usr
47+
%if 0%{?el7}
48+
cp -a ./opt ${RPM_BUILD_ROOT}/opt
49+
%endif
50+
51+
%clean
52+
rm -rf %{buildroot}
53+
54+
%files
55+
%defattr(-,root,root,-)
56+
%if 0%{?el8}
57+
%dir %{gem_instdir}
58+
%{gem_libdir}
59+
%exclude %{gem_cache}
60+
%{gem_spec}
61+
/usr/share/gems
62+
/usr/bin/%{gem_name}
63+
%else
64+
%{gemdir}/gems/%{gem_name}-%{version}
65+
/opt/rh/rh-ruby30/root/usr/local/share/gems/cache/%{gem_name}-%{version}.gem
66+
/opt/rh/rh-ruby30/root/usr/local/share/gems/doc/%{gem_name}-%{version}
67+
/opt/rh/rh-ruby30/root/usr/local/share/gems/specifications/%{gem_name}-%{version}.gemspec
68+
/usr/local/bin
69+
%endif
70+
71+
%changelog

rpm/build_rpms.bsh

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -124,20 +124,14 @@ if [[ ${VERSION_ID[0]} == 8 ]]; then
124124
$SUDO yum install -y rubygems-devel
125125
fi
126126

127-
if ! command -v ronn; then
127+
if ! command -v asciidoctor; then
128128
echo "Downloading some ruby gems..."
129129
pushd ${CURDIR}/SOURCES
130-
curl -L -O https://rubygems.org/downloads/rdiscount-2.1.8.gem
131-
curl -L -O https://rubygems.org/downloads/hpricot-0.8.6.gem
132-
curl -L -O https://rubygems.org/downloads/mustache-1.0.1.gem
133-
curl -L -O https://rubygems.org/downloads/ronn-0.7.3.gem
130+
curl -L -O https://rubygems.org/downloads/asciidoctor-2.0.17.gem
134131
popd
135132

136133
echo "Building ruby gems..."
137-
"${RPMBUILD[@]}" -ba ${CURDIR}/SPECS/rubygem-rdiscount.spec
138-
"${RPMBUILD[@]}" -ba ${CURDIR}/SPECS/rubygem-mustache.spec
139-
"${RPMBUILD[@]}" -ba ${CURDIR}/SPECS/rubygem-hpricot.spec
140-
"${RPMBUILD[@]}" -ba ${CURDIR}/SPECS/rubygem-ronn.spec
134+
"${RPMBUILD[@]}" -ba ${CURDIR}/SPECS/rubygem-asciidoctor.spec
141135

142136
echo "Installing ruby gems..."
143137
$SUDO yum install -y --nogpgcheck $(ls ${CURDIR}/RPMS/noarch/rubygem-*.rpm ${CURDIR}/RPMS/x86_64/rubygem-*.rpm | grep -v debuginfo)

0 commit comments

Comments
 (0)