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>
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>
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>
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>
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>
Improve the detection of source URLs by matching only non-commented
Source* lines with "://" present.
Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>