From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Mon, 20 Apr 2015 23:18:04 +0300 From: Michael Shigorin To: devel-distro@lists.altlinux.org Message-ID: <20150420201804.GE29500@imap.altlinux.org> Mail-Followup-To: devel-distro@lists.altlinux.org References: <20150420195053.GD29500@imap.altlinux.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="EuxKj2iCbKjpUGkD" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20150420195053.GD29500@imap.altlinux.org> User-Agent: Mutt/1.4.2.3i Subject: [devel-distro] =?koi8-r?b?W1BBVENIXSBhcmNoZGVwIHBrZ2xpc3RzICjX?= =?koi8-r?b?xM/Hz87L1SDLIDEuMS42NCk=?= X-BeenThere: devel-distro@lists.altlinux.org X-Mailman-Version: 2.1.12 Precedence: list Reply-To: Distributions development List-Id: Distributions development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Apr 2015 20:18:05 -0000 Archived-At: List-Archive: --EuxKj2iCbKjpUGkD Content-Type: text/plain; charset=koi8-r Content-Disposition: inline Content-Transfer-Encoding: 8bit On Mon, Apr 20, 2015 at 10:50:53PM +0300, I wrote: > За эти три недели наконец-то была доведена до включения одна из > разрабатывавшихся с прошлого года экспериментальных веток На самом деле была подготовлена ещё одна штука (про архитектурно-зависимые пакеты в списках), но попросту забыл в финальный вариант забрать; прилагаю коммит заодно с документацией, вкратце: -@I586_ONLY@haspd -@X86_64_ONLY@i586-haspd +haspd@i586 i586-haspd@x86_64 (скриптик для обработки списков там же в doc/archdep.txt) Может, так оно и лучше, если в процессе независимого тестирования всплывут какие-нибудь не замеченные мною грабельки... --  ---- WBR, Michael Shigorin / http://altlinux.org   ------ http://opennet.ru / http://anna-news.info --EuxKj2iCbKjpUGkD Content-Type: text/x-patch; charset=koi8-r Content-Disposition: attachment; filename="0001-pkg.in-lists-archdep-suffices-for-pkglists.patch" Content-Transfer-Encoding: 8bit >>From ac5dbb4bba5b802be4a8df4d7f7c3202fe51259b Mon Sep 17 00:00:00 2001 From: Michael Shigorin Date: Thu, 22 Jan 2015 18:27:07 +0300 Subject: [PATCH] pkg.in/lists: archdep suffices for pkglists This is an initial implementation of architecture dependent contents handling for package lists more or less in the vein of mkimage-profiles-desktop's one *but* using suffix part to filter words in or out *not* prefix part to replace it with a comment marker (thus filtering out lines). The syntax should be pretty obvious: a b@i586 c@x86_64 will get "a b" given ARCH=i586 and "a c" given ARCH=x86_64; please see doc/archdep.txt for a more elaborate description and a conversion script. --- doc/archdep.txt | 46 +++++++++++++++++++++++++++++++++++++++++++ doc/mkimage-profiles.asciidoc | 2 ++ lib/profile.mk | 1 + pkg.in/lists/Makefile | 11 ++++++++++- 4 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 doc/archdep.txt diff --git a/doc/archdep.txt b/doc/archdep.txt new file mode 100644 index 0000000..25927ce --- /dev/null +++ b/doc/archdep.txt @@ -0,0 +1,46 @@ +== Архитектурно-зависимые фрагменты == + +=== Makefile === + +Достаточно воспользоваться ifeq/ifneq, сравнивая $(ARCH) с нужным: + + ifeq (x86_64,$(ARCH)) + EFI_LISTS := $(call tags,base efi) + endif + +При необходимости сравнить со списком ("любой x86") можно сделать так: + + ifeq (,$(filter-out i586 x86_64,$(ARCH))) + use/x11/xorg: use/x11 use/x11/intel use/firmware + else + use/x11/xorg: use/x11 + endif + +В рецептах (shell-часть Makefile) используйте $(ARCH) или $$ARCH. + +=== скрипты === + +В скриптовых хуках ({image-,}scripts.d/*) проверяйте $GLOBAL_ARCH. + +=== списки пакетов === + +Бывает так, что в списке пакетов есть смысл упоминать какой-либо из них +только для определённой архитектуры (например, wine или steam); в таких +случаях можно воспользоваться механизмом подстановки, который пословно +обрабатывает списки и в случае наличия суффикса @ARCH оставляет только +слова, в которых этот суффикс соответствует заданной архитектуре сборки. + +Например, для Simply Linux в mkimage-profiles-desktop есть строчки: + +@I586_ONLY@haspd +@X86_64_ONLY@i586-haspd + +В случае mkimage-profiles они должны выглядеть так: + +haspd@i586 +i586-haspd@x86_64 + +Для преобразования можно воспользоваться следующей командой: + +sed -r -e 's/@I586_ONLY@([^\t ]+)/\1@i586/g' \ + -e 's/@X86_64_ONLY@([^\t ]+)/\1@x86_64/g' diff --git a/doc/mkimage-profiles.asciidoc b/doc/mkimage-profiles.asciidoc index 8feb97d..a280122 100644 --- a/doc/mkimage-profiles.asciidoc +++ b/doc/mkimage-profiles.asciidoc @@ -42,6 +42,8 @@ include::features.txt[] include::pkglists.txt[] +include::archdep.txt[] + = Каталоги = include::../conf.d/README[] diff --git a/lib/profile.mk b/lib/profile.mk index 762f8be..05a2352 100644 --- a/lib/profile.mk +++ b/lib/profile.mk @@ -98,6 +98,7 @@ profile/bare: profile/init ifeq (,$(REPO:altlinux%=)) @$(call set,IMAGE_INIT_LIST,+branding-$$(BRANDING)-release) endif + @$(call xport,ARCH) @mp-commit "$(BUILDDIR)" "image configuration defaults set" # put the derived SUBPROFILE_DIRS here to get it logged in clear text by the way diff --git a/pkg.in/lists/Makefile b/pkg.in/lists/Makefile index 485d3d0..1759e9c 100644 --- a/pkg.in/lists/Makefile +++ b/pkg.in/lists/Makefile @@ -18,7 +18,7 @@ include $(BUILDDIR)/distcfg.mk SUFFIX := pkg/lists TARGET := $(BUILDDIR)/$(SUFFIX) -all: $(TARGET) $(GLOBAL_DEBUG) $(DOTBASE) copy-lists copy-groups +all: | $(TARGET) $(GLOBAL_DEBUG) $(DOTBASE) copy-lists copy-groups grep-archdep @mp-commit "$(TARGET)" "requested $(SUFFIX) copied over" # env | sort -u | grep _LISTS | xargs -r cp -t @@ -33,6 +33,15 @@ copy-groups: cp -at $(TARGET) -- $(THE_GROUPS) $(MAIN_GROUPS); \ fi +grep-archdep: a = $(ARCH) +grep-archdep: s = [:space:] +grep-archdep: + # xargs -L 1024 -n 1024 ? -- breaks -I + @find $(TARGET) -type f \ + | xargs -I '__' sh -c '\ + sed -rni "s/\\<([^@ ]*)\\>|\\<([^@ ]*)@$a\\>/\\1\\2/pg" __; \ + sed -i -r "s/\\<([^@ ]*)@[^@ ]+\\> *//g" __' + # do beforehand as foreach gets expanded before recipe execution $(TARGET): @mkdir -p $(TARGET) -- 2.1.4 --EuxKj2iCbKjpUGkD--