puppet-extensions.spec 6.93 KB
Newer Older
mh's avatar
mh committed
1
2
3
%if 0%{?_version:1}
%define _verstr      %{_version}
%else
mh's avatar
mh committed
4
%define _verstr      0.0.18
mh's avatar
mh committed
5
6
%endif

mh's avatar
mh committed
7
# puppetserver still runs a ruby 1.9.3 kind JRuby
mh's avatar
mh committed
8
%define gems trocla iuid base32 ip formatador systemu hashdiff open4 acme-client public_suffix ed25519
mh's avatar
mh committed
9
10
%define version_gems1 activerecord --version '~> 6.0.3'
%define version_gems2 actionmailer --version '~> 6.0.3'
mh's avatar
mh committed
11
# we don't need sinatra oder openoffice in jruby
12
%define mrionly_gems sinatra roo simpleidn sha3
13
%if 0%{?rhel} >= 8
14
%define mrionly_gems_version1 none
15
%else
mh's avatar
mh committed
16
%define mrionly_gems_version1 pg --version '= 0.20'
17
%endif
mh's avatar
mh committed
18
# we want the jruby version of pg
19
%define jrubyonly_gems jruby-pg sha3-pure-ruby
mh's avatar
mh committed
20

mh's avatar
mh committed
21
22
23
%define checkout %(date +%Y%m%d)

%define agentdir /opt/puppetlabs/puppet
mh's avatar
mh committed
24
%define agentgemdir %{agentdir}/lib/ruby/gems/2.7.0/
mh's avatar
mh committed
25
26
27
28
29
30
31
32
%define servergemdir /opt/puppetlabs/server/data/puppetserver/jruby-gems

Name:		puppet-extensions
Version:	%{_verstr}
Release:	1
Summary:	Extension for the puppet-agent or puppetserver.
License:	GPLv3
Source0: puppetserver.conf
mh's avatar
mh committed
33
Patch0: https://github.com/duritong/ip/commit/0cf261fa2fb75113c94fef5ac231f3d7b2f3ff4c.patch
mh's avatar
mh committed
34

mh's avatar
mh committed
35
36
BuildRequires: puppet-agent >= 7.0
BuildRequires: puppetserver >= 7.0
mh's avatar
mh committed
37
38
39
40
%if 0%{?rhel} >= 8
BuildRequires: postgresql
BuildRequires: postgresql-devel
%else
mh's avatar
mh committed
41
42
BuildRequires: postgresql13
BuildRequires: postgresql13-devel
mh's avatar
mh committed
43
%endif
mh's avatar
mh committed
44
45
BuildRequires: libxml2-devel
BuildRequires: libxslt-devel
mh's avatar
mh committed
46
BuildRequires: gcc-c++
mh's avatar
mh committed
47
BuildRequires: chrpath
mh's avatar
mh committed
48
Requires: puppet-agent >= 7.0
mh's avatar
mh committed
49
50
51
52
53
54
55
56
57
58
59

%description

A set of gems for puppet agent & server


%filter_requires_in %agentgemdir
%filter_setup

%package -n puppet-agent-extensions
Summary:	Extension for the puppet-agent.
mh's avatar
mh committed
60
Requires: puppet-agent >= 7.0
mh's avatar
mh committed
61
62
63
64
65
66
%description -n puppet-agent-extensions

A set of gem extensions packaged for the puppet-agent.

%package -n puppetserver-extensions
Summary:	Extension for the puppetserver.
mh's avatar
mh committed
67
Requires: puppetserver >= 7.0
mh's avatar
mh committed
68
69
70
71
72
73
74
75
76
77
78
79
80
81
%description -n puppetserver-extensions

A set of gem extensions packaged for the puppetserver.

%prep

mkdir server_config
cp %{SOURCE0} server_config
mkdir -p ~/.puppetlabs/etc/puppet
echo -e "[master]\nconfdir=~/puppet\ncodedir=~/puppetcode" > ~/.puppetlabs/etc/puppet/puppet.conf


%build

