Compare commits

..

86 Commits

Author SHA1 Message Date
clrbuilder 6a7fac08d9 Update packages file for version 22060
Signed-off-by: clrbuilder <clrbuilder@intel.com>
2018-04-24 19:02:11 +00: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
clrbuilder e00c76846b Update packages file for version 22010
Signed-off-by: clrbuilder <clrbuilder@intel.com>
2018-04-20 18:32:15 +00:00
clrbuilder af2c0bea72 Update packages file for version 21970
Signed-off-by: clrbuilder <clrbuilder@intel.com>
2018-04-18 19:02:08 +00:00
clrbuilder b99b7e8c25 Update packages file for version 21960
Signed-off-by: clrbuilder <clrbuilder@intel.com>
2018-04-18 12:47:49 +00:00
clrbuilder 359d2a8379 Update packages file for version 21860
Signed-off-by: clrbuilder <clrbuilder@intel.com>
2018-04-16 02:52:02 +00:00
clrbuilder d828f3a3ce Update packages file for version 21850
Signed-off-by: clrbuilder <clrbuilder@intel.com>
2018-04-14 20:29:27 +00:00
clrbuilder 330876d190 Update packages file for version 21830
Signed-off-by: clrbuilder <clrbuilder@intel.com>
2018-04-13 13:01:54 +00:00
Patrick McCarty 3bf5f39687 Revert "autospecnew: master branch should track origin/master"
The 'git branch' command fails at this stage because the master branch
is not initialized locally, but because the remote is also not
initialized, additional special incantations are needed to make this
work. Revert it for now so that users do not see an error message from
the 'git branch' command. A proper fix will follow later.

