]> git.mxchange.org Git - quix0rs-apt-p2p.git/commitdiff
Initial debian directory and packaging related changes.
authorCameron Dale <camrdale@gmail.com>
Mon, 18 Feb 2008 03:42:45 +0000 (19:42 -0800)
committerCameron Dale <camrdale@gmail.com>
Mon, 18 Feb 2008 03:42:45 +0000 (19:42 -0800)
19 files changed:
apt-dht.conf [new file with mode: 0644]
apt-dht.py
apt_dht/apt_dht_conf.py
debian/apt-dht.conf.sgml [new file with mode: 0644]
debian/apt-dht.sgml [new file with mode: 0644]
debian/changelog [new file with mode: 0644]
debian/compat [new file with mode: 0644]
debian/control [new file with mode: 0644]
debian/copyright [new file with mode: 0644]
debian/default [new file with mode: 0644]
debian/dirs [new file with mode: 0644]
debian/docs [new file with mode: 0644]
debian/init.d [new file with mode: 0755]
debian/install [new file with mode: 0644]
debian/manpages [new file with mode: 0644]
debian/postinst [new file with mode: 0644]
debian/postrm [new file with mode: 0644]
debian/prerm [new file with mode: 0644]
debian/rules [new file with mode: 0755]

diff --git a/apt-dht.conf b/apt-dht.conf
new file mode 100644 (file)
index 0000000..6c9b055
--- /dev/null
@@ -0,0 +1,90 @@
+# The apt-dht configuration file.
+#
+# This is an ini-type configuration file, using sections identified by
+# square brackets. Values are specified on a single line using the '='
+# sign. Some values indicate times, in which case a suffix of 'd' for
+# days, 'h' for hours, 'm' for minutes, and 's' for seconds can be used.
+# Some values can span multiple lines by starting the subsequent lines
+# with one or more spaces.
+#
+#########################  DEFAULT  ###################################
+# This is the default section containing the configuration options for the
+# main application.
+[DEFAULT]
+
+# The number of the port to listen on for requests.
+# The main application will use this TCP port to listen for requests from APT, and
+# for uploads to other peers. If a port is not specified for the DHT, it will also
+# use this UDP port to listen for DHT requests.
+PORT = 9977
+    
+# Directory to store the downloaded files in
+CACHE_DIR = /var/cache/apt-dht
+    
+# Other directories containing packages to share with others
+# WARNING: all files in these directories will be hashed and available
+#          for everybody to download
+# OTHER_DIRS = 
+    
+# Whether it's OK to use an IP addres from a known local/private range
+LOCAL_OK = no
+
+# Which DHT implementation to use.
+# It must be possile to do "from <DHT>.DHT import DHT" to get a class that
+# implements the IDHT interface. There should also be a similarly named
+# section below to specify the options for the DHT.
+DHT = apt_dht_Khashmir
+
+# Whether to only run the DHT (for providing only a bootstrap node)
+DHT-ONLY = no
+
+#######################  apt_dht_Khashmir  ############################
+# This is the default (included) DHT to use.
+[apt_dht_Khashmir]
+
+# To specify a different (UDP) port for the DHT to use.
+# If not specified here, the PORT value in the DEFAULT section will be used.
+# PORT = 
+
+# bootstrap nodes to contact to join the DHT
+BOOTSTRAP = www.camrdale.org:9977
+            steveholt.hopto.org:9976
+
+# whether this node is a bootstrap node
+BOOTSTRAP_NODE = no
+
+# Kademlia "K" constant, this should be an even number
+K = 8
+
+# SHA1 is 160 bits long
+HASH_LENGTH = 160
+
+# interval between saving the running state
+CHECKPOINT_INTERVAL = 15m
+
+# concurrent number of calls per find node/value request!
+CONCURRENT_REQS = 4
+
+# how many hosts to post values to
+STORE_REDUNDANCY = 3
+
+# how many times in a row a node can fail to respond before it's booted from the routing table
+MAX_FAILURES = 3
+
+# never ping a node more often than this
+MIN_PING_INTERVAL = 15m
+
+# refresh buckets that haven't been touched in this long
+BUCKET_STALENESS = 1h
+
+# time before expirer starts running
+KEINITIAL_DELAY = 15s
+
+# time between expirer runs
+KE_DELAY = 20m
+
+# expire entries older than this
+KE_AGE = 1h
+
+# whether to spew info about the requests/responses in the protocol
+SPEW = no
index c8d007982cad455ca9e5dba42bcb601fee170072..b096d383cd831927f39202de7fca3647aa99121e 100644 (file)
@@ -16,7 +16,7 @@ from twisted.internet import reactor
 from twisted.python import usage, log
 from twisted.web2 import channel
 
-from apt_dht.apt_dht_conf import config, version
+from apt_dht.apt_dht_conf import config, version, DEFAULT_CONFIG_FILES
 from apt_dht.interfaces import IDHT
 
 config_file = []
