ALT Linux Team development discussions
 help / color / mirror / Atom feed
From: Victor Forsyuk <victor@ksi-linux.com>
To: ALT Devel discussion list <devel@altlinux.ru>
Subject: Re: [devel] RPM и архитектура бинарных пакетов
Date: Fri, 24 Oct 2003 21:25:40 +0300
Message-ID: <20031024182540.GA24587@mailhub.gu.net> (raw)
In-Reply-To: <20031021173949.GA8294@basalt.office.altlinux.org>

[-- Attachment #1: Type: text/plain, Size: 1394 bytes --]

On Tue, Oct 21, 2003 at 09:39:49PM +0400, Dmitry V. Levin wrote:

> > "Why all features of RPM should be used in Red Hat's build process?" - этот
> > Витин вопрос остался без ответа. Никто ведь не принуждает РедХет
> > пользоваться фичей, поддержку которой их попросили включить в rpm.
> 
> На самом деле один аргумент всё-таки был приведён:
> Эта возможность создаёт риск создания большего количества
> труднообнаруживаемых не_совсем_noarch-пакетов, чем оно есть сейчас.
> 
> Впрочем, всякой возможностью можно злоупотребить.

Именно! Наличие ножа в доме создает риск порезаться (если им пользоваться
неосторожно). Но не не совсем понятен аргумент убрать все ножи из дома:
боишься ножа - не пользуйся им :)
 
> > > 2. Написанный Виктором код уже есть и его можно использовать как затравку
> > > для создания кода, который позволит, например, с дополнительным ключем не
> > > упаковывать подпакеты с выбранной архитектурой, отличной от собираемой -- 
> > > это позволит легко решить проблему RH(1).
> 
> Как говорит Andrew Morgan, "Show me the code".

See attach.
 
> > p.s. [вполголоса] А вот если бы еще возможность прерывать сборку при наличии
> > в buildroot пропущенных в %files файлов... ;-)
> > Я был бы тогда в два раза счастливее - как кот Матроскин :)
> 
> Это вопрос времени.

[мечтательно] Вот бы быстрее это время наступило. :)

> У меня, в принципе, есть патч к rpm-4_0_branch.



