From 5f881522233e4f901de0e43f66632b1378432ff6 Mon Sep 17 00:00:00 2001 From: Michael Shigorin Date: Fri, 15 Jul 2011 00:00:46 +0300 Subject: [PATCH] .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 --- Makefile | 14 ++++++-------- clean.mk | 1 - distro.mk | 2 +- features.in/installer/config.mk | 3 ++- image.in/Makefile | 13 ++++++------- iso.mk | 2 ++ libdistro.mk | 1 - log.mk | 4 +++- pkg.in/lists/.base | 12 +----------- pkg.in/lists/Makefile | 19 +++++++++++++++---- pkg.in/lists/tagged/{.base+apt => basesystem} | 2 +- ...alterator+install => basesystem,alterator} | 2 +- sub.in/main/Makefile | 4 +++- sub.in/main/README | 5 +++-- 14 files changed, 44 insertions(+), 40 deletions(-) rename pkg.in/lists/tagged/{.base+apt => basesystem} (55%) rename pkg.in/lists/tagged/{.base+alterator+install => basesystem,alterator} (76%) diff --git a/Makefile b/Makefile index 2e29e4f6..344e835e 100644 --- a/Makefile +++ b/Makefile @@ -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"; \ diff --git a/clean.mk b/clean.mk index 1eaeb15c..5f864735 100644 --- a/clean.mk +++ b/clean.mk @@ -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); \ diff --git a/distro.mk b/distro.mk index 3bd486d6..b23b3288 100644 --- a/distro.mk +++ b/distro.mk @@ -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) diff --git a/features.in/installer/config.mk b/features.in/installer/config.mk index 00295795..82fe9664 100644 --- a/features.in/installer/config.mk +++ b/features.in/installer/config.mk @@ -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)) diff --git a/image.in/Makefile b/image.in/Makefile index 8b68f314..c4cf9ee0 100644 --- a/image.in/Makefile +++ b/image.in/Makefile @@ -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): diff --git a/iso.mk b/iso.mk index e1bbcee4..9969b548 100644 --- a/iso.mk +++ b/iso.mk @@ -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, diff --git a/libdistro.mk b/libdistro.mk index 1ceb6a90..42eebbcf 100644 --- a/libdistro.mk +++ b/libdistro.mk @@ -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 diff --git a/log.mk b/log.mk index 0531fc2a..10cd31b8 100644 --- a/log.mk +++ b/log.mk @@ -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 diff --git a/pkg.in/lists/.base b/pkg.in/lists/.base index a511808b..fecb0191 100644 --- a/pkg.in/lists/.base +++ b/pkg.in/lists/.base @@ -1,11 +1 @@ -basesystem -udev - -interactivesystem -apt-conf-sisyphus -apt - -alterator-grub -alterator-root -alterator-users -alterator-net-eth +# basesystem packages, see Makefile diff --git a/pkg.in/lists/Makefile b/pkg.in/lists/Makefile index c3334267..18c7f4e0 100644 --- a/pkg.in/lists/Makefile +++ b/pkg.in/lists/Makefile @@ -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): diff --git a/pkg.in/lists/tagged/.base+apt b/pkg.in/lists/tagged/basesystem similarity index 55% rename from pkg.in/lists/tagged/.base+apt rename to pkg.in/lists/tagged/basesystem index 4de8bdab..7979c1ac 100644 --- a/pkg.in/lists/tagged/.base+apt +++ b/pkg.in/lists/tagged/basesystem @@ -1,3 +1,3 @@ interactivesystem -apt-conf-sisyphus +apt-conf apt diff --git a/pkg.in/lists/tagged/.base+alterator+install b/pkg.in/lists/tagged/basesystem,alterator similarity index 76% rename from pkg.in/lists/tagged/.base+alterator+install rename to pkg.in/lists/tagged/basesystem,alterator index 70a33cfd..8211701c 100644 --- a/pkg.in/lists/tagged/.base+alterator+install +++ b/pkg.in/lists/tagged/basesystem,alterator @@ -1,4 +1,4 @@ -alterator-lilo +alterator-grub alterator-root alterator-users alterator-net-eth diff --git a/sub.in/main/Makefile b/sub.in/main/Makefile index 096b0add..7fe63948 100644 --- a/sub.in/main/Makefile +++ b/sub.in/main/Makefile @@ -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 diff --git a/sub.in/main/README b/sub.in/main/README index 2627bb72..7d368fd3 100644 --- a/sub.in/main/README +++ b/sub.in/main/README @@ -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/* -- рабочий чрут не содержит исполняемых файлов.