def testExtractFilesFromCpio(self): rpmName = "popt-1.5-4x.i386.rpm" fileobj = file(os.path.join(self.archiveDir, rpmName)) payload = rpmhelper.UncompressedRpmPayload(fileobj) fileList = ["./usr/include/popt.h", "usr/lib/libpopt.so.0", "/usr/lib/libpopt.so.0.0.0"] ret = rpmhelper.extractFilesFromCpio(payload, fileList) self.assertEqual([self._fileSize(x) for x in ret], [5396, None, 20971])
def testExtractFilesFromCpio(self): rpmName = 'popt-1.5-4x.i386.rpm' fileobj = file(os.path.join(self.archiveDir, rpmName)) payload = rpmhelper.UncompressedRpmPayload(fileobj) fileList = [ './usr/include/popt.h', 'usr/lib/libpopt.so.0', '/usr/lib/libpopt.so.0.0.0' ] ret = rpmhelper.extractFilesFromCpio(payload, fileList) self.assertEqual([self._fileSize(x) for x in ret], [5396, None, 20971])
def testExtractFilesFromCpioHardlinks(self): payload = gzip.GzipFile( os.path.join(self.archiveDir, 'hardlinks.cpio.gz')) fileList = [ '/b/regular-linked-b', 'b/regular-linked-c', './b/empty', 'a', './a/regular', 'nosuchfile', ] ret = rpmhelper.extractFilesFromCpio(payload, fileList) self.assertEqual([self._fileSize(x) for x in ret], [2, 2, 0, None, 2, None]) self.assertEqual([self._fileContents(x) for x in ret], ['2\n', '2\n', '', None, '1\n', None])
def testExtractFilesFromCpioHardlinks(self): payload = gzip.GzipFile(os.path.join(self.archiveDir, "hardlinks.cpio.gz")) fileList = ["/b/regular-linked-b", "b/regular-linked-c", "./b/empty", "a", "./a/regular", "nosuchfile"] ret = rpmhelper.extractFilesFromCpio(payload, fileList) self.assertEqual([self._fileSize(x) for x in ret], [2, 2, 0, None, 2, None]) self.assertEqual([self._fileContents(x) for x in ret], ["2\n", "2\n", "", None, "1\n", None])