[Checkins] SVN: van.reposync/ Initial import of tool to mirror pypi repositories from APT repositories

Brian Sutherland jinty at web.de
Mon Jun 15 06:13:38 EDT 2009


Log message for revision 100962:
  Initial import of tool to mirror pypi repositories from APT repositories

Changed:
  A   van.reposync/
  A   van.reposync/trunk/
  A   van.reposync/trunk/buildout.cfg
  A   van.reposync/trunk/setup.py
  A   van.reposync/trunk/van/
  A   van.reposync/trunk/van/__init__.py
  A   van.reposync/trunk/van/reposync/
  A   van.reposync/trunk/van/reposync/README.txt
  A   van.reposync/trunk/van/reposync/__init__.py
  A   van.reposync/trunk/van/reposync/tests/
  A   van.reposync/trunk/van/reposync/tests/__init__.py
  A   van.reposync/trunk/van/reposync/tests/sample_repo1/
  A   van.reposync/trunk/van/reposync/tests/sample_repo1/Packages
  A   van.reposync/trunk/van/reposync/tests/sample_repo1/Sources
  A   van.reposync/trunk/van/reposync/tests/sample_repo1/build-dep-on-setuptools-without-egg-info_1-1.diff.gz
  A   van.reposync/trunk/van/reposync/tests/sample_repo1/build-dep-on-setuptools-without-egg-info_1-1.dsc
  A   van.reposync/trunk/van/reposync/tests/sample_repo1/build-dep-on-setuptools-without-egg-info_1.orig.tar.gz
  A   van.reposync/trunk/van/reposync/tests/sample_repo1/python-build-dep-on-setuptools-without-egg-info_1-1_all.deb
  A   van.reposync/trunk/van/reposync/tests/sample_repo1/python-van.pydeb_1.2.0-3_all.deb
  A   van.reposync/trunk/van/reposync/tests/sample_repo1/python-zope.component-zcml_3.7.0-1_all.deb
  A   van.reposync/trunk/van/reposync/tests/sample_repo1/python-zope.component_3.7.0-1_all.deb
  A   van.reposync/trunk/van/reposync/tests/sample_repo1/update
  A   van.reposync/trunk/van/reposync/tests/sample_repo1/van.pydeb_1.2.0-3.diff.gz
  A   van.reposync/trunk/van/reposync/tests/sample_repo1/van.pydeb_1.2.0-3.dsc
  A   van.reposync/trunk/van/reposync/tests/sample_repo1/van.pydeb_1.2.0.orig.tar.gz
  A   van.reposync/trunk/van/reposync/tests/sample_repo1/zope.component_3.7.0-1.diff.gz
  A   van.reposync/trunk/van/reposync/tests/sample_repo1/zope.component_3.7.0-1.dsc
  A   van.reposync/trunk/van/reposync/tests/sample_repo1/zope.component_3.7.0.orig.tar.gz
  A   van.reposync/trunk/van/reposync/tests/sample_repo_empty/
  A   van.reposync/trunk/van/reposync/tests/sample_repo_empty/Packages
  A   van.reposync/trunk/van/reposync/tests/sample_repo_empty/Sources
  A   van.reposync/trunk/van/reposync/tests/sources1.list
  A   van.reposync/trunk/van/reposync/tests/sources_empty.list
  A   van.reposync/trunk/van/reposync/tests/sync.txt
  A   van.reposync/trunk/van/reposync/tests/test_doctest.py

-=-
Added: van.reposync/trunk/buildout.cfg
===================================================================
--- van.reposync/trunk/buildout.cfg	                        (rev 0)
+++ van.reposync/trunk/buildout.cfg	2009-06-15 10:13:38 UTC (rev 100962)
@@ -0,0 +1,13 @@
+[buildout]
+parts = test interp
+develop = .
+project = van.reposync
+
+[interp]
+recipe = zc.recipe.egg
+eggs = ${buildout:project}
+interpreter = py
+
+[test]
+recipe = zc.recipe.testrunner
+eggs = ${buildout:project}

Added: van.reposync/trunk/setup.py
===================================================================
--- van.reposync/trunk/setup.py	                        (rev 0)
+++ van.reposync/trunk/setup.py	2009-06-15 10:13:38 UTC (rev 100962)
@@ -0,0 +1,47 @@
+##############################################################################
+#
+# Copyright (c) 2008 Vanguardistas and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+import os
+from setuptools import setup, find_packages
+
+#long_description = open('README.txt', 'r').read()
+#long_description += '\n'
+#long_description += open('CHANGES.txt', 'r').read()
+
+setup(name="van.reposync",
+      description='Mirror a pypi-style egg repository from a debian APT repository',
+#      long_description=long_description,
+      author="Vanguardistas",
+      url='http://pypi.python.org/pypi/van.reposync',
+      version='1.0.0dev',
+      license = 'ZPL 2.1',
+      packages=find_packages(),
+      entry_points = {'console_scripts': ['van-reposync = van.reposync:main',]},
+      namespace_packages=["van"],
+      install_requires=[
+          'setuptools',
+          'zc.lockfile',
+          'van.pydeb',
+          ],
+      classifiers=['Development Status :: 4 - Beta',
+                   'Intended Audience :: Developers',
+                   'Intended Audience :: System Administrators',
+                   'Topic :: System :: Archiving :: Packaging',
+                   'License :: DFSG approved',
+                   'License :: OSI Approved :: Zope Public License',
+                   'Operating System :: POSIX :: Linux',
+                   'Programming Language :: Python',
+                   ],
+      include_package_data = True,
+      zip_safe = False,
+      )


Property changes on: van.reposync/trunk/setup.py
___________________________________________________________________
Added: svn:eol-style
   + native

Added: van.reposync/trunk/van/__init__.py
===================================================================
--- van.reposync/trunk/van/__init__.py	                        (rev 0)
+++ van.reposync/trunk/van/__init__.py	2009-06-15 10:13:38 UTC (rev 100962)
@@ -0,0 +1,3 @@
+# this is a namespace package
+import pkg_resources
+pkg_resources.declare_namespace(__name__)


