def test_04_generate_spec(self): b = RpmBuilder(srcdir=self.srcdir, topdir=self.topdir) infile = "{srcdir}/src/packaging/RedHat/openafs.spec.in".format( srcdir=self.srcdir) spec = b.generate_spec(infile) self.assertEquals( spec, "{topdir}/SPECS/openafs.spec".format(topdir=self.topdir)) self.assertExists( "{topdir}/SPECS/openafs.spec".format(topdir=self.topdir))
def test_12_prepare_sources_csdb(self): csdb = "/tmp/CellServDB" writefile(csdb, "example") try: b = RpmBuilder(srcdir=self.srcdir, topdir=self.topdir, csdb=csdb) b.prepare_sources_csdb() self.assertExists( "{topdir}/SOURCES/CellServDB".format(topdir=self.topdir)) finally: os.remove(csdb)
def test_05_copy_spec(self): spec = "/tmp/openafs.spec" writefile(spec, "example") try: b = RpmBuilder(srcdir=self.srcdir, topdir=self.topdir) b.copy_spec(spec) self.assertExists( "{topdir}/SPECS/openafs.spec".format(topdir=self.topdir)) finally: os.remove(spec)
def test_03_get_version__from_dot_version(self): dot_version = os.path.join(self.srcdir, ".version") writefile(dot_version, "1.2.3") try: b = RpmBuilder(srcdir=self.srcdir, topdir=self.topdir) version = b.get_version() self.assertIsNotNone(version) self.assertEquals(version, "1.2.3") finally: os.remove(dot_version)
def test_11_copy_csdb(self): csdb = "/tmp/CellServDB" writefile(csdb, "example") try: b = RpmBuilder(srcdir=self.srcdir, topdir=self.topdir) b.copy_csdb(csdb) self.assertExists( "{topdir}/SOURCES/CellServDB".format(topdir=self.topdir)) finally: os.remove(csdb)
def test_07_prepare_spec__external_spec(self): spec = "/tmp/openafs.spec" writefile(spec, "example") try: b = RpmBuilder(srcdir=self.srcdir, topdir=self.topdir, spec=spec) b.prepare_spec() self.assertExists( "{topdir}/SPECS/openafs.spec".format(topdir=self.topdir)) contents = readfile( "{topdir}/SPECS/openafs.spec".format(topdir=self.topdir)) self.assertEquals(contents, "example") finally: os.remove(spec)
def test_01_get_package_version(self): testcases = [ ('1.6.0', '1.6.0', '1'), ('1.6.0pre1', '1.6.0', '0.pre1'), ('1.8.0dev', '1.8.0', '0.dev'), ('1.6.20-32-gabcdef', '1.6.20', '32.gabcdef'), ('1.6.18.3-foo3', '1.6.18.3', '1.2.3.foo'), ] b = RpmBuilder() for tc in testcases: (v, r) = b.get_package_version(version=tc[0]) self.assertEquals(v, tc[1]) self.assertEquals(r, tc[2])
def test_19_build_userspace(self): b = RpmBuilder(srcdir=self.srcdir, topdir=self.topdir, quiet=True) b.build_userspace() self.assertGlobExists("{topdir}/RPMS/*".format(topdir=self.topdir))
def test_20_build_kmods(self): b = RpmBuilder(srcdir=self.srcdir, topdir=self.topdir, quiet=True) b.build_kmods() self.assertGlobExists("{topdir}/RPMS/*".format(topdir=self.topdir))
def test_17_prepare_sources(self): b = RpmBuilder(srcdir=self.srcdir, topdir=self.topdir, quiet=True) b.prepare_sources() self.assertGlobExists("{topdir}/SOURCES/*".format(topdir=self.topdir))
def test_18_build_srpm(self): b = RpmBuilder(srcdir=self.srcdir, topdir=self.topdir, quiet=True) b.build_srpm() self.assertGlobExists("{topdir}/SRPMS/*".format(topdir=self.topdir))
def test_15_prepare_sources_scripts(self): b = RpmBuilder(srcdir=self.srcdir, topdir=self.topdir) b.prepare_sources_scripts() self.assertGlobExists("{topdir}/SOURCES/*".format(topdir=self.topdir))
def test_16_prepare_sources_tarballs(self): b = RpmBuilder(srcdir=self.srcdir, topdir=self.topdir) b.prepare_sources_tarballs() self.assertGlobExists( "{topdir}/SOURCES/*.tar.*".format(topdir=self.topdir))
def test_13_prepare_sources_relnotes(self): b = RpmBuilder(srcdir=self.srcdir, topdir=self.topdir) b.prepare_sources_relnotes() version = b.get_version() self.assertExists("{topdir}/SOURCES/RELNOTES-{version}".format( topdir=self.topdir, version=version))
def test_14_prepare_sources_changelog(self): b = RpmBuilder(srcdir=self.srcdir, topdir=self.topdir) b.prepare_sources_changelog() self.assertExists( "{topdir}/SOURCES/ChangeLog".format(topdir=self.topdir))
def test_06_prepare_spec(self): b = RpmBuilder(srcdir=self.srcdir, topdir=self.topdir) b.prepare_spec() self.assertExists( "{topdir}/SPECS/openafs.spec".format(topdir=self.topdir))
def test_02_get_version(self): b = RpmBuilder(srcdir=self.srcdir, topdir=self.topdir) version = b.get_version() self.assertIsNotNone(version) self.assertRegexpMatches(version, r'^[1-9]\.[0-9]+\.[0-9]+.*')
def test_10_download_csdb(self): url = "https://www.central.org/dl/cellservdb/CellServDB.2016-01-01" b = RpmBuilder(srcdir=self.srcdir, topdir=self.topdir) b.download_csdb(url) self.assertExists("{topdir}/SOURCES/CellServDB.2016-01-01".format( topdir=self.topdir))
def test_09_lookup_source(self): b = RpmBuilder(srcdir=self.srcdir, topdir=self.topdir) s = b.lookup_source('CellServDB') self.assertIsNotNone(s)
def test_08_list_sources(self): b = RpmBuilder(srcdir=self.srcdir, topdir=self.topdir) s = b.list_sources() self.assertIsNotNone(s)