42 Commits

Author SHA1 Message Date
William Douglas 1f398f5e7b Add config for using ninja instead of make
Given more packages are using ninja as the build system of choice
instead of make, add flag to enable ninja usage.

Signed-off-by: William Douglas <william.douglas@intel.com>
2024-05-29 16:02:05 -07:00
William Douglas f4bef72a70 Add handling for multiline find_package
Previously support for cmake's find_package parsing was only able to
handle single line entries. This change adds support for multiline
versions and allows for module namespacing (currently qt6 and kf6
support is available).

The change for cmake_modules shows this namespacing in use.

Signed-off-by: William Douglas <william.douglas@intel.com>
2024-03-15 14:20:20 -07:00
William Douglas 874204ec31 Correct tests based on warnings
Previous code would emit:
SyntaxWarning: invalid escape sequence

Correct this by removing the escapes as they are not necessary.

Also add a missing buildreq that is detected correctly after the
fix.

Signed-off-by: William Douglas <william.douglas@intel.com>
2023-11-13 10:08:32 -08:00
William Douglas 250a6667eb Add global requires ban handling logic
Some packages should not be able to be added to any subpkg. Add
handling for this case.

Also as pypi-nose is no longer usable so ban it from being added as a
dependency.

Signed-off-by: William Douglas <william.douglas@intel.com>
2023-10-20 12:23:35 -07:00
William Douglas f796f641d0 Fix requires.tst scan variable assignment
When autospec find a requires.txt, set the requirements_path not the
requires_path (renamed to a more fitting pyproject_path). Also fix up
unittests and add a new one for this case.

Signed-off-by: William Douglas <william.douglas@intel.com>
2023-05-22 16:24:11 -07:00
William Douglas 972f4c60a1 Rework build pattern detection
Reorder some items for build pattern detection so that build
requirements for specific patterns are added last. This is to help
prevent build requirements that don't apply to a given pattern from
being added unintentionally.

As part of this remove some outdated bits (catkin and disutils36) that
no longer are used.

Signed-off-by: William Douglas <william.douglas@intel.com>
2023-03-23 15:11:54 -07:00
William Douglas 74c0833cf4 Remove ruby, golang and cargo build patterns
These patterns are being removed as they are not used or are going to
be reworked.

This change also removes support for multi-versioned packages which
were considered for go and cargo purposes.

Signed-off-by: William Douglas <william.douglas@intel.com>
2023-03-17 12:14:20 -07:00
William Douglas a453f7be0e Enable provides configuration overrides
Add support for (*_)provides_{add,ban} configuration files.

This is occasionally useful for cases where a pypi() provide isn't
picked up as the packages isn't a python package but does provide a
python library. It also can be handy when doing some renames to
prevent mass rebuilds.

Signed-off-by: William Douglas <william.douglas@intel.com>
2022-06-29 14:06:17 -07:00
William Douglas 25dee2cae6 Ignore python requirements with max python version
If a python requirement has a python_version bounded by a maximum
(python_version < 3.8) than ignore it. The reasoning for this change
is to avoid dependencies that no longer apply with the most recent
python version.

Signed-off-by: William Douglas <william.douglas@intel.com>
2022-02-09 10:53:10 -08:00
William Douglas 0c780b3205 Remove support for the java build systems
These are no longer used in Clear Linux so the code can be removed
without issue.

Signed-off-by: William Douglas <william.douglas@intel.com>
2021-12-17 11:56:08 -08:00
William Douglas f20cc8a1d3 Add missing python requirement symbol scrubber
Signed-off-by: William Douglas <william.douglas@intel.com>
2021-11-22 08:46:31 -08:00
William Douglas a19a557d53 Revamp autospec python dependency management
This migrates python dependencies (both build and runtime) to use
'pypi()' where possible (when detecting dependencies from setup.py,
setup.cfg, pyproject.toml, requires.txt and requirements.txt).

It also adds a few little cleanups to python detection in order to
make the above work more evenly and removes some python2 cruft.

Signed-off-by: William Douglas <william.douglas@intel.com>
2021-11-18 13:45:55 -08:00
Patrick McCarty d65b5a4e82 Revise CRAN package dep handling
Autospec's DESCRIPTION file parsing for CRAN packages is working well
enough that I think we can unconditionally add the detected requirements
as both build and runtime dependencies.

Also remove the propagation of CRAN build->runtime deps via fail
pattern, since we no longer need it; the deps detected via fail pattern
are either Suggests (optional) or not listed in DESCRIPTION at all.
Either way, they are not required dependencies.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2021-10-07 17:04:59 -07:00
William Douglas 38a711734c Don't handle install_requires parsing when already in multiline
When parsing setup.py files, if already in multiline and install_requires
is used as a variable, don't try and treat the line as if it was an
install_requires assignment.

