Score:0

Make yum not installing dependancies if main package failed

au flag

I have 3 packages corepkg, corepkg-optB and corepkg-optC. corepkg-optC depends on corepkg-optB, corepkg-optB depends on corepkg. I've created a repo of these 3 packages. When I run yum install corepkg-optC, and corepkg failed, yum installs corepkg-optB and corepkg-optC. It is not what I would like.

I would like corepkg-optB failing if corepkg is failed and corepkg-optC failing if corepkg-optB failed because corepkg failed.

My specfile looks like this:

Name: corepkg
Version: 1.0.0

%pretrans
if ! grep -q foo /etc/hosts
then
    exit 1
fi

%package optB
Requires: corepkg = 1.0.0

%package optC
Requires: codepkg-optB = 1.0.0

I tried Requires then Requires(pre), but give me the same result:

# yum install corepkg-optC
error: %pretrans(corepkg-1.0.0-1.el7.noarch) scriptlet failed, exit status 1
Error in PRETRANS scriptlet in rpm package corepkg-1.0.0-1.el7.noarch
  Installing : corepkg-optB-1.0.0-1.el7.noarch                                     1/3
error: corepkg-1.0.0-1.el7.noarch: install skipped
  Installing : corepkg-optC-1.0.0-1.el7.noarch                                     2/3
  Verifying  : corepkg-optC-1.0.0-1.el7.noarch                                     1/3
  Verifying  : corepkg-optB-1.0.0-1.el7.noarch                                     2/3
  Verifying  : corepkg-1.0.0-1.el7.noarch                                          3/3

Installed:
  corepkg-optC.noarch 0:1.0.0-1.el7.noarch

Dependency Installed:
  corepkg-optB.noarch 0:1.0.0-1.el7.noarch

Failed:
  corepkg.noarch 0:1.0.0-1.el7.noarch

I tried Requires(pretrans) but it was a non-sense as everything is a single yum transaction.

All corepkg are mine, I can modify specfiles. Any idea? Thank you!

EDIT: package B and C are not dep but more like additionnal stuff to corepkg. It is similar to packages php-* or python-*. Similar because my packages corepkg-optB and corepkg-optC are modules (text files) and means nothing without corepkg. I'm saying that because some php-* packages work standalone.

Score:0
sa flag

Looks like there is no simple answer on your question. I find question similar to yours. And looks like this is only one way, you should check in %pre section properly installed packages, but not using rpm command. May be check for existing files or something like that.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.