From ae7139f8b686c0afd11275073b160c05c84fd023 Mon Sep 17 00:00:00 2001 From: Michael Shigorin Date: Mon, 14 Nov 2011 16:24:07 +0200 Subject: [PATCH] initial repo feature We've got some parts of it in build-distro feature, and some went to dev feature for no real reason. But a bare installer might go without package base, and LiveCDs other than live-builder might find local repository useful given aufs2 root overlay. Now the overall scheme is more straightforward: - a distro: + asks that a package repo be included + cares to further add the packages to it - a repo feature: + pulls in sub/main for it to happen + provides genbasedir script to create repo metadata + supplements live feature with repo configuration --- conf.d/desktop.mk | 2 +- conf.d/live.mk | 2 +- conf.d/server.mk | 2 +- features.in/build-distro/lib/build-distro.mk | 2 - .../build-distro/scripts.d/01-genbasedir | 40 ------------------- .../dev/live/image-scripts.d/80-cdrom-repo | 9 ----- features.in/repo/README | 8 ++++ features.in/repo/config.mk | 4 ++ features.in/repo/lib/build-genbasedir.mk | 2 + .../repo/live/image-scripts.d/80-repo-main | 10 +++++ features.in/repo/scripts.d/01-genbasedir | 28 +++++++++++++ image.in/README | 9 +++-- sub.in/main/README | 7 +++- 13 files changed, 65 insertions(+), 60 deletions(-) delete mode 100755 features.in/build-distro/scripts.d/01-genbasedir delete mode 100755 features.in/dev/live/image-scripts.d/80-cdrom-repo create mode 100644 features.in/repo/README create mode 100644 features.in/repo/config.mk create mode 100644 features.in/repo/lib/build-genbasedir.mk create mode 100755 features.in/repo/live/image-scripts.d/80-repo-main create mode 100755 features.in/repo/scripts.d/01-genbasedir diff --git a/conf.d/desktop.mk b/conf.d/desktop.mk index 6bebe553..a1cdee4e 100644 --- a/conf.d/desktop.mk +++ b/conf.d/desktop.mk @@ -1,7 +1,7 @@ # desktop distributions ifeq (distro,$(IMAGE_CLASS)) -distro/desktop-base: distro/installer sub/main \ +distro/desktop-base: distro/installer use/repo/main \ use/syslinux/ui-vesamenu use/x11/xorg use/bootloader/grub distro/icewm: distro/desktop-base \ diff --git a/conf.d/live.mk b/conf.d/live.mk index baa4d448..f2c7fe84 100644 --- a/conf.d/live.mk +++ b/conf.d/live.mk @@ -10,7 +10,7 @@ distro/live-systemd: distro/.base use/live/base use/systemd distro/live-isomd5sum: distro/.base use/live/base use/isomd5sum @$(call add,LIVE_PACKAGES,livecd-isomd5sum) -distro/live-builder: distro/.base sub/main \ +distro/live-builder: distro/.base use/repo/main \ use/live/base use/dev/mkimage use/power/acpi/button @$(call add,LIVE_LISTS,$(call tags,base && (server || builder))) @$(call add,LIVE_PACKAGES,livecd-tmpfs livecd-online-repo) diff --git a/conf.d/server.mk b/conf.d/server.mk index f83770d5..19b98a64 100644 --- a/conf.d/server.mk +++ b/conf.d/server.mk @@ -1,7 +1,7 @@ # server distributions ifeq (distro,$(IMAGE_CLASS)) -distro/server-base: distro/installer sub/main \ +distro/server-base: distro/installer use/repo/main \ use/syslinux/ui-menu use/memtest use/bootloader/grub @$(call add,BASE_LISTS,server-base) diff --git a/features.in/build-distro/lib/build-distro.mk b/features.in/build-distro/lib/build-distro.mk index 0cd91fa6..0cc01d30 100644 --- a/features.in/build-distro/lib/build-distro.mk +++ b/features.in/build-distro/lib/build-distro.mk @@ -4,8 +4,6 @@ # take the latter part SUBDIRS = $(notdir $(SUBPROFILES)) -# "main" subprofile needs genbasedir -CHROOT_PACKAGES = apt-utils BOOT_TYPE = isolinux # Metadata/ needed only for installers (and not for e.g. syslinux.iso) diff --git a/features.in/build-distro/scripts.d/01-genbasedir b/features.in/build-distro/scripts.d/01-genbasedir deleted file mode 100755 index 624bb282..00000000 --- a/features.in/build-distro/scripts.d/01-genbasedir +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/sh -# FIXME: bring to common style - -verbose() -{ - [ -z "$GLOBAL_VERBOSE" ] || - echo >&2 "HOOK: 01-genbasedir: $*" -} - -verbose started - -[ -d "$WORKDIR/ALTLinux" ] || exit 0 -cd "$WORKDIR/ALTLinux" - -comps="$(find -mindepth 1 -maxdepth 1 -type d -name 'RPMS.*' -printf '%f\n' | - sed 's/^RPMS\.//')" - -verbose "comps=$comps" - -[ -n "$comps" ] || exit 1 - -genbasedir \ - --topdir="$WORKDIR" \ - --architecture="$INFO_ARCH" \ - --no-oldhashfile \ - --partial \ - --xz \ - --bz2 \ - --create \ - --notautomatic=false \ - ${INFO_NAME:+--archive="$INFO_NAME"} \ - ${INFO_VERSION:+--version="$INFO_VERSION"} \ - ${INFO_ORIGIN:+--origin="$INFO_ORIGIN"} \ - ${INFO_LABEL:+--label="$INFO_LABEL"} \ - ALTLinux $comps - -### drop this when genbasedir is fixed (--no-uncompressed) -for comp in $comps; do rm -f base/{pkg,src}list.$comp; done - -verbose finished diff --git a/features.in/dev/live/image-scripts.d/80-cdrom-repo b/features.in/dev/live/image-scripts.d/80-cdrom-repo deleted file mode 100755 index 3b6ba7b0..00000000 --- a/features.in/dev/live/image-scripts.d/80-cdrom-repo +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh -efu -# configure local image repository provided by sub/main - -# TODO: some integration with sub/main to ensure that it is there - -{ - echo "# for real stuff you'll need full repo, see apt-repo" - echo "rpm file:/image ALTLinux main" -} > /etc/apt/sources.list.d/cdrom.list diff --git a/features.in/repo/README b/features.in/repo/README new file mode 100644 index 00000000..1277bf4d --- /dev/null +++ b/features.in/repo/README @@ -0,0 +1,8 @@ +Эта фича предназначена для конфигурирования репозиториев +в образе, включая генерацию хэшей и подключение к LiveCD. + +На данный момент единственным таким репозиторием является +RPMS.main (создаваемый sub/main), но возможно добавление +addons, updates или иных по мере необходимости. + +Результат -- каталог ALTLinux/base/ для копирования в образ. diff --git a/features.in/repo/config.mk b/features.in/repo/config.mk new file mode 100644 index 00000000..e62a1043 --- /dev/null +++ b/features.in/repo/config.mk @@ -0,0 +1,4 @@ +use/repo: + @$(call add,FEATURES,repo) + +use/repo/main: sub/main use/repo diff --git a/features.in/repo/lib/build-genbasedir.mk b/features.in/repo/lib/build-genbasedir.mk new file mode 100644 index 00000000..81a5ebe3 --- /dev/null +++ b/features.in/repo/lib/build-genbasedir.mk @@ -0,0 +1,2 @@ +# ../scripts.d/01-genbasedir needs that +CHROOT_PACKAGES += apt-utils diff --git a/features.in/repo/live/image-scripts.d/80-repo-main b/features.in/repo/live/image-scripts.d/80-repo-main new file mode 100755 index 00000000..005602e8 --- /dev/null +++ b/features.in/repo/live/image-scripts.d/80-repo-main @@ -0,0 +1,10 @@ +#!/bin/sh -efu +# configure package repository of the image (provided by sub/main); +# this script will be run iff both live and repo features are used + +DIR=/etc/apt/sources.list.d + +mkdir -p $DIR && { + echo "# for real stuff you'll need full repo, see apt-repo" + echo "rpm file:/image ALTLinux main" +} > $DIR/main.list diff --git a/features.in/repo/scripts.d/01-genbasedir b/features.in/repo/scripts.d/01-genbasedir new file mode 100755 index 00000000..59c7a0b1 --- /dev/null +++ b/features.in/repo/scripts.d/01-genbasedir @@ -0,0 +1,28 @@ +#!/bin/sh -efu + +PREFIX=ALTLinux +cd "$WORKDIR/$PREFIX" + +COMPS="$(find -mindepth 1 -maxdepth 1 -type d -name 'RPMS.*' -printf '%f\n' | + sed 's/^RPMS\.//')" + +[ -z "$GLOBAL_VERBOSE" ] || echo "** COMPS=$COMPS" >&2 +[ -n "$COMPS" ] || exit 1 + +genbasedir \ + --topdir="$WORKDIR" \ + --no-oldhashfile \ + --partial \ + --xz \ + --bz2 \ + --create \ + --notautomatic=false \ + ${INFO_ARCH:+--architecture="$INFO_ARCH"} \ + ${INFO_NAME:+--archive="$INFO_NAME"} \ + ${INFO_VERSION:+--version="$INFO_VERSION"} \ + ${INFO_ORIGIN:+--origin="$INFO_ORIGIN"} \ + ${INFO_LABEL:+--label="$INFO_LABEL"} \ + $PREFIX $COMPS + +### drop this when genbasedir is fixed (--no-uncompressed) +for c in $COMPS; do rm -f base/{pkg,src}list.$c; done diff --git a/image.in/README b/image.in/README index 03057aaa..8d39c533 100644 --- a/image.in/README +++ b/image.in/README @@ -7,11 +7,12 @@ Соответственно для сборки требуется или features.in/build-distro, или use/build-ve. -Пакетная база рабочего чрута минимальна; apt-utils включены -ради genbasedir, который после завершения первоначального -наполнения субпрофилей может переехать в ../sub.in/main/ (TODO). +Пакетная база рабочего чрута минимальна (может чуть расширяться +фичами -- см. ../features.in/repo/lib/build-genbasedir.mk +в качестве примера). Если требуется какая-либо иная обработка чрута, следует -предпочитать scripts.d/. +предпочитать scripts.d/ -- для универсальной обработки +скрипт можно добавить здесь, для специфичной -- в фичу. Результат -- готовый образ в $(IMAGEDIR)/. diff --git a/sub.in/main/README b/sub.in/main/README index 5ebee0c3..978a6ed4 100644 --- a/sub.in/main/README +++ b/sub.in/main/README @@ -1,7 +1,7 @@ Этот каталог содержит субпрофиль main, собирающий пакетную базу для локальной инсталяции дистрибутива из полученного образа, -включая необязательные пакеты; в live-builder применяется как -локальный репозиторий для сборки. +включая необязательные пакеты; в distro/live-builder применяется +как локальный репозиторий для сборки. Подбирает: - SYSTEM_PACKAGES, COMMON_PACKAGES, BASE_PACKAGES, BASE_LISTS: @@ -11,4 +11,7 @@ В image-scripts.d/* смысла нет, только scripts.d/* -- рабочий чрут не содержит исполняемых файлов. +Не следует использовать этот субпрофиль напрямую, для добавления +пакетного репозитория в образ предназначена фича repo/main. + Результат -- каталог ALTLinux/RPMS.main для копирования в образ.