Signed-off-by: William Douglas <william.douglas@intel.com>
2021-09-29 15:02:57 -07:00
William Douglas 327801ba2b Add support for custom subpackage requires
Due to more systems being added for automated runtime dependency
injection for subpackages, we need a way for manual overrides of the
default detected dependencies.

This change provides support for specifying which subpackage runtime
dependencies should be added or removed and consolidates some of the
custom configuration file detection along with it.
2020-04-24 16:00:21 -07:00
William Douglas 0e412270aa Re-organize buildpattern function into config
The buildpattern is a bit of an odd standalone module that was a
vestiage of the pre-refactor days where modules owned global
data. These days are coming to a close so move this data to a more
sensible owner in config.

This resolves #612 though likely more will be done as part of #131.
2020-04-17 13:49:33 -07:00
William Douglas 4f90794393 Move target directory to Config
Many different components require the target download path and it is
needed early. Previously code existed to attempt to autodetect its
location and so defining the path was enforced later in the build
process. This created problems with ordering functions based on this
requirement but since the target path is now certain to be defined at
startup (due to previous changes) we can better align the location and
initialization of the data to the Config class.

As part of this change also avoid requiring the temporary working
directory to be setup as part of the Build class. This is done as a
cleanup due to the only real user of this location being the Content
class.

This also drops the stand-alone pkg_integrety main function that was
initially used as a one off test to avoid needing to run autospec to
validate the integrity of a package. This feature was seldom used and
doesn't function well without handling configuration so it was
dropped.
2020-04-14 14:14:14 -07:00
William Douglas 2a181a2ddb Refactor buildreq into a class
The buildreq module had a large number of globals being touched across
many modules that would import it. This made changes to the buildreq
fragile.

It also made testing fragile due to certain globals needing to be
reset in order to properly test a change.

This change moves the global state (and functions that needed to act
on that global state) into a Requirements class. The goal of this work
is to better track what content can be updated by a particular
function and load data in a sensible order and have it owned by a
sensible component.
2020-03-26 16:26:26 -07:00
William Douglas 54636b48dd Refactor the config into a class
The config module had a large amount of globals that were being
touched across many modules that would import. This made changes to
config very fragile as figuring out what would be modified in any
given call chain was difficult to diagnose.

It also made testing fragile as one would need to reset a given
module's config import to the best of their knowledge before rerunning
another test.

To get away from that (and to try and reduce the number of globally
modified variablies in autospec as a whole), refactor the config
module to provide its state as part config class. The long running
goal of changes like this is to better track what content can be
updated by a particular function (if a function would have access
to the config instance is now the hint rather than the config module
getting imported).
2020-03-24 18:05:27 -07:00
William Douglas 70ae12f135 Add pypi requires for pypi packages
Turn on pypi requires now that Clear Linux packages have the pypi
provides.
2020-03-05 16:32:45 -08:00
William Douglas e4f229d10b Use the pypi api for distutils3 builds
Get metadata about the package from pypi for distutils3 build patterns
then use that metadata to get summary, description and provides
information (license and requires maybe leveraged in the future).

The description isn't always very useful (often too long) so only use
it if there isn't one already.
2020-02-27 12:30:33 -08:00
William Douglas 1489b2776b Purge python2 support from autospec 2019-11-14 12:59:43 -08:00
Patrick McCarty d404a9d25a Add several unit tests to cover R description parsing
Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2019-10-30 12:41:32 -07:00
William Douglas 54fd6e27aa Improve go ecosystem support
Update support for handling go packages by handling missing go
dependencies. Make use of go modules and the go proxy (see
https://tip.golang.org/cmd/go/#hdr-Module_proxy_protocol for more
details on the proxy implementation) to discover what artifacts are
needed.

A new go-dep build_pattern that will package all versions that the
go-proxy finds is also added as part of this change. Additional rework
of the golang build_pattern (and Makefile build_pattern as a number of
go packages use Makefiles) to use module vendoring when module
configuration is detected was added as well.