@@ -51,7 +51,7 @@ if __name__ == '__main__':
         f = open(log_file, 'w')
     log.startLogging(f, setStdout=1)
 
-config.read(config_file)
+config.read(DEFAULT_CONFIG_FILES + [config_file])
 if config.has_option('DEFAULT', 'username') and config.get('DEFAULT', 'username'):
     uid,gid = pwd.getpwnam(config.get('DEFAULT', 'username'))[2:4]
 else:
index 4f77d6f61188ad0550cce674c182b18b9d9cff2a..fb2be962d5334a7e9c0bd26da8d22c1c29f0f069 100644 (file)
@@ -16,6 +16,8 @@ if home == '${HOME}' or not os.path.isdir(home):
     home = os.path.expanduser('~')
     if not os.path.isdir(home):
         home = os.path.abspath(os.path.dirname(sys.argv[0]))
+DEFAULT_CONFIG_FILES=['/etc/apt-dht/apt-dht.conf',
+                      home + '/.apt-dht/apt-dht.conf']
 
 DEFAULTS = {
 
diff --git a/debian/apt-dht.conf.sgml b/debian/apt-dht.conf.sgml
new file mode 100644 (file)
index 0000000..b011c51
--- /dev/null
@@ -0,0 +1,290 @@
+<!doctype refentry PUBLIC "-//OASIS//DTD DocBook V4.1//EN" [
+
+  <!-- Fill in your name for FIRSTNAME and SURNAME. -->
+  <!ENTITY dhfirstname "<firstname>Cameron</firstname>">
+  <!ENTITY dhsurname   "<surname>Dale</surname>">
+  <!-- Please adjust the date whenever revising the manpage. -->
+  <!ENTITY dhdate      "<date>February 17, 2008</date>">
+  <!-- SECTION should be 1-8, maybe w/ subsection other parameters are
+       allowed: see man(7), man(1). -->
+  <!ENTITY dhsection   "<manvolnum>5</manvolnum>">
+  <!ENTITY dhemail     "<email>camrdale@gmail.com</email>">
+  <!ENTITY dhusername  "Cameron Dale">
+  <!ENTITY dhucpackage "<refentrytitle>apt-dht.conf</refentrytitle>">
+  <!ENTITY dhpackage   "apt-dht">
+
+  <!ENTITY debian      "<productname>Debian</productname>">
+  <!ENTITY gnu         "<acronym>GNU</acronym>">
+  <!ENTITY gpl         "&gnu; <acronym>GPL</acronym>">
+]>
+
+<refentry>
+  <refentryinfo>
+    <address>
+      &dhemail;
+    </address>
+    <author>
+      &dhfirstname;
+      &dhsurname;
+    </author>
+    <copyright>
+      <year>2008</year>
+      <holder>&dhusername;</holder>
+    </copyright>
+    &dhdate;
+  </refentryinfo>
+  <refmeta>
+    &dhucpackage;
+
+    &dhsection;
+  </refmeta>
+
+  <refnamediv>
+    <refname>&dhpackage;</refname>
+
+    <refpurpose>configuration file for &dhpackage;</refpurpose>
+  </refnamediv>
+
+  <refsect1>
+    <title>DESCRIPTION</title>
+
+    <para>Configuration information for &dhpackage; is searched for in the following order, with later
+      entries overriding former ones:
+      <OrderedList>
+        <ListItem><para>/etc/apt-dht/apt-dht.conf</para></ListItem>
+        <ListItem><para>${HOME}/.apt-dht/apt-dht.conf</para></ListItem>
+        <ListItem><para>the location specified by the config-file parameter</para></ListItem>
+      </OrderedList>
+    </para>
+    
+  </refsect1>
+  <refsect1>
+    <title>FORMAT</title>
+
+    <para>&dhpackage; has a structure similar to Microsoft Windows INI files.
+       The configuration file consists of sections, led by a ``[section]'' header and followed
+       by ``name = value'' or ``name: value'' entries, with continuations in the style of RFC 822
+       (values can span multiple lines by starting the subsequent lines with one or more spaces).
+       Some values indicate times, in which case a suffix of 'd' for
+       days, 'h' for hours, 'm' for minutes, and 's' for seconds can be used.
+       Boolean values can be '1', 'yes', 'true', and 'on' to evaluate to True,
+       or '0', 'no', 'false', and 'off' to evaluate to false.
+       Note that leading whitespace is removed from values, and case is not important.
+       Lines beginning with "#" or ";" are ignored and may be used to provide comments.</para>
+    
+  </refsect1>
+  <refsect1>
+    <title>VARIABLES</title>
+      <para>There are 2 required sections in the config file. The first is the DEFAULT section, providing
+        variables for the configuration of the main application. The second is the section that provides
+        variables for the configuration of the DHT.</para>
+        
+      <refsect2>
+       <title>DEFAULT</title>
+
+        <variablelist>
+         <varlistentry>
+           <term><option>PORT = <replaceable>number</replaceable></option></term>
+            <listitem>
+             <para>The <replaceable>number</replaceable> of the port to listen on for requests.
+                 The main application will use this TCP port to listen for requests from APT, and
+                 for uploads to other peers. If a port is not specified for the DHT, it will also
+                 use this UDP port to listen for DHT requests.
+                 (Default is 9977.)</para>
+           </listitem>
+         </varlistentry>
+         <varlistentry>
+           <term><option>CACHE_DIR = <replaceable>directory</replaceable></option></term>
+            <listitem>
+             <para>The <replaceable>directory</replaceable> to store the downloaded files in.
+               (Default is ${HOME}/.apt-dht/cache.)</para>
+           </listitem>
+         </varlistentry>
+         <varlistentry>
+           <term><option>OTHER_DIRS = <replaceable>list</replaceable></option></term>
+            <listitem>
+             <para>The <replaceable>list</replaceable> of directories containing packages to share with others.
+               All files in these directories will be hashed and available for everybody to download.
+               (Default is to share only the files downloaded.)</para>
+           </listitem>
+         </varlistentry>
+         <varlistentry>
+           <term><option>LOCAL_OK = <replaceable>boolean</replaceable></option></term>
+            <listitem>
+             <para>Whether it's OK to use an IP addres from a known local or private range.
+               (Default is false)</para>
+           </listitem>
+         </varlistentry>
+         <varlistentry>
+           <term><option>DHT = <replaceable>string</replaceable></option></term>
+            <listitem>
+             <para>The DHT implementation to use. It must be possile to do (in python)
+               ``from &lt;DHT&gt;.DHT import DHT'' to get a class that implements the IDHT interface.
+               There should also be a similarly named section below to specify the options for the DHT.
+               (Default is `apt_dht_Khashmir')</para>
+           </listitem>
+         </varlistentry>
+         <varlistentry>
+           <term><option>DHT-ONLY = <replaceable>boolean</replaceable></option></term>
+            <listitem>
+             <para>Whether to only run the DHT. This can be useful for providing only a bootstrap node.
+               (Default is false)</para>
+           </listitem>
+         </varlistentry>
+       </variablelist>
+      </refsect2>
+      <refsect2>
+       <title>apt_dht_Khashmir</title>
+
+        <variablelist>
+         <varlistentry>
+           <term><option>PORT = <replaceable>number</replaceable></option></term>
+            <listitem>
+             <para>The <replaceable>number</replaceable> of the port to listen on for DHT (UDP) requests.
+                 (Default is to use the value specified in the DEFAULT section.)</para>
+           </listitem>
+         </varlistentry>
+         <varlistentry>
+           <term><option>BOOTSTRAP = <replaceable>list</replaceable></option></term>
+            <listitem>
+             <para>The <replaceable>list</replaceable> of bootstrap nodes to contact to join the DHT.
+               Each node should be on a separate line, and start with the IP address or host name,
+               followed by a colon and the port number.
+               (Default is a list of known good nodes.)</para>
+           </listitem>
+         </varlistentry>
+         <varlistentry>
+           <term><option>BOOTSTRAP_NODE = <replaceable>boolean</replaceable></option></term>
+            <listitem>
+             <para>Whether this node is a bootstrap node.
+               (Default is false)</para>
+           </listitem>
+         </varlistentry>
+         <varlistentry>
+           <term><option>K = <replaceable>number</replaceable></option></term>
+            <listitem>
+             <para>The <replaceable>number</replaceable> of the Kademlia "K" constant.
+                 It should be an even number.
+                 (Default is 8.)</para>
+           </listitem>
+         </varlistentry>
+         <varlistentry>
+           <term><option>HASH_LENGTH = <replaceable>number</replaceable></option></term>
+            <listitem>
+             <para>The <replaceable>number</replaceable> of bits in the hash to use.
+                 (Default is 160.)</para>
+           </listitem>
+         </varlistentry>
+         <varlistentry>
+           <term><option>CHECKPOINT_INTERVAL = <replaceable>time</replaceable></option></term>
+            <listitem>
+             <para>The <replaceable>time</replaceable> to wait between saves of the running state.
+                 (Default is 15 minutes.)</para>
+           </listitem>
+         </varlistentry>
+         <varlistentry>
+           <term><option>CONCURRENT_REQS = <replaceable>number</replaceable></option></term>
+            <listitem>
+             <para>The concurrent <replaceable>number</replaceable> of calls per find node/value request.
+                 (Default is 4.)</para>
+           </listitem>
+         </varlistentry>
+         <varlistentry>
+           <term><option>STORE_REDUNDANCY = <replaceable>number</replaceable></option></term>
+            <listitem>
+             <para>The <replaceable>number</replaceable> of redundant copies of a value to store in the DHT.
+                 (Default is 3.)</para>
+           </listitem>
+         </varlistentry>
+         <varlistentry>
+           <term><option>MAX_FAILURES = <replaceable>number</replaceable></option></term>
+            <listitem>
+             <para>The <replaceable>number</replaceable> of times in a row a node can fail to
+                 respond before it's booted from the routing table.
+                 (Default is 3.)</para>
+           </listitem>
+         </varlistentry>
+         <varlistentry>
+           <term><option>MIN_PING_INTERVAL = <replaceable>time</replaceable></option></term>
+            <listitem>
+             <para>The minimum <replaceable>time</replaceable> to wait before re-pinging a node.
+                 (Default is 15 minutes.)</para>
+           </listitem>
+         </varlistentry>
+         <varlistentry>
+           <term><option>BUCKET_STALENESS = <replaceable>time</replaceable></option></term>
+            <listitem>
+             <para>The maximum <replaceable>time</replaceable> to wait before refreshing a bucket.
+                 (Default is 1 hour.)</para>
+           </listitem>
+         </varlistentry>
+         <varlistentry>
+           <term><option>KEINITIAL_DELAY = <replaceable>time</replaceable></option></term>
+            <listitem>
+             <para>The <replaceable>time</replaceable> to wait after startup before starting the key expirer.
+                 (Default is 15 seconds.)</para>
+           </listitem>
+         </varlistentry>
+         <varlistentry>
+           <term><option>KE_DELAY = <replaceable>time</replaceable></option></term>
+            <listitem>
+             <para>The <replaceable>time</replaceable> to wait between runs of the key expirer.
+                 (Default is 20 minutes.)</para>
+           </listitem>
+         </varlistentry>
+         <varlistentry>
+           <term><option>KE_AGE = <replaceable>time</replaceable></option></term>
+            <listitem>
+             <para>The <replaceable>time</replaceable> to wait before expiring unrefreshed keys.
+                 (Default is 1 hour.)</para>
+           </listitem>
+         </varlistentry>
+         <varlistentry>
+           <term><option>SPEW = <replaceable>boolean</replaceable></option></term>
+            <listitem>
+             <para>Whether to log lots of info about the requests and responses in the protocol.
+               (Default is false)</para>
+           </listitem>
+         </varlistentry>
+       </variablelist>
+     </refsect2>
+  </refsect1>
+
+  <refsect1>
+    <title>SEE ALSO</title>
+
+    <para>
+      <citerefentry><refentrytitle>apt-dht</refentrytitle><manvolnum>8</manvolnum></citerefentry>
+    </para>
+  </refsect1>
+  <refsect1>
+    <title>AUTHOR</title>
+    <para>This manual page was written by &dhusername; &lt;&dhemail;> for
+      the &debian; system (but may be used by others).  Permission is
+      granted to copy, distribute and/or modify this document under
+      the terms of the &gnu; General Public License, Version 2 or any
+      later version published by the Free Software Foundation.
+    </para>
+    <para>
+      On Debian systems, the complete text of the GNU General Public
+      License can be found in /usr/share/common-licenses/GPL.
+    </para>
+  </refsect1>
+</refentry>
+
+<!-- Keep this comment at the end of the file
+Local variables:
+mode: sgml
+sgml-omittag:t
+sgml-shorttag:t
+sgml-minimize-attributes:nil
+sgml-always-quote-attributes:t
+sgml-indent-step:2
+sgml-indent-data:t
+sgml-parent-document:nil
+sgml-default-dtd-file:nil
+sgml-exposed-tags:nil
+sgml-local-catalogs:nil
+sgml-local-ecat-files:nil
+End:
+-->
diff --git a/debian/apt-dht.sgml b/debian/apt-dht.sgml
new file mode 100644 (file)
index 0000000..c368bc8
--- /dev/null
@@ -0,0 +1,163 @@
+<!doctype refentry PUBLIC "-//OASIS//DTD DocBook V4.1//EN" [
+
+  <!-- Fill in your name for FIRSTNAME and SURNAME. -->
+  <!ENTITY dhfirstname "<firstname>Cameron</firstname>">
+  <!ENTITY dhsurname   "<surname>Dale</surname>">
+  <!-- Please adjust the date whenever revising the manpage. -->
+  <!ENTITY dhdate      "<date>February 17, 2008</date>">
+  <!-- SECTION should be 1-8, maybe w/ subsection other parameters are
+       allowed: see man(7), man(1). -->
+  <!ENTITY dhsection   "<manvolnum>8</manvolnum>">
+  <!ENTITY dhemail     "<email>camrdale@gmail.com</email>">
+  <!ENTITY dhusername  "Cameron Dale">
+  <!ENTITY dhucpackage "<refentrytitle>apt-dht</refentrytitle>">
+  <!ENTITY dhpackage   "apt-dht">
+
+  <!ENTITY debian      "<productname>Debian</productname>">
+  <!ENTITY gnu         "<acronym>GNU</acronym>">
+  <!ENTITY gpl         "&gnu; <acronym>GPL</acronym>">
+]>
+
+<refentry>
+  <refentryinfo>
+    <address>
+      &dhemail;
+    </address>
+    <author>
+      &dhfirstname;
+      &dhsurname;
+    </author>
+    <copyright>
+      <year>2008</year>
+      <holder>&dhusername;</holder>
+    </copyright>
+    &dhdate;
+  </refentryinfo>
+  <refmeta>
+    &dhucpackage;
+
+    &dhsection;
+  </refmeta>
+
+  <refnamediv>
+    <refname>&dhpackage;</refname>
+
+    <refpurpose>apt helper for peer-to-peer downloads of Debian packages</refpurpose>
+  </refnamediv>
+  <refsynopsisdiv>
+    <para>Normally &dhpackage; is run from init.d using <command>twistd</command>, in which case no &dhpackage;
+        options can be specified on the command-line, and all configuration variables are
+        read from the default config file locations of ${HOME}/.apt-dht.conf and /etc/apt-dht/apt-dht.conf.
+        The command is then:</para>
+    <cmdsynopsis>
+      <command>twistd</command> <arg choice="Req">-y /path/to/&dhpackage;</arg> <arg rep="Repeat"><option>twistd options</option></arg>
+    </cmdsynopsis>
+    <para>For a detailed listing of the twistd options, see
+        <citerefentry><refentrytitle>twistd</refentrytitle><manvolnum>1</manvolnum></citerefentry></para>
+    <para>&dhpackage; can also be run without twistd by executing:</para>
+    <cmdsynopsis>
+      <command>&dhpackage;</command> <arg rep="Repeat"><option>options</option></arg>
+    </cmdsynopsis>
+    <para>In this case, you can specify the options documented below on the command-line.</para>
+  </refsynopsisdiv>
+  <refsect1>
+    <title>DESCRIPTION</title>
+
+    <para>This manual page documents briefly the options available to the &dhpackage; command.</para>
+
+    <para><command>&dhpackage;</command> is a helper for downloading Debian packages files with APT.
+        It will download any needed files from other Apt-DHT peers in a
+        bittorrent-like manner, and so reduce the strain on the Debian mirrors.</para>
+
+    <para>In order for APT to send it's requests to &dhpackage;, the source.list entries must be modified to point to the
+        local &dhpackage; address. Unless you have changed the default port, then adding "localhost:9977/" to the beginning
+        of each entry should be sufficient. For example, if your sources.list contains a line like this:</para>
+
+    <para>deb http://ftp.us.debian.org/debian etch main contrib non-free</para>
+
+    <para>then replace it with this:</para>
+
+    <para>deb http://localhost:9977/ftp.us.debian.org/debian etch main contrib non-free</para>
+    
+    <para>The port can be changed in the &dhpackage; config file in /etc/&dhpackage;/&dhpackage;.conf,
+        but it defaults to 9977.</para>
+  </refsect1>
+  <refsect1>
+    <title>OPTIONS</title>
+
+    <para>These programs follow the usual &gnu; command line syntax,
+      with short options starting with a single dash (`-'),
+      and long options starting with two dashes (`--').
+      A summary of options is included below.</para>
+    
+    <variablelist>
+      <varlistentry>
+        <term><option>-c <replaceable>filename</replaceable>,</option> <option>--configfile=<replaceable>filename</replaceable></option></term>
+         <listitem>
+          <para>the <replaceable>filename</replaceable> to use for the configuration file, options found in this
+              file are combined with those in ${HOME}/.apt-dht/apt-dht.conf and /etc/apt-dht/apt-dht.conf
+              (see <citerefentry><refentrytitle>apt-dht.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry> for the format of the file)</para>
+        </listitem>
+      </varlistentry>
+      <varlistentry>
+        <term><option>-l <replaceable>filename</replaceable>,</option> <option>--logfile=<replaceable>filename</replaceable></option></term>
+         <listitem>
+          <para>the <replaceable>filename</replaceable> to print log messages to,
+              or `-' to log to standard output, if not specified then
+              /var/log/apt-dht.log will be used</para>
+        </listitem>
+      </varlistentry>
+      <varlistentry>
+        <term><option>-h</option>, <option>--help</option></term>
+        <listitem>
+          <para>print a help message describing the invocation of the program</para>
+        </listitem>
+      </varlistentry>
+      <varlistentry>
+        <term><option>-v</option>, <option>--version</option></term>
+        <listitem>
+          <para>print the version of the program</para>
+        </listitem>
+      </varlistentry>
+    </variablelist>
+  </refsect1>
+
+  <refsect1>
+    <title>SEE ALSO</title>
+
+    <para>
+      <citerefentry><refentrytitle>apt-dht.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
+      <citerefentry><refentrytitle>twistd</refentrytitle><manvolnum>1</manvolnum></citerefentry>
+    </para>
+  </refsect1>
+  <refsect1>
+    <title>AUTHOR</title>
+    <para>This manual page was written by &dhusername; &lt;&dhemail;> for
+      the &debian; system (but may be used by others).  Permission is
+      granted to copy, distribute and/or modify this document under
+      the terms of the &gnu; General Public License, Version 2 or any
+      later version published by the Free Software Foundation.
+    </para>
+    <para>
+      On Debian systems, the complete text of the GNU General Public
+      License can be found in /usr/share/common-licenses/GPL.
+    </para>
+  </refsect1>
+</refentry>
+
+<!-- Keep this comment at the end of the file
+Local variables:
+mode: sgml
+sgml-omittag:t
+sgml-shorttag:t
+sgml-minimize-attributes:nil
+sgml-always-quote-attributes:t
+sgml-indent-step:2
+sgml-indent-data:t
+sgml-parent-document:nil
+sgml-default-dtd-file:nil
+sgml-exposed-tags:nil
+sgml-local-catalogs:nil
+sgml-local-ecat-files:nil
+End:
+-->
diff --git a/debian/changelog b/debian/changelog
new file mode 100644 (file)
index 0000000..689ea1a
--- /dev/null
@@ -0,0 +1,5 @@
+apt-dht (0.0.0) sid; urgency=low
+
+  * Initial release.
+
+ -- Cameron Dale <camrdale@gmail.com>  Sun, 17 Feb 2008 13:42:40 -0800
diff --git a/debian/compat b/debian/compat
new file mode 100644 (file)
index 0000000..1e8b314
--- /dev/null
@@ -0,0 +1 @@
+6
diff --git a/debian/control b/debian/control
new file mode 100644 (file)
index 0000000..22feb84
--- /dev/null
@@ -0,0 +1,37 @@
+Source: apt-dht
+Section: net
+Priority: optional
+Maintainer: Cameron Dale <camrdale@gmail.com>
+Homepage: http://www.camrdale.org/apt-dht.html
+Standards-Version: 3.7.3
+Build-Depends: debhelper (>= 5.0.37.2)
+Build-Depends-Indep: python-dev, python-support (>= 0.5.4), docbook-to-man
+Build-Depends-Indep: python-twisted-web (>= 0.6), python (>= 2.3.5-1), python-apt, python-central (>= 0.5)
+Vcs-Git: git://git.camrdale.org/git/apt-dht.git
+Vcs-Browser: http://git.camrdale.org/?p=apt-dht.git;a=summary
+XS-Dm-Upload-Allowed: yes
+
+Package: apt-dht
+Architecture: all
+Depends: ${python:Depends}, python-twisted-web (>= 0.6), python-apt (>= 0.5.8)
+Depends: ${python:Depends}, adduser, python-debian (>= 0.1.4), python-apt
+Provides: python-apt-dht, python-apt-dht-khashmir
+Description: apt helper for peer-to-peer downloads of Debian packages
+ Apt-DHT is a helper for downloading Debian packages files with APT.
+ It will download any needed files from other Apt-DHT peers in a
+ bittorrent-like manner, and so reduce the strain on the Debian mirrors.
+ .
+ The Apt-DHT daemon runs automatically on startup and listens for
+ requests from APT for files, as well as maintaining membership in a
+ Distributed Hash Table (DHT). For any files which have a hash
+ available (most files), peers that have the file are looked for in the
+ DHT. The file can then be downloaded from them, using the uploading
+ bandwidth of other peers while reducing the demand on the Debian mirror
+ network. However, if a package cannot be found on any peers, Apt-DHT
+ will fall back to downloading from a mirror to ensure all packages are
+ downloaded. Once downloaded, the file is hash checked and added to the
+ DHT so that other peers can download it without the mirror.
+ .
+ The configuration is very simple, and only involves prepending
+ 'localhost' and the port to your current sources.list lines (similar
+ to other apt-proxy-like software).
diff --git a/debian/copyright b/debian/copyright
new file mode 100644 (file)
index 0000000..65ee9ba
--- /dev/null
@@ -0,0 +1,14 @@
+This is the Debian GNU/Linux packaged version of apt-dht
+
+The package is written and maintained by Cameron Dale.
+
+The original source can always be found at:
+    http://ftp.debian.org/debian/pool/main/a/apt-dht/
+
+The project homepage is at
+  http://www.camrdale.org/apt-dht.html
+
+This software is released under the terms of the GNU General Public License.
+
+On Debian systems, the complete text of the GNU General Public License
+can be found in /usr/share/common-licenses/GPL.
diff --git a/debian/default b/debian/default
new file mode 100644 (file)
index 0000000..490116c
--- /dev/null
@@ -0,0 +1,7 @@
+# apt-dht configuration
+
+## Filename to store pid of process
+#pidfile=/var/run/apt-dht/apt-dht.pid 
+
+## Log file
+#logfile=/var/log/apt-dht.log
diff --git a/debian/dirs b/debian/dirs
new file mode 100644 (file)
index 0000000..74bf09f
--- /dev/null
@@ -0,0 +1,6 @@
+etc/default
+etc/init.d
+usr/share/doc/apt-dht
+usr/sbin
+var/cache/apt-dht
+var/lib/apt-dht
diff --git a/debian/docs b/debian/docs
new file mode 100644 (file)
index 0000000..724e084
--- /dev/null
@@ -0,0 +1,2 @@
+README
+TODO
diff --git a/debian/init.d b/debian/init.d
new file mode 100755 (executable)
index 0000000..1543442
--- /dev/null
@@ -0,0 +1,108 @@
+#!/bin/sh
+
+### BEGIN INIT INFO
+# Provides:          apt-dht
+# Required-Start:    $network
+# Required-Stop:
+# Should-Start:      $named
+# Should-Stop:
+# Default-Start:     2 3 4 5
+# Default-Stop:      0 1 6
+# Short-Description: apt helper for peer-to-peer downloads of Debian packages
+# Description:       Apt-DHT is a helper for downloading Debian packages
+#                    files with APT. It will download any needed files from
+#                    other Apt-DHT peers in a bittorrent-like manner, and so
+#                    reduce the strain on the Debian mirrors.
+### END INIT INFO
+
+# /etc/init.d/apt-dht: start and stop the apt-dht daemon
+
+PATH=/sbin:/bin:/usr/sbin:/usr/bin
+
+rundir=/var/run/apt-dht/ 
+pidfile=$rundir/apt-dht.pid 
+logfile=/var/log/apt-dht.log
+application=/usr/sbin/apt-dht
+twistd=/usr/bin/twistd
+user=aptdht
+group=nogroup
+
+[ -r /etc/default/apt-dht ] && . /etc/default/apt-dht
+
+test -x $twistd || exit 0
+test -r $application || exit 0
+
+# return true if at least one pid is alive
+alive()
+{
+    if [ -z "$*" ]; then
+        return 1
+    fi
+    for i in $*; do
+        if kill -0 $i 2> /dev/null; then
+            return 0
+        fi
+    done
+
+    return 1
+}
+
+
+case "$1" in
+    start)
+        echo -n "Starting apt-dht"
+        [ ! -d $rundir ] && mkdir $rundir
+        [ ! -f $logfile ] && touch $logfile
+        chown $user $rundir $logfile 
+        [ -f $pidfile ] && chown $user $pidfile
+        # Make cache files readable
+        umask 022
+        start-stop-daemon --start --quiet --exec $twistd -- \
+            --pidfile=$pidfile --rundir=$rundir --python=$application \
+            --logfile=$logfile --no_save
+        echo "."        
+    ;;
+
+    stop)
+        echo -n "Stopping apt-dht"
+        start-stop-daemon --stop --quiet --pidfile $pidfile
+        #
+        # Continue stopping until daemon finished or time over
+        #
+        count=0
+        pid=$(cat $pidfile 2>/dev/null)
+        while alive $pid; do
+                if [ $count -gt 20 ]; then
+                        echo -n " aborted"
+                        break;
+                elif [ $count = 1 ]; then
+                        echo -n " [wait $count"
+                elif [ $count -gt 1 ]; then
+                        echo -n " $count"
+                fi
+                count=$(expr $count + 1)
+                sleep 1
+                start-stop-daemon --stop --quiet --pidfile $pidfile
+        done
+        if [ $count -gt 1 ]; then
+                echo -n "]"
+        fi
+        echo "."        
+    ;;
+
+    restart)
+        $0 stop
+        $0 start
+    ;;
+    
+    force-reload)
+        $0 restart
+    ;;
+
+    *)
+        echo "Usage: /etc/init.d/apt-dht {start|stop|restart|force-reload}" >&2
+        exit 1
+    ;;
+esac
+
+exit 0
diff --git a/debian/install b/debian/install
new file mode 100644 (file)
index 0000000..4ea6423
--- /dev/null
@@ -0,0 +1 @@
+apt-dht.conf etc/apt-dht
diff --git a/debian/manpages b/debian/manpages
new file mode 100644 (file)
index 0000000..31493df
--- /dev/null
@@ -0,0 +1,2 @@
+debian/apt-dht.8
+debian/apt-dht.conf.5
diff --git a/debian/postinst b/debian/postinst
new file mode 100644 (file)
index 0000000..636f90f
--- /dev/null
@@ -0,0 +1,55 @@
+#! /bin/sh
+# postinst script for apt-dht
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# summary of how this script can be called:
+#        * <postinst> `configure' <most-recently-configured-version>
+#        * <old-postinst> `abort-upgrade' <new version>
+#        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
+#          <new-version>
+#        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
+#          <failed-install-package> <version> `removing'
+#          <conflicting-package> <version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+#
+# quoting from the policy:
+#     Any necessary prompting should almost always be confined to the
+#     post-installation script, and should be protected with a conditional
+#     so that unnecessary prompting doesn't happen if a package's
+#     installation fails and the `postinst' is called with `abort-upgrade',
+#     `abort-remove' or `abort-deconfigure'.
+
+case "$1" in
+    configure)
+               if ! getent passwd aptdht >/dev/null; then
+                       adduser --quiet --system --no-create-home \
+                                       --home /var/cache/apt-dht --disabled-password \
+                                       --disabled-login --shell /bin/false --ingroup nogroup \
+                                       aptdht
+               fi
+               
+               touch /var/log/apt-dht.log
+               chown aptdht:adm /var/log/apt-dht.log
+               mkdir -p /var/cache/apt-dht
+               chown -R aptdht:adm /var/cache/apt-dht
+    ;;
+
+    abort-upgrade|abort-remove|abort-deconfigure)
+    ;;
+
+    *)
+           echo "postinst called with unknown argument \`$1'" >&2
+           exit 1
+    ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0
diff --git a/debian/postrm b/debian/postrm
new file mode 100644 (file)
index 0000000..8ff06f8
--- /dev/null
@@ -0,0 +1,37 @@
+#! /bin/sh
+# postrm script for apt-dht
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# summary of how this script can be called:
+#        * <postrm> `remove'
+#        * <postrm> `purge'
+#        * <old-postrm> `upgrade' <new-version>
+#        * <new-postrm> `failed-upgrade' <old-version>
+#        * <new-postrm> `abort-install'
+#        * <new-postrm> `abort-install' <old-version>
+#        * <new-postrm> `abort-upgrade' <old-version>
+#        * <disappearer's-postrm> `disappear' <r>overwrit>r> <new-version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+if test "$1" = "purge"; then
+  # Remove the logs
+  rm -rf /var/log/apt-dht.log*
+  
+  echo Purging apt-dht cache directory
+  rm -rf /var/cache/apt-dht
+
+  if id aptdht >/dev/null; then
+    deluser aptdht
+  fi
+fi
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0
diff --git a/debian/prerm b/debian/prerm
new file mode 100644 (file)
index 0000000..f148cf5
--- /dev/null
@@ -0,0 +1,30 @@
+#! /bin/sh
+# prerm script for #PACKAGE#
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# summary of how this script can be called:
+#        * <prerm> `remove'
+#        * <old-prerm> `upgrade' <new-version>
+#        * <new-prerm> `failed-upgrade' <old-version>
+#        * <conflictor's-prerm> `remove' `in-favour' <package> <new-version>
+#        * <deconfigured's-prerm> `deconfigure' `in-favour'
+#          <package-being-installed> <version> `removing'
+#          <conflicting-package> <version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+PACKAGE="apt-dht"
+
+dpkg --listfiles $PACKAGE |
+        awk '$0~/\.py$/ {print $0"c\n" $0"o"}' |
+        xargs rm -f >&2
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0
diff --git a/debian/rules b/debian/rules
new file mode 100755 (executable)
index 0000000..3701079
--- /dev/null
@@ -0,0 +1,68 @@
+#!/usr/bin/make -f
+# Sample debian/rules that uses debhelper.
+# GNU copyright 1997 to 1999 by Joey Hess.
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+PYTHON_VERSION=$(shell /usr/bin/python -V 2>&1 | /usr/bin/perl -le 'print "$$1.$$2" if <> =~m/^Python\s+(\d+)\.(\d+)(\.\d+)*/')
+
+
+build-stamp: apt-dht.8 apt-dht.conf.5
+       dh_testdir
+       touch build-stamp
+
+%.1:   debian/%.sgml
+       /usr/bin/docbook-to-man $< > debian/$@
+
+clean:
+       dh_testdir
+       dh_testroot
+       rm -rf build/ apt_dht/*.pyc apt_dht_Khashmir/*.pyc *.pyc
+       rm -f debian/*.[58]
+       rm -f build-stamp
+       dh_clean
+
+install: build-stamp
+
+
+       dh_testdir
+       dh_testroot
+       dh_clean -k
+       dh_installdirs
+
+       ./setup.py install --prefix=$(CURDIR)/debian/apt-dht/usr --install-lib=$(CURDIR)/debian/apt-dht/usr/share/python-support/apt-dht
+
+       # Remove the generated .pyc files
+       ( cd debian/apt-dht/usr/share/python-support/apt-dht/apt_dht_Khashmir && \
+         rm -f *.pyc  && \
+         cd ../apt_dht && \
+         rm -f *.pyc )
+
+# Build architecture-independent files here.
+binary-indep: install
+       dh_testdir
+       dh_testroot
+       dh_installdocs
+       dh_installexamples
+       dh_installman
+       dh_installlogrotate
+       
+       # Remove the .py from the end of each of these
+       mv debian/apt-dht/usr/sbin/apt-dht.py debian/apt-dht/usr/sbin/apt-dht || exit 1; done
+
+       dh_installchangelogs 
+       dh_install
+       dh_link
+       dh_compress
+       dh_fixperms
+       dh_pysupport
+       dh_installinit
+       dh_installdeb
+       dh_shlibdeps
+       dh_gencontrol
+       dh_md5sums
+       dh_builddeb
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install