- drop no longer needed patches
  - adjust requires + buildrequires to match current needs
  - adjust rpmdb index ghosts to match the new release
  - split librpmbuild and librpmsign to a separate rpm-build-libs package
  - split rpmsign to its own package to allow signing without all the build goo
  - build-conditionalize plugins, disabled for now
  - gstreamer and printer dependency generation moving out
  - handle .so symlink dependencies with fileattrs
This commit is contained in:
Panu Matilainen 2011-01-18 14:20:26 +02:00
parent 566e45ff17
commit f29fc6771b
14 changed files with 77 additions and 929 deletions

1
.gitignore vendored
View File

@ -1 +1,2 @@
rpm-4.8.1.tar.bz2
/rpm-4.9.0-beta1.tar.bz2

View File

@ -1,16 +0,0 @@
diff --git a/build/rpmfc.c b/build/rpmfc.c
index 94fb68e..525915b 100644
--- a/build/rpmfc.c
+++ b/build/rpmfc.c
@@ -1093,6 +1093,11 @@ assert(s != NULL);
free(buf);
}
+ /* Add possible GStreamer provides */
+ if (!fc->skipProv && isDSO) {
+ xx = rpmfcHelper(fc, 'P', "gstreamer");
+ }
+
exit:
soname = _free(soname);
if (elf) (void) elf_end(elf);

View File

@ -1,157 +0,0 @@
diff -up rpm-4.7.90.git9278/build/rpmfc.c.devel-autodep rpm-4.7.90.git9278/build/rpmfc.c
--- rpm-4.7.90.git9278/build/rpmfc.c.devel-autodep 2009-09-01 10:45:07.000000000 +0300
+++ rpm-4.7.90.git9278/build/rpmfc.c 2009-09-01 11:00:15.000000000 +0300
@@ -501,7 +501,7 @@ static const struct rpmfcTokens_s const
{ "GLS_BINARY_LSB_FIRST", RPMFC_WHITE|RPMFC_INCLUDE },
{ " DB ", RPMFC_WHITE|RPMFC_INCLUDE },
- { "symbolic link to", RPMFC_SYMLINK },
+ { "symbolic link to", RPMFC_SYMLINK|RPMFC_INCLUDE },
{ "socket", RPMFC_DEVICE },
{ "special", RPMFC_DEVICE },
{ " text", RPMFC_TEXT|RPMFC_INCLUDE },
@@ -663,6 +663,105 @@ rpmds rpmfcRequires(rpmfc fc)
/**
+ * Ensure that symlinks for shared libs generate a dep on the shared lib
+ * @param fc file classifier
+ * @return 0 on success
+ */
+static int rpmfcSYMLINK(rpmfc fc)
+{
+ const char * fn = fc->fn[fc->ix];
+ struct stat sb;
+ int fdno;
+
+ if (fc->skipReq)
+ return 0;
+
+ if (stat(fn, &sb) < 0)
+ return -1;
+ if (S_ISLNK(sb.st_mode))
+ return -1;
+
+ fdno = open(fn, O_RDONLY);
+ if (fdno < 0) {
+ return fdno;
+ }
+
+#if HAVE_GELF_H && HAVE_LIBELF
+ Elf * elf = NULL;
+ GElf_Ehdr ehdr_mem, * ehdr;
+ int isElf64 = 0;
+ int i, cnt;
+ char * soname = NULL;
+ rpmds ds;
+
+ (void) elf_version(EV_CURRENT);
+ elf = NULL;
+ if ((elf = elf_begin (fdno, ELF_C_READ_MMAP, NULL)) == NULL
+ || elf_kind(elf) != ELF_K_ELF
+ || (ehdr = gelf_getehdr(elf, &ehdr_mem)) == NULL
+ || ehdr->e_type != ET_DYN)
+ goto exit;
+
+/* alpha uses /lib, not /lib64 so don't add (64bit) deps */
+#if !defined(__alpha__)
+ isElf64 = ehdr->e_ident[EI_CLASS] == ELFCLASS64;
+#endif
+
+ for (i = 0; i < ehdr->e_phnum; ++i) {
+ GElf_Phdr phdr_mem;
+ GElf_Phdr *phdr = gelf_getphdr (elf, i, &phdr_mem);
+ GElf_Shdr shdr_mem;
+ Elf_Data * data = NULL;
+ Elf_Scn * scn;
+ GElf_Shdr *shdr;
+
+ if (phdr == NULL || phdr->p_type != PT_DYNAMIC)
+ continue;
+
+ scn = gelf_offscn(elf, phdr->p_offset);
+ shdr = gelf_getshdr(scn, &shdr_mem);
+
+ if (shdr != NULL && shdr->sh_type == SHT_DYNAMIC)
+ data = elf_getdata (scn, NULL);
+ if (data == NULL)
+ continue;
+
+ for (cnt = 0; cnt < shdr->sh_size / shdr->sh_entsize; ++cnt) {
+ GElf_Dyn dynmem;
+ GElf_Dyn *dyn = gelf_getdyn (data, cnt, &dynmem);
+ char *depname = NULL;
+
+ if (dyn == NULL)
+ break;
+ if (dyn->d_tag != DT_SONAME)
+ continue;
+
+ /* add the soname to package deps */
+ soname = elf_strptr(elf, shdr->sh_link, dyn->d_un.d_val);
+ if (soname == NULL)
+ break;
+
+ rasprintf(&depname, "%s%s", soname, isElf64 ? "()(64bit)" : "");
+ /* Add to package dependencies. */
+ ds = rpmdsSingle(RPMTAG_REQUIRENAME, depname, "",
+ RPMSENSE_FIND_REQUIRES);
+ free(depname);
+
+ rpmdsMerge(&fc->requires, ds);
+ rpmfcAddFileDep(&fc->ddict, fc->ix, ds);
+ ds = rpmdsFree(ds);
+ break;
+ }
+ }
+exit:
+ if (elf) (void) elf_end(elf);
+ close(fdno);
+ return 0;
+#endif
+ return -1;
+}
+
+/**
* Extract script dependencies.
* @param fc file classifier
* @return 0 on success
@@ -1118,6 +1217,7 @@ static const struct rpmfcApplyTbl_s cons
RPMFC_PERL|RPMFC_PYTHON|RPMFC_MONO|RPMFC_OCAML|
RPMFC_PKGCONFIG|RPMFC_LIBTOOL) },
{ rpmfcMISC, RPMFC_FONT|RPMFC_TEXT },
+ { rpmfcSYMLINK, RPMFC_SYMLINK },
{ NULL, 0 }
};
@@ -1138,6 +1238,7 @@ rpmRC rpmfcApply(rpmfc fc)
int ix;
int i;
int xx;
+ int skipping = 0;
/* Generate package and per-file dependencies. */
for (fc->ix = 0; fc->fn[fc->ix] != NULL; fc->ix++) {
@@ -1192,11 +1293,13 @@ rpmRC rpmfcApply(rpmfc fc)
default:
break;
case 'P':
+ skipping = fc->skipProv;
ds = rpmdsSingle(RPMTAG_PROVIDENAME, N, EVR, Flags);
dix = rpmdsFind(fc->provides, ds);
ds = rpmdsFree(ds);
break;
case 'R':
+ skipping = fc->skipReq;
ds = rpmdsSingle(RPMTAG_REQUIRENAME, N, EVR, Flags);
dix = rpmdsFind(fc->requires, ds);
ds = rpmdsFree(ds);
@@ -1218,7 +1321,7 @@ assert(dix >= 0);
previx = ix;
xx = argiAdd(&fc->fddictx, ix, argiCount(fc->ddictx)-1);
}
- if (fc->fddictn && fc->fddictn->vals)
+ if (fc->fddictn && fc->fddictn->vals && !skipping)
fc->fddictn->vals[ix]++;
}

