Commit Graph

1000 Commits

Author SHA1 Message Date
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
Brett T. Warden 1580da9cec Use tarball basename for setup dir
When the downloaded tarball/zip has no top level directory, use the
file's basename as the directory to have %setup create and extract it
into.
2019-10-10 13:16:02 -07:00
Brett T. Warden a9bcb61413 Make up subdirs when zips don't have them
When a source package/zip/tarball doesn't have a top-level directory,
make one up based on the package name and version, and use the -c
argument to %setup to make rpmbuild create the dir and extract into it.

This comes into play in two places -- the initial scan by autospec in a
tmpdir for license files and build patterns, and later by rpmbuild.
2019-10-10 13:16:02 -07:00
Brett T. Warden b75aeb7fc9 Attempt to handle multiple primary source tarballs
Starting point to handle building multiple versions of a package in a
single package. Reads new 'sources' file to map version numbers to
source URLs, to *supplement* $URL in Makefile.
2019-10-10 13:16:02 -07:00
Brett T. Warden 4919d87ea9 Reworking build_unzip() to handle prefixless files
Significant rewrite, trying to make it more robust and dependable.
More reliably parses the output from unzip -l.
Looks for the longest common directory prefix of all files in the zip.
If it doesn't find that, picks the zip file's basename as the prefix,
and extends the extract_cmd to create and unpack into that subdir.
2019-10-10 13:16:02 -07:00
Athenas Jimenez 77917b9854 maven pattern: Improve xml reading for version and groupId tags
Adding a if/else statement to avoid duplicity when reading version or
goupId tags (i.e. 3.2.03.2.0) from pom files.

Signed-off-by: Athenas Jimenez <athenas.jimenez.gonzalez@intel.com>
2019-10-03 11:37:27 -07:00
Patrick McCarty d66d66ec7c Add new domain field to options.conf
This field's purpose is to classify a package according to a "domain",
useful for tooling that wraps autospec to operate on any/all packages
that belong to the domain.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2019-10-02 16:25:36 -07:00
Athenas Jimenez 86b3e96d54 maven pattern: Improve the resolution for fail patterns
Adding the resolution for "parent" or "pom" artifacts when a
corresponding jar doesn't exists.

Signed-off-by: Athenas Jimenez <athenas.jimenez.gonzalez@intel.com>
2019-10-02 14:35:04 -07:00
William Douglas 5542cbb9a9 Don't try and call non-existent function
make_prepend is implemented a bit differently and is actually just
handled as part of write_make_line. Probably should be updated at some
point but for now just remove the function calls to a non-existent
function.
2019-10-02 12:59:57 -07:00
Geoffroy Van Cutsem ed22e7ab5d README.rst: add missing options to the documentation
A few options available to configure the flags and optimization are missing from
the documentation (README.rst). This patch adds them.

Also fix a typo in the code

Signed-off-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
2019-10-01 10:37:05 -07:00
Thiago Macieira 0647022768 Introduce "build_append" and fix missing write_xxx_{prepend,append}
Turns out there's a difference between build_append and install_prepend:
since they run from different shell scripts, environment variables set
at the beginning of %build will not be set in the snippets added by
install_prepend. Notably, that includes CFLAGS and SOURCE_DATE_EPOCH.

Signed-off-by: Thiago Macieira <thiago.macieira@intel.com>
2019-09-30 12:33:08 -07:00
Auke Kok f06967ee0d Add nginx ecosystem autospec for nginx modules.
This adds the capacity for autospec to autopackage nginx dynamic modules
out of tree using the out-of-tree headers and build files that nginx-mainline
has. This will make it easy to package a large ecosystem of nginx modules
automatically.
2019-09-26 11:31:36 -07:00
Brett T. Warden d9e439b813 Make m2 repo copy more robust
In case /builddir/.m2 already exists, make sure we're copying explicitly
into that directory, not underneath it.
2019-09-19 15:46:15 -07:00
Brett T. Warden 0f05575e07 Make more mvn dep matches generate mvn() virtual req
Change the matching for "Could not find ..." to produce a virtual mvn()
dependency with version, instead of generating a mvn-* package name.
This should be more accurate now, taking advantage of the new virtual
provides.
2019-09-19 15:46:15 -07:00
Brett T. Warden 35561d3a3f Make mvn dependency detection skip spaces
Resolves mistakenly matching this line:
Could not resolve all files for configuration ':buildSrc:runtimeClasspath'.
to generate virtual dependency:
mvn(all files for configuration ':buildSrc:jar) = runtimeClasspath
2019-09-19 15:46:15 -07:00
Brett T. Warden a7780ec2d0 Apply our maven local repo to more files
Apply it to all .gradle and .gradle.kts files
2019-09-19 15:46:15 -07:00
Brett T. Warden 14c862a273 Remove gradle build and install goals
It's unclear how dependable "build" and "install" are as gradle goals,
so don't force their use. Packager will need to specify them manually
in make_args and make_install_args.
2019-09-19 15:46:15 -07:00