From 7efe66b8fce05cf3d46bb4b08422780fbf4f4ca0 Mon Sep 17 00:00:00 2001 From: Till Kamppeter Date: Mon, 9 Jan 2006 18:26:53 +0000 Subject: - Make sure that when a user supplies an updated PPD file, the new file and not the old one from the system gets used. --- perl-install/printer/main.pm | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'perl-install/printer') diff --git a/perl-install/printer/main.pm b/perl-install/printer/main.pm index a39514b08..8abd74157 100644 --- a/perl-install/printer/main.pm +++ b/perl-install/printer/main.pm @@ -1934,6 +1934,14 @@ sub poll_ppd_base { # Remove the old entry delete $thedb{$ppdkey}; my $newkey = $key; + # User-added PPD file, mark it + if ($ppd =~ m!printerdrake/!i) { + $newkey .= ", " . N("user-supplied"); + } + # Newly added PPD file, mark it + if ($ppdfile eq "/usr/share/cups/model/$ppd") { + $newkey .= ", " . N("NEW"); + } if (!$printer->{expert}) { # Remove driver part in recommended mode $newkey =~ s/^([^\|]+\|[^\|]+)\|.*$/$1/; @@ -1957,6 +1965,12 @@ sub poll_ppd_base { $newkey =~ s/^([^\|]+\|)([^\|]+)(\|.*|)$/$1$oldmodel$3/; } + # Do not overwrite another entry which has the + # same key, consider different PPD files with + # the same identity as a bug and drop them + if ($thedb{$newkey}) { + next; + } # Create the new entry $thedb{$newkey}{ppd} = $ppd; $thedb{$newkey}{make} = $mf; @@ -2078,10 +2092,24 @@ sub poll_ppd_base { } } + # User-added PPD file, mark it + if ($ppd =~ m!printerdrake/!i) { + $key .= ", " . N("user-supplied"); + } + # Newly added PPD file, mark it + if ($ppdfile eq "/usr/share/cups/model/$ppd") { + $key .= ", " . N("NEW"); + } # Remove duplicate "recommended" tags and have the # "recommended" tag at the end $key =~ s/(\s*$sprecstr)(.*?)(\s*$sprecstr)/$2$3/; $key =~ s/(\s*$sprecstr)(.+)$/$2$1/; + # Do not overwrite another entry which has the same + # key, consider different PPD files with the same identity + # as a bug and drop them + if ($thedb{$key}) { + next; + } # Create the new entry $thedb{$key}{ppd} = $ppd; $thedb{$key}{make} = $mf; -- cgit v1.2.1