def test_build_depends_profiles(self): """Test that https://wiki.debian.org/BuildProfileSpec restrictions are parseable. """ self.addSource("precise", "main", "hello", "1.0-1", ["hello"], fields={"Build-Depends": "gettext <!stage1> <!cross>, " "base-files <stage1>, " "gettext (<< 0.7) | debhelper (>= 9)"}) self.addPackage("precise", "main", "i386", "hello", "1.0-1") self.addSource("precise", "main", "gettext", "0.8.1.1-5ubuntu3", ["gettext"]) self.addPackage("precise", "main", "i386", "gettext", "0.8.1.1-5ubuntu3") self.addSource("precise", "main", "base-files", "6.5ubuntu6", ["base-files"]) self.addPackage("precise", "main", "i386", "base-files", "6.5ubuntu6") self.addSource("precise", "main", "debhelper", "9.20120115ubuntu3", ["debhelper"]) self.addPackage("precise", "main", "i386", "debhelper", "9.20120115ubuntu3") branch = "collection.precise" self.addSeed(branch, "base") self.addSeedPackage(branch, "base", "hello") germinator = Germinator("i386") archive = TagFile( "precise", "main", "i386", "file://%s" % self.archive_dir) germinator.parse_archive(archive) structure = self.openSeedStructure(branch) germinator.plant_seeds(structure) germinator.grow(structure) self.assertEqual( set(["gettext", "debhelper"]), germinator.get_build_depends(structure, "base"))
def test_build_depends_multiarch(self): """Compare Build-Depends behaviour against the multiarch specification. https://wiki.ubuntu.com/MultiarchCross#Build_Dependencies """ for ma, qual, allowed in ( (None, "", True), (None, ":any", False), (None, ":native", True), ("same", "", True), ("same", ":any", False), ("same", ":native", True), ("foreign", "", True), ("foreign", ":any", False), ("foreign", ":native", False), ("allowed", "", True), ("allowed", ":any", True), ("allowed", ":native", True), ): self.addSource("precise", "main", "hello", "1.0-1", ["hello"], fields={"Build-Depends": "gettext%s" % qual}) self.addPackage("precise", "main", "i386", "hello", "1.0-1") self.addSource("precise", "main", "gettext", "0.18.1.1-5ubuntu3", ["gettext"]) package_fields = {} if ma is not None: package_fields["Multi-Arch"] = ma self.addPackage("precise", "main", "i386", "gettext", "0.18.1.1-5ubuntu3", fields=package_fields) branch = "collection.precise" self.addSeed(branch, "base") self.addSeedPackage(branch, "base", "hello") germinator = Germinator("i386") archive = TagFile("precise", "main", "i386", "file://%s" % self.archive_dir) germinator.parse_archive(archive) structure = self.openSeedStructure(branch) germinator.plant_seeds(structure) germinator.grow(structure) expected = set() if allowed: expected.add("gettext") self.assertEqual( expected, germinator.get_build_depends(structure, "base"), "Build-Depends: gettext%s on Multi-Arch: %s incorrectly %s" % (qual, ma if ma else "none", "disallowed" if allowed else "allowed")) shutil.rmtree(self.archive_dir) shutil.rmtree(self.seeds_dir)
def set_seeds(self, options, seeds): self.seeds = seeds # Suppress most log information germinate_logging(logging.CRITICAL) logging.getLogger('germinate.archive').setLevel(logging.INFO) global MIRRORS, COMPONENTS print("Germinating") g = Germinator(options.arch) archive = germinate.archive.TagFile(options.dist, COMPONENTS, options.arch, MIRRORS, cleanup=True) g.parse_archive(archive) needed_seeds = [] build_tree = False try: structure = SeedStructure(options.release, options.seeds) for seedname in self.seeds: if seedname == ('%s+build-depends' % structure.supported): seedname = structure.supported build_tree = True needed_seeds.append(seedname) g.plant_seeds(structure, seeds=needed_seeds) except SeedError: sys.exit(1) g.grow(structure) for seedname in structure.names: for pkg in g.get_seed_entries(structure, seedname): self.package.setdefault(pkg, Package(pkg)) self.package[pkg].set_seed(seedname + ".seed") for pkg in g.get_seed_recommends_entries(structure, seedname): self.package.setdefault(pkg, Package(pkg)) self.package[pkg].set_seed(seedname + ".seed-recommends") for pkg in g.get_depends(structure, seedname): self.package.setdefault(pkg, Package(pkg)) self.package[pkg].set_seed(seedname + ".depends") if build_tree: build_depends = set(g.get_build_depends(structure, seedname)) for inner in structure.inner_seeds(structure.supported): build_depends -= set(g.get_seed_entries(structure, inner)) build_depends -= set( g.get_seed_recommends_entries(structure, inner)) build_depends -= g.get_depends(structure, inner) for pkg in build_depends: self.package.setdefault(pkg, Package(pkg)) self.package[pkg].set_seed(structure.supported + ".build-depends")
def set_seeds(self, options, seeds): self.seeds = seeds # Suppress most log information germinate_logging(logging.CRITICAL) logging.getLogger('germinate.archive').setLevel(logging.INFO) global MIRRORS, COMPONENTS print("Germinating") g = Germinator(options.arch) archive = germinate.archive.TagFile( options.dist, COMPONENTS, options.arch, MIRRORS, cleanup=True) g.parse_archive(archive) needed_seeds = [] build_tree = False try: structure = SeedStructure(options.release, options.seeds) for seedname in self.seeds: if seedname == ('%s+build-depends' % structure.supported): seedname = structure.supported build_tree = True needed_seeds.append(seedname) g.plant_seeds(structure, seeds=needed_seeds) except SeedError: sys.exit(1) g.grow(structure) for seedname in structure.names: for pkg in g.get_seed_entries(structure, seedname): self.package.setdefault(pkg, Package(pkg)) self.package[pkg].set_seed(seedname + ".seed") for pkg in g.get_seed_recommends_entries(structure, seedname): self.package.setdefault(pkg, Package(pkg)) self.package[pkg].set_seed(seedname + ".seed-recommends") for pkg in g.get_depends(structure, seedname): self.package.setdefault(pkg, Package(pkg)) self.package[pkg].set_seed(seedname + ".depends") if build_tree: build_depends = set(g.get_build_depends(structure, seedname)) for inner in structure.inner_seeds(structure.supported): build_depends -= set(g.get_seed_entries(structure, inner)) build_depends -= set(g.get_seed_recommends_entries( structure, inner)) build_depends -= g.get_depends(structure, inner) for pkg in build_depends: self.package.setdefault(pkg, Package(pkg)) self.package[pkg].set_seed(structure.supported + ".build-depends")
def test_build_depends_multiarch(self): """Compare Build-Depends behaviour against the multiarch specification. https://wiki.ubuntu.com/MultiarchCross#Build_Dependencies """ for ma, qual, allowed in ( (None, "", True), (None, ":any", False), (None, ":native", True), ("same", "", True), ("same", ":any", False), ("same", ":native", True), ("foreign", "", True), ("foreign", ":any", False), ("foreign", ":native", False), ("allowed", "", True), ("allowed", ":any", True), ("allowed", ":native", True), ): self.addSource("precise", "main", "hello", "1.0-1", ["hello"], fields={"Build-Depends": "gettext%s" % qual}) self.addPackage("precise", "main", "i386", "hello", "1.0-1") self.addSource("precise", "main", "gettext", "0.18.1.1-5ubuntu3", ["gettext"]) package_fields = {} if ma is not None: package_fields["Multi-Arch"] = ma self.addPackage("precise", "main", "i386", "gettext", "0.18.1.1-5ubuntu3", fields=package_fields) branch = "collection.precise" self.addSeed(branch, "base") self.addSeedPackage(branch, "base", "hello") germinator = Germinator("i386") archive = TagFile( "precise", "main", "i386", "file://%s" % self.archive_dir) germinator.parse_archive(archive) structure = self.openSeedStructure(branch) germinator.plant_seeds(structure) germinator.grow(structure) expected = set() if allowed: expected.add("gettext") self.assertEqual( expected, germinator.get_build_depends(structure, "base"), "Build-Depends: gettext%s on Multi-Arch: %s incorrectly %s" % ( qual, ma if ma else "none", "disallowed" if allowed else "allowed")) shutil.rmtree(self.archive_dir) shutil.rmtree(self.seeds_dir)
def test_build_depends_profiles(self): """Test that https://wiki.debian.org/BuildProfileSpec restrictions are parseable. """ self.addSource("precise", "main", "hello", "1.0-1", ["hello"], fields={ "Build-Depends": "gettext <!stage1> <!cross>, " "base-files <stage1>, " "gettext (<< 0.7) | debhelper (>= 9)" }) self.addPackage("precise", "main", "i386", "hello", "1.0-1") self.addSource("precise", "main", "gettext", "0.8.1.1-5ubuntu3", ["gettext"]) self.addPackage("precise", "main", "i386", "gettext", "0.8.1.1-5ubuntu3") self.addSource("precise", "main", "base-files", "6.5ubuntu6", ["base-files"]) self.addPackage("precise", "main", "i386", "base-files", "6.5ubuntu6") self.addSource("precise", "main", "debhelper", "9.20120115ubuntu3", ["debhelper"]) self.addPackage("precise", "main", "i386", "debhelper", "9.20120115ubuntu3") branch = "collection.precise" self.addSeed(branch, "base") self.addSeedPackage(branch, "base", "hello") germinator = Germinator("i386") archive = TagFile("precise", "main", "i386", "file://%s" % self.archive_dir) germinator.parse_archive(archive) structure = self.openSeedStructure(branch) germinator.plant_seeds(structure) germinator.grow(structure) self.assertEqual(set(["gettext", "debhelper"]), germinator.get_build_depends(structure, "base"))