Commit Graph

1016 Commits

Author SHA1 Message Date
Auke Kok d97ae540fb Allow patch files as archives (for manual patching). 2019-11-14 13:59:15 -08:00
Auke Kok 7bb8ae643c Add info subrpms.
Tested on `autoconf` - succesfully moved all -doc files to a new
-info subrpm.
2019-11-14 13:41:48 -08:00
Auke Kok bd6af6901e Dissallow bare 'Domain' License word. 2019-11-14 13:40:53 -08:00
William Douglas 1489b2776b Purge python2 support from autospec 2019-11-14 12:59:43 -08:00
Patrick McCarty 2c7671ad45 Enable container-based Action/Workflow for testing CI
This commit sets up an in-tree, container-based Github Action and
associated workflow for running `make check` and `make unittests` within
a Clear Linux OS Docker container.

The most appropriate bundles to install in the container to satisfy all
test dependencies are `python-extras` (includes `python3-basic` bundle
and the `flake8` tool) and `package-builder` (includes `make`, and the
`pycurl` package).

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2019-11-13 17:55:59 -08:00
Patrick McCarty 51f7a324c6 build: pass --mock-opts value for second mock call
Any additional options specified by --mock-opts were only being passed
to mock for the source RPM build, but they should be passed along for
the binary RPM build as well.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2019-11-11 15:02:42 -08:00
Patrick McCarty 274de4d028 build: use lists to define mock invocations
The two mock invocations are becoming lengthy, and it's difficult to
spot problems with these calls due to the way in which they are written.

For better maintainability, use formatted string literals, and define
all mock command line arguments in a list. We can then convert the list
to a string with space-separated arguments and pass it to util.call().

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2019-11-11 15:02:42 -08:00
Patrick McCarty e283a7f24f Fix unit test failure
Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2019-11-11 15:02:42 -08:00
Patrick McCarty 8350cc172b Fix version "1" fallback handling
When no version is detected from the URL, autospec sets the version to
1, but it needs to be a string, "1", instead, because str.lower() is
later called on it in convert_version().

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2019-11-11 11:23:04 -08:00
William Douglas c9e7cb6104 make python test be version agnostic
Prevents needing autospec changes and reautospec to handle python
version upgrades.
2019-11-07 15:35:42 -08:00
Brett T. Warden d190e5269c Make Perl builds honor make_install_args
Appends the contents of make_install_args to the 'make pure_install' or
'Build install' commands in the %install section for Perl packages.
2019-11-06 13:02:24 -08:00
Juro Bystricky 09b4775704 download.py: increase curl timeout to 600 seconds
Avoid errors such as:
"Unable to fetch xxx: (28, 'Operation timed out after 29401 milliseconds with 94355456 out of 244671436 bytes received')"

30 seconds may not be enough to download a large file
even with a fast connection or a smaller file with a slower
connection.

Signed-off-by: Juro Bystricky <juro.bystricky@intel.com>
2019-11-06 10:52:58 -08:00
William Douglas 80a7039581 Add new glew failed pattern 2019-11-05 12:19:06 -08:00
Brett T. Warden 58320e9f06 Add more characters to Perl module name matching
Perl modules can also contain underscores and digits in their names.
Extend the pattern matching to make sure we don't miss anything.
Previously, we missed this one:

 #     Error:  Can't locate PerlIO/utf8_strict.pm in @INC (you may need to install the PerlIO::utf8_strict module)
2019-10-30 17:07:22 -07:00
Patrick McCarty d404a9d25a Add several unit tests to cover R description parsing
Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2019-10-30 12:41:32 -07:00
Patrick McCarty 1a21d8596e Expand the R description parsing function docstring
Add examples and more clarification on the function's intended purpose.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2019-10-30 12:41:32 -07:00
Patrick McCarty 2e014238df Fix R description parsing for last field in the file
Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2019-10-30 12:41:32 -07:00
Patrick McCarty a87515e7fa Support LinkingTo keyword in DESCRIPTION
If present, LinkingTo packages should also be added as runtime/buildtime
dependencies.

Fixes https://github.com/clearlinux/autospec/issues/508

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2019-10-30 12:41:32 -07:00
Patrick McCarty 194604f670 Fix multiple bugs with DESCRIPTION file parsing
- Fix parsing when keywords are immediately followed by newlines.

- Strip any leading/trailing commas and whitespace from the values
  (which are comma-separated lists).

- If a keyword is present but has no value, do not return the empty
  string.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2019-10-30 12:41:32 -07:00