Property changes on: van.reposync/trunk/van/__init__.py
___________________________________________________________________
Added: svn:eol-style
   + native

Added: van.reposync/trunk/van/reposync/README.txt
===================================================================
--- van.reposync/trunk/van/reposync/README.txt	                        (rev 0)
+++ van.reposync/trunk/van/reposync/README.txt	2009-06-15 10:13:38 UTC (rev 100962)
@@ -0,0 +1,46 @@
+Mirror a pypi-style egg repository from a debian APT repository
+
+Disclaimer
+----------
+
+This package depends on an as-yet-unreleased version of python-apt (0.8) for
+which it seems the only download location is debian's experimental
+distribution. Currently the version there is 0.7.91.
+
+While this code is tested for simple cases, a lot of the different failure
+modes have not been tested. So if it breaks for you, please add your failure to
+the automated tests and submit a patch!
+
+Use
+---
+
+Doctest setup (so we can test the documentation):
+    
+    >>> import tempfile, os
+    >>> tmp_dir = tempfile.mkdtemp()
+
+    >>> from van.reposync import tests
+    >>> tests_dir = os.path.dirname(tests.__file__)
+    >>> sources1_list = os.path.join(tmp_dir, 'sources1.list')
+    >>> open(sources1_list, 'w').write(open(os.path.join(tests_dir, 'sources1.list'), 'r').read() % {'tests_dir': tests_dir})
+
+We provide one binary `van-reposync` which can be run to perform the
+synchronization. The first time it's run, it requires an --apt-sources
+parameter pointing at an apt sources.list file containing the apt-repositories
+you wish to mirror. It is important that the .list file contain matching deb
+and deb-src lines (mirroring needs both binary and source packages): 
+
+    >>> tests.runit('van-reposync sync --root %s --apt-sources %s' % (tmp_dir, sources1_list))
+
+After it's done, you will see that the directory you pointed the tool at
+contains an apt configuration, buildout configuration and tarballs linked into
+a pypi-style repository.
+
+The next run does not require the apt-sources command, and should be a lot faster:
+
+    >>> tests.runit('van-reposync sync --root %s' % tmp_dir)
+
+TearDown
+
+    >>> import shutil
+    >>> shutil.rmtree(tmp_dir)


Property changes on: van.reposync/trunk/van/reposync/README.txt
___________________________________________________________________
Added: svn:eol-style
   + native