View File

@ -1,92 +0,0 @@
diff -up rpm-4.7.90.git9301/lib/tagexts.c.fedora-specspo rpm-4.7.90.git9301/lib/tagexts.c
--- rpm-4.7.90.git9301/lib/tagexts.c.fedora-specspo 2009-09-02 13:59:38.000000000 +0300
+++ rpm-4.7.90.git9301/lib/tagexts.c 2009-09-02 14:51:10.000000000 +0300
@@ -460,12 +460,6 @@ static int filerequireTag(Header h, rpmt
}
/* I18N look aside diversions */
-
-#if defined(ENABLE_NLS)
-extern int _nl_msg_cat_cntr; /* XXX GNU gettext voodoo */
-#endif
-static const char * const language = "LANGUAGE";
-
static const char * const _macro_i18ndomains = "%{?_i18ndomains}";
/**
@@ -477,61 +471,27 @@ static const char * const _macro_i18ndom
*/
static int i18nTag(Header h, rpmTag tag, rpmtd td, headerGetFlags hgflags)
{
- char * dstring = rpmExpand(_macro_i18ndomains, NULL);
- int rc;
-
- td->type = RPM_STRING_TYPE;
- td->data = NULL;
- td->count = 0;
-
- if (dstring && *dstring) {
- char *domain, *de;
- const char * langval;
- char * msgkey;
- const char * msgid;
-
- rasprintf(&msgkey, "%s(%s)", headerGetString(h, RPMTAG_NAME),
- rpmTagGetName(tag));
-
- /* change to en_US for msgkey -> msgid resolution */
- langval = getenv(language);
- (void) setenv(language, "en_US", 1);
-#if defined(ENABLE_NLS)
- ++_nl_msg_cat_cntr;
-#endif
+ int rc = headerGet(h, tag, td, HEADERGET_ALLOC);
+ if (rc) {
+ char *de, *dstring = rpmExpand(_macro_i18ndomains, NULL);
+ const char *domain;
- msgid = NULL;
for (domain = dstring; domain != NULL; domain = de) {
+ const char *msgid = td->data;
+ const char *msg = NULL;
+
de = strchr(domain, ':');
if (de) *de++ = '\0';
- msgid = dgettext(domain, msgkey);
- if (msgid != msgkey) break;
- }
-
- /* restore previous environment for msgid -> msgstr resolution */
- if (langval)
- (void) setenv(language, langval, 1);
- else
- unsetenv(language);
-#if defined(ENABLE_NLS)
- ++_nl_msg_cat_cntr;
-#endif
-
- if (domain && msgid) {
- td->data = dgettext(domain, msgid);
- td->data = xstrdup(td->data); /* XXX xstrdup has side effects. */
- td->count = 1;
- td->flags = RPMTD_ALLOCED;
+ msg = dgettext(domain, td->data);
+ if (msg != msgid) {
+ free(td->data);
+ td->data = xstrdup(msg);
+ break;
+ }
}
- dstring = _free(dstring);
- free(msgkey);
- if (td->data)
- return 1;
+ free(dstring);
}
- dstring = _free(dstring);
-
- rc = headerGet(h, tag, td, HEADERGET_ALLOC);
return rc;
}

View File

@ -1,30 +0,0 @@
commit 2d468d2cd9d2a5e2f9adcdecdd9f017fe04eb77a
Author: Till Maas <opensource@till.name>
Date: Thu May 20 11:35:16 2010 +0300
Search all locale dirs in find-lang.sh, not just those under share/ (#159)
diff --git a/scripts/find-lang.sh b/scripts/find-lang.sh
index bb25b31..e33ed0c 100755
--- a/scripts/find-lang.sh
+++ b/scripts/find-lang.sh
@@ -1,7 +1,7 @@
#!/bin/sh
#findlang - automagically generate list of language specific files
#for inclusion in an rpm spec file.
-#This does assume that the *.mo files are under .../share/locale/...
+#This does assume that the *.mo files are under .../locale/...
#Run with no arguments gets a usage message.
#findlang is copyright (c) 1998 by W. L. Estes <wlestes@uncg.edu>
@@ -99,8 +99,8 @@ done
find $TOP_DIR -type f -o -type l|sed '
s:'"$TOP_DIR"'::
-'"$ALL_NAME$MO"'s:\(.*/share/locale/\)\([^/_]\+\)\(.*\.mo$\):%lang(\2) \1\2\3:
-'"$NO_ALL_NAME$MO"'s:\(.*/share/locale/\)\([^/_]\+\)\(.*/'"$NAME"'\.mo$\):%lang(\2) \1\2\3:
+'"$ALL_NAME$MO"'s:\(.*/locale/\)\([^/_]\+\)\(.*\.mo$\):%lang(\2) \1\2\3:
+'"$NO_ALL_NAME$MO"'s:\(.*/locale/\)\([^/_]\+\)\(.*/'"$NAME"'\.mo$\):%lang(\2) \1\2\3:
s:^\([^%].*\)::
s:%lang(C) ::
/^$/d' > $MO_NAME

View File

@ -1,12 +0,0 @@
diff -up rpm-4.8.0/scripts/pkgconfigdeps.sh.pkgconfig-private rpm-4.8.0/scripts/pkgconfigdeps.sh
--- rpm-4.8.0/scripts/pkgconfigdeps.sh.pkgconfig-private 2010-05-27 15:24:48.000000000 +0300
+++ rpm-4.8.0/scripts/pkgconfigdeps.sh 2010-05-27 15:25:01.000000000 +0300
@@ -39,7 +39,7 @@ case $1 in
[ $i -eq 1 ] && echo "$pkgconfig"
DIR="`dirname ${filename}`"
export PKG_CONFIG_PATH="$DIR:$DIR/../../share/pkgconfig"
- $pkgconfig --print-requires "$filename" 2> /dev/null | while read n r v ; do
+ $pkgconfig --print-requires --print-requires-private "$filename" 2> /dev/null | while read n r v ; do
[ -n "$n" ] || continue
echo -n "pkgconfig($n) "
[ -n "$r" ] && [ -n "$v" ] && echo -n "$r" "$v"

View File

@ -1,393 +0,0 @@
diff -up rpm-4.8.0/build/rpmfc.c.psdriver rpm-4.8.0/build/rpmfc.c
--- rpm-4.8.0/build/rpmfc.c.psdriver 2010-03-16 10:54:04.000000000 +0200
+++ rpm-4.8.0/build/rpmfc.c 2010-03-16 10:54:04.000000000 +0200
@@ -489,6 +489,7 @@ static const struct rpmfcTokens_s const
{ " font metrics", RPMFC_WHITE|RPMFC_INCLUDE },
{ " font", RPMFC_FONT|RPMFC_INCLUDE },
{ " Font", RPMFC_FONT|RPMFC_INCLUDE },
+ { "PPD file", RPMFC_PSDRIVER|RPMFC_INCLUDE },
{ " commands", RPMFC_SCRIPT|RPMFC_INCLUDE },
{ " script", RPMFC_SCRIPT|RPMFC_INCLUDE },
@@ -1185,6 +1186,11 @@ exit:
#endif
}
+static int rpmfcPSDRIVER(rpmfc fc)
+{
+ return rpmfcHelper(fc, 'P', "psdriver");
+}
+
static int rpmfcMISC(rpmfc fc)
{
struct stat st;
@@ -1224,6 +1230,7 @@ static const struct rpmfcApplyTbl_s cons
RPMFC_PKGCONFIG|RPMFC_LIBTOOL) },
{ rpmfcMISC, RPMFC_FONT|RPMFC_TEXT },
{ rpmfcSYMLINK, RPMFC_SYMLINK },
+ { rpmfcPSDRIVER, RPMFC_PSDRIVER },
{ NULL, 0 }
};
@@ -1260,6 +1267,10 @@ rpmRC rpmfcApply(rpmfc fc)
fc->fcolor->vals[fc->ix] |= RPMFC_PYTHON;
}
}
+ /* XXX HACK: get cups driver executables also recognized as psdrivers */
+ if (strstr(fc->fn[fc->ix], "/usr/lib/cups/driver/")) {
+ fc->fcolor->vals[fc->ix] |= RPMFC_PSDRIVER;
+ }
if (fc->fcolor->vals[fc->ix])
for (fcat = rpmfcApplyTable; fcat->func != NULL; fcat++) {
@@ -1401,6 +1412,11 @@ rpmRC rpmfcClassify(rpmfc fc, ARGV_t arg
else if (rpmFileHasSuffix(s, ".pc"))
ftype = "pkgconfig file";
+ /* XXX Make cups .drv's to appear as PPD's for now */
+ else if (rpmFileHasSuffix(s, ".drv") &&
+ strstr(s, "/usr/share/cups/drv"))
+ ftype = "PPD file";
+
/* XXX skip all files in /dev/ which are (or should be) %dev dummies. */
else if (slen >= fc->brlen+sizeof("/dev/") && rstreqn(s+fc->brlen, "/dev/", sizeof("/dev/")-1))
ftype = "";
diff -up rpm-4.8.0/build/rpmfc.h.psdriver rpm-4.8.0/build/rpmfc.h
--- rpm-4.8.0/build/rpmfc.h.psdriver 2009-12-09 15:37:25.000000000 +0200
+++ rpm-4.8.0/build/rpmfc.h 2010-03-16 10:54:04.000000000 +0200
@@ -31,7 +31,8 @@ enum FCOLOR_e {
#define RPMFC_ELF (RPMFC_ELF32|RPMFC_ELF64|RPMFC_ELFMIPSN32)
/* (1 << 3) leaks into package headers, reserved */
- /* bits 4-6 unused */
+ /* bits 4-5 unused */
+ RPMFC_PSDRIVER = (1 << 6),
RPMFC_OCAML = (1 << 7),
RPMFC_PKGCONFIG = (1 << 8),
RPMFC_LIBTOOL = (1 << 9),
@@ -53,6 +54,7 @@ enum FCOLOR_e {
RPMFC_MANPAGE = (7 << 16),
RPMFC_TEXT = (8 << 16),
RPMFC_DOCUMENT = (9 << 16),
+ RPMFC_PPD = (10 << 16),
RPMFC_ARCHIVE = (1 << 20),
RPMFC_COMPRESSED = (1 << 21),
diff -up rpm-4.8.0/macros.in.psdriver rpm-4.8.0/macros.in
--- rpm-4.8.0/macros.in.psdriver 2010-03-16 10:54:04.000000000 +0200
+++ rpm-4.8.0/macros.in 2010-03-16 10:54:04.000000000 +0200
@@ -504,6 +504,7 @@ print (t)\
%__fontconfig_provides %{_rpmconfigdir}/fontconfig.prov
%__desktop_provides %{_rpmconfigdir}/desktop-file.prov
+%__psdriver_provides %{_rpmconfigdir}/postscriptdriver.prov %{buildroot}
#==============================================================================
# ---- Database configuration macros.
diff -up rpm-4.8.0/scripts/Makefile.am.psdriver rpm-4.8.0/scripts/Makefile.am
--- rpm-4.8.0/scripts/Makefile.am.psdriver 2009-12-07 16:36:49.000000000 +0200
+++ rpm-4.8.0/scripts/Makefile.am 2010-03-16 10:54:04.000000000 +0200
@@ -20,7 +20,8 @@ EXTRA_DIST = \
mono-find-requires mono-find-provides \
ocaml-find-requires.sh ocaml-find-provides.sh \
pkgconfigdeps.sh libtooldeps.sh \
- fontconfig.prov desktop-file.prov
+ fontconfig.prov desktop-file.prov \
+ postscriptdriver.prov
rpmconfig_SCRIPTS = \
brp-compress brp-python-bytecompile brp-java-gcjcompile \
@@ -34,6 +35,7 @@ rpmconfig_SCRIPTS = \
pkgconfigdeps.sh libtooldeps.sh \
ocaml-find-requires.sh ocaml-find-provides.sh \
fontconfig.prov desktop-file.prov \
+ postscriptdriver.prov \
rpmdb_loadcvt rpmdiff rpm2cpio.sh tcl.req tgpg
rpmconfig_DATA = \
diff -up rpm-4.8.0/scripts/Makefile.in.psdriver rpm-4.8.0/scripts/Makefile.in
--- rpm-4.8.0/scripts/Makefile.in.psdriver 2010-01-08 10:35:16.000000000 +0200
+++ rpm-4.8.0/scripts/Makefile.in 2010-03-16 10:54:04.000000000 +0200
@@ -317,7 +317,8 @@ EXTRA_DIST = brp-compress brp-python-byt
find-php-provides find-php-requires mono-find-requires \
mono-find-provides ocaml-find-requires.sh \
ocaml-find-provides.sh pkgconfigdeps.sh libtooldeps.sh \
- fontconfig.prov desktop-file.prov macros.perl.in macros.php.in \
+ fontconfig.prov desktop-file.prov postscriptdriver.prov \
+ macros.perl.in macros.php.in \
macros.python.in
rpmconfig_SCRIPTS = \
brp-compress brp-python-bytecompile brp-java-gcjcompile \
@@ -331,6 +332,7 @@ rpmconfig_SCRIPTS = \
pkgconfigdeps.sh libtooldeps.sh \
ocaml-find-requires.sh ocaml-find-provides.sh \
fontconfig.prov desktop-file.prov \
+ postscriptdriver.prov \
rpmdb_loadcvt rpmdiff rpm2cpio.sh tcl.req tgpg
rpmconfig_DATA = rpmdiff.cgi rpm.daily rpm.log rpm.xinetd macros.perl \
diff -up rpm-4.8.0/scripts/postscriptdriver.prov.psdriver rpm-4.8.0/scripts/postscriptdriver.prov
--- rpm-4.8.0/scripts/postscriptdriver.prov.psdriver 2010-03-16 10:54:04.000000000 +0200
+++ rpm-4.8.0/scripts/postscriptdriver.prov 2010-03-16 10:54:04.000000000 +0200
@@ -0,0 +1,261 @@
+#!/bin/bash
+shopt -s execfail
+exec -a "$0" python -- <(tail -n +4 -- "$0") "$@" || exit 0 # -*- python -*-
+
+## Copyright (C) 2009, 2010 Red Hat, Inc.
+## Author: Tim Waugh <twaugh@redhat.com>
+
+## This program is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 2 of the License, or
+## (at your option) any later version.
+
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU General Public License for more details.
+
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+import sys
+
+try:
+ import cups
+ CAN_EXAMINE_PPDS = True
+except:
+ CAN_EXAMINE_PPDS = False
+
+from getopt import getopt
+import errno
+import os
+import posix
+import re
+import shlex
+import signal
+import subprocess
+import sys
+import tempfile
+
+if len (sys.argv) > 1:
+ RPM_BUILD_ROOT = sys.argv[1]
+else:
+ RPM_BUILD_ROOT = None
+
+class TimedOut(Exception):
+ def __init__ (self):
+ Exception.__init__ (self, "Timed out")
+
+class DeviceIDs:
+ def __init__ (self):
+ self.ids = dict()
+
+ def get_dict (self):
+ return self.ids
+
+ def get_tags (self):
+ ret = []
+ for mfg, mdlset in self.ids.iteritems ():
+ mfgl = mfg.lower ().replace (" ", "_")
+ for mdl in mdlset:
+ mdll = mdl.lower ().replace (" ", "_")
+ ret.append ("postscriptdriver(%s;%s;)" % (mfgl,
+ mdll))
+
+ return ret
+
+ def __add__ (self, other):
+ if isinstance(other, DeviceIDs):
+ for omfg, omdlset in other.ids.iteritems ():
+ try:
+ mdlset = self.ids[omfg]
+ except KeyError:
+ mdlset = set()
+ self.ids[omfg] = mdlset
+
+ mdlset.update (omdlset)
+
+ return self
+
+ pieces = other.split (';')
+ mfg = mdl = None
+ for piece in pieces:
+ s = piece.split (":")
+ if len (s) != 2:
+ continue
+ key, value = s
+ key = key.upper ()
+ if key in ["MFG", "MANUFACTURER"]:
+ mfg = value
+ elif key in ["MDL", "MODEL"]:
+ mdl = value
+
+ if mfg and mdl:
+ try:
+ mdlset = self.ids[mfg]
+ except KeyError:
+ mdlset = set()
+ self.ids[mfg] = mdlset
+
+ mdlset.add (mdl)
+
+ return self
+
+class Driver:
+ def __init__ (self):
+ self.ids = DeviceIDs()
+
+ def list (self):
+ return self.ids
+
+class PPDDriver(Driver):
+ def __init__ (self, pathname=None):
+ Driver.__init__ (self)
+ self.pathname = pathname
+
+ def list (self):
+ if self.pathname != None:
+ self.examine_file (self.pathname)
+
+ return Driver.list (self)
+
+ def examine_file (self, path):
+ try:
+ ppd = cups.PPD (path)
+ except RuntimeError, e:
+ # Not a PPD file. Perhaps it's a drv file.
+ drv = DrvDriver (path)
+ self.ids += drv.list ()
+ return
+
+ attr = ppd.findAttr ('1284DeviceID')
+ while attr:
+ self.ids += attr.value
+ attr = ppd.findNextAttr ('1284DeviceID')
+
+class DynamicDriver(Driver):
+ def __init__ (self, driver):
+ Driver.__init__ (self)
+ self.driver = driver
+ signal.signal (signal.SIGALRM, self._alarm)
+
+ def _alarm (self, sig, stack):
+ raise TimedOut
+
+ def list (self):
+ signal.alarm (60)
+ env = os.environ.copy ()
+ if RPM_BUILD_ROOT:
+ buildroot = RPM_BUILD_ROOT
+ if not buildroot.endswith (os.path.sep):
+ buildroot += os.path.sep
+
+ env["DESTDIR"] = RPM_BUILD_ROOT
+ env["LD_LIBRARY_PATH"] = "%susr/lib64:%susr/lib" % (buildroot,
+ buildroot)
+
+ p = subprocess.Popen ([self.driver, "list"],
+ stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE,
+ env=env)
+ try:
+ (stdout, stderr) = p.communicate ()
+ signal.alarm (0)
+ except TimedOut:
+ posix.kill (p.pid, signal.SIGKILL)
+ raise
+
+ if stderr:
+ print >> sys.stderr, stderr
+
+ ppds = []
+ lines = stdout.split ('\n')
+ for line in lines:
+ l = shlex.split (line)
+ if len (l) < 5:
+ continue
+ self.ids += l[4]
+
+ return Driver.list (self)
+
+class DrvDriver(PPDDriver):
+ def __init__ (self, pathname):
+ PPDDriver.__init__ (self)
+ self.drv = pathname
+
+ def _alarm (self, sig, stack):
+ raise TimedOut
+
+ def list (self):
+ tmpdir = os.environ.get ("TMPDIR", "/tmp") + os.path.sep
+ outputdir = tempfile.mkdtemp (dir=tmpdir)
+
+ argv = [ "ppdc",
+ "-d", outputdir,
+ "-I", "/usr/share/cups/ppdc",
+ self.drv ]
+
+ signal.alarm (60)
+ try:
+ p = subprocess.Popen (argv,
+ stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE)
+ except OSError:
+ # ppdc not available.
+ os.rmdir (outputdir)
+ return Driver.list (self)
+
+ try:
+ (stdout, stderr) = p.communicate ()
+ signal.alarm (0)
+ except TimedOut:
+ posix.kill (p.pid, signal.SIGKILL)
+ raise
+
+ os.path.walk (outputdir, self.examine_directory, None)
+ os.rmdir (outputdir)
+ return Driver.list (self)
+
+ def examine_directory (self, unused, dirname, fnames):
+ for fname in fnames:
+ path = dirname + os.path.sep + fname
+ self.examine_file (path)
+ os.unlink (path)
+
+class TagBuilder:
+ def __init__ (self, filelist=None):
+ if filelist == None:
+ filelist = sys.stdin
+
+ paths = map (lambda x: x.rstrip (), filelist.readlines ())
+ self.ids = DeviceIDs ()
+
+ for path in paths:
+ if path.find ("/usr/lib/cups/driver/") != -1:
+ try:
+ self.ids += DynamicDriver (path).list ()
+ except TimedOut:
+ pass
+ except OSError, (e, s):
+ if e == errno.EACCES or e == errno.ENOENT:
+ # Not executable
+ pass
+ else:
+ raise
+
+ if CAN_EXAMINE_PPDS:
+ for path in paths:
+ try:
+ self.ids += PPDDriver (path).list ()
+ except TimedOut:
+ pass
+
+ def get_tags (self):
+ return self.ids.get_tags ()
+
+if __name__ == "__main__":
+ builder = TagBuilder ()
+ tags = builder.get_tags ()
+ for tag in tags:
+ print tag

View File

@ -1,74 +0,0 @@
commit 7617dfec85012a75bf15dec963f2f9a65e8550d9
Author: Panu Matilainen <pmatilai@redhat.com>
Date: Wed Feb 3 12:26:23 2010 +0200
brp-python-bytecompile fixes + improvements (RhBug:558997)
- fix incorrect paths (eg /site-packages/filename.py instead of
/usr/lib/pythonX.Y/site-packages/filename.py) ending up in bytecode
- add a "strict" mode where byte-compilation errors will abort the build
- when in non-strict mode, byte-compile everything we can instead of
bailing out at first error
- patch originally from Toshio Kuratomi, slightly changed to preserve
the original order of arguments to avoid unnecessary incompatibilities
diff --git a/scripts/brp-python-bytecompile b/scripts/brp-python-bytecompile
index 9fac5a7..79996ea 100644
--- a/scripts/brp-python-bytecompile
+++ b/scripts/brp-python-bytecompile
@@ -1,4 +1,5 @@
#!/bin/bash
+errors_terminate=$2
# If using normal root, avoid changing anything.
if [ -z "$RPM_BUILD_ROOT" -o "$RPM_BUILD_ROOT" = "/" ]; then
@@ -33,16 +34,25 @@ fi
# and below /usr/lib/python3.1/, we're targetting /usr/bin/python3.1
shopt -s nullglob
-for python_libdir in $RPM_BUILD_ROOT/usr/lib*/python*/ ;
+for python_libdir in $RPM_BUILD_ROOT/usr/lib{,64}/python[0-9].[0-9]/ ;
do
python_binary=/usr/bin/$(basename $python_libdir)
+ real_libdir=${python_libdir/$RPM_BUILD_ROOT/}
echo "Bytecompiling .py files below $python_libdir using $python_binary"
# Generate normal (.pyc) byte-compiled files.
- $python_binary -c 'import compileall; compileall.compile_dir("'"$python_libdir"'", '"$depth"', "/", force=1, quiet=1)'
+ $python_binary -c 'import compileall, sys; sys.exit(not compileall.compile_dir("'"$python_libdir"'", '"$depth"', "'"$real_libdir"'", force=1, quiet=1))'
+ if [ $? -ne 0 -a 0$errors_terminate -ne 0 ]; then
+ # One or more of the files had a syntax error
+ exit 1
+ fi
# Generate optimized (.pyo) byte-compiled files.
- $python_binary -O -c 'import compileall; compileall.compile_dir("'"$python_libdir"'", '"$depth"', "/", force=1, quiet=1)'
+ $python_binary -O -c 'import compileall, sys; sys.exit(not compileall.compile_dir("'"$python_libdir"'", '"$depth"', "'"$real_libdir"'", force=1, quiet=1))'
+ if [ $? -ne 0 -a 0$errors_terminate -ne 0 ]; then
+ # One or more of the files had a syntax error
+ exit 1
+ fi
done
@@ -50,12 +60,16 @@ done
# implementation:
# Generate normal (.pyc) byte-compiled files.
-$default_python -c 'import compileall, re, sys; sys.exit (not compileall.compile_dir("'"$RPM_BUILD_ROOT"'", '"$depth"', "/", 1, re.compile(r"'"/bin/|/sbin/|/usr/lib.*/python.+/"'"), quiet=1))'
-if [ $? != 0 ]; then
+$default_python -c 'import compileall, re, sys; sys.exit (not compileall.compile_dir("'"$RPM_BUILD_ROOT"'", '"$depth"', "/", 1, re.compile(r"'"/bin/|/sbin/|/usr/lib(64)?/python[0-9]\.[0-9]"'"), quiet=1))'
+if [ $? -ne 0 -a 0$errors_terminate -ne 0 ]; then
# One or more of the files had a syntax error
- # XXX TODO: parametrize the exit code, only warn for now
- exit 0
+ exit 1
fi
# Generate optimized (.pyo) byte-compiled files.
-$default_python -O -c 'import compileall, re; compileall.compile_dir("'"$RPM_BUILD_ROOT"'", '"$depth"', "/", 1, re.compile(r"'"/bin/|/sbin/|/usr/lib.*/python.+/"'"))' > /dev/null
+$default_python -O -c 'import compileall, re, sys; sys.exit(not compileall.compile_dir("'"$RPM_BUILD_ROOT"'", '"$depth"', "/", 1, re.compile(r"'"/bin/|/sbin/|/usr/lib(64)?/python[0-9]\.[0-9]"'"), quiet=1))' > /dev/null
+if [ $? -ne 0 -a 0$errors_terminate -ne 0 ]; then
+ # One or more of the files had a syntax error
+ exit 1
+fi
+exit 0

View File

@ -1,37 +0,0 @@
diff --git a/scripts/pythondeps.sh b/scripts/pythondeps.sh
index 7ccd076..7bf6fec 100755
--- a/scripts/pythondeps.sh
+++ b/scripts/pythondeps.sh
@@ -5,17 +5,27 @@
exit 0
}
-PYVER=`python -c "import sys; v=sys.version_info[:2]; print '%d.%d'%v"`
case $1 in
-P|--provides)
shift
- grep "/usr/bin/python\*\$" >& /dev/null && echo "python(abi) = ${PYVER}"
- exit 0
+ # Match buildroot/payload paths of the form
+ # /PATH/OF/BUILDROOT/usr/bin/pythonMAJOR.MINOR
+ # generating a line of the form
+ # python(abi) = MAJOR.MINOR
+ # (Don't match against -config tools e.g. /usr/bin/python2.6-config)
+ grep "/usr/bin/python.\..$" \
+ | sed -e "s|.*/usr/bin/python\(.\..\)|python(abi) = \1|"
;;
-R|--requires)
shift
- grep "/usr/lib[^/]*/python${PYVER}/" >& /dev/null && echo "python(abi) = ${PYVER}"
- exit 0
+ # Match buildroot paths of the form
+ # /PATH/OF/BUILDROOT/usr/lib/pythonMAJOR.MINOR/ and
+ # /PATH/OF/BUILDROOT/usr/lib64/pythonMAJOR.MINOR/
+ # generating (uniqely) lines of the form:
+ # python(abi) = MAJOR.MINOR
+ grep "/usr/lib[^/]*/python.\../.*" \
+ | sed -e "s|.*/usr/lib[^/]*/python\(.\..\)/.*|python(abi) = \1|g" \
+ | sort | uniq
;;
esac

View File

@ -1,31 +0,0 @@
From 53045d5dcdce3988e2586cb315b35e6a675a8152 Mon Sep 17 00:00:00 2001
From: Panu Matilainen <pmatilai@redhat.com>
Date: Wed, 30 Jun 2010 11:57:17 +0300
Subject: [PATCH 1/2] Fix potential getOutputFrom() error on font provide extraction (RhBug:609117)
- if fonts are detected in the package being built but fc-query isn't
present, the script exited without consuming stdin which can break
getOutputFrom()
---
scripts/fontconfig.prov | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/scripts/fontconfig.prov b/scripts/fontconfig.prov
index 8638680..594851d 100755
--- a/scripts/fontconfig.prov
+++ b/scripts/fontconfig.prov
@@ -12,7 +12,10 @@
fcquery=/usr/bin/fc-query
-[ -x $fcquery ] || exit 0
+if [ ! -x $fcquery ]; then
+ cat > /dev/null
+ exit 0
+fi
# filter out anything outside main fontconfig path
grep /usr/share/fonts/ |
--
1.7.0.1

View File

@ -1,20 +0,0 @@
commit 9570a7f6af152e2f1e63181ad8a20d12a10e3c5b
Author: Tom Tromey <tromey@redhat.com>
Date: Mon Aug 9 15:22:51 2010 +0300
Create GDB index from find-debuginfo if possible (RhBug:617166)
- Details in https://fedoraproject.org/wiki/Features/GdbIndex
diff --git a/scripts/find-debuginfo.sh b/scripts/find-debuginfo.sh
index 01456da..3ada962 100644
--- a/scripts/find-debuginfo.sh
+++ b/scripts/find-debuginfo.sh
@@ -207,6 +207,8 @@ while read nlinks inum f; do
$strict && exit 2
fi
+ [ -x /usr/bin/gdb-add-index ] && /usr/bin/gdb-add-index "$f" > /dev/null 2>&1
+
# A binary already copied into /usr/lib/debug doesn't get stripped,
# just has its file names collected and adjusted.
case "$dn" in

View File

@ -1,28 +0,0 @@
From 5711982e27c70bea4017632255a94630ea10d1ab Mon Sep 17 00:00:00 2001
From: Panu Matilainen <pmatilai@redhat.com>
Date: Wed, 30 Jun 2010 12:27:56 +0300
Subject: [PATCH 2/2] Make the infamous getOutputFrom() error message more useful
- ...like actually saying what was the failing script, doh
- leaving the function name there for a googling hint
---
build/rpmfc.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/build/rpmfc.c b/build/rpmfc.c
index e76363a..3c915f5 100644
--- a/build/rpmfc.c
+++ b/build/rpmfc.c
@@ -234,7 +234,8 @@ top:
if ((nbw = write(toProg[1], writePtr,
(1024<writeBytesLeft) ? 1024 : writeBytesLeft)) < 0) {
if (errno != EAGAIN) {
- perror("getOutputFrom()");
+ rpmlog(RPMLOG_ERR, _("%s: failure writing to %s: %m\n"),
+ __func__, argv[0]);
exit(EXIT_FAILURE);
}
nbw = 0;
--
1.7.0.1

113
rpm.spec
View File

@ -4,14 +4,16 @@
%bcond_with int_bdb
# run internal testsuite?
%bcond_without check
# disable plugins initially
%bcond_with plugins
%{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")}
%define rpmhome /usr/lib/rpm
%define rpmver 4.8.1
%define snapver %{nil}
%define srcver %{rpmver}
%define rpmver 4.9.0
%define snapver beta1
%define srcver %{rpmver}%{?snapver:-%{snapver}}
%define bdbname db4
%define bdbver 4.8.30
@ -20,39 +22,29 @@
Summary: The RPM package management system
Name: rpm
Version: %{rpmver}
Release: 7%{?dist}
Release: %{?snapver:0.%{snapver}.}1%{?dist}
Group: System Environment/Base
Url: http://www.rpm.org/
Source0: http://rpm.org/releases/rpm-4.8.x/%{name}-%{srcver}.tar.bz2
%if %{with int_bdb}
Source1: db-%{bdbver}.tar.gz
%endif
Source10: libsymlink.attr
Patch0: rpm-4.7.90-devel-autodep.patch
Patch1: rpm-4.5.90-pkgconfig-path.patch
Patch2: rpm-4.5.90-gstreamer-provides.patch
# Fedora specspo is setup differently than what rpm expects, considering
# this as Fedora-specific patch for now
Patch3: rpm-4.7.90-fedora-specspo.patch
# Postscript driver provides extraction is Fedora specific for now
Patch4: rpm-4.8.0-psdriver-deps.patch
Patch2: rpm-4.8.90-fedora-specspo.patch
# In current Fedora, man-pages pkg owns all the localized man directories
Patch5: rpm-4.8.0-no-man-dirs.patch
Patch3: rpm-4.8.0-no-man-dirs.patch
# gnupg2 comes installed by default, avoid need to drag in gnupg too
Patch6: rpm-4.8.1-use-gpg2.patch
Patch4: rpm-4.8.1-use-gpg2.patch
# Patches already in upstream
Patch200: rpm-4.8.0-pythondeps-parallel.patch
Patch201: rpm-4.8.0-python-bytecompile.patch
Patch202: rpm-4.8.0-findlang-localedirs.patch
Patch203: rpm-4.8.1-eat-stdin.patch
Patch204: rpm-4.8.1-getoutput-emsg.patch
Patch205: rpm-4.8.1-find-debuginfo-gdb-index.patch
# These are not yet upstream
Patch301: rpm-4.6.0-niagara.patch
Patch302: rpm-4.7.1-geode-i686.patch
Patch303: rpm-4.8.0-pkgconfig-private.patch
# Partially GPL/LGPL dual-licensed and some bits with BSD
# SourceLicense: (GPLv2+ and LGPLv2+ with exceptions) and BSD
@ -87,6 +79,8 @@ BuildRequires: popt-devel%{_isa} >= 1.10.2
BuildRequires: file-devel%{_isa}
BuildRequires: gettext-devel%{_isa}
BuildRequires: libselinux-devel%{_isa}
# XXX semanage is only used by sepolicy plugin but configure requires it...
BuildRequires: libsemanage-devel%{_isa}
BuildRequires: ncurses-devel%{_isa}
BuildRequires: bzip2-devel%{_isa} >= 0.9.0c-2
BuildRequires: python-devel%{_isa} >= 2.6
@ -118,11 +112,24 @@ Requires: libcap%{_isa} >= 2.16
%description libs
This package contains the RPM shared libraries.
%package build-libs
Summary: Libraries for building and signing RPM packages
Group: Development/Libraries
License: GPLv2+ and LGPLv2+ with exceptions
Requires: rpm-libs%{_isa} = %{version}-%{release}
Requires: %{_bindir}/gpg2
%description build-libs
This package contains the RPM shared libraries for building and signing
packages.
%package devel
Summary: Development files for manipulating RPM packages
Group: Development/Libraries
License: GPLv2+ and LGPLv2+ with exceptions
Requires: rpm = %{version}-%{release}
Requires: rpm-libs%{_isa} = %{version}-%{release}
Requires: rpm-build-libs%{_isa} = %{version}-%{release}
Requires: popt-devel%{_isa}
%description devel
@ -151,6 +158,14 @@ Conflicts: ocaml-runtime < 3.11.1-7
The rpm-build package contains the scripts and executable programs
that are used to build packages using the RPM Package Manager.
%package sign
Summary: Package signing support
Group: System Environment/Base
Requires: rpm-build-libs%{_isa} = %{version}-%{release}
%description sign
This package contains support for digitally signing RPM packages.
%package python
Summary: Python bindings for apps which will manipulate RPM packages
Group: Development/Libraries
@ -185,24 +200,13 @@ packages on a system.
%prep
%setup -q -n %{name}-%{srcver} %{?with_int_bdb:-a 1}
%patch0 -p1 -b .devel-autodep
%patch1 -p1 -b .pkgconfig-path
%patch2 -p1 -b .gstreamer-prov
%patch3 -p1 -b .fedora-specspo
%patch4 -p1 -b .psdriver-deps
%patch5 -p1 -b .no-man-dirs
%patch6 -p1 -b .use-gpg2
%patch200 -p1 -b .pythondeps-parallel
%patch201 -p1 -b .python-bytecompile
%patch202 -p1 -b .findlang-localedirs
%patch203 -p1 -b .eat-stdin
%patch204 -p1 -b .getoutput-emsg
%patch205 -p1 -b .find-debuginfo-gdb-index
%patch2 -p1 -b .fedora-specspo
%patch3 -p1 -b .no-man-dirs
%patch4 -p1 -b .use-gpg2
%patch301 -p1 -b .niagara
%patch302 -p1 -b .geode
%patch303 -p1 -b .pkgconfig-private
%if %{with int_bdb}
ln -s db-%{bdbver} db
@ -226,6 +230,7 @@ export CPPFLAGS CFLAGS LDFLAGS
--sharedstatedir=%{_var}/lib \
--libdir=%{_libdir} \
%{!?with_int_bdb: --with-external-db} \
%{!?with_plugins: --disable-plugins} \
--with-lua \
--with-selinux \
--with-cap \
@ -248,11 +253,12 @@ install -m 644 scripts/rpm.log ${RPM_BUILD_ROOT}%{_sysconfdir}/logrotate.d/rpm
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/rpm
install -m 644 %{SOURCE10} ${RPM_BUILD_ROOT}%{rpmhome}/fileattrs/libsymlink.attr
mkdir -p $RPM_BUILD_ROOT/var/lib/rpm
for dbi in \
Basenames Conflictname Dirnames Group Installtid Name Packages \
Providename Provideversion Requirename Requireversion Triggername \
Filedigests Pubkeys Sha1header Sigmd5 Obsoletename \
Basenames Conflictname Dirnames Group Installtid Name Obsoletename \
Packages Providename Requirename Triggername Sha1header Sigmd5 \
__db.001 __db.002 __db.003 __db.004 __db.005 __db.006 __db.007 \
__db.008 __db.009
do
@ -312,11 +318,14 @@ exit 0
/bin/rpm
%{_bindir}/rpm2cpio
%{_bindir}/rpmdb
%{_bindir}/rpmkeys
%{_bindir}/rpmsign
%{_bindir}/rpmquery
%{_bindir}/rpmverify
%{_mandir}/man8/rpm.8*
%{_mandir}/man8/rpmdb.8*
%{_mandir}/man8/rpmkeys.8*
%{_mandir}/man8/rpm2cpio.8*
# XXX this places translated manuals to wrong package wrt eg rpmbuild
@ -334,7 +343,6 @@ exit 0
%{rpmhome}/rpmdb_*
%{rpmhome}/rpm.daily
%{rpmhome}/rpm.log
%{rpmhome}/rpm.xinetd
%{rpmhome}/rpm2cpio.sh
%{rpmhome}/tgpg
@ -342,15 +350,27 @@ exit 0
%files libs
%defattr(-,root,root)
%{_libdir}/librpm*.so.*
%{_libdir}/librpmio.so.*
%{_libdir}/librpm.so.*
%if %{with plugins}
%{_libdir}/rpm-plugins
%endif
%files build-libs
%defattr(-,root,root)
%{_libdir}/librpmbuild.so.*
%{_libdir}/librpmsign.so.*
%files build
%defattr(-,root,root)
%{_bindir}/rpmbuild
%{_bindir}/gendiff
%{_bindir}/rpmspec
%{_mandir}/man1/gendiff.1*
%{_mandir}/man8/rpmbuild.8*
%{_mandir}/man8/rpmdeps.8*
%{_mandir}/man8/rpmspec.8*
%{rpmhome}/brp-*
%{rpmhome}/check-*
@ -364,8 +384,13 @@ exit 0
%{rpmhome}/*.req
%{rpmhome}/config.*
%{rpmhome}/mkinstalldirs
%{rpmhome}/rpmdiff*
%{rpmhome}/macros.*
%{rpmhome}/fileattrs
%files sign
%defattr(-,root,root)
%{_bindir}/rpmsign
%{_mandir}/man8/rpmsign.8*
%files python
%defattr(-,root,root)
@ -389,6 +414,18 @@ exit 0
%doc COPYING doc/librpm/html/*
%changelog
* Tue Jan 18 2011 Panu Matilainen <pmatilai@redhat.com> - 4.9.0-0.beta1.1
- rpm 4.9.0-beta1 (http://rpm.org/wiki/Releases/4.9.0)
- drop no longer needed patches
- adjust requires + buildrequires to match current needs
- adjust rpmdb index ghosts to match the new release
- split librpmbuild and librpmsign to a separate rpm-build-libs package
- split rpmsign to its own package to allow signing without all the build goo
- build-conditionalize plugins, disabled for now
- gstreamer and printer dependency generation moving out
- handle .so symlink dependencies with fileattrs
- use gnupg2 for signing as that's what typically installed by default
* Tue Jan 18 2011 Panu Matilainen <pmatilai@redhat.com> - 4.8.1-7
- bunch of spec tweaks, cleanups + corrections:
- shorten rpm-build filelist a bit with glob use, reorder for saner grouping

View File

@ -1 +1 @@
85b9cabd384ffe47b7c3ffb396133fb1 rpm-4.8.1.tar.bz2
38684f12db6d68f42d69a0b1ce28b3c7 rpm-4.9.0-beta1.tar.bz2