Brett T. Warden f7b4b48888 Rework archives handling
Support archive files that don't include a top-level directory by making
one up. Also quit using %setup for archives since it causes interesting
side effects in %build that aren't really applicable for archives.
2019-10-28 13:43:26 -07:00
Brett T. Warden 3357591b49 Move Perl content to -perl subpackage
Also make the subpackage depend on the parent package. This should close
the loop between top-level Requires on perl() virtuals and Provides on
perl() virtuals in the subpackage.
2019-10-24 13:00:59 -07:00
Brett T. Warden ff67390845 Catch perl module checks from configure scripts
Catches e.g.:
checking for perl module Test::More 0.87... no
2019-10-21 10:02:29 -07:00
Patrick McCarty f02ea3daa7 Install /usr/lib/perl5 content to -data
Because implicit requires of '/usr/bin/perl' exist for many packages,
perl-bin will be installed as a build dependency, but not the perl
package's modules; the modules currently live in the base package, and
-bin does not require that package.

The easiest solution for now is to ship the modules in -data, since -bin
requires -data. So, add a files pattern to ship all content matching
/usr/lib/perl5 in -data.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2019-10-17 11:47:15 -07: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
Simental Magana, Marcos 16b225cdd7 failed_commands: Add pattern for libuv
This handles looking at logs failing when asking for LIBUV (e.g: cmake:
-- Could NOT find LIBUV (missing: LIBUV_LIBRARIES LIBUV_INCLUDE_DIR)
)

Signed-off-by: Simental Magana, Marcos <marcos.simental.magana@intel.com>
2019-10-16 07:43:22 -07:00
Simental Magana, Marcos 6482d4eb09 meson_pattern: remove explicit install_append call
the install_append function is executed implicit from the
write_buildpattern function, so no need to generate duplicated
install_append instructions.

Fixes https://github.com/clearlinux/autospec/issues/500