Added: van.reposync/trunk/van/reposync/__init__.py
===================================================================
--- van.reposync/trunk/van/reposync/__init__.py	                        (rev 0)
+++ van.reposync/trunk/van/reposync/__init__.py	2009-06-15 10:13:38 UTC (rev 100962)
@@ -0,0 +1,329 @@
+##############################################################################
+#
+# Copyright (c) 2008 Vanguardistas and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+import os
+import sys
+import tempfile
+from os.path import exists, join
+from subprocess import Popen, PIPE, call
+import logging
+import optparse
+import shutil
+
+from van import pydeb
+from setuptools import sandbox
+from pkg_resources import to_filename, PathMetadata, Distribution
+import apt
+import apt_pkg
+from zc.lockfile import LockFile
+
+logger = logging.getLogger("van.reposync")
+
+#
+# Command Line Interface
+#
+
+_COMMANDS = {}
+
+def main(argv=sys.argv):
+    # Handle global options and dispatch the command 
+    assert len(argv) >= 2, "You need to specify a command"
+    command = _COMMANDS.get(argv[1])
+    if command is None:
+        raise Exception("No Command: %s" % argv[1])
+    return command(argv)
+
+def _assert_dir(path, context):
+    path = os.path.abspath(path)
+    assert context.rootdir in path
+    if not exists(path):
+        logger.info("Creating %s" % path)
+        os.makedirs(path)
+
+def _sync(args=sys.argv):
+    command = args[1]
+    parser = optparse.OptionParser(usage="usage: %%prog %s argument" % command)
+    parser.add_option("--apt-sources", dest="apt_sources", metavar="FILE",
+                      help="Load an apt sources.list file into the mirror, "
+                           "this only needs to be done once, or whenever you "
+                           "want to change the target apt soures.")
+    parser.add_option("--root", dest="rootdir", default=os.path.curdir,
+                      help="The root directory of the mirror.")
+    parser.add_option("--loglevel", dest="loglevel", default='WARNING',
+                      help="The loglevel to output messages at.")
+    options, args = parser.parse_args(args)
+    assert len(args) == 2, "One and only one command can be specified"
+    # setup logging
+    loglevel = getattr(logging, options.loglevel)
+    logging.basicConfig(level=loglevel)
+    # read the apt config we need
+    apt_sources = None
+    if options.apt_sources:
+        apt_sources = open(options.apt_sources, 'r').read()
+    context = _ExecutionContext(options.rootdir)
+    context.open()
+    try:
+        pool = join(context.pypi_root, 'download')
+        tarballs_to_get = set([])
+        owned_files = set([])
+        cache, records, depcache = _init_apt_cache(context, apt_sources)
+        src = apt_pkg.SourceRecords()
+        acq = apt_pkg.Acquire(apt.progress.FetchProgress())
+        for package in cache.packages:
+            if not package.version_list:
+                continue
+            src.restart()
+            src.lookup(package.name)
+            if getattr(src, 'files', None) is None:
+                logger.warning("%s has no source package" % package.name)
+                continue
+            # check for build deps on setuptools
+            for build_dep, _, _, _ in src.build_depends:
+                if build_dep == 'python-setuptools':
+                    break
+            else:
+                continue
+            for md5, size, path, type in src.files:
+                destfile = os.path.join(pool, path)
+                pool_metadata_filename = '%s.reposync' % destfile
+                if exists(pool_metadata_filename):
+                    # already got/processed this one, so only mark that we own it
+                    owned_files.add(pool_metadata_filename)
+                    owned_files.add(destfile)
+                    continue
+                if type == 'tar':
+                    base = os.path.basename(path)
+                    dirname = os.path.join(pool, os.path.dirname(path))
+                    _assert_dir(dirname, context)
+                    apt_pkg.AcquireFile(acq, src.index.archive_uri(path), md5, size, base, destdir=dirname)
+                    tarballs_to_get.add((destfile, package.name)) # should only add files we already have or have succeeded in downloading
+                else:
+                    continue
+                owned_files.add(destfile)
+        # actually get the tarballs
+        acq.run()
+        for i in acq.items:
+            if i.status != i.stat_done:
+                raise Exception("Could not get %s: %s" % (i.destfile, i.error_text))
+        # cycle through the tarballs we got and introspect them (also write out links/metadata)
+        pypi_simple = join(context.pypi_root, 'simple')
+        cant_introspect = set([])
+        introspected = set([])
+        for pool_file, bin_package_name in tarballs_to_get:
+            assert pool in pool_file
+            pypi_path = os.path.dirname(pool_file).replace(pool, pypi_simple)
+            pool_metadata_filename = '%s.reposync' % pool_file
+            if exists(pool_metadata_filename):
+                continue # we already introspected this file, but for another package name
+            owned_files.add(pool_metadata_filename)
+            py_data = _get_setuptools_data(pool_file, pydeb.bin_to_py(bin_package_name))
+            if py_data is None:
+                cant_introspect.add(pool_file)
+                continue
+            py_project_name, py_version, py_filename = py_data
+            pool_metadata_file = open(pool_metadata_filename, 'w')
+            pool_metadata_file.write('%s %s %s\n' % py_data)
+            pypi_file = os.path.join(pypi_path, py_filename)
+            pool_metadata_file.write('%s\n' % pypi_file)
+            if exists(pypi_file):
+                assert os.path.samefile(pool_file, pypi_file)
+                continue
+            _assert_dir(pypi_path, context)
+            logger.info("Linking %s to %s" % (pool_file, pypi_file))
+            os.symlink(pool_file, pypi_file)
+            pool_metadata_file.close()
+            introspected.add(pool_file)
+        for pool_file in cant_introspect - introspected:
+            # write out which files we cannot introspect!
+            pool_metadata_filename = '%s.reposync' % pool_file
+            open(pool_metadata_filename, 'w').write('XXX')
+        # writeout our buildout.cfg
+        bo_file = []
+        for f in owned_files:
+            if not f.endswith(".reposync"):
+                continue
+            pool_metadata = open(f, 'r').read()
+            if pool_metadata == 'XXX':
+                continue
+            py_project_name, py_version, py_filename = pool_metadata.splitlines()[0].split()
+            bo_file.append("    %s = %s" % (py_project_name, py_version))
+        bo_file.sort()
+        bo_file.insert(0, '[versions]')
+        open(join(context.pypi_root, "buildout_versions.cfg"), 'w').write('\n'.join(bo_file))
+        # cleanup
+        deferred_remove = set([])
+        for path, dirs, files in os.walk(pool):
+            if not dirs and not files:
+                # cleanup empty dir, XXX need to do this for pypi
+                os.rmdir(path)
+            for file in files:
+                pool_file = os.path.join(path, file)
+                if pool_file in owned_files:
+                    continue
+                # We don't own it, so remove it
+                if pool_file.endswith('.reposync'):
+                    # remove the metadata in a second stage, we may need it to properly remove links
+                    deferred_remove.add(pool_file)
+                    continue
+                pool_metadata_filename = '%s.reposync' % pool_file
+                pool_metadata = None
+                if exists(pool_metadata_filename):
+                    pool_metadata = open(pool_metadata_filename, 'r').read()
+                if pool_metadata is not None and pool_metadata != 'XXX':
+                    for f in pool_metadata.splitlines()[1:]:
+                        if exists(f):
+                            os.remove(f)
+                os.remove(pool_file)
+        for f in deferred_remove:
+            os.remove(f)
+    finally:
+        context.close()
+_COMMANDS['sync'] = _sync
+
+#
+# Generic Classes
+#
+
+def _query_setuptools_dist(tarball, tmpdir, py_package_name):
+    py_package_filename = to_filename(py_package_name)
+    logger.info("Introspecting egg tarball at %s" % tarball)
+    oldcwd = os.getcwd()
+    os.chdir(tmpdir)
+    try:
+        retcode = call(['tar', '-xzf', tarball])
+        if retcode != 0:
+            logger.error("Failed to unpack egg at %s" % tarball)
+            return None
+        # find the .egg-info and load it
+        p = Popen(['find', tmpdir, '-name', '%s.egg-info' % py_package_name], stdout=PIPE, stderr=PIPE)
+        stdout, stderr = p.communicate()
+        if p.returncode != 0:
+            raise Exception('oops')
+        if not stdout:
+            return None
+        egg_info = stdout.splitlines()
+        if len(egg_info) > 1:
+            raise Exception("oops")
+        egg_info = egg_info[0]
+        basedir = os.path.dirname(egg_info)
+        metadata = PathMetadata(basedir, egg_info)
+        dist_name = os.path.splitext(os.path.basename(egg_info))[0]
+        dist = Distribution(basedir,project_name=dist_name,metadata=metadata)
+        return dist
+    finally:
+        os.chdir(oldcwd)
+
+
+def _get_setuptools_data(filename, py_package_name):
+    """Returns a 3 part tuple:
+    
+    (name, version, filename)
+
+    where filename is the setuptools name on the filesystem."""
+    tmpdir = tempfile.mkdtemp()
+    try:
+        try:
+            dist = _query_setuptools_dist(filename, tmpdir, py_package_name)
+        except:
+            logging.exception("Error on introspecting %s, ignoring and continuing anyway." % filename)
+            return None
+        if dist is None:
+            return None
+        # I think this is the right way of quoting
+        # see: http://mail.python.org/pipermail/distutils-sig/2009-May/011877.html
+        return (dist.project_name, dist.version, '%s-%s.tar.gz' % (to_filename(dist.project_name), to_filename(dist.version)))
+    finally:
+       shutil.rmtree(tmpdir) 
+    
+
+class _ExecutionContext(object):
+    """Contains the global configuration for what we are doing"""
+
+    _lock = None
+    
+    def __init__(self, rootdir):
+        self._rootdir = os.path.abspath(rootdir)
+   
+    def open(self):
+        assert self._lock is None
+        self._lock = LockFile(os.path.join(self.rootdir, 'lock'))
+
+    def close(self):
+        self._lock.close()
+        self._lock = None
+
+    @property
+    def rootdir(self):
+        return self._rootdir
+
+    @property
+    def apt_root(self):
+        return os.path.join(self.rootdir, 'apt')
+
+    @property
+    def pypi_root(self):
+        return os.path.join(self.rootdir, 'pypi')
+
+
+def _init_apt_cache(context, apt_sources=None):
+    join = os.path.join
+    exists = os.path.exists
+    apt_etc = join(context.apt_root, 'etc', 'apt')
+    dpkg_lib = join(context.apt_root, 'var', 'lib', 'dpkg')
+    dirs = (apt_etc,
+            join(context.apt_root, 'var', 'lib', 'apt', 'lists', 'partial'),
+            join(context.apt_root, 'var', 'cache', 'apt', 'archives', 'partial'),
+            dpkg_lib)
+    # create our directories if they don't already exist
+    for d in dirs:
+        _assert_dir(d, context)
+    # Make the files we need
+    dpkg_status = join(dpkg_lib, 'status')
+    if not exists(dpkg_status):
+        logger.info("Creating %s" % dpkg_status)
+        open(dpkg_status, 'w')
+    apt_sources_list = join(apt_etc, 'sources.list')
+    contents = None
+    wanted_contents = apt_sources
+    if exists(apt_sources_list):
+        contents = open(apt_sources_list, 'r').read()
+        if apt_sources is None:
+            wanted_contents = contents
+    if wanted_contents is None:
+        raise Exception("No sources.list setup yet")
+    if contents != wanted_contents:
+        logger.info("Updating/Creating %s" % apt_sources_list)
+        f = open(apt_sources_list, 'w')
+        f.write(wanted_contents)
+        f.close()
+    # get us initialized, but then we don't do much!
+    apt_pkg.init()
+    config = apt_pkg.config
+    apt_pkg.config.set("Dir", context.apt_root)
+    apt_pkg.config.set("Dir::State::status", os.path.join(context.apt_root, "var/lib/dpkg/status"))
+    cache = apt_pkg.Cache(apt.progress.OpProgress())
+    list = apt_pkg.SourceList()
+    list.read_main_list()
+    lockfile = apt_pkg.config.find_dir("Dir::State::Lists") + "lock"
+    lock = apt_pkg.get_lock(lockfile)
+    if lock < 0:
+        raise Exception("Failed to lock %s" % lockfile)
+    try:
+        cache.update(apt.progress.FetchProgress(), list)
+    finally:
+        os.close(lock)
+    # re-make the cache with the new lists!
+    cache = apt_pkg.Cache(apt.progress.OpProgress())
+    depcache = apt_pkg.DepCache(cache)
+    records = apt_pkg.PackageRecords(cache)
+    return cache, records, depcache


Property changes on: van.reposync/trunk/van/reposync/__init__.py
___________________________________________________________________
Added: svn:eol-style
   + native

Added: van.reposync/trunk/van/reposync/tests/__init__.py
===================================================================
--- van.reposync/trunk/van/reposync/tests/__init__.py	                        (rev 0)
+++ van.reposync/trunk/van/reposync/tests/__init__.py	2009-06-15 10:13:38 UTC (rev 100962)
@@ -0,0 +1,9 @@
+# import
+
+from van.reposync import main
+
+def runit(string):
+    "Test run a command"
+    exitcode = main(string.split())
+    if exitcode != 0:
+        return exitcode


Property changes on: van.reposync/trunk/van/reposync/tests/__init__.py
___________________________________________________________________
Added: svn:eol-style
   + native

Added: van.reposync/trunk/van/reposync/tests/sample_repo1/Packages
===================================================================
--- van.reposync/trunk/van/reposync/tests/sample_repo1/Packages	                        (rev 0)
+++ van.reposync/trunk/van/reposync/tests/sample_repo1/Packages	2009-06-15 10:13:38 UTC (rev 100962)
@@ -0,0 +1,83 @@
+Package: python-build-dep-on-setuptools-without-egg-info
+Priority: extra
+Section: python
+Installed-Size: 56
+Maintainer: Brian Sutherland <brian at vanguardistas.net>
+Architecture: all
+Source: build-dep-on-setuptools-without-egg-info
+Version: 1-1
+Filename: ./python-build-dep-on-setuptools-without-egg-info_1-1_all.deb
+Size: 2216
+MD5sum: c2d28a6c485c515369130910f20263a8
+SHA1: 2f932c33d6202ede558da50f18f5ad9bb1546694
+SHA256: 08205b44a773285690aa0ab48cea64fa56acb8adfe51697225fa203e54ea0cdb
+Description: pathological test case for van.pydeb
+ This package build depends on python-setuptools (and otherwise looks like a
+ python package) but does not contain an egg-info file. Or anything else, for
+ that matter.
+Python-Version: all
+
+Package: python-van.pydeb
+Priority: extra
+Section: python
+Installed-Size: 456
+Maintainer: Brian Sutherland <brian at vanguardistas.net>
+Architecture: all
+Source: van.pydeb
+Version: 1.2.0-3
+Replaces: python-van
+Provides: python-van
+Depends: python-pkg-resources, python, python-central (>= 0.6.7), python2.5
+Filename: ./python-van.pydeb_1.2.0-3_all.deb
+Size: 44360
+MD5sum: d5047c1317599516535aea0010daab1f
+SHA1: e8522876f5edbcf935bb688aedb2cfcd41163835
+SHA256: 6fb24af3710db81e147a8d2e9d25fb2da925ac1f9e8b5c5ad7bf86ae966f4c6a
+Description: introspection of python metadata and conversion to Debian package metadata
+ Provides a python API for accessing python package metadata and trandslating
+ that to Debian packaging metadata.
+ .
+ A binary useful in building Debian packages is also provided.
+Python-Version: all
+
+Package: python-zope.component-zcml
+Priority: extra
+Section: python
+Installed-Size: 36
+Maintainer: Brian Sutherland <brian at vanguardistas.net>
+Architecture: all
+Source: zope.component
+Version: 3.7.0-1
+Depends: python-zope.component (= 3.7.0-1), python-zope.configuration, python-zope.i18nmessageid, python-zope.proxy, python-zope.security
+Filename: ./python-zope.component-zcml_3.7.0-1_all.deb
+Size: 3856
+MD5sum: 91a2bcf4bc962be1782ceaace16b6562
+SHA1: 082a53b6f1ea9f2608d58671e7ab70e3ad692502
+SHA256: 112c93570b16298e0ded1dcb35ffcb81920ccd64250ddbbff1a3ba3a0cdb230e
+Description: Metapackage for zope.component zcml extra
+ Provides support for registering components with zope.component in ZCML.
+Python-Version: all
+
+Package: python-zope.component
+Priority: extra
+Section: python
+Installed-Size: 552
+Maintainer: Brian Sutherland <brian at vanguardistas.net>
+Architecture: all
+Source: zope.component
+Version: 3.7.0-1
+Provides: python-zope.component-persistentregistry
+Depends: python-setuptools, python-zodb, python-zope, python-zope.event, python-zope.interface, python, python-central (>= 0.6.7)
+Recommends: python-zope.hookable
+Suggests: python-z3c.recipe.sphinxdoc, python-zope.location, python-zope.testing
+Filename: ./python-zope.component_3.7.0-1_all.deb
+Size: 77456
+MD5sum: 711f8822dbd34d10b843fe193b972646
+SHA1: c286808b73854f2b79a82fad41f6bf97618f6938
+SHA256: 1f30a08c373f6e2eff39fccf2d5a0f093c2e78d6e09aaca4e0ea2657252c7700
+Description: Zope Component Architecture
+ This package represents the core of the Zope Component Architecture.
+ Together with the zope.interface package, it provides facilities for
+ defining, registering and looking up components.
+Python-Version: all
+

