← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~julian-edwards/launchpad/publisher-config-bug-734800 into lp:launchpad/db-devel

 

Julian Edwards has proposed merging lp:~julian-edwards/launchpad/publisher-config-bug-734800 into lp:launchpad/db-devel.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #734800 in Launchpad itself: "The Soyuz publisher should use PublisherConfig, not canonical.config"
  https://bugs.launchpad.net/launchpad/+bug/734800

For more details, see:
https://code.launchpad.net/~julian-edwards/launchpad/publisher-config-bug-734800/+merge/53664

= Summary =
Make the Soyuz publisher use internal database data for configuration values instead of canonical.config.

== Proposed fix ==
A recent change introduced the PublisherConfig table which holds values that are currently
 configured in canonical.config.  This branch removes the config and makes the publisher u
se the database values instead.

== Implementation details ==
Mostly mechanical changes.  Where the configuration is actually fetched is well encapsulat
ed (for a change!) in a separate archivepublisher.config.Config object which made it easy to switch over.  The mechanical changes are mostly about fixing now-broken tests.

One other disturbing fact is that I needed to adjust sample data for PublisherConfig to make tests pass.  Yes, I know, I know, but the alternative is to change literally hundreds of tests which is more hassle than this man can accept right now.

== Demo and Q/A ==
Dogfood is the only place to test this, and it will be tested on there before landing by attempting to publish some Ubuntu changes.
-- 
https://code.launchpad.net/~julian-edwards/launchpad/publisher-config-bug-734800/+merge/53664
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~julian-edwards/launchpad/publisher-config-bug-734800 into lp:launchpad/db-devel.
=== modified file 'configs/development/launchpad-lazr.conf'
--- configs/development/launchpad-lazr.conf	2011-02-25 19:27:05 +0000
+++ configs/development/launchpad-lazr.conf	2011-03-16 17:34:34 +0000
@@ -5,10 +5,6 @@
 [meta]
 extends: ../../lib/canonical/config/schema-lazr.conf
 
-[archivepublisher]
-root: /var/tmp/archive
-base_url: http://archive.launchpad.dev/
-
 [branchscanner]
 oops_prefix: BS
 error_dir: /var/tmp/codehosting.test

=== modified file 'configs/testrunner/launchpad-lazr.conf'
--- configs/testrunner/launchpad-lazr.conf	2011-02-25 19:27:05 +0000
+++ configs/testrunner/launchpad-lazr.conf	2011-03-16 17:34:34 +0000
@@ -8,9 +8,6 @@
 [canonical]
 cron_control_url: file:lib/lp/services/scripts/tests/cronscripts.ini
 
-[archivepublisher]
-base_url: http://ftpmaster.internal/
-
 [branchscanner]
 oops_prefix: TSMS
 error_dir: /var/tmp/lperr.test

=== modified file 'database/sampledata/current-dev.sql'
--- database/sampledata/current-dev.sql	2011-03-11 17:03:37 +0000
+++ database/sampledata/current-dev.sql	2011-03-16 17:34:34 +0000
@@ -9927,6 +9927,8 @@
 
 ALTER TABLE publisherconfig DISABLE TRIGGER ALL;
 
+INSERT INTO publisherconfig (id, distribution, root_dir, base_url, copy_base_url) VALUES (1, 1, '/var/tmp/archive', 'http://archive.launchpad.dev/', 'http://rebuild-test.internal/');
+INSERT INTO publisherconfig (id, distribution, root_dir, base_url, copy_base_url) VALUES (2, 8, '/var/tmp/archive', 'http://archive.launchpad.dev/', 'http://rebuild-test.internal/');
 
 
 ALTER TABLE publisherconfig ENABLE TRIGGER ALL;

=== modified file 'database/sampledata/current.sql'
--- database/sampledata/current.sql	2011-03-11 17:03:37 +0000
+++ database/sampledata/current.sql	2011-03-16 17:34:34 +0000
@@ -9932,6 +9932,8 @@
 
 ALTER TABLE publisherconfig DISABLE TRIGGER ALL;
 
+INSERT INTO publisherconfig (id, distribution, root_dir, base_url, copy_base_url) VALUES (1, 1, '/var/tmp/archive', 'http://archive.launchpad.dev/', 'http://rebuild-test.internal/');
+INSERT INTO publisherconfig (id, distribution, root_dir, base_url, copy_base_url) VALUES (2, 8, '/var/tmp/archive', 'http://archive.launchpad.dev/', 'http://rebuild-test.internal/');
 
 
 ALTER TABLE publisherconfig ENABLE TRIGGER ALL;
