Gina over Multiple Architectures (and Pockets, and Components) -------------------------------------------------------------- Get the current counts of stuff in the database: >>> from lp.services.identity.model.emailaddress import EmailAddress >>> from lp.registry.model.person import Person, WikiName >>> from lp.registry.model.teammembership import TeamParticipation >>> from lp.soyuz.model.binarypackagebuild import BinaryPackageBuild >>> from lp.soyuz.model.binarypackagerelease import BinaryPackageRelease >>> from lp.soyuz.model.publishing import ( ... BinaryPackagePublishingHistory, ... SourcePackagePublishingHistory, ... ) >>> from lp.soyuz.model.sourcepackagerelease import SourcePackageRelease >>> SSPPH = SourcePackagePublishingHistory >>> SBPPH = BinaryPackagePublishingHistory >>> orig_spr_count = SourcePackageRelease.select().count() >>> orig_sspph_count = SSPPH.select().count() >>> orig_person_count = Person.select().count() >>> orig_tp_count = TeamParticipation.select().count() >>> orig_email_count = EmailAddress.select().count() >>> orig_wiki_count = WikiName.select().count() >>> orig_bpr_count = BinaryPackageRelease.select().count() >>> orig_build_count = BinaryPackageBuild.select().count() >>> orig_sbpph_count = SBPPH.select().count() Create a distribution series and an arch series for dapper: >>> from lp.soyuz.model.distroarchseries import DistroArchSeries >>> from lp.soyuz.model.processor import ProcessorFamily >>> from lp.app.interfaces.launchpad import ILaunchpadCelebrities >>> celebs = getUtility(ILaunchpadCelebrities) >>> ubuntu = celebs.ubuntu >>> hoary = ubuntu.getSeries("hoary") # Only the distro owner or admins can create a series. >>> login_person(ubuntu.owner.activemembers[0]) >>> dapper = ubuntu.newSeries("dapper", "Dapper Dragoon", "My title", ... "My summary", "My description", "5.10", ... hoary, celebs.launchpad_developers) >>> login(ANONYMOUS) Check it was properly created and create its DistroArchSeriess. >>> from lp.registry.model.distroseries import DistroSeries >>> dapper = DistroSeries.selectOneBy(name="dapper", ... distributionID=ubuntu.id) >>> pf = ProcessorFamily.selectOneBy(name="x86") >>> if pf is None: ... pf = ProcessorFamily(name="x86", title="X86", ... description="Intel X86") >>> dar = DistroArchSeries(distroseries=dapper, processorfamily=pf, ... architecturetag="i386", official=True, ... owner=celebs.launchpad_developers) >>> pf = ProcessorFamily.selectOneBy(name="amd64") >>> if pf is None: ... pf = ProcessorFamily(name="amd64", title="AMD64", ... description="AMD 64") >>> dar = DistroArchSeries(distroseries=dapper, processorfamily=pf, ... architecturetag="amd64", official=True, ... owner=celebs.launchpad_developers) >>> pf = ProcessorFamily.selectOneBy(name="powerpc") >>> if pf is None: ... pf = ProcessorFamily(name="powerpc", title="PowerPC", ... description="PowerPC") >>> dar = DistroArchSeries(distroseries=dapper, processorfamily=pf, ... architecturetag="powerpc", official=True, ... owner=celebs.launchpad_developers) >>> import transaction >>> transaction.commit() Let's set up the filesystem: >>> import subprocess, sys, os >>> try: ... os.unlink("/var/lock/launchpad-gina.lock") ... except OSError: ... pass >>> try: ... os.remove('/tmp/gina_test_archive') ... except OSError: ... pass >>> relative_path = ('lib/lp/soyuz/scripts/tests/gina_test_archive') >>> path = os.path.join(os.getcwd(), relative_path) >>> os.symlink(path, '/tmp/gina_test_archive') Run gina without a powerpc processor for the powerpc family: >>> gina_proc = [sys.executable, 'scripts/gina.py', '-q', ... 'dapper', 'dapper-updates'] >>> proc = subprocess.Popen(gina_proc, stderr=subprocess.PIPE) >>> print proc.stderr.read() WARNING ... ERROR Database setup required for run on powerpc -> http://... (Unable to find a processor...dapper/powerpc) >>> proc.wait() 1 Set up the processor, commit and run her again. Note that dapper-updates/universe doesn't include the powerpc architecture, but we just warn it and move right ahead. >>> from lp.soyuz.model.processor import Processor >>> p = Processor(name="powerpc", title="PowerPC", family=pf, ... description="The little processor that could") >>> p == Processor.selectOneBy(familyID=pf.id) True >>> transaction.commit() >>> gina_proc = [sys.executable, 'scripts/gina.py', '-q', ... 'dapper', 'dapper-updates'] >>> proc = subprocess.Popen(gina_proc, stderr=subprocess.PIPE) >>> print proc.stderr.read() WARNING ... WARNING No source package bdftopcf (0.99.0-1) listed for bdftopcf (0.99.0-1), scrubbing archive... WARNING The archive for dapper-updates/universe doesn't contain a directory for powerpc, skipping >>> proc.wait() 0 Make the changes visible elsewhere: >>> transaction.commit() Check the quantities that were returned. We have: * bdftopdf, a binary package that comes from a source package that isn't listed in the Sources file (but which we find). * ekg, a source package that generates 3 binary packages. We have two source packages, and we're only really publishing into breezy: >>> SourcePackageRelease.select().count() - orig_spr_count 2 >>> print SSPPH.select().count() - orig_sspph_count 2 Each source package has its own maintainer (in this case, fabbione and porridge): >>> print Person.select().count() - orig_person_count 2 >>> print TeamParticipation.select().count() - orig_tp_count 2 >>> print EmailAddress.select().count() - orig_email_count 2 There are 4 binary packages generated by the two builds of the two source packages. We should only be publishing them into one distroarchseries: >>> BinaryPackageRelease.select().count() - orig_bpr_count 4 >>> BinaryPackageBuild.select().count() - orig_build_count 2 >>> SBPPH.select().count() - orig_sbpph_count 4 Check that the source package was correctly imported: >>> from lp.soyuz.model.binarypackagename import BinaryPackageName >>> from lp.registry.model.sourcepackagename import SourcePackageName >>> n = SourcePackageName.selectOneBy(name="ekg") >>> ekg = SourcePackageRelease.selectOneBy(sourcepackagenameID=n.id, ... version="1:1.5-4ubuntu1.2") >>> print ekg.section.name net >>> print ekg.component.name main And that one of the packages in main is here too: >>> n = BinaryPackageName.selectOneBy(name="libgadu-dev") >>> ekg = BinaryPackageRelease.selectOneBy(binarypackagenameID=n.id, ... version="1:1.5-4ubuntu1.2") >>> print ekg.section.name libdevel >>> print ekg.component.name main >>> print ekg.architecturespecific True >>> print ekg.build.processor.name 386 Check that the package it generates in universe was successfully processed. In particular, its section should be stripped of the component name. >>> from lp.soyuz.enums import PackagePublishingPriority >>> n = BinaryPackageName.selectOneBy(name="ekg") >>> ekg = BinaryPackageRelease.selectOneBy(binarypackagenameID=n.id, ... version="1:1.5-4ubuntu1.2") >>> print ekg.section.name net >>> print ekg.component.name universe >>> print ekg.priority == PackagePublishingPriority.OPTIONAL True The bdftopcf package is in a bit of a fix. Its binary package is present in universe, but no source package is listed for it, and the actual package files are in main! Gina to the rescue: she finds them in the right place, updates the component, and creates it with a semi-bogus DSC. >>> n = BinaryPackageName.selectOneBy(name="bdftopcf") >>> ekg = BinaryPackageRelease.selectOneBy(binarypackagenameID=n.id, ... version="0.99.0-1") >>> print ekg.section.name x11 >>> print ekg.component.name universe >>> print ekg.build.source_package_release.sourcepackagename.name bdftopcf >>> print ekg.build.source_package_release.component.name main >>> print ekg.build.source_package_release.version 0.99.0-1 Check that we publishing bdftopcf into the correct distroarchseries: >>> pf = ProcessorFamily.selectOneBy(name="x86") >>> dar = DistroArchSeries.selectOneBy(distroseriesID=dapper.id, ... processorfamilyID=pf.id, architecturetag="i386", ... official=True, ownerID=celebs.launchpad_developers.id) >>> print dar.architecturetag i386 >>> for entry in SBPPH.selectBy(distroarchseriesID=dar.id, ... orderBy="binarypackagerelease"): ... package = entry.binarypackagerelease ... print package.binarypackagename.name, package.version bdftopcf 0.99.0-1 ekg 1:1.5-4ubuntu1.2 libgadu-dev 1:1.5-4ubuntu1.2 libgadu3 1:1.5-4ubuntu1.2 Be proper and clean up after ourselves. >>> os.remove('/tmp/gina_test_archive')