diff -Nru mirrorkit-0.1.1/AUTHORS mirrorkit-0.2.1/AUTHORS --- mirrorkit-0.1.1/AUTHORS 2010-02-17 19:02:16.000000000 +0000 +++ mirrorkit-0.2.1/AUTHORS 2013-08-27 20:18:14.000000000 +0000 @@ -1,3 +1,18 @@ -Stephane Graber -Michael Jeanson +Copyright (applies if no explicit header in the file): +This program 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 program 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 program; if not, write to the Free Software +Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +Authors: + Copyright (c) 2012-2013 Stéphane Graber diff -Nru mirrorkit-0.1.1/COPYING mirrorkit-0.2.1/COPYING --- mirrorkit-0.1.1/COPYING 2010-02-17 19:02:16.000000000 +0000 +++ mirrorkit-0.2.1/COPYING 2013-08-27 20:17:53.000000000 +0000 @@ -1,8 +1,8 @@ GNU GENERAL PUBLIC LICENSE Version 2, June 1991 - Copyright (C) 1989, 1991 Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. @@ -15,7 +15,7 @@ General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by -the GNU Lesser General Public License instead.) You can apply it to +the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not @@ -55,7 +55,7 @@ The precise terms and conditions for copying, distribution and modification follow. - + GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION @@ -110,7 +110,7 @@ License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) - + These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in @@ -168,7 +168,7 @@ access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. - + 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is @@ -225,7 +225,7 @@ This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. - + 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License @@ -278,7 +278,7 @@ POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS - + How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest @@ -303,16 +303,17 @@ 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 program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: - Gnomovision version 69, Copyright (C) year name of author + Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. @@ -335,5 +336,5 @@ This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Lesser General +library. If this is what you want to do, use the GNU Library General Public License instead of this License. diff -Nru mirrorkit-0.1.1/README mirrorkit-0.2.1/README --- mirrorkit-0.1.1/README 2010-02-17 19:02:16.000000000 +0000 +++ mirrorkit-0.2.1/README 1970-01-01 00:00:00.000000000 +0000 @@ -1,5 +0,0 @@ -Dependencies: - - debhelper - - python subprocess - - python xml - - python urlparse diff -Nru mirrorkit-0.1.1/README-DEVELOPMENT-POLICY mirrorkit-0.2.1/README-DEVELOPMENT-POLICY --- mirrorkit-0.1.1/README-DEVELOPMENT-POLICY 2010-02-17 19:02:16.000000000 +0000 +++ mirrorkit-0.2.1/README-DEVELOPMENT-POLICY 1970-01-01 00:00:00.000000000 +0000 @@ -1,25 +0,0 @@ -After a quick discussion on coding styles, here's what we've currently got -for consensus: - -For shell scripts: - - - Shell scripts should be fully posix compliant. - - We will favour the use of if [ ]; then else fi, over && and ||, for clarity - - When using a multi check if, exception will be using the - if [ .. ] && [ .. ] || [ .. ] form, as opposed to [ .. -a .. -o .. ] form. - - If a single line test is used, use test &&/|| result, and only - for tests that fit on a single line. - - We'll use spaces instead of tabs, and the indentation level will be 4 - spaces, the same as python. - -For C programs: - - Programs should be passed through the "indent" program periodically to clean - them up. - - The following indent command line should be used: - indent -kr -i4 -nut -c50 -psl - - K&R style (Scott's a greybeard) - - 4 character tab width, and spaces instead of tabs - - Align inline comments on column 50 - - A newline after function definitions - - All if() else blocks will have {}'s, even if only 1 line long, or Ollie will break your thumbs. - - Comments will be /* */ or Scott will break the rest of your fingers. diff -Nru mirrorkit-0.1.1/TODO mirrorkit-0.2.1/TODO --- mirrorkit-0.1.1/TODO 2010-02-17 19:02:16.000000000 +0000 +++ mirrorkit-0.2.1/TODO 1970-01-01 00:00:00.000000000 +0000 @@ -1,12 +0,0 @@ -- Implement a generator for - - An index page - - The help pages - - Improved log pages - - Apache configuration (.htaccess) -- Support for primary and backup mirrors when used as a transparent mirror - - / is the mirror - - /.real is the primary mirror - - /.backup is the backup mirror - - When accessing a non-existent file in /, the user is redirected to /.real unless this one is unresponsive - - If it's unresponsive, a script (cron ?) will change the .htaccess to use /.backup instead -- Support translation using gettext diff -Nru mirrorkit-0.1.1/bin/mirrorkit mirrorkit-0.2.1/bin/mirrorkit --- mirrorkit-0.1.1/bin/mirrorkit 1970-01-01 00:00:00.000000000 +0000 +++ mirrorkit-0.2.1/bin/mirrorkit 2013-10-27 00:32:00.000000000 +0000 @@ -0,0 +1,349 @@ +#!/usr/bin/python3 +# -*- coding: utf-8 -*- + +# Copyright (C) 2008-2013 Stéphane Graber +# Author: Stéphane Graber + +# This program 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 program 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 can find the license on Debian systems in the file +# /usr/share/common-licenses/GPL-2 + +import argparse +import configparser +import logging +import os +import string +import subprocess +import sys +import tempfile +import time +import urllib.parse + + +def get_path_size(path): + total_size = 0 + for dirpath, dirnames, filenames in os.walk(path): + for f in filenames: + fp = os.path.join(dirpath, f) + total_size += os.path.getsize(fp) + return total_size + + +def parse_config(path): + """ + Return a dict representation of a .ini config + """ + config = {} + + configp = configparser.ConfigParser() + try: + configp.read(path) + except: + return config + + for section in configp.sections(): + config_section = {} + for option in configp.options(section): + value = configp.get(section, option) + if ", " in value: + value = [entry.strip('"').strip() + for entry in value.split(", ")] + else: + value = value.strip('"').strip() + config_section[option] = value + config[section] = config_section + + return config + + +def load_config(config_path): + """ + Read an ini configuration file and return a MirrorKitConfig object. + """ + + # Get a dict representation of the config + config = parse_config(config_path) + + # Process the global section + settings = {} + if not "global" in config: + logging.error("Missing 'global' config section.") + return None + + if not config['global'].get("publish_path", None): + logging.error("Missing 'publish_path' value.") + return None + + settings['publish_path'] = config['global']['publish_path'] + settings['log_path'] = config['global'].get("log_path", None) + if settings['log_path']: + if not config['global'].get("log_template_path", None): + logging.error("Missing 'log_template_path' value.") + return None + settings['log_template_path'] = config['global'].get( + "log_template_path", None) + settings['apache_conf_path'] = config['global'].get("apache_conf_path", + None) + + settings['http_base'] = config['global'].get("http_base", "/") + + settings['mirrors'] = [] + for mirror_name in config['global'].get("mirrors", []): + mirror = {} + mirror['name'] = mirror_name + + if mirror_name not in config: + logging.error("Couldn't find settings for mirror: %s" % + mirror_name) + return None + + mirror['source'] = config[mirror_name].get("source", None) + mirror['sources'] = config[mirror_name].get("sources", False) == "true" + + for key in ("pockets", "components", "sub-components", + "architectures"): + value = config[mirror_name].get(key, None) + + if not isinstance(value, list): + value = [value] + + mirror[key] = value + + # Expand sub-components + extra_components = [] + for entry in mirror['sub-components']: + for component in mirror['components']: + extra_components.append("%s/%s" % (component, entry)) + mirror['components'] += extra_components + mirror.pop("sub-components") + + for key in ("source", "pockets", "components", "architectures"): + if not mirror[key]: + logging.error("Missing value for '%s' in mirror: %s" % + (key, mirror_name)) + return None + + settings['mirrors'].append(type("MirrorKitMirror", (object,), mirror)) + + # Create our fake object + return type("MirrorKitConfig", (object,), settings) + + +def debmirror_command(config, mirror): + """ + Generate the appropriate debmirror command. + """ + + url = urllib.parse.urlparse(mirror.source) + + if not url: + logging.error("Invalid URL: %s" % url) + return None + + if url.scheme not in ("http", "https", "ftp", "rsync"): + logging.error("Invalid URL scheme: %s" % url.scheme) + return None + + cmd = ["debmirror", "-v", + "--host=%s" % url.netloc, + "--root=%s" % url.path, + "--arch=%s" % ",".join(mirror.architectures), + "--dist=%s" % ",".join(mirror.pockets), + "--section=%s" % ",".join(mirror.components), + "--progress", + "--method=%s" % url.scheme, + "--ignore-release-gpg"] + + if not mirror.sources: + cmd += ["--nosource"] + + cmd += [os.path.join(config.publish_path, mirror.name)] + + return cmd + + +def run_debmirror(config, mirror, log): + """ + Run debmirror. + Output is written to stdout and stderr. + """ + + cmd = debmirror_command(config, mirror) + if not cmd: + return None + + if subprocess.call(cmd, stdout=log, stderr=log, + universal_newlines=True) != 0: + logging.error("debmirror failed to run for: %s" % mirror.name) + return None + + return (True, cmd) + + +def generate_report(config, mirror, success, log): + log_filename = "%s.%s.html" % (mirror.name, + time.strftime("%Y%m%d.%H-%M-%S", + time.gmtime())) + log_file = os.path.join(config.log_path, log_filename) + + log.seek(0) + + variables = {'date': time.strftime("%Y-%m-%d %H:%M:%S", time.gmtime()), + 'name': mirror.name, + 'status': "Success" if success else "Failure", + 'status_html': "Success" + if success else + "Failure", + 'size': round(get_path_size(os.path.join( + config.publish_path, mirror.name)) / 1048576, 2), + 'source': mirror.source, + 'destination': os.path.join(config.publish_path, mirror.name), + 'pockets': ", ".join(mirror.pockets), + 'components': ", ".join(mirror.components), + 'architectures': ", ".join(mirror.architectures), + 'sources': "yes" if mirror.sources else "no", + 'command': " ".join(debmirror_command(config, mirror)), + 'log': log.read()} + + # Generate the html file + with open(log_file, "w+") as log_fd: + with open(config.log_template_path, "r") as fd: + template_str = fd.read() + template = string.Template(template_str) + log_fd.write(template.safe_substitute(variables)) + + # Create symlink + log_symlink = os.path.join(config.log_path, "%s.html" % mirror.name) + if os.path.exists(log_symlink): + os.remove(log_symlink) + os.symlink(log_filename, log_symlink) + + +def generate_apache_conf(config): + if not os.path.exists(os.path.dirname(config.apache_conf_path)): + logging.info("Apache configuration directory doesn't exist, skipping") + return + + with open(config.apache_conf_path, "w+") as fd: + for mirror in config.mirrors: + fd.write("Alias %s %s\n" % (os.path.join(config.http_base, + mirror.name), + os.path.join(config.publish_path, + mirror.name))) + + if config.log_path: + fd.write("Alias %s %s\n" % (os.path.join(config.http_base, "logs"), + config.log_path)) + fd.write(""" + + Options Indexes FollowSymLinks MultiViews + + Order allow,deny + Allow from all + + = 2.3> + Require all granted + + +""" % (os.path.join(config.http_base, "logs"))) + + for mirror in config.mirrors: + rel_path = os.path.join(config.http_base, mirror.name) + rel_path_escaped = rel_path.replace("/", "\\/") + + fd.write(""" + + RewriteEngine On + RewriteCond %%{REQUEST_FILENAME} !-f + RewriteCond %%{REQUEST_FILENAME} !-d + RewriteRule .*%s\/pool\/(.*) %s.orig/pool/$1 [L] + RewriteRule .*%s\/dists\/(.*) %s.orig/dists/$1 [L] + + Options Indexes FollowSymLinks MultiViews + + Order allow,deny + Allow from all + + = 2.3> + Require all granted + + + + Deny from all + +ProxyPass %s.orig/ %s/ +""" % (rel_path, + rel_path_escaped, rel_path, + rel_path_escaped, rel_path, + rel_path, + rel_path, mirror.source)) + + fd.write("ProxyRequests off") + + +if __name__ == '__main__': + parser = argparse.ArgumentParser(description="mirrorkit") + parser.add_argument("--config", metavar="CONFIG", + help="Path to the configuration file", + default="/etc/mirrorkit.conf") + args = parser.parse_args() + + # Basic checks + if not os.path.exists(args.config): + parser.error("Configuration file doesn't exist: %s" % args.config) + sys.exit(1) + + # Load the configuration + config = load_config(args.config) + if not config: + sys.error(1) + + if not config.mirrors: + sys.exit(0) + + # Check if template exists + if config.log_template_path: + if not os.path.exists(config.log_template_path): + parser.error("Missing log template: %s" % config.log_template_path) + sys.exit(1) + + # Create any missing path + if not os.path.exists(config.publish_path): + logging.debug("Creating missing path: %s" % config.publish_path) + os.makedirs(config.publish_path) + + if config.log_path and not os.path.exists(config.log_path): + logging.debug("Creating missing path: %s" % config.log_path) + os.makedirs(config.log_path) + + # Start the mirroring + for mirror in config.mirrors: + logging.info("Beginning to mirror: %s" % mirror.name) + + log_fd, log_path = tempfile.mkstemp() + log = os.fdopen(log_fd) + + retval = run_debmirror(config, mirror, log) + logging.info("Done mirroring: %s" % mirror.name) + + if config.log_path: + logging.info("Generating html report for: %s" % mirror.name) + generate_report(config, mirror, retval is not None, log) + + log.close() + os.remove(log_path) + + # Generate the http configuration + if config.apache_conf_path: + logging.info("Generating apache2 configuration: %s" % + config.apache_conf_path) + generate_apache_conf(config) diff -Nru mirrorkit-0.1.1/debian/apache.conf mirrorkit-0.2.1/debian/apache.conf --- mirrorkit-0.1.1/debian/apache.conf 2011-06-21 19:03:38.000000000 +0000 +++ mirrorkit-0.2.1/debian/apache.conf 1970-01-01 00:00:00.000000000 +0000 @@ -1,12 +0,0 @@ -# Where the html templates and stylesheets are stored -Alias /mirrorkit/html /usr/share/mirrorkit/html - -Alias /mirrorkit /var/lib/mirrorkit - - - Options Indexes FollowSymLinks MultiViews - - AllowOverride None - Order Allow,Deny - Allow From All - diff -Nru mirrorkit-0.1.1/debian/changelog mirrorkit-0.2.1/debian/changelog --- mirrorkit-0.1.1/debian/changelog 2011-12-31 02:05:24.000000000 +0000 +++ mirrorkit-0.2.1/debian/changelog 2013-10-27 01:40:51.000000000 +0000 @@ -1,3 +1,21 @@ +mirrorkit (0.2.1) trusty; urgency=low + + * Wrap and sort. + * Add missing build-depends help2man. + + -- Stéphane Graber Sat, 26 Oct 2013 21:40:43 -0400 + +mirrorkit (0.2) trusty; urgency=low + + * Upstream is dead, converting to native package. + * Rewrite entirely: + - Use ini instead of xml config file + - Default to python3 + - Add logging + - Generate apache2 config file on the fly + + -- Stéphane Graber Sat, 26 Oct 2013 21:35:44 -0400 + mirrorkit (0.1.1-0ubuntu4) precise; urgency=low * Rebuild to drop python2.6 dependencies. @@ -12,7 +30,7 @@ mirrorkit (0.1.1-0ubuntu2) oneiric; urgency=low - * Convert to dh_python2 and dh7. + * Convert to dh_python2 and dh7. * Convert to source format 3.0 (quilt). * Bump Standards-Version to 3.9.2. * Drop old Vcs-Bzr field. It should now be diff -Nru mirrorkit-0.1.1/debian/compat mirrorkit-0.2.1/debian/compat --- mirrorkit-0.1.1/debian/compat 2011-06-21 19:06:43.000000000 +0000 +++ mirrorkit-0.2.1/debian/compat 2012-07-18 20:02:08.000000000 +0000 @@ -1 +1 @@ -7 +9 diff -Nru mirrorkit-0.1.1/debian/control mirrorkit-0.2.1/debian/control --- mirrorkit-0.1.1/debian/control 2011-10-04 00:04:51.000000000 +0000 +++ mirrorkit-0.2.1/debian/control 2013-10-27 01:37:15.000000000 +0000 @@ -2,18 +2,12 @@ Section: misc Priority: optional Maintainer: Ubuntu Developers -Build-Depends: debhelper (>= 7), - python (>= 2.6.6-3~) -X-Python-Version: >= 2.4 -Standards-Version: 3.9.2 -Homepage: https://launchpad.net/mirrorkit +Build-Depends: debhelper (>= 9), help2man, python3 +Standards-Version: 3.9.4 Package: mirrorkit Architecture: all -Depends: debmirror, - python, - ${misc:Depends}, - ${python:Depends} +Depends: debmirror, python3, ${misc:Depends} Recommends: apache2 | httpd Description: Python frontend to debmirror MirrorKit is a Python frontend to debmirror that uses a xml configuration file diff -Nru mirrorkit-0.1.1/debian/copyright mirrorkit-0.2.1/debian/copyright --- mirrorkit-0.1.1/debian/copyright 2011-06-21 19:04:39.000000000 +0000 +++ mirrorkit-0.2.1/debian/copyright 2013-10-27 01:37:15.000000000 +0000 @@ -1,18 +1,13 @@ -This package was debianized by Michael Jeanson - on Wed, 17 Feb 2010 10:06:00 -0500. - -It was downloaded from https://launchpad.net/mirrorkit - -Upstream authors: +This package was debianized by Stéphane Graber. +Authors: Stéphane Graber Copyright: - - Copyright (C) 2008-2009 Stéphane Graber + Stéphane Graber + Copyright (c) 2007-2013 Stéphane Graber License: - This program 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 @@ -26,7 +21,6 @@ You can find the license on Debian systems in the file /usr/share/common-licenses/GPL-2 - -The Debian packaging is Copyright 2010, Michael Jeanson - and is licensed under the GPL, +The Debian packaging is Copyright 2010-2012, Stéphane Graber + and is licensed under the GPL, see `/usr/share/common-licenses/GPL-2'. diff -Nru mirrorkit-0.1.1/debian/cron.d mirrorkit-0.2.1/debian/cron.d --- mirrorkit-0.1.1/debian/cron.d 2011-06-21 19:03:38.000000000 +0000 +++ mirrorkit-0.2.1/debian/cron.d 1970-01-01 00:00:00.000000000 +0000 @@ -1,6 +0,0 @@ -# /etc/cron.d/mirrorkit: crontab entries for the mirrorkit package - -SHELL=/bin/sh -PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin - -#30 3 * * * root test -x /usr/bin/mirrorkit && /usr/bin/mirrorkit /etc/mirrorkit/mirrors.xml >/dev/null diff -Nru mirrorkit-0.1.1/debian/dirs mirrorkit-0.2.1/debian/dirs --- mirrorkit-0.1.1/debian/dirs 2011-06-21 19:03:38.000000000 +0000 +++ mirrorkit-0.2.1/debian/dirs 1970-01-01 00:00:00.000000000 +0000 @@ -1,4 +0,0 @@ -etc/mirrorkit -var/lib/mirrorkit -var/lib/mirrorkit/log -var/lib/mirrorkit/mirrors diff -Nru mirrorkit-0.1.1/debian/install mirrorkit-0.2.1/debian/install --- mirrorkit-0.1.1/debian/install 2011-06-21 19:04:39.000000000 +0000 +++ mirrorkit-0.2.1/debian/install 2013-10-27 01:37:15.000000000 +0000 @@ -1,2 +1,3 @@ -debian/apache.conf etc/mirrorkit -debian/mirrors.xml etc/mirrorkit +bin/* usr/bin/ +etc/mirrorkit.conf etc/ +share/* usr/share/mirrorkit/ diff -Nru mirrorkit-0.1.1/debian/mirrors.xml mirrorkit-0.2.1/debian/mirrors.xml --- mirrorkit-0.1.1/debian/mirrors.xml 2011-06-21 19:03:38.000000000 +0000 +++ mirrorkit-0.2.1/debian/mirrors.xml 1970-01-01 00:00:00.000000000 +0000 @@ -1,33 +0,0 @@ - - - - - /mirrorkit - /var/lib/mirrorkiti/mirrors - /var/lib/mirrorkit/log - /usr/share/mirrorkit/html/template.html - - 1 - - - - deb - http://archive.ubuntu.com/ubuntu - lucid,lucid-updates,lucid-security -
main,restricted,universe,multiverse,main/i18n,restricted/i18n,universe/i18n,multiverse/i18n,main/debian-installer,restricted/debian-installer,universe/debian-installer,multiverse/debian-installer
- i386 - 1 - /help.ubuntu.html -
- -
diff -Nru mirrorkit-0.1.1/debian/rules mirrorkit-0.2.1/debian/rules --- mirrorkit-0.1.1/debian/rules 2011-06-21 19:06:47.000000000 +0000 +++ mirrorkit-0.2.1/debian/rules 2013-10-26 17:39:32.000000000 +0000 @@ -1,4 +1,10 @@ #!/usr/bin/make -f +VERSION=$(shell head -n1 debian/changelog |sed -e 's/.*(\(.*\)).*/\1/') %: - dh $@ --with python2 + dh $@ + +override_dh_installman: + mkdir -p $(CURDIR)/debian/mirrorkit/usr/share/man/man1/ + help2man --name="Mirrorkit" --version-string=$(VERSION) -N $(CURDIR)/bin/mirrorkit > $(CURDIR)/debian/mirrorkit/usr/share/man/man1/mirrorkit.1 + dh_installman diff -Nru mirrorkit-0.1.1/debian/source/format mirrorkit-0.2.1/debian/source/format --- mirrorkit-0.1.1/debian/source/format 2013-10-27 02:05:14.492631565 +0000 +++ mirrorkit-0.2.1/debian/source/format 2013-10-27 02:05:14.602640172 +0000 @@ -1 +1 @@ -3.0 (quilt) +3.0 (native) diff -Nru mirrorkit-0.1.1/debian/watch mirrorkit-0.2.1/debian/watch --- mirrorkit-0.1.1/debian/watch 2011-06-21 19:03:38.000000000 +0000 +++ mirrorkit-0.2.1/debian/watch 1970-01-01 00:00:00.000000000 +0000 @@ -1,2 +0,0 @@ -version=3 -https://launchpad.net/mirrorkit/+download http://launchpad.net/mirrorkit/.*/mirrorkit-(.+).tar.gz diff -Nru mirrorkit-0.1.1/doc/mirrorkit.1 mirrorkit-0.2.1/doc/mirrorkit.1 --- mirrorkit-0.1.1/doc/mirrorkit.1 2010-02-17 19:02:16.000000000 +0000 +++ mirrorkit-0.2.1/doc/mirrorkit.1 1970-01-01 00:00:00.000000000 +0000 @@ -1,17 +0,0 @@ -.TH MIRRORKIT 1 "Mar 11, 2009" "" "" -.SH "NAME" -MirrorKit \- A python frontend to debmirror -.SH SYNOPSIS -.br -.B mirrorkit -.RI [ config.xml ] -.br -.SH "DESCRIPTION" -This manual page documents \fBMirrorKit\fP, a debian mirroring tool. -.PP -\fBMirrorKit\fP allows users to easily build a debian mirror from a simple xml -config file. -.SH "SEE ALSO" -.BR debmirror(1) -.SH "AUTHOR" -MirrorKit was written by Stéphane Graber and others. diff -Nru mirrorkit-0.1.1/etc/mirrorkit.conf mirrorkit-0.2.1/etc/mirrorkit.conf --- mirrorkit-0.1.1/etc/mirrorkit.conf 1970-01-01 00:00:00.000000000 +0000 +++ mirrorkit-0.2.1/etc/mirrorkit.conf 2013-10-26 23:28:49.000000000 +0000 @@ -0,0 +1,35 @@ +[global] + +# Destination path for the mirror (mandatory) +publish_path = /var/lib/mirrorkit/www/ + +# Destination path for the html log files (optional) +log_path = /var/lib/mirrorkit/www/logs/ + +# Path of the html template for the logs (mandatory if log_path is set) +log_template_path = /usr/share/mirrorkit/log.html.tpl + +# Path to the mirror relative to the http server root (optional, default to /) +http_base = / + +# Path to the auto-generated apache configuration file (optional) +apache_conf_path = /etc/apache2/conf-available/mirrorkit.conf + +# List of mirrors that are enabled (optional, off if empty) +# mirrors = ubuntu, ubuntu-ports + +# [ubuntu] +# source = http://archive.ubuntulinux.org/ubuntu +# pockets = trusty, trusty-updates, trusty-security +# components = main, restricted, universe, multiverse +# sub-components = i18n, debian-installer +# architectures = i386, amd64 +# sources = true + +# [ubuntu-ports] +# source = http://ports.ubuntulinux.org/ubuntu-ports +# pockets = trusty, trusty-updates, trusty-security +# components = main, restricted, universe, multiverse +# sub-components = i18n, debian-installer +# architectures = armhf +# sources = false diff -Nru mirrorkit-0.1.1/examples/apache.conf mirrorkit-0.2.1/examples/apache.conf --- mirrorkit-0.1.1/examples/apache.conf 2010-02-17 19:02:16.000000000 +0000 +++ mirrorkit-0.2.1/examples/apache.conf 1970-01-01 00:00:00.000000000 +0000 @@ -1,12 +0,0 @@ -# Where the html templates and stylesheets are stored -Alias /mirrorkit/html /usr/share/mirrorkit/html - -Alias /mirrorkit /var/lib/mirrorkit - - - Options FollowSymLinks - - AllowOverride None - Order Allow,Deny - Allow From All - diff -Nru mirrorkit-0.1.1/examples/mirrorkit.cron mirrorkit-0.2.1/examples/mirrorkit.cron --- mirrorkit-0.1.1/examples/mirrorkit.cron 2010-02-17 19:02:16.000000000 +0000 +++ mirrorkit-0.2.1/examples/mirrorkit.cron 1970-01-01 00:00:00.000000000 +0000 @@ -1,6 +0,0 @@ -# /etc/cron.d/mirrorkit: crontab entries for the mirrorkit package - -SHELL=/bin/sh -PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin - -30 3 * * * root test -x /usr/bin/mirrorkit && /usr/bin/mirrorkit /etc/mirrorkit/mirrors.xml >/dev/null diff -Nru mirrorkit-0.1.1/examples/mirrors.xml mirrorkit-0.2.1/examples/mirrors.xml --- mirrorkit-0.1.1/examples/mirrors.xml 2010-02-17 19:02:16.000000000 +0000 +++ mirrorkit-0.2.1/examples/mirrors.xml 1970-01-01 00:00:00.000000000 +0000 @@ -1,30 +0,0 @@ - - - - - /mirrorkit - /var/lib/mirrorkit/mirrors - /var/lib/mirrorkit/log - /usr/share/mirrorkit/html/template.html - - 0 - - - deb - http://archive.ubuntu.com/ubuntu - hardy,hardy-updates,hardy-security,hardy-backports,hardy-proposed -
main,restricted,universe,multiverse,main/i18n,restricted/i18n,universe/i18n,multiverse/i18n,main/debian-installer,restricted/debian-installer,universe/debian-installer,multiverse/debian-installer
- i386,amd64 - 1 - /help.ubuntu.html -
- - deb - http://ftp.debian.org - etch -
main,contrib,non-free,main/debian-installer
- i386 - 1 - /help.debian.html -
-
diff -Nru mirrorkit-0.1.1/release.conf mirrorkit-0.2.1/release.conf --- mirrorkit-0.1.1/release.conf 2010-02-17 19:02:16.000000000 +0000 +++ mirrorkit-0.2.1/release.conf 1970-01-01 00:00:00.000000000 +0000 @@ -1,2 +0,0 @@ -NAME=mirrorkit -VERSION=0.1.1 diff -Nru mirrorkit-0.1.1/setup.py mirrorkit-0.2.1/setup.py --- mirrorkit-0.1.1/setup.py 2010-02-17 19:02:16.000000000 +0000 +++ mirrorkit-0.2.1/setup.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,40 +0,0 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- -# -# MirrorKit - A python frontend to debmirror -# Copyright (C) 2008-2009 Stephane Graber -# (C) 2009 Michael Jeanson -# -# This program 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 program 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 program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -from distutils.core import setup -from glob import glob - -setup( - name="mirrorkit", - version="0.1.1", - description="A python frontend to debmirror", - author="Stéphane Graber", - author_email="stgraber@ubuntu.com", - url='https://launchpad.net/mirrorkit', - scripts = glob('src/bin/*'), -# packages = ['mirrorkit'], -# package_dir = {'mirrorkit':'src/lib/mirrorkit'}, - data_files = [ - ('share/man/man1', ['doc/mirrorkit.1']), - ('share/mirrorkit/html', glob('src/share/html/*')), - ('share/doc/mirrorkit/examples', glob('examples/*')), - ] -) diff -Nru mirrorkit-0.1.1/share/log.html.tpl mirrorkit-0.2.1/share/log.html.tpl --- mirrorkit-0.1.1/share/log.html.tpl 1970-01-01 00:00:00.000000000 +0000 +++ mirrorkit-0.2.1/share/log.html.tpl 2013-10-26 22:13:52.000000000 +0000 @@ -0,0 +1,90 @@ + + + + [$status] Mirror update - $name - $date + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Date$date
Name$name
Status$status_html
Size$size MB
Source$source
Destination$destination
Pockets$pockets
Components$components
Architecture$architectures
Command$command
+

