default: all

SQUASHFS_VERSION=4

# Include mkimage config file with default definitions
include /usr/share/mkimage/config.mk

# Include autogenerated settings for specific product flavor
# Not neccessary for clean family targets.
-include stage-autocfg.mk

# packagelist stuff
TOPDIR=/home/builder/mkimage-profiles-6-plc
include ../functions.mk

CHROOT_PACKAGES = apt-utils rsync

PACKAGES_EXPAND_METHOD=regexp
#NO_CACHE=1

IMAGE_INIT_LIST = +branding-altlinux-kdesktop-release apt-conf-t6

LOCAL_BASE_PACKAGE_LISTS ?= base kernel
IMAGE_PACKAGES = .base \
		 $(call list,$(LOCAL_BASE_PACKAGE_LISTS)) \
		 $(call list,$(GLOBAL_BASE_PACKAGE_LISTS)) \
		 $(call list,$(GLOBAL_DISK_PACKAGE_LISTS)) \
		 $(GLOBAL_DISK_PACKAGES) \
		 $(call list,$(shell  grep X-Alterator-PackageList /dev/null $(call group,$(GLOBAL_PKG_GROUPS)) | cut -d= -f2)) \
		 $(call tagged,$(GLOBAL_BASE_TAGS)) \
		 $(call tagged,$(GLOBAL_DISK_TAGS))

MKI_DESTDIR = ALTLinux/RPMS.main

MKI_PACK_RESULTS = data:

INFO_NAME	= ALT Linux Main packages
INFO_LABEL	= KDesktop 

# Include mkimage targets definitions
include /usr/share/mkimage/targets.mk

test-tags:
	@echo $(call tagged,base dvd)

all: dot-base rm-pkg-groups-base copy-packages run-scripts pack-image pkg-groups-base

# FIXME: this should be generated in pkg/Makefile probably
# NB: alterator-pkg depends on it being lists/.base in Metadata.tar
pkg-groups-base: dot-base
	@echo "Preparing pkg-groups-base..."
	mkdir -p `dirname $(call list,.base)`
	cat .base $(call list,$(LOCAL_BASE_PACKAGE_LISTS)) \
		  $(call list,$(GLOBAL_BASE_PACKAGE_LISTS)) \
		  | sed -e 's/#.*//' \
		      -e 's/[^[:space:]]*-\([[:space:]]\+\|$$\)//g' \
		      -e 's/[[:space:]]\+/\n/g' \
			> $(call list,.base)

rm-pkg-groups-base:
	rm -f $(call list,.base)

dot-base:
	@echo "IMAGE_PACKAGES: $(IMAGE_PACKAGES)"
	echo apt-conf-t6 \
		 branding-altlinux-kdesktop-release \
		 branding-altlinux-kdesktop-bootsplash \
		 branding-altlinux-kdesktop-bootloader \
		 branding-altlinux-kdesktop-notes \
		 branding-altlinux-kdesktop-alterator \
		 indexhtml-common branding-altlinux-kdesktop-indexhtml\
		 $(GLOBAL_BASE_PACKAGES) \
                 branding-altlinux-kdesktop-bootloader > .base