10 Commits

Author SHA1 Message Date
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
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
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
Matthew Johnson
02c63d802c Record imported public key in commit message
When the user chooses to import a public key during the autospec run
display information on that key in the commit message.

Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
2018-01-18 15:20:30 -08:00
Gabi Beyer
c68e877bd2 Fix unittests that use mock_open
with the imlpementation of the write_out functionality,
some unittests need to be changed to use that fuction.

Signed-off-by: Gabi Beyer <gabrielle.n.beyer@intel.com>
2017-08-31 12:44:04 -07:00
Matthew Johnson
8384daf05e Use secure temporary directory instead of public
Autospec previously used an unsecure public temporary directory as its
working directory. This patch creates a secure temporary directory only
accessible by the creating user ID.
2017-03-09 11:55:58 -08:00
Matthew Johnson
bd8702e7dc Add a unit test for commitmessage.scan_for_changes
The scan_for_changes was moved from docs.py to commitmessage.py, this
patch adds a commitmessage test for scan_for_changes.
2017-02-16 15:36:28 -08:00
Matthew Johnson
192ee3570d Add unit tests for commitmessage module 2017-02-16 15:35:35 -08:00