← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~stevenk/launchpad/destroy-bprc into lp:launchpad

 

Steve Kowalik has proposed merging lp:~stevenk/launchpad/destroy-bprc into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~stevenk/launchpad/destroy-bprc/+merge/111542

Delete the model, interfaces and tests for BinaryPackageReleaseContents and BinaryPackagePath. This was an effort to do contents generation from the DB, but the effort was mostly stillborn and I think it should be dropped.
-- 
https://code.launchpad.net/~stevenk/launchpad/destroy-bprc/+merge/111542
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~stevenk/launchpad/destroy-bprc into lp:launchpad.
=== modified file 'lib/lp/soyuz/configure.zcml'
--- lib/lp/soyuz/configure.zcml	2012-06-19 16:09:38 +0000
+++ lib/lp/soyuz/configure.zcml	2012-06-22 05:32:21 +0000
@@ -993,40 +993,6 @@
         <allow interface="lp.soyuz.adapters.overrides.IOverridePolicy" />
    </class>
 
-    <!-- BinaryPackagePath -->
-
-    <class
-        class="lp.soyuz.model.binarypackagepath.BinaryPackagePath">
-        <allow
-            interface="lp.soyuz.interfaces.binarypackagepath.IBinaryPackagePath"/>
-    </class>
-
-    <!-- BinaryPackagePathSet -->
-
-    <securedutility
-        class="lp.soyuz.model.binarypackagepath.BinaryPackagePath"
-        provides="lp.soyuz.interfaces.binarypackagepath.IBinaryPackagePathSet">
-        <allow
-            interface="lp.soyuz.interfaces.binarypackagepath.IBinaryPackagePathSet"/>
-    </securedutility>
-
-    <!-- BinaryPackageReleaseContents -->
-
-    <class
-        class="lp.soyuz.model.binarypackagereleasecontents.BinaryPackageReleaseContents">
-        <allow
-            interface="lp.soyuz.interfaces.binarypackagereleasecontents.IBinaryPackageReleaseContents"/>
-    </class>
-
-    <!-- BinaryPackageReleaseContentsSet -->
-
-    <securedutility
-        class="lp.soyuz.model.binarypackagereleasecontents.BinaryPackageReleaseContents"
-        provides="lp.soyuz.interfaces.binarypackagereleasecontents.IBinaryPackageReleaseContentsSet">
-        <allow
-            interface="lp.soyuz.interfaces.binarypackagereleasecontents.IBinaryPackageReleaseContentsSet"/>
-    </securedutility>
-
    <webservice:register module="lp.soyuz.interfaces.webservice" />
 
 </configure>

=== removed file 'lib/lp/soyuz/interfaces/binarypackagepath.py'
--- lib/lp/soyuz/interfaces/binarypackagepath.py	2011-12-24 16:54:44 +0000
+++ lib/lp/soyuz/interfaces/binarypackagepath.py	1970-01-01 00:00:00 +0000
@@ -1,36 +0,0 @@
-# Copyright 2011 Canonical Ltd.  This software is licensed under the
-# GNU Affero General Public License version 3 (see the file LICENSE).
-
-"""Binary Package Path interface."""
-
-__metaclass__ = type
-
-__all__ = [
-    'IBinaryPackagePath',
-    'IBinaryPackagePathSet',
-    ]
-
-from zope.interface import Interface
-from zope.schema import (
-    Int,
-    TextLine,
-    )
-
-from lp import _
-
-
-class IBinaryPackagePath(Interface):
-    """The path of a file contained in a binary package."""
-    id = Int(title=_('ID'), required=True, readonly=True)
-    path = TextLine(title=_('Full path name'), required=True, readonly=True)
-
-
-class IBinaryPackagePathSet(Interface):
-
-    def getOrCreate(path):
-        """Fetch the ID of the given path name, or create it.
-
-        :param: path: The full path name to query or create.
-
-        :return: A `IBinaryPackagePath`.
-        """

=== removed file 'lib/lp/soyuz/interfaces/binarypackagereleasecontents.py'
--- lib/lp/soyuz/interfaces/binarypackagereleasecontents.py	2011-12-24 16:54:44 +0000
+++ lib/lp/soyuz/interfaces/binarypackagereleasecontents.py	1970-01-01 00:00:00 +0000
@@ -1,45 +0,0 @@
-# Copyright 2011 Canonical Ltd.  This software is licensed under the
-# GNU Affero General Public License version 3 (see the file LICENSE).
-
-"""Binary Package Release Contents interface."""
-
-__metaclass__ = type
-
-__all__ = [
-    'IBinaryPackageReleaseContents',
-    'IBinaryPackageReleaseContentsSet',
-    ]
-
-from lazr.restful.fields import Reference
-from zope.interface import Interface
-
-from lp import _
-from lp.soyuz.interfaces.binarypackagepath import IBinaryPackagePath
-from lp.soyuz.interfaces.binarypackagerelease import IBinaryPackageRelease
-
-
-class IBinaryPackageReleaseContents(Interface):
-    """A file contained by an `IBinaryPackageRelease`."""
-    binarypackagerelease = Reference(
-        IBinaryPackageRelease, title=_('Binary Package Release'),
-        required=True, readonly=True)
-    binarypackagepath = Reference(
-        IBinaryPackagePath, title=_('Binary Package Pathname'),
-        required=True, readonly=True)
-
-
-class IBinaryPackageReleaseContentsSet(Interface):
-
-    def add(bpr):
-        """Add the contents of the given binary package release.
-
-        :param: bpr: The `IBinaryPackageRelease` to add.
-
-        :return: True on success, False on failure.
-        """
-
-    def remove(bpr):
-        """Remove the contents of the given binary package release.
-
-        :param: bpr: The `IBinaryPackageRelease` to remove.
-        """