[-- Attachment #2: ksi-rpm-3.0.4-targetarch.patch --]
[-- Type: text/plain, Size: 6025 bytes --]

diff -urN rpm-4.0.3.orig/build/pack.c rpm-4.0.3/build/pack.c
--- rpm-4.0.3.orig/build/pack.c	Tue Apr 17 22:26:32 2001
+++ rpm-4.0.3/build/pack.c	Sun Jun 17 18:14:31 2001
@@ -443,8 +443,20 @@
 
 	if (Fileno(csa->cpioFdIn) < 0) {
 #ifndef	DYING
+	  if (headerIsEntry(h, RPMTAG_ARCH)) {
+	    char *_arch;
+	    headerGetEntry(h, RPMTAG_ARCH, NULL, (void **)&_arch, NULL);
+	    rpmGetArchNum(_arch, &archnum);
+	  } else {
 	    rpmGetArchInfo(NULL, &archnum);
+	  }
+	  if (headerIsEntry(h, RPMTAG_OS)) {
+	    char *_os;
+	    headerGetEntry(h, RPMTAG_OS, NULL, (void **)&_os, NULL);
+	    rpmGetOsNum(_os, &osnum);
+	  } else {
 	    rpmGetOsInfo(NULL, &osnum);
+	  }
 #endif
 	} else if (csa->lead != NULL) {
 	    archnum = csa->lead->archnum;
diff -urN rpm-3.0.4.orig/build/parsePreamble.c rpm-3.0.4/build/parsePreamble.c
--- rpm-3.0.4.orig/build/parsePreamble.c	Tue Aug 24 17:09:22 1999
+++ rpm-3.0.4/build/parsePreamble.c	Thu Sep 30 20:11:20 1999
@@ -140,6 +140,7 @@
 {
     const char *arch = NULL;
     const char *os = NULL;
+    Package pkg;
 
     rpmGetArchInfo(&arch, NULL);
     rpmGetOsInfo(&os, NULL);
@@ -154,6 +155,23 @@
 	rpmError(RPMERR_BADSPEC, _("Architecture is not included: %s"), arch);
 	return RPMERR_BADSPEC;
     }
+    pkg = spec->packages;
+    while (pkg) {
+       if (headerIsEntry(pkg->header, RPMTAG_ARCH)) {
+           headerGetEntry(pkg->header, RPMTAG_ARCH, NULL, (void **)&arch, NULL);
+           if (isMemberInEntry(spec->buildRestrictions,
+                               arch, RPMTAG_EXCLUDEARCH) == 1) {
+               rpmError(RPMERR_BADSPEC, _("Architecture is excluded: %s"), arch);
+               return RPMERR_BADSPEC;
+           }
+           if (isMemberInEntry(spec->buildRestrictions,
+                       arch, RPMTAG_EXCLUSIVEARCH) == 0) {
+               rpmError(RPMERR_BADSPEC, _("Architecture is not included: %s"), arch);
+               return RPMERR_BADSPEC;
+           }
+       }
+       pkg = pkg->next;
+    }
     if (isMemberInEntry(spec->buildRestrictions,
 			os, RPMTAG_EXCLUDEOS) == 1) {
 	rpmError(RPMERR_BADSPEC, _("OS is excluded: %s"), os);
@@ -164,6 +182,23 @@
 	rpmError(RPMERR_BADSPEC, _("OS is not included: %s"), os);
 	return RPMERR_BADSPEC;
     }
+    pkg = spec->packages;
+    while (pkg) {
+       if (headerIsEntry(pkg->header, RPMTAG_OS)) {
+           headerGetEntry(pkg->header, RPMTAG_OS, NULL, (void **)&os, NULL);
+           if (isMemberInEntry(spec->buildRestrictions,
+                               os, RPMTAG_EXCLUDEOS) == 1) {
+               rpmError(RPMERR_BADSPEC, _("OS is excluded: %s"), os);
+               return RPMERR_BADSPEC;
+           }
+           if (isMemberInEntry(spec->buildRestrictions,
+                               os, RPMTAG_EXCLUSIVEOS) == 0) {
+               rpmError(RPMERR_BADSPEC, _("OS is not included: %s"), os);
+               return RPMERR_BADSPEC;
+           }
+       }
+       pkg = pkg->next;
+    }
 
     return 0;
 }
@@ -367,6 +402,8 @@
       case RPMTAG_NAME:
       case RPMTAG_VERSION:
       case RPMTAG_RELEASE:
+      case RPMTAG_ARCH:
+      case RPMTAG_OS:
       case RPMTAG_URL:
 	SINGLE_TOKEN_ONLY;
 	/* These macros are for backward compatibility */
@@ -611,7 +648,9 @@
     {RPMTAG_AUTOREQPROV,	0, 0, "autoreqprov"},
     {RPMTAG_AUTOREQ,		0, 0, "autoreq"},
     {RPMTAG_AUTOPROV,		0, 0, "autoprov"},
-    {RPMTAG_DOCDIR,		0, 0, "docdir"},
+    {RPMTAG_DOCDIR,		0, 0, "docdir"},
+    {RPMTAG_ARCH,		0, 0, "targetarch"},
+    {RPMTAG_OS,			0, 0, "targetos"},
     {0, 0, 0, 0}
 };
 
diff -urN rpm-3.0.3.orig/build/parseSpec.c rpm-3.0.3/build/parseSpec.c
--- rpm-3.0.3.orig/build/parseSpec.c	Mon Sep  6 23:51:54 1999
+++ rpm-3.0.3/build/parseSpec.c	Thu Sep 30 20:11:20 1999
@@ -496,8 +496,10 @@
 	    return RPMERR_BADSPEC;
 	}
 
-	headerAddEntry(pkg->header, RPMTAG_OS, RPM_STRING_TYPE, os, 1);
-	headerAddEntry(pkg->header, RPMTAG_ARCH, RPM_STRING_TYPE, arch, 1);
+       if (!headerIsEntry(pkg->header, RPMTAG_OS))
+           headerAddEntry(pkg->header, RPMTAG_OS, RPM_STRING_TYPE, os, 1);
+       if (!headerIsEntry(pkg->header, RPMTAG_ARCH))
+           headerAddEntry(pkg->header, RPMTAG_ARCH, RPM_STRING_TYPE, arch, 1);
       }
       FREE(myos);
     }