mh's avatar
mh committed
82
export PATH=$PATH:/usr/pgsql-13/bin
83
/opt/puppetlabs/puppet/bin/gem install --lock --install-dir ./agent_gems --no-document -N %{gems} %{mrionly_gems}
84
%if "%{mrionly_gems_version1}" != "none"
85
/opt/puppetlabs/puppet/bin/gem install --lock --install-dir ./agent_gems --no-document -N %{mrionly_gems_version1}
86
%endif
87
88
/opt/puppetlabs/puppet/bin/gem install --lock --install-dir ./agent_gems --no-document -N %{version_gems1}
/opt/puppetlabs/puppet/bin/gem install --lock --install-dir ./agent_gems --no-document -N %{version_gems2}
mh's avatar
mh committed
89
90
91
92
93
94
95
96
97
98
99

# so it picks up the right config
export JAVA_BIN=/usr/bin/java
export JAVA_ARGS='-Xms2g -Xmx2g -Djruby.logger.class=com.puppetlabs.jruby_utils.jruby.Slf4jLogger'
export USER=puppet
export GROUP=puppet
export INSTALL_DIR=/opt/puppetlabs/server/apps/puppetserver
export SERVICE_STOP_RETRIES=60
export START_TIMEOUT=300
export RELOAD_TIMEOUT=120
export CLASSPATH=${INSTALL_DIR}/puppet-server-release.jar
mh's avatar
mh committed
100
export JRUBY_JAR="${JRUBY_JAR:-${INSTALL_DIR}/jruby-9k.jar}"
mh's avatar
mh committed
101
102
103
104
105
export CLASSPATH="${CLASSPATH}:${JRUBY_JAR}"
export CONFIG=./server_config
"${JAVA_BIN}" $JAVA_ARGS_CLI -Djava.security.egd=/dev/urandom \
    -cp "$CLASSPATH" \
    clojure.main -m puppetlabs.puppetserver.cli.gem \
106
     --config ./server_config -- install --lock --install-dir ./server_gems --no-document -N %{gems} %{jrubyonly_gems}
mh's avatar
mh committed
107
108
109
"${JAVA_BIN}" $JAVA_ARGS_CLI -Djava.security.egd=/dev/urandom \
    -cp "$CLASSPATH" \
    clojure.main -m puppetlabs.puppetserver.cli.gem \
110
     --config ./server_config -- install --lock --install-dir ./server_gems --no-document -N %{version_gems1}
mh's avatar
mh committed
111
112
113
"${JAVA_BIN}" $JAVA_ARGS_CLI -Djava.security.egd=/dev/urandom \
    -cp "$CLASSPATH" \
    clojure.main -m puppetlabs.puppetserver.cli.gem \
114
     --config ./server_config -- install --lock --install-dir ./server_gems --no-document -N %{version_gems2}
mh's avatar
mh committed
115

mh's avatar
mh committed
116
117
118
119
120
121
cd ./agent_gems/gems/ip-*
patch -p1 < %{PATCH0}
cd ../../../
cd ./server_gems/gems/ip-*
patch -p1 < %{PATCH0}

mh's avatar
mh committed
122
123
124
125
126
127
128
129
130
131
132
133
134
%install

mkdir -p %{buildroot}%{agentgemdir}
for d in specifications gems extensions; do
  mv ./agent_gems/${d} %{buildroot}%{agentgemdir}/
done
mv ./agent_gems/bin %{buildroot}%{agentdir}/bin

mkdir -p %{buildroot}%{servergemdir}
for d in bin specifications gems; do
  mv ./server_gems/${d} %{buildroot}%{servergemdir}/
done

mh's avatar
mh committed
135
136
137
chrpath -d %{buildroot}/opt/puppetlabs/puppet/lib/ruby/gems/*/extensions/x86_64-linux/*/bcrypt-*/bcrypt_ext.so
chrpath -d %{buildroot}/opt/puppetlabs/puppet/lib/ruby/gems/*/extensions/x86_64-linux/*/nokogiri-*/nokogiri/nokogiri.so
chrpath -d %{buildroot}/opt/puppetlabs/puppet/lib/ruby/gems/*/extensions/x86_64-linux/*/unf_ext-*/unf_ext.so
mh's avatar
mh committed
138
139
140
141
142
chrpath -d %{buildroot}/opt/puppetlabs/puppet/lib/ruby/gems/*/extensions/x86_64-linux/*/ed25519-*/ed25519_ref10.so
chrpath -d %{buildroot}/opt/puppetlabs/puppet/lib/ruby/gems/*/extensions/x86_64-linux/*/sha3-*/sha3_n.so
if [ -d %{buildroot}/opt/puppetlabs/puppet/lib/ruby/gems/*/extensions/x86_64-linux/*/pg-*/ ]; then
  chrpath -d %{buildroot}/opt/puppetlabs/puppet/lib/ruby/gems/*/extensions/x86_64-linux/*/pg-*/pg_ext.so
