packaging 22.0 removed the LegacyVersion object which was the fallback
when an invalid version was found. Now when an invalid version is found
packaging raises and exception. This appears to be a problem for rolling
release distros like Arch and Manjaro as they don't have versions.
To fix this we catch the exception and set our object value to None.
This will cause us to error later should we actually need the version
for some reason. When we don't need it as with Arch/Manjaro we continue
along just fine.
Change-Id: Ic9ec6a3a492a7f95cf9d2865f88d79c6c5de796c
The 1.7.0 release of distro moves the source code around [0] which
requires us to update our monkey patching of distro to make tests work.
Because distro 1.7.0 does not support python < 3.6 we update bindep's
testing to accomodate both old and new distro to enable python 2.7 and
3.5 testing.
[0] 4d76bd160f
Change-Id: I6cc3bedaa9753dc86d6560d32961b5a22cf3a36e
We've seen people whose editors don't add newlines to files for whatever
reason. Make bindep handle this case since users are running into it.
Note that we could theoretically modify the existing parsley grammar to
accept a missing newline and instead find EOF but adding rules like that
seems to interact with whitespace processing in ways that I don't
understand. Rather than spend a ton of time learning parsley internals I
figure the fix here is simple and easy to understand and limits
potential fallout from changes to the grammar.
Change-Id: I960e579a603d1a4612d859451df1f559e950ac31
If applied, this commit will add test support for Manjaro Linux. The
test suite for Manjaro is based on the test suite for Arch Linux since
these two distros share a package manager. In addition to a package
manager, Manjaro also shares a vast majority of its packages with Arch
Linux and does not offer any that override package names in the base
Arch Linux repositories. Like Arch, Manjaro is a rolling release, so the
test fixture, (a copy of /etc/os-release), should remain consistent over
time, as it lacks any version information.
Change-Id: I07195f9300459339ebe62c7871fae9a770bd97f2
If applied, this commit adds support for Manjaro Linux, an Arch Linux
downstream variant. Both use pacman as their package manager.
Change-Id: Ib95834bf919b045a871e919973871f5303a4c6c9
Apparently distutils.version.LooseVersion does not supply a version
attribute in newer Python stdlib. The code we have already prefers
packaging.version.parse over it anyway if packaging is installed, so
declare it as an actual requirement. Clean up the old distutils
alternative now that it should no longer be called.
Change-Id: I9409f2b0e076e5def3fffb1149665df71c0c5508
- assure we can all bindep as a module (python -m bindep)
- add test the assures output is the same regardless how is called
- include argparse fix which needs to know executable name when
called as modules.
- enables use of bindep without needing to have it in PATH
Change-Id: Ib2aac359e2f23cb0ac7857835905e0a02e90888d
It seems that `pacman -Q` may output warning lines if you have a
file with the same name as the package, like so:
$ mkdir cmake
$ pacman -Q cmake
error: package 'cmake' was not found
warning: 'cmake' is a file, you might want to use -p/--file.
This confuses bindep's output parsing when looking simply for lines
ending in "was not found" so match more strictly instead on lines
containing something like:
error: package 'cmake' was not found
See the original patch supplied by Jakob Lykke Andersen in this
mailing list post:
http://lists.openstack.org/pipermail/openstack-discuss/2020-December/019404.html
Change-Id: I70287418ce034690a7fd34f4127a24fe8d7a33d2
Co-Authored-By: Jakob Lykke Andersen <jlandersen@imada.sdu.dk>
Upgraded hacking and fixed issues with code. This fixes pep8 job
which was failing on py38 as dependencies were too old.
Change-Id: I1b1a980eb1cb7ad0a6754b3aebfb3e3e1617c3be
When added with 2152331ebf this was a
copy of the externally hosted bindep fallback file which was
deprecated.
So this now represents a big collection of things that we're not
maintaining. When we add new python3 only distros to testing it all
breaks.
I think the point of this test is to ensure the callouts to the tools
for installation are working; there's no need to install the whole
world. Cull this to a simlified list that exercises a few common
paths with packages that should be stable for the forseeable future.
Change-Id: Ib87425a5010e6cc781731512473e3db2461c1faf
When just trying to determine the list of possible platform profiles, it
seems silly to need to `touch bindep.txt`.
Note that we'll still log the error about how neither bindep.txt nor
other-requirements.txt exists
Change-Id: I6ab187cdfb7d8fc5638880bcffea6800f5227c79
Because we forgot to mock platform.system() it was impossible to run
unittests on Darwin.
This also introduces a minimal unittest for Darwin itself, checking
that it recognizes brew.
Change-Id: Iff77e46b8b550d13e825712567266532edb03fa6
Adds two new atoms `base-py2` and `base-py3` that can be used to
identify the primary python version supported by the current operating
system.
This allows bindep file authors to mention correct python package names
without having to hardcode each operating system version, which is
not future proof, as it would break when new versions are released.
New way to use bindep:
python3-lxml [platform:base-py3]
python-lxml [platform:base-py2]
Before this users had to rely on hacks like including the operating
system name and version [platform:centos-7] and negative variants,
something that would being broken as soon a new release is made.
Initial implementation covers RedHat flavored, Ubuntu, Debian and MacOS
which do come with an official Python version but is made in such way
that we could enable it for any other platforms.
Change-Id: I506699fb0c80f8d9ca84e20154d1c282a08708bb
Task: https://tree.taiga.io/project/tripleo-ci-board/task/809
During the refactoring of the depends module
I74ebd432d8e1ab8b3433f0f55d5dfe3535019911
it was found that two test cases for emerge
used the wrong type as a return type in the
CalledProcessError (str instead of bytes).
This patch fixes this and also adds a check that the
appropriate operations can be executed also for emerge.
Change-Id: I127e72cbcefaef12f28f5eb986cdcc769d033bf7
Signed-off-by: Andreas Florath <andreas@florath.net>
This requires updating newer hacking which requires
some small fixes for pep8 to pass. Also adjust sphinx
dependencies so that py2.7 environment continues to work.
Change-Id: I576a6c42867a3fed7cc7090bd4a6219de3bced66
Pacman output has changed and, as of v5.1.2, has a newline after
showing package x was not found.
Without this patch, the bindep --brief would throw an exception
because the stdout is not properly matched.
Change-Id: Ibe2ca0d426d6d8fa69b5c4ee9ccf0f6a07c862a7
Adopts testing using in-repo bindep.txt testing file instead of
using the deprecated externally hosted bindep-fallback.txt file.
Initial file is the same but in the future we may want to simplify it.
Change-Id: I570fe8686068478a163e4fe597514460b6a69fef
yum/dnf package managers do allow mentioning full path to executable
instead of rpm name for installing it.
This allows users to install needed tool regardless what package name
may provide it (which may depend on what repos they have installed or
enabled).
This allows 'package' names to start with slash as this is a requirement
for triggering this feature in yum/rpm.
Practice use-case scenario: user wants docker to be installed but docker
could be installed from docker rpm or from docker-ce rpm if user added
upstream repositories. Both of them provide the same executable, but
the package manager will pick one based on its priorities.
Command line example: yum install -y /usr/bin/docker
Change-Id: I7e47ee956e9496d9f47a98f9595790797c8d1789
The parsing is still weak, but we do get around warnings or anything
else on stderr that would trip it up. This required refactoring the
tests which were mocking subprocess.check_output instead of
Popen/communicate which is what we use now.
Change-Id: Ie2d2fdfd27c728508213b4d23d3b58ad81a68ad2
* Use openstackdocstheme instead of obsolete oslosphinx
* Update requirements to current versions
* Use sphinx-build instead of pbr specific commands
* Fix wrong indend to avoid sphinx warning
Change-Id: I5aff91ec45466f25b825b1729561976db69eb188
Without this patch, issuing 'bindep --profiles' would fail
on groups that aren't a 2-tuple, because we assume
always two elements and unpack these two [1].
This is a problem, because in the case of loci [2], it prevents
a user from predicting the list of packages to be installed
on the system in a read only fashion.
Additionally, the current --profile function is showing
platform details under "Configuration profiles" AND
"Platform Profiles", as platforms are not filtered by the
profiles() function.
This patch solves the two linked problems by:
- ensuring the lists of profiles are flattened
- ensure the profiles are following the _partition function.
[1]: cec3a7576b/bindep/depends.py (L276)
[2]: 8982c3ae71/bindep.txt (L13)
Change-Id: Ied4ac178e20daf35f105e2acae0a2b3e11219a56
Docker images coming from the dockerhub for opensuse leap 15
(opensuse/leap:15) have the following content in their lsb
release:
NAME="openSUSE Leap"
VERSION="15.0"
ID="opensuse-leap"
<redacted>
Without this patch, opensuse-leap images are not recognised
by bindep, as "opensuse-leap" != "opensuse"
This is a problem, as it prevents subprojects using bindep
(like loci) to use those images, unless some hackery of
release file is done.
This patch solves the problem by ensuring opensuse-leap
systems are strictly listed like any other "opensuse.*" system.
Change-Id: I937812b7219ec38f9335dbb85600f294fff40902
This change implements support for Alpine Linux and it's package manager
apk.
Task: 22622
Task: 22623
Story: 2002765
Change-Id: I4027e50e33a512fd75a6d6be49c2f7665c4cbc7a
If we don't know how to support a detected platform the old code gave a
cryptic error message. Make this more clear by setting a specific
"unknown" platform value that raises if you attempt to get package
manager info with an error message that explains this situation.
Change-Id: I125dad3a3aa8f67ad5e96430e51022f5aa461b23
Some distros don't have lsb_release and some aren't even linuxes. Lets
work to support them by using the python distro package which has a
consistent api to getting the distro id, codename, and version info that
we need.
This does its best to be backward compatible by adding atoms for the
os-release reported name and the lsb_release reported name when they
differ on distros; however, it is likely that my survey was incomplete
and there may be other non matching distros. (For some reason it seems
like this is super common with rpm based distros...).
Note that the test for a missing lsb_release has been removed since that
is not the distro package's responsibility and it has multiple
fallbacks.
Change-Id: I891f5d21accb3fbf6d56bd6b0c2ebc2601682442
I presume optparse was a python2.6 compat thing; but since it's stated
in the NEWS file that it's not supported for several years, I think we
can switch. Even if someone *was* running on centos6 era, the odds
they won't/can't have python-argparse installed anyway are minimal, so
it's not like this is a completely hard break.
Some minor refactoring is included to reduce a level of nesting.
Change-Id: Ib933db547a811d533bdc95b4836354e959c0a6f5
lsb-release-3.X.X doesn't report 'openSUSE Tumbleweed' anymore but it
simply returns 'openSUSE' so update the references for Tumbleweed.
Change-Id: I3e99948167655a8a94c76a1a90d7ddefa6d5bb5b
Link: http://bugzilla.suse.com/show_bug.cgi?id=1059374
This adjusts the logic to be in keeping with the original spirit of the
patch. We want to treat a group as a profile, so if a group exists and
does not match, and no other groups or profiles were specified, the
package should not be installed.
Change-Id: If76bbb408837b14e79a659348edbdb840be7b9ba
Given the following:
package1 [foo bar]
package2 [foo (bar baz)]
package3 [baz]
package4 [(bar baz)]
Profile 'foo' will match package1 and package2
Profile 'bar' will match package1
Profile 'baz' will match package3
package4 cannot be match when only declaring a single profile
Specifing profiles 'bar baz' will match all four packages
Additionally, this relaxes the whitespace around the profiles and
groups. Previously while space was allowed after but not before braces.
Change-Id: I077943ff52cc8dc2eb6437925f8ca653b3534508
These changes add a new feature which allows users
to list all dependencies for their platform in csv
format or one dep per line. This is really useful
if people want to take the deps found in bindeps.txt
and use them in an RPM spec file to build an RPM.
USAGE:
bindep -l newline
* lists all dependencies one per line
bindep -l csv
* lists all dependencies in csv format
Change-Id: I0277689ba727737e11b0adcddf6300b58614ac18
It's possible for a bindep file to list capabilities instead of actual
package names so it can cover different packages that provide the same
functionality. It's also possible to use capabilities to 'capture'
multiple releases of the same distribution that may have different
rpm package names for the same application. RPMs normally provide at
least one capability named after their actual package name so this
change actual extends the behavior of bindep without alterning it.
For example, here are some results on the openSUSE Leap 42.2
distribution where the package name is 'mariadb'
> rpm -q mariadb
mariadb-10.0.30-20.4.1.x86_64
> rpm --whatprovides -q mariadb
mariadb-10.0.30-20.4.1.x86_64
> rpm -q mariadb-server
package mariadb-server is not installed
> rpm --whatprovides -q mariadb-server
mariadb-10.0.30-20.4.1.x86_64
As we can see, using '--whatprovides' results in bindep picking up
the correct package name based on the capabilities of that package.
Change-Id: I36945d3528013250f3a8617ea63ba1883733f91c
Right now, if lsb_release is not on the system, bindep just dumps stack
and indicates "No such file or directory". This gives no indication of
what the problem is or what to do to resolve it. This change logs an
error message about lsb_release being missing in that case.
Change-Id: I501647770478fe154d66cdb2c6adff48973dd23c