0

I have this issue and I would like to understand why it is like this. I have build 3 really simple rpm packages called a, b and c, and I made a independant, b depending on a and c depending on a and b. Each of them has a source made of only one file that is supposed to be put in /home/ (that's not the important part).

The code for each of them is more or less the same, only the dependencies changing from a package to another. I have other packages that I've tested at work, where dependencies are organised like this. Sometimes one package failed and all the time next packages are installed anyway, even if the package being the dependency failed.

Here's my testing code, I try to make b package fail :

Name:           b
Version:        1
Release:        1%{?dist}
Summary:        Package b

License:        GPL
Source0:        b.tar.gz
BuildRoot:      %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)

PreReq:         a

%description
Install package b

%prep
%setup -q

%pre
if [ ! -f "/home/b" ]
then
        exit 1
fi

%install
rm -rf %{buildroot}
mkdir -p %{buildroot}/home/
mv b %{buildroot}/home/

%clean
rm -rf %{buildroot}

%files
%defattr(-,root,root,-)
/home/b

So as you can notice this package will fail all the time, but that's the purpose of it. And when I'm trying to install the packages I get this :

[root@oradm|in ~]# rpm -ivh a-1-1.el6.x86_64.rpm b-1-1.el6.x86_64.rpm c-1-1.el6.x86_64.rpm 
Préparation...              ########################################### [100%]
   1:a                      ########################################### [ 33%]
erreur: %pre(b-1-1.el6.x86_64) scriptlet failed, exit status 1
erreur:   install: échec du scriptlet %pre (2), on saute b-1-1.el6
   2:c                      ########################################### [ 67%]

So package a is installing, that makes sense, nothing is wrong there. Then package b fails as intended. But package c is installed too !! and that should fails as this is the code of package c :

Name:           c
Version:        1
Release:        1%{?dist}
Summary:        Package c

License:        GPL
Source0:        c.tar.gz
BuildRoot:      %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)

PreReq:         a,b

%description
Install package c

%prep
%setup -q

%install
rm -rf %{buildroot}
mkdir -p %{buildroot}/home/
mv c %{buildroot}/home/

%clean
rm -rf %{buildroot}

%files
%defattr(-,root,root,-)
/home/c

As you can see, it should require a and b, and b failed. How is that possible ? I've tried with the "Requires" directive instead of PreReq, the result is exactly the same.

Can someone explain this to me ?

EDIT : I forgot to add, I'm using RPM version 4.8.0 on the server where I install the rpm packages, it's a RHEL 6.3

Pierre-Alain TORET
  • 1,244
  • 7
  • 14

0 Answers0