Commit d920c990 authored by Michael Shigorin's avatar Michael Shigorin

--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.
parent 2f967a05
#!/bin/sh -f #!/bin/sh -f
# a script to transform a tag name, a list of tag names (ANDed then), # 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: # examples of expected stdin:
# #
# kde # kde
...@@ -9,6 +8,8 @@ ...@@ -9,6 +8,8 @@
# (base && (kernel || apt || alterator)) # (base && (kernel || apt || alterator))
# #
# TODO; consider s/-name/-path/
find . $(sed \ find . $(sed \
-e "s,\([^&|! ()']\+\),-name *_\1_*,g" \ -e "s,\([^&|! ()']\+\),-name *_\1_*,g" \
-e "s, *&& *, -a ,g" \ -e "s, *&& *, -a ,g" \
......
clean: clean:
@echo '** cleaning up...' @echo '** cleaning up...'
@[ -d build/ ] && \ @[ -d build/ ] && \
make -C build $@ GLOBAL_BUILDDIR=$(shell readlink build) \ make -C build/image $@ GLOBAL_BUILDDIR=$(shell readlink build) \
||: ||:
distclean: clean distclean: clean
@[ -d build/ ] && \ @[ -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 -r $(shell readlink build) && \
rm .config.mk build \ rm .config.mk build \
||: ||:
# it can be symlinked if r/w (see configure); # it can be symlinked if r/w (see configure);
# if not, then should come from environment # if not, then should come from environment
#BUILDDIR ?= $(shell realpath build)
BUILDDIR ?= $(shell realpath build) BUILDDIR ?= $(shell realpath build)
prep: prep:
......
...@@ -13,11 +13,10 @@ PARAMS="$@" ...@@ -13,11 +13,10 @@ PARAMS="$@"
# keeping profile itself completely readonly would be nice # keeping profile itself completely readonly would be nice
export BUILDDIR="$(bin/mktmpdir mkimage-profiles.build)" export BUILDDIR="$(bin/mktmpdir mkimage-profiles.build)"
ls -ld $BUILDDIR #ls -ld $BUILDDIR
#find image.in -type f -print0 | xargs -r0 cp -at "$BUILDDIR"/ -- #find image.in -type f -print0 | xargs -r0 cp -at "$BUILDDIR"/ --
rsync -qa --delete image.in/ "$BUILDDIR"/ rsync -qaH --delete image.in/ "$BUILDDIR"/image/
cp -a pkg "$BUILDDIR"/
#rm -f "$BUILDDIR"/.config.mk #rm -f "$BUILDDIR"/.config.mk
touch "$BUILDDIR"/.config.mk touch "$BUILDDIR"/.config.mk
mkdir "$BUILDDIR"/.mki mkdir "$BUILDDIR"/.mki
......
...@@ -5,7 +5,8 @@ CONFIG = $(BUILDDIR)/.config.mk ...@@ -5,7 +5,8 @@ CONFIG = $(BUILDDIR)/.config.mk
# shell will get confused by ' or args get spammed with " # shell will get confused by ' or args get spammed with "
put = $(and $(1),$(put_body)) put = $(and $(1),$(put_body))
define 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 endef
# request particular image subprofile inclusion # request particular image subprofile inclusion
...@@ -15,25 +16,28 @@ sub/%: ...@@ -15,25 +16,28 @@ sub/%:
init: init:
@echo "** starting distro configuration build process" @echo "** starting distro configuration build process"
:> $(CONFIG) :> $(CONFIG)
$(call put,KFLAVOUR=std-def) $(call put,KFLAVOUR=std-def) ###
$(call put,IMAGE_INIT_LIST=+branding-$$(BRANDING)-release) $(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 # NB: our */* are phony targets really, just for namespace
distro/installer: init sub/install2 distro/installer: init sub/install2
@#$(call put,BRANDING=altlinux-sisyphus) ### @#$(call put,BRANDING=altlinux-sisyphus) ###
$(call put,BASE_LISTS=base kernel) $(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 distro/server-base: distro/installer sub/main use/memtest86
$(call put,BRANDING=altlinux-backup-server) ###
$(call put,BASE_LISTS+=server-base kernel-server) $(call put,BASE_LISTS+=server-base kernel-server)
distro/server-light: distro/server-base distro/server-light: distro/server-base use/bootsplash
$(call put,KFLAVOUR=ovz-smp) $(call put,KFLAVOUR=ovz-smp) # override default
$(call put,BRANDING=sisyphus-server-light) $(call put,BRANDING=sisyphus-server-light)
$(call put,DISK_LISTS+=kernel-wifi) $(call put,DISK_LISTS+=kernel-wifi)
use/memtest86: use/memtest86:
$(call put,COMMON_PACKAGES+=memtest86+) $(call put,COMMON_PACKAGES+=memtest86+)
@# configure syslinux/isolinux as well @# configure syslinux/isolinux as well
use/bootsplash:
$(call put,COMMON_TAGS+=bootsplash)
...@@ -7,7 +7,7 @@ SUBDIRS = $(SUBPROFILES) ...@@ -7,7 +7,7 @@ SUBDIRS = $(SUBPROFILES)
# we usually need a bootloader (until stage1 is separate), # we usually need a bootloader (until stage1 is separate),
# and "main" subprofile needs genbasedir # 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 MKI_PACK_RESULTS = boot:mkimage-profiles.iso
...@@ -19,7 +19,7 @@ PROPAGATOR_VERSION = mkimage-profiles 2.0 ...@@ -19,7 +19,7 @@ PROPAGATOR_VERSION = mkimage-profiles 2.0
PROPAGATOR_MAR_MODULES = ./modules PROPAGATOR_MAR_MODULES = ./modules
PROPAGATOR_INITFS = ./initfs PROPAGATOR_INITFS = ./initfs
include /usr/share/mkimage/targets.mk include $(MKIMAGE_PREFIX)/targets.mk
all: prep copy-tree copy-subdirs run-scripts pack-image all: prep copy-tree copy-subdirs run-scripts pack-image
......
...@@ -18,16 +18,16 @@ AC_ARG_WITH(aptconf, ...@@ -18,16 +18,16 @@ AC_ARG_WITH(aptconf,
AC_ARG_WITH(mkimage, AC_ARG_WITH(mkimage,
AC_HELP_STRING([--with-mkimage=dir], 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]) AC_MSG_CHECKING([mkimage])
if test -d "$with_mkimage/usr/share/mkimage"; then if test -d "$with_mkimage/tools"; then
MKIMAGE_PREFIX="$with_mkimage" MKIMAGE_PREFIX="$with_mkimage"
AC_MSG_RESULT([** $with_mkimage/usr/share/mkimage exists]) AC_MSG_RESULT([** $with_mkimage/tools exists])
fi fi
], ],
[ [
MKIMAGE_PREFIX='' MKIMAGE_PREFIX='/usr/share/mkimage'
]) ])
# with-kernel: provide two separate desktop/server default substs? # with-kernel: provide two separate desktop/server default substs?
......
default: all default: all
include $(GLOBAL_BUILDDIR)/globals.mk include ../globals.mk
include $(GLOBAL_BUILDDIR)/functions.mk include ../functions.mk
include $(MKIMAGE_PREFIX)/config.mk include $(MKIMAGE_PREFIX)/config.mk
include $(GLOBAL_BUILDDIR)/.config.mk include $(GLOBAL_BUILDDIR)/.config.mk
IMAGE_PACKAGES = kernel-image-std-def \ IMAGE_PACKAGES = $(KERNEL_PACKAGES) \
installer-distro-server-light-stage2 \ $(COMMON_PACKAGES) \
./packages \ $(INSTALL2_PACKAGES) \
$(INSTALL2_PACKAGES) ./packages
MKI_PACK_RESULTS = squash:altinst MKI_PACK_RESULTS = squash:altinst
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
default: all default: all
include $(GLOBAL_BUILDDIR)/globals.mk include ../globals.mk
include $(GLOBAL_BUILDDIR)/functions.mk include ../functions.mk
include $(MKIMAGE_PREFIX)/config.mk include $(MKIMAGE_PREFIX)/config.mk
include $(GLOBAL_BUILDDIR)/.config.mk include $(GLOBAL_BUILDDIR)/.config.mk
...@@ -11,6 +11,7 @@ CHROOT_PACKAGES = apt-utils rsync ...@@ -11,6 +11,7 @@ CHROOT_PACKAGES = apt-utils rsync
PACKAGES_EXPAND_METHOD=regexp PACKAGES_EXPAND_METHOD=regexp
IMAGE_PACKAGES = $(call list,.base) \ IMAGE_PACKAGES = $(call list,.base) \
$(COMMON_PACKAGES) \
$(MAIN_PACKAGES) \ $(MAIN_PACKAGES) \
$(call list,$(BASE_LISTS)) \ $(call list,$(BASE_LISTS)) \
$(call list,$(DISK_LISTS)) $(call list,$(DISK_LISTS))
......
iso: pkgs:
@echo "** starting package lists build process"
$(MAKE) -C pkg BUILDDIR=$(BUILDDIR)
iso: pkgs
@echo "** starting image build process" @echo "** starting image build process"
@### setup GLOBAL_BOOT_TYPE, etc @### 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 @# check iso size
# 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))))
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment