[28227] in Source-Commits

home help back first fref pref prev next nref lref last post

cupsys-config commit: Cleanup remnants of BrowsePoll; update packaging

daemon@ATHENA.MIT.EDU (Jonathan D Reed)
Tue May 27 13:48:18 2014

Date: Tue, 27 May 2014 13:48:11 -0400
From: Jonathan D Reed <jdreed@MIT.EDU>
Message-Id: <201405271748.s4RHmB0o007397@drugstore.mit.edu>
To: source-commits@MIT.EDU

https://github.com/mit-athena/cupsys-config/commit/7ac86dbaf320a5ba3f37f28f777169927f6c1b53
commit 7ac86dbaf320a5ba3f37f28f777169927f6c1b53
Author: Jonathan Reed <jdreed@mit.edu>
Date:   Tue May 27 11:46:38 2014 -0400

    Cleanup remnants of BrowsePoll; update packaging
    
    - Actually cleanup everything from when we used to BrowsePoll
      against cluster-printers.mit.edu (Trac: #1473).  This entails
      punting the transform script, the restart code, and the site
      config file.
    - Drop CDBS and switch to dh7, adding a .undisplace file.
    - Update the copyright file to the new file format
    - Drop the build dependency on cups, cdbs, and dh-buildinfo
    - Remove the disjunctions in the Depends field, because it's not
      2008 anymore, and nobody has anything called cupsys installed.

 debian/control                            |    4 +-
 debian/copyright                          |   59 +++++++++++----------
 debian/cupsd-site.conf                    |    8 ---
 debian/debathena-cupsys-config.undisplace |    2 +
 debian/install                            |    1 -
 debian/restart-cups.sh                    |   82 ++++++-----------------------
 debian/rules                              |    9 +---
 debian/transform_cupsd.conf.debathena     |    7 ---
 8 files changed, 52 insertions(+), 120 deletions(-)

diff --git a/debian/control b/debian/control
index 65fdff4..90bf08a 100644
--- a/debian/control
+++ b/debian/control
@@ -2,12 +2,12 @@ Source: debathena-cupsys-config
 Section: debathena-config/net
 Priority: extra
 Maintainer: Debathena Project <debathena@mit.edu>
-Build-Depends: cdbs, debhelper, dh-buildinfo, config-package-dev (>= 5.0~), cups
+Build-Depends: debhelper (>= 7), config-package-dev (>= 5.0~)
 Standards-Version: 3.9.3
 
 Package: debathena-cupsys-config
 Architecture: all
-Depends: ${shlibs:Depends}, ${misc:Depends}, cups | cupsys, cups-bsd | cupsys-bsd, hpijs-ppds
+Depends: ${shlibs:Depends}, ${misc:Depends}, cups, cups-bsd, hpijs-ppds
 Provides: ${diverted-files}, debathena-cluster-cups-config
 Conflicts: ${diverted-files}, debathena-cluster-cups-config (<= 2.0.4)
 Replaces: debathena-cluster-cups-config (<= 2.0.4)
diff --git a/debian/copyright b/debian/copyright
index 002f720..3740021 100644
--- a/debian/copyright
+++ b/debian/copyright
@@ -1,31 +1,32 @@
-This package was created as part of the Debathena Project
-<http://debathena.mit.edu/> of the MIT Student Information Processing
-Board.
+Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
 
-The source code was obtained from the Athena SVN repository at
-<svn://debathena.mit.edu/athena/trunk>, and is licensed as follows:
+Files: *
+Copyright: (c) 2008, Evan Broder <broder@mit.edu>
+	   (c) 2011-2014, Massachusetts Institute of Technology
+License: BSD-3-clause
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are
+ met:
+    * Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+    * Redistributions in binary form must reproduce the above
+      copyright notice, this list of conditions and the following
+      disclaimer in the documentation and/or other materials provided
+      with the distribution.
+    * Neither the name of the Massachusetts Institute of Technology
+      nor the names of its contributors may be used to endorse or
+      promote products derived from this software without specific
+      prior written permission.
 
-  Copyright © 2008 Evan Broder
-
-  Permission is hereby granted, free of charge, to any person
-  obtaining a copy of this software and associated documentation files
-  (the "Software"), to deal in the Software without restriction,
-  including without limitation the rights to use, copy, modify, merge,
-  publish, distribute, sublicense, and/or sell copies of the Software,
-  and to permit persons to whom the Software is furnished to do so,
-  subject to the following conditions:
-
-  The above copyright notice and this permission notice shall be
-  included in all copies or substantial portions of the Software.
-
-  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
-  BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
-  ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-  CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-  SOFTWARE.
-
-The Debian packaging is Copyright © 2007-2008 Tim Abbott and Anders
-Kaseorg, and has the same license as the original software.
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL MASSACHUSETTS
+ INSTITUTE OF TECHNOLOGY BE LIABLE FOR ANY DIRECT, INDIRECT,
+ INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
+ TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGE.
diff --git a/debian/cupsd-site.conf b/debian/cupsd-site.conf
deleted file mode 100644
index e81e1f1..0000000
--- a/debian/cupsd-site.conf
+++ /dev/null
@@ -1,8 +0,0 @@
-# Site configuration file for CUPS
-# Included in /etc/cups/cupsd.conf
-
-Browsing On
-BrowseProtocols cups
-BrowsePoll cluster-printers.mit.edu
-BrowseInterval 600
-BrowseTimeout 1200
diff --git a/debian/debathena-cupsys-config.undisplace b/debian/debathena-cupsys-config.undisplace
new file mode 100644
index 0000000..709d9c5
--- /dev/null
+++ b/debian/debathena-cupsys-config.undisplace
@@ -0,0 +1,2 @@
+# We gave up on BrowsePolling
+/etc/cups/cupsd.conf.debathena
diff --git a/debian/install b/debian/install
index dfe89f8..9e2d404 100644
--- a/debian/install
+++ b/debian/install
@@ -1,3 +1,2 @@
 debian/restart-cups.sh usr/lib/debathena-cupsys-config
 debian/configure-athena-printers usr/lib/debathena-cupsys-config
-debian/cupsd-site.conf usr/share/debathena-cupsys-config
diff --git a/debian/restart-cups.sh b/debian/restart-cups.sh
index f1c3ed4..4f9a8bd 100644
--- a/debian/restart-cups.sh
+++ b/debian/restart-cups.sh
@@ -1,71 +1,21 @@
 restart_cups()
 {
-	# Handle Debian package name change from cupsys to cups.
-	[ -e /etc/init.d/cups ] && rcname=cups || rcname=cupsys
-	# Restart cupsd if it is running
-	if /etc/init.d/$rcname status; then
-	    if hash invoke-rc.d; then
-		invoke="invoke-rc.d $rcname"
-	    else
-		invoke="/etc/init.d/$rcname"
-	    fi
-	    # Flush remote.cache to deal with things like changing the
-	    # server we BrowsePoll against. But don't do so if
-	    # policy-rc.d is going to prevent us from restarting cupsd
-	    # (for instance, if reactivate is installed and running;
-	    # in that case, the next logout will flush remote.cache and restart
-	    # cupsd anyway).
-	    if $invoke stop; then
-		rm -f /var/cache/cups/remote.cache
-		if type restart_cups_extra >/dev/null 2>&1; then
-		    restart_cups_extra 0
-		fi
-		$invoke start
-	    else
-		ret="$?"
-		if type restart_cups_extra >/dev/null 2>&1; then
-		    restart_cups_extra "$ret"
-		fi
-	    fi
+    # Historically, we used to have to do all sorts of clever stuff
+    # when restarting CUPS.  In an effort to plan for future
+    # hilarity, we'll keep this hook around, but only restart
+    # CUPS if it's running, and don't error out if we can't.
 
-	    # Wait up to two minutes to pick up all the BrowsePoll server's queues.
-	    browse_host="$(sed -ne '/^BrowsePoll/ { s/^BrowsePoll //p; q }' /etc/cups/cupsd.conf)"
-	    if [ -n "$browse_host" ]; then
-		browse_host="$(sed -ne '/^BrowsePoll/ { s/^BrowsePoll //p; q }' /usr/share/debathena-cupsys-config/cupsd-site.conf)"
-	    fi
-	    if [ -n "$browse_host" ]; then
-		echo "Retrieving printer list, please wait..." >&2
-		echo "(This may take up to 30 seconds)" >&2
-		queue_count=$(lpstat -h "$browse_host" -a | awk '{print $1}' | sort -u | wc -l)
-
-		if echo "$browse_host" | grep -q ':'; then
-		    browse_port="${browse_host##*:}"
-		    browse_host="${browse_host%:*}"
-		else
-		    browse_port=631
-		fi
-
-		# Execute the cups-polld in a subshell so that we can
-		# set an EXIT trap
-		(trap "start-stop-daemon --stop --oknodo --pidfile /var/run/debathena-cupsys-config-polld.pid" EXIT
-
-		    start-stop-daemon --start \
-			--chuid lp \
-			--pidfile /var/run/debathena-cupsys-config-polld.pid \
-			--background \
-			--make-pidfile \
-			--startas /usr/lib/cups/daemon/cups-polld -- \
-			"$browse_host" "$browse_port" 1 631
-
-		    timeout=0
-		    while [ $(lpstat -a | wc -l) -lt $queue_count ] && [ $timeout -le 30 ]; do
-			sleep 1
-			timeout=$((timeout+1))
-		    done)
-	    fi
-	else
-	    if type restart_cups_extra >/dev/null 2>&1; then
-		restart_cups_extra -1
-	    fi
+    # It's not 2008 anymore, there's nothing named "cupsys"
+    rcname=cups
+    if /etc/init.d/$rcname status; then
+        if hash invoke-rc.d; then
+            invoke="invoke-rc.d $rcname"
+        else
+            invoke="/etc/init.d/$rcname"
+        fi
+	# This should not be fatal
+	if ! $invoke restart; then
+	    echo "NOTICE: Failed to restart CUPS.  Oh well..." >&2
 	fi
+    fi
 }
diff --git a/debian/rules b/debian/rules
index 4789d5e..a089a9e 100755
--- a/debian/rules
+++ b/debian/rules
@@ -1,9 +1,4 @@
 #!/usr/bin/make -f
 
-DEB_DIVERT_EXTENSION = .debathena
-
-DEB_UNDIVERT_FILES_debathena-cupsys-config += \
-	/etc/cups/cupsd.conf.debathena
-
-include /usr/share/cdbs/1/rules/debhelper.mk
-include /usr/share/cdbs/1/rules/config-package.mk
+%:
+	dh $@ --with config-package
diff --git a/debian/transform_cupsd.conf.debathena b/debian/transform_cupsd.conf.debathena
deleted file mode 100755
index 657f5a0..0000000
--- a/debian/transform_cupsd.conf.debathena
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/usr/bin/perl -0p
-s/^\s*#?\s*Browsing.*$//m;
-s/^\s*#?\s*BrowseProtocols.*$//m;
-s/^\s*#?\s*BrowsePoll.*$//m;
-s/^\s*#?\s*BrowseInterval.*$//m;
-s/^\s*#?\s*BrowseTimeout.*$//m;
-s|$|\nInclude /usr/share/debathena-cupsys-config/cupsd-site.conf| or die;

home help back first fref pref prev next nref lref last post