45 Commits

Author SHA1 Message Date
Patrick McCarty
11e0b5baee Add new commands for installing rpms on the running system
For testing purposes only, if developers want to install RPMs they just
built onto their development system, potentially overwriting content
that is tracked by swupd, they can now run 'make install-local' to
install all of the RPMs, or 'make install-debuginfo-local' to just
install the debuginfo package.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2018-10-10 13:09:20 -07:00
Patrick McCarty
012a1a3767 Support pre-checks for autospec and autospecnew too
For some commands, it is useful to be able to add custom prerequisites.
We already support this for `make koji` and `make build`, and there was
just a request to add it for `make autospec` and `make autospecnew`.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2018-09-21 12:12:23 -07:00
Thiago Macieira
f59a650cf4 Also delete the rpms/ subdir when making proper
Autospec has begun putting the files there.

Signed-off-by: Thiago Macieira <thiago.macieira@intel.com>
2018-09-05 16:29:59 -07:00
Patrick McCarty
852b6e83c9 Refresh SPDX license list to latest (version 3.2)
Make the SPDX puller code more robust by reading from JSON sources
rather than parsing HTML. Also, keep all deprecated license identifiers
for now, since they are still present in the spdx list.

Four identifiers were removed since the last refresh, but we are keeping
them for backwards compatibility. The removed license IDs now reside in
the licenses-extra file. At

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2018-08-29 17:19:34 -07:00
Brett T. Warden
5bc6cc856b Error on specfile and upstreams only when missing
Previously, we always emitted an error and failed when the specfile or
upstream target was requested, breaking the -B switch. Now, we only fail
if the file doesn't actually exist, not just that it was requested via
make.
2018-08-07 09:03:54 -07:00
Patrick McCarty
3739bc0e0f repoadd: use new rpms directory, and hardlink instead
Since binary RPMs are now stored in the "rpms" directory, follow a
similar method for storing them in the local repo, too.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2018-08-01 09:38:27 -07:00
Patrick McCarty
f43a186a78 Store copies of binary RPMs in "rpms" dir
To improve visibility of which RPMs a user may want to install after a
build, copy (hardlink) them to a separate "rpms" directory.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2018-08-01 09:38:27 -07:00
Patrick McCarty
da562cb750 Always clean rpms and logs from previous builds
I often find myself running "make clean proper", when by default, I
think the old build artifacts should be removed so that the results
directory is pristine at the start of a new build.

As a result, if users wish to keep all build artifacts from a previous
"make build" or "make autospec", they must keep manual backups, as the
tooling no longer keeps them around.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2018-08-01 09:38:27 -07:00
Patrick McCarty
16467cfbc0 Avoid appending to srpm logs
Mock will append the binary rpm build logs to the srpm logs, but this is
confusing. After the srpm finishes building, rename the log files to
avoid this behavior.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2018-08-01 09:38:27 -07:00
Patrick McCarty
16466cac02 Make results/ directory un-nested again
Because Mock dumps its logs and and resulting rpms in the same directory
(results), shuffling the logs and rpms only after a successful build is
confusing, since they will be untouched for the error case.

It's simpler to avoid moving the files entirely. The only exceptions
will be to avoid clobbering existing log files. Changes of this nature
will appear in later commits and in autospec.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2018-08-01 09:38:27 -07:00
Brett T. Warden
a70cf49f45 Include Makefile.custom from package repo 2018-07-24 15:42:12 -07:00
Patrick McCarty
768bdc7550 Ignore mv failure when debuginfo package is missing
Fixes #6

Not all Clear Linux packages have debuginfo subpackages, so ignore
errors when attempting to move them to the results/debuginfo/ directory.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2018-07-02 16:48:08 -07:00
Patrick McCarty
2d8fc9a155 koji: exit early if spec has uncommitted changes
When running 'make koji', the tooling will attempt to create a new git
tag with a name constructed from the spec file's NVR.

However, if there are uncommitted changes to the Name, Version, or
Release fields (collectively, NVR) in that file, the new tag's name will
not match the NVR in the spec file referenced by commit HEAD.

Protect against the mismatch by exiting early from a 'make koji' if any
spec file modifications are not yet committed to the repo, and alert the
user what the problem is.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2018-06-27 17:46:25 -07:00
Patrick McCarty
1eadce9aad Fix 'make repoadd'
The debuginfo RPMs are stored in a separate directory now, so the rpm
copy pipeline needed a slight adjustment.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2018-06-27 14:48:52 -07:00
Tudor Marcu
6613644b9c Update folder structure in results/
The logs, srpms, and debuginfo should all be split into their own
directory, so it is less confusing about which RPMs can be used when
creating mixes. They are mainly for extra metadata, and should not be
left in the main RPM results location.

