Blame SOURCES/cups-deprecate-drivers.patch

ad8523
diff --git a/cgi-bin/admin.c b/cgi-bin/admin.c
ad8523
index 02b9d9d..669cb65 100644
ad8523
--- a/cgi-bin/admin.c
ad8523
+++ b/cgi-bin/admin.c
ad8523
@@ -619,6 +619,7 @@ do_am_printer(http_t *http,		/* I - HTTP connection */
ad8523
 		*oldinfo;		/* Old printer information */
ad8523
   const cgi_file_t *file;		/* Uploaded file, if any */
ad8523
   const char	*var;			/* CGI variable */
ad8523
+  char	*ppd_name = NULL;	/* Pointer to PPD name */
ad8523
   char		uri[HTTP_MAX_URI],	/* Device or printer URI */
ad8523
 		*uriptr,		/* Pointer into URI */
ad8523
 		evefile[1024] = "";	/* IPP Everywhere PPD file */
ad8523
@@ -1124,12 +1125,12 @@ do_am_printer(http_t *http,		/* I - HTTP connection */
ad8523
 
ad8523
     if (!file)
ad8523
     {
ad8523
-      var = cgiGetVariable("PPD_NAME");
ad8523
-      if (!strcmp(var, "everywhere"))
ad8523
+      ppd_name = cgiGetVariable("PPD_NAME");
ad8523
+      if (!strcmp(ppd_name, "everywhere"))
ad8523
         get_printer_ppd(cgiGetVariable("DEVICE_URI"), evefile, sizeof(evefile));
ad8523
-      else if (strcmp(var, "__no_change__"))
ad8523
+      else if (strcmp(ppd_name, "__no_change__"))
ad8523
 	ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "ppd-name",
ad8523
-		     NULL, var);
ad8523
+		     NULL, ppd_name);
ad8523
     }
ad8523
 
ad8523
     ippAddString(request, IPP_TAG_PRINTER, IPP_TAG_TEXT, "printer-location",
ad8523
@@ -1219,7 +1220,7 @@ do_am_printer(http_t *http,		/* I - HTTP connection */
ad8523
 
ad8523
       cgiCopyTemplateLang("printer-modified.tmpl");
ad8523
     }
ad8523
-    else
ad8523
+    else if (ppd_name && (strcmp(ppd_name, "everywhere") == 0 || strstr(ppd_name, "driverless")))
ad8523
     {
ad8523
      /*
ad8523
       * Set the printer options...
ad8523
@@ -1229,6 +1230,16 @@ do_am_printer(http_t *http,		/* I - HTTP connection */
ad8523
       do_set_options(http, 0);
ad8523
       return;
ad8523
     }
ad8523
+    else
ad8523
+    {
ad8523
+     /*
ad8523
+      * If we don't have an everywhere model, show printer-added
ad8523
+      * template with warning about drivers going away...
ad8523
+      */
ad8523
+
ad8523
+      cgiStartHTML(title);
ad8523
+      cgiCopyTemplateLang("printer-added.tmpl");
ad8523
+    }
ad8523
 
ad8523
     cgiEndHTML();
ad8523
   }
ad8523
diff --git a/scheduler/printers.c b/scheduler/printers.c
ad8523
index 3bfe4a8..248bdba 100644
ad8523
--- a/scheduler/printers.c
ad8523
+++ b/scheduler/printers.c
ad8523
@@ -950,6 +950,8 @@ cupsdLoadAllPrinters(void)
ad8523
 			*value,		/* Pointer to value */
ad8523
 			*valueptr;	/* Pointer into value */
ad8523
   cupsd_printer_t	*p;		/* Current printer */
ad8523
+  int			found_raw = 0;		/* Flag whether raw queue is installed */
ad8523
+  int			found_driver = 0;		/* Flag whether queue with classic driver is installed */
ad8523
 
ad8523
 
ad8523
  /*
ad8523
@@ -1025,6 +1027,30 @@ cupsdLoadAllPrinters(void)
ad8523
 
ad8523
         cupsdSetPrinterAttrs(p);
ad8523
 
ad8523
+	if ((p->device_uri && strncmp(p->device_uri, "ipp:", 4) && strncmp(p->device_uri, "ipps:", 5) && strncmp(p->device_uri, "implicitclass:", 14)) ||
ad8523
+	    !p->make_model ||
ad8523
+	    (p->make_model && strstr(p->make_model, "IPP Everywhere") == NULL && strstr(p->make_model, "driverless") == NULL))
ad8523
+	{
ad8523
+	 /*
ad8523
+	  * Warn users about printer drivers and raw queues will be deprecated.
ad8523
+	  * It will warn users in the following scenarios:
ad8523
+	  * - the queue doesn't use ipp, ipps or implicitclass backend, which means
ad8523
+	  *   it doesn't communicate via IPP and is raw or uses a driver for sure
ad8523
+	  * - the queue doesn't have make_model - it is raw
ad8523
+	  * - the queue uses a correct backend, but the model is not IPP Everywhere/driverless
ad8523
+	  */
ad8523
+	  if (!p->make_model)
ad8523
+	  {
ad8523
+	    cupsdLogMessage(CUPSD_LOG_DEBUG, "Queue %s is a raw queue, which is deprecated.", p->name);
ad8523
+	    found_raw = 1;
ad8523
+	  }
ad8523
+	  else
ad8523
+	  {
ad8523
+	    cupsdLogMessage(CUPSD_LOG_DEBUG, "Queue %s uses a printer driver, which is deprecated.", p->name);
ad8523
+	    found_driver = 1;
ad8523
+	  }
ad8523
+	}
ad8523
+
ad8523
         if (strncmp(p->device_uri, "file:", 5) && p->state != IPP_PRINTER_STOPPED)
