Commit Graph

1107 Commits

Author SHA1 Message Date
Patrick McCarty 67dfd12ee6 Remove old Travis CI config
We are using Github Actions now, so remove the unused Travis CI
configuration file.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2020-04-24 20:12:02 -07:00
William Douglas 258ebe73db Remove dead code
The content map can never be empty at this point due to the assignment
so remove the test.

We could have checked the files element in the map to see if it was
empty but printing a warning for an empty extras file isn't very
valuable.
2020-04-24 16:00:21 -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
Patrick McCarty 400e69fcaa actions: refactor workflow to run tests in parallel
Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2020-04-24 00:51:00 -07:00
Patrick McCarty cce562197e actions: bump to latest checkout release (v2.1.0)
Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2020-04-24 00:51:00 -07:00
Patrick McCarty 34e861e60a Restore red color prefix for warnings
The messages with '[WARNING]' prefix were red, not yellow.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2020-04-22 12:03:19 -07:00
Patrick McCarty b1f40644ff Avoid escape sequences when stdout is not a tty
In case autospec's output is logged to a file, it's better to not print
the escape sequences.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2020-04-22 12:03:19 -07:00
Patrick McCarty 7fb591d7f2 Unify progress messages that use color
The `pkg_integrity` module defined its own progress message functions
that differed from the ones used by the rest of the code base: they used
slightly different colors (the "bright" color variants) and had
different formatting.

For better maintainability, remove the `pkg_integrity` progress message
functions, and extend/refactor the ones from `util` to cover the ones
`pkg_integrity` needs.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2020-04-22 12:03:19 -07:00
William Douglas 71b7496fbc Fix pecl url builds
The pattern must be passed to the source class to handle pecl archive
files correctly. It would be good to have the configuration files be
loaded before the sources are processed but that's a later work item
and is unlikely to cause problems in this case.

Fixes #617.
2020-04-20 12:35:08 -07:00
Patrick McCarty 363f050627 Refresh tests/README.rst to reflect current state
Fixes #405

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2020-04-17 14:47:37 -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
Ross Burton e6385a66bb config: only load profile_payload if PGO is enabled
Closes #548
2020-04-17 08:48:43 -07:00
Patrick McCarty 91c50b3836 Avoid using a keyring when calling pip
Instruct pip to not use a keyring by setting an environment variable
(PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring). As far as I
know, there is no need to use a keyring for any of the pip commands
autospec runs.

Some users have encountered timeouts similar to the report from
https://github.com/pypa/pip/issues/7883, which describes this
environment variable setting as a workaround.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2020-04-16 10:30:43 -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 f72b990506 Require the target option to be passed
Similar to the URL, the common tooling always passes the target
directive to autospec. Using this convention we can better initialize
autospec state earlier and with less fallbacks.
2020-04-14 14:14:14 -07:00
Ross Burton 2c1a2bf656 config: support tests_extras
Some test suites install files that can't be auto-detected, so support a
tests-extras file to add extra files to the -tests package (not
-extras-tests).
2020-04-13 16:39:47 -07:00
Ross Burton d46769be5e Refactor extra file packaging
The logic behind the files extras, dev_extras and *_extras is
essentially identical but duplicated.  Consolidate the code and internal
variables into a single parse and file_maps variable.
2020-04-13 16:39:47 -07:00
Ross Burton 8ea337062e specfiles: make foo-tests depend on foo
Also cleanup code duplication that has grown over time.
2020-04-13 16:39:47 -07:00
Ross Burton 108e3ac9a9 Package installed-tests into a -tests subpackage
Many GNOME packages install their test suite so that it be run in situ
instead of in the limited environment of the builder.  However, these
files for foo.spec are typically packaged into either foo or foo-libexec
and so always installed.

Instead, package /usr/(share|libexec)/installed-tests into foo-tests, so
that they are not always installed but the packages exist for potential
bundles in the future.
2020-04-13 16:39:47 -07:00
Patrick McCarty 08db263cdc Fix buildreq_cache handling
The fourth argument to `parse_config_files` is supposed to be the
content (tarball) version, not the Content instance itself. The
buildreq_cache file handling in `parse_config_files` is the only code
affected by the bug.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2020-04-13 16:36:36 -07:00
William Douglas a00b51abeb Add new failed_pat based on simple_pat
There was a simple pattern for systemd (oddly not a pkgconfig pattern
since it is using pkg-config) that is usable by at least one other
package pattern so move it into a failed pattern. Also add the other
package to the failed_commands file.
2020-04-13 15:50:18 -07:00
William Douglas 9e611565e5 Remove simple zlib pattern
This pattern is captured by failed_pats so drop it.
2020-04-13 15:50:18 -07:00
Auke Kok 8ab45a1921 Add sysusers support identical to tmpfiles. 2020-04-13 14:48:58 -07:00
Patrick McCarty 3bfb7b558a Extend fail pattern for make
This covers the "ENOENT" case. Also update the unittests to verify that
the updated pattern works.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2020-04-12 16:48:37 -07:00
Anselmo L. S. Melo 324fc800e9 specfiles: Allow archives in R pattern
The rationale behind this was to support extra tarball for R-RSQLite,
in order to bump the bundled sqlite version using sqlite's upstream
tarball instead of a local (huge) patch applied to the package.
2020-04-07 11:12:01 -07:00
Thiago Macieira bb32bec4cc Add support for an "-examples" sub-package, containing Qt 5 examples
Other installations welcome. I could have added them to the "-dev"
package but didn't think most people want the examples when
developing. This will be used in a new bundle in Clear Linux.

