862
862
productseries = self.makeProductSeries(product=product)
863
863
distroseries = None
865
distroseries = self.makeDistroSeries(distribution=distribution)
865
distroseries = self.makeDistroRelease(distribution=distribution)
867
867
name = self.getUniqueString()
868
868
return ProxyFactory(
954
954
licenses=None, owner=None, registrant=None,
955
955
title=None, summary=None, official_malone=None,
956
956
translations_usage=None, bug_supervisor=None,
957
driver=None, security_contact=None, icon=None):
958
958
"""Create and return a new, arbitrary Product."""
959
959
if owner is None:
960
960
owner = self.makePerson()
980
980
self.getUniqueString('description'),
981
981
licenses=licenses,
983
registrant=registrant,
983
registrant=registrant)
985
984
naked_product = removeSecurityProxy(product)
986
985
if official_malone is not None:
987
986
naked_product.official_malone = official_malone
991
990
naked_product.bug_supervisor = bug_supervisor
992
991
if driver is not None:
993
992
naked_product.driver = driver
994
if security_contact is not None:
995
naked_product.security_contact = security_contact
998
995
def makeProductSeries(self, product=None, name=None, owner=None,
1026
1023
return ProxyFactory(series)
1028
1025
def makeProject(self, name=None, displayname=None, title=None,
1029
homepageurl=None, summary=None, owner=None, driver=None,
1026
homepageurl=None, summary=None, owner=None,
1030
1027
description=None):
1031
1028
"""Create and return a new, arbitrary ProjectGroup."""
1032
1029
if owner is None:
2056
2050
makeBlueprint = makeSpecification
2058
2052
def makeQuestion(self, target=None, title=None,
2059
owner=None, description=None, language=None):
2053
owner=None, description=None):
2060
2054
"""Create and return a new, arbitrary Question.
2062
2056
:param target: The IQuestionTarget to make the question on. If one is
2065
2059
arbitrary title is created.
2066
2060
:param owner: The owner of the question. If one is not provided, the
2067
2061
question target owner will be used.
2068
:param description: The question description.
2069
:param language: The question language. If one is not provided, then
2070
English will be used.
2072
2063
if target is None:
2073
2064
target = self.makeProduct()
2077
2068
owner = target.owner
2078
2069
if description is None:
2079
2070
description = self.getUniqueString('description')
2080
with person_logged_in(owner):
2071
with person_logged_in(target.owner):
2081
2072
question = target.newQuestion(
2082
owner=owner, title=title, description=description,
2073
owner=owner, title=title, description=description)
2084
2074
return question
2086
2076
def makeQuestionSubscription(self, question=None, person=None):
2331
2321
def makeDistribution(self, name=None, displayname=None, owner=None,
2332
2322
registrant=None, members=None, title=None,
2333
aliases=None, bug_supervisor=None, driver=None,
2334
security_contact=None, publish_root_dir=None,
2335
publish_base_url=None, publish_copy_base_url=None,
2336
no_pubconf=False, icon=None):
2323
aliases=None, bug_supervisor=None,
2324
publish_root_dir=None, publish_base_url=None,
2325
publish_copy_base_url=None, no_pubconf=False):
2337
2326
"""Make a new distribution."""
2338
2327
if name is None:
2339
2328
name = self.getUniqueString(prefix="distribution")
2352
2341
members = self.makeTeam(owner)
2353
2342
distro = getUtility(IDistributionSet).new(
2354
2343
name, displayname, title, description, summary, domainname,
2355
members, owner, registrant, icon=icon)
2356
naked_distro = removeSecurityProxy(distro)
2344
members, owner, registrant)
2357
2345
if aliases is not None:
2358
naked_distro.setAliases(aliases)
2359
if driver is not None:
2360
naked_distro.driver = driver
2346
removeSecurityProxy(distro).setAliases(aliases)
2361
2347
if bug_supervisor is not None:
2348
naked_distro = removeSecurityProxy(distro)
2362
2349
naked_distro.bug_supervisor = bug_supervisor
2363
if security_contact is not None:
2364
naked_distro.security_contact = security_contact
2365
2350
if not no_pubconf:
2366
2351
self.makePublisherConfig(
2367
2352
distro, publish_root_dir, publish_base_url,
2368
2353
publish_copy_base_url)
2371
def makeDistroSeries(self, distribution=None, version=None,
2372
status=SeriesStatus.DEVELOPMENT,
2373
previous_series=None, name=None, displayname=None,
2375
"""Make a new `DistroSeries`."""
2356
def makeDistroRelease(self, distribution=None, version=None,
2357
status=SeriesStatus.DEVELOPMENT,
2358
previous_series=None, name=None, displayname=None,
2360
"""Make a new distro release."""
2376
2361
if distribution is None:
2377
2362
distribution = self.makeDistribution()
2378
2363
if name is None:
2399
2384
return ProxyFactory(series)
2401
def makeUbuntuDistroSeries(self, version=None,
2402
status=SeriesStatus.DEVELOPMENT,
2403
previous_series=None, name=None,
2386
def makeUbuntuDistroRelease(self, version=None,
2387
status=SeriesStatus.DEVELOPMENT,
2388
previous_series=None, name=None,
2405
2390
"""Short cut to use the celebrity 'ubuntu' as the distribution."""
2406
2391
ubuntu = getUtility(ILaunchpadCelebrities).ubuntu
2407
return self.makeDistroSeries(
2392
return self.makeDistroRelease(
2408
2393
ubuntu, version, status, previous_series, name, displayname)
2395
# Most people think of distro releases as distro series.
2396
makeDistroSeries = makeDistroRelease
2397
makeUbuntuDistroSeries = makeUbuntuDistroRelease
2410
2399
def makeDistroSeriesDifference(
2411
2400
self, derived_series=None, source_package_name_str=None,
2518
2507
"""Create a new distroarchseries"""
2520
2509
if distroseries is None:
2521
distroseries = self.makeDistroSeries()
2510
distroseries = self.makeDistroRelease()
2522
2511
if processorfamily is None:
2523
2512
processorfamily = self.makeProcessorFamily()
2524
2513
if owner is None:
2785
2774
:param epoch_days: the time window to use when creating records.
2788
distroseries = self.makeDistroSeries()
2777
distroseries = self.makeDistroRelease()
2789
2778
sourcepackagename = self.makeSourcePackageName()
2790
2779
sourcepackage = self.makeSourcePackage(
2791
2780
sourcepackagename=sourcepackagename,
3372
3361
return self.makeSourcePackageName()
3373
3362
return getUtility(ISourcePackageNameSet).getOrCreateByName(name)
3375
def makeSourcePackage(self, sourcepackagename=None, distroseries=None,
3377
"""Make an `ISourcePackage`.
3379
:param publish: if true, create a corresponding
3380
SourcePackagePublishingHistory.
3364
def makeSourcePackage(self, sourcepackagename=None, distroseries=None):
3365
"""Make an `ISourcePackage`."""
3382
3366
# Make sure we have a real sourcepackagename object.
3383
3367
if (sourcepackagename is None or
3384
3368
isinstance(sourcepackagename, basestring)):
3385
3369
sourcepackagename = self.getOrMakeSourcePackageName(
3386
3370
sourcepackagename)
3387
3371
if distroseries is None:
3388
distroseries = self.makeDistroSeries()
3390
self.makeSourcePackagePublishingHistory(
3391
distroseries=distroseries,
3392
sourcepackagename=sourcepackagename)
3372
distroseries = self.makeDistroRelease()
3393
3373
return distroseries.getSourcePackage(sourcepackagename)
3395
3375
def getAnySourcePackageUrgency(self):
3699
3679
distribution = None
3701
3681
distribution = archive.distribution
3702
distroseries = self.makeDistroSeries(
3682
distroseries = self.makeDistroRelease(
3703
3683
distribution=distribution)
3704
3684
if archive is None:
3705
3685
archive = distroseries.main_archive
3905
3885
def makeSuiteSourcePackage(self, distroseries=None,
3906
3886
sourcepackagename=None, pocket=None):
3907
3887
if distroseries is None:
3908
distroseries = self.makeDistroSeries()
3888
distroseries = self.makeDistroRelease()
3909
3889
if pocket is None:
3910
3890
pocket = self.getAnyPocket()
3911
3891
# Make sure we have a real sourcepackagename object.