@@ -9940,7 +9942,6 @@
 ALTER TABLE pushmirroraccess DISABLE TRIGGER ALL;
 
 
-
 ALTER TABLE pushmirroraccess ENABLE TRIGGER ALL;
 
 

=== modified file 'database/schema/security.cfg'
--- database/schema/security.cfg	2011-03-16 04:05:57 +0000
+++ database/schema/security.cfg	2011-03-16 17:34:34 +0000
@@ -860,6 +860,8 @@
 public.packagesetgroup                          = SELECT
 public.packagesetsources                        = SELECT, INSERT, UPDATE, DELETE
 public.packagesetinclusion                      = SELECT, INSERT, UPDATE, DELETE
+# INSERT for publisherconfig only required for the test suite.
+public.publisherconfig                          = SELECT, INSERT
 public.flatpackagesetinclusion                  = SELECT, INSERT, UPDATE, DELETE
 public.binarypackagepublishinghistory           = SELECT, INSERT, UPDATE, DELETE
 public.sourcepackagepublishinghistory           = SELECT, INSERT, UPDATE, DELETE
@@ -962,6 +964,7 @@
 public.teamparticipation                        = SELECT
 public.translationimportqueueentry              = SELECT, INSERT, UPDATE
 public.translationtemplatesbuild                = SELECT, INSERT
+public.publisherconfig                          = SELECT
 
 [ppa-apache-log-parser]
 type=user
@@ -1416,6 +1419,7 @@
 public.componentselection               = SELECT
 public.sectionselection                 = SELECT
 public.packagediff                      = SELECT, UPDATE
+public.publisherconfig                  = SELECT
 
 # Librarian stuff
 public.libraryfilealias                 = SELECT, INSERT
@@ -2259,6 +2263,7 @@
 public.distroseries                     = SELECT
 public.emailaddress                     = SELECT
 public.person                           = SELECT
+public.publisherconfig                  = SELECT
 public.teammembership                   = SELECT
 public.teamparticipation                = SELECT
 

=== modified file 'lib/canonical/config/schema-lazr.conf'
--- lib/canonical/config/schema-lazr.conf	2011-03-08 04:26:42 +0000
+++ lib/canonical/config/schema-lazr.conf	2011-03-16 17:34:34 +0000
@@ -24,15 +24,6 @@
 # datatype: string
 dbuser: archivepublisher
 
-# Base directory for distribution archives.
-# datatype: string
-root: /var/tmp/archive/
-
-# External base URL for distribution archives.
-# datatype: string
-base_url: http://ftpmaster.internal/
-copy_base_url: http://rebuild-test.internal/
-
 
 [binaryfile_expire]
 dbuser: binaryfile-expire

=== modified file 'lib/lp/archivepublisher/config.py'
--- lib/lp/archivepublisher/config.py	2011-03-04 15:42:09 +0000
+++ lib/lp/archivepublisher/config.py	2011-03-16 17:34:34 +0000
@@ -8,7 +8,10 @@
 
 import os
 
+from zope.component import getUtility
+
 from canonical.config import config
+from lp.archivepublisher.interfaces.publisherconfig import IPublisherConfigSet
 from lp.soyuz.enums import ArchivePurpose
 
 
