From d920c9904c31855f593730add7d0fafd8c3737d2 Mon Sep 17 00:00:00 2001 From: Michael Shigorin Date: Wed, 8 Sep 2010 15:47:06 +0300 Subject: [PATCH] --as-needed for pkg/lists As not every package list is useful for every distro, only the needed lists should be copied for a particular one. --- bin/tags2lists | 5 +++-- clean.mk | 5 ++--- configure | 5 ++--- distro.mk | 18 +++++++++++------- image.in/Makefile | 4 ++-- image.in/configure.ac | 8 ++++---- image.in/install2/Makefile | 12 ++++++------ image.in/main/Makefile | 5 +++-- iso.mk | 9 +++++++-- pkg/Makefile | 24 ++++++++++++++++++++++++ 10 files changed, 64 insertions(+), 31 deletions(-) create mode 100644 pkg/Makefile diff --git a/bin/tags2lists b/bin/tags2lists index 66ec293a..229e72c7 100755 --- a/bin/tags2lists +++ b/bin/tags2lists @@ -1,7 +1,6 @@ #!/bin/sh -f # a script to transform a tag name, a list of tag names (ANDed then), -# or a complex boolean expression into a list of package list names -# +# or a complex boolean expression into a list of package list names. # examples of expected stdin: # # kde @@ -9,6 +8,8 @@ # (base && (kernel || apt || alterator)) # +# TODO; consider s/-name/-path/ + find . $(sed \ -e "s,\([^&|! ()']\+\),-name *_\1_*,g" \ -e "s, *&& *, -a ,g" \ diff --git a/clean.mk b/clean.mk index d21630c6..a88d4819 100644 --- a/clean.mk +++ b/clean.mk @@ -1,19 +1,18 @@ clean: @echo '** cleaning up...' @[ -d build/ ] && \ - make -C build $@ GLOBAL_BUILDDIR=$(shell readlink build) \ + make -C build/image $@ GLOBAL_BUILDDIR=$(shell readlink build) \ ||: distclean: clean @[ -d build/ ] && \ - make -C build $@ GLOBAL_BUILDDIR=$(shell readlink build) && \ + make -C build/image $@ GLOBAL_BUILDDIR=$(shell readlink build) && \ rm -r $(shell readlink build) && \ rm .config.mk build \ ||: # it can be symlinked if r/w (see configure); # if not, then should come from environment -#BUILDDIR ?= $(shell realpath build) BUILDDIR ?= $(shell realpath build) prep: diff --git a/configure b/configure index 1ac21d02..d045f036 100755 --- a/configure +++ b/configure @@ -13,11 +13,10 @@ PARAMS="$@" # keeping profile itself completely readonly would be nice export BUILDDIR="$(bin/mktmpdir mkimage-profiles.build)" -ls -ld $BUILDDIR +#ls -ld $BUILDDIR #find image.in -type f -print0 | xargs -r0 cp -at "$BUILDDIR"/ -- -rsync -qa --delete image.in/ "$BUILDDIR"/ -cp -a pkg "$BUILDDIR"/ +rsync -qaH --delete image.in/ "$BUILDDIR"/image/ #rm -f "$BUILDDIR"/.config.mk touch "$BUILDDIR"/.config.mk mkdir "$BUILDDIR"/.mki diff --git a/distro.mk b/distro.mk index 112d1df0..882fba8e 100644 --- a/distro.mk +++ b/distro.mk @@ -5,7 +5,8 @@ CONFIG = $(BUILDDIR)/.config.mk # shell will get confused by ' or args get spammed with " put = $(and $(1),$(put_body)) define put_body -@printf '%s\n' '$(1)# $@' >> "$(CONFIG)"; +@printf '%s\n' '$(1)#=- $@' >> "$(CONFIG)"; +@# TODO: maybe some more logging/tracing, otherwise inline this endef # request particular image subprofile inclusion @@ -15,25 +16,28 @@ sub/%: init: @echo "** starting distro configuration build process" :> $(CONFIG) - $(call put,KFLAVOUR=std-def) + $(call put,KFLAVOUR=std-def) ### $(call put,IMAGE_INIT_LIST=+branding-$$(BRANDING)-release) - $(call put,STAGE1_PACKAGES=kernel-image-$$(KFLAVOUR)) + #$(call put,STAGE1_PACKAGES=kernel-image-$$(KFLAVOUR)) + $(call put,KERNEL_PACKAGES=kernel-image-$$(KFLAVOUR)) # NB: our */* are phony targets really, just for namespace distro/installer: init sub/install2 @#$(call put,BRANDING=altlinux-sisyphus) ### $(call put,BASE_LISTS=base kernel) - $(call put,INSTALL2_PACKAGES=kernel-image-$$(KFLAVOUR)) + $(call put,INSTALL2_PACKAGES=installer-distro-server-light-stage2) ### distro/server-base: distro/installer sub/main use/memtest86 - $(call put,BRANDING=altlinux-backup-server) ### $(call put,BASE_LISTS+=server-base kernel-server) -distro/server-light: distro/server-base - $(call put,KFLAVOUR=ovz-smp) +distro/server-light: distro/server-base use/bootsplash + $(call put,KFLAVOUR=ovz-smp) # override default $(call put,BRANDING=sisyphus-server-light) $(call put,DISK_LISTS+=kernel-wifi) use/memtest86: $(call put,COMMON_PACKAGES+=memtest86+) @# configure syslinux/isolinux as well + +use/bootsplash: + $(call put,COMMON_TAGS+=bootsplash) diff --git a/image.in/Makefile b/image.in/Makefile index 4091dd5e..eee09086 100644 --- a/image.in/Makefile +++ b/image.in/Makefile @@ -7,7 +7,7 @@ SUBDIRS = $(SUBPROFILES) # we usually need a bootloader (until stage1 is separate), # and "main" subprofile needs genbasedir -CHROOT_PACKAGES = syslinux apt-utils $(STAGE1_PACKAGES) +CHROOT_PACKAGES = syslinux apt-utils $(KERNEL_PACKAGES) ### MKI_PACK_RESULTS = boot:mkimage-profiles.iso @@ -19,7 +19,7 @@ PROPAGATOR_VERSION = mkimage-profiles 2.0 PROPAGATOR_MAR_MODULES = ./modules PROPAGATOR_INITFS = ./initfs -include /usr/share/mkimage/targets.mk +include $(MKIMAGE_PREFIX)/targets.mk all: prep copy-tree copy-subdirs run-scripts pack-image diff --git a/image.in/configure.ac b/image.in/configure.ac index 4101d7c3..14ad11ea 100644 --- a/image.in/configure.ac +++ b/image.in/configure.ac @@ -18,16 +18,16 @@ AC_ARG_WITH(aptconf, AC_ARG_WITH(mkimage, AC_HELP_STRING([--with-mkimage=dir], - [custom mkimage prefix, e.g '--with-mkimage=/home/me/mkimage']), + [custom mkimage prefix, e.g '--with-mkimage=/home/me/usr/share/mkimage']), [ AC_MSG_CHECKING([mkimage]) - if test -d "$with_mkimage/usr/share/mkimage"; then + if test -d "$with_mkimage/tools"; then MKIMAGE_PREFIX="$with_mkimage" - AC_MSG_RESULT([** $with_mkimage/usr/share/mkimage exists]) + AC_MSG_RESULT([** $with_mkimage/tools exists]) fi ], [ - MKIMAGE_PREFIX='' + MKIMAGE_PREFIX='/usr/share/mkimage' ]) # with-kernel: provide two separate desktop/server default substs? diff --git a/image.in/install2/Makefile b/image.in/install2/Makefile index 3634f651..e6fd6084 100644 --- a/image.in/install2/Makefile +++ b/image.in/install2/Makefile @@ -1,14 +1,14 @@ default: all -include $(GLOBAL_BUILDDIR)/globals.mk -include $(GLOBAL_BUILDDIR)/functions.mk +include ../globals.mk +include ../functions.mk include $(MKIMAGE_PREFIX)/config.mk include $(GLOBAL_BUILDDIR)/.config.mk -IMAGE_PACKAGES = kernel-image-std-def \ - installer-distro-server-light-stage2 \ - ./packages \ - $(INSTALL2_PACKAGES) +IMAGE_PACKAGES = $(KERNEL_PACKAGES) \ + $(COMMON_PACKAGES) \ + $(INSTALL2_PACKAGES) \ + ./packages MKI_PACK_RESULTS = squash:altinst diff --git a/image.in/main/Makefile b/image.in/main/Makefile index 50479aa1..c932fe5c 100644 --- a/image.in/main/Makefile +++ b/image.in/main/Makefile @@ -2,8 +2,8 @@ default: all -include $(GLOBAL_BUILDDIR)/globals.mk -include $(GLOBAL_BUILDDIR)/functions.mk +include ../globals.mk +include ../functions.mk include $(MKIMAGE_PREFIX)/config.mk include $(GLOBAL_BUILDDIR)/.config.mk @@ -11,6 +11,7 @@ CHROOT_PACKAGES = apt-utils rsync PACKAGES_EXPAND_METHOD=regexp IMAGE_PACKAGES = $(call list,.base) \ + $(COMMON_PACKAGES) \ $(MAIN_PACKAGES) \ $(call list,$(BASE_LISTS)) \ $(call list,$(DISK_LISTS)) diff --git a/iso.mk b/iso.mk index 30a93113..06d4a40e 100644 --- a/iso.mk +++ b/iso.mk @@ -1,5 +1,10 @@ -iso: +pkgs: + @echo "** starting package lists build process" + $(MAKE) -C pkg BUILDDIR=$(BUILDDIR) + +iso: pkgs @echo "** starting image build process" @### setup GLOBAL_BOOT_TYPE, etc - i586 make -C $(BUILDDIR) GLOBAL_BUILDDIR=$(BUILDDIR) + (cd $(BUILDDIR)/image; autoconf; ./configure --with-aptconf=/etc/apt/apt.conf.SS_64) ### + echo $(MAKE) -C $(BUILDDIR)/image GLOBAL_BUILDDIR=$(BUILDDIR) @# check iso size diff --git a/pkg/Makefile b/pkg/Makefile new file mode 100644 index 00000000..f948062b --- /dev/null +++ b/pkg/Makefile @@ -0,0 +1,24 @@ +# copy package lists referenced in distro configuration +# over to build dir + +include $(BUILDDIR)/.config.mk +.PHONY: pkgs + +# env | sort -u | grep _LISTS | xargs cp +pkgs: prep test + @$(foreach V, \ + $(filter %_LISTS,$(sort $(.VARIABLES))), \ + $(if $(filter environment% file,$(origin $V)),\ + $(shell cp -a $(addprefix lists/,$(value $V)) \ + $(BUILDDIR)/pkg/lists/))) + +# moving this into pkgs spoils execution order (clobbers results) +prep: + mkdir -p $(BUILDDIR)/pkg/{lists,groups} + +# dump *_LISTS variables' values +test: + @$(foreach V, \ + $(filter %_LISTS,$(sort $(.VARIABLES))), \ + $(if $(filter environment% file,$(origin $V)),\ + $(warning $V=$(value $V))))