28 Commits

Author SHA1 Message Date
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 bab62aab05 Handle backport patches
When encountering patches prefixed with 'backport-' if they no longer
apply, remove them from the patch series and try to restart the build
without them. The goal is to avoid manual work removing patches known
to be obsolete in the next release.

Signed-off-by: William Douglas <william.douglas@intel.com>
2022-03-18 13:48:17 -07:00
William Douglas b0d98f2f41 build: reset file_restart for buildroot log parse
The file_restart needs to be reset for the buildroot log if the
buildroot log is not clean the build log won't be parsed and so
file_restart won't be reset otherwise (causing build loops to occur
for packages that can't be found for instance).

Signed-off-by: William Douglas <william.douglas@intel.com>
2022-02-07 12:37:36 -08:00
William Douglas 61af4ac6f5 pypi conversion test fixups 2022-01-12 04:44:34 -08:00
William Douglas aabe801c3e Avoid rebuilding the package after only file adds
Try to avoid doing a full rebuild when the build.log only has new
files in it.

This has a two downsides. The source buildroot needs to be distinct
from the binary buildroot. The built rpms are no longer installable as
rpmbuild flags them.

The upside is packages that take forever to build or don't have
build times improved by ccache will not need a duplicate round for
just adding the files.

The rpms can still be generated in an installable fashion with 'make
build' and the autospec generated rpms can be installed by force
installing if need be.

Signed-off-by: William Douglas <william.douglas@intel.com>
2022-01-05 08:23:17 -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
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 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 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 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
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
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 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
Athenas Jimenez cf52709df9 test_build: Increase coverage for build errors patterns
Signed-off-by: Athenas Jimenez <athenas.jimenez.gonzalez@intel.com>
2020-01-07 13:45:42 -08:00
Patrick McCarty 0e91b5a284 Remove capability for dynamic reserving of buildroots
Instead of autospec reserving buildroots on-the-fly to not collide with
buildroots that already exist, I would prefer for the developer (or
automation) running autospec to explicitly modify mock's `basedir`
config option whenever more control is needed, possibly combined with
other config options that modify state locations (like `cache_topdir`,
`root`, etc).

Considering only the `basedir` option, a developer could run these three
commands simultaneously to build the package `foo` and also avoid
buildroot collisions:

  $ make autospec MOCK_OPTS="--config-opts=basedir=/var/lib/mock/dir1"
  $ make autospec MOCK_OPTS="--config-opts=basedir=/var/lib/mock/dir2"
  $ make autospec MOCK_OPTS="--config-opts=basedir=/var/lib/mock/dir3"

The build root names would be (assuming that
config_opts['root']='clear', as it is by default):

  /var/lib/mock/dir1/clear-foo
  /var/lib/mock/dir2/clear-foo
  /var/lib/mock/dir3/clear-foo

(Note that a side-effect of this change is that all autospec unit tests
now pass in Github Actions; tests were failing because `sudo` was not
installed by default, and the unit tests required `sudo` via the
reserve_path() function.)

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2019-11-22 12:17:42 -08:00
William Douglas ef9b6c9c7d Add tests for banned paths
Autospec currently doesn't handle /etc/, /opt/, /usr/etc/, /usr/local/
or /usr/src/ content paths so explicity warn and then fail when
content in these paths are detected.
2019-10-16 13:53:45 -07:00
Athenas Jimenez c1154cd17b maven pattern: General update.
- Change the prefix from jdk- to mvn- .
- Remove the use of xmvn.
- Add more artifacts to maven_jars file.

Signed-off-by: Athenas Jimenez <athenas.jimenez.gonzalez@intel.com>
2019-06-25 18:31:12 -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
Patrick McCarty 4d6ba518ec Fix a bug in root.log parsing function
The function was simply returning 'None' instead of a boolean. This bug
resulted in autospec never recognizing that no more build rounds were
needed when mock returns 0.

Add a unit test for this case and the other case for when mock failed
but the root.log contains no relevant errors.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2018-11-19 20:10:29 -08:00
Patrick McCarty ad1351cb1a Implement mock root.log error detection
Occasionally, packages will add new dependencies that are not yet
available in the repos, or autospec may add an invalid build dependency
for the next build round, etc.

To report these error conditions in a more meaningful way, scan the
root.log after a build whenever mock exits with a non-zero code. If mock
logged a missing dependency (or multiple missing dependencies), report
that information to the user. Otherwise, consider the root.log to be
"clean", and continue by scanning the build.log to determine how to
proceed.

Also, add a new unit test for the root.log parsing function.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2018-11-19 14:25:24 -08:00
Matthew Johnson bbaade01c7 Add test for build.log missing file parsing
Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
2017-11-16 13:19:11 -08:00
Matthew Johnson d4e78abc6c Remove unused "output" directory
Since moving output to a temporary directory, the "output" directory has
fallen out of use. Remove the output directory from autospec.

Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
2017-10-23 15:33:19 -07:00
Caio Marcelo de Oliveira Filho cc57b39872 Remove use of global variable for mock_cmd
Rename set_mock to get_mock_cmd, and return the value instead of
setting a global variable.

This patch should not change any behavior.

Signed-off-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
2017-10-18 12:33:15 -07:00
Caio Marcelo de Oliveira Filho 1574477167 Change how to decide whether use sudo or not with mock
Use 'sudo' unless /usr/bin/mock points to consolehelper. This is a
simpler heuristic than checking for the group membership and will let
us use the group membership in Clear Linux to give sudo permissions.

Signed-off-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
2017-10-18 12:33:15 -07:00
Matthew Johnson 8b56c225b1 Create mock chroot with a unique uniqueext
This prevents collisions when two instances are trying to build the same
package in parallel. Unit tests added as well.

Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
2017-10-11 15:38:14 -07:00
Matthew Johnson f8eb22b8f1 Update unit tests for latest changes
Some changes have recently been pushed to autospec sources without
updating the unit tests. This patch brings the unit tests up-to-date
again.

test_build.py: Remove go buildtool bits (was deprecated)
test_specdescription.py: Newline added to post-scripts
test_specfile.py: Reset license_translations dict
files.py: Check dict with get() in case of missing key
2017-07-12 08:46:47 -07:00
Matthew Johnson 13c6cdd838 Add unittests for the build module
This patch adds 26 tests for the build module. They can be tested by
running `make test_build` from the root of the autospec repo.
2017-04-25 16:55:07 -07:00