Added: van.reposync/trunk/van/reposync/tests/sample_repo1/Sources
===================================================================
--- van.reposync/trunk/van/reposync/tests/sample_repo1/Sources	                        (rev 0)
+++ van.reposync/trunk/van/reposync/tests/sample_repo1/Sources	2009-06-15 10:13:38 UTC (rev 100962)
@@ -0,0 +1,60 @@
+Package: build-dep-on-setuptools-without-egg-info
+Binary: python-build-dep-on-setuptools-without-egg-info
+Version: 1-1
+Maintainer: Brian Sutherland <brian at vanguardistas.net>
+Build-Depends: debhelper (>= 5.0.38), python-all-dev (>= 2.3.5-11), python-central (>= 0.5.6), python-setuptools (>= 0.6b3-1)
+Architecture: all
+Standards-Version: 3.8.1
+Format: 1.0
+Files:
+ a867da96f61b255ca1021c569887a7e8 1050 build-dep-on-setuptools-without-egg-info_1-1.dsc
+ b875b7741a923c6c1d7e299490ad2ee3 196 build-dep-on-setuptools-without-egg-info_1.orig.tar.gz
+ 451e4de4a5a9a86ec36063cd20759109 989 build-dep-on-setuptools-without-egg-info_1-1.diff.gz
+Checksums-Sha1: 
+ 03316dabe22188e7745298c95effe131066f5e42 196 build-dep-on-setuptools-without-egg-info_1.orig.tar.gz
+ 484744861aa8efd6b7c56599823b8724b856bc5a 989 build-dep-on-setuptools-without-egg-info_1-1.diff.gz
+Checksums-Sha256: 
+ cae948291967c4d9747d624fec0234b1c9db70972e477959c03e2f0c5e1b26f7 196 build-dep-on-setuptools-without-egg-info_1.orig.tar.gz
+ c44bdbf3f362aba4aba1b98517e0f1857ea0a974e1964ee102f4a29ef1d6747d 989 build-dep-on-setuptools-without-egg-info_1-1.diff.gz
+Python-Version: all
+
+Package: van.pydeb
+Binary: python-van.pydeb
+Version: 1.2.0-3
+Maintainer: Brian Sutherland <brian at vanguardistas.net>
+Build-Depends: debhelper (>= 5.0.38), python-all-dev (>= 2.3.5-11), python-central (>= 0.5.6), python-setuptools (>= 0.6b3-1)
+Architecture: all
+Standards-Version: 3.8.0
+Format: 1.0
+Files:
+ ff71797231fc247bfb391a042260137d 1084 van.pydeb_1.2.0-3.dsc
+ e170f01cc51555986694f69091781ff7 41062 van.pydeb_1.2.0.orig.tar.gz
+ 04d492807bddbd8c546755cf8e65b15e 1997 van.pydeb_1.2.0-3.diff.gz
+Checksums-Sha1: 
+ 5fb78dc6413502141e905d1da30a64bb1044cb08 41062 van.pydeb_1.2.0.orig.tar.gz
+ a737e5ff467412e1a7e988a514debabad079a0d0 1997 van.pydeb_1.2.0-3.diff.gz
+Checksums-Sha256: 
+ fa30c1934816578986f529f96e4841a7caf07a4c1b768b9592b90f0e7f260465 41062 van.pydeb_1.2.0.orig.tar.gz
+ d0f4bbcd8eaa0a79f1868cd6f5ec616bcf4248d60ce4c33a3798c797cb4df110 1997 van.pydeb_1.2.0-3.diff.gz
+Python-Version: all
+
+Package: zope.component
+Binary: python-zope.component, python-zope.component-zcml
+Version: 3.7.0-1
+Maintainer: Brian Sutherland <brian at vanguardistas.net>
+Build-Depends: debhelper (>= 5.0.38), python-all-dev (>= 2.3.5-11), python-central (>= 0.5.6), python-setuptools (>= 0.6b3-1), python-van.pydeb
+Architecture: all
+Standards-Version: 3.8.0
+Format: 1.0
+Files:
+ 4cc956bdac2179d88ab08e4374c310a5 1170 zope.component_3.7.0-1.dsc
+ b8843319eb010ff073025adbfba19be0 90602 zope.component_3.7.0.orig.tar.gz
+ a4da189d95176cd2960c4adda3ddaa44 2499 zope.component_3.7.0-1.diff.gz
+Checksums-Sha1: 
+ 135508ece5f7d7891226362b809a922adec8e086 90602 zope.component_3.7.0.orig.tar.gz
+ 783babb75a2d188a45e7bbf90966800644521ec5 2499 zope.component_3.7.0-1.diff.gz
+Checksums-Sha256: 
+ 01ddc44f31439124d1273860128663acb8cb2ab74432124b4cd514de37a4c943 90602 zope.component_3.7.0.orig.tar.gz
+ c72717dd722e634a4f15a4817731418ad4de946f389aa122da5594bd56186344 2499 zope.component_3.7.0-1.diff.gz
+Python-Version: all
+

