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

mh's avatar
mh committed
7
# puppetserver still runs a ruby 1.9.3 kind JRuby
8
%define gems trocla iuid base32 ip formatador systemu hashdiff open4 acme-client
mh's avatar
mh committed
9
10
11
12
13
%define version_gems1 activerecord --version '~> 4.2.9'
%define version_gems2 actionmailer --version '~> 4.2.9'
# we don't need sinatra oder openoffice in jruby
%define mrionly_gems sinatra roo simpleidn
%define mrionly_gems_version1 pg --version '= 0.20'
mh's avatar
mh committed
14
15
16
# we want the jruby version of pg
%define jrubyonly_gems jruby-pg

mh's avatar
mh committed
17
18
19
%define checkout %(date +%Y%m%d)

%define agentdir /opt/puppetlabs/puppet
mh's avatar
mh committed
20
%define agentgemdir %{agentdir}/lib/ruby/gems/2.5.0/
mh's avatar
mh committed
21
22
23
24
25
26
27
28
%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
29
Patch0: https://github.com/erikh/ip/commit/0cf261fa2fb75113c94fef5ac231f3d7b2f3ff4c.patch
mh's avatar
mh committed
30

mh's avatar
mh committed
31
32
BuildRequires: puppet-agent >= 6.0
BuildRequires: puppetserver >= 6.0
mh's avatar
mh committed
33
34
BuildRequires: postgresql96
BuildRequires: postgresql96-devel
mh's avatar
mh committed
35
36
BuildRequires: libxml2-devel
BuildRequires: libxslt-devel
mh's avatar
mh committed
37
BuildRequires: gcc-c++
mh's avatar
mh committed
38
BuildRequires: chrpath
mh's avatar
mh committed
39
Requires: puppet-agent >= 6.0
mh's avatar
mh committed
40
41
42
43
44
45
46
47
48
49
50

%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
51
Requires: puppet-agent >= 6.0
mh's avatar
mh committed
52
53
54
55
56
57
%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
58
Requires: puppetserver >= 6.0
mh's avatar
mh committed
59
60
61
62
63
64
65
66
67
68
69
70
71
72
%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
73
export PATH=$PATH:/usr/pgsql-9.6/bin
mh's avatar
mh committed
74
/opt/puppetlabs/puppet/bin/gem install --lock --install-dir ./agent_gems --no-ri --no-rdoc -N %{gems} %{mrionly_gems}
mh's avatar
mh committed
75
76
77
/opt/puppetlabs/puppet/bin/gem install --lock --install-dir ./agent_gems --no-ri --no-rdoc -N %{mrionly_gems_version1}
/opt/puppetlabs/puppet/bin/gem install --lock --install-dir ./agent_gems --no-ri --no-rdoc -N %{version_gems1}
/opt/puppetlabs/puppet/bin/gem install --lock --install-dir ./agent_gems --no-ri --no-rdoc -N %{version_gems2}
mh's avatar
mh committed
78
79
80
81
82
83
84
85
86
87
88

# 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
89
export JRUBY_JAR="${JRUBY_JAR:-${INSTALL_DIR}/jruby-9k.jar}"
mh's avatar
mh committed
90
91
92
93
94
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 \
mh's avatar
mh committed
95
     --config ./server_config -- install --lock --install-dir ./server_gems --no-ri --no-rdoc -N %{gems} %{jrubyonly_gems}
mh's avatar
mh committed
96
97
98
99
100
101
102
103
"${JAVA_BIN}" $JAVA_ARGS_CLI -Djava.security.egd=/dev/urandom \
    -cp "$CLASSPATH" \
    clojure.main -m puppetlabs.puppetserver.cli.gem \
     --config ./server_config -- install --lock --install-dir ./server_gems --no-ri --no-rdoc -N %{version_gems1}
"${JAVA_BIN}" $JAVA_ARGS_CLI -Djava.security.egd=/dev/urandom \
    -cp "$CLASSPATH" \
    clojure.main -m puppetlabs.puppetserver.cli.gem \
     --config ./server_config -- install --lock --install-dir ./server_gems --no-ri --no-rdoc -N %{version_gems2}
mh's avatar
mh committed
104

mh's avatar
mh committed
105
106
107
108
109
110
cd ./agent_gems/gems/ip-*
patch -p1 < %{PATCH0}
cd ../../../
cd ./server_gems/gems/ip-*
patch -p1 < %{PATCH0}

mh's avatar
mh committed
111
112
113
114
115
116
117
118
119
120
121
122
123
%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
124
chrpath -d /opt/puppetlabs/puppet/lib/ruby/gems/*/extensions/x86_64-linux/*/bcrypt-*/bcrypt_ext.so
mh's avatar
mh committed
125
chrpath -d opt/puppetlabs/puppet/lib/ruby/gems/2.5.0/extensions/x86_64-linux/2.5.0/nokogiri-/nokogiri/nokogiri.so
mh's avatar
mh committed
126

mh's avatar
mh committed
127
128
129
130
%files -n puppet-agent-extensions
%defattr(-,root,root,-)
%{agentdir}/bin/trocla
%{agentdir}/bin/iuid
mh's avatar
mh committed
131
132
133
%{agentdir}/bin/rackup
%{agentdir}/bin/tilt
%{agentdir}/bin/nokogiri
mh's avatar
mh committed
134
%{agentdir}/bin/erubis
mh's avatar
mh committed
135
136
137
138
139
140
141
142
143
144
%{agentgemdir}/specifications/*
%{agentgemdir}/extensions/*
%{agentgemdir}/gems/*

%files -n puppetserver-extensions
%defattr(-,root,root,-)
%{servergemdir}/*

%changelog