fi
mh's avatar
mh committed
143

mh's avatar
mh committed
144
145
chrpath -d %{buildroot}/opt/puppetlabs/puppet/lib/ruby/gems/*/gems/bcrypt-*/ext/mri/bcrypt_ext.so
chrpath -d %{buildroot}/opt/puppetlabs/puppet/lib/ruby/gems/*/gems/bcrypt-*/lib/bcrypt_ext.so
mh's avatar
mh committed
146
147
148
149
chrpath -d %{buildroot}/opt/puppetlabs/puppet/lib/ruby/gems/*/gems/nokogiri-*/ext/nokogiri/nokogiri.so
chrpath -d %{buildroot}/opt/puppetlabs/puppet/lib/ruby/gems/*/gems/nokogiri-*/lib/nokogiri/nokogiri.so
chrpath -d %{buildroot}/opt/puppetlabs/puppet/lib/ruby/gems/*/gems/unf_ext-*/ext/unf_ext/unf_ext.so
chrpath -d %{buildroot}/opt/puppetlabs/puppet/lib/ruby/gems/*/gems/unf_ext-*/lib/unf_ext.so
mh's avatar
mh committed
150
151
152
153
if [ -d %{buildroot}/opt/puppetlabs/puppet/lib/ruby/gems/*/gems/pg-*/ ]; then
  chrpath -d %{buildroot}/opt/puppetlabs/puppet/lib/ruby/gems/*/gems/pg-*/ext/pg_ext.so
  chrpath -d %{buildroot}/opt/puppetlabs/puppet/lib/ruby/gems/*/gems/pg-*/lib/pg_ext.so
fi
mh's avatar
mh committed
154

155
156
chrpath -d %{buildroot}/opt/puppetlabs/puppet/lib/ruby/gems/*/gems/ed25519-*/ext/ed25519_ref10/ed25519_ref10.so
chrpath -d %{buildroot}/opt/puppetlabs/puppet/lib/ruby/gems/*/gems/ed25519-*/lib/ed25519_ref10.so
mh's avatar
mh committed
157
158
chrpath -d %{buildroot}/opt/puppetlabs/puppet/lib/ruby/gems/*/gems/sha3-*/ext/sha3/sha3_n.so
chrpath -d %{buildroot}/opt/puppetlabs/puppet/lib/ruby/gems/*/gems/sha3-*/lib/sha3_n.so
159

mh's avatar
mh committed
160
# remove unused files with broken shebang
mh's avatar
mh committed
161
rm -rf %{buildroot}/opt/puppetlabs/server/data/puppetserver/jruby-gems/gems/rack-*/test
mh's avatar
mh committed
162
rm -rf %{buildroot}/opt/puppetlabs/puppet/lib/ruby/gems/*/gems/rack-*/test/
mh's avatar
mh committed
163

mh's avatar
mh committed
164
%files -n puppet-agent-extensions
mh's avatar
mh committed
165
%defattr(0644,root,root,0755)
mh's avatar
mh committed
166
167
168
169
170
%attr(0755,-,-) %{agentdir}/bin/trocla
%attr(0755,-,-) %{agentdir}/bin/iuid
%attr(0755,-,-) %{agentdir}/bin/rackup
%attr(0755,-,-) %{agentdir}/bin/tilt
%attr(0755,-,-) %{agentdir}/bin/nokogiri
mh's avatar
mh committed
171
172
173
174
175
%{agentgemdir}/specifications/*
%{agentgemdir}/extensions/*
%{agentgemdir}/gems/*

%files -n puppetserver-extensions
mh's avatar
mh committed
176
%defattr(0644,root,root,0755)
mh's avatar
mh committed
177
178
179
180
%{servergemdir}/*

%changelog