Added: van.reposync/trunk/van/reposync/tests/sample_repo1/build-dep-on-setuptools-without-egg-info_1-1.diff.gz
===================================================================
(Binary files differ)


Property changes on: van.reposync/trunk/van/reposync/tests/sample_repo1/build-dep-on-setuptools-without-egg-info_1-1.diff.gz
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: van.reposync/trunk/van/reposync/tests/sample_repo1/build-dep-on-setuptools-without-egg-info_1-1.dsc
===================================================================
--- van.reposync/trunk/van/reposync/tests/sample_repo1/build-dep-on-setuptools-without-egg-info_1-1.dsc	                        (rev 0)
+++ van.reposync/trunk/van/reposync/tests/sample_repo1/build-dep-on-setuptools-without-egg-info_1-1.dsc	2009-06-15 10:13:38 UTC (rev 100962)
@@ -0,0 +1,18 @@
+Format: 1.0
+Source: build-dep-on-setuptools-without-egg-info
+Binary: python-build-dep-on-setuptools-without-egg-info
+Architecture: all
+Version: 1-1
+Maintainer: Brian Sutherland <brian at vanguardistas.net>
+Standards-Version: 3.8.1
+Build-Depends: debhelper (>= 5.0.38), python-all-dev (>= 2.3.5-11), python-central (>= 0.5.6), python-setuptools (>= 0.6b3-1)
+Checksums-Sha1: 
+ 03316dabe22188e7745298c95effe131066f5e42 196 build-dep-on-setuptools-without-egg-info_1.orig.tar.gz
+ 484744861aa8efd6b7c56599823b8724b856bc5a 989 build-dep-on-setuptools-without-egg-info_1-1.diff.gz
+Checksums-Sha256: 
+ cae948291967c4d9747d624fec0234b1c9db70972e477959c03e2f0c5e1b26f7 196 build-dep-on-setuptools-without-egg-info_1.orig.tar.gz
+ c44bdbf3f362aba4aba1b98517e0f1857ea0a974e1964ee102f4a29ef1d6747d 989 build-dep-on-setuptools-without-egg-info_1-1.diff.gz
+Files: 
+ b875b7741a923c6c1d7e299490ad2ee3 196 build-dep-on-setuptools-without-egg-info_1.orig.tar.gz
+ 451e4de4a5a9a86ec36063cd20759109 989 build-dep-on-setuptools-without-egg-info_1-1.diff.gz
+Python-Version: all

Added: van.reposync/trunk/van/reposync/tests/sample_repo1/build-dep-on-setuptools-without-egg-info_1.orig.tar.gz
===================================================================
(Binary files differ)


Property changes on: van.reposync/trunk/van/reposync/tests/sample_repo1/build-dep-on-setuptools-without-egg-info_1.orig.tar.gz
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: van.reposync/trunk/van/reposync/tests/sample_repo1/python-build-dep-on-setuptools-without-egg-info_1-1_all.deb
===================================================================
(Binary files differ)


Property changes on: van.reposync/trunk/van/reposync/tests/sample_repo1/python-build-dep-on-setuptools-without-egg-info_1-1_all.deb
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: van.reposync/trunk/van/reposync/tests/sample_repo1/python-van.pydeb_1.2.0-3_all.deb
===================================================================
(Binary files differ)


Property changes on: van.reposync/trunk/van/reposync/tests/sample_repo1/python-van.pydeb_1.2.0-3_all.deb
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: van.reposync/trunk/van/reposync/tests/sample_repo1/python-zope.component-zcml_3.7.0-1_all.deb
===================================================================
(Binary files differ)


Property changes on: van.reposync/trunk/van/reposync/tests/sample_repo1/python-zope.component-zcml_3.7.0-1_all.deb
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: van.reposync/trunk/van/reposync/tests/sample_repo1/python-zope.component_3.7.0-1_all.deb
===================================================================
(Binary files differ)


Property changes on: van.reposync/trunk/van/reposync/tests/sample_repo1/python-zope.component_3.7.0-1_all.deb
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: van.reposync/trunk/van/reposync/tests/sample_repo1/update
===================================================================
--- van.reposync/trunk/van/reposync/tests/sample_repo1/update	                        (rev 0)
+++ van.reposync/trunk/van/reposync/tests/sample_repo1/update	2009-06-15 10:13:38 UTC (rev 100962)
@@ -0,0 +1,5 @@
+#!/bin/bash
+
+apt-ftparchive packages . > Packages
+apt-ftparchive sources . > Sources
+


Property changes on: van.reposync/trunk/van/reposync/tests/sample_repo1/update
___________________________________________________________________
Added: svn:executable
   + 

