- CUPS driver: if DESTDIR is set, use it when looking for XML files. Fixes

postscriptdriver tags.
This commit is contained in:
Tim Waugh 2010-02-05 15:27:26 +00:00
parent 0b5f6fa8a2
commit 1bd8b5cc15
2 changed files with 107 additions and 2 deletions

View File

@ -0,0 +1,99 @@
diff -up gutenprint-5.2.4/src/main/module.c.postscriptdriver gutenprint-5.2.4/src/main/module.c
--- gutenprint-5.2.4/src/main/module.c.postscriptdriver 2006-09-30 16:02:59.000000000 +0100
+++ gutenprint-5.2.4/src/main/module.c 2010-02-05 10:01:18.668652991 +0000
@@ -151,12 +151,20 @@ int stp_module_load(void)
}
else
{
+ const char *prefix = getenv("DESTDIR");
#ifdef USE_LTDL
stp_path_split(dir_list, getenv("LTDL_LIBRARY_PATH"));
stp_path_split(dir_list, lt_dlgetsearchpath());
#else
stp_path_split(dir_list, PKGMODULEDIR);
#endif
+ if (prefix)
+ {
+ stp_list_t *prefix_list;
+ prefix_list = stp_paths_copy_with_prefix(dir_list, prefix);
+ stp_list_destroy(dir_list);
+ dir_list = prefix_list;
+ }
}
#ifdef USE_LTDL
file_list = stp_path_search(dir_list, ".la");
diff -up gutenprint-5.2.4/src/main/path.c.postscriptdriver gutenprint-5.2.4/src/main/path.c
--- gutenprint-5.2.4/src/main/path.c.postscriptdriver 2008-06-01 15:41:18.000000000 +0100
+++ gutenprint-5.2.4/src/main/path.c 2010-02-05 10:33:18.117778663 +0000
@@ -158,7 +158,17 @@ stpi_data_path(void)
if (getenv("STP_DATA_PATH"))
stp_path_split(dir_list, getenv("STP_DATA_PATH"));
else
- stp_path_split(dir_list, PKGXMLDATADIR);
+ {
+ const char *prefix = getenv("DESTDIR");
+ stp_path_split(dir_list, PKGXMLDATADIR);
+ if (prefix)
+ {
+ stp_list_t *prefix_list;
+ prefix_list = stp_paths_copy_with_prefix(dir_list, prefix);
+ stp_list_destroy(dir_list);
+ dir_list = prefix_list;
+ }
+ }
return dir_list;
}
@@ -226,6 +236,40 @@ stp_path_split(stp_list_t *list, /* List
}
}
+/*
+ * Split a PATH-type string (colon-delimited) into separate
+ * directories.
+ */
+stp_list_t *
+stp_paths_copy_with_prefix(stp_list_t *list, /* List to add prefix to */
+ const char *prefix) /* Prefix to add */
+{
+ stp_list_t *new_list;
+ stp_list_item_t *item;
+ int prefixlen = strlen (prefix);
+ if (!(new_list = stp_list_create()))
+ return;
+
+ item = stp_list_get_start (list);
+ while (item)
+ {
+ const char *data;
+ char *new_data;
+ int len;
+ data = stp_list_item_get_data (item);
+ len = strlen (data);
+ new_data = (char *) stp_malloc(prefixlen + 1 + len + 1);
+ strncpy(new_data, prefix, prefixlen);
+ new_data[prefixlen] = '/';
+ strcpy(new_data + prefixlen + 1, data);
+ stp_list_item_create(new_list, NULL, new_data);
+
+ item = stp_list_item_next (item);
+ }
+
+ return new_list;
+}
+
/* Adapted from GNU libc <dirent.h>
These macros extract size information from a `struct dirent *'.
They may evaluate their argument multiple times, so it must not
diff -up gutenprint-5.2.4/src/main/util.h.postscriptdriver gutenprint-5.2.4/src/main/util.h
--- gutenprint-5.2.4/src/main/util.h.postscriptdriver 2007-02-24 21:49:22.000000000 +0000
+++ gutenprint-5.2.4/src/main/util.h 2010-02-05 10:24:16.253778762 +0000
@@ -61,6 +61,8 @@ extern void stpi_init_printer(void);
#define BUFFER_FLAG_FLIP_X 0x1
#define BUFFER_FLAG_FLIP_Y 0x2
extern stp_image_t* stpi_buffer_image(stp_image_t* image, unsigned int flags);
+extern stp_list_t *stp_paths_copy_with_prefix(stp_list_t* list,
+ const char *prefix);
/** @} */

View File

@ -4,7 +4,7 @@
Name: gutenprint Name: gutenprint
Summary: Printer Drivers Package. Summary: Printer Drivers Package.
Version: 5.2.4 Version: 5.2.4
Release: 10%{?dist} Release: 11%{?dist}
Group: System Environment/Base Group: System Environment/Base
URL: http://gimp-print.sourceforge.net/ URL: http://gimp-print.sourceforge.net/
Source0: http://dl.sf.net/gimp-print/gutenprint-%{version}.tar.bz2 Source0: http://dl.sf.net/gimp-print/gutenprint-%{version}.tar.bz2
@ -15,6 +15,7 @@ Patch1: gutenprint-O6.patch
Patch2: gutenprint-selinux.patch Patch2: gutenprint-selinux.patch
Patch3: gutenprint-deviceid.patch Patch3: gutenprint-deviceid.patch
Patch4: gutenprint-brother-hl-2040.patch Patch4: gutenprint-brother-hl-2040.patch
Patch5: gutenprint-postscriptdriver.patch
License: GPLv2+ License: GPLv2+
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: cups-libs >= 1.1.22-0.rc1.9.10, cups >= 1.1.22-0.rc1.9.10 BuildRequires: cups-libs >= 1.1.22-0.rc1.9.10, cups >= 1.1.22-0.rc1.9.10
@ -30,7 +31,7 @@ Obsoletes: gimp-print-utils <= 4.2.7-25
Provides: gimp-print-utils = 4.2.7-25 Provides: gimp-print-utils = 4.2.7-25
# Make sure we get postscriptdriver tags. # Make sure we get postscriptdriver tags.
BuildRequires: pycups BuildRequires: pycups, cups
## NOTE ## ## NOTE ##
# The README file in this package contains suggestions from upstream # The README file in this package contains suggestions from upstream
@ -145,6 +146,7 @@ Epson, HP and compatible printers.
%patch2 -p1 -b .selinux %patch2 -p1 -b .selinux
%patch3 -p1 -b .deviceid %patch3 -p1 -b .deviceid
%patch4 -p1 -b .brother-hl-2040 %patch4 -p1 -b .brother-hl-2040
%patch5 -p1 -b .postscriptdriver
cp %{SOURCE2} src/cups/cups-genppdupdate.in cp %{SOURCE2} src/cups/cups-genppdupdate.in
@ -273,6 +275,10 @@ fi
/bin/rm -f /var/cache/foomatic/* /bin/rm -f /var/cache/foomatic/*
%changelog %changelog
* Fri Feb 5 2010 Tim Waugh <twaugh@redhat.com> 5.2.4-11
- CUPS driver: if DESTDIR is set, use it when looking for XML files.
Fixes postscriptdriver tags.
* Thu Feb 4 2010 Tim Waugh <twaugh@redhat.com> 5.2.4-10 * Thu Feb 4 2010 Tim Waugh <twaugh@redhat.com> 5.2.4-10
- Rebuild for postscriptdriver tags. - Rebuild for postscriptdriver tags.