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>
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>
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>
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>
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>
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)
- 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>
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.
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.
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>
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.
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>
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.