=== removed file 'lib/lp/soyuz/model/binarypackagepath.py'
--- lib/lp/soyuz/model/binarypackagepath.py	2011-12-21 14:58:31 +0000
+++ lib/lp/soyuz/model/binarypackagepath.py	1970-01-01 00:00:00 +0000
@@ -1,37 +0,0 @@
-# Copyright 2009 Canonical Ltd.  This software is licensed under the
-# GNU Affero General Public License version 3 (see the file LICENSE).
-
-__metaclass__ = type
-
-__all__ = [
-    'BinaryPackagePath',
-    ]
-
-from storm.locals import (
-    Int,
-    RawStr,
-    Storm,
-    )
-from zope.interface import implements
-
-from lp.services.database.lpstorm import IMasterStore
-from lp.soyuz.interfaces.binarypackagepath import IBinaryPackagePath
-
-
-class BinaryPackagePath(Storm):
-    """See `IBinaryPackagePath`."""
-    implements(IBinaryPackagePath)
-    __storm_table__ = 'BinaryPackagePath'
-    id = Int(primary=True)
-    path = RawStr(name='path', allow_none=False)
-
-    def getOrCreate(self, path):
-        """See `IBinaryPackagePathSet`."""
-        store = IMasterStore(BinaryPackagePath)
-        bpp = store.find(
-            BinaryPackagePath, BinaryPackagePath.path == path).one()
-        if bpp is None:
-            bpp = BinaryPackagePath()
-            bpp.path = path
-            store.add(bpp)
-        return bpp

=== removed file 'lib/lp/soyuz/model/binarypackagereleasecontents.py'
--- lib/lp/soyuz/model/binarypackagereleasecontents.py	2011-12-21 14:58:31 +0000
+++ lib/lp/soyuz/model/binarypackagereleasecontents.py	1970-01-01 00:00:00 +0000
@@ -1,71 +0,0 @@
-# Copyright 2011 Canonical Ltd.  This software is licensed under the
-# GNU Affero General Public License version 3 (see the file LICENSE).
-
-__metaclass__ = type
-
-__all__ = [
-    'BinaryPackageReleaseContents',
-    ]
-
-import tempfile
-
-from apt.debfile import DebPackage
-from bzrlib.osutils import pumpfile
-from storm.locals import (
-    Int,
-    Reference,
-    Storm,
-    )
-from zope.component import getUtility
-from zope.interface import implements
-
-from lp.services.database.lpstorm import IMasterStore
-from lp.soyuz.interfaces.binarypackagepath import IBinaryPackagePathSet
-from lp.soyuz.interfaces.binarypackagereleasecontents import (
-    IBinaryPackageReleaseContents,
-    )
-
-
-class BinaryPackageReleaseContents(Storm):
-    """See `IBinaryPackageReleaseContents`."""
-    implements(IBinaryPackageReleaseContents)
-    __storm_table__ = 'BinaryPackageReleaseContents'
-    __storm_primary__ = ("binarypackagerelease_id", "binarypackagepath_id")
-
-    binarypackagerelease_id = Int(
-        name='binarypackagerelease', allow_none=False)
-    binarypackagerelease = Reference(
-        binarypackagerelease_id, 'BinaryPackageRelease.id')
-
-    binarypackagepath_id = Int(name='binarypackagepath', allow_none=False)
-    binarypackagepath = Reference(
-        binarypackagepath_id, 'BinaryPackagePath.id')
-
-    def add(self, bpr):
-        """See `IBinaryPackageReleaseContentsSet`."""
-        if not bpr.files:
-            return False
-        store = IMasterStore(BinaryPackageReleaseContents)
-        with tempfile.NamedTemporaryFile() as dest_file:
-            bpr.files[0].libraryfile.open()
-            pumpfile(bpr.files[0].libraryfile, dest_file)
-            dest_file.seek(0)
-            deb = DebPackage(filename=dest_file.name)
-        # Filter out directories.
-        filelist = filter(lambda x: not x.endswith('/'), deb.filelist)
-        for filename in filelist:
-            bpp = getUtility(IBinaryPackagePathSet).getOrCreate(
-                filename)
-            bprc = BinaryPackageReleaseContents()
-            bprc.binarypackagerelease = bpr
-            bprc.binarypackagepath = bpp
-            store.add(bprc)
-        return True
-
-    def remove(self, bpr):
-        """See `IBinaryPackageReleaseContentsSet`."""
-        store = IMasterStore(BinaryPackageReleaseContents)
-        results = store.find(
-            BinaryPackageReleaseContents,
-            BinaryPackageReleaseContents.binarypackagerelease == bpr.id)
-        results.remove()