Needed to fix clearlinux/distribution#1781.
2020-04-07 10:46:40 -07:00
Juro Bystricky 75e7d2b887 specfiles.py: FFLAGS/FCFLAGS fixes
Fortran developers may be using either FCFLAGS, FFLAGS or both.
Common usage is:

FCFLAGS : Fortran 90 compiler flags
FFLAGS  : Fortran 77 compiler flags

If both of them are initialized, they must be identical.

This patch addresses two issues:

1. https://github.com/clearlinux/autospec/issues/538
   The assumption CFLAGS and FFLAGS are identical is no longer valid.
   Using CFLAGS for FFLAGS will result in compiler warnings such as:
   f951: Warning: command line option -Wformat=1 is valid for C/C++/ObjC/ObjC++ but not for Fortran
   f951: Warning: command line option -Wformat-security is valid for C/C++/ObjC/ObjC++ but not for Fortran

   Not only are the warnings a nuisance, but if warnings are treated as
   errors, this can break builds. The remedy is to initilize FFLAGS using
   the environment $FFLAGS instead of the environment $CFLAGS.

2. https://github.com/clearlinux/autospec/issues/580
   AVX2/AVX512 instructions not generated for Fortran
   When selecting builds with AVX2/AVX512 optimizations, there are no
   FFLAGS or FCFLAGS specified, hence any resulting Fortran code will
   not generate any AVX instructions. Fortran is mostly used for
   intensive mathematical/numerical/scientific code and as such would
   very likely benefit from AVX instructions a lot.

Signed-off-by: Juro Bystricky <juro.bystricky@intel.com>
2020-04-02 12:19:22 -07:00
Patrick McCarty 1dbe8ce95d Restore sorted order for pypi Requires lines
In the recently removed `load_specfile()` function in buildreq.py (see
commit 2a181a2d), the pypi_requires set was sorted and converted to a
list via `sorted()`. Now, the set is no longer converted to a list, so
we can instead sort it immediately before writing out the contents in
`write_files_header()` in specfiles.py.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2020-04-01 21:05:40 -07:00
William Douglas 195b88e0ff Refactor build to remove remaining globals
The build module had a number of globals that were referenced by many
other modules and has ordering dependencies with the config and
tarball module for some values. This made deciding on where certain
values get initialized difficult but before the initialization can be
addressed a refactor is helpful.

This change moves the global state (and functions that needed to act
on that global state) into a Build class. The goal of this work is
to better track what can be updated by a particular function, load
data in a sensible order and have it owned by a sensible component.

Some of this data is likely to be removed from the build class in the
future as initialization of download and base paths should take place
in other modules most likely.
2020-04-01 14:59:44 -07:00
Ross Burton 33a9f75ca4 tarball: update Git URL for GNOME projects
github.com/GNOME is a mirror of the canonical git repositories, which are at
gitlab.gnome.org.
2020-03-31 08:31:21 -07:00
William Douglas ebf0a6988d Refactor tarball to remove remaining globals
The tarball module had a number of globals that were referenced by
many other modules and has ordering dependencies with the config
module for some values. This made deciding on where certain values get
initialized difficult but before the initialization can be addressed a
refactor is helpful.

This change moves the global state (and functions that needed to
act on that global state) into a Content class. The goal of this work
is to better track what can be updated by a particular function, load
data in a sensible order and have it owned by a sensible component.

I expect that future work will see the tarball, buildpattern and some
portions of the config moved around to better match what component
should own what data (and to better deliniate between the data that
has a similar use but comes from different sources).
2020-03-30 13:08:05 -07:00
Juro Bystricky 000cdd38f0 files.py: Properly package openmpi python files
Python openmpi files such as:

/usr/lib64/openmpi/lib/python3.8/site-packages/foo.py

should be packaged in <package>-openmpi instead of <package>-dev.

Signed-off-by: Juro Bystricky <juro.bystricky@intel.com>
2020-03-30 08:50:50 -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 84464a329b Use Config members directly in specfiles
Rather than load duplicates of certain members of the Config class,
directly reference those objects from the specfile's own reference of
config.
2020-03-26 16:26:26 -07:00
Patrick McCarty 72ecbd46ef Fix bug with "file not found" detection
Omitting the package NVR from the conditional will result in an
IndexError if the NVR does not actually exist on that line.

