rpms/gutenprint/devel gutenprint-foomaticppdupdate, NONE, 1.1 gutenprint.spec, 1.27, 1.28
Tim Waugh (twaugh)
fedora-extras-commits at redhat.com
Mon Jul 2 17:19:40 UTC 2007
- Previous message: fedora-accounts json.py, NONE, 1.1 bz-make-components-pkgdb.py, 1.1, 1.2
- Next message: rpms/php-pear-HTML-QuickForm/EL-5 PHP-LICENSE-3.01, 1.2, 1.3 .cvsignore, 1.2, 1.3 php-pear-HTML-QuickForm.spec, 1.2, 1.3 sources, 1.2, 1.3 PHP-LICENSE-2.02, 1.1, NONE
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Author: twaugh
Update of /cvs/pkgs/rpms/gutenprint/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv30124
Modified Files:
gutenprint.spec
Added Files:
gutenprint-foomaticppdupdate
Log Message:
* Mon Jul 2 2007 Tim Waugh <twaugh at redhat.com> 5.0.1-2
- Fix up foomatic PPD files after upgrade (bug #246448).
--- NEW FILE gutenprint-foomaticppdupdate ---
#!/usr/bin/python
## gutenprint-foomaticppdupdate
## A utility for updating foomatic-generated PPDs so that they work with
## a newly-installed gutenprint package.
## Copyright (C) 2007 Red Hat, Inc.
## Copyright (C) 2007 Tim Waugh <twaugh at 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
import glob
import os
import popen2
import tempfile
import cups
if len (sys.argv) < 2 or sys.argv[1] == "--help":
print "Usage: gutenprint-foomaticppdupdate <version>"
sys.exit (1)
gutenprint_version = sys.argv[1]
dry_run = True
def generate_ppd (ppdfile, printer, driver):
(r, w) = popen2.popen2 (["foomatic-ppdfile",
"-p", printer,
"-d", driver])
w.close ()
ppd = r.readlines ()
r.close ()
fname = ppdfile + ".tmp"
try:
file(fname, "w").writelines (ppd)
except IOError, e:
print e
raise
ppdobj = cups.PPD (fname)
os.remove (fname)
return ppdobj
def update_ppdfile (ppdfile):
ppd = cups.PPD (ppdfile)
attr = ppd.findAttr ("FoomaticIDs")
if not attr:
return
IDs = attr.value.split (" ")
if len (IDs) != 2:
print "Don't understand FoomaticIDs: %s" % IDs
return
if not IDs[1].startswith ("gutenprint"):
return
attr = ppd.findAttr ("FoomaticRIPCommandLine")
if not attr:
return
cmdline = attr.value
STP_VERSION="STP_VERSION="
i = cmdline.find (STP_VERSION)
if i == -1:
return
i += len (STP_VERSION)
j = i + 1
end = len (cmdline)
while j < end:
ch = cmdline[j]
if ch != '.' and not ch.isdigit ():
break
j += 1
version = cmdline[i:j]
if gutenprint_version == version:
return
# Needs updating.
try:
genppd = generate_ppd (ppdfile, IDs[0], IDs[1])
except:
return
os.environ['FILE'] = ppdfile
os.system ('cp -af "$FILE" "$FILE".bak')
def update_options (options, newppd, origppd):
for newopt in options:
origopt = origppd.findOption (newopt.keyword)
if origopt:
newppd.markOption (newopt.keyword, origopt.defchoice)
genppd.markDefaults ()
for group in genppd.optionGroups:
update_options (group.options, genppd, ppd)
for subgroup in group.subgroups:
update_options (subgroup.options, genppd, ppd)
ps = genppd.findOption ("PageSize")
if ps:
update_options ([ps], genppd, ppd)
f = file (ppdfile, "w")
genppd.writeFd (f.fileno ())
print "Updated PPD file %s" % ppdfile
for ppdfile in glob.glob ("/etc/cups/ppd/*.ppd"):
update_ppdfile (ppdfile)
Index: gutenprint.spec
===================================================================
RCS file: /cvs/pkgs/rpms/gutenprint/devel/gutenprint.spec,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- gutenprint.spec 26 Jun 2007 16:40:08 -0000 1.27
+++ gutenprint.spec 2 Jul 2007 17:19:02 -0000 1.28
@@ -4,10 +4,11 @@
Name: gutenprint
Summary: Printer Drivers Package
Version: 5.0.1
-Release: 1%{?dist}
+Release: 2%{?dist}
Group: System Environment/Base
URL: http://gimp-print.sourceforge.net/
Source0: http://dl.sf.net/gimp-print/gutenprint-%{version}.tar.bz2
+Source1: gutenprint-foomaticppdupdate
Patch0: gutenprint-menu.patch
Patch1: gutenprint-lpstat.patch
Patch2: gutenprint-O6.patch
@@ -61,6 +62,7 @@
Summary: Foomatic printer database
Group: System Environment/Libraries
Requires: %{name} = %{version}-%{release}
+Requires(post): foomatic
Obsoletes: gimp-print <= 4.2.7-25
Provides: gimp-print = 4.2.7-25
@@ -144,6 +146,8 @@
mv %{buildroot}%{cups_serverbin}/driver/gutenprint.5.0 %{buildroot}%{_sbindir}
ln -s %{_sbindir}/gutenprint.5.0 %{buildroot}%{cups_serverbin}/driver/
+install -m755 %{SOURCE1} %{buildroot}%{_sbindir}
+
rm -rf %{buildroot}%{_datadir}/gutenprint/doc
rm -rf %{buildroot}%{_libdir}/gutenprint/5.0.0/modules/*.la
@@ -204,6 +208,7 @@
%files foomatic
%doc
%defattr(-, root, root,-)
+%{_sbindir}/gutenprint-foomaticppdupdate
%{_datadir}/foomatic/kitload.log
%{_datadir}/foomatic/db/source/driver/*
%{_datadir}/foomatic/db/source/opt/*
@@ -230,11 +235,15 @@
%post foomatic
/bin/rm -f /var/cache/foomatic/*
+%{_sbindir}/gutenprint-foomaticppdupdate %{version} || :
%postun foomatic
/bin/rm -f /var/cache/foomatic/*
%changelog
+* Mon Jul 2 2007 Tim Waugh <twaugh at redhat.com> 5.0.1-2
+- Fix up foomatic PPD files after upgrade (bug #246448).
+
* Tue Jun 26 2007 Tim Waugh <twaugh at redhat.com> 5.0.1-1
- 5.0.1.
- Previous message: fedora-accounts json.py, NONE, 1.1 bz-make-components-pkgdb.py, 1.1, 1.2
- Next message: rpms/php-pear-HTML-QuickForm/EL-5 PHP-LICENSE-3.01, 1.2, 1.3 .cvsignore, 1.2, 1.3 php-pear-HTML-QuickForm.spec, 1.2, 1.3 sources, 1.2, 1.3 PHP-LICENSE-2.02, 1.1, NONE
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the scm-commits
mailing list