I try to create an rpm package with some subpackages.
running the rpmbuild command results in an error when preparing the first subpackage.
This is the result when running rpmbuild -ba specfile:
[root#RHEL510-BUILD SPECS]# rpmbuild -ba kapsch-icinga.spec
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.88616
+ umask 022
+ cd /usr/src/rpmbuild/BUILD
+ LANG=C
+ export LANG
+ unset DISPLAY
+ -n autoconf
/var/tmp/rpm-tmp.88616: line 27: -n: command not found
error: Bad exit status from /var/tmp/rpm-tmp.88616 (%prep)
I don't see any error in the spec file defined.
As described in the rpm documentation the parameter -n defines that a subpackage will use the name defined without the prefix name of the main package.
My SPEC file:
%define _topdir /usr/src/rpmbuild
Name: my-icinga
Version: 1.0
Release: 1
License: GPLv2
Summary: defined installation of ICINGA and all it's components inclugins plugins
Group: Monitoring
%description
In this package all dependancies for a complete installation for icinga/nagios server and client(s)are included.
Each subpackage can be created separately.
#--------------
# define some global configuration parameters
#--------------
%define _nagiosUser icinga
%define _nagiosGrp icinga
%package -n autoconf
Version: 2.69
Release: 1
License: GPLv2
Source: http://ftp.gnu.org/gnu/autoconf/autoconf-2.69.tar.gz
Summary: autoconf with a version > 2.65
Group: Monitoring
%description -n autoconf
autoconf will be needed with a version > 2.65 to be able to build some additional subpackages
%package -n my-nagios-plugins
Version: 1.0
Release: 1
License: GPLv2
Summary: Plugins from nagios and ConSol for Kapsch ICINGA cient installation
Group: Monitoring
%description -n my-nagios-plugins
These package includes the standard nagios plugins as well als ConSol plugins check_oracle_health and check_logfiles
#-----------------------------------------------------------------------------------------------
# Build area
# here starts the build section for each subpackage
#-----------------------------------------------------------------------------------------------
%prep -n autoconf
%setup -n autoconf
%build -n autoconf
./configure
./make
#%%prep my-nagios-plugins
#%%setup my-nagios-plugins
#
#%%build my-nagios-plugins
##first build the standard nagios plugins
#cd nagios-plugins-2.0.3
#./configure
#./make
Any hint what's wrong with my SPEC file?
I know that the SPEC file is not complete but the missing parts should not be the cause of the error.
Don't override %_topdir in your spec file. %_topdir
is expanded before the spec file is parsed.
Instead, configure in ~/.rpmmacros
As the error message says, %prep does not take -n as an argument.
There are parts of the spec that are common to all subpackages
There are other underlying issues with your spec file:
If you need autoconf to build packages, you need to install it BEFORE your rpm, typically defining it as a dependency.
Also, I maintain a similar .spec to install icinga and all its dependencies; a very good piece of advice here is the old "KISS" (keep it simple st ...). Make tiny rpms for individual plugins or groups of plugins and create a metapackage that has all of them as dependecy.
Also I advise you to install your custom nagios-plugins to a different location that nagios-plugin:
EG: on centos nagios-plugins install at: /usr/lib/nagios/plugins
our custom built nagios-plugins are installed at: /usr/lib/nagios/plugins/mycompany
NOTE: nagios-plugins from git pulls its own spec file, that can be easily modified to be used with your custom plugins
Related
Need to differentiate a package dependency between RHEL 7.2/7.3 v/s RHEL 7.4 and above. There is rhel macro available in rpm spec file but that evaluates to 7 for all RHEL 7.x and 6 for all RHEL 6.x versions.
I can possibly read /etc/redhat-release file and determine the minor version in %pre section but unclear whether that's too late to specify package dependency using Requires directive.
I tried defining a macro that reads /etc/redhat-release file and then using the macro like following
%define rhel_minor_version %(rhel_version_file="/etc/redhat-release";
if [ -f $rhel_version_file ]; then echo $(cat $rhel_version_file |
grep -oP '.*7\.\K([0-9]+)'); else echo 0; fi)
%if 0%{?rhel} == 7
%if 0%{?rhel_minor_version} >= 4
Requires: iperf3
%endif
%endif
However this macro gets evaluated on the system where rpmbuild is invoked to build the rpm package and not the system where the rpm package is installed. So doesn't work.
There is a mechanism to specify weak dependency i.e. optional dependency in rpm spec file. This way if the package is available it’ll be installed else dependency will be ignored.
https://rpm.org/user_doc/dependencies.html
“Recommends” directive appears valid on Fedora but not available on RHEL
https://bugzilla.redhat.com/show_bug.cgi?id=1427674
After much thought I don't think it's possible to differentiate dependencies based on RHEL minor version without shipping different el7 packages for RHEL 7.2/7.3 v/s RHEL 7.4+ which is not an option...
I have this spec file for my open source shell scripting sdk https://github.com/icasimpan/shcf/blob/packagebuilds/packagebuilds/rpm/shcf.spec
I build it as follows:
rpmbuild --target noarch -bb shcf.spec
Now, this builds fine, however, the output rpm's content has duplicated path "shcf/shcf", like:
/opt/icasimpan/shcf/shcf/***
This is the prep area
%prep
echo "BUILDROOT = $RPM_BUILD_ROOT"
mkdir -p $RPM_BUILD_ROOT/opt/icasimpan/shcf
cd $RPM_BUILD_ROOT/opt/icasimpan/shcf
git clone --branch 0.3.1 https://github.com/icasimpan/shcf.git
exit
At first sight, it's obviously due to the clone done to "$RPM_BUILD_ROOT/opt/icasimpan/shcf". However, if I modify the clone line to say
git clone --branch 0.3.1 https://github.com/icasimpan/shcf.git .
rpm build will fail due to unpackaged files.
Is there anything I'm missing?
Thanks in advance.
I installed tinyos on ubuntu 15.04 following this tutorial: http://tinyos.stanford.edu/tinyos-wiki/index.php/Automatic_installation
My telosb is well detected:
root#liberty:/opt/tinyos-release-tinyos-2_1_2/apps/Blink# motelist
Reference Device Description
---------- ---------------- ---------------------------------------------
FTYP7UJV /dev/ttyUSB0 FTDI MTM-CM5000MSP
My tinyos.env:
root#liberty:/opt/tinyos-release-tinyos-2_1_2# cat tinyos.env
# Here we setup the environment
# variables needed by the tinyos
# make system
export TOSROOT="/opt/tinyos-release-tinyos-2_1_2/"
export TOSDIR="$TOSROOT/tos"
export CLASSPATH=$CLASSPATH:$TOSROOT/support/sdk/java
export MAKERULES="$TOSROOT/support/make/Makerules"
export PYTHONPATH=$PYTHONPATH:$TOSROOT/support/sdk/python
echo "setting up TinyOS on source path $TOSROOT"
My tos-check-env:
tomski#liberty:~$ tos-check-env
Path:
/usr/local/sbin
/usr/local/bin
/usr/sbin
/usr/bin
/sbin
/bin
/usr/games
/usr/local/games
Classpath:
/usr/src/tinyos/support/sdk/java/tinyos.jar
/opt/tinyos-2.1.2/support/sdk/java
/opt/tinyos-2.1.2/support/sdk/java/tinyos.jar
.
/usr/lib/jvm/java-6-openjdk-i386/lib
/usr/lib/jvm/java-6-openjdk-i386/lib
rpms:
/usr/bin/rpm
nesc:
/usr/bin/nescc
Version: nescc: 1.3.4
perl:
/usr/bin/perl
Version: v5.20.2) built for i686-linux-gnu-thread-multi-64int
flex:
bison:
java:
/usr/bin/java
--> WARNING: The JAVA version found first by tos-check-env may not be version 1.4 or version 1.5, one of which is required by TOS. Please ensure that the located Java version is 1.4 or 1.5
graphviz:
/usr/bin/dot
dot - graphviz version 2.38.0 (20140413.2041)
--> WARNING: The graphviz (dot) version found by tos-check-env is not 1.10. Please update your graphviz version if you'd like to use the nescdoc documentation generator.
tos-check-env completed with errors:
--> WARNING: The JAVA version found first by tos-check-env may not be version 1.4 or version 1.5one of which is required by TOS. Please ensure that the located Java version is 1.4 or 1.5
--> WARNING: The graphviz (dot) version found by tos-check-env is not 1.10. Please update your graphviz version if you'd like to use the nescdoc documentation generator.
My java version:
tomski#liberty:~$ java -version
java version "1.7.0_79"
OpenJDK Runtime Environment (IcedTea 2.5.6) (7u79-2.5.6-0ubuntu1.15.04.1)
OpenJDK Server VM (build 24.79-b02, mixed mode)
when I compile:
root#liberty:/opt/tinyos-release-tinyos-2_1_2/apps/Blink# make telosb
make: *** No rule to make target 'telosb'. Stop.
I have build-essentials, nescc, gcc, make etc..
Many thanks in advance for your help
perform every task as a super user and the queries will be resolved.
for e.g.:
$ sudo touch tinyos-env
$ sudo nano tinyos-env
perform the copy and change the TOSROOT path accordingly also copy the same file to your ~/.bashrc file and perform every application as a super user
$ sudo su
Though this post is bit too late, the last comment of the thread helped to resolve this query for TinyOS on Ubuntu-15.04 for me recently.
maybe you can do it without the root privileges, but under the user privileges.
then: cd /opt/tinyos-release-tinyos-2_1_2/apps/Blink
then: sudo chmod -R 777 .
then: make telosb
Old post, but the previous answers are not completely clear.
You have to point to that tinyos.env file.
In order to do that, from your home directory:
Open the .bashrc file:
sudo nano .bashrc
On the bottom of your .bashrc file, add the line:
source <path_to_tinyos_folder>/tinyos.env
Of course the file tinyos.env contains the setup enviroment variables.
I want to run tests of my Phoenix app on Travis-CI.
Log excerpt:
$ MIX_ENV=test mix do deps.get, compile, test
Could not find hex, which is needed to build dependency :phoenix
Shall I install hex? [Yn]
When it comes to fetching and installing dependencies, it asks if it should install hex. I was wondering if I can pass a --yes option to mix so that it doesn't ask but just installs?
You can add this command to your before_install section in .travis.yml
mix local.hex --force
After of course, you've already installed elixir in a previous command. I
cargo culted this .travis.yml from an existing elixir project on github.
language: erlang
env:
- ELIXIR="v1.0.0"
otp_release:
- 17.1
before_install:
- mkdir -p vendor/elixir
- wget -q https://github.com/elixir-lang/elixir/releases/download/$ELIXIR/Precompiled.zip && unzip -qq Precompiled.zip -d vendor/elixir
- export PATH="$PATH:$PWD/vendor/elixir/bin"
- mix local.hex --force
script: "MIX_ENV=test mix do deps.get, test"
As with any unix command, you could pipe yes into the mix command:
yes | MIX_ENV=test mix do deps.get, compile, test
But there are some warnings about this solution in the comments below. I recommend using the top voted solution!
OS: RHEL 6.5 x64
Rstudio-server Version 0.98.1062
R version 3.1.1 (2014-07-10)
knitr version 1.6
When attempting to knit an Rmarkdown file I get a failure during the pandoc stage of the compilation:
pandoc: Error producing PDF from TeX source.
! LaTeX Error: File 'ifluatex.sty' not found.
Type X to quit or <RETURN> to proceed,
or enter new name. (Default extension: sty)
Enter file name:
! Emergency stop.
Tried the (9-hour-long) full manual LiveTeX install, just to be sure, and luatex is now installed, but there is still no ifluatex.sty to be found. How do I tell RStudioServer/knitr/pandoc where the installation directory for that file is?
Many thanks to Homer White's blog for sending me in the right direction. I'm more or less posting his answer verbatim, with minor modifications for RHEL 6.5 and 2014 LiveTex.
Even the full manual install had not solved the problem. Following Homer's advice, I downloaded from the internet a copy of ifluatex.sty
You can get it either directly or via wget from the CTAN archive.
wget http://www.ctan.org/tex-archive/macros/latex/contrib/oberdiek/ifluatex.dtx
tex ifluatex.dtx
Copy the resulting file into the shared folder for your LaTeX Distribution. In RHEL 6/CentOS for the 2014 LiveTex distribution installed via install-tl this was:
/usr/share/texmf/tex/generic/oberdiek
Easy, right? Next step was to get the framed package:
wget http://mirrors.ctan.org/macros/latex/contrib/framed.zip
unzip framed.zip
This should create a folder in the download location. Now copy the entire folder to the Shared LiveTeX folder for LaTeX:
/usr/share/texmf/tex/latex
Finally, let LiveTeX know it should update its library by running
texhash
PS: Note that I had root access. You might need it as well, of if you're a wheel user, prefix with sudo.
Here is quick'n'dirty rpm spec file for those who do not want to install non-packaged files to /usr.
Name: texlive-rstudio-addon-el6
Version: 0.1
Release: 1%{?dist}
Summary: addon stylesheets for Rstudio pandoc
Group: Publishing
License: LPPL1.3c+
URL: http://www.ctan.org/tex-archive/macros/latex/contrib/oberdiek/
Source0: http://www.ctan.org/tex-archive/macros/latex/contrib/oberdiek/ifluatex.dtx
Source1: http://mirrors.ctan.org/macros/latex/contrib/framed.zip
BuildRequires: texlive
BuildRequires: texlive-texmf
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch: noarch
%description
Couple styles addons which are required by RStudio pandoc when processing Rmarkdown documents
%prep
%setup -q -c -T
cat %{SOURCE0} > ifluatex.dtx
unzip %{SOURCE1}
%build
%install
rm -rf %{buildroot} && mkdir -p %{buildroot}
tex ifluatex.dtx
mkdir -p %{buildroot}/%{_texmf_main}/tex/generic/oberdiek
mkdir -p %{buildroot}/%{_texmf_main}/tex/latex/
cp ifluatex.sty %{buildroot}/%{_texmf_main}/tex/generic/oberdiek
cp -a framed %{buildroot}/%{_texmf_main}/tex/latex/
%clean
rm -rf %{buildroot}
%post
[ -x %{_bindir}/texconfig-sys ] && %{_bindir}/texconfig-sys rehash 2> /dev/null
%files
%defattr(-,root,root)
%{_texmf_main}/tex/generic/oberdiek/ifluatex.sty
%{_texmf_main}/tex/latex/framed/*
%doc
%changelog
For my fix root was needed and ifluatex and frame file permissions needed to be updated.