Added: van.reposync/trunk/van/reposync/tests/sample_repo1/van.pydeb_1.2.0-3.diff.gz
===================================================================
(Binary files differ)


Property changes on: van.reposync/trunk/van/reposync/tests/sample_repo1/van.pydeb_1.2.0-3.diff.gz
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: van.reposync/trunk/van/reposync/tests/sample_repo1/van.pydeb_1.2.0-3.dsc
===================================================================
--- van.reposync/trunk/van/reposync/tests/sample_repo1/van.pydeb_1.2.0-3.dsc	                        (rev 0)
+++ van.reposync/trunk/van/reposync/tests/sample_repo1/van.pydeb_1.2.0-3.dsc	2009-06-15 10:13:38 UTC (rev 100962)
@@ -0,0 +1,29 @@
+-----BEGIN PGP SIGNED MESSAGE-----
+Hash: SHA1
+
+Format: 1.0
+Source: van.pydeb
+Binary: python-van.pydeb
+Architecture: all
+Version: 1.2.0-3
+Maintainer: Brian Sutherland <brian at vanguardistas.net>
+Standards-Version: 3.8.0
+Build-Depends: debhelper (>= 5.0.38), python-all-dev (>= 2.3.5-11), python-central (>= 0.5.6), python-setuptools (>= 0.6b3-1)
+Checksums-Sha1: 
+ 5fb78dc6413502141e905d1da30a64bb1044cb08 41062 van.pydeb_1.2.0.orig.tar.gz
+ a737e5ff467412e1a7e988a514debabad079a0d0 1997 van.pydeb_1.2.0-3.diff.gz
+Checksums-Sha256: 
+ fa30c1934816578986f529f96e4841a7caf07a4c1b768b9592b90f0e7f260465 41062 van.pydeb_1.2.0.orig.tar.gz
+ d0f4bbcd8eaa0a79f1868cd6f5ec616bcf4248d60ce4c33a3798c797cb4df110 1997 van.pydeb_1.2.0-3.diff.gz
+Files: 
+ e170f01cc51555986694f69091781ff7 41062 van.pydeb_1.2.0.orig.tar.gz
+ 04d492807bddbd8c546755cf8e65b15e 1997 van.pydeb_1.2.0-3.diff.gz
+Python-Version: all
+
+-----BEGIN PGP SIGNATURE-----
+Version: GnuPG v1.4.9 (GNU/Linux)
+
+iEYEARECAAYFAkomsMAACgkQ53ZwQZo62MYMkQCdEP7PVzp7aHTjhU04I8fhcNvY
+hA0AnijJ7RbhhsxYyG7IbEggLa6TY4NZ
+=BGb7
+-----END PGP SIGNATURE-----

Added: van.reposync/trunk/van/reposync/tests/sample_repo1/van.pydeb_1.2.0.orig.tar.gz
===================================================================
(Binary files differ)


Property changes on: van.reposync/trunk/van/reposync/tests/sample_repo1/van.pydeb_1.2.0.orig.tar.gz
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: van.reposync/trunk/van/reposync/tests/sample_repo1/zope.component_3.7.0-1.diff.gz
===================================================================
(Binary files differ)


Property changes on: van.reposync/trunk/van/reposync/tests/sample_repo1/zope.component_3.7.0-1.diff.gz
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: van.reposync/trunk/van/reposync/tests/sample_repo1/zope.component_3.7.0-1.dsc
===================================================================
--- van.reposync/trunk/van/reposync/tests/sample_repo1/zope.component_3.7.0-1.dsc	                        (rev 0)
+++ van.reposync/trunk/van/reposync/tests/sample_repo1/zope.component_3.7.0-1.dsc	2009-06-15 10:13:38 UTC (rev 100962)
@@ -0,0 +1,29 @@
+-----BEGIN PGP SIGNED MESSAGE-----
+Hash: SHA1
+
+Format: 1.0
+Source: zope.component
+Binary: python-zope.component, python-zope.component-zcml
+Architecture: all
+Version: 3.7.0-1
+Maintainer: Brian Sutherland <brian at vanguardistas.net>
+Standards-Version: 3.8.0
+Build-Depends: debhelper (>= 5.0.38), python-all-dev (>= 2.3.5-11), python-central (>= 0.5.6), python-setuptools (>= 0.6b3-1), python-van.pydeb
+Checksums-Sha1: 
+ 135508ece5f7d7891226362b809a922adec8e086 90602 zope.component_3.7.0.orig.tar.gz
+ 783babb75a2d188a45e7bbf90966800644521ec5 2499 zope.component_3.7.0-1.diff.gz
+Checksums-Sha256: 
+ 01ddc44f31439124d1273860128663acb8cb2ab74432124b4cd514de37a4c943 90602 zope.component_3.7.0.orig.tar.gz
+ c72717dd722e634a4f15a4817731418ad4de946f389aa122da5594bd56186344 2499 zope.component_3.7.0-1.diff.gz
+Files: 
+ b8843319eb010ff073025adbfba19be0 90602 zope.component_3.7.0.orig.tar.gz
+ a4da189d95176cd2960c4adda3ddaa44 2499 zope.component_3.7.0-1.diff.gz
+Python-Version: all
+
+-----BEGIN PGP SIGNATURE-----
+Version: GnuPG v1.4.9 (GNU/Linux)
+
+iEYEARECAAYFAkoa+a8ACgkQ53ZwQZo62MZZ/ACfVoZ+BXV3tqSNCOGNclJ/OCf7
+r88AoNV4oVorz1dTJXW6lnne3OaFAmnc
+=B7aP
+-----END PGP SIGNATURE-----

Added: van.reposync/trunk/van/reposync/tests/sample_repo1/zope.component_3.7.0.orig.tar.gz
===================================================================
(Binary files differ)