This reverts commit 71d9699bdd.
2018-04-12 18:05:45 -07:00
Patrick McCarty 71d9699bdd autospecnew: master branch should track origin/master
Because 'make koji' expects that master should track origin/master,
initialize the tracking branch during the autospecnew.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2018-04-12 17:46:01 -07:00
clrbuilder ded920ccb3 Update packages file for version 21810
Signed-off-by: clrbuilder <clrbuilder@intel.com>
2018-04-12 13:01:47 +00:00
clrbuilder cc16065a09 Update packages file for version 21790
Signed-off-by: clrbuilder <clrbuilder@intel.com>
2018-04-11 13:01:37 +00:00
clrbuilder 45f2185a25 Update packages file for version 21780
Signed-off-by: clrbuilder <clrbuilder@intel.com>
2018-04-10 19:05:07 +00:00
clrbuilder 9ffc0b9640 Update packages file for version 21770
Signed-off-by: clrbuilder <clrbuilder@intel.com>
2018-04-10 13:03:01 +00:00
clrbuilder 98c5937801 Update packages file for version 21760
Signed-off-by: clrbuilder <clrbuilder@intel.com>
2018-04-09 20:56:43 +00:00
clrbuilder a50450212c Update packages file for version 21720
Signed-off-by: clrbuilder <clrbuilder@intel.com>
2018-04-08 13:28:18 +00:00
clrbuilder ab77a99a47 Update packages file for version 21710
Signed-off-by: clrbuilder <clrbuilder@intel.com>
2018-04-07 17:41:19 +00:00
clrbuilder 090bb77f92 Update packages file for version 21690
Signed-off-by: clrbuilder <clrbuilder@intel.com>
2018-04-06 15:50:48 +00:00
clrbuilder f2b7a30d12 Update packages file for version 21670
Signed-off-by: clrbuilder <clrbuilder@intel.com>
2018-04-05 13:07:37 +00:00
clrbuilder c26e27ce65 Update packages file for version 21640
Signed-off-by: clrbuilder <clrbuilder@intel.com>
2018-04-03 20:07:19 +00:00
clrbuilder 6fa010e10b Update packages file for version 21610
Signed-off-by: clrbuilder <clrbuilder@intel.com>
2018-04-03 13:25:42 +00:00
clrbuilder 173673b5c6 Update packages file for version 21600
Signed-off-by: clrbuilder <clrbuilder@intel.com>
2018-04-02 19:07:05 +00:00
clrbuilder eea34ccd7f Update packages file for version 21590
Signed-off-by: clrbuilder <clrbuilder@intel.com>
2018-04-02 13:49:46 +00:00
clrbuilder fa58b00fb7 Update packages file for version 21580
Signed-off-by: clrbuilder <clrbuilder@intel.com>
2018-03-30 19:24:39 +00:00
Patrick McCarty cd9b9c1319 user-setup: remove suggestion to run 'newgrp kvm'
If you run `newgrp kvm` after the user-setup script completes, and then
proceed to run `make build`, `make autospec`, etc. within a package
repo, mock will fail because it tries to `groupadd mockbuild` in the
package chroot with the wrong group ID. Logging out and logging back in
results in correct behavior, so leave that as the sole recommendation.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2018-03-29 10:52:16 -07:00
Patrick McCarty d22e4f985d Minor style fix in Makefile.toplevel
In my previous commit, one of the changed lines used a combination of
tabs and spaces, but it should have used tabs only.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2018-03-28 22:19:37 -07:00
clrbuilder eb58950c17 Update packages file for version 21540
Signed-off-by: clrbuilder <clrbuilder@intel.com>
2018-03-28 16:51:30 +00: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
clrbuilder d6250a68cd Update packages file for version 21500
Signed-off-by: clrbuilder <david.j.klimesh@intel.com>
2018-03-23 06:01:38 -07:00
clrbuilder a0208a0509 Update packages file for version 21490
Signed-off-by: clrbuilder <david.j.klimesh@intel.com>
2018-03-22 12:48:08 -07:00
clrbuilder 7ff122463b Update packages file for version 21480
Signed-off-by: clrbuilder <david.j.klimesh@intel.com>
2018-03-22 07:16:18 -07:00
clrbuilder 08498361a4 Update packages file for version 21470
Signed-off-by: clrbuilder <david.j.klimesh@intel.com>
2018-03-22 06:01:51 -07:00
clrbuilder 1b8c8d250d Update packages file for version 21440
Signed-off-by: clrbuilder <david.j.klimesh@intel.com>
2018-03-20 12:03:00 -07:00
clrbuilder 4eccb104d5 Update packages file for version 21420
Signed-off-by: clrbuilder <david.j.klimesh@intel.com>
2018-03-19 12:04:45 -07:00
clrbuilder 4ac2b829d3 Update packages file for version 21410
Signed-off-by: clrbuilder <david.j.klimesh@intel.com>
2018-03-19 06:51:50 -07:00
clrbuilder 052fa48e83 Update packages file for version 21400
Signed-off-by: clrbuilder <david.j.klimesh@intel.com>
2018-03-16 15:00:30 -07:00
clrbuilder 382ed28176 Update packages file for version 21390
Signed-off-by: clrbuilder <david.j.klimesh@intel.com>
2018-03-16 08:16:43 -07:00
Patrick McCarty e695db8c80 Fix 'make pull' to honor the autospec pushurl
A 'make clone' sets the proper git pushurl for autospec, but a
subsequent 'make pull' does not honor override. Fix by adding a special
condition for 'make pull'.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2018-03-14 17:30:10 -07:00
clrbuilder f12e7e48ea Update packages file for version 21340
Signed-off-by: clrbuilder <david.j.klimesh@intel.com>
2018-03-14 12:01:52 -07:00
clrbuilder f269683632 Update packages file for version 21310
Signed-off-by: clrbuilder <david.j.klimesh@intel.com>
2018-03-13 15:52:23 -07:00
clrbuilder a2c4413083 Update packages file for version 21220
Signed-off-by: clrbuilder <david.j.klimesh@intel.com>
2018-03-08 17:29:54 -08: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
clrbuilder 01e548b268 Update packages file for version 21180
Signed-off-by: clrbuilder <david.j.klimesh@intel.com>
2018-03-07 12:02:02 -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 905b1d1c06 local repo: add toplevel 'repoclean' command
In case the user wants to remove all RPMs from the local repo, they can
now run 'make repoclean' at toplevel.

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
clrbuilder 9f8869fdff Update packages file for version 21150
Signed-off-by: clrbuilder <david.j.klimesh@intel.com>
2018-03-06 06:01:44 -08:00
Patrick McCarty 9892e87aec autospecnew: never clone the remote repo
With the assumption that developers will be keeping up-to-date by
running 'make pull; make clone', trying to clone the remote repo here is
not necessary.

