From: Michael Shigorin <mike@altlinux.org>
To: devel-distro@lists.altlinux.org
Subject: [devel-distro] [PATCH] archdep pkglists (вдогонку к 1.1.64)
Date: Mon, 20 Apr 2015 23:18:04 +0300
Message-ID: <20150420201804.GE29500@imap.altlinux.org> (raw)
In-Reply-To: <20150420195053.GD29500@imap.altlinux.org>
[-- Attachment #1: Type: text/plain, Size: 728 bytes --]
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
[-- Attachment #2: 0001-pkg.in-lists-archdep-suffices-for-pkglists.patch --]
[-- Type: text/x-patch, Size: 4223 bytes --]
>From ac5dbb4bba5b802be4a8df4d7f7c3202fe51259b Mon Sep 17 00:00:00 2001
From: Michael Shigorin <mike@altlinux.org>
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
next prev parent reply other threads:[~2015-04-20 20:18 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-20 19:50 [devel-distro] I: mkimage-profiles 1.1.64 Michael Shigorin
2015-04-20 20:18 ` Michael Shigorin [this message]
2015-04-22 15:09 ` [devel-distro] [PATCH] archdep pkglists (вдогонку к 1.1.64) Sergey V Turchin
2015-04-22 15:32 ` Michael Shigorin
2015-04-23 10:39 ` Sergey V Turchin
2015-04-23 10:44 ` Michael Shigorin
2015-04-23 10:45 ` Sergey V Turchin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150420201804.GE29500@imap.altlinux.org \
--to=mike@altlinux.org \
--cc=devel-distro@lists.altlinux.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
ALT Linux Distributions development
This inbox may be cloned and mirrored by anyone:
git clone --mirror http://lore.altlinux.org/devel-distro/0 devel-distro/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 devel-distro devel-distro/ http://lore.altlinux.org/devel-distro \
devel-distro@lists.altlinux.org devel-distro@lists.altlinux.ru devel-distro@lists.altlinux.com
public-inbox-index devel-distro
Example config snippet for mirrors.
Newsgroup available over NNTP:
nntp://lore.altlinux.org/org.altlinux.lists.devel-distro
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git