Commit Graph

200 Commits

Author SHA1 Message Date
Matthew Johnson da28362ee9 Move large failed_commands dict to separate file
Simplify user additions to the failed_commands list by moving to a
separate file. Format for additions is <pattern>, <package>.
2016-11-28 10:28:04 -08:00
Matthew Johnson 7f1676b3f3 Update functional tests for skip_tests configuration
skip_test_suite functionality was restored recently. The tests now
reflect and test for this change
2016-11-28 09:46:08 -08:00
Arjan van de Ven da5829920b Restore skip_test_suite functionality
in the options cleanup, this one got lost.... put it back in
2016-11-26 18:28:14 +00:00
Alex Jaramillo afc68e9104 Adding dhcp dev public key 2016-11-21 22:36:48 +00:00
Alex Jaramillo 36988533a9 Supressing test print out
Package integrity verification print errors when
the verification fails ans some tests are meant
to test such behaviour, but the errors are
confusing. I'm adding buffer=True to test suite
to suppres prints to stdout from pkg_integrity
2016-11-21 22:36:10 +00:00
Icarus Sparry f4c5774f6f Work around missing soname fatal error
Some packages create shared libraries but do not pass flags to linkers
to record the names of the shared librares. Change a fatal error to a
warning and use the filename instead. Based on work by Ikey Doherty
<michael.i.doherty@intel.com>

Signed-off-by: Icarus Sparry <icarus.w.sparry@intel.com>
2016-11-21 12:48:14 -08:00
Matthew Johnson ec1f99b49d Remove downloaded archives at beginning of run
Archives are downloaded then moved to /tmp/<user>/<tarball_prefix>/
If this directory is not removed before an autospec run and a user runs
autospec on the same package twice in a row, the build will fail due to
the archives existing in the same location the new archives are
attempting to be moved to. This directory needs to be removed before an
autospec run to prevent this.
2016-11-21 12:25:32 -08:00
Matthew Johnson 82144ad634 Update c-helloworld test with unformatted config
Add an unformatted and incomplete options.conf to the c-helloworld
functional test to insure a correct file is generated.
2016-11-21 11:09:34 -08:00
Matthew Johnson 813af2efbc Rewrite options configuration file on autospec run
options.conf may exist in a package directory in a format different from
the format defined in config.py due to an out-of-date autospec or
user-creation of the configuration file. Rewriting the file on each run
updates the configuration file to the common format without requiring
manual editing by the user.

Consequently, this also allows the user to provide a partial
configuration file without defining every option required. The
configuration file will be rewritten with all available options and
associated comments. Previously missing options will be added as false
values.
2016-11-21 11:09:34 -08:00
Alex Jaramillo c0ed2656fc Adding public keys to keyring
Adding a set of keys after running verification in
1380 packages that are part of koji git repo as of
Nov 2nd 2016
2016-11-19 00:16:48 +00:00
Alex Jaramillo 6d92759a74 Use check function instead of from_url
The check function in pkg_integrity will look for
a signature (or sha256 if a gem) inside the folder
where a package is processed
2016-11-19 00:16:05 +00:00
Matthew Johnson 5f9d3a381f Add comments to the options.conf file
Adding comments makes the configuration file self-documenting and
increases usability, which was the entire purpose of this file in the
first place.
2016-11-18 14:36:18 -08:00
William Douglas 5691e620cb Rework golang support
The support for golang in autospec was previously installing packages
into the GOROOT causing failures when go get was run on packages already
in the GOROOT.

This patch moves the install location to /usr/lib/golang-dist which
should be added to the GOPATH when building a go package.

The autospec support still does not allow for building go and instead
just handles adding library installation at this time. It also requires
manual configuration for the go source path and build pattern.
2016-11-18 19:23:23 +00:00
Matthew Johnson 86ca6986a4 Create test results directory if it does not exist
If the test results directory does not exist, create it. At the
beginning of the test run, remove the previous test's fail log.
2016-11-18 10:12:22 -08:00
Arjan van de Ven 4280d2035c reset cflags for avx2 after one time use 2016-11-18 17:06:04 +00:00
Matthew Johnson d9b574322b Update functional test to reflect recent cmake change
Recent commit d9928f (fix cmake) adds cmake-dev as a build requirement
when cmake is used. Add cmake-dev to the specfile for the libjpeg-turbo
test as libjpeg-turbo uses cmake.
2016-11-17 16:52:56 -08:00
Matthew Johnson 114cfed15c Add test package with various options enabled
The test package, c-helloworld-opts, sets several options using the
deprecated method of creating various empty configuration files. The
tests then verify that the correct configuration is detected and added
to the options.conf file.

Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
2016-11-17 16:38:46 -08:00
Matthew Johnson 039228e5af Enable testing for correct configuration file generation
Functional tests now check the generated configuration file against a
user-defined expected configuration file called conf-expectations. The
check is done identically to how the spec-expectations file is checked.

Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
2016-11-17 16:38:46 -08:00
Matthew Johnson 362655584e Move boolean configurations into single file
Remove "file exists" type configuration options and replace with an
automatically generated single configuration file. This makes the
autospec configuration easier to understand for the autospec user by
setting a boolean configuration option in a standard file.

Autospec will create this configuration file if it does not exist and
remove the deprecated configuration files, as well as removing them from
git tracking.

Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
2016-11-17 16:38:46 -08:00
Alex Jaramillo 214b71f406 Merge branch 'master' of kojiclear.jf.intel.com:projects/autospec 2016-11-18 00:31:17 +00:00
Alex Jaramillo 6b18347dd1 Adding package integrity file check first
Integrity check originally looked for a signature file
in 'package_URL + .asc', however this patterns is not
that common therefore I'm adding a way to check
locally for a signature file before attempting to find
a signature at 'package_URL + .asc'
2016-11-17 19:44:56 +00:00
Arjan van de Ven d9928fd7e3 fix cmake 2016-11-17 16:43:23 +00:00
Alex Jaramillo 3c1dd1f388 Merging 2016-11-17 00:33:36 +00:00
Alex Jaramillo d56b7189a5 Changing module name
Signature verification was extended to do hash
validation for ruby gems, so integrity validation
is a better description of module. The module
was changed from verify_sign to pkg_integrity
2016-11-16 18:33:28 +00:00
Matthew Johnson cc1449c2ee Only try to substitute the urlban if it is defined
If urlban is not defined (by a configuration file, for instance), do not
try to remove it from a url. This was causing autospec failures when
urlban was not defined. This also removes the autospec.conf dependency
from the functional tests.

Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
2016-11-16 09:45:29 -08:00
Matthew Johnson 388149e12f Make autospec pep8 clean
Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
2016-11-16 09:14:53 -08:00
Arjan van de Ven 0c3a137cfb move cmake files to -dev 2016-11-16 14:13:23 +00:00
Alex Jaramillo ebb56b4b16 Adding more tests to verify_sign
Added one testcase for GEM validation and one test
to cover condition when package does not have a
matching signature.
2016-11-15 22:29:57 +00:00
Alex Jaramillo c75d929713 Removing gpgme dependency
After fighting python-gnupg and gnupg I decided to
use neither, both have missing features that are
required for what I'm trying to do.  I'm using a
wrapper for command line instead (for now). I will
revisit my decision if things change, but for now
a wrapper for command line is enough.
2016-11-15 22:25:05 +00:00
Matthew Johnson 0b30e86a93 Add large package (libjpeg-turbo) for testing
Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
2016-11-14 20:39:48 -08:00
Matthew Johnson d9802344b3 Add py-helloworld source to test
Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
2016-11-14 20:39:48 -08:00
Matthew Johnson bd2f1405bb Add simple c-helloworld source for tests
Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
2016-11-14 20:39:48 -08:00
Matthew Johnson 3a44ea720f Add basic functional test framework to Autospec
Add test framework and basic tests to Autospec to allow testing of
packages. The tests can be run by invoking `python3 test_autospec.py`

