예제 #1
0
 def setPackaging(self, productseries, owner):
     """See `ISourcePackage`."""
     target = self.direct_packaging
     if target is not None:
         if target.productseries == productseries:
             return
         # Delete the current packaging and create a new one so
         # that the translation sharing jobs are started.
         self.direct_packaging.destroySelf()
     PackagingUtil.createPackaging(distroseries=self.distroseries,
                                   sourcepackagename=self.sourcepackagename,
                                   productseries=productseries,
                                   owner=owner,
                                   packaging=PackagingType.PRIME)
     # and make sure this change is immediately available
     flush_database_updates()
예제 #2
0
    def setPackaging(self, distroseries, sourcepackagename, owner):
        """See IProductSeries."""
        if distroseries.distribution.full_functionality:
            source_package = distroseries.getSourcePackage(sourcepackagename)
            if source_package.currentrelease is None:
                raise AssertionError(
                    "The source package is not published in %s." %
                    distroseries.displayname)
        for pkg in self.packagings:
            if (pkg.distroseries == distroseries and
                pkg.sourcepackagename == sourcepackagename):
                # we have found a matching Packaging record
                # and it has the same source package name
                return pkg

        # ok, we didn't find a packaging record that matches, let's go ahead
        # and create one
        pkg = PackagingUtil.createPackaging(
            distroseries=distroseries,
            sourcepackagename=sourcepackagename,
            productseries=self,
            packaging=PackagingType.PRIME,
            owner=owner)
        pkg.sync()  # convert UTC_NOW to actual datetime
        return pkg