mirror of
https://github.com/clearlinux/common.git
synced 2026-06-16 19:16:00 +00:00
Compare commits
55 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 01e548b268 | |||
| 128799fa02 | |||
| ad77e695dc | |||
| 8bf6c59e96 | |||
| ac3f1898f6 | |||
| 905b1d1c06 | |||
| e3b1adedd8 | |||
| ab142ead38 | |||
| a9982b4064 | |||
| 9f8869fdff | |||
| 9892e87aec | |||
| 100ad5965e | |||
| 61db58c057 | |||
| abe044ee0c | |||
| 8997c889f8 | |||
| f2dd86b50c | |||
| fa6fa080d6 | |||
| a20775675d | |||
| 9dfe2ba937 | |||
| 744cf78eb1 | |||
| 97e7ab937a | |||
| 4fb96cadcc | |||
| 670a01fc25 | |||
| 728e6ea221 | |||
| 240653c41d | |||
| 6935953ee7 | |||
| f210130e38 | |||
| 8df7f9dd6b | |||
| c424e9cd89 | |||
| c247096be4 | |||
| 42e2edaf6b | |||
| 5c4004f6d8 | |||
| 374f9dd581 | |||
| 68c06960c9 | |||
| a52f147734 | |||
| 3e7fad9b4b | |||
| ac7cf82607 | |||
| 458f5c71d0 | |||
| f8ac700994 | |||
| 794b93a8a4 | |||
| e7d54e5528 | |||
| b656b478ff | |||
| 0fd03748cb | |||
| 523a4ce1e2 | |||
| 38059c0401 | |||
| 1cc337d5fa | |||
| d2b87af7d3 | |||
| a3f2351225 | |||
| a96e245866 | |||
| ed31b0d4d7 | |||
| e0a2933bce | |||
| d933700e4e | |||
| ad95a0b5dd | |||
| ae089fc77b | |||
| 6a9a5d3d00 |
@@ -0,0 +1,3 @@
|
||||
*~
|
||||
.*swp
|
||||
Makefile*.site_local
|
||||
@@ -15,7 +15,7 @@ endif
|
||||
|
||||
update:
|
||||
curl -f -o packages ${BASE_URL}/source/package-sources
|
||||
cut -f1 packages | LC_ALL=en_US.utf8 sort > packages.new && mv packages.new packages
|
||||
cut -f1 packages | LC_ALL=C sort > packages.new && mv packages.new packages
|
||||
|
||||
spdx:
|
||||
curl -s spdx.org/licenses/ | sed '0,/<tbody>/d;/<\/tbody>/q;s/<tr>/\f/g;s/$$/,/g;s/<[^>]*>//g' | awk 'BEGIN{RS="\f";FS=","} {print $$4}' | sed '/^$$/d;s/^[ ]*//' > spdx
|
||||
|
||||
+45
-13
@@ -19,7 +19,12 @@ 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
|
||||
ifeq ($(wildcard $(TOPLVL)/repo/clear.cfg),)
|
||||
MOCK ?= $(WITH_SUDO) /usr/bin/mock -r $(MOCK_CONF)
|
||||
else
|
||||
MOCK ?= $(WITH_SUDO) /usr/bin/mock -r $(TOPLVL)/repo/clear.cfg
|
||||
USE_LOCAL_REPO = 1
|
||||
endif
|
||||
|
||||
ifneq ($(wildcard upstream),)
|
||||
__allsources := $(notdir $(strip $(shell cat upstream)))
|
||||
@@ -81,11 +86,13 @@ configemail:
|
||||
checkblacklist:
|
||||
@$(TOPLVL)/projects/common/checkblacklist.sh $(TOPLVL)/projects/common/blacklist results/*.rpm
|
||||
|
||||
prebuild-checks:
|
||||
|
||||
#help build: Builds from current directory on your machine and puts log
|
||||
#help files and rpms in the results directory of your package. If there
|
||||
#help are mutlple tar.gz files for a package, make will do make sources,
|
||||
#help which creates a src.rpm file from the spec file.
|
||||
build: configemail $(SPECFILE) upstream $(SRPMFILE)
|
||||
build: prebuild-checks configemail $(SPECFILE) upstream $(SRPMFILE)
|
||||
$(MOCK) $(SRPMFILE) --result=results/ --no-cleanup-after --uniqueext=$(PKG_NAME)
|
||||
@perl $(TOPLVL)/projects/common/logcheck.pl results/build.log
|
||||
@perl $(TOPLVL)/projects/common/count.pl results/build.log &> testresults
|
||||
@@ -113,6 +120,13 @@ shell:
|
||||
.PHONY: $(SRPMFILE)
|
||||
$(SRPMFILE): $(SPECFILE) $(__allsources)
|
||||
@$(MAKE) spdxcheck
|
||||
@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
|
||||
$(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
|
||||
@@ -146,7 +160,7 @@ autospec: pullrebase
|
||||
echo "Specfile already exists and was not created by autospec.py! Aborting."; \
|
||||
exit 1; \
|
||||
fi
|
||||
@printf 'PKG_NAME := %s\nURL = %s\n\n\ninclude ../common/Makefile.common\n' $(PKG_NAME) '$(firstword $(value NEWURL) $(value URL))' > Makefile
|
||||
@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} \
|
||||
@@ -228,16 +242,21 @@ else
|
||||
rm -rf "$$tmp";
|
||||
endif
|
||||
|
||||
prekoji-checks:
|
||||
|
||||
#help koji: Creates a git tag on the latest local commit, then asks koji to
|
||||
#help build from that tag on the server. If you have uncommitted local changes,
|
||||
#help they will not be included.
|
||||
koji: kojidef
|
||||
koji: prekoji-checks kojidef
|
||||
@$(MAKE) spdxcheck
|
||||
@$(MAKE) checkblacklist
|
||||
@if ! git branch | grep -q -E '^\* master'; then \
|
||||
echo "Error: Must be on the master branch to submit to koji" >&2; \
|
||||
exit 1; \
|
||||
fi
|
||||
git pull --rebase
|
||||
git tag $(SRPMVERS)
|
||||
git push --follow-tags
|
||||
git push --tags
|
||||
git push origin master refs/tags/$(SRPMVERS)
|
||||
$(KOJI_CMD) build $$KOJI_NOWAIT $(KOJI_TAG) $(PKG_BASE_URL)/$(PKG_NAME)?#$(SRPMVERS)
|
||||
|
||||
#help rekoji: In case a previous 'make koji' failed, trigger a rebuild for the
|
||||
@@ -268,8 +287,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; \
|
||||
@@ -278,17 +300,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:"; \
|
||||
@@ -297,8 +318,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)
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -62,6 +62,64 @@ 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; \
|
||||
)
|
||||
|
||||
|
||||
.PHONY: help
|
||||
##### Code
|
||||
# Make sure that HELPSPACE has exactly HELPLEN spaces in it
|
||||
|
||||
+30
-4
@@ -148,6 +148,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 +158,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
|
||||
@@ -189,14 +190,20 @@ provides:
|
||||
#help process. For more information about autospec, see the project page on Github https://github.com/clearlinux/autospec
|
||||
autospecnew:
|
||||
@if [ -z $(NAME) ] || [ -z $(URL) ]; then \
|
||||
echo "Please specify NAME and URL"; \
|
||||
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); \
|
||||
printf 'PKG_NAME := %s\nURL = %s\n\n\ninclude ../common/Makefile.common\n' $(NAME) '$(value URL)' > $(TOPLVL)/packages/$(NAME)/Makefile; \
|
||||
( \
|
||||
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); \
|
||||
$(TOPLVL)/projects/common/checkblacklist.sh $(TOPLVL)/projects/common/blacklist $(TOPLVL)/packages/${NAME}/results/*.rpm; \
|
||||
else \
|
||||
@@ -204,5 +211,24 @@ autospecnew:
|
||||
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
|
||||
|
||||
@@ -19,8 +19,17 @@ 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.
|
||||
Download the [user setup](user-setup.sh) script and run it on your Clear Linux
|
||||
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
|
||||
|
||||
@@ -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 =
|
||||
|
||||
@@ -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'] = """
|
||||
|
||||
Reference in New Issue
Block a user