ad8523
 	{
ad8523
 	 /*
ad8523
@@ -1415,6 +1441,12 @@ cupsdLoadAllPrinters(void)
ad8523
     }
ad8523
   }
ad8523
 
ad8523
+  if (found_raw)
ad8523
+    cupsdLogMessage(CUPSD_LOG_WARN, "Raw queues are deprecated and will stop working in a future version of CUPS. See https://github.com/OpenPrinting/cups/issues/103");
ad8523
+
ad8523
+  if (found_driver)
ad8523
+    cupsdLogMessage(CUPSD_LOG_WARN, "Printer drivers are deprecated and will stop working in a future version of CUPS. See https://github.com/OpenPrinting/cups/issues/103");
ad8523
+
ad8523
   cupsFileClose(fp);
ad8523
 }
ad8523
 
ad8523
diff --git a/systemv/lpadmin.c b/systemv/lpadmin.c
ad8523
index ca6d386..daf24d5 100644
ad8523
--- a/systemv/lpadmin.c
ad8523
+++ b/systemv/lpadmin.c
ad8523
@@ -632,7 +632,7 @@ main(int  argc,				/* I - Number of command-line arguments */
ad8523
 
ad8523
     num_options = cupsRemoveOption("ppd-name", num_options, &options);
ad8523
   }
ad8523
-  else if (ppd_name || file)
ad8523
+  else if ((ppd_name && strncmp(ppd_name, "driverless:", 11)) || file)
ad8523
   {
ad8523
     _cupsLangPuts(stderr, _("lpadmin: Printer drivers are deprecated and will stop working in a future version of CUPS."));
ad8523
   }
ad8523
diff --git a/templates/choose-model.tmpl b/templates/choose-model.tmpl
ad8523
index e916cf8..9c9b71f 100644
ad8523
--- a/templates/choose-model.tmpl
ad8523
+++ b/templates/choose-model.tmpl
ad8523
@@ -39,7 +39,7 @@
ad8523
 
ad8523
 <SELECT NAME="PPD_NAME" SIZE="10">
ad8523
 {op=add-printer?:<OPTION VALUE="__no_change__" SELECTED>Current Driver - {current_make_and_model}</OPTION>:}
ad8523
-{show_ipp_everywhere?<OPTION VALUE="everywhere" SELECTED>{current_make_and_model} - IPP Everywhere ™</OPTION>:}
ad8523
+{show_ipp_everywhere?<OPTION VALUE="everywhere" SELECTED>{current_make_and_model?{current_make_and_model} -:} IPP Everywhere ™</OPTION>:}
ad8523
 {[ppd_name]<OPTION VALUE="{ppd_name}" {op=modify-printer?:{?current_make_and_model={ppd_make_and_model}?SELECTED:}}>{ppd_make_and_model} ({ppd_natural_language})
ad8523
 }</SELECT>
ad8523
 
ad8523
diff --git a/templates/printer-added.tmpl b/templates/printer-added.tmpl
ad8523
index 0ccf6d3..9ebc835 100644
ad8523
--- a/templates/printer-added.tmpl
ad8523
+++ b/templates/printer-added.tmpl
ad8523
@@ -1,4 +1,15 @@
ad8523
-

Add Printer

ad8523
+

Add Printer {printer_name}

ad8523
 
ad8523
 

Printer {printer_name} has been added

ad8523
 successfully.
ad8523
+
ad8523
+
ad8523
+Note:Printer drivers and raw queues are deprecated and will stop working in a future version of CUPS.
ad8523
+
ad8523
+
ad8523
+<FORM ACTION="admin/" METHOD="POST">
ad8523
+<INPUT TYPE="HIDDEN" NAME="org.cups.sid" VALUE="{$org.cups.sid}">
ad8523
+<INPUT TYPE="HIDDEN" NAME="OP" VALUE="set-printer-options">
ad8523
+<INPUT TYPE="HIDDEN" NAME="printer_name" VALUE="{printer_name}">
ad8523
+<INPUT TYPE="SUBMIT" VALUE="Set Printer Options">
ad8523
+</FORM>
ad8523
diff --git a/test/run-stp-tests.sh b/test/run-stp-tests.sh
ad8523
index 4498a8c..8776874 100755
ad8523
--- a/test/run-stp-tests.sh
ad8523
+++ b/test/run-stp-tests.sh
ad8523
@@ -1049,10 +1049,10 @@ fi
ad8523
 
ad8523
 # Warning log messages
ad8523
 count=`$GREP '^W ' $BASE/log/error_log | $GREP -v CreateProfile | $GREP -v 'libusb error' | $GREP -v ColorManager | $GREP -v 'Avahi client failed' | wc -l | awk '{print $1}'`
ad8523
-if test $count != 8; then
ad8523
-	echo "FAIL: $count warning messages, expected 8."
ad8523
+if test $count != 10; then
ad8523
+	echo "FAIL: $count warning messages, expected 10."
ad8523
 	$GREP '^W ' $BASE/log/error_log
ad8523
-	echo "    

FAIL: $count warning messages, expected 8.

" >>$strfile
ad8523
+	echo "    

FAIL: $count warning messages, expected 10.

" >>$strfile
ad8523
 	echo "    
" >>$strfile
ad8523
 	$GREP '^W ' $BASE/log/error_log | sed -e '1,$s/&/&/g' -e '1,$s/</</g' >>$strfile
ad8523
 	echo "    " >>$strfile