.base rehashed, DISK_LISTS renamed, etc

In particular:
- .base is now generated from pieces (see image.in/Makefile)
- s/DISTROS/IMAGES/g; s/CONFIGS/DISTROS/g (for clarity)
- s/DISK_LISTS/MAIN_LISTS/g ("disk" was early m-p-d legacy)
- introduced BASE_PACKAGES to complement BASE_LISTS
- minor tweaks to Makefile (ARCH and DATE moved elsewhere)
- libdistro.mk: dropped overlooked IMAGE_INIT_LIST copy
- clean.mk: silly cleanup
This commit is contained in:
Michael Shigorin 2011-07-15 00:00:46 +03:00
parent a9e4934bf3
commit 5f88152223
14 changed files with 44 additions and 40 deletions

View File

@ -9,7 +9,7 @@
all help:
@echo '** available distribution targets:'
@echo $(DISTROS) | fmt -sw"$$((COLUMNS>>1))" | column -t
@echo $(IMAGES) | fmt -sw"$$((COLUMNS>>1))" | column -t
# most of the actual work done elsewhere
include clean.mk
@ -19,12 +19,10 @@ include log.mk
include iso.mk
# we can't use implicit rules for top-level targets, only for prereqs
CONFIGS := $(shell sed -n 's,^distro/\([^:.]\+\):.*$$,\1,p' distro.mk)
DISTROS := $(addsuffix .iso,$(CONFIGS))
ARCH ?= $(shell arch | sed 's/i686/i586/')
DATE = $(shell date +%Y%m%d)
export ARCH DATE
# NB: what about static pattern rules?
# TODO: move into libdistro?
DISTROS := $(shell sed -n 's,^distro/\([^:.]\+\):.*$$,\1,p' distro.mk)
IMAGES := $(addsuffix .iso,$(DISTROS))
# to be passed into distcfg.mk
IMAGEDIR ?= $(shell [ -d "$$HOME/out" -a -w "$$HOME/out" ] \
@ -32,7 +30,7 @@ IMAGEDIR ?= $(shell [ -d "$$HOME/out" -a -w "$$HOME/out" ] \
|| echo "$(BUILDDIR)/out" )
IMAGENAME ?= mkimage-profiles-$(ARCH).iso
$(DISTROS): %.iso: | profile/init distro/% boot/isolinux profile/populate iso
$(IMAGES): %.iso: | profile/init distro/% boot/isolinux profile/populate iso
@# TODO: run automated tests (e.g. iso size)
@OUTNAME="$(@:.iso=)-$(DATE)-$(ARCH).iso"; \
OUTPATH="$(IMAGEDIR)/$$OUTNAME"; \

View File

@ -15,7 +15,6 @@ clean:
# and BUILDLOG can be specified by hand either
distclean: clean
@if [ -L build -a -d build/ ]; then \
$(MAKE) -C build $@ GLOBAL_BUILDDIR=$(shell readlink build) $(LOG); \
rm -rf build/.git; \
$(MAKE) -C build $@ GLOBAL_BUILDDIR=$(shell readlink build) $(LOG) && \
rm -r $(shell readlink build); \

View File

@ -47,7 +47,7 @@ distro/server-ovz: distro/server-base use/hdt use/firmware/server
@$(call add,KMODULES,bcmwl e1000e igb ndiswrapper rtl8168 rtl8192)
@$(call add,KMODULES,ipset ipt-netflow opendpi pf_ring xtables-addons)
@$(call add,KMODULES,drbd83 kvm)
@$(call add,DISK_LISTS,kernel-wifi)
@$(call add,MAIN_LISTS,kernel-wifi)
@$(call add,BASE_LISTS,ovz-server)
@$(call add,BASE_LISTS,$(call tags,base server))
@$(call add,GROUPS,dns-server http-server ftp-server kvm-server)

View File

@ -3,4 +3,5 @@ use/installer: sub/install2 use/syslinux/install2.cfg
@$(call set,INSTALL2_PACKAGES,installer-distro-$$(INSTALLER)-stage2)
@$(call add,INSTALL2_PACKAGES,branding-$$(BRANDING)-alterator)
@$(call add,MAIN_PACKAGES,branding-$$(BRANDING)-release)
@$(call set,BASE_LISTS,base)
# @$(call set,BASE_LISTS,base)
@$(call add,BASE_LISTS,$(call tags,basesystem))

View File

@ -39,21 +39,20 @@ ifeq "$(INSTALLER_KFLAVOUR)$(KFLAVOURS)" ""
metadata:
@echo "** skipping metadata target, no stage1 kernel installed"
else
metadata:
metadata: dot-base
@mkdir -p files/Metadata
@rm -f files/Metadata/pkg-groups.tar
@echo -e "\n# auto-added in image.in/Makefile" >> $(call list,.base)
@echo "$(call kpackages,$(KMODULES),$(KFLAVOURS))" >> $(call list,.base)
@echo "$(COMMON_PACKAGES)" | tr ' ' '\n\n' >> $(call list,.base)
@echo "branding-$(BRANDING)-release" >> $(call list,.base)
# see also alterator-pkg (backend3/pkg-install); we only tar up what's up to it
@tar -cvf files/Metadata/pkg-groups.tar -C $(PKGDIR) \
$$(echo $(call list,.base) \
$(call list,$(GROUPS)) \
$$(echo $(call list,$(GROUPS) .base) \
$(call group,$(GROUPS)) \
| sed 's,$(PKGDIR)/*,,g')
endif
dot-base:
@echo -e "# auto-added in image.in/Makefile" >> $(call list,.base)
@echo "$(call kpackages,$(KMODULES),$(KFLAVOURS))" >> $(call list,.base)
prep: $(GLOBAL_DEBUG) dot-disk metadata $(IMAGEDIR)
$(IMAGEDIR):

2
iso.mk
View File

@ -3,6 +3,8 @@ ifndef BUILDDIR
$(error BUILDDIR not defined)
endif
export ARCH ?= $(shell arch | sed 's/i686/i586/')
# step 4 is kicked off here but actually done by image.in/Makefile
#
# adding boot/isolinux to prereqs is too late here,

View File

@ -24,7 +24,6 @@ distro/.branding: distro/.init
# NB: the last flavour in KFLAVOURS gets to be the default one;
# the kernel packages regexp evaluation has to take place at build stage
distro/.base: distro/.branding sub/stage1 use/syslinux use/syslinux/localboot.cfg
@$(call set,IMAGE_INIT_LIST,+branding-$$(BRANDING)-release)
@$(call set,KFLAVOURS,std-def)
# pick up release manager's config

4
log.mk
View File

@ -23,4 +23,6 @@ LOG = 2>>$(BUILDLOG) >/dev/null
GLOBAL_DEBUG := debug
endif
export BUILDLOG DEBUG GLOBAL_DEBUG GLOBAL_VERBOSE LOG MAKE SHELL
DATE = $(shell date +%Y%m%d)
export BUILDLOG DATE DEBUG GLOBAL_DEBUG GLOBAL_VERBOSE LOG MAKE SHELL

View File

@ -1,11 +1 @@
basesystem
udev
interactivesystem
apt-conf-sisyphus
apt
alterator-grub
alterator-root
alterator-users
alterator-net-eth
# basesystem packages, see Makefile

View File

@ -9,19 +9,30 @@ include $(BUILDDIR)/distcfg.mk
SUFFIX := pkg/lists
TARGET := $(BUILDDIR)/$(SUFFIX)
# env | sort -u | grep _LISTS | xargs cp
all: $(TARGET) $(GLOBAL_DEBUG)
# env | sort -u | grep _LISTS | xargs cp
@$(foreach V, \
$(filter %_LISTS,$(sort $(.VARIABLES))), \
$(if $(filter environment% file,$(origin $V)),\
$(shell cp --parents -at $(TARGET) \
-- $(value $V))))
@cp -a .base $(GROUPS) $(TARGET)
# construct .base packagelist for alterator-pkg
@( \
echo "### generated via pkg.in/lists/Makefile" && \
echo "### BASE_LISTS" && \
cat $(BASE_LISTS) /dev/null && \
echo "### branding" && \
echo "branding-$(BRANDING)-release" && \
echo "### COMMON_PACKAGES" && \
echo "$(COMMON_PACKAGES)" && \
echo "### BASE_PACKAGES" && \
echo "$(BASE_PACKAGES)" \
) | sed -re '/^[^[:space:]#]/ s/[[:space:]]+/\n/g' >$(TARGET)/.base
@[ -z $(GROUPS) ] || cp -at $(TARGET) $(GROUPS)
@type -t git >&/dev/null && \
cd $(TARGET) && \
git add . && \
git commit -qam "$(SUFFIX)"; \
cd - >&/dev/null; \
git commit -qam "$(SUFFIX)";
# do beforehand as foreach gets expanded before recipe execution
$(TARGET):

View File

@ -1,3 +1,3 @@
interactivesystem
apt-conf-sisyphus
apt-conf
apt

View File

@ -1,4 +1,4 @@
alterator-lilo
alterator-grub
alterator-root
alterator-users
alterator-net-eth

View File

@ -14,8 +14,10 @@ CHROOT_PACKAGES = apt-utils rsync
IMAGE_PACKAGES_REGEXP = $(call kpackages,$(KMODULES),$(KFLAVOURS)) \
$(MAIN_PACKAGES_REGEXP)
IMAGE_PACKAGES = $(call map,list,.base $(BASE_LISTS) $(DISK_LISTS) $(GROUPS)) \
IMAGE_PACKAGES = $(call map,list,$(BASE_LISTS) $(MAIN_LISTS) $(GROUPS)) \
$(COMMON_PACKAGES) \
$(BASE_PACKAGES) \
$(MAIN_PACKAGES)
MKI_DESTDIR = ALTLinux/RPMS.main

View File

@ -1,8 +1,9 @@
Этот каталог содержит субпрофиль main, собирающий пакетную базу,
которая затем укладывается в образ.
Подбирает MAIN_PACKAGES, а также BASE_LISTS (в установку)
и DISK_LISTS (дополнительные пакеты).
Подбирает:
- COMMON_PACKAGES, BASE_PACKAGES, BASE_LISTS: в установку по умолчанию;
- MAIN_PACKAGES, MAIN_LISTS: дополнительные пакеты.
В image-scripts.d/* смысла нет, только scripts.d/* --
рабочий чрут не содержит исполняемых файлов.