This change fixes the packaging for `epm` in Clear Linux OS, which
prints "file not found" errors when running its unit tests, but with
the i386 arch and slightly different NVR.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2020-03-25 19:08:15 -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 0e5f88efe0 Remove unused function
This hasn't been in use for some time and with the rework of pip
requirement capture is no longer required.
2020-03-24 18:05:27 -07:00
Juro Bystricky 54a94e123f support for openmpi sections
Initial support for concurrent serial and parallel build.
Parallel MPI build enabled via a new setting in "options.conf":
    openmpi = false|true (false is default)

 * Serial builds remain unaffected.
 * Parallel build: Only OpenMPI is supported.
 * Parallel builds always assume AVX2.
 * Build patterns implemented: "configure" and "cmake".
   The build process is controlled by additional files:
   "cmake_arg_openmpi": same functionality as "cmake_args"
   "configure_openmpi": same functionality as "configure"

The openmpi (configure, build, check, install) sections follow these steps:

module load openmpi
...[configure,build,install,check]
module unload openmpi

Once "openmpi=true", the packages "openmpi-dev", "modules" and "openssh"
are automatically added to BuildRequires. ("openssh" is generally required
to run any MPI test suites).

Packages created:
   foo-openmpi:    binaries, libraries, docs, ...
   foo-dev :       contains both serial and MPI devel. files
   foo-staticdev:  contains both serial and MPI devel. files
2020-03-10 10:49:37 -07:00
William Douglas b757c28a15 Disable use of go modules
Unless a user specifically opts into using go modules don't try and
parse go.mod files for dependencies.
2020-03-09 13:38:03 -07:00
William Douglas b274d9dfff Normalize the package names from the pypi ecosystem 2020-03-05 16:32:45 -08: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 5f6a38d890 Add support for package alias name
The package alias is intended to be used as a manual override in cases
where the upstream package name is not the one that Clear Linux used
as the package name (due to conflicts or other reasons) and there is
tooling that requires the use of the upstream package name that
autotools runs (pypi is the motivating usage currently).
2020-03-05 16:32:45 -08:00
William Douglas 1c51261d1a Keep global file list in a set instead
Rather than iterate through a list for existence checks, use a set
instead for performance reasons.
2020-03-05 16:32:45 -08:00
Juro Bystricky 26a9210743 specfile.py: fix incorrect install folder for AVX/AVX512
The combined usage of "subdir" and AVX2/AVX512 builds fails to install
for certain build patterns (notably for "configure").

This can be verified, for example,  by trying to build the package "ntl" with:
    use_avx2 = true
    use_avx512 = true

This will fail with an error during install, similar to this:
    pushd: ../buildavx512/: No such file or directory

This patch fixes this by descending to the correct folder:
    pushd ../buildavx512/src

Signed-off-by: Juro Bystricky <juro.bystricky@intel.com>
2020-02-28 15:16:34 -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
Auke Kok a6067f4017 Add two more patterns to blacklist. 2020-02-26 10:56:05 -08:00
Athenas Jimenez 808b7d7224 Consolidate source management in Source class.
This patch consolidates the code that manages the sources
(.zip, .tar, etc) in Source class. This class is written in a way
that allows the reuse of code for all current supported types of
sources and at the same time, it allows the easy addition of new
ones.

Signed-off-by: Athenas Jimenez <athenas.jimenez.gonzalez@intel.com>
2020-02-21 16:15:22 -08:00
Patrick McCarty d6dd491899 build: only record files when they are first listed
Because rpmbuild dumps a list of build errors after the build has
stopped and any errors have occurred, the "Installed (but unpackaged)
file(s) found" line is repeated, and thus autospec will always parse the
list of unpackaged files twice. Also, the repeated listing of unpackaged
files is sometimes truncated, possibly due to a bug in rpmbuild.

Since autospec already understands how to locate the end of the initial
unpackaged file listing, it can avoid the duplicate parsing and any
possible truncation issues by ensuring that the `infiles` variable is
set to `1` exactly once. Then, `infiles` will continue to have value `2`
from the end of the first file listing until parsing stops.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2020-02-20 10:17:29 -08:00
William Douglas 615f5a44a5 Stop adding maven build requirements
Turn off adding maven and gradle dependencies and build requirements
due to the reduction of support for this content in Clear Linux.
2020-02-11 13:05:45 -08:00
Athenas Jimenez d0b3aa3ac5 tarball: Simplify Go packages management.
Add a special archives list (go_archives), so we can remove Go specific
methods and simply make use of regular methods.

Signed-off-by: Athenas Jimenez <athenas.jimenez.gonzalez@intel.com>
2020-01-31 14:07:09 -08:00