The tests first create a tarball of each source directory within the
testfiles directory and runs autospec against it. Each package is
handled in its own thread, so the total time of the tests is equivalent
to the total time of the longest autospec run.

Once the build is complete, the output of `make autospec` and the
command resulting spec file are searched for terms defined by in a
special file within the test source directories. The special file is
expectations.py and within this file the following terms can be
defined:

- buildreqs (list of strings) - build requirements expected to be
detected by autospec.

- license (string) - name of the license to be detected by autospec.

- output_strings (list of strings) - strings expected to be in the
output of `make autospec`.

- specfile (string) - this string is read in from the spec-expectations
file, which contains the exact text of the specfile expected to be
generated from the autospec run.

The file expectations.py is not included in the tarball created in the
first step of the test process.

There is an additional directory 'autospecdir' within the test package
that contains the configuration files used by an autospec run.

Test results are printed at the end of an autospec run on a package. If
the generated specfile differs from spec-expectations, a diff is
displayed along with the failure.

tarball.py is also updated to remove only the specific tarball that was
downloaded. This allows the tests to be run in parallel without the
"downloaded" tarball being erased by subsequent autospec runs.

Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
2016-11-14 20:39:48 -08:00
Alex Jaramillo 95566d0e82 Adding missing file 2016-11-15 00:51:32 +00:00
Alex Jaramillo 960614e15a Small refactoring and more tests 2016-11-15 00:44:36 +00:00
Alex Jaramillo 3f194a5c1c Adding unittests for verify sign 2016-11-15 00:43:45 +00:00
Alex Jaramillo 2fd7c3fb1b Cleaning PEP8 errors 2016-11-14 22:17:00 +00:00
Alex Jaramillo 24f6af2c49 Adding more gpg pub keys 2016-11-14 22:13:32 +00:00
Alex Jaramillo dbd6d49676 Implemented GEM sha256 verification 2016-11-14 22:12:41 +00:00
William Douglas 7f2234549b Rework autostart implementation
This change prevents the possibility of enabled systemd unit files not
being put into the autostart subpackage by just matching all files in
the system *.target.wants subdirectories. The autostart config file has
thus been reworked to instead be a no_autostart file that controls if
the autostart subpackage is included by the main package or not.
2016-11-14 17:21:08 +00:00
William Douglas 21f0cdc050 Add autostart subpackage
This change allows packages to have an autostart subpackage that is
included by default as one of the main package's dependencies. It is
intended to replace an informal use of the extras subpackage which
previously handled having a separation between systemd unit activation
files and the main package.

To make use of this feature, a packager will likely create the
target.wants folder for the systemd unit and create the symlink to the
systemd unit in make_install_append and add the full path to the
unit file symlink in the autostart file (as described in the
README.rst).
2016-11-14 16:31:08 +00:00
William Douglas ad613ee5a8 Add support for zip files with hashes
When zip files contain hash information it is displayed in the header
causing failure to detect the zip file prefix. This change adds minimal
zip file header detection in order to determine which line contains the
first compressed file to find the prefix.

An example of the unzip -l output that had previously been the only
correctly handled type is:

Archive:  wsgiref-0.1.2.zip
  Length      Date    Time    Name
