mirror of
https://github.com/clearlinux/common.git
synced 2026-06-16 11:06:15 +00:00
Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 1e74d17500 | |||
| 6a7fac08d9 | |||
| 932c2236a7 | |||
| 6c92ce3160 | |||
| 3e2219c07e | |||
| f0d2523151 | |||
| de39e64e29 | |||
| 877fee6375 | |||
| e921a2a883 |
+63
-32
@@ -205,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; \
|
||||
@@ -236,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:
|
||||
@@ -365,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
|
||||
|
||||
+2
-2
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user