diff --git a/.travis.yml b/.travis.yml index 6ba78493..e4530b34 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,5 @@ language: python +sudo: true dist: "xenial" python: - "2.7" @@ -7,7 +8,9 @@ python: - "3.6" - "3.7" install: + - sudo apt-get update && sudo apt-get install -y rpm - pip install pylint pylint_runner ordereddict mysqlclient requests feedparser prometheus_client flask script: + - cd rpm && make all && cd .. - pylint_runner --rcfile .pylintrc - ./tests.py diff --git a/rpm/tcollector.spec b/rpm/tcollector.spec index f2c495e4..fc4eaaf1 100644 --- a/rpm/tcollector.spec +++ b/rpm/tcollector.spec @@ -28,6 +28,7 @@ package will install the tcollector.py along with %install mkdir -p %{buildroot}/%{collectorsdir}/0/ +mkdir -p %{buildroot}/%{collectorsdir}/300/ mkdir -p %{buildroot}/etc/init.d/ # set homedir in init script @@ -37,14 +38,17 @@ mkdir -p %{buildroot}/etc/init.d/ # Install Base files mkdir -p %{buildroot}%{tcollectordir}/collectors/lib/ +mkdir -p %{buildroot}%{tcollectordir}/collectors/lib/docker_engine/ mkdir -p %{buildroot}%{tcollectordir}/collectors/etc/ %{__install} -m 0755 -D %{srccollectors}/__init__.py %{buildroot}%{tcollectordir}/collectors/ -%{__install} -m 0755 -D %{srccollectors}/lib/* %{buildroot}%{tcollectordir}/collectors/lib/ +%{__install} -m 0755 -D %{srccollectors}/lib/*.* %{buildroot}%{tcollectordir}/collectors/lib/ +%{__install} -m 0755 -D %{srccollectors}/lib/docker_engine/* %{buildroot}%{tcollectordir}/collectors/lib/docker_engine/ %{__install} -m 0755 -D %{srccollectors}/etc/* %{buildroot}%{tcollectordir}/collectors/etc/ %{__install} -m 0755 -D %{rootdir}/tcollector.py %{buildroot}%{tcollectordir}/ # Install Collectors %{__install} -m 0755 -D %{srccollectors}/0/* %{buildroot}%{collectorsdir}/0/ +%{__install} -m 0755 -D %{srccollectors}/300/* %{buildroot}%{collectorsdir}/300/ # Install EOS files %{__install} -m 0755 -D %{eosdir}/collectors/agent*.sh %{buildroot}/%{collectorsdir}/0/ @@ -55,6 +59,16 @@ mkdir -p %{buildroot}/%{py2_sitelib}/ %{__install} -m 0755 -D %{eosdir}/tcollector_agent.py %{buildroot}/%{py2_sitelib}/ +# Modern rpmbuild wants either python2 or python3 +%{__perl} -pe "s|/usr/bin/env python|/usr/bin/env python2|;" -i %{buildroot}%{tcollectordir}/*.py +%{__perl} -pe "s|/usr/bin/env python|/usr/bin/env python2|;" -i %{eosdir}/tcollector_agent.py %{buildroot}/%{py2_sitelib}/*.py +%{__perl} -pe "s|/usr/bin/env python|/usr/bin/env python2|;" -i %{buildroot}%{tcollectordir}/collectors/etc/*.py +%{__perl} -pe "s|/usr/bin/env python|/usr/bin/env python2|;" -i %{buildroot}%{tcollectordir}/collectors/0/*.py +%{__perl} -pe "s|/usr/bin/env python|/usr/bin/env python2|;" -i %{buildroot}%{tcollectordir}/collectors/300/*.py +%{__perl} -pe "s|/usr/bin/env python|/usr/bin/env python2|;" -i %{buildroot}%{tcollectordir}/collectors/lib/*.py +%{__perl} -pe "s|/usr/bin/env python|/usr/bin/env python2|;" -i %{buildroot}%{tcollectordir}/collectors/lib/docker_engine/*.py +%{__perl} -pe "s|/usr/bin/env python|/usr/bin/env python2|;" -i %{buildroot}/usr/bin/tcollector + %files %dir %{tcollectordir} %attr(755, -, -) /etc/init.d/tcollector