--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.
This commit is contained in:
Michael Shigorin 2010-09-08 15:47:06 +03:00
parent 2f967a0528
commit d920c9904c
10 changed files with 64 additions and 31 deletions

View File

@ -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" \

View File

@ -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:

5
configure vendored
View File

@ -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

View File

@ -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)

View File

@ -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

View File

@ -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?

View File

@ -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

View File

@ -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))

9
iso.mk
View File

@ -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

24
pkg/Makefile Normal file
View File

@ -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))))