13 Commits

Author SHA1 Message Date
Patrick McCarty
d2d8b886bd Restrict query to spec sections above %files
In Clear Linux OS, all package spec files define their header fields
(and other required sections, like %description) above the first %files
section. Restricting the `rpmspec` queries to sections of %files speeds
up the command significantly, most notably for `texlive`, which has the
largest spec file.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2020-12-14 04:01:31 +00:00
Patrick McCarty
b924031ba6 Use parameterized function for most rpmspec commands
The `rpmspec` commands usually specify the same flags aside from the
queryformat and the spec file(s) to query.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2020-12-14 03:49:30 +00:00
Patrick McCarty
59a46563cf Add some input validation for local repo handling
The local repo implementation makes some assumptions about the contents
of the package manager and mock conf files, so do some basic input
validation to assess whether the assumptions are correct, and exit with
informative errors if not.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2020-05-18 14:18:46 -07:00
Patrick McCarty
a198b2d0a0 Make local repo support more parallel safe
For commands that modify contents of $(TOPLVL)/repo, wrap them with
`flock`, using a lock file `repo.lock` within the repo directory. This
ensures that the repo directory tree is not otherwise modified while
each command is running.

To keep the implementation simple, I opted to not wrap entire makefile
targets with a lock (e.g. lock the entire operation of `make repoadd`).
If users need that level of control, they can implement locking in a
separate wrapper script.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2020-05-18 13:55:19 -07:00
Patrick McCarty
ea568f6239 Support cloning of pre-existing package repos
Over the lifetime of Clear Linux OS, many packages have been added and
removed, but the package *repos* always remain once they have been
created.

Thus, if a package is removed at one point, and later added back to the
distro, the same package repo should be used. This commit adds support
to `make autospecnew` for that use case, always using a pre-existing
package repo if one is available.

(Note that the gitolite repo detection is more complicated because it
must support configurations with and without "wild repos" enabled.)

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2020-04-22 10:45:34 -07:00
Patrick McCarty
450e84f809 Set priority=1 for local repo
The RPMs from repo `localrepo` should have priority over RPMs from the
main repo, so set `priority=1` for it.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2020-01-08 17:18:19 -08:00
Patrick McCarty
fd509a2295 Hardlink only the rpms created by Mock
In case git repos cloned by autospec into results/ contain RPMs, we do
not want to hardlink those files to rpms/.

Fix the issue by limiting the find depth to 1 level so that the tooling
only hardlinks rpms created by Mock.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2018-08-08 19:14:19 -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
de39e64e29 Fix some indentation issues
Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2018-04-23 14:15:58 -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