rpm/rpm-4.8.0-psdriver-fixes.patch

87 lines
2.8 KiB
Diff

--- rpm-4.8.0/macros.in 2010-02-04 17:42:32.228100971 +0000
+++ rpm-4.8.0/macros.in.postscriptdriver-fixes 2010-02-04 17:43:03.867226950 +0000
@@ -504,7 +504,7 @@ print (t)\
%__fontconfig_provides %{_rpmconfigdir}/fontconfig.prov
%__desktop_provides %{_rpmconfigdir}/desktop-file.prov
-%__psdriver_provides %{_rpmconfigdir}/postscriptdriver.prov
+%__psdriver_provides %{_rpmconfigdir}/postscriptdriver.prov %{buildroot}
#==============================================================================
# ---- Database configuration macros.
--- rpm-4.8.0/scripts/postscriptdriver.prov 2010-02-04 17:25:15.672102648 +0000
+++ rpm-4.8.0/scripts/postscriptdriver.prov.postscriptdriver-fixes 2010-02-05 10:46:44.517778993 +0000
@@ -1,6 +1,6 @@
#!/bin/bash
shopt -s execfail
-exec -a "$0" python -- "$@" <(tail -n +4 -- "$0") || exit 0 # -*- python -*-
+exec -a "$0" python -- <(tail -n +4 -- "$0") "$@" || exit 0 # -*- python -*-
## Copyright (C) 2009, 2010 Red Hat, Inc.
## Author: Tim Waugh <twaugh@redhat.com>
@@ -23,21 +23,26 @@ import sys
try:
import cups
- CAN_EXAMINE_PPDS=True
+ CAN_EXAMINE_PPDS = True
except:
- CAN_EXAMINE_PPDS=False
+ CAN_EXAMINE_PPDS = False
from getopt import getopt
+import errno
import os
import posix
import re
import shlex
import signal
-import stat
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")
@@ -139,9 +144,20 @@ class DynamicDriver(Driver):
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)
+ stderr=subprocess.PIPE,
+ env=env)
try:
(stdout, stderr) = p.communicate ()
signal.alarm (0)
@@ -214,6 +230,12 @@ class TagBuilder:
self.ids += DynamicDriver (path).list ()
except TimedOut:
pass
+ except OSError, e:
+ if e == errno.EACCES or e == errno.ENOENT:
+ # Not executable
+ pass
+ else:
+ raise
if CAN_EXAMINE_PPDS:
for path in paths: