From 004b3242cd6b9933ea049039840f1071b0284ad8 Mon Sep 17 00:00:00 2001 From: Cameron Dale Date: Sun, 17 Feb 2008 19:42:45 -0800 Subject: [PATCH] Initial debian directory and packaging related changes. --- apt-dht.conf | 90 ++++++++++++ apt-dht.py | 4 +- apt_dht/apt_dht_conf.py | 2 + debian/apt-dht.conf.sgml | 290 +++++++++++++++++++++++++++++++++++++++ debian/apt-dht.sgml | 163 ++++++++++++++++++++++ debian/changelog | 5 + debian/compat | 1 + debian/control | 37 +++++ debian/copyright | 14 ++ debian/default | 7 + debian/dirs | 6 + debian/docs | 2 + debian/init.d | 108 +++++++++++++++ debian/install | 1 + debian/manpages | 2 + debian/postinst | 55 ++++++++ debian/postrm | 37 +++++ debian/prerm | 30 ++++ debian/rules | 68 +++++++++ 19 files changed, 920 insertions(+), 2 deletions(-) create mode 100644 apt-dht.conf create mode 100644 debian/apt-dht.conf.sgml create mode 100644 debian/apt-dht.sgml create mode 100644 debian/changelog create mode 100644 debian/compat create mode 100644 debian/control create mode 100644 debian/copyright create mode 100644 debian/default create mode 100644 debian/dirs create mode 100644 debian/docs create mode 100755 debian/init.d create mode 100644 debian/install create mode 100644 debian/manpages create mode 100644 debian/postinst create mode 100644 debian/postrm create mode 100644 debian/prerm create mode 100755 debian/rules diff --git a/apt-dht.conf b/apt-dht.conf new file mode 100644 index 0000000..6c9b055 --- /dev/null +++ b/apt-dht.conf @@ -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 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 diff --git a/apt-dht.py b/apt-dht.py index c8d0079..b096d38 100644 --- a/apt-dht.py +++ b/apt-dht.py @@ -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: diff --git a/apt_dht/apt_dht_conf.py b/apt_dht/apt_dht_conf.py index 4f77d6f..fb2be96 100644 --- a/apt_dht/apt_dht_conf.py +++ b/apt_dht/apt_dht_conf.py @@ -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 index 0000000..b011c51 --- /dev/null +++ b/debian/apt-dht.conf.sgml @@ -0,0 +1,290 @@ + + Cameron"> + Dale"> + + February 17, 2008"> + + 5"> + camrdale@gmail.com"> + + apt-dht.conf"> + + + Debian"> + GNU"> + GPL"> +]> + + + +
+ &dhemail; +
+ + &dhfirstname; + &dhsurname; + + + 2008 + &dhusername; + + &dhdate; +
+ + &dhucpackage; + + &dhsection; + + + + &dhpackage; + + configuration file for &dhpackage; + + + + DESCRIPTION + + Configuration information for &dhpackage; is searched for in the following order, with later + entries overriding former ones: + + /etc/apt-dht/apt-dht.conf + ${HOME}/.apt-dht/apt-dht.conf + the location specified by the config-file parameter + + + + + + FORMAT + + &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. + + + + VARIABLES + 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. + + + 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. + (Default is 9977.) + + + + + + The directory to store the downloaded files in. + (Default is ${HOME}/.apt-dht/cache.) + + + + + + The list 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.) + + + + + + Whether it's OK to use an IP addres from a known local or private range. + (Default is false) + + + + + + The DHT implementation to use. It must be possile to do (in python) + ``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. + (Default is `apt_dht_Khashmir') + + + + + + Whether to only run the DHT. This can be useful for providing only a bootstrap node. + (Default is false) + + + + + + apt_dht_Khashmir + + + + + + The number of the port to listen on for DHT (UDP) requests. + (Default is to use the value specified in the DEFAULT section.) + + + + + + The list 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.) + + + + + + Whether this node is a bootstrap node. + (Default is false) + + + + + + The number of the Kademlia "K" constant. + It should be an even number. + (Default is 8.) + + + + + + The number of bits in the hash to use. + (Default is 160.) + + + + + + The time to wait between saves of the running state. + (Default is 15 minutes.) + + + + + + The concurrent number of calls per find node/value request. + (Default is 4.) + + + + + + The number of redundant copies of a value to store in the DHT. + (Default is 3.) + + + + + + The number of times in a row a node can fail to + respond before it's booted from the routing table. + (Default is 3.) + + + + + + The minimum time to wait before re-pinging a node. + (Default is 15 minutes.) + + + + + + The maximum time to wait before refreshing a bucket. + (Default is 1 hour.) + + + + + + The time to wait after startup before starting the key expirer. + (Default is 15 seconds.) + + + + + + The time to wait between runs of the key expirer. + (Default is 20 minutes.) + + + + + + The time to wait before expiring unrefreshed keys. + (Default is 1 hour.) + + + + + + Whether to log lots of info about the requests and responses in the protocol. + (Default is false) + + + + + + + + SEE ALSO + + + apt-dht8 + + + + AUTHOR + This manual page was written by &dhusername; <&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. + + + 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/apt-dht.sgml b/debian/apt-dht.sgml new file mode 100644 index 0000000..c368bc8 --- /dev/null +++ b/debian/apt-dht.sgml @@ -0,0 +1,163 @@ + + Cameron"> + Dale"> + + February 17, 2008"> + + 8"> + camrdale@gmail.com"> + + apt-dht"> + + + Debian"> + GNU"> + GPL"> +]> + + + +
+ &dhemail; +
+ + &dhfirstname; + &dhsurname; + + + 2008 + &dhusername; + + &dhdate; +
+ + &dhucpackage; + + &dhsection; + + + + &dhpackage; + + apt helper for peer-to-peer downloads of Debian packages + + + Normally &dhpackage; is run from init.d using twistd, 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: + + twistd -y /path/to/&dhpackage; + + For a detailed listing of the twistd options, see + twistd1 + &dhpackage; can also be run without twistd by executing: + + &dhpackage; + + In this case, you can specify the options documented below on the command-line. + + + DESCRIPTION + + This manual page documents briefly the options available to the &dhpackage; command. + + &dhpackage; 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. + + 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: + + deb http://ftp.us.debian.org/debian etch main contrib non-free + + then replace it with this: + + deb http://localhost:9977/ftp.us.debian.org/debian etch main contrib non-free + + The port can be changed in the &dhpackage; config file in /etc/&dhpackage;/&dhpackage;.conf, + but it defaults to 9977. + + + OPTIONS + + 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. + + + + + + the filename 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 apt-dht.conf5 for the format of the file) + + + + + + the filename to print log messages to, + or `-' to log to standard output, if not specified then + /var/log/apt-dht.log will be used + + + + , + + print a help message describing the invocation of the program + + + + , + + print the version of the program + + + + + + + SEE ALSO + + + apt-dht.conf5, + twistd1 + + + + AUTHOR + This manual page was written by &dhusername; <&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. + + + 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/changelog b/debian/changelog new file mode 100644 index 0000000..689ea1a --- /dev/null +++ b/debian/changelog @@ -0,0 +1,5 @@ +apt-dht (0.0.0) sid; urgency=low + + * Initial release. + + -- Cameron Dale Sun, 17 Feb 2008 13:42:40 -0800 diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000..1e8b314 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +6 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..22feb84 --- /dev/null +++ b/debian/control @@ -0,0 +1,37 @@ +Source: apt-dht +Section: net +Priority: optional +Maintainer: Cameron Dale +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 index 0000000..65ee9ba --- /dev/null +++ b/debian/copyright @@ -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 index 0000000..490116c --- /dev/null +++ b/debian/default @@ -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 index 0000000..74bf09f --- /dev/null +++ b/debian/dirs @@ -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 index 0000000..724e084 --- /dev/null +++ b/debian/docs @@ -0,0 +1,2 @@ +README +TODO diff --git a/debian/init.d b/debian/init.d new file mode 100755 index 0000000..1543442 --- /dev/null +++ b/debian/init.d @@ -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 index 0000000..4ea6423 --- /dev/null +++ b/debian/install @@ -0,0 +1 @@ +apt-dht.conf etc/apt-dht diff --git a/debian/manpages b/debian/manpages new file mode 100644 index 0000000..31493df --- /dev/null +++ b/debian/manpages @@ -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 index 0000000..636f90f --- /dev/null +++ b/debian/postinst @@ -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: +# * `configure' +# * `abort-upgrade' +# * `abort-remove' `in-favour' +# +# * `abort-deconfigure' `in-favour' +# `removing' +# +# 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 index 0000000..8ff06f8 --- /dev/null +++ b/debian/postrm @@ -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: +# * `remove' +# * `purge' +# * `upgrade' +# * `failed-upgrade' +# * `abort-install' +# * `abort-install' +# * `abort-upgrade' +# * `disappear' overwrit>r> +# 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 index 0000000..f148cf5 --- /dev/null +++ b/debian/prerm @@ -0,0 +1,30 @@ +#! /bin/sh +# prerm script for #PACKAGE# +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * `remove' +# * `upgrade' +# * `failed-upgrade' +# * `remove' `in-favour' +# * `deconfigure' `in-favour' +# `removing' +# +# 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 index 0000000..3701079 --- /dev/null +++ b/debian/rules @@ -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 -- 2.39.5