diff options
author | Didier Raboud <odyx@debian.org> | 2015-08-09 14:40:26 +0200 |
---|---|---|
committer | Didier Raboud <odyx@debian.org> | 2015-08-09 14:40:26 +0200 |
commit | 92976f71a4aa7f84cd8aadf013d2b03873dead7c (patch) | |
tree | cf693495783f07f67a0a2c8c12437fd6ed220593 /src/cups/cups-genppdupdate.in | |
parent | 58b4abe145a14a936e420a3ba5b7d0c6c56fa839 (diff) |
Imported Upstream version 5.2.11~pre1
Diffstat (limited to 'src/cups/cups-genppdupdate.in')
-rw-r--r-- | src/cups/cups-genppdupdate.in | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/src/cups/cups-genppdupdate.in b/src/cups/cups-genppdupdate.in index 66d0a46..61b7206 100644 --- a/src/cups/cups-genppdupdate.in +++ b/src/cups/cups-genppdupdate.in @@ -1,5 +1,5 @@ #! @PERL@ -w -# $Id: cups-genppdupdate.in,v 1.60 2012/02/14 23:11:41 tillkamppeter Exp $ +# $Id: cups-genppdupdate.in,v 1.61 2014/06/04 01:16:47 rlk Exp $ # Update CUPS PPDs for Gutenprint queues. # Copyright (C) 2002-2003 Roger Leigh (rleigh@debian.org) # @@ -57,7 +57,8 @@ my $micro_version = "@GUTENPRINT_VERSION@"; my $use_static_ppd = "@BUILD_CUPS_PPDS@"; my $file_version = '"@VERSION@"$'; -my $ppd_dir = "@cups_conf_serverroot@/ppd"; # Location of in-use CUPS PPDs +my $system_ppd_dir = "@cups_conf_serverroot@/ppd";# Location of in-use CUPS PPDs +my $ppd_dir = $system_ppd_dir; # Location of in-use CUPS PPDs my $ppd_root_dir = "@cups_conf_datadir@/model"; my $ppd_base_dir = "$ppd_root_dir/gutenprint/$version"; # Available PPDs my $ppd_out_dir = ""; # By default output into source directory @@ -181,7 +182,8 @@ if (!$quiet || $verbose) { print STDOUT ", $skipped_ppd_count skipped"; } print STDOUT "."; - if (!defined $opt_o || $opt_o ne "") { + if ($ppd_out_dir eq $system_ppd_dir || + ($ppd_dir eq $system_ppd_dir && $ppd_out_dir eq "")) { print STDOUT " Restart cupsd for the changes to take effect."; } print STDOUT "\n"; @@ -590,6 +592,25 @@ sub update_ppd ($) { $source_data =~ s/(\*StpLocale:\s*\")(.*)(\")/$1$orig_locale$3/; } + # PageRegion, PageSize, Imageablearea, and PaperDimension need to match. + # ImageableArea and PaperDimension may be broken from cups-genppdupdate + # in 5.2.10 and earlier not updating them, but PageRegion and PageSize + # should match. Use PageSize as the default, but warn if PageSize + # and PageRegion don't match. + + if ($defaults{"DefaultPageSize"} ne $defaults{"DefaultPageRegion"}) { + warn("Warning: DefaultPageSize $defaults{'DefaultPageSize'} and DefaultPageRegion $defaults{'DefaultPageRegion'} don't match. Using $defaults{'DefaultPageSize'} for both.\n"); + $defaults{"DefaultPageRegion"} = $defaults{"DefaultPageSize"}; + } + if ($defaults{"DefaultPageSize"} ne $defaults{"DefaultImageableArea"}) { + print STDERR "Correcting DefaultImageableArea from $defaults{'DefaultImageableArea'} to $defaults{'DefaultPageSize'}\n"; + $defaults{"DefaultImageableArea"} = $defaults{"DefaultPageSize"}; + } + if ($defaults{"DefaultPageSize"} ne $defaults{"DefaultPaperDimension"}) { + print STDERR "Correcting DefaultPaperDimension from $defaults{'DefaultPaperDimension'} to $defaults{'DefaultPageSize'}\n"; + $defaults{"DefaultPaperDimension"} = $defaults{"DefaultPageSize"}; + } + if ($debug & 4) { print "Options (Old->New Default Type):\n"; foreach (sort keys %options) { @@ -666,6 +687,7 @@ default_loop: my $new_default = $new_defaults{$default_option}; if ((!defined($orig_method) || !defined($new_method)) || $orig_method ne $new_method) { + $source_data =~ s/^\*($default_option).*/*$1: $default_option_value/m; next; } if (defined($new_default) && @@ -698,7 +720,7 @@ default_loop: (defined $resolution_map{$dopt}) && ($dopt = $resolution_map{$dopt}) eq $opt)) { # Valid option # Set the option in the new PPD - $source_data =~ s/^\*($default_option).*/*$1:$dopt/m; + $source_data =~ s/^\*($default_option).*/*$1: $dopt/m; if ($verbose) { print "$ppd_source_filename: Set *$default_option to $dopt\n"; } |