27 Commits

Author SHA1 Message Date
William Douglas f032afc72f Add autospec information to spec header
Add information about what autospec version was used to create the
spec file.

New header will appear as:

+# autospec version: v2
+# autospec commit: 1234567

With this change we'll restart tagging autospec. Changes that get
tagged (after PR merge, tag likely just pushed via git cli) should be
doing something that would benefit from a larger package ecosystem
rebuild.

Signed-off-by: William Douglas <william.douglas@intel.com>
2023-10-16 12:37:36 -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 7168764db4 Make build pattern print a comment
Signed-off-by: William Douglas <william.douglas@intel.com>
2023-03-16 14:23:21 -07:00
William Douglas 3552dc8e24 Add build pattern used in specfile output
Helpful for seeing what build patterns are being actively used.

Signed-off-by: William Douglas <william.douglas@intel.com>
2023-03-16 13:24:41 -07:00
Arjan van de Ven fb197fc176 move the elf-move run to after install_append so that install_append can fix up messes correctly 2021-10-12 16:03:55 -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
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
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 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
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
Brett T. Warden aa470c5c22 Create SourceX fields for extra version tarballs 2019-10-10 13:16:02 -07:00
William Douglas aeebdc928a Rework exclude feature
Instead of the excludes file adding '%exclude' macros for files that
are not being shipped in the binary rpms, they cause the file to be
deleted entirely.

This causes a few ripple effects in other parts of the subpackage file
manipulation code where excludes were used to avoid files being added
to multiple subpackages. To work around this, don't allow calls that
add files to a specific subpackage to fall through into the general
push_package_file fallthrough or file_pat_match calls. Also don't add
files that are still intended to be shipped to show up on the excludes
list.
2019-07-29 14:33:35 -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 0e1c61f6e6 Implement new config for clr-service-restart units
To improve tracking of units that are enabled for restart by
clr-service-restart, add a new config file `service_restart`. It lists
one or more unit names (with full path), one unit per line. The %install
section is updated accordingly.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2019-07-01 21:33:09 -07:00
Brett T. Warden 0ec8e42f4f Update test for commit c296fa2f35
Updating expected dev package definition to accomodate:
    make -dev packages require: the main package
    so that installing -dev gives you a functional component
2019-04-09 19:10:47 -07:00
William Douglas 0ddb695cfb Add custom extras subpackage support
Enable package builders to create custom extras subpackages (suffixed
by -extras). This enables content to be divided more exactly than just
the current extras subpackage support and also allows users to specify
requirements on other subpackages in the package. It is not intended
to replace extras usage as this feature should be used sparingly where
content really must be specificly placed.
2019-03-22 13:03:40 -07:00
Patrick McCarty 31a0e11d59 tests: fix test_specfile and test_test targets
Some unit tests were failing due to some config options not being
initialized. The issues are not seen when run with 'coverage' (as with
'make unittests').

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2018-11-07 11:22:36 -08:00
Thiago Macieira 0e4b531ad8 Make the main package depend on this build's subpackages
Commit cf9f5e5394 did that for each of
the sub-packages, but we forgot to do the same for the main package.

Signed-off-by: Thiago Macieira <thiago.macieira@intel.com>
2018-09-25 12:24:12 -07:00
Thiago Macieira cf9f5e5394 Make sub-packages require/provide exact versions
I'm seeing at least one package that weirdly causes an old version to
get installed by dnf, causing file conflicts later.
2018-09-11 15:46:53 -07:00
Brett T. Warden a3589e1a70 tests: add leading slash to test filenames
Tests for the %files section use bare file names. Since rpmbuild
requires leading slashes anyway, adding slashes to some of the tests.

Adding new tests for filenames with white space and/or rpm directives.

Signed-off-by: Brett T. Warden <brett.t.warden@intel.com>
2017-10-19 14:05:39 -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 c3231eaed5 Remove unchangeable default_grp from specfiles
Since default_group in specdescription is never modified, remove it as a
class member from the Specfiles class and just write the default.
2017-07-07 15:10:48 -07:00
William Douglas eab12f1589 Add support for manual requires
This patch allows users to specify requires_add and requires_ban to
augment the automatic runtime requirement handling.

As part of this change, the handling of python requires has been
modified so that they are managed under generic requires instead of
their own special mechanism. python requires detection was also improved
by adding install_requires section contents when the section is detected
in setup.py.

The primary change aside from python handling is to remove main_requires
handling in files.py and consolidate requires fully in buildreq.py.
2017-02-23 17:57:48 +00:00
Matthew Johnson 4dcb271dac Add unit tests for new Specfile class
Includes a rename of specfile.py -> specfiles.py for easier imports and
related change to how it imported in autospec.py. Also includes a minor
fix to how lang files are written to the specfile. The error was
identified by these unit tests.
2016-12-16 12:40:20 -08:00