Exemplo n.º 1
0
 def makeScript(self, distro=None, extra_args=[]):
     """Produce instance of the `PublishFTPMaster` script."""
     if distro is None:
         distro = self.makeDistroWithPublishDirectory()
     script = PublishFTPMaster(test_args=["-d", distro.name] + extra_args)
     script.txn = self.layer.txn
     script.logger = DevNullLogger()
     return script
 def makeScript(self, distro=None, extra_args=[]):
     """Produce instance of the `PublishFTPMaster` script."""
     if distro is None:
         distro = self.makeDistroWithPublishDirectory()
     script = PublishFTPMaster(test_args=["-d", distro.name] + extra_args)
     script.txn = self.layer.txn
     script.logger = DevNullLogger()
     return script
 def test_main(self):
     # If run end-to-end, the script generates Contents.gz files, and a
     # following publisher run will put those files in their final place
     # and include them in the Release file.
     distro = self.makeDistro()
     distroseries = self.factory.makeDistroSeries(distribution=distro)
     processor = self.factory.makeProcessor()
     das = self.factory.makeDistroArchSeries(distroseries=distroseries,
                                             processor=processor)
     package = self.factory.makeSuiteSourcePackage(distroseries)
     self.factory.makeSourcePackagePublishingHistory(
         distroseries=distroseries, pocket=package.pocket)
     self.factory.makeBinaryPackageBuild(distroarchseries=das,
                                         pocket=package.pocket,
                                         processor=processor)
     suite = package.suite
     script = self.makeScript(distro)
     os.makedirs(os.path.join(script.config.distsroot, package.suite))
     self.assertNotEqual([], list(script.getSuites()))
     fake_overrides(script, distroseries)
     script.process()
     self.assertTrue(
         file_exists(
             os.path.join(script.config.stagingroot, suite,
                          "Contents-%s.gz" % das.architecturetag)))
     publisher_script = PublishFTPMaster(test_args=["-d", distro.name])
     publisher_script.txn = self.layer.txn
     publisher_script.logger = DevNullLogger()
     publisher_script.main()
     contents_path = os.path.join(script.config.distsroot, suite,
                                  "Contents-%s.gz" % das.architecturetag)
     self.assertTrue(file_exists(contents_path))
     with open(contents_path, "rb") as contents_file:
         contents_bytes = contents_file.read()
     release_path = os.path.join(script.config.distsroot, suite, "Release")
     self.assertTrue(file_exists(release_path))
     with open(release_path) as release_file:
         release_lines = release_file.readlines()
     self.assertIn(
         " %s %16s Contents-%s.gz\n" %
         (hashlib.md5(contents_bytes).hexdigest(), len(contents_bytes),
          das.architecturetag), release_lines)
#!/usr/bin/python -S
#
# Copyright 2011 Canonical Ltd.  This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).

"""Master distro publishing script."""

import _pythonpath

from lp.archivepublisher.scripts.publish_ftpmaster import PublishFTPMaster


if __name__ == '__main__':
    script = PublishFTPMaster(
        "publish-ftpmaster", 'publish_ftpmaster')
    script.lock_and_run()
Exemplo n.º 5
0
 def test_processOptions_for_all_derived_ignores_nonderived_distros(self):
     distro = self.factory.makeDistribution()
     script = PublishFTPMaster(test_args=['--all-derived'])
     script.processOptions()
     self.assertNotIn(distro, script.distributions)
Exemplo n.º 6
0
 def test_processOptions_for_all_derived_finds_derived_distros(self):
     dsp = self.factory.makeDistroSeriesParent()
     script = PublishFTPMaster(test_args=['--all-derived'])
     script.processOptions()
     self.assertIn(dsp.derived_series.distribution, script.distributions)
Exemplo n.º 7
0
#!/usr/bin/python -S
#
# Copyright 2011 Canonical Ltd.  This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Master distro publishing script."""

import _pythonpath

from lp.archivepublisher.scripts.publish_ftpmaster import PublishFTPMaster

if __name__ == '__main__':
    script = PublishFTPMaster("publish-ftpmaster", 'publish_ftpmaster')
    script.lock_and_run()
 def test_processOptions_for_all_derived_ignores_nonderived_distros(self):
     distro = self.factory.makeDistribution()
     script = PublishFTPMaster(test_args=['--all-derived'])
     script.processOptions()
     self.assertNotIn(distro, script.distributions)
 def test_processOptions_for_all_derived_finds_derived_distros(self):
     dsp = self.factory.makeDistroSeriesParent()
     script = PublishFTPMaster(test_args=['--all-derived'])
     script.processOptions()
     self.assertIn(dsp.derived_series.distribution, script.distributions)