Signed-off-by: Tudor Marcu <tudor.marcu@intel.com>
2018-06-27 14:04:12 -07:00
Patrick McCarty
4910ef0882 koji: only pull --rebase if remote is initialized
After running 'make autospecnew', the freshly created repo only exists locally,
so the repo remote is not yet initialized. The 'git pull --rebase' (via 'make
koji') will then fail due to the uninitialized remote. Improve this case by
only rebasing when the remote is initialized.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2018-05-14 11:49:26 -07:00
Leandro Dorileo
51dc7a7c24 autospec: use MOCK_OPTS
Also make autospec use MOCK_OPTS to pass down arbitrary mock options.

Signed-off-by: Leandro Dorileo <leandro.maciel.dorileo@intel.com>
2018-05-10 15:48:26 -07:00
George T Kramer
c8848dbdb2 Allow additional curl options for fetching sources
The DOWNLOAD_MIRROR server, the SOURCES_URL server, and upstream
source tarballs may be hosted in many different environments.
Allow users to supply additional curl options via a config to use
whenever connecting to the DOWNLOAD_MIRROR and SOURCES_URL servers and
work better with their particular hosting environment.  Because upstream
source tarballs can come from many different locations, do not offer a
global config and instead allow users to define this manually as needed
when the rule is used.

Signed-off-by: George T Kramer <george.t.kramer@intel.com>
2018-05-10 15:22:57 -07:00
Leandro Dorileo
92e045116a mock: add MOCK_OPTS
Eventually developers - when they know what they're doing - want to
manipulate a little bit the mock arguments to i.e skip a few stages
in the mock build cycle while they're hacking a package.

One example is when developers are testing changes to a spec file but
not touching dependencies and they're [re]running the build multiple times
it would be nice to not cleanup before the build and run a rebuild
for example with: --rebuild --no-clean

With this patch one should only do:

make build MOCK_OPTS="--rebuild --no-clean"

Signed-off-by: Leandro Dorileo <leandro.maciel.dorileo@intel.com>
2018-05-10 14:56:22 -07:00
Patrick McCarty
932c2236a7 generateupstream: fix upstream file handling
My previous change to handling of the 'upstream' file assumed that the
file exists already, but this need not be true.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2018-04-24 10:12:34 -07:00
Patrick McCarty
6c92ce3160 sources: download files directly if SOURCES_URL undefined
When SOURCES_URL is not defined, the current behavior of extracting
source files from SRPMs in the latest published Clear Linux release has
proven to not work so well: It is not optimal when users are adding new
packages, modifying existing packages, not building from latest master,
etc.

Instead, run 'generateupstream' automatically so that source files are
downloaded from the remote locations listed in the spec file. This
target creates the 'upstream' file too, which becomes useful if the user
later defines SOURCES_URL, when 'upstream' is actively consumed.

In the event that download errors occur, as a fallback mechanism, try to
find the corresponding SRPM from a published release of Clear Linux OS.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2018-04-23 16:07:33 -07:00
Patrick McCarty
3e2219c07e sources: move srpm fetch code to separate target
I will reusing this code (largely unmodified) in the next commit, so
move it into a separate target to easily inspect changes.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2018-04-23 16:07:33 -07:00
Patrick McCarty
f0d2523151 sources/generateupstream: properly handle curl errors
If any of the curl commands fail, it's better for the entire target to
fail. In this way, developers will be properly notified.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2018-04-23 14:25:51 -07:00
Patrick McCarty
de39e64e29 Fix some indentation issues
Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2018-04-23 14:15:58 -07:00
Patrick McCarty
877fee6375 sources: follow SOURCES_URL redirects; remove noproxy requirement
The curl --no-proxy hint is not needed anymore, since Clear Linux OS has
an autoproxy, and curl will honor proxy environment variables.

Also, pass -L to curl to follow redirects, similarly to other curl calls
in this makefile.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2018-04-23 13:47:24 -07:00
Patrick McCarty
e921a2a883 generateupstream: make URL extraction more robust
Improve the detection of source URLs by matching only non-commented
Source* lines with "://" present.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2018-04-23 13:30:21 -07:00
Patrick McCarty
8ff80b0be2 Sync options for 'autospec' and 'autospecnew' commands
Over time, the autospec options used for 'autospec' and 'autospecnew'
commands have diverged. They are meant to be in sync, so do that here,
and format the recipe in a way that eases future changes.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2018-03-26 14:12:38 -07:00
Patrick McCarty
05634010e9 Disable recipe echo and set -x for 'pullrebase'
The echo commands at key points of the pullrebase should be sufficient
for users to know what action pullrebase performed.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2018-03-23 16:42:20 -07:00
Patrick McCarty
f6442a0e7f Improve behavior of 'make autospec' for new repos
If a new package repo is created with make autospecnew, and then make
autospec is run immediately afterward, a git fetch is performed, but
the remote repo is not likely to exist yet.

Address this issue by only running the git fetch if the remote origin is
initialized locally via a git push, git pull, etc.

In addition to properly supporting the workflow described above, this
change also enables developers to build packages that are *not* intended
to be included in Clear Linux OS, thus not destined to appear in the
'packages' file. Package repos of this nature might have different,
manually configured remotes, or the remote may never be initialized at
all if builds are only run locally.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2018-03-23 11:59:56 -07:00
Patrick McCarty
cc6e70bb29 Enable local repo notice for autospec commands
Similar to how a notice is printed for 'make build', enable the same
notice for 'make autospec' and 'make autospecnew'.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2018-03-08 14:01:48 -08:00
Patrick McCarty
f3989c0d5a Enable local repo support for autospec
Local repo support was recently added for 'make build', so do the same
for 'make autospec' and 'make autospecnew'.

Note that to make mock invocations work at both package-level and
toplevel, I am resolving MOCK_CONFIG_VAL with the realpath function.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2018-03-07 16:36:41 -08:00
Patrick McCarty
f697b227e8 Rename Makefile.functions to Makefile.shared
The name "shared" makes more sense at this point, since the makefile
does not contain only functions, and it is meant to be shared between
Makefile.common and Makefile.toplevel.

Also, reorder the makefile includes, since Makefile.shared should be
able to use variables defined in Makefile.config.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2018-03-07 16:00:24 -08:00
Patrick McCarty
128799fa02 local repo: unhide local repo conf files
To make sure the conf files are more visible in the local repo
directory, unhide them by installing them without a leading dot
character.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2018-03-06 16:56:47 -08:00
Patrick McCarty
ad77e695dc local repo: instantiate repo after creating the directory
DNF seems to ignore an uninitialized repo, but Yum does not. To fix,
make sure to run createrepo immediately after creating the local repo
directory.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2018-03-06 16:56:47 -08:00
Patrick McCarty
8bf6c59e96 Enable local repo support for 'make build'
With this change, 'make build' will automatically use the local repo, if
enabled. A notice is printed in case the user didn't want to use the
local repo and wishes to disable it with 'make repodisable'.

Another functional change here is that 'make build' will use the in-tree
mock config (clear.cfg) instead of the /etc/mock/clear.cfg. If this
behavior is not desired, then MOCK_CONF can be modified in
Makefile.config, or overridden by a Makefile.config.site_local.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2018-03-06 16:56:47 -08:00
Patrick McCarty
ac3f1898f6 local repo: forcibly remove RPMs from the local dir
In case the user runs 'make repoclean' followed by 'make repoadd' in a
package repo dir, 'rm' will complain. Add the -f option to silence those
warnings.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2018-03-06 16:56:47 -08:00
Patrick McCarty
e3b1adedd8 local repo: add 'repostatus' command
This new command displays a helpful summary of what packages exist in
the local RPM repo and whether it is enabled for Yum/DNF, Mock, or both.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2018-03-06 16:56:47 -08:00
Patrick McCarty
ab142ead38 local repo: run createrepo after 'repodel' removes RPMs
To ensure that RPM repo metadata is always up-to-date for the local
repo, make sure createrepo is run after removing the RPMs.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2018-03-06 16:56:47 -08:00
Patrick McCarty
a9982b4064 local repo: add Mock support and enable/disable commands
An interface for a local RPM repository already exists, so extend it by
adding Mock support and the ability to enable and disable the
repository, at package level and at toplevel.

Integration for commands that use Mock will be added in separate
commits.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2018-03-06 16:56:47 -08:00
Patrick McCarty
1cc337d5fa Fix support for ARCHIVES in autospec rules
PKG_NAME and URL were properly supported, but ARCHIVES needed to be
written back to the package repo makefile.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2018-01-16 13:22:57 -08:00
Patrick McCarty
a3f2351225 Adopt strict policy for koji submissions
Because there have been very few situations in the past requiring a
"make koji" from a branch other than master, add a strict check that the
active local branch is "master". This also blocks submissions from a
"detached" state, which was previously permitted.

Also, fix and consolidate the git push commands into one. Now that the
branch check is implemented, the "master" refspec can be used, and
explicitly push *one* tag (the tag created immediately before the push).
The --follow-tags and --tags options don't have the intended effect, so
omit them.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2018-01-12 14:43:19 -08:00
Leandro Dorileo
e0a2933bce Introduce pre build and koji targets
These are targets to be executed before build and koji targets. They
are meant to execute security and validation checks.

Signed-off-by: Leandro Dorileo <leandro.maciel.dorileo@intel.com>
2018-01-10 12:57:33 -08:00
Icarus Sparry
56b23370bd Remove an extra layer of shell
As pointed out by Kai, I can avoid one level of shell wrapping. Mock
is already running this via "/bin/sh -c" (function doshell in
/usr/lib/python2.7/site-packages/mockbuild/util.py currently).

Signed-off-by: Icarus Sparry <icarus.w.sparry@intel.com>
2017-12-24 12:47:13 -08:00
Icarus Sparry
f99b2de07e Add rootshell target and change shell to be unprivileged
Change the "make shell" command to invoke a shell as the "mockbuild"
user and starting in ~mockbuild. This is typically what you want when
you enter the build environment.

Add a new target, "rootshell", which gives the old behavior, a root
shell starting at /.

Signed-off-by: Icarus Sparry <icarus.w.sparry@intel.com>
2017-12-23 14:40:53 -08:00
Patrick McCarty
c18abdb9db Initial import
Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2017-12-22 22:51:05 -08:00