Syncronisation log

+
+
$log
+
+ + + diff -Nru mirrorkit-0.1.1/src/bin/mirrorkit mirrorkit-0.2.1/src/bin/mirrorkit --- mirrorkit-0.1.1/src/bin/mirrorkit 2010-02-17 19:02:16.000000000 +0000 +++ mirrorkit-0.2.1/src/bin/mirrorkit 1970-01-01 00:00:00.000000000 +0000 @@ -1,184 +0,0 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- -# -# MirrorKit - A python frontend to debmirror -# Copyright (C) 2008-2009 Stephane Graber -# (C) 2009 Michael Jeanson -# -# This program 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 program 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 program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -from urlparse import urlparse -import xml.dom.minidom, time, sys, subprocess, os - -def SyncDEB(source, destination, dist, section, arch): - "Return the syncronisation command for an APT source (Debian)" - - #Source format: :/// - #Destination format: Unix path - #Dist format: Distributions to mirror - #Section format: Sections to mirror - #Arch format: Architectures to mirror - (method, host, path, Null, Null, Null)=urlparse(source) - - cmd="debmirror -v --host="+host - if path: - cmd+=" --root="+path - cmd+=" --dist="+dist+" --section="+section+" --arch="+arch+" -m --progress --nosource --method="+method+" --ignore-release-gpg" - if config["proxy"]: - cmd+=" --proxy="+config["proxy"] - cmd+=" "+destination - return cmd - -def XMLgetParameter(node,parameter): - "Get a parameter from 'node'" - - value="" - for node2 in node.getElementsByTagName(parameter): - for node3 in node2.childNodes: - if node3.nodeType == xml.dom.minidom.Node.TEXT_NODE: - value += node3.data - return value - -def LoadMirrorList(list): - "Load a XML file and return an array of dictionaries containing the mirror properties" - - mirrors=[] - doc=xml.dom.minidom.parse(list) - for node in doc.getElementsByTagName("mirror"): - #Create the list of mirror properties and put them into a dictionary - mirror={ - "name": node.getAttribute("name"), - "type": XMLgetParameter(node,"type"), - "source": XMLgetParameter(node,"source"), - "dist": XMLgetParameter(node,"dist"), - "section": XMLgetParameter(node,"section"), - "arch": XMLgetParameter(node,"arch"), - "enabled": XMLgetParameter(node,"enabled"), - "help": XMLgetParameter(node,"help") - } - if mirror["enabled"] != "0" and mirror["name"] != "admin" and mirror["name"] != "help": #generator and help are reserved names - mirrors.append(mirror) - return mirrors - -def LoadConfig(list): - doc=xml.dom.minidom.parse(list) - config={} - for node in doc.getElementsByTagName("config"): - config={ - "www-url": XMLgetParameter(node,"www-url"), - "www-dir": XMLgetParameter(node,"www-dir"), - "log-dir": XMLgetParameter(node,"log-dir"), - "template-html": XMLgetParameter(node,"template-html"), - "proxy": XMLgetParameter(node,"proxy"), - "help": XMLgetParameter(node,"help") - } - return config - -def Now(): - return "["+time.strftime("%H:%M:%S")+"] " - -def GenHTMLReport(mirror,log,error): - "Generate HTML report from the log" - - if error != "": - result="Failure" - result_html="Failure" - else: - result="Success" - result_html="Success" - error="No error reported" - - if log == "": - log="No log message reported" - - file=open(config['template-html'],"r") - page=file.read() - file.close() - size=subprocess.Popen(("du","-h","-s",config['www-dir']+"/"+mirror["name"]),stdout=subprocess.PIPE,stderr=subprocess.PIPE).stdout.read().split("\t")[0] - - page=page.replace("WWW_URL",config['www-url']) - page=page.replace("RESULT_HTML",result_html) - page=page.replace("RESULT",result) - page=page.replace("MIRROR_CMD",mirror["cmd"]) - page=page.replace("MIRROR_SIZE",size) - page=page.replace("MIRROR_TYPE",mirror["type"]) - page=page.replace("MIRROR_SOURCE",mirror["source"]) - page=page.replace("MIRROR_DESTINATION",config['www-dir']+"/"+mirror["name"]) - page=page.replace("MIRROR_DIST",mirror["dist"]) - page=page.replace("MIRROR_SECTION",mirror["section"]) - page=page.replace("MIRROR_ARCH",mirror["arch"]) - page=page.replace("MIRROR_NAME",mirror["name"]) - page=page.replace("DATE",time.strftime("%Y-%m-%d %H:%M:%S")) - page=page.replace("LOG",log.replace("\n","
")) - page=page.replace("ERROR",error.replace("\n","
")) - - filename=mirror["name"]+"-"+time.strftime("%Y%m%d.%H-%M-%S")+".html" - file=open(config["log-dir"]+"/"+filename,"w+") - file.write(page) - file.close() - try: - os.remove(config["log-dir"]+"/"+mirror["name"]+".html") - except: - print Now()+"Symlink for "+mirror["name"]+" doesn't yet exist, creating." - os.symlink(filename,config["log-dir"]+"/"+mirror["name"]+".html") - -if len(sys.argv) != 2: - print "Usage: "+sys.argv[0]+" " - sys.exit(1) - -mirrors=LoadMirrorList(sys.argv[1]) -config=LoadConfig(sys.argv[1]) -try: - os.mkdir(config["www-dir"]) - print Now()+"Creating web directory ("+config["www-dir"]+")" -except: - print Now()+"Web directory already exists ("+config["www-dir"]+")" - -for mirror in mirrors: - log="" - error="" - try: - os.mkdir(config["www-dir"]+"/"+mirror["name"]) - print Now()+"Creating mirror directory ("+config["www-dir"]+")" - except: - print Now()+"Mirror directory already exists ("+config["www-dir"]+"/"+mirror["name"]+")" - if mirror["type"] == "deb": - mirror["cmd"]=SyncDEB(mirror["source"],config["www-dir"]+"/"+mirror["name"],mirror["dist"],mirror["section"],mirror["arch"]) - if mirror["type"] == "suse": - mirror["cmd"]="echo Not implemented yet" - if mirror["cmd"]: - stdout=open(config["log-dir"]+"/stdout.txt","w+") - stderr=open(config["log-dir"]+"/stderr.txt","w+") - cmd=subprocess.Popen(mirror["cmd"].split(" "),stdout=stdout,stderr=stderr) - print Now()+"Syncronisation started ("+mirror["name"]+")" - cmd.wait() - stdout.seek(0) - stderr.seek(0) - log=stdout.read() - error=stderr.read() - stdout.close() - stderr.close() - GenHTMLReport(mirror,log,error) - print Now()+"Syncronisation completed ("+mirror["name"]+")" - -if config["help"] == "1": - print Now()+"Generating directory index" - file=open(config["www-dir"]+"/help.html","w+") - page="

