summaryrefslogtreecommitdiffstats
path: root/perl-install/printer
diff options
context:
space:
mode:
authorTill Kamppeter <tkamppeter@mandriva.com>2006-01-09 18:26:53 +0000
committerTill Kamppeter <tkamppeter@mandriva.com>2006-01-09 18:26:53 +0000
commit7efe66b8fce05cf3d46bb4b08422780fbf4f4ca0 (patch)
tree5aceccd33fb185090f778e4473863955d508e877 /perl-install/printer
parent70002b40da8ccd8f2cae49f490df12c86f422be4 (diff)
downloaddrakx-7efe66b8fce05cf3d46bb4b08422780fbf4f4ca0.tar
drakx-7efe66b8fce05cf3d46bb4b08422780fbf4f4ca0.tar.gz
drakx-7efe66b8fce05cf3d46bb4b08422780fbf4f4ca0.tar.bz2
drakx-7efe66b8fce05cf3d46bb4b08422780fbf4f4ca0.tar.xz
drakx-7efe66b8fce05cf3d46bb4b08422780fbf4f4ca0.zip
- Make sure that when a user supplies an updated PPD file, the new
file and not the old one from the system gets used.
Diffstat (limited to 'perl-install/printer')
-rw-r--r--perl-install/printer/main.pm28
1 files changed, 28 insertions, 0 deletions
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;