Skip to content
This repository has been archived by the owner on Jun 28, 2022. It is now read-only.

Fix depends for rpms #11

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

djnym
Copy link
Contributor

@djnym djnym commented May 4, 2017

This fixes the way dependencies are set in RPMs. It seems like the previous changes actually broke something and left 2 places where dependencies were dealt with and that lead to depends being broken. Here's an example (using the same test package from the previous PR).

> ../epm.erl -f -t rpm -n test -v 1.1.0 -a x86_64 tmp etc
> rpm -qp --requires test-1.1.0-1.x86_64.rpm
/bin/sh
> ../epm.erl -f -t rpm -n test -v 1.1.0 -a x86_64 --depends 'zlib > 1.2' --depends 'zlib-devel > 1.2' tmp etc
> rpm -qp --requires test-1.1.0-1.x86_64.rpm
zlib-devel >
zlib > 1.2
> ../epm.erl -f -t rpm -n test -v 1.1.0 -a x86_64 --depends 'zlib > 1.2' --depends 'zlib-devel > 1.2' --depends foo tmp etc
> rpm -qp --requires test-1.1.0-1.x86_64.rpm
foo
zlib-devel > 1.2
zlib > 1.2

notice how sometimes the version is missing and that /bin/sh is not included in them all (even though it is supposed to be).

Here's the same commands with the fix.

> ../epm.erl -f -t rpm -n test -v 1.1.0 -a x86_64 tmp etc
> rpm -qp --requires test-1.1.0-1.x86_64.rpm
/bin/sh
> ../epm.erl -f -t rpm -n test -v 1.1.0 -a x86_64 --depends 'zlib > 1.2' --depends 'zlib-devel > 1.2' tmp etc
> rpm -qp --requires test-1.1.0-1.x86_64.rpm
/bin/sh
zlib > 1.2
zlib-devel > 1.2
> ../epm.erl -f -t rpm -n test -v 1.1.0 -a x86_64 --depends 'zlib > 1.2' --depends 'zlib-devel > 1.2' --depends 'foo' tmp etc
> rpm -qp --requires test-1.1.0-1.x86_64.rpm
/bin/sh
zlib > 1.2
zlib-devel > 1.2
foo

In this case all the dependencies seem to be correct.

@djnym
Copy link
Contributor Author

djnym commented May 24, 2017

Same suse setup, the commands from above with master

> ../epm.erl -f -t rpm -n test -v 1.1.0 -a x86_64 tmp etc
> rpm -qp --requires test-1.1.0-1.x86_64.rpm
/bin/sh
> ../epm.erl -f -t rpm -n test -v 1.1.0 -a x86_64 --depends 'libz1 > 1.2' --depends 'zlib-devel > 1.2' tmp etc
> rpm -qp --requires test-1.1.0-1.x86_64.rpm
zlib-devel >
libz1 > 1.2
> ../epm.erl -f -t rpm -n test -v 1.1.0 -a x86_64 --depends 'libz1 > 1.2' --depends 'zlib-devel > 1.2' --depends 'foo' tmp etc
> rpm -qp --requires test-1.1.0-1.x86_64.rpm
foo
zlib-devel > 1.2
libz1 > 1.2

So same behavior, now with the patch.

> ../epm.erl -f -t rpm -n test -v 1.1.0 -a x86_64 tmp etc
> rpm -qp --requires test-1.1.0-1.x86_64.rpm
/bin/sh
> ../epm.erl -f -t rpm -n test -v 1.1.0 -a x86_64 --depends 'libz1 > 1.2' --depends 'zlib-devel > 1.2' tmp etc
> rpm -qp --requires test-1.1.0-1.x86_64.rpm
/bin/sh
libz1 > 1.2
zlib-devel > 1.2
> ../epm.erl -f -t rpm -n test -v 1.1.0 -a x86_64 --depends 'libz1 > 1.2' --depends 'zlib-devel > 1.2' --depends 'foo' tmp etc
> rpm -qp --requires test-1.1.0-1.x86_64.rpm
/bin/sh
libz1 > 1.2
zlib-devel > 1.2
foo

And trying to install the one with 'foo' results in

> sudo rpm -i test-1.1.0-1.x86_64.rpm
error: Failed dependencies:
        foo is needed by test-1.1.0-1.x86_64

But installing the one without (but with the zlib deps, works as expected)

> sudo rpm -i test-1.1.0-1.x86_64.rpm
>
> sudo rpm -e test zlib-devel
> sudo rpm -i test-1.1.0-1.x86_64.rpm
error: Failed dependencies:
        zlib-devel > 1.2 is needed by test-1.1.0-1.x86_64
> sudo zypper install zlib-devel
Loading repository data...
Reading installed packages...
Resolving package dependencies...

The following NEW package is going to be installed:
  zlib-devel

1 new package to install.
Overall download size: 106.6 KiB. Already cached: 0 B. After the operation,
additional 374.1 KiB will be used.
Continue? [y/n/? shows all options] (y): y
Retrieving package zlib-devel-1.2.8-10.1.x86_64
                                       (1/1), 106.6 KiB (374.1 KiB unpacked)
Retrieving: zlib-devel-1.2.8-10.1.x86_64.rpm .........................[done]
Checking for file conflicts: .........................................[done]
(1/1) Installing: zlib-devel-1.2.8-10.1.x86_64 .......................[done]
> sudo rpm -i test-1.1.0-1.x86_64.rpm
> echo $?
0

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant