1590014 - hplip PPD search doesn't expect '-' in device name
This commit is contained in:
parent
d6b7a484d5
commit
458a657499
134
hplip-find-driver.patch
Normal file
134
hplip-find-driver.patch
Normal file
@ -0,0 +1,134 @@
|
|||||||
|
diff --git a/prnt/cups.py b/prnt/cups.py
|
||||||
|
index a9f410a..b3e7434 100644
|
||||||
|
--- a/prnt/cups.py
|
||||||
|
+++ b/prnt/cups.py
|
||||||
|
@@ -489,49 +489,72 @@ def getPPDFile2(mq,model, ppds): # New PPD find
|
||||||
|
#Check if common ppd name is already given in models.dat(This is needed because in case of devices having more than one derivatives
|
||||||
|
#will have diffrent model name strings in device ID, because of which we don't get the common ppd name for search)
|
||||||
|
family_check=isfamilydrv(ppds)
|
||||||
|
- family_class=getFamilyClassName(model)
|
||||||
|
+
|
||||||
|
model = models.normalizeModelName(model)
|
||||||
|
- if family_check==0:
|
||||||
|
- ppd_name = mq.get('ppd-name',0)
|
||||||
|
- else:
|
||||||
|
- ppd_name = mq.get('family-ppd',0)
|
||||||
|
|
||||||
|
- if ppd_name == 0:
|
||||||
|
- stripped_model = stripModel2(model)
|
||||||
|
- else:
|
||||||
|
- stripped_model = stripModel2(ppd_name)
|
||||||
|
+ ppd_name = mq.get('{}'.format('family-ppd' if family_check else 'ppd-name'), 0)
|
||||||
|
+
|
||||||
|
+ stripped_model = stripModel2(ppd_name) if ppd_name else stripModel2(model)
|
||||||
|
+
|
||||||
|
+ wanted_model = getFamilyClassName(model) if family_check else stripped_model
|
||||||
|
|
||||||
|
log.debug("Matching PPD list to model %s..." % stripped_model)
|
||||||
|
|
||||||
|
matches = []
|
||||||
|
- if family_check ==0 :
|
||||||
|
- for f in ppds:
|
||||||
|
- match = ppd_pat.match(f)
|
||||||
|
- if match is not None:
|
||||||
|
- if match.group(1) == stripped_model:
|
||||||
|
- log.debug("Found match: %s" % f)
|
||||||
|
- try:
|
||||||
|
- pdls = match.group(2).split('-')
|
||||||
|
- except AttributeError:
|
||||||
|
- pdls = []
|
||||||
|
- if (prop.hpcups_build and 'hpijs' not in f) or \
|
||||||
|
- ((prop.hpijs_build and 'hpijs' in pdls) or (prop.hpcups_build and 'hpijs' not in pdls)) or \
|
||||||
|
- ('ps' in pdls) or ('pdf' in pdls):
|
||||||
|
- matches.append((f, [p for p in pdls if p and p != 'hpijs']))
|
||||||
|
- else:
|
||||||
|
- for f in ppds:
|
||||||
|
- match = ppd_pat1.match(f)
|
||||||
|
- if match is not None:
|
||||||
|
- if match.group(1) == family_class:
|
||||||
|
- log.debug("Found match: %s" % f)
|
||||||
|
- try:
|
||||||
|
- pdls = match.group(2).split('-')
|
||||||
|
- except AttributeError:
|
||||||
|
- pdls = []
|
||||||
|
- if (prop.hpcups_build and 'hpijs' not in f) or \
|
||||||
|
- ((prop.hpijs_build and 'hpijs' in pdls) or (prop.hpcups_build and 'hpijs' not in pdls)) or \
|
||||||
|
- ('ps' in pdls) or ('pdf' in pdls):
|
||||||
|
- matches.append((f, [p for p in pdls if p and p != 'hpijs']))
|
||||||
|
+ for f in ppds:
|
||||||
|
+ # ignore foomatic and gutenprint drivers
|
||||||
|
+ if 'foomatic' in f or 'gutenprint' in f:
|
||||||
|
+ continue
|
||||||
|
+
|
||||||
|
+ # see if driver type is in driver name
|
||||||
|
+ driver_types = []
|
||||||
|
+ if 'hpcups' in f:
|
||||||
|
+ driver_types.append('hpcups')
|
||||||
|
+ if 'hpijs' in f:
|
||||||
|
+ driver_types.append('hpijs')
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+ ppd_filename = f.rsplit('/', 1)[1].split('.')[0].replace('hp-', '')
|
||||||
|
+
|
||||||
|
+ if not ppd_filename:
|
||||||
|
+ continue
|
||||||
|
+
|
||||||
|
+ # we need to sanitize the end of filename - there can be a driver type (-hpijs, -hpcups),
|
||||||
|
+ # pdl name (-zjstream, -pdf, -ps etc.) or the device can just have '-' in their name
|
||||||
|
+ # (HP Photosmart Premium C309g-m).
|
||||||
|
+ # So if we don't know the name after '-', take it as part of device name.
|
||||||
|
+ # If we know them either like driver type of PDL, remove the string from ppd name
|
||||||
|
+ # so we can compare it with stripped model
|
||||||
|
+ pdl_candidates = []
|
||||||
|
+ pdl_candidates = ppd_filename.split('-')[1:]
|
||||||
|
+
|
||||||
|
+ pdls = []
|
||||||
|
+ ppd_model = ppd_filename
|
||||||
|
+
|
||||||
|
+ for pdl in pdl_candidates:
|
||||||
|
+ if pdl in ['hpijs', 'hpcups']:
|
||||||
|
+ ppd_model=ppd_model.replace('-{}'.format(pdl), '')
|
||||||
|
+ continue
|
||||||
|
+
|
||||||
|
+ if not models.PDL_TYPES.get(pdl):
|
||||||
|
+ log.debug('Unknown PDL named \'{}\' - can be a new PDL or '
|
||||||
|
+ 'just a part of device name. Assume it is '
|
||||||
|
+ 'a part of device name.'.format(pdl))
|
||||||
|
+ else:
|
||||||
|
+ pdls.append(pdl)
|
||||||
|
+ ppd_model=ppd_model.replace('-{}'.format(pdl), '')
|
||||||
|
+
|
||||||
|
+ if ppd_model != wanted_model:
|
||||||
|
+ continue
|
||||||
|
+
|
||||||
|
+ log.debug("Found match: %s" % f)
|
||||||
|
+
|
||||||
|
+ if (prop.hpcups_build and 'hpijs' not in f) or \
|
||||||
|
+ ((prop.hpijs_build and 'hpijs' in driver_types) or (prop.hpcups_build and 'hpijs' not in driver_types)) or \
|
||||||
|
+ ('ps' in pdls) or ('pdf' in pdls):
|
||||||
|
+ matches.append((f, pdls, [d for d in driver_types if d and d != 'hpijs']))
|
||||||
|
+
|
||||||
|
+
|
||||||
|
log.debug(matches)
|
||||||
|
num_matches = len(matches)
|
||||||
|
|
||||||
|
@@ -570,7 +593,7 @@ def getPPDFile2(mq,model, ppds): # New PPD find
|
||||||
|
# > 1
|
||||||
|
log.debug("%d matches found. Searching based on PDL: Host > PS,PDF > PCL/Other" % num_matches)
|
||||||
|
for p in [models.PDL_TYPE_HOST, models.PDL_TYPE_PS,models.PDL_TYPE_PDF, models.PDL_TYPE_PCL]:
|
||||||
|
- for f, pdl_list in matches:
|
||||||
|
+ for f, pdl_list, driver_list in matches:
|
||||||
|
for x in pdl_list:
|
||||||
|
# default to HOST-based PDLs, as newly supported PDLs will most likely be of this type
|
||||||
|
if models.PDL_TYPES.get(x, models.PDL_TYPE_HOST) == p:
|
||||||
|
@@ -579,8 +602,8 @@ def getPPDFile2(mq,model, ppds): # New PPD find
|
||||||
|
|
||||||
|
log.debug("%d matches found. Searching based on Filters: HPCUPS > HPIJS" % num_matches)
|
||||||
|
for p in ["hpcups","hpijs"]:
|
||||||
|
- for f, pdl_list in matches:
|
||||||
|
- if p in f:
|
||||||
|
+ for f, pdl_list, driver_list in matches:
|
||||||
|
+ if p in driver_list:
|
||||||
|
log.debug("Selecting PPD: %s" % (f))
|
||||||
|
return (f, '')
|
||||||
|
|
@ -138,6 +138,11 @@ Patch52: hplip-configure-python.patch
|
|||||||
# of request on cupsd
|
# of request on cupsd
|
||||||
# https://bugs.launchpad.net/hplip/+bug/1880275
|
# https://bugs.launchpad.net/hplip/+bug/1880275
|
||||||
Patch53: hplip-dialog-infinite-loop.patch
|
Patch53: hplip-dialog-infinite-loop.patch
|
||||||
|
# searching algorithm did not expect '-' in model name and thought it is a new PDL
|
||||||
|
# it resulted in incorrect PPD match, so e.g. hpijs driver was used instead of hpcups
|
||||||
|
# bug: https://bugzilla.redhat.com/show_bug.cgi?id=1590014
|
||||||
|
# reported upstream: https://bugs.launchpad.net/hplip/+bug/1881587
|
||||||
|
Patch54: hplip-find-driver.patch
|
||||||
|
|
||||||
|
|
||||||
Requires: %{name}-libs%{?_isa} = %{version}-%{release}
|
Requires: %{name}-libs%{?_isa} = %{version}-%{release}
|
||||||
@ -402,6 +407,8 @@ rm prnt/hpcups/ErnieFilter.{cpp,h} prnt/hpijs/ernieplatform.h
|
|||||||
%patch51 -p1 -b .Wreturn-fix
|
%patch51 -p1 -b .Wreturn-fix
|
||||||
%patch52 -p1 -b .configure-python
|
%patch52 -p1 -b .configure-python
|
||||||
%patch53 -p1 -b .dialog-infinite-loop
|
%patch53 -p1 -b .dialog-infinite-loop
|
||||||
|
# 1590014 - hplip PPD search doesn't expect '-' in device name
|
||||||
|
%patch54 -p1 -b .find-driver
|
||||||
|
|
||||||
sed -i.duplex-constraints \
|
sed -i.duplex-constraints \
|
||||||
-e 's,\(UIConstraints.* \*Duplex\),//\1,' \
|
-e 's,\(UIConstraints.* \*Duplex\),//\1,' \
|
||||||
@ -704,6 +711,7 @@ rm -f %{buildroot}%{_sysconfdir}/xdg/autostart/hplip-systray.desktop
|
|||||||
%changelog
|
%changelog
|
||||||
* Mon Jun 01 2020 Zdenek Dohnal <zdohnal@redhat.com> - 3.20.5-4
|
* Mon Jun 01 2020 Zdenek Dohnal <zdohnal@redhat.com> - 3.20.5-4
|
||||||
- 1794147 - HP-setup crashes with Python3 ui5 module not found error
|
- 1794147 - HP-setup crashes with Python3 ui5 module not found error
|
||||||
|
- 1590014 - hplip PPD search doesn't expect '-' in device name
|
||||||
|
|
||||||
* Tue May 26 2020 Miro Hrončok <mhroncok@redhat.com> - 3.20.5-3
|
* Tue May 26 2020 Miro Hrončok <mhroncok@redhat.com> - 3.20.5-3
|
||||||
- Rebuilt for Python 3.9
|
- Rebuilt for Python 3.9
|
||||||
|
Loading…
Reference in New Issue
Block a user