[or-cvs] r23828: {arm} More changes for the deb build: - Using temporary file for m (in arm: resources/build/debian trunk)

Damian Johnson atagar1 at gmail.com
Thu Nov 18 18:12:16 UTC 2010


Author: atagar
Date: 2010-11-18 18:12:16 +0000 (Thu, 18 Nov 2010)
New Revision: 23828

Modified:
   arm/resources/build/debian/changelog
   arm/resources/build/debian/control
   arm/resources/build/debian/rules
   arm/trunk/setup.py
Log:
More changes for the deb build:
- Using temporary file for man page build. There's still a tiny window for nastyness, but I'm not spotting a nice way of piping the gzip output to a pipe file instance. However, this implementation is sufficient to make me happy so leaving it this way until someone offers a better suggestion (guess I could do a popen and direct the results of a gzip but... ick). (thanks to asn for the suggestion!)
- Better method of wiping the egg-info thanks to weasel.
- A few revisions to the wording of various metadata.



Modified: arm/resources/build/debian/changelog
===================================================================
--- arm/resources/build/debian/changelog	2010-11-18 16:21:55 UTC (rev 23827)
+++ arm/resources/build/debian/changelog	2010-11-18 18:12:16 UTC (rev 23828)
@@ -1,7 +1,5 @@
 tor-arm (1.3.7-1) unstable; urgency=low
 
-  * Initial release (upstream version 1.3.7-1).
-  * closes: bug#603056
+  * Initial release (upstream version 1.3.7-1, closes: #603056).
   
  -- Damian Johnson (www.atagar.com) <atagar1 at gmail.com>  Wed, 6 Oct 2010 22:30:43 -0700
-

Modified: arm/resources/build/debian/control
===================================================================
--- arm/resources/build/debian/control	2010-11-18 16:21:55 UTC (rev 23827)
+++ arm/resources/build/debian/control	2010-11-18 18:12:16 UTC (rev 23828)
@@ -10,7 +10,7 @@
 Architecture: all
 Depends: ${misc:Depends}, ${python:Depends}
 Suggests: tor
-Description: arm is a terminal status monitor for tor
+Description: terminal status monitor for tor
  The anonymizing relay monitor (arm) is a terminal status monitor for Tor
  relays, intended for command-line aficionados, ssh connections, and anyone
  stuck with a tty terminal. This works much like top does for system usage,
@@ -20,5 +20,5 @@
   - relay's current configuration
   - logged events
   - connection details (ip, hostname, fingerprint, and consensus data)
-  - etc
+  - etc.
  .

Modified: arm/resources/build/debian/rules
===================================================================
--- arm/resources/build/debian/rules	2010-11-18 16:21:55 UTC (rev 23827)
+++ arm/resources/build/debian/rules	2010-11-18 18:12:16 UTC (rev 23828)
@@ -20,3 +20,6 @@
 clean::
 	dh_clean
 
+binary-post-install/tor-arm::
+	find debian/tor-arm -name 'arm-*egg-info' -exec rm -v '{}' +
+

Modified: arm/trunk/setup.py
===================================================================
--- arm/trunk/setup.py	2010-11-18 16:21:55 UTC (rev 23827)
+++ arm/trunk/setup.py	2010-11-18 18:12:16 UTC (rev 23828)
@@ -2,14 +2,19 @@
 import os
 import sys
 import gzip
+import tempfile
 from src.version import VERSION
 from distutils.core import setup
 
-# When we're running the install target as a deb we do the following:
-# - use 'tor-arm' instead of 'arm' in the path for the sample armrc
-# - account for the debian build prefix when removing the egg-info
+# Use 'tor-arm' instead of 'arm' in the path for the sample armrc if we're
+# building for debian.
 
-isDebInstall = "--install-layout=deb" in sys.argv
+isDebInstall = False
+for arg in sys.argv:
+  if "tor-arm" in arg:
+    isDebInstall = True
+    break
+
 docPath = "/usr/share/doc/%s" % ("tor-arm" if isDebInstall else "arm")
 
 # Provides the configuration option to install to "/usr/share" rather than as a
@@ -31,13 +36,15 @@
   manContents = manInputFile.read()
   manInputFile.close()
   
-  manOutputFile = gzip.open('/tmp/arm.1.gz', 'wb')
+  # temporary destination for the man page guarenteed to be unoccupied (to
+  # avoid conflicting with files that are already there)
+  manOutputFile = gzip.open(tempfile.mktemp("/arm.1.gz"), 'wb')
   manOutputFile.write(manContents)
   manOutputFile.close()
   
   # places in tmp rather than a relative path to avoid having this copy appear
   # in the deb and rpm builds
-  manFilename = "/tmp/arm.1.gz"
+  manFilename = manOutputFile.name
 except IOError, exc:
   print "Unable to compress man page: %s" % exc
   manFilename = "arm.1"
@@ -58,7 +65,7 @@
      )
 
 # Cleans up the temporary compressed man page.
-if manFilename == '/tmp/arm.1.gz' and os.path.isfile(manFilename):
+if manFilename != 'arm.1' and os.path.isfile(manFilename):
   if "-q" not in sys.argv: print "Removing %s" % manFilename
   os.remove(manFilename)
 
@@ -67,7 +74,6 @@
 # bypass its creation.
 # TODO: not sure how to remove this from the deb build too...
 eggPath = '/usr/share/arm-%s.egg-info' % VERSION
-if isDebInstall: eggPath = "./debian/tor-arm" + eggPath
 
 if os.path.isfile(eggPath):
   if "-q" not in sys.argv: print "Removing %s" % eggPath



More information about the tor-commits mailing list