Property changes on: van.reposync/trunk/van/reposync/tests/sample_repo1/zope.component_3.7.0.orig.tar.gz
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: van.reposync/trunk/van/reposync/tests/sources1.list
===================================================================
--- van.reposync/trunk/van/reposync/tests/sources1.list	                        (rev 0)
+++ van.reposync/trunk/van/reposync/tests/sources1.list	2009-06-15 10:13:38 UTC (rev 100962)
@@ -0,0 +1,2 @@
+deb file://%(tests_dir)s/sample_repo1 ./
+deb-src file://%(tests_dir)s/sample_repo1 ./

Added: van.reposync/trunk/van/reposync/tests/sources_empty.list
===================================================================
--- van.reposync/trunk/van/reposync/tests/sources_empty.list	                        (rev 0)
+++ van.reposync/trunk/van/reposync/tests/sources_empty.list	2009-06-15 10:13:38 UTC (rev 100962)
@@ -0,0 +1,2 @@
+deb file://%(tests_dir)s/sample_repo_empty ./
+deb-src file://%(tests_dir)s/sample_repo_empty ./

Added: van.reposync/trunk/van/reposync/tests/sync.txt
===================================================================
--- van.reposync/trunk/van/reposync/tests/sync.txt	                        (rev 0)
+++ van.reposync/trunk/van/reposync/tests/sync.txt	2009-06-15 10:13:38 UTC (rev 100962)
@@ -0,0 +1,91 @@
+
+Setup
+-----
+
+Get a temporary directory:
+
+    >>> import tempfile, shutil, os
+    >>> tmp_dir = tempfile.mkdtemp()
+
+    >>> from van.reposync import tests
+    >>> tests_dir = os.path.dirname(tests.__file__)
+
+Basic Synchronization
+---------------------
+
+We need to setup a sources.list file:
+
+    >>> synced1 = os.path.join(tmp_dir, 'synced1')
+    >>> os.mkdir(synced1)
+    >>> sources1_list = os.path.join(tmp_dir, 'sources1.list')
+    >>> open(sources1_list, 'w').write(open(os.path.join(tests_dir, 'sources1.list'), 'r').read() % {'tests_dir': tests_dir})
+
+    >>> tests.runit('van-reposync sync --root %s --apt-sources %s' % (synced1, sources1_list)) # doctest: +REPORT_NDIFF
+
+Lets look inside the repo and see what's there:
+
+    >>> def look(*args):
+    ...     dir = os.path.join(tmp_dir, *args)
+    ...     for i in sorted(os.listdir(dir)):
+    ...         print i
+
+    >>> def lookin(*args):
+    ...     f = os.path.join(tmp_dir, *args)
+    ...     print open(f, 'r').read()
+
+We see the apt working directory, lockfile and our mirror:
+
+    >>> look('synced1')
+    apt
+    lock
+    pypi
+
+In pypi, we see the "download" directory where apt put the files, and also the "simple" pypi mirror:
+
+    >>> look('synced1', 'pypi')
+    buildout_versions.cfg
+    download
+    simple
+    
+Looking in the buildout file, we can see the python project versions in the debian repository:
+
+    >>> lookin('synced1', 'pypi', 'buildout_versions.cfg')
+    [versions]
+        van.pydeb = 1.2.0
+        zope.component = 3.7.0
+
+Looking inside both, we can see that the "simple" directory just links tarballs:
+
+    >>> look('synced1', 'pypi', 'simple')
+    van.pydeb-1.2.0.tar.gz
+    zope.component-3.7.0.tar.gz
+    >>> look('synced1', 'pypi', 'download')
+    build-dep-on-setuptools-without-egg-info_1.orig.tar.gz
+    build-dep-on-setuptools-without-egg-info_1.orig.tar.gz.reposync
+    van.pydeb_1.2.0.orig.tar.gz
+    van.pydeb_1.2.0.orig.tar.gz.reposync
+    zope.component_3.7.0.orig.tar.gz
+    zope.component_3.7.0.orig.tar.gz.reposync
+
+    >>> os.path.samefile(os.path.join(tmp_dir, 'synced1', 'pypi', 'simple', 'zope.component-3.7.0.tar.gz'),
+    ...                  os.path.join(tmp_dir, 'synced1', 'pypi', 'download', 'zope.component_3.7.0.orig.tar.gz'))
+    True
+
+If we now use an empty source.list, and re-sync, everything is cleaned up:
+
+    >>> sources_list_empty = os.path.join(tmp_dir, 'sources_empty.list')
+    >>> open(sources_list_empty, 'w').write(open(os.path.join(tests_dir, 'sources_empty.list'), 'r').read() % {'tests_dir': tests_dir})
+    >>> tests.runit('van-reposync sync --root %s --apt-sources %s' % (synced1, sources_list_empty)) # doctest: +REPORT_NDIFF
+
+    >>> look('synced1', 'pypi', 'simple')
+    >>> look('synced1', 'pypi', 'download')
+
+    >>> lookin('synced1', 'pypi', 'buildout_versions.cfg')
+    [versions]
+
+Cleanup
+-------
+
+Remove the temporary directory:
+
+    >>> shutil.rmtree(tmp_dir)


Property changes on: van.reposync/trunk/van/reposync/tests/sync.txt
___________________________________________________________________
Added: svn:eol-style
   + native

Added: van.reposync/trunk/van/reposync/tests/test_doctest.py
===================================================================
--- van.reposync/trunk/van/reposync/tests/test_doctest.py	                        (rev 0)
+++ van.reposync/trunk/van/reposync/tests/test_doctest.py	2009-06-15 10:13:38 UTC (rev 100962)
@@ -0,0 +1,24 @@
+##############################################################################
+#
+# Copyright (c) 2009 Vanguardistas and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+import unittest
+import doctest
+import os
+
+def test_suite():
+    suite = unittest.TestSuite()
+    suite.addTest(doctest.DocTestSuite('van.reposync'))
+    suite.addTest(doctest.DocFileSuite('sync.txt'))
+    suite.addTest(doctest.DocFileSuite(os.path.join('..', 'README.txt')))
+    return suite
+


Property changes on: van.reposync/trunk/van/reposync/tests/test_doctest.py
___________________________________________________________________
Added: svn:eol-style
   + native



More information about the Checkins mailing list