diff -urN rpm-4.0.3.orig/lib/rpmlib.h rpm-4.0.3/lib/rpmlib.h
--- rpm-4.0.3.orig/lib/rpmlib.h	Thu Apr 19 18:11:00 2001
+++ rpm-4.0.3/lib/rpmlib.h	Sun Jun 17 18:08:16 2001
@@ -475,6 +475,7 @@
  * @retval num		address of arch number (or NULL)
  */
 void rpmGetArchInfo( /*@out@*/ const char ** name, /*@out@*/ int * num);
+void rpmGetArchNum(char * name, int * num);
 
 /** \ingroup rpmrc
  * Return current os name and/or number.
@@ -483,6 +484,7 @@
  * @retval num		address of os number (or NULL)
  */
 void rpmGetOsInfo( /*@out@*/ const char ** name, /*@out@*/ int * num);
+void rpmGetOsNum(char * name, int * num);
 
 /** \ingroup rpmrc
  * Return arch/os score of a name.
diff -urN rpm-3.0.3.orig/lib/rpmrc.c rpm-3.0.3/lib/rpmrc.c
--- rpm-3.0.3.orig/lib/rpmrc.c	Mon Aug 16 19:05:03 1999
+++ rpm-3.0.3/lib/rpmrc.c	Thu Sep 30 20:11:20 1999
@@ -1136,6 +1136,38 @@
     getMachineInfo(OS, name, num);
 }
 
+static void getNum(int type, char * name, int * num) {
+    struct canonEntry * canon;
+    int which = currTables[type];
+
+    /* use the normal canon tables, even if we're looking up build stuff */
+    if (which >= 2) which -= 2;
+
+    canon = lookupInCanonTable(name, 
+			       tables[which].canons,
+			       tables[which].canonsLength);
+
+    if (canon) {
+	if (num) *num = canon->num;
+    } else {
+	if (num) *num = 255;
+
+	if (tables[currTables[type]].hasCanon) {
+	    rpmMessage(RPMMESS_WARNING, _("Unknown system: %s\n"), name);
+/*	    rpmMessage(RPMMESS_WARNING, _("Please contact rpm-list@redhat.com\n"));*/
+	}
+    }
+}
+
+void rpmGetArchNum(char * name, int * num) {
+    getNum(ARCH, name, num);
+}
+
+void rpmGetOsNum(char * name, int * num) {
+    getNum(OS, name, num);
+}
+
+
 void rpmRebuildTargetVars(const char **buildtarget, const char ** canontarget)
 {
 

  parent reply	other threads:[~2003-10-24 18:25 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-10-17  7:03 Denis Ovsienko
2003-10-17  8:42 ` Alexander Bokovoy
2003-10-20 13:35 ` Victor Forsyuk
2003-10-20 13:51   ` Alexander Bokovoy
2003-10-21 16:27     ` Victor Forsyuk
2003-10-21 17:39       ` Dmitry V. Levin
2003-10-21 20:45         ` Alexander Bokovoy
2003-10-21 21:03           ` Dmitry V. Levin
2003-10-21 21:13             ` Alexander Bokovoy
2003-10-22 17:50           ` Canis Cerberus
2003-10-22 19:40             ` Alexander Bokovoy
2003-10-21 23:15         ` Re[2]: [devel] RPM É ÁÒÈÉÔÅËÔÕÒÁ ÂÉÎÁÒÎÙÈ ÐÁËÅÔÏ× Volkov Serge
2003-10-24 18:25         ` Victor Forsyuk [this message]
2003-11-09 18:39           ` [devel] RPM %_unpackaged_files_terminate_build Dmitry V. Levin
2003-10-22 14:52       ` [devel] Re: RPM и архитектура бинарных пакетов Alexey Tourbin
2003-10-22 14:56         ` Alexander Bokovoy

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=20031024182540.GA24587@mailhub.gu.net \
    --to=victor@ksi-linux.com \
    --cc=devel@altlinux.ru \
    /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 Team development discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://lore.altlinux.org/devel/0 devel/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 devel/ http://lore.altlinux.org/devel \
		devel@altlinux.org devel@altlinux.ru devel@lists.altlinux.org devel@lists.altlinux.ru devel@linux.iplabs.ru mandrake-russian@linuxteam.iplabs.ru sisyphus@linuxteam.iplabs.ru
	public-inbox-index devel

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://lore.altlinux.org/org.altlinux.lists.devel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git