@@ -24,9 +27,11 @@
     """
     pubconf = Config()
     ppa_config = config.personalpackagearchive
+    db_pubconf = getUtility(
+        IPublisherConfigSet).getByDistribution(archive.distribution)
 
     pubconf.temproot = os.path.join(
-        config.archivepublisher.root, '%s-temp' % archive.distribution.name)
+        db_pubconf.root_dir, '%s-temp' % archive.distribution.name)
 
     if archive.is_ppa:
         if archive.private:
@@ -40,7 +45,7 @@
             pubconf.distroroot, archive.owner.name, archive.name,
             archive.distribution.name)
     elif archive.is_main:
-        pubconf.distroroot = config.archivepublisher.root
+        pubconf.distroroot = db_pubconf.root_dir
         pubconf.archiveroot = os.path.join(
             pubconf.distroroot, archive.distribution.name)
         if archive.purpose == ArchivePurpose.PARTNER:
@@ -48,7 +53,7 @@
         elif archive.purpose == ArchivePurpose.DEBUG:
             pubconf.archiveroot += '-debug'
     elif archive.is_copy:
-        pubconf.distroroot = config.archivepublisher.root
+        pubconf.distroroot = db_pubconf.root_dir
         pubconf.archiveroot = os.path.join(
             pubconf.distroroot,
             archive.distribution.name + '-' + archive.name,

=== modified file 'lib/lp/archivepublisher/tests/test_publisherconfig.py'
--- lib/lp/archivepublisher/tests/test_publisherconfig.py	2011-03-08 16:41:15 +0000
+++ lib/lp/archivepublisher/tests/test_publisherconfig.py	2011-03-16 17:34:34 +0000
@@ -68,8 +68,6 @@
 
     def test_getByDistribution(self):
         # Test that IPublisherConfigSet.getByDistribution works.
-        pubconf = self.factory.makePublisherConfig(
-            distribution=self.distribution)
         pubconf = getUtility(IPublisherConfigSet).getByDistribution(
             self.distribution)
         self.assertEqual(self.distribution.name, pubconf.distribution.name)
@@ -81,8 +79,8 @@
 
     def test_only_admin(self):
         # Only admins can see and change the config.
-        distro = self.factory.makeDistribution()
-        config = self.factory.makePublisherConfig(distro, root_dir=u"foo")
+        distro = self.factory.makeDistribution(publish_root_dir=u"foo")
+        config = getUtility(IPublisherConfigSet).getByDistribution(distro)
 
         login(ANONYMOUS)
         self.assertRaises(Unauthorized, getattr, config, "root_dir")

=== modified file 'lib/lp/code/model/tests/test_recipebuilder.py'
--- lib/lp/code/model/tests/test_recipebuilder.py	2010-12-23 01:02:00 +0000
+++ lib/lp/code/model/tests/test_recipebuilder.py	2011-03-16 17:34:34 +0000
@@ -21,7 +21,7 @@
 from zope.security.proxy import removeSecurityProxy
 
 from canonical.testing.layers import (
-    LaunchpadFunctionalLayer,
+    LaunchpadZopelessLayer,
     )
 from lp.buildmaster.enums import BuildFarmJobType
 from lp.buildmaster.interfaces.builder import CannotBuild
@@ -50,7 +50,7 @@
 
 class TestRecipeBuilder(TestCaseWithFactory):
 
-    layer = LaunchpadFunctionalLayer
+    layer = LaunchpadZopelessLayer
 
     def makeJob(self, recipe_registrant=None, recipe_owner=None):
         """Create a sample `ISourcePackageRecipeBuildJob`."""

=== modified file 'lib/lp/registry/browser/tests/test_distribution_views.py'
--- lib/lp/registry/browser/tests/test_distribution_views.py	2011-03-14 14:56:42 +0000
+++ lib/lp/registry/browser/tests/test_distribution_views.py	2011-03-16 17:34:34 +0000
@@ -28,7 +28,7 @@
     def setUp(self):
         # Create a test distribution.
         super(TestDistributionPublisherConfigView, self).setUp()
-        self.distro = self.factory.makeDistribution()
+        self.distro = self.factory.makeDistribution(no_pubconf=True)
         login(LAUNCHPAD_ADMIN)
 
         self.ROOT_DIR = u"rootdir/test"

=== modified file 'lib/lp/soyuz/doc/archive-dependencies.txt'
--- lib/lp/soyuz/doc/archive-dependencies.txt	2010-10-18 12:35:41 +0000
+++ lib/lp/soyuz/doc/archive-dependencies.txt	2011-03-16 17:34:34 +0000
@@ -226,11 +226,11 @@
     0
 
     >>> print_building_sources_list(a_build)
-    deb http://ftpmaster.internal/ubuntu hoary
-        main restricted universe multiverse
-    deb http://ftpmaster.internal/ubuntu hoary-security
-        main restricted universe multiverse
-    deb http://ftpmaster.internal/ubuntu hoary-updates
+    deb http://archive.launchpad.dev/ubuntu hoary
+        main restricted universe multiverse
+    deb http://archive.launchpad.dev/ubuntu hoary-security
+        main restricted universe multiverse
+    deb http://archive.launchpad.dev/ubuntu hoary-updates
         main restricted universe multiverse
 
 Once we publish a test binary in Celso's PPA hoary/i386,
@@ -243,11 +243,11 @@
 
     >>> print_building_sources_list(a_build)
     deb http://ppa.launchpad.dev/cprov/ppa/ubuntu hoary main
-    deb http://ftpmaster.internal/ubuntu hoary
-        main restricted universe multiverse
-    deb http://ftpmaster.internal/ubuntu hoary-security
-        main restricted universe multiverse
-    deb http://ftpmaster.internal/ubuntu hoary-updates
+    deb http://archive.launchpad.dev/ubuntu hoary
+        main restricted universe multiverse
+    deb http://archive.launchpad.dev/ubuntu hoary-security
+        main restricted universe multiverse
+    deb http://archive.launchpad.dev/ubuntu hoary-updates
         main restricted universe multiverse
 
 Similarly, unpopulated PPA dependencies are *not* listed in the building
@@ -259,11 +259,11 @@
     ...     getUtility(IComponentSet)['main'])
     >>> print_building_sources_list(a_build)
     deb http://ppa.launchpad.dev/cprov/ppa/ubuntu hoary main
-    deb http://ftpmaster.internal/ubuntu hoary
-        main restricted universe multiverse
-    deb http://ftpmaster.internal/ubuntu hoary-security
-        main restricted universe multiverse
-    deb http://ftpmaster.internal/ubuntu hoary-updates
+    deb http://archive.launchpad.dev/ubuntu hoary
+        main restricted universe multiverse
+    deb http://archive.launchpad.dev/ubuntu hoary-security
+        main restricted universe multiverse
+    deb http://archive.launchpad.dev/ubuntu hoary-updates
         main restricted universe multiverse
 
 But *populated* PPA dependencies *are* listed in the building 'sources_list'.
@@ -274,11 +274,11 @@
     >>> print_building_sources_list(a_build)
     deb http://ppa.launchpad.dev/cprov/ppa/ubuntu hoary main
     deb http://ppa.launchpad.dev/mark/ppa/ubuntu hoary main
-    deb http://ftpmaster.internal/ubuntu hoary
-        main restricted universe multiverse
-    deb http://ftpmaster.internal/ubuntu hoary-security
-        main restricted universe multiverse
-    deb http://ftpmaster.internal/ubuntu hoary-updates
+    deb http://archive.launchpad.dev/ubuntu hoary
+        main restricted universe multiverse
+    deb http://archive.launchpad.dev/ubuntu hoary-security
+        main restricted universe multiverse
+    deb http://archive.launchpad.dev/ubuntu hoary-updates
         main restricted universe multiverse
 
 The authentication information gets added for private PPA
@@ -300,11 +300,11 @@
     deb http://ppa.launchpad.dev/cprov/ppa/ubuntu hoary main
     deb http://buildd:sekrit@xxxxxxxxxxxxxxxxxxxxxxxxx/mark/p3a/ubuntu
         hoary main
-    deb http://ftpmaster.internal/ubuntu hoary
-        main restricted universe multiverse
-    deb http://ftpmaster.internal/ubuntu hoary-security
-        main restricted universe multiverse
-    deb http://ftpmaster.internal/ubuntu hoary-updates
+    deb http://archive.launchpad.dev/ubuntu hoary
+        main restricted universe multiverse
+    deb http://archive.launchpad.dev/ubuntu hoary-security
+        main restricted universe multiverse
+    deb http://archive.launchpad.dev/ubuntu hoary-updates
         main restricted universe multiverse
 
 Remove the private PPA dependency before continuing.
@@ -332,11 +332,11 @@
     ValueError: incomplete format
     <BLANKLINE>
     deb http://ppa.launchpad.dev/cprov/ppa/ubuntu hoary main
-    deb http://ftpmaster.internal/ubuntu hoary
-        main restricted universe multiverse
-    deb http://ftpmaster.internal/ubuntu hoary-security
-        main restricted universe multiverse
-    deb http://ftpmaster.internal/ubuntu hoary-updates
+    deb http://archive.launchpad.dev/ubuntu hoary
+        main restricted universe multiverse
+    deb http://archive.launchpad.dev/ubuntu hoary-security
+        main restricted universe multiverse
+    deb http://archive.launchpad.dev/ubuntu hoary-updates
         main restricted universe multiverse
 
 However, in order to avoid the problem going forward (and to allow the PPA
@@ -372,11 +372,11 @@
     ValueError: incomplete format
     <BLANKLINE>
     deb http://ppa.launchpad.dev/cprov/ppa/ubuntu hoary main
-    deb http://ftpmaster.internal/ubuntu hoary
-        main restricted universe multiverse
-    deb http://ftpmaster.internal/ubuntu hoary-security
-        main restricted universe multiverse
-    deb http://ftpmaster.internal/ubuntu hoary-updates
+    deb http://archive.launchpad.dev/ubuntu hoary
+        main restricted universe multiverse
+    deb http://archive.launchpad.dev/ubuntu hoary-security
+        main restricted universe multiverse
+    deb http://archive.launchpad.dev/ubuntu hoary-updates
         main restricted universe multiverse
 
 However, in order to avoid the problem going forward (and to allow the PPA
@@ -407,11 +407,11 @@
 
     >>> print_building_sources_list(a_build)
     deb http://ppa.launchpad.dev/cprov/ppa/ubuntu hoary main
-    deb http://ftpmaster.internal/ubuntu hoary
-        main restricted universe multiverse
-    deb http://ftpmaster.internal/ubuntu hoary-security
-        main restricted universe multiverse
-    deb http://ftpmaster.internal/ubuntu hoary-updates
+    deb http://archive.launchpad.dev/ubuntu hoary
+        main restricted universe multiverse
+    deb http://archive.launchpad.dev/ubuntu hoary-security
+        main restricted universe multiverse
+    deb http://archive.launchpad.dev/ubuntu hoary-updates
         main restricted universe multiverse
 
 The default build behaviour will remain unchanged when we override the
@@ -423,11 +423,11 @@
 
     >>> print_building_sources_list(a_build)
     deb http://ppa.launchpad.dev/cprov/ppa/ubuntu hoary main
-    deb http://ftpmaster.internal/ubuntu hoary
-        main restricted universe multiverse
-    deb http://ftpmaster.internal/ubuntu hoary-security
-        main restricted universe multiverse
-    deb http://ftpmaster.internal/ubuntu hoary-updates
+    deb http://archive.launchpad.dev/ubuntu hoary
+        main restricted universe multiverse
+    deb http://archive.launchpad.dev/ubuntu hoary-security
+        main restricted universe multiverse
+    deb http://archive.launchpad.dev/ubuntu hoary-updates
         main restricted universe multiverse
 
     >>> cprov.archive.removeArchiveDependency(ubuntu.main_archive)
@@ -450,9 +450,9 @@
 
     >>> print_building_sources_list(a_build)
     deb http://ppa.launchpad.dev/cprov/ppa/ubuntu hoary main
-    deb http://ftpmaster.internal/ubuntu hoary
+    deb http://archive.launchpad.dev/ubuntu hoary
         main universe
-    deb http://ftpmaster.internal/ubuntu hoary-security
+    deb http://archive.launchpad.dev/ubuntu hoary-security
         main universe
 
     >>> cprov.archive.removeArchiveDependency(ubuntu.main_archive)
@@ -467,7 +467,7 @@
 
     >>> print_building_sources_list(a_build)
     deb http://ppa.launchpad.dev/cprov/ppa/ubuntu hoary main
-    deb http://ftpmaster.internal/ubuntu hoary main restricted
+    deb http://archive.launchpad.dev/ubuntu hoary main restricted
 
     >>> cprov.archive.removeArchiveDependency(ubuntu.main_archive)
 
@@ -480,13 +480,13 @@
 
     >>> print_building_sources_list(a_build)
     deb http://ppa.launchpad.dev/cprov/ppa/ubuntu hoary main
-    deb http://ftpmaster.internal/ubuntu hoary
-        main restricted universe multiverse
-    deb http://ftpmaster.internal/ubuntu hoary-security
-        main restricted universe multiverse
-    deb http://ftpmaster.internal/ubuntu hoary-updates
-        main restricted universe multiverse
-    deb http://ftpmaster.internal/ubuntu hoary-proposed
+    deb http://archive.launchpad.dev/ubuntu hoary
+        main restricted universe multiverse
+    deb http://archive.launchpad.dev/ubuntu hoary-security
+        main restricted universe multiverse
+    deb http://archive.launchpad.dev/ubuntu hoary-updates
+        main restricted universe multiverse
+    deb http://archive.launchpad.dev/ubuntu hoary-proposed
         main restricted universe multiverse
 
     >>> cprov.archive.removeArchiveDependency(ubuntu.main_archive)
@@ -499,13 +499,13 @@
 
     >>> print_building_sources_list(a_build)
     deb http://ppa.launchpad.dev/cprov/ppa/ubuntu hoary main
-    deb http://ftpmaster.internal/ubuntu hoary
-        main restricted universe multiverse
-    deb http://ftpmaster.internal/ubuntu hoary-security
-        main restricted universe multiverse
-    deb http://ftpmaster.internal/ubuntu hoary-updates
-        main restricted universe multiverse
-    deb http://ftpmaster.internal/ubuntu hoary-backports
+    deb http://archive.launchpad.dev/ubuntu hoary
+        main restricted universe multiverse
+    deb http://archive.launchpad.dev/ubuntu hoary-security
+        main restricted universe multiverse
+    deb http://archive.launchpad.dev/ubuntu hoary-updates
+        main restricted universe multiverse
+    deb http://archive.launchpad.dev/ubuntu hoary-backports
         main restricted universe multiverse
 
     >>> cprov.archive.removeArchiveDependency(ubuntu.main_archive)
@@ -532,12 +532,12 @@
     >>> [partner_build] = pub_source.createMissingBuilds()
 
     >>> print_building_sources_list(partner_build)
-    deb http://ftpmaster.internal/ubuntu-partner hoary partner
-    deb http://ftpmaster.internal/ubuntu hoary
-        main restricted universe multiverse
-    deb http://ftpmaster.internal/ubuntu hoary-security
-        main restricted universe multiverse
-    deb http://ftpmaster.internal/ubuntu hoary-updates
+    deb http://archive.launchpad.dev/ubuntu-partner hoary partner
+    deb http://archive.launchpad.dev/ubuntu hoary
+        main restricted universe multiverse
+    deb http://archive.launchpad.dev/ubuntu hoary-security
+        main restricted universe multiverse
+    deb http://archive.launchpad.dev/ubuntu hoary-updates
         main restricted universe multiverse
 
 
@@ -570,9 +570,9 @@
     deb http://user:pass@repository zoing everything
     deb http://user:pass@repository hoary public private
     deb http://user:pass@repository hoary-extra public
-    deb http://ftpmaster.internal/ubuntu hoary
-        main restricted universe multiverse
-    deb http://ftpmaster.internal/ubuntu hoary-security
-        main restricted universe multiverse
-    deb http://ftpmaster.internal/ubuntu hoary-updates
+    deb http://archive.launchpad.dev/ubuntu hoary
+        main restricted universe multiverse
+    deb http://archive.launchpad.dev/ubuntu hoary-security
+        main restricted universe multiverse
+    deb http://archive.launchpad.dev/ubuntu hoary-updates
         main restricted universe multiverse

=== modified file 'lib/lp/soyuz/doc/archive.txt'
--- lib/lp/soyuz/doc/archive.txt	2011-03-10 22:36:25 +0000
+++ lib/lp/soyuz/doc/archive.txt	2011-03-16 17:34:34 +0000
@@ -1284,21 +1284,23 @@
     None
 
 IArchive.archive_url will return a URL for the archive that the builder can
-use to retrieve files from it.
+use to retrieve files from it.  Internal paths and urls supplied via the
+PunlisherConfig require us to log in as an admin:
 
+    >>> login('admin@xxxxxxxxxxxxx')
     >>> print partner_archive.archive_url
-    http://ftpmaster.internal/ubuntutest-partner
+    http://archive.launchpad.dev/ubuntutest-partner
 
     >>> print sandbox_archive.archive_url
     http://ppa.launchpad.dev/name16/ppa/ubuntu
 
     >>> print getUtility(IArchiveSet).getByDistroPurpose(
     ...     ubuntutest, ArchivePurpose.PRIMARY).archive_url
-    http://ftpmaster.internal/ubuntutest
+    http://archive.launchpad.dev/ubuntutest
 
     >>> print getUtility(IArchiveSet).getByDistroPurpose(
     ...     ubuntu, ArchivePurpose.DEBUG).archive_url
-    http://ftpmaster.internal/ubuntu-debug
+    http://archive.launchpad.dev/ubuntu-debug
 
 COPY archives use a URL format of <distro-name>-<archive-name>:
 
@@ -1310,6 +1312,7 @@
 If the archive is private, the url may be different as private PPAs
 are published to a secure location.
 
+    >>> login("celso.providelo@xxxxxxxxxxxxx")
     >>> print cprov_archive.archive_url
     http://ppa.launchpad.dev/cprov/ppa/ubuntu
 

=== modified file 'lib/lp/soyuz/doc/publishing.txt'
--- lib/lp/soyuz/doc/publishing.txt	2011-03-03 00:43:44 +0000
+++ lib/lp/soyuz/doc/publishing.txt	2011-03-16 17:34:34 +0000
@@ -362,7 +362,7 @@
     >>> [(pub_file.libraryfilealias.filename, pub_file.file_type_name,
     ...   pub_file.archive_url) for pub_file in spph.files]
     [(u'alsa-utils_1.0.8-1ubuntu1.dsc', 'dsc',
-      u'http://ftpmaster.internal/ubuntu/pool/main/a/alsa-utils/alsa-utils_1.0.8-1ubuntu1.dsc')]
+      u'http://archive.launchpad.dev/ubuntu/pool/main/a/alsa-utils/alsa-utils_1.0.8-1ubuntu1.dsc')]
 
 
 Deletion and obsolescence
@@ -952,8 +952,11 @@
     >>> [pub_file.libraryfilealias.filename for pub_file in bpph.files]
     [u'mozilla-firefox_0.9_i386.deb']
 
+    >>> debian = bpph.distroarchseries.distroseries.distribution
+    >>> discard = factory.makePublisherConfig(
+    ...     distribution=debian, base_url=u"http://archive.launchpad.dev";)
     >>> [pub_file.archive_url for pub_file in bpph.files]
-    [u'http://ftpmaster.internal/debian/pool/universe/m/mozilla-firefox/mozilla-firefox_0.9_i386.deb']
+    [u'http://archive.launchpad.dev/debian/pool/universe/m/mozilla-firefox/mozilla-firefox_0.9_i386.deb']
 
 Binary publishing records also have a download count, which contains
 the number of downloads of this binary package release in this archive.

=== modified file 'lib/lp/soyuz/model/archive.py'
--- lib/lp/soyuz/model/archive.py	2011-03-07 07:05:39 +0000
+++ lib/lp/soyuz/model/archive.py	2011-03-16 17:34:34 +0000
@@ -39,7 +39,6 @@
     alsoProvides,
     implements,
     )
-from zope.security.proxy import removeSecurityProxy
 
 from canonical.config import config
 from canonical.database.constants import UTC_NOW
@@ -76,6 +75,7 @@
 from lp.app.errors import NotFoundError
 from lp.app.validators.name import valid_name
 from lp.archivepublisher.debversion import Version
+from lp.archivepublisher.interfaces.publisherconfig import IPublisherConfigSet
 from lp.archiveuploader.utils import (
     re_isadeb,
     re_issource,
@@ -423,9 +423,11 @@
                 url, "/".join(
                     (self.owner.name, self.name, self.distribution.name)))
 
+        db_pubconf = getUtility(
+            IPublisherConfigSet).getByDistribution(self.distribution)
         if self.is_copy:
             url = urlappend(
-                config.archivepublisher.copy_base_url,
+                db_pubconf.copy_base_url,
                 self.distribution.name + '-' + self.name)
             return urlappend(url, self.distribution.name)
 
@@ -435,8 +437,7 @@
             raise AssertionError(
                 "archive_url unknown for purpose: %s" % self.purpose)
         return urlappend(
-            config.archivepublisher.base_url,
-            self.distribution.name + postfix)
+            db_pubconf.base_url, self.distribution.name + postfix)
 
     @property
     def signing_key_fingerprint(self):

=== modified file 'lib/lp/soyuz/scripts/tests/test_publishdistro.py'
--- lib/lp/soyuz/scripts/tests/test_publishdistro.py	2010-12-20 03:21:03 +0000
+++ lib/lp/soyuz/scripts/tests/test_publishdistro.py	2011-03-16 17:34:34 +0000
@@ -17,6 +17,7 @@
 
 from canonical.config import config
 from lp.archivepublisher.config import getPubConfig
+from lp.archivepublisher.interfaces.publisherconfig import IPublisherConfigSet
 from lp.registry.interfaces.distribution import IDistributionSet
 from lp.registry.interfaces.person import IPersonSet
 from lp.services.log.logger import BufferLogger
@@ -274,13 +275,15 @@
             self.runPublishDistro, ['--primary-debug'])
 
         # The DEBUG repository path was not created.
+        ubuntutest = getUtility(IDistributionSet)['ubuntutest']
+        root_dir = getUtility(
+            IPublisherConfigSet).getByDistribution(ubuntutest).root_dir
         repo_path = os.path.join(
-            config.archivepublisher.root, 'ubuntutest-debug')
+            root_dir, 'ubuntutest-debug')
         self.assertNotExists(repo_path)
 
         # We will create the DEBUG archive for ubuntutest, so it can
         # be published.
-        ubuntutest = getUtility(IDistributionSet)['ubuntutest']
         debug_archive = getUtility(IArchiveSet).new(
             purpose=ArchivePurpose.DEBUG, owner=ubuntutest.owner,
             distribution=ubuntutest)
@@ -319,8 +322,10 @@
         copy_archive_name = 'test-copy-publish'
 
         # The COPY repository path is not created yet.
+        root_dir = getUtility(
+            IPublisherConfigSet).getByDistribution(ubuntutest).root_dir
         repo_path = os.path.join(
-            config.archivepublisher.root,
+            root_dir,
             ubuntutest.name + '-' + copy_archive_name,
             ubuntutest.name)
         self.assertNotExists(repo_path)

=== modified file 'lib/lp/soyuz/tests/test_packageupload.py'
--- lib/lp/soyuz/tests/test_packageupload.py	2010-12-20 06:46:09 +0000
+++ lib/lp/soyuz/tests/test_packageupload.py	2011-03-16 17:34:34 +0000
@@ -12,6 +12,7 @@
 from canonical.config import config
 from canonical.testing.layers import LaunchpadZopelessLayer
 from lp.archiveuploader.tests import datadir
+from lp.archivepublisher.interfaces.publisherconfig import IPublisherConfigSet
 from lp.buildmaster.enums import BuildStatus
 from lp.registry.interfaces.distribution import IDistributionSet
 from lp.registry.interfaces.pocket import PackagePublishingPocket
@@ -158,22 +159,26 @@
             self.assertEqual(
                 restricted, pub_file.libraryfilealias.restricted)
 
-    def removeRepository(self):
+    def removeRepository(self, distro):
         """Remove the testing repository root if it exists."""
-        if os.path.exists(config.archivepublisher.root):
-            shutil.rmtree(config.archivepublisher.root)
+        root = getUtility(
+            IPublisherConfigSet).getByDistribution(distro).root_dir
+        if os.path.exists(root):
+            shutil.rmtree(root)
 
     def test_realiseUpload_for_delayed_copies(self):
         # Delayed-copies result in published records that were overridden
         # and has their files privacy adjusted according test destination
         # context.
 
+        # Create the default delayed-copy context.
+        delayed_copy = self.createDelayedCopy()
+
         # Add a cleanup for removing the repository where the custom upload
         # was published.
-        self.addCleanup(self.removeRepository)
-
-        # Create the default delayed-copy context.
-        delayed_copy = self.createDelayedCopy()
+        self.addCleanup(
+            self.removeRepository,
+            self.test_publisher.breezy_autotest.distribution)
 
         # Delayed-copies targeted to unreleased pockets cannot be accepted.
         self.assertRaisesWithContent(
@@ -216,6 +221,7 @@
         # production.  The user's environment might have a different umask, so
         # just force it to what the test expects.
         old_umask = os.umask(022)
+
         try:
             pub_records = delayed_copy.realiseUpload(logger=logger)
         finally:
@@ -271,8 +277,10 @@
         self.assertFalse(package_diff.diff_content.restricted)
 
         # The custom file was also published.
+        root_dir = getUtility(IPublisherConfigSet).getByDistribution(
+            self.test_publisher.breezy_autotest.distribution).root_dir
         custom_path = os.path.join(
-            config.archivepublisher.root,
+            root_dir,
             'ubuntutest/dists/breezy-autotest-security',
             'main/dist-upgrader-all')
         self.assertEquals(

=== modified file 'lib/lp/testing/factory.py'
--- lib/lp/testing/factory.py	2011-03-16 04:05:57 +0000
+++ lib/lp/testing/factory.py	2011-03-16 17:34:34 +0000
@@ -2213,8 +2213,10 @@
         return library_file_alias
 
     def makeDistribution(self, name=None, displayname=None, owner=None,
-                         registrant=None, members=None, title=None, 
-                         aliases=None, bug_supervisor=None):
+                         registrant=None, members=None, title=None,
+                         aliases=None, bug_supervisor=None,
+                         publish_root_dir=None, publish_base_url=None,
+                         publish_copy_base_url=None, no_pubconf=False):
         """Make a new distribution."""
         if name is None:
             name = self.getUniqueString(prefix="distribution")
@@ -2239,6 +2241,10 @@
         if bug_supervisor is not None:
             naked_distro = removeSecurityProxy(distro)
             naked_distro.bug_supervisor = bug_supervisor
+        if no_pubconf is False:
+            self.makePublisherConfig(
+                distro, publish_root_dir, publish_base_url,
+                publish_copy_base_url)
         return distro
 
     def makeDistroRelease(self, distribution=None, version=None,