Blame SOURCES/cups-deprecate-drivers.patch

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

Add Printer

b03539
+

Add Printer {printer_name}

b03539
 
b03539
 

Printer {printer_name} has been added

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

FAIL: $count warning messages, expected 8.

" >>$strfile
b03539
+	echo "    

FAIL: $count warning messages, expected 10.

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