Mirrorkit

\n" - for mirror in mirrors: - page+="\n" - page+="
"+mirror["name"]+"Installation instructions Generation log


" - file.write(page) - file.close() diff -Nru mirrorkit-0.1.1/src/share/html/style.css mirrorkit-0.2.1/src/share/html/style.css --- mirrorkit-0.1.1/src/share/html/style.css 2010-02-17 19:02:16.000000000 +0000 +++ mirrorkit-0.2.1/src/share/html/style.css 1970-01-01 00:00:00.000000000 +0000 @@ -1,37 +0,0 @@ -table { - border: 1px solid #000000; - background-color: #feffeb; -} - -td { - padding: 5px; - vertical-align: top; - text-align: left; -} - -#error { - border: 1px dotted red; - padding: 2px 2px 2px 2px; - background-color: #ffebeb; -} - - -#log { - border: 1px dotted green; - padding: 2px 2px 2px 2px; - background-color: #edffeb; -} - -#footer { - margin-top:2em; -} - -#failure { - font-weight:bold; - color:red; -} - -#success { - font-weight:bold; - color:green; -} diff -Nru mirrorkit-0.1.1/src/share/html/template.html mirrorkit-0.2.1/src/share/html/template.html --- mirrorkit-0.1.1/src/share/html/template.html 2010-02-17 19:02:16.000000000 +0000 +++ mirrorkit-0.2.1/src/share/html/template.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,67 +0,0 @@ - - - - [RESULT] Mirror update - MIRROR_NAME - DATE - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
DateDATE
MirrorMIRROR_NAME
StatusRESULT_HTML
SizeMIRROR_SIZE
TypeMIRROR_TYPE
SourceMIRROR_SOURCE
DestinationMIRROR_DESTINATION
DistributionMIRROR_DIST
SectionMIRROR_SECTION
ArchitectureMIRROR_ARCH
CommandMIRROR_CMD
-

Syncronisation error

-
- ERROR -
-

Syncronisation log

-
- LOG -
- - -