The new functionality is also intended to be used by a higher level
tool that will wrap autospec calls to build missing dependencies as
well as the requested package.
2019-07-19 15:10:48 -07:00
Patrick McCarty e5bf1b99b7 tests: fix up mocks for open_auto() use
Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2019-06-24 13:08:39 -07:00
William Douglas 0f29a2fa9f Remove cargo buildreq
Cargo is now part of the rustc package so stop adding it as a
buildreq.
2019-03-08 17:08:38 -08:00
Caio Marcelo de Oliveira Filho 0624ba6f37 cmake: Add a test for find_package parsing 2019-02-25 11:06:02 -08:00
Caio Marcelo de Oliveira Filho 2aa87e873e cmake: Ignore entries inside comments
Change the regexp to match only non-comment lines.  Found when I
figured waffle was depending on "pkgconfig(foo)".  Added a test for
that case.
2019-02-25 11:06:02 -08:00
Brett T. Warden 90eae48798 Improve handling variables in pkg_check_modules
Strip out variables in e.g.:
pkg_check_modules(AVCODEC libavcodec${_avcodec_ver})
2018-09-06 15:20:57 -07:00
Brett T. Warden 30a2528f95 Add unit test for pkg_check_modules with whitespace 2018-09-06 12:24:37 -07:00
Patrick McCarty e49a7a6494 test: add initial unit test for cmake pkg_check_modules support
Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2018-08-10 12:42:20 -07:00
William Douglas 6267759847 Improve python buildreq detection
Add additional logic to handle: "pkg ;  dep <= 'X'", style statements
for python requirements in setup.py. Also update tests to validate the
results are as expected.
2018-07-31 16:21:22 -07:00
Arjan van de Ven 3df5864ea8 switch to using buildreq-* meta packages for build deps
Use meta packages to handle buildreqs. Also when scanning for build
systems, set the buildreqs when the build_pattern has already been
configured.
2018-07-18 09:34:32 -07:00
William Douglas 4ea59de19c Stop attempting to handle python2 requirements
Move autospec over to only automatically resolving
buildrequirements (and some runtime requirements) for python3 and let
python2 go away.
2018-06-29 11:52:34 -07:00
Gabriel Briones ed12513d19 Correcting test for buildreq.py for py3 defaulting 2018-04-11 12:54:13 -07:00
Kevron Rees 85af003498 Try to autodetect python version by classifiers
If a python package is python3-only and has a setup.py,
"distutils23" will be used as build pattern even if the project is
explicitely specified as python 2 or python 3 only.

This change tries to find if either of these are the case by
looking at the classifiers in the setup.py file for the following
string:

"Programming Language :: Python :: 3 :: Only"
"Programming Language :: Python :: 2 :: Only"

The default is still "distutils23" unless either of these strings
are found.  If they are "distutils2" or "distutils3" will be used
corresponding to the version in the classifier.

Signed-off-by: Kevron Rees <kevron.m.rees@intel.com>
2018-03-21 09:28:58 -07:00
William Douglas 4befc85602 Fixups for rust/cargo building
Improve rust/cargo support by:
1) Better handling only toplevel Cargo configuration files for dependency
lookup.
2) Adding runtime requirements for buildreq packages in order to get
dependencies from non directly dependent packages resolved.
3) Add cargo as a buildreq for rust packages to handle the rustc/cargo
split.
4) Add cargo detection from failed_commands.
5) Fix rust source directory destination to not append version in case
the package name already had version information in it.
6) Get name and version information from crates.io package files.
2018-01-16 14:17:09 -08:00
Matthew Johnson a6c82dc940 Clean up buildreq module
Minor clean up of buildreq module, including the following changes:

- Remove unused import "tarball"
- Add function docstrings
- Convert to list-driven pattern checks instead of a long list of
  conditionals.
- Rename variable names that were overriding keywords (file, buffer,
  etc.)
- Remove unused setup_py_python3 function
- Remove unused arguments and variables from scan_for_configure function
  (and corresponding function calls in test_buildreq.py and autospec.py)

Most changes made at pylint and pycodestyle suggestions.
2017-07-13 10:55:41 -07:00
Matthew Johnson ccc278e657 Add more tests for setup.py buildreq parsing
Shortcomings were identified in setup.py parsing for python build
requirements. These tests more exhaustively test the cases we have been
seeing in the wild.
2017-07-06 16:26:48 -07:00
Arjan van de Ven 193efe132e Revert "Simplify the buildreq module"
This reverts commit 52e986c07d.

it breaks quite a few packages, including gtk+
2017-05-03 02:41:30 +00:00
Matthew Johnson 52e986c07d Simplify the buildreq module
This patch makes some simplifications to the buildreq module and related
modules (autospec and config). These are mostly readability changes and
code cleanup.
2017-05-01 11:47:00 -07:00
Matthew Johnson d5b6abc9d2 Add unittests for the buildreq module
Unit tests can be run from the root of the autospec directory by
invoking `make test_buildreq` or `make unittests`.
2017-05-01 11:47:00 -07:00