示例#1
0
 def makeScript(self, distribution=None, args=[], all_derived=False):
     """Create a `PublishDistro` for `distribution`."""
     if distribution is None and not all_derived:
         distribution = self.makeDistro()
     distro_args = []
     if distribution is not None:
         distro_args.extend(['--distribution', distribution.name])
     if all_derived:
         distro_args.append('--all-derived')
     full_args = args + distro_args
     script = PublishDistro(test_args=full_args)
     script.distribution = distribution
     script.logger = DevNullLogger()
     return script
 def makeScript(self, distribution=None, args=[], all_derived=False):
     """Create a `PublishDistro` for `distribution`."""
     if distribution is None and not all_derived:
         distribution = self.makeDistro()
     distro_args = []
     if distribution is not None:
         distro_args.extend(['--distribution', distribution.name])
     if all_derived:
         distro_args.append('--all-derived')
     full_args = args + distro_args
     script = PublishDistro(test_args=full_args)
     script.distribution = distribution
     script.logger = DevNullLogger()
     return script
    def runPublishDistro(self, distribution, args=[], suites=None):
        """Execute `publish-distro`."""
        if suites is None:
            suites = []
        arguments = (
            ['-d', distribution.name] +
            args +
            sum([['-s', suite] for suite in suites], []))

        publish_distro = PublishDistro(
            test_args=arguments, logger=self.logger)
        publish_distro.logger = self.logger
        publish_distro.txn = self.txn
        publish_distro.main()
    def runPublishDistro(self, extra_args=None, distribution="ubuntutest"):
        """Run publish-distro without invoking the script.

        This method hooks into the publishdistro module to run the
        publish-distro script without the overhead of using Popen.
        """
        args = ["-d", distribution]
        if extra_args is not None:
            args.extend(extra_args)
        publish_distro = PublishDistro(test_args=args)
        publish_distro.logger = BufferLogger()
        publish_distro.txn = self.layer.txn
        switch_dbuser(config.archivepublisher.dbuser)
        publish_distro.main()
        switch_dbuser('launchpad')
示例#5
0
 def test_findDistros_raises_if_selected_distro_not_found(self):
     # If findDistro can't find the distribution, that's an
     # OptionValueError.
     wrong_name = self.factory.getUniqueString()
     self.assertRaises(
         OptionValueError,
         PublishDistro(test_args=['-d', wrong_name]).findDistros)
    def runPublishDistro(self, distribution, args=[], suites=None):
        """Execute `publish-distro`."""
        if suites is None:
            suites = []
        arguments = (['-d', distribution.name] + args +
                     sum([['-s', suite] for suite in suites], []))

        publish_distro = PublishDistro(test_args=arguments, logger=self.logger)
        publish_distro.logger = self.logger
        publish_distro.txn = self.txn
        publish_distro.main()
示例#7
0
    def runPublishDistro(self, extra_args=None, distribution="ubuntutest"):
        """Run publish-distro without invoking the script.

        This method hooks into the publishdistro module to run the
        publish-distro script without the overhead of using Popen.
        """
        args = ["-d", distribution]
        if extra_args is not None:
            args.extend(extra_args)
        publish_distro = PublishDistro(test_args=args)
        publish_distro.logger = BufferLogger()
        publish_distro.txn = self.layer.txn
        switch_dbuser(config.archivepublisher.dbuser)
        publish_distro.main()
        switch_dbuser('launchpad')
示例#8
0
#!/usr/bin/python -S
#
# Copyright 2009-2011 Canonical Ltd.  This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).

import _pythonpath

from lp.soyuz.scripts.publishdistro import PublishDistro

if __name__ == "__main__":
    script = PublishDistro('publish-distro', dbuser='******')
    script.lock_and_run()
#!/usr/bin/python -S
#
# Copyright 2009-2011 Canonical Ltd.  This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).

import _pythonpath

from lp.soyuz.scripts.publishdistro import PublishDistro


if __name__ == "__main__":
    script = PublishDistro('publish-distro', dbuser='******')
    script.lock_and_run()
示例#10
0
 def test_findDistros_finds_ubuntu_by_default(self):
     ubuntu = getUtility(ILaunchpadCelebrities).ubuntu
     self.assertContentEqual([ubuntu],
                             PublishDistro(test_args=[]).findDistros())
示例#11
0
 def test_validateOptions_does_not_accept_distro_with_all_derived(self):
     # The --all-derived option conflicts with the --distribution
     # option.
     distro = self.makeDistro()
     script = PublishDistro(test_args=['-d', distro.name, '--all-derived'])
     self.assertRaises(OptionValueError, script.validateOptions)
示例#12
0
 def test_validateOptions_accepts_all_derived_without_distro(self):
     # If --all-derived is given, the --distribution option is not
     # required.
     PublishDistro(test_args=['--all-derived']).validateOptions()
     # The test is that we get here without error.
     pass