If the package git repo already exists locally, no action is taken.
Otherwise, create a local package git repo, and then run autospec.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2018-02-26 13:34:52 -08:00
clrbuilder 100ad5965e Update packages file for version 20920
Signed-off-by: clrbuilder <david.j.klimesh@intel.com>
2018-02-22 12:01:34 -08:00
clrbuilder 61db58c057 Update packages file for version 20910
Signed-off-by: clrbuilder <david.j.klimesh@intel.com>
2018-02-22 06:01:30 -08:00
clrbuilder abe044ee0c Update packages file for version 20890
Signed-off-by: clrbuilder <david.j.klimesh@intel.com>
2018-02-21 06:01:43 -08:00
clrbuilder 8997c889f8 Update packages file for version 20870
Signed-off-by: clrbuilder <david.j.klimesh@intel.com>
2018-02-20 06:28:36 -08:00
clrbuilder f2dd86b50c Update packages file for version 20850
Signed-off-by: clrbuilder <david.j.klimesh@intel.com>
2018-02-16 13:38:18 -08:00
clrbuilder fa6fa080d6 Update packages file for version 20840
Signed-off-by: clrbuilder <david.j.klimesh@intel.com>
2018-02-16 06:01:40 -08:00
clrbuilder a20775675d Update packages file for version 20830
Signed-off-by: clrbuilder <david.j.klimesh@intel.com>
2018-02-15 13:06:50 -08:00
clrbuilder 9dfe2ba937 Update packages file for version 20820
Signed-off-by: clrbuilder <david.j.klimesh@intel.com>
2018-02-15 07:51:46 -08:00
clrbuilder 744cf78eb1 Update packages file for version 20810
Signed-off-by: clrbuilder <david.j.klimesh@intel.com>
2018-02-14 21:51:54 -08:00
clrbuilder 97e7ab937a Update packages file for version 20790
Signed-off-by: clrbuilder <david.j.klimesh@intel.com>
2018-02-14 06:43:32 -08:00
clrbuilder 4fb96cadcc Update packages file for version 20780
Signed-off-by: clrbuilder <david.j.klimesh@intel.com>
2018-02-13 15:08:36 -08:00
clrbuilder 670a01fc25 Update packages file for version 20770
Signed-off-by: clrbuilder <david.j.klimesh@intel.com>
2018-02-13 10:59:59 -08:00
Leandro Dorileo 728e6ea221 make clean: show what's going on
Intead of waiting forever, show the user the package we're cleaning.

Signed-off-by: Leandro Dorileo <leandro.maciel.dorileo@intel.com>
2018-02-12 18:49:24 -08:00
Leandro Dorileo 240653c41d give status target a better output
Improve the output for "make status" by displaying only relevant
status parts (avoiding the git warning and instructions output).

Also make sure we don't run git status "non git package folders"
(i.e packages/common).