Signed-off-by: Simental Magana, Marcos <marcos.simental.magana@intel.com>
2019-10-15 07:00:36 -07:00
Brett T. Warden 2a8c372711 Update prefixes dict if we rewrite URL
package URL is the key for the prefixes dict, so if we rewrite the URL,
we should make sure we have a corresponding entry in prefixes.
2019-10-14 15:52:46 -07:00
William Douglas 82da87e573 Improve gnome signature file acquisition 2019-10-11 11:29:06 -07:00
Brett T. Warden ae1f863f1e Fix detection of autoconf patches
A change for multi-version support, specifically to ensure that all
versions are scanned for licenses, broke the procedure that detects
whether to re-execute autoconf when patches affect input files. This
shifts the license scanning change into a more specific location to
leave the original autoconf scanning intact.
2019-10-11 09:44:28 -07:00
Mi, Dapeng1 f8fe6848e5 add LDFLAGS for PGO enabled spec file
Signed-off-by: Mi, Dapeng1 <dapeng1.mi@intel.com>
2019-10-10 16:25:59 -07:00
Brett T. Warden 51fe6f6c6f Limit rewrites of options.conf
When scanning available patches, if any are cve-related, we set the
security_sensitive parameter in options.conf. Since we now scan for
patches in potentially several series files, use a flag to track whether
to update the parameter and only write it once, after scanning all the
patches.
2019-10-10 13:16:02 -07:00
Brett T. Warden a558b43701 Name installed license files by hash
Instead of creating a long, complex name for license files, just name
them by their SHA1 hash and store them in a package-level directory
(/usr/share/package-licenses/<package>/

This will eliminate redundant license files within an individual
package.

This change also tweaks the license file search to ensure that we pick
up files from all source versions.
2019-10-10 13:16:02 -07:00
Brett T. Warden 7c527e2e4f Use absolute path when installing license files
If we build multiple versions, we'll potentially enter %install while in
a different dir than the license file(s) we already found. Use the
absolute path instead. This resolves the case where we fail to install a
license file because it came from a different version of the source than
the one we built last.

Also, when trimming the build dir off the front of the path to the
license file, be careful to always trim off only leading slashes, not
just blindly the first character, as we don't force subdir to *not* have
a trailing slash itself. This prevents a case where we fail to copy the
license because we ate the first character of its relative path.
2019-10-10 13:16:02 -07:00
Brett T. Warden 80ed3f7c1d Don't retain made-up archive prefixes
If we try to use a source file (zip or jar) that doesn't have a
first-level common prefix directory in it, we have to make one up and
create a build subdirectory. We need to remember what that directory is.
In subsequent autospec rounds, however, we need to remember whether we
made up that prefix, so we can do it again (%setup -c). This change
adds another list to keep track of all of the build directories,
separate from the list of *detected* prefixes.
2019-10-10 13:16:02 -07:00
Brett T. Warden 568f406f22 Commit version-specific patch series files
For version-specific patch series files, e.g. series.1.7, make sure to
'git add' them if the version exists in this build, or 'git rm' if it no
longer does.
2019-10-10 13:16:02 -07:00
Brett T. Warden c424891324 Move build_append/prepend inside versions loops
For builds supporting multi-version (maven, ant, gradle), move
build_append and build_prepend into the version loops, so the contents
will be added per version, inside each version's respective build
directory.

For gradle, this also means moving build_append inside the optional
subdir.
2019-10-10 13:16:02 -07:00
Brett T. Warden cda145e605 Add multi-version install to gradle and maven
For gradle and maven installation functions, iterate through all build
versions. install_prepend and install_append will only apply once,
though.
2019-10-10 13:16:02 -07:00
Brett T. Warden f46dc7a869 Only install /usr/share/java/*/lib for gradle
For gradle packages, instead of installing everything in
/usr/share/java/<package>, only install the lib subdirectory. If more
contents are actually needed, rely in install_append to handle those.
2019-10-10 13:16:02 -07:00
Brett T. Warden 974f02ca89 Run build command per version for ant/maven/gradle
For ant, maven, and gradle build patterns, iterate through each unpacked
source directory and execute the build command there.
2019-10-10 13:16:02 -07:00
Brett T. Warden 5fb24b7e7a Enable security_sensitive for CVE version patches
Just like for regular patches, if we find a CVE patch in
version-specific series files, enable security_sensitive.

This adds some inefficiency in that we'll potentially rewrite
options.conf multiple times unnecessarily.
2019-10-10 13:16:02 -07:00
Brett T. Warden f14db3c954 Handle version-specific patch series
Process all the series.<ver> files, adding Patch: fields for their
patches (duplicates ok, will not be merged).
Captures any prefixes we've generated for build dirs.
Enters each build dir and adds the appropriate %patch directives.

Patches from the top-level series file will be applied to the default
version. Patches from a version-specific series file matching that
version will be applied afterward.

Still need to notice and flag any CVE patches.
2019-10-10 13:16:02 -07:00
Brett T. Warden 1afbc27f11 Rework versions file parsing and generation
Make sure we only parse the file once -- have to cache the parsed
result.
We'll keep that result by itself, but other tasks (e.g.
tarball.process()) will result in adding to the global versions list, so
we need to make sure we don't overwrite it. Instead, we'll merge the
parsed list into the global versions list.
2019-10-10 13:16:02 -07:00
Brett T. Warden 7610810790 Fixing issues from code review
Detect and report extraneous fields in versions file
Remove extra check for header lines in zip file info after we've already
removed the header
Only consider directory names when looking for common prefix, which
would affect us if we had a zip file with only a single file.
2019-10-10 13:16:02 -07:00
Brett T. Warden 90ca404f7a Write %setup calls for each tarball
This introduces a lot of similar, but not quite duplicate, code.
Definitely a candidate for future refactoring.

Passes the flags to %setup to:
1) *not* re-unpack the default (SOURCE0) archive
2) create the directory if the archive doesn't have a top-level prefix
3) unpack the indexed source
4) Use the provided directory name (either the detected prefix, or if
   none, the basename of the archive file

This should handle extra versions in the order they're defined in the
versions file.
2019-10-10 13:16:02 -07:00
Brett T. Warden a39355e989 Add extra version tarballs to upstream file 2019-10-10 13:16:02 -07:00
Brett T. Warden aa470c5c22 Create SourceX fields for extra version tarballs 2019-10-10 13:16:02 -07:00
Brett T. Warden 65a3eb72ce Fix linter issues 2019-10-10 13:16:02 -07:00
Brett T. Warden bdf2e237c1 Handle zip listings without a footer
At least in unit tests, zip listings do not have a footer. Scan the
contents to look for a footer before trying to remove it.
2019-10-10 13:16:02 -07:00
Brett T. Warden 9df74e7dde Handle single-version packages
Don't incur the multi-version support if there's only a single version
listed in the versions file -- otherwise we could end up adding a
version when we meant to simply upgrade a package.
2019-10-10 13:16:02 -07:00
Brett T. Warden 2d9f9b84c0 Add optional URL field to versions file
versions file previously only contained a newline-separated list of
version numbers. Now each version can optionally be followed by an
arbitrary amount of whitespace, followed by a URL for the source archive
for that version. The file will be written back out in the same order,
but whitespace between the version field and URL field, if any, will be
a single tab character.
2019-10-10 13:16:02 -07:00