---------  ---------- -----   ----
      589  06-11-2006 23:49   wsgiref-0.1.2/PKG-INFO
      239  06-07-2006 13:13   wsgiref-0.1.2/README.txt
       51  06-07-2006 13:10   wsgiref-0.1.2/setup.cfg
      581  06-11-2006 23:48   wsgiref-0.1.2/setup.py
    17925  06-11-2006 23:18   wsgiref-0.1.2/test_wsgiref.py
    27441  06-09-2006 11:54   wsgiref-0.1.2/docs/libwsgiref.tex
     2295  06-09-2006 12:01   wsgiref-0.1.2/docs/ref.tex
      614  07-09-2005 00:29   wsgiref-0.1.2/ez_setup/README.txt
     7661  06-09-2006 14:43   wsgiref-0.1.2/ez_setup/__init__.py
    15596  06-11-2006 23:44   wsgiref-0.1.2/wsgiref/handlers.py
     5916  06-11-2006 23:43   wsgiref-0.1.2/wsgiref/headers.py
     4789  06-11-2006 23:43   wsgiref-0.1.2/wsgiref/simple_server.py
     5598  06-11-2006 23:44   wsgiref-0.1.2/wsgiref/util.py
    14737  06-11-2006 23:42   wsgiref-0.1.2/wsgiref/validate.py
      586  06-05-2006 13:45   wsgiref-0.1.2/wsgiref/__init__.py
      589  06-11-2006 23:49   wsgiref-0.1.2/wsgiref.egg-info/PKG-INFO
      343  06-11-2006 23:49   wsgiref-0.1.2/wsgiref.egg-info/SOURCES.txt
        8  06-11-2006 23:49   wsgiref-0.1.2/wsgiref.egg-info/top_level.txt
---------                     -------
   105558                     18 files

The first line after the header:

      589  06-11-2006 23:49   wsgiref-0.1.2/PKG-INFO

is on the 4th line of the output in this case unlike the output where a
checksum is embedded in the zip file:

Archive:  msr-tools-1.3.zip
d9a630da8b626196737d29dff697bfda405de93e
  Length      Date    Time    Name
---------  ---------- -----   ----
        0  09-10-2013 02:49   msr-tools-master/
      231  09-10-2013 02:49   msr-tools-master/MAKEDEV-cpuid-msr
      977  09-10-2013 02:49   msr-tools-master/Makefile
     4383  09-10-2013 02:49   msr-tools-master/cpuid.c
     7645  09-10-2013 02:49   msr-tools-master/rdmsr.c
      102  09-10-2013 02:49   msr-tools-master/version.h
     3756  09-10-2013 02:49   msr-tools-master/wrmsr.c
---------                     -------
    17094                     7 files

In this case the first line after the header:

        0  09-10-2013 02:49   msr-tools-master/

is on the 5th line of the output causing the header separation line to
be erroneously used to get the prefix.

In addition, refactor the code into a function since the unzip logic was
used in multiple places already.
2016-11-14 16:31:08 +00:00
Arjan van de Ven d215064b44 2 more patters for autodetection
(yes this bypasses review process, but we should treat these
additions as trivial)
2016-11-13 17:56:51 +00:00
Matthew Johnson 036d85dac8 Add optimize_size to git adds
This patch adds the optimize_size configuration file to the list of git
adds that are performed at the end of an autospec run.

Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
2016-11-11 13:47:55 -08:00
Gabriel Briones Sayeg 581681ee2a Adding failing patterns for building samba
Signed-off-by: Gabriel Briones Sayeg <gabriel.briones.sayeg@intel.com>
2016-11-11 14:51:51 -06:00
Alex Jaramillo 2b74a0e7de Making changes to verification to add more types and obtaining keyid fro different types 2016-11-09 00:46:34 +00:00
Auke Kok c1b93c7865 Escape tarball name before passing it as part of a regex.
Any regex special character will make this part blow up, so
we must escape it first before passing it here.
2016-11-08 09:22:26 -08:00
Alex Jaramillo 5d27bf83cd Change logic to improve maintainability 2016-11-04 18:37:31 +00:00
Alex Jaramillo 79e606dee6 Adding key verification 2016-11-02 21:13:55 +00:00
Alex Jaramillo d38f33991b Renaming dir to _dir. dir is a python built in function 2016-11-02 16:08:15 +00:00