=== removed file 'lib/lp/soyuz/tests/test_binarypackagepath.py'
--- lib/lp/soyuz/tests/test_binarypackagepath.py	2012-01-01 02:58:52 +0000
+++ lib/lp/soyuz/tests/test_binarypackagepath.py	1970-01-01 00:00:00 +0000
@@ -1,26 +0,0 @@
-# Copyright 2011 Canonical Ltd.  This software is licensed under the
-# GNU Affero General Public License version 3 (see the file LICENSE).
-
-"""Test the Binary Package Path model."""
-
-__metaclass__ = type
-
-from zope.component import getUtility
-
-from lp.soyuz.interfaces.binarypackagepath import IBinaryPackagePathSet
-from lp.testing import TestCaseWithFactory
-from lp.testing.layers import DatabaseFunctionalLayer
-
-
-class TestBinaryPackagePath(TestCaseWithFactory):
-
-    layer = DatabaseFunctionalLayer
-
-    def test_getOrCreate(self):
-        bpp = getUtility(IBinaryPackagePathSet).getOrCreate('bin/bash')
-        self.assertEqual('bin/bash', bpp.path)
-
-    def test_getOrCreate_existing(self):
-        orig_bpp = getUtility(IBinaryPackagePathSet).getOrCreate('bin/bash')
-        bpp = getUtility(IBinaryPackagePathSet).getOrCreate('bin/bash')
-        self.assertEqual(orig_bpp.id, bpp.id)

=== removed file 'lib/lp/soyuz/tests/test_binarypackagereleasecontents.py'
--- lib/lp/soyuz/tests/test_binarypackagereleasecontents.py	2012-01-01 02:58:52 +0000
+++ lib/lp/soyuz/tests/test_binarypackagereleasecontents.py	1970-01-01 00:00:00 +0000
@@ -1,65 +0,0 @@
-# Copyright 2011 Canonical Ltd.  This software is licensed under the
-# GNU Affero General Public License version 3 (see the file LICENSE).
-
-"""Test the Binary Package Release Contents model."""
-
-__metaclass__ = type
-
-import transaction
-from zope.component import getUtility
-
-from lp.archiveuploader.tests import datadir
-from lp.services.database.lpstorm import IStore
-from lp.soyuz.interfaces.binarypackagereleasecontents import (
-    IBinaryPackageReleaseContentsSet,
-    )
-from lp.soyuz.model.binarypackagereleasecontents import (
-    BinaryPackageReleaseContents,
-    )
-from lp.testing import TestCaseWithFactory
-from lp.testing.layers import LaunchpadFunctionalLayer
-
-
-class TestBinaryPackageReleaseContents(TestCaseWithFactory):
-
-    layer = LaunchpadFunctionalLayer
-
-    def create_bpr(self):
-        bpr = self.factory.makeBinaryPackageRelease()
-        deb = open(datadir('pmount_0.9.7-2ubuntu2_amd64.deb'), 'r')
-        lfa = self.factory.makeLibraryFileAlias(
-            filename='pmount_0.9.7-2ubuntu2_amd64.deb', content=deb.read())
-        deb.close()
-        transaction.commit()
-        bpr.addFile(lfa)
-        return bpr
-
-    def test_add(self):
-        bpr = self.create_bpr()
-        getUtility(IBinaryPackageReleaseContentsSet).add(bpr)
-        store = IStore(BinaryPackageReleaseContents)
-        results = store.find(
-            BinaryPackageReleaseContents,
-            BinaryPackageReleaseContents.binarypackagerelease == bpr.id)
-        paths = map(lambda x: x.binarypackagepath.path, results)
-        expected_paths = [
-            'etc/pmount.allow', 'usr/bin/pumount', 'usr/bin/pmount-hal',
-            'usr/bin/pmount', 'usr/share/doc/pmount/TODO',
-            'usr/share/doc/pmount/README.Debian',
-            'usr/share/doc/pmount/AUTHORS', 'usr/share/doc/pmount/copyright',
-            'usr/share/doc/pmount/changelog.gz',
-            'usr/share/doc/pmount/changelog.Debian.gz',
-            'usr/share/man/man1/pmount-hal.1.gz',
-            'usr/share/man/man1/pmount.1.gz',
-            'usr/share/man/man1/pumount.1.gz']
-        self.assertContentEqual(expected_paths, paths)
-
-    def test_remove(self):
-        bpr = self.create_bpr()
-        getUtility(IBinaryPackageReleaseContentsSet).add(bpr)
-        getUtility(IBinaryPackageReleaseContentsSet).remove(bpr)
-        store = IStore(BinaryPackageReleaseContents)
-        results = store.find(
-            BinaryPackageReleaseContents,
-            BinaryPackageReleaseContents.binarypackagerelease == bpr.id)
-        self.assertEqual(0, results.count())


Follow ups