Dist-git and spec file cleanup
This commit is contained in:
parent
b7799d8e8a
commit
90c3a152e8
@ -1,137 +0,0 @@
|
|||||||
#!/usr/bin/python3
|
|
||||||
|
|
||||||
## gutenprint-foomaticppdupdate
|
|
||||||
|
|
||||||
## A utility for updating foomatic-generated PPDs so that they work with
|
|
||||||
## a newly-installed gutenprint package.
|
|
||||||
|
|
||||||
## Copyright (C) 2007, 2009, 2014 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
|
|
||||||
import glob
|
|
||||||
import os
|
|
||||||
import subprocess
|
|
||||||
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):
|
|
||||||
p = subprocess.Popen (["foomatic-ppdfile", "-p", printer, "-d", driver],
|
|
||||||
stdin=subprocess.DEVNULL,
|
|
||||||
stdout=subprocess.PIPE,
|
|
||||||
stderr=subprocess.PIPE)
|
|
||||||
(ppd, stderr) = p.communicate ()
|
|
||||||
fname = ppdfile + ".tmp"
|
|
||||||
try:
|
|
||||||
with open (fname, "w") as f:
|
|
||||||
f.write (ppd)
|
|
||||||
except IOError as e:
|
|
||||||
print (e)
|
|
||||||
raise
|
|
||||||
|
|
||||||
ppdobj = cups.PPD (fname)
|
|
||||||
os.remove (fname)
|
|
||||||
return ppdobj
|
|
||||||
|
|
||||||
def update_ppdfile (ppdfile):
|
|
||||||
try:
|
|
||||||
ppd = cups.PPD (ppdfile)
|
|
||||||
except RuntimeError:
|
|
||||||
# Invalid PPD in some way.
|
|
||||||
return
|
|
||||||
|
|
||||||
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.
|
|
||||||
firstdot = gutenprint_version.find ('.')
|
|
||||||
seconddot = firstdot + 1 + gutenprint_version[1 + firstdot:].find ('.')
|
|
||||||
major = gutenprint_version[:seconddot]
|
|
||||||
|
|
||||||
driver = IDs[1]
|
|
||||||
dot = driver.find ('.')
|
|
||||||
driver = driver[:dot] + "." + major
|
|
||||||
try:
|
|
||||||
genppd = generate_ppd (ppdfile, IDs[0], driver)
|
|
||||||
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)
|
|
||||||
|
|
||||||
with open (ppdfile, "w") as f:
|
|
||||||
genppd.writeFd (f.fileno ())
|
|
||||||
print ("Updated PPD file %s" % ppdfile)
|
|
||||||
|
|
||||||
for ppdfile in glob.glob ("/etc/cups/ppd/*.ppd"):
|
|
||||||
update_ppdfile (ppdfile)
|
|
@ -1,47 +0,0 @@
|
|||||||
.\" Copyright (C) 2000 Roger Leigh <rleigh@debian.org>
|
|
||||||
.\" Copyright (C) 2014 Red Hat, Inc.
|
|
||||||
.\"
|
|
||||||
.\" 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, 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
||||||
.\"
|
|
||||||
.\" Based on cups-genppdupdate(8)
|
|
||||||
.\"
|
|
||||||
.TH GUTENPRINT-FOOMATICPPDUPDATE "8" "05 Aug 2014" "5.2.10" "Gutenprint"
|
|
||||||
.SH NAME
|
|
||||||
gutenprint-foomaticppdupdate \- update Gutenprint Foomatic PPD files
|
|
||||||
.SH SYNOPSIS
|
|
||||||
.B gutenprint-foomaticppdupdate VERSION
|
|
||||||
.SH DESCRIPTION
|
|
||||||
\fBgutenprint\-foomaticppdupdate\fP regenerates the \fIGutenprint\fP
|
|
||||||
Foomatic PPD files in use by CUPS, using freshly generated Foomatic
|
|
||||||
PPD files as templates. The new PPD file replaces the old PPD file
|
|
||||||
under \fI/etc/cups/ppd\fP, but all the options set in the old PPD will
|
|
||||||
be merged into the new PPD, provided that they are still valid in the
|
|
||||||
new file.
|
|
||||||
.PP
|
|
||||||
\fBgutenprint\-foomaticppdupdate\fP does \fBnot\fP restart cupsd.
|
|
||||||
cupsd will need manual reloading (or send SIGHUP) once
|
|
||||||
\fBgutenprint\-foomaticppdupdate\fP has completed.
|
|
||||||
.PP
|
|
||||||
This is not intended to be used directly but instead is run
|
|
||||||
automatically on package upgrade.
|
|
||||||
.SH OPTIONS
|
|
||||||
.B VERSION
|
|
||||||
The version number of the Gutenprint package just installed.
|
|
||||||
.SH SEE ALSO
|
|
||||||
.BR cups\-genppdupdate (8)
|
|
||||||
.PP
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
|
||||||
it under the terms fo the GNU General Public License, version 2, or
|
|
||||||
(at your option) any later version.
|
|
@ -27,18 +27,14 @@ Source0: http://downloads.sourceforge.net/gimp-print/%{name}-%{version}.t
|
|||||||
Source1: cups-genppdupdate.py.in
|
Source1: cups-genppdupdate.py.in
|
||||||
# ported from old gimp-print package - fix for a menu in gimp gutenprint plugin
|
# ported from old gimp-print package - fix for a menu in gimp gutenprint plugin
|
||||||
Patch0: gutenprint-menu.patch
|
Patch0: gutenprint-menu.patch
|
||||||
Patch3: gutenprint-postscriptdriver.patch
|
Patch1: gutenprint-postscriptdriver.patch
|
||||||
Patch4: gutenprint-yyin.patch
|
Patch2: gutenprint-yyin.patch
|
||||||
Patch5: gutenprint-manpage.patch
|
Patch3: gutenprint-manpage.patch
|
||||||
Patch6: gutenprint-python36syntax.patch
|
Patch4: gutenprint-python36syntax.patch
|
||||||
Patch7: gutenprint-xmlfixes.patch
|
Patch5: gutenprint-xmlfixes.patch
|
||||||
Patch8: gutenprint-libusb-crash.patch
|
Patch6: gutenprint-libusb-crash.patch
|
||||||
License: GPL-2.0-or-later AND LGPL-2.0-or-later AND MIT AND GPL-3.0-or-later WITH Bison-exception-2.2
|
License: GPL-2.0-or-later AND LGPL-2.0-or-later AND MIT AND GPL-3.0-or-later WITH Bison-exception-2.2
|
||||||
|
|
||||||
#### removed patches, because the seems useless
|
|
||||||
# I'll leave them here, in case its removal will break something
|
|
||||||
#Patch1: gutenprint-O6.patch
|
|
||||||
#Patch2: gutenprint-selinux.patch
|
|
||||||
|
|
||||||
Requires: %{name}-libs%{?_isa} = %{version}-%{release}
|
Requires: %{name}-libs%{?_isa} = %{version}-%{release}
|
||||||
|
|
||||||
@ -163,17 +159,13 @@ Epson, HP and compatible printers.
|
|||||||
%prep
|
%prep
|
||||||
%setup -q -n %{name}-%{version}
|
%setup -q -n %{name}-%{version}
|
||||||
# Fix menu placement of GIMP plugin.
|
# Fix menu placement of GIMP plugin.
|
||||||
%patch0 -p1 -b .menu
|
%patch -P 0 -p1 -b .menu
|
||||||
# Don't use -O6 compiler option.
|
|
||||||
#%%patch1 -p1 -b .O6
|
|
||||||
# Restore file contexts when updating PPDs.
|
|
||||||
#%%patch2 -p1 -b .selinux
|
|
||||||
# Allow the CUPS dynamic driver to run inside a build root.
|
# Allow the CUPS dynamic driver to run inside a build root.
|
||||||
%patch3 -p1 -b .postscriptdriver
|
%patch -P 1 -p1 -b .postscriptdriver
|
||||||
# Don't export yy* symbols (bug #882194).
|
# Don't export yy* symbols (bug #882194).
|
||||||
%patch4 -p1 -b .yyin
|
%patch -P 2 -p1 -b .yyin
|
||||||
# Added some escputil options to the manpage (bug #979064).
|
# Added some escputil options to the manpage (bug #979064).
|
||||||
%patch5 -p1 -b .manpage
|
%patch -P 3 -p1 -b .manpage
|
||||||
|
|
||||||
cp %{SOURCE1} src/cups/cups-genppdupdate.in
|
cp %{SOURCE1} src/cups/cups-genppdupdate.in
|
||||||
|
|
||||||
@ -181,11 +173,11 @@ cp %{SOURCE1} src/cups/cups-genppdupdate.in
|
|||||||
sed -i -e 's,^#!/usr/bin/python3,#!%{__python3},' src/cups/cups-genppdupdate.in
|
sed -i -e 's,^#!/usr/bin/python3,#!%{__python3},' src/cups/cups-genppdupdate.in
|
||||||
|
|
||||||
# Python 3.6 invalid escape sequence deprecation fixes, COPYING as license (bug #1448303)
|
# Python 3.6 invalid escape sequence deprecation fixes, COPYING as license (bug #1448303)
|
||||||
%patch6 -p1 -b .python36syntax
|
%patch -P 4 -p1 -b .python36syntax
|
||||||
# fix xml error reported by rpminspect, sent upstream via email
|
# fix xml error reported by rpminspect, sent upstream via email
|
||||||
%patch7 -p1 -b .xmlfixes
|
%patch -P 5 -p1 -b .xmlfixes
|
||||||
# 2055504 - Set gutenprint53+usb backend to use the default USB context
|
# 2055504 - Set gutenprint53+usb backend to use the default USB context
|
||||||
%patch8 -p1 -b .crash
|
%patch -P 6 -p1 -b .crash
|
||||||
|
|
||||||
%build
|
%build
|
||||||
# Don't run the weave test as it takes a very long time.
|
# Don't run the weave test as it takes a very long time.
|
||||||
|
Loading…
Reference in New Issue
Block a user