本文整理汇总了Python中iso_distributor.distributor.ISODistributor._export_errata方法的典型用法代码示例。如果您正苦于以下问题:Python ISODistributor._export_errata方法的具体用法?Python ISODistributor._export_errata怎么用?Python ISODistributor._export_errata使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类iso_distributor.distributor.ISODistributor
的用法示例。
在下文中一共展示了ISODistributor._export_errata方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_errata_export
# 需要导入模块: from iso_distributor.distributor import ISODistributor [as 别名]
# 或者: from iso_distributor.distributor.ISODistributor import _export_errata [as 别名]
def test_errata_export(self):
feed_url = "file://%s/test_errata_local_sync/" % self.data_dir
repo = mock.Mock(spec=Repository)
repo.working_dir = self.repo_working_dir
repo.id = "test_errata_local_sync"
repo.checksumtype = 'sha'
sync_conduit = importer_mocks.get_sync_conduit(type_id=TYPE_ID_RPM, existing_units=[], pkg_dir=self.pkg_dir)
config = importer_mocks.get_basic_config(feed_url=feed_url)
importerRPM = importer_rpm.ImporterRPM()
status, summary, details = importerRPM.sync(repo, sync_conduit, config)
metadata = {}
unit_key_a = {'id' : '','name' :'patb', 'version' :'0.1', 'release' : '2', 'epoch':'0', 'arch' : 'x86_64', 'checksumtype' : 'md5',
'checksum': 'f3c197a29d9b66c5b65c5d62b25db5b4'}
unit_key_b = {'id' : '', 'name' :'emoticons', 'version' :'0.1', 'release' :'2', 'epoch':'0','arch' : 'x86_64', 'checksumtype' :'md5',
'checksum' : '366bb5e73a5905eacb82c96e0578f92b'}
existing_units = []
for unit in [unit_key_a, unit_key_b]:
existing_units.append(Unit(TYPE_ID_RPM, unit, metadata, ''))
sync_conduit = importer_mocks.get_sync_conduit(type_id=TYPE_ID_RPM, existing_units=existing_units, pkg_dir=self.pkg_dir)
importerErrata = errata.ImporterErrata()
status, summary, details = importerErrata.sync(repo, sync_conduit, config)
unit_key = dict()
unit_key['id'] = "RHEA-2010:9999"
mdata = { 'description' : "test",
'from_str': '[email protected]',
'issued': '2010-03-30 08:07:30',
'pkglist': [{'name': 'RHEL Virtualization (v. 5 for 32-bit x86)',
'packages': [{'arch': 'x86_64',
'epoch': '0',
'filename': 'patb-0.1-2.x86_64.rpm',
'name': 'patb',
'release': '2',
'src': '',
'sum': ('md5',
'f3c197a29d9b66c5b65c5d62b25db5b4'),
'version': '0.1'},
{'arch': 'x86_64',
'epoch': '0',
'filename': 'emoticons-0.1-2.x86_64.rpm',
'name': 'emoticons',
'release': '2',
'src': '',
'sum': ('md5',
'366bb5e73a5905eacb82c96e0578f92b'),
'version': '0.1'}],
'short': 'rhel-i386-server-vt-5'}],
'pushcount': 1,
'reboot_suggested': False,
'references': [],
'release': '',
'rights': '',
'status': 'final',
'summary': '',
'title': 'emoticons enhancement fix and enhancement update',
'updated': '2010-03-30 08:07:30',
'version': '1',
'type' : 'enhancement',
'severity' : 'Low',
'solution' : ''}
errata_unit = [Unit(TYPE_ID_ERRATA, unit_key, mdata, '')]
symlink_dir = "%s/%s" % (self.repo_working_dir, repo.id)
iso_distributor = ISODistributor()
publish_conduit = distributor_mocks.get_publish_conduit(existing_units=existing_units, pkg_dir=self.pkg_dir)
config = distributor_mocks.get_basic_config(https_publish_dir=self.https_publish_dir, http=False, https=True)
print symlink_dir
rpm_units = iso_distributor._get_errata_rpms(errata_unit, existing_units)
print "RPMS in ERRATA",rpm_units
iso_distributor._export_rpms(rpm_units, self.repo_working_dir)
status, errors = iso_distributor._export_errata(errata_unit, symlink_dir)
self.assertTrue(os.path.exists("%s/%s" % (symlink_dir, "updateinfo.xml")))
self.assertTrue(status)
ftypes = util.get_repomd_filetypes("%s/%s" % (symlink_dir, "repodata/repomd.xml"))
print ftypes
self.assertTrue("updateinfo" in ftypes)
示例2: test_errata_export
# 需要导入模块: from iso_distributor.distributor import ISODistributor [as 别名]
# 或者: from iso_distributor.distributor.ISODistributor import _export_errata [as 别名]
def test_errata_export(self):
feed_url = "file://%s/test_errata_local_sync/" % self.data_dir
repo = mock.Mock(spec=Repository)
repo.working_dir = self.repo_working_dir
repo.id = "test_errata_local_sync"
repo.checksumtype = "sha"
sync_conduit = importer_mocks.get_sync_conduit(type_id=TYPE_ID_RPM, existing_units=[], pkg_dir=self.pkg_dir)
config = importer_mocks.get_basic_config(feed_url=feed_url)
importerRPM = importer_rpm.ImporterRPM()
status, summary, details = importerRPM.sync(repo, sync_conduit, config)
metadata = {}
unit_key_a = {
"id": "",
"name": "patb",
"version": "0.1",
"release": "2",
"epoch": "0",
"arch": "x86_64",
"checksumtype": "md5",
"checksum": "f3c197a29d9b66c5b65c5d62b25db5b4",
}
unit_key_b = {
"id": "",
"name": "emoticons",
"version": "0.1",
"release": "2",
"epoch": "0",
"arch": "x86_64",
"checksumtype": "md5",
"checksum": "366bb5e73a5905eacb82c96e0578f92b",
}
existing_units = []
for unit in [unit_key_a, unit_key_b]:
existing_units.append(Unit(TYPE_ID_RPM, unit, metadata, ""))
sync_conduit = importer_mocks.get_sync_conduit(
type_id=TYPE_ID_RPM, existing_units=existing_units, pkg_dir=self.pkg_dir
)
importerErrata = errata.ImporterErrata()
status, summary, details = importerErrata.sync(repo, sync_conduit, config)
unit_key = dict()
unit_key["id"] = "RHEA-2010:9999"
mdata = {
"description": "test",
"from_str": "[email protected]",
"issued": "2010-03-30 08:07:30",
"pkglist": [
{
"name": "RHEL Virtualization (v. 5 for 32-bit x86)",
"packages": [
{
"arch": "x86_64",
"epoch": "0",
"filename": "patb-0.1-2.x86_64.rpm",
"name": "patb",
"release": "2",
"src": "",
"sum": ("md5", "f3c197a29d9b66c5b65c5d62b25db5b4"),
"version": "0.1",
},
{
"arch": "x86_64",
"epoch": "0",
"filename": "emoticons-0.1-2.x86_64.rpm",
"name": "emoticons",
"release": "2",
"src": "",
"sum": ("md5", "366bb5e73a5905eacb82c96e0578f92b"),
"version": "0.1",
},
],
"short": "rhel-i386-server-vt-5",
}
],
"pushcount": 1,
"reboot_suggested": False,
"references": [],
"release": "",
"rights": "",
"status": "final",
"summary": "",
"title": "emoticons enhancement fix and enhancement update",
"updated": "2010-03-30 08:07:30",
"version": "1",
"type": "enhancement",
"severity": "Low",
"solution": "",
}
errata_unit = [Unit(TYPE_ID_ERRATA, unit_key, mdata, "")]
symlink_dir = "%s/%s" % (self.repo_working_dir, repo.id)
iso_distributor = ISODistributor()
publish_conduit = distributor_mocks.get_publish_conduit(existing_units=existing_units, pkg_dir=self.pkg_dir)
config = distributor_mocks.get_basic_config(https_publish_dir=self.https_publish_dir, http=False, https=True)
print symlink_dir
rpm_units = iso_distributor._get_errata_rpms(errata_unit, existing_units)
print "RPMS in ERRATA", rpm_units
iso_distributor._export_rpms(rpm_units, self.repo_working_dir)
status, errors = iso_distributor._export_errata(errata_unit, symlink_dir)
self.assertTrue(os.path.exists("%s/%s" % (symlink_dir, "updateinfo.xml")))
self.assertTrue(status)
#.........这里部分代码省略.........