diff options
Diffstat (limited to 'debian')
-rw-r--r-- | debian/README.Debian | 49 | ||||
-rw-r--r-- | debian/README.source | 13 | ||||
-rw-r--r-- | debian/changelog | 13 | ||||
-rw-r--r-- | debian/compat | 1 | ||||
-rw-r--r-- | debian/control | 27 | ||||
-rw-r--r-- | debian/copyright | 42 | ||||
-rw-r--r-- | debian/patches/0001-fixes-python27-breakage.patch | 190 | ||||
-rw-r--r-- | debian/patches/0002-adds-stdin-support.patch | 89 | ||||
-rw-r--r-- | debian/patches/series | 2 | ||||
-rwxr-xr-x | debian/rules | 16 | ||||
-rw-r--r-- | debian/source/format | 1 | ||||
-rw-r--r-- | debian/woof.1 | 55 | ||||
-rw-r--r-- | debian/woof.install | 1 | ||||
-rw-r--r-- | debian/woof.manpages | 1 |
14 files changed, 500 insertions, 0 deletions
diff --git a/debian/README.Debian b/debian/README.Debian new file mode 100644 index 0000000..f23f457 --- /dev/null +++ b/debian/README.Debian @@ -0,0 +1,49 @@ +Reporting some doc and examples as in project homepage: + +Simply exchange files with WOOF + +I guess everybody with a laptop has experienced this problem at some point: You plug into a network and just want to exchange files with other participants. It always is a pain until you can exchange files with the person vis-a-vis. + +Of course there are a lot of tools to tackle this problem. For large scale communities there are dozens of filesharing networks. However, they don't work for small local networks. Of course you could put your stuff to exchange on a local web server, but who really wants to maintain this? Tools like the ingenious npush/npoll are extremely helpful, provided that both parties have it installed, SAFT/sendfile also aims to solve this problem, but needs a permanently running daemon... + +Woof (Web Offer One File) tries a different approach. It assumes that everybody has a web-browser or a commandline web-client installed. Woof is a small simple stupid webserver that can easily be invoked on a single file. Your partner can access the file with tools he trusts (e.g. wget). No need to enter passwords on keyboards where you don't know about keyboard sniffers, no need to start a huge lot of infrastructure, just do a + + $ woof filename +and tell the recipient the URL woof spits out. When he got that file, woof will quit and everything is done. +And when someone wants to send you a file, woof has a switch to offer itself, so he can get woof and offer a file to you. + +Prerequisites and usage + +Woof needs Python on a unix'ish operating system. Some people have used it successfully on Windows within the cygwin environment. + + Usage: woof [-i <ip_addr>] [-p <port>] [-c <count>] <file> + woof [-i <ip_addr>] [-p <port>] [-c <count>] [-z|-j|-Z|-u] <dir> + woof [-i <ip_addr>] [-p <port>] [-c <count>] -s + woof [-i <ip_addr>] [-p <port>] [-c <count>] -U + + Serves a single file <count> times via http on port <port> on IP + address <ip_addr>. + When a directory is specified, an tar archive gets served. By default + it is gzip compressed. You can specify -z for gzip compression, + -j for bzip2 compression, -Z for ZIP compression or -u for no compression. + You can configure your default compression method in the configuration + file described below. + + When -s is specified instead of a filename, woof distributes itself. + + When -U is specified, woof provides an upload form and allows uploading files. + + defaults: count = 1, port = 8080 + + You can specify different defaults in two locations: /etc/woofrc + and ~/.woofrc can be INI-style config files containing the default + port and the default count. The file in the home directory takes + precedence. The compression methods are "off", "gz", "bz2" or "zip". + + Sample file: + + [main] + port = 8008 + count = 2 + ip = 127.0.0.1 + compressed = gz diff --git a/debian/README.source b/debian/README.source new file mode 100644 index 0000000..2231fec --- /dev/null +++ b/debian/README.source @@ -0,0 +1,13 @@ +woof for Debian +--------------- + +woof is composed by a single file taken from the author's website at +http://www.home.unix-ag.org/simon/woof.html. + +It has been tarred and gzipped, and given a version number based on the release +date, as indicated in the author's website. + +You can obtain an .orig.tar.gz using get-orig-source as follow: +$ ./debian/rules get-orig-source + + diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..b2b36ca --- /dev/null +++ b/debian/changelog @@ -0,0 +1,13 @@ +woof (20091227-2) unstable; urgency=low + + * debian/patches added: + - 0001-fixes-python27-crash.patch (LP: #841408) + - 0002-adds-stdin-support.patch (Closes: #638635) Thanks to Hugues Hiegel + + -- Andrea Gasparini <gaspa@yattaweb.it> Tue, 13 Sep 2011 23:40:42 +0200 + +woof (20091227-1) unstable; urgency=low + + * Initial release (Closes: #595820). + + -- Andrea Colangelo <warp10@ubuntu.com> Sun, 12 Sep 2010 01:03:11 +0200 diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000..7f8f011 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +7 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..cc81573 --- /dev/null +++ b/debian/control @@ -0,0 +1,27 @@ +Source: woof +Section: net +Priority: optional +Maintainer: Andrea Gasparini <gaspa@yattaweb.it> +Uploaders: Andrea Colangelo <warp10@ubuntu.com> +Build-Depends: debhelper (>= 7.0.50~), python-support (>= 0.90.0) +Build-Depends-Indep: python +Standards-Version: 3.9.2 +Homepage: http://www.home.unix-ag.org/simon/woof.html + +Package: woof +Architecture: all +Depends: ${python:Depends}, ${misc:Depends} +Description: share files through HTTP protocol + Woof (Web Offer One File) is a tool to copy files among hosts. It can serve a + specified file on HTTP, just for a given number of times, and then exits. + . + It can be easily used to share files across the computers on a net, enough the + other ends have just a browser (that means you can share things between + different operating systems or different devices, even phones). + . + Features include: + * it can share stuff "one shot" and exit just after he served that file. + * it can share things among different operating system or different devices + (e.g.: a smartphone), and allows one to upload files easily. + * it can also show a simple html form in order to upload file (useful if the + client hasn't a way to serve the file). diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..dc244ff --- /dev/null +++ b/debian/copyright @@ -0,0 +1,42 @@ +This work was packaged for Debian by: + + Andrea Colangelo <warp10@ubuntu.com> on Sun, 12 Sep 2010 01:03:11 +0200 + +It was downloaded from: + + http://www.home.unix-ag.org/simon/woof.html + +Upstream Author: + + Simon Budig <simon@budig.de> + +Copyright: + + Copyright © 2004-2009 Simon Budig + +License: + + This package is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This package is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this package; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +On Debian systems, the complete text of the GNU General +Public License version 2 can be found in `/usr/share/common-licenses/GPL-2'. + +The Debian packaging is: + + Copyright © 2010 Andrea Colangelo <warp10@ubuntu.com> + +you can redistribute it and/or modify it under the terms of the GNU General +Public License as published by the Free Software Foundation, version 2 of the +license or (at your option) any later version. diff --git a/debian/patches/0001-fixes-python27-breakage.patch b/debian/patches/0001-fixes-python27-breakage.patch new file mode 100644 index 0000000..dba7971 --- /dev/null +++ b/debian/patches/0001-fixes-python27-breakage.patch @@ -0,0 +1,190 @@ +--- woof-20091227.orig/woof 2009-12-27 23:47:43.000000000 +0100 ++++ woof-20091227/woof 2011-02-08 20:38:51.150000040 +0100 +@@ -28,13 +28,13 @@ + + import sys, os, errno, socket, getopt, commands, tempfile + import cgi, urllib, BaseHTTPServer ++from SocketServer import ThreadingMixIn + import ConfigParser + import shutil, tarfile, zipfile + import struct + + maxdownloads = 1 + TM = object +-cpid = -1 + compressed = 'gz' + upload = False + +@@ -137,6 +137,11 @@ class FileServHTTPRequestHandler (BaseHT + self.send_error (501, "Unsupported method (POST)") + return + ++ maxdownloads -= 1 ++ ++ if maxdownloads < 1: ++ httpd.shutdown() ++ + # taken from + # http://mail.python.org/pipermail/python-list/2006-September/402441.html + +@@ -200,13 +205,11 @@ class FileServHTTPRequestHandler (BaseHT + self.end_headers () + self.wfile.write (txt) + +- maxdownloads -= 1 +- + return + + + def do_GET (self): +- global maxdownloads, cpid, compressed, upload ++ global maxdownloads, compressed, upload + + # Form for uploading a file + if upload: +@@ -260,63 +263,62 @@ class FileServHTTPRequestHandler (BaseHT + + maxdownloads -= 1 + +- # let a separate process handle the actual download, so that +- # multiple downloads can happen simultaneously. ++ if maxdownloads < 1: ++ httpd.shutdown() + +- cpid = os.fork () ++ type = None ++ ++ if os.path.isfile (self.filename): ++ type = "file" ++ elif os.path.isdir (self.filename): ++ type = "dir" + +- if cpid == 0: +- # Child process +- child = None +- type = None +- +- if os.path.isfile (self.filename): +- type = "file" +- elif os.path.isdir (self.filename): +- type = "dir" ++ if not type: ++ print >> sys.stderr, "can only serve files or directories. Aborting." ++ sys.exit (1) + +- if not type: +- print >> sys.stderr, "can only serve files or directories. Aborting." +- sys.exit (1) ++ self.send_response (200) ++ self.send_header ("Content-Type", "application/octet-stream") ++ if os.path.isfile (self.filename): ++ self.send_header ("Content-Length", ++ os.path.getsize (self.filename)) ++ self.end_headers () + +- self.send_response (200) +- self.send_header ("Content-Type", "application/octet-stream") +- if os.path.isfile (self.filename): +- self.send_header ("Content-Length", +- os.path.getsize (self.filename)) +- self.end_headers () ++ try: ++ if type == "file": ++ datafile = file (self.filename) ++ shutil.copyfileobj (datafile, self.wfile) ++ datafile.close () ++ elif type == "dir": ++ if compressed == 'zip': ++ ezfile = EvilZipStreamWrapper (self.wfile) ++ zfile = zipfile.ZipFile (ezfile, 'w', zipfile.ZIP_DEFLATED) ++ stripoff = os.path.dirname (self.filename) + os.sep + +- try: +- if type == "file": +- datafile = file (self.filename) +- shutil.copyfileobj (datafile, self.wfile) +- datafile.close () +- elif type == "dir": +- if compressed == 'zip': +- ezfile = EvilZipStreamWrapper (self.wfile) +- zfile = zipfile.ZipFile (ezfile, 'w', zipfile.ZIP_DEFLATED) +- stripoff = os.path.dirname (self.filename) + os.sep ++ for root, dirs, files in os.walk (self.filename): ++ for f in files: ++ filename = os.path.join (root, f) ++ if filename[:len (stripoff)] != stripoff: ++ raise RuntimeException, "invalid filename assumptions, please report!" ++ zfile.write (filename, filename[len (stripoff):]) ++ zfile.close () ++ else: ++ tfile = tarfile.open (mode=('w|' + compressed), ++ fileobj=self.wfile) ++ tfile.add (self.filename, ++ arcname=os.path.basename(self.filename)) ++ tfile.close () ++ except Exception, e: ++ print e ++ print >>sys.stderr, "Connection broke. Aborting" + +- for root, dirs, files in os.walk (self.filename): +- for f in files: +- filename = os.path.join (root, f) +- if filename[:len (stripoff)] != stripoff: +- raise RuntimeException, "invalid filename assumptions, please report!" +- zfile.write (filename, filename[len (stripoff):]) +- zfile.close () +- else: +- tfile = tarfile.open (mode=('w|' + compressed), +- fileobj=self.wfile) +- tfile.add (self.filename, +- arcname=os.path.basename(self.filename)) +- tfile.close () +- except Exception, e: +- print e +- print >>sys.stderr, "Connection broke. Aborting" ++ ++class ThreadedHTTPServer(ThreadingMixIn, BaseHTTPServer.HTTPServer): ++ """Handle requests in a separate thread""" + + + def serve_files (filename, maxdown = 1, ip_addr = '', port = 8080): +- global maxdownloads ++ global maxdownloads, httpd + + maxdownloads = maxdown + +@@ -326,8 +328,7 @@ def serve_files (filename, maxdown = 1, + FileServHTTPRequestHandler.filename = filename + + try: +- httpd = BaseHTTPServer.HTTPServer ((ip_addr, port), +- FileServHTTPRequestHandler) ++ httpd = ThreadedHTTPServer ((ip_addr, port), FileServHTTPRequestHandler) + except socket.error: + print >>sys.stderr, "cannot bind to IP address '%s' port %d" % (ip_addr, port) + sys.exit (1) +@@ -337,8 +338,7 @@ def serve_files (filename, maxdown = 1, + if ip_addr: + print "Now serving on http://%s:%s/" % (ip_addr, httpd.server_port) + +- while cpid != 0 and maxdownloads > 0: +- httpd.handle_request () ++ httpd.serve_forever () + + + +@@ -488,14 +488,6 @@ def main (): + + serve_files (filename, maxdown, ip_addr, port) + +- # wait for child processes to terminate +- if cpid != 0: +- try: +- while 1: +- os.wait () +- except OSError: +- pass +- + + + if __name__=='__main__': diff --git a/debian/patches/0002-adds-stdin-support.patch b/debian/patches/0002-adds-stdin-support.patch new file mode 100644 index 0000000..49238ae --- /dev/null +++ b/debian/patches/0002-adds-stdin-support.patch @@ -0,0 +1,89 @@ +--- woof-20091227.orig/woof 2011-09-13 23:32:16.000000000 +0200 ++++ woof-20091227/woof 2011-09-13 23:38:50.000000000 +0200 +@@ -123,7 +123,7 @@ + server_version = "Simons FileServer" + protocol_version = "HTTP/1.0" + +- filename = "." ++ filename = "-" + + def log_request (self, code='-', size='-'): + if code == 200: +@@ -272,9 +272,11 @@ + type = "file" + elif os.path.isdir (self.filename): + type = "dir" ++ elif self.filename == "-": ++ type = "stdin" + + if not type: +- print >> sys.stderr, "can only serve files or directories. Aborting." ++ print >> sys.stderr, "can only serve files, directories or stdin. Aborting." + sys.exit (1) + + self.send_response (200) +@@ -308,6 +310,9 @@ + tfile.add (self.filename, + arcname=os.path.basename(self.filename)) + tfile.close () ++ elif type == "stdin": ++ datafile = sys.stdin ++ shutil.copyfileobj (datafile, self.wfile) + except Exception, e: + print e + print >>sys.stderr, "Connection broke. Aborting" +@@ -345,13 +350,14 @@ + def usage (defport, defmaxdown, errmsg = None): + name = os.path.basename (sys.argv[0]) + print >>sys.stderr, """ +- Usage: %s [-i <ip_addr>] [-p <port>] [-c <count>] <file> ++ Usage: %s [-i <ip_addr>] [-p <port>] [-c <count>] [<file>] + %s [-i <ip_addr>] [-p <port>] [-c <count>] [-z|-j|-Z|-u] <dir> + %s [-i <ip_addr>] [-p <port>] [-c <count>] -s + %s [-i <ip_addr>] [-p <port>] [-c <count>] -U + + Serves a single file <count> times via http on port <port> on IP + address <ip_addr>. ++ When no filename is specified, or set to '-', then stdin will be read. + When a directory is specified, an tar archive gets served. By default + it is gzip compressed. You can specify -z for gzip compression, + -j for bzip2 compression, -Z for ZIP compression or -u for no compression. +@@ -388,6 +394,8 @@ + def main (): + global cpid, upload, compressed + ++ filename = '-' ++ + maxdown = 1 + port = 8080 + ip_addr = '' +@@ -473,18 +481,18 @@ + + else: + if len (filenames) == 1: +- filename = os.path.abspath (filenames[0]) +- else: +- usage (defaultport, defaultmaxdown, +- "Can only serve single files/directories.") ++ if filenames[0] != "-": ++ filename = os.path.abspath (filenames[0]) + +- if not os.path.exists (filename): +- usage (defaultport, defaultmaxdown, +- "%s: No such file or directory" % filenames[0]) +- +- if not (os.path.isfile (filename) or os.path.isdir (filename)): +- usage (defaultport, defaultmaxdown, +- "%s: Neither file nor directory" % filenames[0]) ++ if not os.path.exists (filename): ++ usage (defaultport, defaultmaxdown, ++ "Can only serve single files/directories.") ++ ++ if not (os.path.isfile (filename) or os.path.isdir (filename)): ++ usage (defaultport, defaultmaxdown, ++ "%s: Neither file nor directory" % filenames[0]) ++ else: ++ filename = "-" + + serve_files (filename, maxdown, ip_addr, port) + diff --git a/debian/patches/series b/debian/patches/series new file mode 100644 index 0000000..82e7e9b --- /dev/null +++ b/debian/patches/series @@ -0,0 +1,2 @@ +0001-fixes-python27-breakage.patch +0002-adds-stdin-support.patch diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..61376f3 --- /dev/null +++ b/debian/rules @@ -0,0 +1,16 @@ +#!/usr/bin/make -f + +%: + dh $@ + +SRC_VERSION := $(shell dpkg-parsechangelog | sed -ne 's/^Version: \(\([0-9]\+\):\)\?\(.*\)-.*/\3/p') +TARBALL = woof_$(SRC_VERSION).orig.tar.gz +.PHONY: get-orig-source +get-orig-source: + rm -rf get-orig-source $(TARBALL) + mkdir -p get-orig-source/woof_$(SRC_VERSION) + cp CHANGELOG get-orig-source/woof_$(SRC_VERSION)/ + wget -O get-orig-source/woof_$(SRC_VERSION)/woof http://www.home.unix-ag.org/simon/woof + chmod +x get-orig-source/woof_$(SRC_VERSION)/woof + GZIP='--best --no-name' tar czf $(TARBALL) -C get-orig-source woof_$(SRC_VERSION) + rm -rf get-orig-source diff --git a/debian/source/format b/debian/source/format new file mode 100644 index 0000000..163aaf8 --- /dev/null +++ b/debian/source/format @@ -0,0 +1 @@ +3.0 (quilt) diff --git a/debian/woof.1 b/debian/woof.1 new file mode 100644 index 0000000..12d23a9 --- /dev/null +++ b/debian/woof.1 @@ -0,0 +1,55 @@ +.TH "woof" "1" "Last Modified: September 12, 2010" +.SH NAME +\fBwoof\fP \- A small, simple, stupid webserver to share files + +.SH SYNOPSIS +.B woof +.RI [ options ] " file" + +.SH DESCRIPTION +\fBwoof\fP is a tool to copy files between hosts. It can +serve a specified file on HTTP,just for a given number of times, and then +shutdown. It can be easily used to share files across the computers on a +net, and given that the other ends should have just a browser, it can share +stuff between different operating system, or different devices (e.g.: a +smartphone). It can also show a simple html form in order to upload a file. +commands. + +.SH OPTIONS +A summary of options is included below. +.TP +.B \-h +Show summary of options. +.TP +.B \-i <ip_addr> +IP address to share the file +.TP +.B \-p <port> +Port to be used to share the file +.TP +.B \-c <count> +Number of times to share the file +.TP +.B \-z <dir> +Used on a directory, it creates a tarball with gzip compression +.TP +.B \-j <dir> +Used on a directory, it creates a tarball with bzip2 compression +.TP +.B \-Z <dir> +Used on a directory, it creates a tarball with ZIP compression +.TP +.B \-u <dir> +Used on a directory, it creates a tarball with no compression +.TP +.B \-s +Used to distribute woof itself +.TP +.B \-U +woof provides an upload form and allows uploading files + +.SH AUTHOR +woof was written by Simon Budig <simon@budig.de> + +This manual page was written by Andrea Colangelo <warp10@ubuntu.com>, +for the Debian project (and may be used by others). diff --git a/debian/woof.install b/debian/woof.install new file mode 100644 index 0000000..f293e10 --- /dev/null +++ b/debian/woof.install @@ -0,0 +1 @@ +woof /usr/bin diff --git a/debian/woof.manpages b/debian/woof.manpages new file mode 100644 index 0000000..50f27c0 --- /dev/null +++ b/debian/woof.manpages @@ -0,0 +1 @@ +debian/woof.1 |