Signed-off-by: Leandro Dorileo <leandro.maciel.dorileo@intel.com>
2018-02-12 18:49:21 -08:00
clrbuilder 6935953ee7 Update packages file for version 20760
Signed-off-by: clrbuilder <david.j.klimesh@intel.com>
2018-02-12 11:46:31 -08:00
clrbuilder f210130e38 Update packages file for version 20730
Signed-off-by: clrbuilder <david.j.klimesh@intel.com>
2018-02-08 16:53:40 -08:00
Patrick McCarty 8df7f9dd6b Update autospec.conf template
Expand the autospec.conf template to document missing options. Also,
autospec just gained the ability to understand relative paths for these
two options, so document this too.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2018-02-06 13:23:41 -08:00
clrbuilder c424e9cd89 Update packages file for version 20700
Signed-off-by: clrbuilder <david.j.klimesh@intel.com>
2018-02-06 05:45:22 -08:00
Patrick McCarty c247096be4 Provide an example for running user-setup.sh
The README was not very clear on how to actually download the script and
run it, so provide an example.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2018-02-05 13:14:36 -08:00
clrbuilder 42e2edaf6b Update packages file for version 20690
Signed-off-by: clrbuilder <david.j.klimesh@intel.com>
2018-02-05 09:37:54 -08:00
William Douglas 5c4004f6d8 Update mock clear.cfg to use dnf 2018-02-02 04:17:10 +00:00
clrbuilder 374f9dd581 Update packages file for version 20600
Signed-off-by: clrbuilder <david.j.klimesh@intel.com>
2018-01-30 06:00:59 -08:00
clrbuilder 68c06960c9 Update packages file for version 20580
Signed-off-by: clrbuilder <david.j.klimesh@intel.com>
2018-01-29 06:00:57 -08:00
9 changed files with 773 additions and 75 deletions
+112 -52
View File
@@ -4,8 +4,8 @@ all: build
TOPLVL = ../..
include $(TOPLVL)/projects/common/Makefile.functions
include $(TOPLVL)/projects/common/Makefile.config
include $(TOPLVL)/projects/common/Makefile.shared
SHELL = /bin/bash
@@ -19,7 +19,9 @@ RPMS ?= $(LATEST_RPMS)
WITH_SUDO = $(shell cmp /usr/bin/mock /usr/sbin/mock &> /dev/null && echo sudo )
MOCK ?= $(WITH_SUDO) /usr/bin/mock -r clear
# MOCK_CONFIG_VAL is set in Makefile.shared
MOCK ?= $(WITH_SUDO) /usr/bin/mock -r $(MOCK_CONFIG_VAL)
ifneq ($(wildcard upstream),)
__allsources := $(notdir $(strip $(shell cat upstream)))
@@ -113,21 +115,29 @@ shell:
# Always rebuild the source rpm
.PHONY: $(SRPMFILE)
$(SRPMFILE): $(SPECFILE) $(__allsources)
$(SRPMFILE): $(SPECFILE) $(__allsources) localreponotice
@$(MAKE) spdxcheck
$(MOCK) --buildsrpm --source=./ --spec=$(SPECFILE) --result=results/ --no-cleanup-after --uniqueext=$(PKG_NAME)
# Do a git fetch and a git rebase rather than a git pull so aborting
# the git pull at a password prompt doesn't leave local changes stashed
# Do the the git status dance so we only apply a stash we create
# Do a git fetch and a git rebase to apply local commits on top of latest
# commits from the remote. A git fetch/rebase is used rather than a git pull so
# aborting the git pull at a password prompt doesn't leave local changes
# stashed. Do the git status dance so we only apply a stash we create. Note
# that a fetch/rebase is not attempted if the remote 'origin' is not
# initialized locally, or if the remote contains no commits.
pullrebase:
if [ -z "$$SKIP_GIT" ] && [ -e .git ]; then \
set -x ; \
@if [ -z "$$SKIP_GIT" ] && [ -e .git ]; then \
if ! git rev-parse --verify --quiet origin/master > /dev/null; then \
echo "Remote not yet initialized. Continuing."; \
exit 0; \
fi; \
echo "Fetching origin"; \
git fetch; \
if ! git rev-parse --verify --quiet FETCH_HEAD > /dev/null; then \
echo "No commits exist in remote. Continuing."; \
exit 0; \
fi; \
echo "Rebasing to origin/master"; \
if git status --porcelain | grep -q '^.[^?]'; \
then \
git stash save; \
@@ -142,17 +152,23 @@ pullrebase:
#help already a specfile, it will be overwritten. Several files used by
#help autospec will be created in the process. For more information, see
#help the project at https://github.com/clearlinux/autospec
autospec: pullrebase
autospec: pullrebase localreponotice
rm -f results/*src.rpm
@if [ -e $(SPECFILE) ] && ! grep -q "# Generated by: autospec.py" $(SPECFILE) ; then \
echo "Specfile already exists and was not created by autospec.py! Aborting."; \
exit 1; \
fi
@printf 'PKG_NAME := %s\nURL = %s\nARCHIVES = %s\n\ninclude ../common/Makefile.common\n' $(PKG_NAME) '$(firstword $(value NEWURL) $(value URL))' '$(value ARCHIVES)' > Makefile
python3 $(TOPLVL)/projects/autospec/autospec/autospec.py -t . --integrity \
${NON_INTERACTIVE} --config "$(AUTOSPEC_CONF)" ${SKIP_GIT} \
$(firstword $(NEWURL) $(URL)) --name $(PKG_NAME) ${CLEANUP} \
$${SETVERSION:+ -v $${SETVERSION}} -a $(ARCHIVES)
python3 $(TOPLVL)/projects/autospec/autospec/autospec.py \
--target . \
--integrity \
--config "$(AUTOSPEC_CONF)" \
--name $(PKG_NAME) \
--archives $(ARCHIVES) \
--mock-config $(MOCK_CONFIG_VAL) \
$${SETVERSION:+ --version $${SETVERSION}} \
${NON_INTERACTIVE} ${SKIP_GIT} ${CLEANUP} \
$(firstword $(NEWURL) $(URL));
@$(MAKE) spdxcheck
@$(MAKE) checkblacklist
@if [ -e update_changelog.sh ] && [ -z "$$SKIP_GIT" ] ; then \
@@ -189,30 +205,12 @@ bumpnogit:
$(__missingsources): sources
#help sources: If SOURCES_URL is defined, download required upstream source
#help files from that location. Otherwise, try to extract source files from the
#help SRPM in the latest Clear Linux release, as specified by the LATEST_SRPMS
#help variable. This will run automatically, as a dependency. NOTE: A Koji
#help server can make use of this "make sources" command, since it lives in a
#help repo named "common". If you use this makefile in Koji, ensure
#help "make sources" continues to work for both remote and local builds, since
#help it is a prerequisite of several commands for building packages.
sources: upstream
ifneq ($(strip $(SOURCES_URL)),)
while read u; do \
case "$$u" in \
"") continue ;; \
*://*) n="$$u" ;; \
*) n="$(SOURCES_URL)/$$u" ;; \
esac; \
curl --fail --noproxy "*" "$$n" -o `basename "$$n"`; \
done < upstream
else
@tmp=$$(mktemp -d -p "."); \
# First argument is a Clear Linux build number (e.g. 22000)
define fetch-from-srpm
tmp=$$(mktemp -d -p "."); \
srpm=$$(rpmspec --srpm -q --qf "%{NVR}.src.rpm\n" $(SPECFILE)); \
if cd "$$tmp" && ! curl -f -L -O $(LATEST_SRPMS)/$$srpm; then \
echo "Failed to download $$srpm from latest Clear Linux release." >&2; \
echo "Run \"git pull\" and try again." >&2; \
if cd "$$tmp" && ! curl -s -S -f -L -O $(DOWNLOAD_MIRROR)/releases/$(1)/clear/source/SRPMS/$$srpm; then \
echo "Failed to download $$srpm from Clear Linux release $(1)." >&2; \
cd .. && rm -rf "$$tmp"; \
exit 1; \
fi; \
@@ -220,14 +218,58 @@ else
cd ..; \
srclist=$$(rpmspec --srpm -q --qf "[%{SOURCE}\n]" $(SPECFILE)); \
for s in $$srclist; do \
if ! mv "$$tmp"/$$s .; then \
if ! mv --no-clobber "$$tmp"/$$s .; then \
echo "Missing source file \"$$s\" in $${srpm}." >&2; \
rm -rf "$$tmp"; \
exit 1; \
fi; \
echo "Retrieved source file $$s ..."; \
done; \
rm -rf "$$tmp";
rm -rf "$$tmp"
endef
#help sources: If SOURCES_URL is defined, download required upstream source files
#help from that location. Otherwise, try to download source files according to the
#help URLs listed in the spec file. If any of the source files fail to download,
#help check for the relevant SRPM from published releases of Clear Linux OS, and
#help extract the files if found. Note that SRPMs are taken from the DOWNLOAD_MIRROR
#help location. This will run automatically, as a dependency. NOTE: A Koji server can
#help make use of this "make sources" command, since it lives in a repo named
#help "common". If you use this makefile in Koji, ensure "make sources" continues to
#help work for both remote and local builds, since it is a prerequisite of several
#help commands for building packages.
ifneq ($(strip $(SOURCES_URL)),)
sources: upstream
while read u; do \
case "$$u" in \
"") continue ;; \
*://*) n="$$u" ;; \
*) n="$(SOURCES_URL)/$$u" ;; \
esac; \
if ! curl --fail -L "$$n" -o `basename "$$n"`; then \
echo "Failed to download $$n"; \
exit 1; \
fi; \
done < upstream
else
sources:
@$(MAKE) generateupstream; \
[ $$? -eq 0 ] && exit 0; \
nvr="$$(rpmspec --srpm -q --qf '%{NAME}\t%{VERSION}\t%{RELEASE}\n' $(SPECFILE))"; \
latest_builds=$$(git -C $(TOPLVL)/projects/common tag -l | sort -rn); \
for b in $$latest_builds; do \
url="$(DOWNLOAD_MIRROR)/releases/$$b/clear/source/package-sources"; \
echo "Checking for source files in build $$b ..."; \
if grep -q "$$nvr" <(curl -s -f -L $$url); then \
$(call fetch-from-srpm,$$b); \
if [ $$? -eq 0 ]; then \
echo "Source files retrieved from build $$b"; \
exit 0; \
fi; \
fi; \
done; \
echo "Source files not found for package"; \
exit 1
endif
prekoji-checks:
@@ -275,8 +317,11 @@ logcheck:
$(TOPLVL)/repo:
@echo "Creating local RPM repository $(TOPLVL)/repo"
mkdir $(TOPLVL)/repo
$(MAKE) localrepocreate
#help repoadd: Creates a local Yum repository in the $(TOPLVL)/repo directory.
#help repoadd: Adds locally-built RPMs for this package to the local RPM
#help repository. If this repository does not yet exist, it is created and
#help enabled.
repoadd: results/build.log $(TOPLVL)/repo
@if [ -z "`grep '^Wrote: .*$(shell basename $(SRPMFILE))$$' results/build.log`" ]; then \
echo "You have not yet succesfully built this release yet"; exit 1; \
@@ -285,17 +330,16 @@ repoadd: results/build.log $(TOPLVL)/repo
echo "Cleaning old rpms:"; \
for r in `cat .repo-index`; do \
echo "-$$r"; \
rm $(TOPLVL)/repo/$$r; \
rm -f $(TOPLVL)/repo/$$r; \
done; \
rm .repo-index; \
fi
for r in $(LATEST_RPMS); do echo "+$$r"; echo $$(basename $$r) >> .repo-index; cp $$r $(TOPLVL)/repo; done
( cd $(TOPLVL)/repo ; if type createrepo_c 1>/dev/null 2>&1; then createrepo_c .; else createrepo .; fi );
@cp $(TOPLVL)/projects/common/image-creator/yum.conf $(TOPLVL)/repo/.yum.conf
@printf "\n\n[local]\nname=Local\nfailovermethod=priority\nenabled=1\ngpgcheck=0\n" >> $(TOPLVL)/repo/.yum.conf
@printf "baseurl=file://$$(realpath $(TOPLVL))/repo/\n\n" >> $(TOPLVL)/repo/.yum.conf
$(MAKE) localrepocreate
$(call localrepoenable,${PM_CONF},${MOCK_CONF})
#help repodel: Removes package from local Yum repository.
#help repodel: Removes RPMs from the local RPM repository that were
#help previously added by 'make repoadd' for this package.
repodel:
@if [ -f .repo-index ]; then \
echo "Cleaning old rpms:"; \
@@ -304,8 +348,19 @@ repodel:
rm -f $(TOPLVL)/repo/$$r; \
done; \
rm .repo-index; \
$(MAKE) localrepocreate; \
fi
#help repoenable: Enables the local RPM repository for use with Yum/DNF and
#help Mock. If this repository does not yet exist, it is created.
repoenable: $(TOPLVL)/repo ; $(call localrepoenable,${PM_CONF},${MOCK_CONF})
#help repodisable: Disables the local RPM repository.
repodisable: localrepodisable ;
#help repostatus: Summarizes the local RPM repository status.
repostatus: localrepostatus ;
loop-up:
$(loopup)
@@ -336,15 +391,20 @@ install:
#help calculating their hashes. Autospec performs this step automatically, so ignore
#help it for packages managed with autospec.
generateupstream:
@rm -f upstream
@urls=$$(rpmspec -D '_vendor clr' -P $(SPECFILE) | grep Source | cut -d: -f2- | grep '://'); \
@[ -e upstream ] && mv upstream upstream.bak; \
urls=$$(rpmspec -D '_vendor clr' -P $(SPECFILE) | sed -n "s|^Source[0-9]*[[:blank:]]*:[[:blank:]]*\(..*://..*\)$$|\1|p"); \
for url in $$urls; do \
filename=$$(basename $$url); \
if [ ! -e $$filename ]; then \
curl --fail -L -O $$url; \
fi; \
echo $$(sha1sum $$filename | cut -d\ -f1)/$$filename >> upstream; \
filename=$$(basename $$url); \
if [ ! -e $$filename ]; then \
if ! curl --fail -L -O $$url; then \
echo "Failed to download $$url"; \
[ -e upstream.bak ] && mv --no-clobber upstream.bak upstream; \
exit 1; \
fi; \
fi; \
echo $$(sha1sum $$filename | cut -d\ -f1)/$$filename >> upstream; \
done
@rm -f upstream.bak
@cat upstream
#help drop-abandoned: Remove all unused patches from the git tree
+7
View File
@@ -54,6 +54,13 @@ AUTOSPEC_CONF = $(TOPLVL)/projects/common/autospec.conf
# in "pkg-mapping" for cloning/pulling package repos.
USE_PACKAGE_MAPPING = yes
# Package manager config file. Default to the in-tree copy.
PM_CONF = $(TOPLVL)/projects/common/image-creator/yum.conf
# Mock configuration file. Default to the in-tree copy.
MOCK_CONF = $(TOPLVL)/projects/common/koji-client-files/clear.cfg
# Include any site local configuration variables. These variables may override
# the definitions given above.
-include $(TOPLVL)/projects/common/Makefile.config.site_local
+78 -2
View File
@@ -14,9 +14,9 @@ define loopup
@sudo partprobe /dev/loop$(DEVICE)
@sleep 1
@if [ -e /dev/loop$(DEVICE)p3 ]; then \
sudo mount /dev/loop$(DEVICE)p3 $(TOPLVL)/image; \
sudo mount /dev/loop$(DEVICE)p3 $(TOPLVL)/image; \
else \
sudo mount /dev/loop$(DEVICE)p2 $(TOPLVL)/image; \
sudo mount /dev/loop$(DEVICE)p2 $(TOPLVL)/image; \
fi
@sudo mount /dev/loop$(DEVICE)p1 $(TOPLVL)/image/boot
endef
@@ -62,6 +62,82 @@ define remotepkgname
$(if $(USE_PACKAGE_MAPPING),$$(awk -v P="$(1)" '$$1 == P { res=$$2 } END { print res ? res : P }' $(TOPLVL)/projects/common/pkg-mapping),$(1))
endef
# Enables the local RPM repo by installing package manager and Mock configs.
# First argument is the path to the package manager config, and the second
# argument is the path to the mock config. Each of these config files is
# augmented for local repo support.
define localrepoenable
@cp $(1) $(TOPLVL)/repo/yum.conf
@printf "\n\n[local]\nname=Local\nfailovermethod=priority\nenabled=1\ngpgcheck=0\n" >> $(TOPLVL)/repo/yum.conf
@printf "baseurl=file://$$(realpath $(TOPLVL))/repo/\n\n" >> $(TOPLVL)/repo/yum.conf
@cp $(2) $(TOPLVL)/repo/clear.cfg
@printf "\n\n[localrepo]\nname=Local repo\nfailovermethod=priority\nenabled=1\ngpgcheck=0\n" >> $(TOPLVL)/repo/clear.cfg
@printf "baseurl=file://$$(realpath $(TOPLVL))/repo/\n\n" >> $(TOPLVL)/repo/clear.cfg
@sed -i '/^"""/d; $$a"""' $(TOPLVL)/repo/clear.cfg
endef
# Disables the local RPM repo by removing the installed package manager and
# Mock configuration files.
localrepodisable:
@rm -f $(TOPLVL)/repo/yum.conf
@rm -f $(TOPLVL)/repo/clear.cfg
# Runs createrepo_c (or createrepo) for the local RPM repo
localrepocreate:
( cd $(TOPLVL)/repo ; if type createrepo_c 1>/dev/null 2>&1; then createrepo_c .; else createrepo .; fi );
# Remove all RPMs from the local RPM repo
localrepoclean:
@find $(TOPLVL)/repo -maxdepth 1 -name '*.rpm' -delete
# Summarizes the local RPM repo status
localrepostatus:
@if [ ! -d $(TOPLVL)/repo ]; then \
echo '** Local repo not found'; \
exit 0; \
fi; \
if [ -f $(TOPLVL)/repo/yum.conf ]; then \
echo '** Local repo enabled for Yum/DNF.'; \
else \
echo '** Local repo not enabled for Yum/DNF.'; \
fi; \
if [ -f $(TOPLVL)/repo/clear.cfg ]; then \
echo '** Local repo enabled for Mock.'; \
else \
echo '** Local repo not enabled for Mock.'; \
fi; \
echo -n '** Local repo package list: '; \
( \
cd "$(TOPLVL)/repo"; \
LC_COLLATE="C"; \
shopt -s nullglob; \
set -- *.rpm; \
if [ -n "$$1" ]; then \
printf '\n'; printf '%q\n' "$$@"; \
else \
printf 'none found\n'; \
fi; \
)
# Detection of whether to use the local RPM repo occurs on-the-fly. Normally,
# variable definitions appear in Makefile.config, but these variables are not
# intended to be user-modifiable.
ifeq ($(wildcard $(TOPLVL)/repo/clear.cfg),)
MOCK_CONFIG_VAL = $(realpath $(MOCK_CONF))
else
MOCK_CONFIG_VAL = $(realpath $(TOPLVL)/repo/clear.cfg)
USE_LOCAL_REPO = 1
endif
localreponotice:
@if [ -n "${USE_LOCAL_REPO}" ]; then \
printf '\n\n** NOTICE: Using local repo for the build. Continuing after 3 seconds.\n'; \
printf '** If this is not desired, run `make repodisable`.\n'; \
printf '** The repo can be re-enabled later with `make repoenable`.\n'; \
printf '** Run `touch $(TOPLVL)/repo/opt-in-build` to prevent the 3 second delay.\n\n\n'; \
[ -f $(TOPLVL)/repo/opt-in-build ] || sleep 3; \
fi >&2
.PHONY: help
##### Code
# Make sure that HELPSPACE has exactly HELPLEN spaces in it
+45 -6
View File
@@ -4,8 +4,8 @@ all: clone
TOPLVL = .
include $(TOPLVL)/projects/common/Makefile.functions
include $(TOPLVL)/projects/common/Makefile.config
include $(TOPLVL)/projects/common/Makefile.shared
SHELL = /bin/bash
@@ -80,7 +80,11 @@ ${PULL_PKGS}:
fi ; \
git --no-pager log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit $$O..$$N; echo; \
fi ; \
$(call gitoliteurl,$$p); \
if [ "$$p" = "projects/autospec" ] ; then \
git remote set-url --push origin https://github.com/clearlinux/autospec.git; \
else \
$(call gitoliteurl,$$p); \
fi ; \
else \
echo "$$p: no such remote 'origin'"; \
fi ; \
@@ -148,6 +152,7 @@ proper: $(proper_PKGS)
.PHONY: $(proper_PKGS)
$(clean_PKGS):
@echo "cleaning $(patsubst clean_%,%,$@)"
-@$(MAKE) -s -j -C $(addprefix packages/,$(patsubst clean_%,%,$@)) clean
$(proper_PKGS):
@@ -157,7 +162,7 @@ $(proper_PKGS):
#help and unstaged files in addition to staged files.
status: $(PACKAGES_FILE) $(addprefix packages/,$(PKGS))
@for p in projects/common $(addprefix packages/,$(PKGS)); do \
(cd $$p ; git status | grep -q 'nothing to commit, working [^ ]* clean' || (echo "Uncommitted changes in $$p:"; git status)) ;\
if [ -d "$$p/.git" ] && [ -n "$$(git -C $$p status -uno --porcelain)" ]; then echo "Uncommitted changes in $$p:"; git -C "$$p" status --short; fi ;\
done
#help diff: Runs git diff for all package repos and displays the output using
@@ -187,22 +192,56 @@ provides:
#help autospecnew: Creates a new autospec package with for a given URL=$(URL)
#help with NAME=$(NAME). Several files used by autospec will be created in the
#help process. For more information about autospec, see the project page on Github https://github.com/clearlinux/autospec
autospecnew:
autospecnew: localreponotice
@if [ -z $(NAME) ] || [ -z $(URL) ]; then \
echo "Please specify NAME and URL. The ARCHIVES variable is optional."; \
exit 1; \
fi
@git clone $(PKG_BASE_URL)/$(NAME) $(TOPLVL)/packages/$(NAME) &> /dev/null || true
@if [ ! -d $(TOPLVL)/packages/$(NAME)/.git ]; then \
echo "no remote repository found, creating new package repository and running autospec"; \
mkdir -p $(TOPLVL)/packages/$(NAME); \
( \
cd $(TOPLVL)/packages/$(NAME); \
git init; \
git remote add origin $(PKG_BASE_URL)/$(NAME); \
$(call gitoliteurl,packages/$(NAME)); \
$(call subjectprefix,$(NAME)); \
); \
printf 'PKG_NAME := %s\nURL = %s\nARCHIVES = %s\n\ninclude ../common/Makefile.common\n' $(NAME) '$(value URL)' '$(value ARCHIVES)' > $(TOPLVL)/packages/$(NAME)/Makefile; \
python3 $(TOPLVL)/projects/autospec/autospec/autospec.py --integrity -t packages/$(NAME) --config $(AUTOSPEC_CONF) $(URL) --name $(NAME); \
python3 $(TOPLVL)/projects/autospec/autospec/autospec.py \
--target packages/$(NAME) \
--integrity \
--config "$(AUTOSPEC_CONF)" \
--name $(NAME) \
--archives $(ARCHIVES) \
--mock-config $(MOCK_CONFIG_VAL) \
$${SETVERSION:+ --version $${SETVERSION}} \
${NON_INTERACTIVE} ${SKIP_GIT} ${CLEANUP} \
$(URL); \
$(TOPLVL)/projects/common/checkblacklist.sh $(TOPLVL)/projects/common/blacklist $(TOPLVL)/packages/${NAME}/results/*.rpm; \
else \
echo "$(NAME) already exists at $(TOPLVL)/packages/$(NAME)"; \
exit 1; \
fi
$(TOPLVL)/repo:
@echo "Creating local RPM repository $(TOPLVL)/repo"
mkdir $(TOPLVL)/repo
$(MAKE) localrepocreate
#help repoenable: Enables the local RPM repository for use with Yum/DNF and
#help Mock. If this repository does not yet exist, it is created.
repoenable: $(TOPLVL)/repo ; $(call localrepoenable,${PM_CONF},${MOCK_CONF})
#help repodisable: Disables the local RPM repository.
repodisable: localrepodisable ;
#help repoclean: Removes all RPMs from the local RPM repository.
repoclean: localrepoclean localrepocreate ;
#help repostatus: Summarizes the local RPM repository status.
repostatus: localrepostatus ;
# Define site local toplevel targets in a separate makefile
-include $(TOPLVL)/projects/common/Makefile.toplevel.site_local
+10 -2
View File
@@ -20,8 +20,16 @@ building Clear Linux packages.
### Automated setup
Download the [user setup](user-setup.sh) script and run it on your Clear Linux
system as an unprivileged user. After the script completes, make sure to logout
and login again to complete the setup process.
system as an unprivileged user.
```
$ curl -O https://raw.githubusercontent.com/clearlinux/common/master/user-setup.sh
$ chmod +x user-setup.sh
$ ./user-setup.sh
```
After the script completes, make sure to logout and login again to complete the
setup process.
The script either accepts no options, or all (3) options in case you are
configuring the Koji CLI for remote building on a Koji server. The options are
+8
View File
@@ -13,3 +13,11 @@
# String to replace with "localhost" in upstream tarball URLs
#urlban =
# Path to packages file, a list of current packages in Clear Linux. It can be
# an absolute path or a path relative to this autospec.conf.
#packages_file =
# Path to yum config, used for generating whatrequires. It can be an absolute
# path or a path relative to this autospec.conf.
#yum_conf =
+3 -1
View File
@@ -4,8 +4,10 @@ config_opts['legal_host_arches'] = ('x86_64',)
config_opts['chroot_setup_cmd'] = 'groupinstall build srpm-build'
config_opts['dist'] = 'clear' # only useful for --resultdir variable subst
config_opts['extra_chroot_dirs'] = [ '/run/lock', ]
config_opts['useradd'] = '/usr/sbin/useradd -m -u %(uid)s -g %(gid)s -d %(home)s %(user)s'
config_opts['useradd'] = '/usr/sbin/useradd -m -u %(uid)s -g %(gid)s -d %(home)s %(user)s'
config_opts['plugin_conf']['ccache_enable'] = False
config_opts['releasever'] = 'clear'
config_opts['package_manager'] = 'dnf'
config_opts['yum.conf'] = """
+509 -11
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -149,4 +149,4 @@ fi
echo -en "\n************************\n"
echo 'Workspace has been set up in the "clearlinux" directory'
echo 'NOTE: logout and log back in or run "newgrp kvm" to finalize the setup process'
echo 'NOTE: logout and log back in to finalize the setup process'