Author: jsmeix Date: Thu Oct 9 12:33:23 2008 New Revision: 52019 URL: http://svn.opensuse.org/viewcvs/yast?rev=52019&view=rev Log: - Check if the cups-client RPM is installed (strictly required) and enforce to install it (otherwise abort) and if the cups RPM is installed (not strictly required) and try to install it but let the user proceed otherwise. - Prefer 'hp:/usb/' DeviceURIs by default. The matching 'usb://HP/' is still available via "More Connections". - Using separated progress file for create_printer_ppd_database to show a progress even while waiting up to 300 seconds for a response from the lpinfo command (see Novell/Suse Bugzilla bnc#429397). - 2.17.19 Modified: trunk/printer/VERSION trunk/printer/package/yast2-printer.changes trunk/printer/src/Printer.ycp trunk/printer/tools/autodetect_printers trunk/printer/tools/create_printer_ppd_database Modified: trunk/printer/VERSION URL: http://svn.opensuse.org/viewcvs/yast/trunk/printer/VERSION?rev=52019&r1=52018&r2=52019&view=diff ============================================================================== --- trunk/printer/VERSION (original) +++ trunk/printer/VERSION Thu Oct 9 12:33:23 2008 @@ -1 +1 @@ -2.17.18 +2.17.19 Modified: trunk/printer/package/yast2-printer.changes URL: http://svn.opensuse.org/viewcvs/yast/trunk/printer/package/yast2-printer.changes?rev=52019&r1=52018&r2=52019&view=diff ============================================================================== --- trunk/printer/package/yast2-printer.changes (original) +++ trunk/printer/package/yast2-printer.changes Thu Oct 9 12:33:23 2008 @@ -1,4 +1,20 @@ ------------------------------------------------------------------- +Thu Oct 9 12:26:11 CEST 2008 - jsmeix@suse.de + +- Check if the cups-client RPM is installed (strictly required) + and enforce to install it (otherwise abort) and + if the cups RPM is installed (not strictly required) + and try to install it but let the user proceed otherwise. +- Prefer 'hp:/usb/' DeviceURIs by default. + The matching 'usb://HP/' is still available + via "More Connections". +- Using separated progress file for create_printer_ppd_database + to show a progress even while waiting up to 300 seconds + for a response from the lpinfo command + (see Novell/Suse Bugzilla bnc#429397). +- 2.17.19 + +------------------------------------------------------------------- Wed Oct 8 12:10:46 CEST 2008 - jsmeix@suse.de - The "Share Printers" dialog should now work Modified: trunk/printer/src/Printer.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/printer/src/Printer.ycp?rev=52019&r1=52018&r2=52019&view=diff ============================================================================== --- trunk/printer/src/Printer.ycp (original) +++ trunk/printer/src/Printer.ycp Thu Oct 9 12:33:23 2008 @@ -226,6 +226,7 @@ /* * Local variables: */ +string create_database_progress_filename = "/var/lib/YaST2/create_printer_ppd_database.progress" ; string database_filename = "/var/lib/YaST2/printer_ppd_database.ycp"; string create_database_commandline = "/usr/lib/YaST2/bin/create_printer_ppd_database >" + database_filename; string autodetect_printers_progress_filename = "/var/lib/YaST2/autodetect_printers.progress" ; @@ -265,9 +266,9 @@ `ReplacePoint( `id(`create_database_progress_replace_point), `DownloadProgress( // Header of a DownloadProgress indicator: _("Retrieving printer driver information..."), - database_filename, - // On my openSUSE 10.3 the size is about 1700000 bytes: - 1900000 + create_database_progress_filename, + // On my openSUSE 11.0 the size is about 80000 bytes: + 90000 ) ) ) @@ -949,6 +950,24 @@ { // Skip "usb://HP/" DeviceURIs if there is at least one "hp:/usb/" DeviceURI // so that the "hp:/usb/" DeviceURI is used with preference. // The "usb://HP/" DeviceURI is still available via "MoreConnections". + // It can happen that a "usb://HP/" DeviceURI is skipped + // without a matching "hp:/usb/" DeviceURI because + // the "hp" backend lists only devices which are known as supported by HPLIP. + // If there are two HP printers connected but only one is supported by HPLIP, + // there exists one "hp:/usb/" DeviceURI and therefore all "usb://HP/" DeviceURIs + // are skipped even the one for the HP printer which is unknown to HPLIP. + // But this is no real problem because all "usb://HP/" DeviceURIs are still + // available via "MoreConnections". + // Actually it is even good that HP printers which are unknown to HPLIP + // are skipped by default because usually we do not provide a driver + // for such printers so that the extra-cklick on "MoreConnections" may + // make the user aware that something is fishy with this particular model + // so that the user hopefully pays more attention which driver he selects. + // If a HP printer is unknown to HPLIP it does not mean that it is unsupported + // (it does also not mean that it is unsupported by HPLIP) because + // it could be simply a new model which is not yet known to HPLIP + // but compatible to a known model. In this case the user must pay attention + // which exact driver he selects manually for his particular model. if( "usb://hp/" == tolower( substring( uri, 0, 9 ) ) && hp_usb_uri_exists ) Modified: trunk/printer/tools/autodetect_printers URL: http://svn.opensuse.org/viewcvs/yast/trunk/printer/tools/autodetect_printers?rev=52019&r1=52018&r2=52019&view=diff ============================================================================== --- trunk/printer/tools/autodetect_printers (original) +++ trunk/printer/tools/autodetect_printers Thu Oct 9 12:33:23 2008 @@ -45,8 +45,12 @@ # Get the raw data: echo 'Retrieving the raw data...' >>$PROGRESS -# Continue even after timeout because then an empty YCP map is output -# which indicates that no printers were autodetected. +# Exit after timeout because it is a real error if lpinfo does not respond. +# In this case no empty YCP map is output so that either +# an existing YCP map could be used or YaST could also exit +# because printer setup makes not much sense when lpinfo does not respond. +# Note that lpinfo does respond when no printer can be autodetected +# e.g. when there is no locally connected printer. # Usually "lpinfo -l -v" needs a few seconds. # To be on the safe side, a one minute timeout is used. # Therefore the PROGRESS file can grow up to about 3600 bytes. @@ -62,6 +66,7 @@ then kill -9 $lpinfoPID &>/dev/null echo "Aborted lpinfo after $MAXIMUM_WAIT seconds timeout." 1>&2 echo "Aborted lpinfo after $MAXIMUM_WAIT seconds timeout." >>$PROGRESS + exit 3 fi # Process the data: Modified: trunk/printer/tools/create_printer_ppd_database URL: http://svn.opensuse.org/viewcvs/yast/trunk/printer/tools/create_printer_ppd_database?rev=52019&r1=52018&r2=52019&view=diff ============================================================================== --- trunk/printer/tools/create_printer_ppd_database (original) +++ trunk/printer/tools/create_printer_ppd_database Thu Oct 9 12:33:23 2008 @@ -9,6 +9,9 @@ export LANG="POSIX" umask 022 +# This file name for a progress indicator is also used in Printer.ycp: +test -z "$PROGRESS" && PROGRESS="/var/lib/YaST2/create_printer_ppd_database.progress" + MY_NAME=${0##*/} # Create temporary file names: @@ -16,6 +19,7 @@ TMP_DATA_RAW=$(mktemp -u /tmp/$MY_NAME.XXXXXX) # Test if lpstat and lpinfo are executable: +echo 'Testing if lpstat and lpinfo are executable...' >$PROGRESS LPSTAT="$( type -P lpstat )" if ! test -x "$LPSTAT" then echo "Cannot execute lpstat" 1>&2 @@ -31,6 +35,7 @@ # Only on localhost print queues should be set up. # CUPS supports even remote queue setup but this is not supported by YaST. # Therefore explicitely the cupsd on localhost is asked for printer driver information. +echo 'Testing if cupsd on localhost is accessible...' >>$PROGRESS if ! $LPSTAT -h localhost -r &>/dev/null then echo "Cannot access cupsd on localhost" 1>&2 exit 2 @@ -39,28 +44,32 @@ # Input: # Get the raw data: +echo 'Retrieving the raw data...' >>$PROGRESS # Exit after timeout because then no empty YCP map is output # so that either an existing YCP map could be used or YaST could also exit # because without a PPD database printer setup makes not much sense. # The very long timeout is usually only needed on slower machines # and there also usually only once after a new system installation # when the cupsd reads thousands of PPDs for the very first time -# (see Novell/Suse Bugzilla bnc#429397): +# (see Novell/Suse Bugzilla bnc#429397). +# Therefore the PROGRESS file can grow up to about 17000 bytes here: MAXIMUM_WAIT="300" $LPINFO -h localhost -l -m >$TMP_DATA_RAW & lpinfoPID=$! for i in $( seq $MAXIMUM_WAIT ) do ps $lpinfoPID &>/dev/null || break + echo "Waiting for response from $LPINFO (PID $lpinfoPID)..." >>$PROGRESS sleep 1 done if ps $lpinfoPID &>/dev/null then kill -9 $lpinfoPID &>/dev/null echo "Aborted lpinfo after $MAXIMUM_WAIT seconds timeout." 1>&2 + echo "Aborted lpinfo after $MAXIMUM_WAIT seconds timeout." >>$PROGRESS exit 3 fi # Process the data: - +echo 'Got the raw data.' >>$PROGRESS # Extract what is needed, quotation marks " are replaced by ' : tr '"' "'" <$TMP_DATA_RAW | egrep '^Model:|name =|make-and-model =|device-id =|natural_language =' >$TMP_DATA @@ -74,14 +83,21 @@ -e 's/[[:space:]]*$//' $TMP_DATA # Output: - +echo 'Creating the YCP map...' >>$PROGRESS # Output header: echo "[" -# Function to output one entry: +# Function to output one entry. +# Limit what is written to the PROGRESS file here to 8 characters per PPD. +# Otherwise the PROGRESS file would grow up to more than 300000 bytes here +# which would make the above "waiting for lpinfo" part too small +# to be really visible in the DownloadProgress bar in YaST. +# With the limited output here the PROGRESS file grows to about 80000 bytes +# for the about 8000 PPDs which are installed by default in openSUSE 11.0: Output() { if [ -n "$PPD" -a -n "$NICKNAME" ] then echo -e " \$[ \"ppd\":\"$PPD\",\n \"nickname\":\"$NICKNAME\",\n \"deviceID\":\"$ID\",\n \"language\":\"$LANGUAGE\",\n \"manufacturer\":\"$MANUFACTURER\",\n \"modelname\":\"$MODELNAME\"\n ]," + echo "$NICKNAME" | cut -b-8 >>$PROGRESS fi } @@ -110,5 +126,6 @@ # Remove the temporary files rm $TMP_DATA_RAW $TMP_DATA +echo 'Finished.' >>$PROGRESS exit 0 -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org