60
60
# that it needs a bit of redesigning here around the publication stuff.
61
61
from lp.archivepublisher.config import getPubConfig
62
62
from lp.archivepublisher.customupload import CustomUploadError
63
from lp.archivepublisher.debversion import Version
63
64
from lp.archiveuploader.tagfiles import parse_tagfile_content
64
65
from lp.registry.interfaces.pocket import PackagePublishingPocket
65
66
from lp.registry.model.sourcepackagename import SourcePackageName
562
563
# don't think we need them for sync rejections.
565
changes_file_object = StringIO.StringIO(self.changesfile.read())
566
if self.changesfile is None:
567
changes_file_object = None
569
changes_file_object = StringIO.StringIO(self.changesfile.read())
566
570
# We allow unsigned uploads since they come from the librarian,
567
571
# which are now stored unsigned.
824
828
def _getChangesDict(self, changes_file_object=None):
825
829
"""Return a dictionary with changes file tags in it."""
826
830
if changes_file_object is None:
831
if self.changesfile is None:
827
833
changes_file_object = self.changesfile
828
834
changes_content = changes_file_object.read()
1293
1299
"in MAIN_ARCHIVE_PURPOSES.")
1302
# If the distroseries is 11.10 (oneiric) or later, the valid names
1303
# check is not required. (See bug 788685.)
1304
distroseries = sourcepackagerelease.upload_distroseries
1305
do_names_check = Version(distroseries.version) < Version('11.10')
1296
1307
valid_pockets = (
1297
1308
PackagePublishingPocket.RELEASE, PackagePublishingPocket.SECURITY,
1298
1309
PackagePublishingPocket.UPDATES, PackagePublishingPocket.PROPOSED)
1299
valid_component_names = ('main', 'restricted')
1310
valid_components = ('main', 'restricted')
1300
1311
if (self.packageupload.pocket not in valid_pockets or
1301
sourcepackagerelease.component.name not in valid_component_names):
1313
sourcepackagerelease.component.name not in valid_components)):
1302
1314
# XXX: CarlosPerelloMarin 2006-02-16 bug=31665:
1303
1315
# This should be implemented using a more general rule to accept
1304
1316
# different policies depending on the distribution.
1431
1443
return conflicts.one()
1445
def getBuildsForSources(self, distroseries, status=None, pockets=None,
1447
"""See `IPackageUploadSet`."""
1448
# Avoiding circular imports.
1449
from lp.registry.model.distroseries import DistroSeries
1450
from lp.soyuz.model.binarypackagebuild import BinaryPackageBuild
1451
from lp.soyuz.model.sourcepackagerelease import SourcePackageRelease
1453
archives = distroseries.distribution.getArchiveIDList()
1455
DistroSeries.id == PackageUpload.distroseriesID,
1456
PackageUpload.archiveID.is_in(archives),
1457
PackageUploadBuild.packageuploadID == PackageUpload.id,
1460
if status is not None:
1461
clauses.append(PackageUpload.status.is_in(status))
1462
if pockets is not None:
1463
clauses.append(PackageUpload.pocket.is_in(pockets))
1464
if names is not None:
1466
BinaryPackageBuild.id == PackageUploadBuild.buildID,
1467
BinaryPackageBuild.source_package_release ==
1468
SourcePackageRelease.id,
1469
SourcePackageRelease.sourcepackagename ==
1470
SourcePackageName.id,
1471
SourcePackageName.name.is_in(names),
1474
store = IStore(PackageUpload)
1475
return store.find(PackageUpload, *clauses)
1433
1477
def count(self, status=None, distroseries=None, pocket=None):
1434
1478
"""See `IPackageUploadSet`."""