849 lines
28 KiB
Diff
849 lines
28 KiB
Diff
diff --git a/packageship/application/initialize/binary.json b/packageship/application/initialize/binary.json
|
|
index ebaa681a890a370745fc8a1282b8519fa1d3c734..a3abb5afd41085a83839ef3b2231f7efc4f9658f 100644
|
|
--- a/packageship/application/initialize/binary.json
|
|
+++ b/packageship/application/initialize/binary.json
|
|
@@ -135,18 +135,6 @@
|
|
"ignore_above": 256,
|
|
"index": false
|
|
},
|
|
- "relation": {
|
|
- "properties": {
|
|
- "bin_name": {
|
|
- "type": "keyword",
|
|
- "ignore_above": 256
|
|
- },
|
|
- "src_name": {
|
|
- "type": "keyword",
|
|
- "ignore_above": 256
|
|
- }
|
|
- }
|
|
- },
|
|
"release": {
|
|
"type": "keyword",
|
|
"ignore_above": 256
|
|
diff --git a/packageship/application/initialize/integration.py b/packageship/application/initialize/integration.py
|
|
index f7cd38f6258c3a0f0e05a2d2fea8317e269e2833..788b2f79edcab39a08e4d1094c48027db145c986 100644
|
|
--- a/packageship/application/initialize/integration.py
|
|
+++ b/packageship/application/initialize/integration.py
|
|
@@ -201,20 +201,21 @@ class InitializeService:
|
|
|
|
"""
|
|
sources = []
|
|
- for src_pack_name, src_pack in self._src_pack.items():
|
|
+ for _, src_pack in self._src_pack.items():
|
|
es_json = ESJson()
|
|
es_json.update(src_pack)
|
|
es_json["requires"] = self._build_requires(
|
|
src_pack['pkgKey'])
|
|
try:
|
|
- for bin_pack in self._bin_pack['sources'].pop(src_pack_name):
|
|
+ location_href = src_pack["location_href"].split('/')[-1]
|
|
+ for bin_pack in self._bin_pack['sources'].get(location_href):
|
|
_subpacks = dict(
|
|
name=bin_pack["name"], version=bin_pack["version"])
|
|
try:
|
|
es_json["subpacks"].append(_subpacks)
|
|
except TypeError:
|
|
es_json["subpacks"] = [_subpacks]
|
|
- except KeyError:
|
|
+ except TypeError:
|
|
es_json["subpacks"] = None
|
|
sources.append(self._es_json("-source", es_json))
|
|
helpers.bulk(self._session.client, sources)
|
|
@@ -227,6 +228,10 @@ class InitializeService:
|
|
binarys = []
|
|
be_depends = []
|
|
for _, bin_pack in self._bin_pack["packages"].items():
|
|
+ bin_pack["src_name"] = self._src_location[bin_pack["src_name"]]["name"]
|
|
+ if isinstance(bin_pack["src_name"], ESJson):
|
|
+ bin_pack["src_name"] = None
|
|
+
|
|
be_depends.append(self._be_depend(bin_pack))
|
|
es_json = ESJson()
|
|
es_json.update(bin_pack)
|
|
@@ -275,7 +280,9 @@ class InitializeService:
|
|
try:
|
|
for require in self._bin_requires.get(provide["name"]):
|
|
_bin_pack = self._bin_pack["pkg_key"][require["pkgKey"]]
|
|
- _src_pack = self._src_pack[_bin_pack["src_name"]]
|
|
+ _src_pack = self._src_location[_bin_pack["src_name"]]
|
|
+ if not _src_pack:
|
|
+ _src_pack = self._src_pack[_bin_pack["src_name"]]
|
|
component_json["install_require"].append({
|
|
"req_bin_name": _bin_pack["name"],
|
|
"req_bin_version": _bin_pack["version"],
|
|
@@ -373,7 +380,7 @@ class InitializeService:
|
|
return {
|
|
"_index": str(self._repo["dbname"] + index).lower(),
|
|
"_type": _type,
|
|
- "_source": source
|
|
+ "_source": dict(source)
|
|
}
|
|
|
|
def _relation(self, key):
|
|
@@ -407,7 +414,6 @@ class InitializeService:
|
|
except (KeyError, TypeError):
|
|
return build_requires
|
|
for src_require in requires:
|
|
- src_require["relation"] = self._relation(src_require['name'])
|
|
src_require["requires_type"] = "build"
|
|
build_requires.append(src_require)
|
|
return build_requires
|
|
@@ -422,7 +428,6 @@ class InitializeService:
|
|
install_requires = list()
|
|
try:
|
|
for bin_require in self._bin_requires.get(bin_pack['pkgKey']):
|
|
- bin_require["relation"] = self._relation(bin_require['name'])
|
|
bin_require["requires_type"] = "install"
|
|
install_requires.append(bin_require)
|
|
|
|
@@ -465,6 +470,14 @@ class InitializeService:
|
|
self._data.src_pkgkeys[src_pack["pkgKey"]] = src_pack
|
|
return self._data.src_pkgkeys
|
|
|
|
+ @property
|
|
+ def _src_location(self):
|
|
+ if not self._data.src_location:
|
|
+ for _, package in self._src_pack.items():
|
|
+ key = package["location_href"].split('/')[-1]
|
|
+ self._data["src_location"][key] = package
|
|
+ return self._data.src_location
|
|
+
|
|
@property
|
|
def _src_requires(self):
|
|
"""
|
|
@@ -549,22 +562,16 @@ class InitializeService:
|
|
"""
|
|
|
|
def combination_binary(row_data):
|
|
- try:
|
|
- src_package_name = None
|
|
- _pkgs = row_data.get('rpm_sourcerpm').split(
|
|
- '-' + row_data.get('version'))
|
|
- if len(_pkgs) != 1:
|
|
- src_package_name = ''.join(_pkgs[0:-1])
|
|
- except AttributeError:
|
|
- src_package_name = None
|
|
- row_data["src_name"] = src_package_name
|
|
+
|
|
+ rpm_sourcerpm = row_data.get('rpm_sourcerpm')
|
|
+ row_data["src_name"] = rpm_sourcerpm
|
|
self._data[table]['packages'][row_data[key]] = row_data
|
|
self._data[table]["pkg_key"][row_data["pkgKey"]] = row_data
|
|
- if src_package_name:
|
|
- if isinstance(self._data[table]["sources"][src_package_name], ESJson):
|
|
- self._data[table]["sources"][src_package_name] = [row_data]
|
|
+ if rpm_sourcerpm:
|
|
+ if isinstance(self._data[table]["sources"][rpm_sourcerpm], ESJson):
|
|
+ self._data[table]["sources"][rpm_sourcerpm] = [row_data]
|
|
else:
|
|
- self._data[table]["sources"][src_package_name].append(
|
|
+ self._data[table]["sources"][rpm_sourcerpm].append(
|
|
row_data)
|
|
|
|
def others(row_data, dict_key):
|
|
diff --git a/packageship/application/initialize/source.json b/packageship/application/initialize/source.json
|
|
index 5ee3544dd897b0469eee9c109c934221f6e3ba0c..12049bfd110baf885a06ead363ff4609f05ed21c 100644
|
|
--- a/packageship/application/initialize/source.json
|
|
+++ b/packageship/application/initialize/source.json
|
|
@@ -26,18 +26,6 @@
|
|
"type": "keyword",
|
|
"ignore_above": 256
|
|
},
|
|
- "relation": {
|
|
- "properties": {
|
|
- "bin_name": {
|
|
- "type": "keyword",
|
|
- "ignore_above": 256
|
|
- },
|
|
- "src_name": {
|
|
- "type": "keyword",
|
|
- "ignore_above": 256
|
|
- }
|
|
- }
|
|
- },
|
|
"release": {
|
|
"type": "keyword",
|
|
"ignore_above": 256
|
|
diff --git a/test/cli/init_command/comparison_relation_case/relationship/binary.json b/test/cli/init_command/comparison_relation_case/relationship/binary.json
|
|
index 5e202ba4819ad842d8ba5b344ebbf15f851da563..09a87898e08e787b571cfc35122cb0eca4f5251c 100644
|
|
--- a/test/cli/init_command/comparison_relation_case/relationship/binary.json
|
|
+++ b/test/cli/init_command/comparison_relation_case/relationship/binary.json
|
|
@@ -1,230 +1,212 @@
|
|
{
|
|
- "pkgKey": 35,
|
|
- "pkgId": "df487e3623660d477f556899fce77ac650322c4362d82e047c6efc013e07ae5b",
|
|
- "name": "Judy",
|
|
- "arch": "aarch64",
|
|
- "version": "1.0.5",
|
|
- "epoch": "0",
|
|
- "release": "19.oe1",
|
|
- "summary": "C library array",
|
|
- "description": "The package provides the most advanced core technology, the main\nadvantages are scalability, high performance and memory efficiency.",
|
|
- "url": "http://sourceforge.net/projects/judy/",
|
|
- "time_file": 1601219934,
|
|
- "time_build": 1601219910,
|
|
- "rpm_license": "LGPLv2+",
|
|
- "rpm_vendor": "http://openeuler.org",
|
|
- "rpm_group": "Unspecified",
|
|
- "rpm_buildhost": "obs-worker-0016",
|
|
- "rpm_sourcerpm": "Judy-1.0.5-19.oe1.src.rpm",
|
|
- "rpm_header_start": 5096,
|
|
- "rpm_header_end": 8772,
|
|
- "rpm_packager": "http://openeuler.org",
|
|
- "size_package": 114276,
|
|
- "size_installed": 356971,
|
|
- "size_archive": 358048,
|
|
- "location_href": "Packages/Judy-1.0.5-19.oe1.aarch64.rpm",
|
|
- "location_base": null,
|
|
- "checksum_type": "sha256",
|
|
- "src_name": "Judy",
|
|
- "provides": [
|
|
- {
|
|
- "name": "Judy",
|
|
- "flags": "EQ",
|
|
- "epoch": "0",
|
|
- "version": "1.0.5",
|
|
- "release": "19.oe1",
|
|
- "pkgKey": 35
|
|
- },
|
|
- {
|
|
- "name": "Judy(aarch-64)",
|
|
- "flags": "EQ",
|
|
- "epoch": "0",
|
|
- "version": "1.0.5",
|
|
- "release": "19.oe1",
|
|
- "pkgKey": 35
|
|
- },
|
|
- {
|
|
- "name": "libJudy.so.1()(64bit)",
|
|
- "flags": null,
|
|
- "epoch": null,
|
|
- "version": null,
|
|
- "release": null,
|
|
- "pkgKey": 35
|
|
- }
|
|
- ],
|
|
- "files": [
|
|
- {
|
|
- "name": "/etc/ima/digest_lists/0-metadata_list-compact-Judy-1.0.5-19.oe1.aarch64",
|
|
- "type": "file",
|
|
- "pkgKey": 35
|
|
- },
|
|
- {
|
|
- "name": "/etc/ima/digest_lists.tlv/0-metadata_list-compact_tlv-Judy-1.0.5-19.oe1.aarch64",
|
|
- "type": "file",
|
|
- "pkgKey": 35
|
|
- }
|
|
- ],
|
|
- "filelists": [
|
|
- {
|
|
- "pkgKey": 35,
|
|
- "dirname": "/usr/share/licenses",
|
|
- "filenames": "Judy",
|
|
- "filetypes": "d"
|
|
- },
|
|
- {
|
|
- "pkgKey": 35,
|
|
- "dirname": "/usr/share/licenses/Judy",
|
|
- "filenames": "COPYING",
|
|
- "filetypes": "f"
|
|
- },
|
|
- {
|
|
- "pkgKey": 35,
|
|
- "dirname": "/etc/ima/digest_lists.tlv",
|
|
- "filenames": "0-metadata_list-compact_tlv-Judy-1.0.5-19.oe1.aarch64",
|
|
- "filetypes": "f"
|
|
- },
|
|
- {
|
|
- "pkgKey": 35,
|
|
- "dirname": "/usr/lib64",
|
|
- "filenames": "libJudy.so.1/libJudy.so.1.0.3",
|
|
- "filetypes": "ff"
|
|
- },
|
|
- {
|
|
- "pkgKey": 35,
|
|
- "dirname": "/etc/ima/digest_lists",
|
|
- "filenames": "0-metadata_list-compact-Judy-1.0.5-19.oe1.aarch64",
|
|
- "filetypes": "f"
|
|
- }
|
|
- ],
|
|
- "src_version": "1.0.5",
|
|
- "requires": [
|
|
- {
|
|
- "name": "coreutils",
|
|
- "flags": null,
|
|
- "epoch": null,
|
|
- "version": null,
|
|
- "release": null,
|
|
- "pkgKey": 14,
|
|
- "pre": "FALSE",
|
|
- "relation": [{ "bin_name": "coreutils", "src_name": "coreutils" }],
|
|
- "requires_type": "build"
|
|
- },
|
|
- {
|
|
- "name": "gawk",
|
|
- "flags": null,
|
|
- "epoch": null,
|
|
- "version": null,
|
|
- "release": null,
|
|
- "pkgKey": 14,
|
|
- "pre": "FALSE",
|
|
- "relation": [{ "bin_name": "gawk", "src_name": "gawk" }],
|
|
- "requires_type": "build"
|
|
- },
|
|
- {
|
|
- "name": "gcc",
|
|
- "flags": "GE",
|
|
- "epoch": "0",
|
|
- "version": "4.1",
|
|
- "release": null,
|
|
- "pkgKey": 14,
|
|
- "pre": "FALSE",
|
|
- "relation": [{ "bin_name": "gcc", "src_name": "gcc" }],
|
|
- "requires_type": "build"
|
|
- },
|
|
- {
|
|
- "name": "make",
|
|
- "flags": null,
|
|
- "epoch": null,
|
|
- "version": null,
|
|
- "release": null,
|
|
- "pkgKey": 14,
|
|
- "pre": "FALSE",
|
|
- "relation": [{ "bin_name": "make", "src_name": "make" }],
|
|
- "requires_type": "build"
|
|
- },
|
|
- {
|
|
- "name": "sed",
|
|
- "flags": null,
|
|
- "epoch": null,
|
|
- "version": null,
|
|
- "release": null,
|
|
- "pkgKey": 14,
|
|
- "pre": "FALSE",
|
|
- "relation": [{ "bin_name": "sed", "src_name": "sed" }],
|
|
- "requires_type": "build"
|
|
- },
|
|
- {
|
|
- "name": "/bin/sh",
|
|
- "flags": null,
|
|
- "epoch": null,
|
|
- "version": null,
|
|
- "release": null,
|
|
- "pkgKey": 35,
|
|
- "pre": "TRUE",
|
|
- "relation": [
|
|
- { "bin_name": "bash", "src_name": "bash" },
|
|
- { "bin_name": "coreutils", "src_name": "coreutils" }
|
|
- ],
|
|
- "requires_type": "install"
|
|
- },
|
|
- {
|
|
- "name": "/bin/sh",
|
|
- "flags": null,
|
|
- "epoch": null,
|
|
- "version": null,
|
|
- "release": null,
|
|
- "pkgKey": 35,
|
|
- "pre": "FALSE",
|
|
- "relation": [
|
|
- { "bin_name": "bash", "src_name": "bash" },
|
|
- { "bin_name": "coreutils", "src_name": "coreutils" }
|
|
- ],
|
|
- "requires_type": "install"
|
|
- },
|
|
- {
|
|
- "name": "ld-linux-aarch64.so.1()(64bit)",
|
|
- "flags": null,
|
|
- "epoch": null,
|
|
- "version": null,
|
|
- "release": null,
|
|
- "pkgKey": 35,
|
|
- "pre": "FALSE",
|
|
- "relation": [{ "bin_name": "glibc", "src_name": "glibc" }],
|
|
- "requires_type": "install"
|
|
- },
|
|
- {
|
|
- "name": "ld-linux-aarch64.so.1(GLIBC_2.17)(64bit)",
|
|
- "flags": null,
|
|
- "epoch": null,
|
|
- "version": null,
|
|
- "release": null,
|
|
- "pkgKey": 35,
|
|
- "pre": "FALSE",
|
|
- "relation": [{ "bin_name": "glibc", "src_name": "glibc" }],
|
|
- "requires_type": "install"
|
|
- },
|
|
- {
|
|
- "name": "rtld(GNU_HASH)",
|
|
- "flags": null,
|
|
- "epoch": null,
|
|
- "version": null,
|
|
- "release": null,
|
|
- "pkgKey": 35,
|
|
- "pre": "FALSE",
|
|
- "relation": [{ "bin_name": "glibc", "src_name": "glibc" }],
|
|
- "requires_type": "install"
|
|
- },
|
|
- {
|
|
- "name": "libc.so.6(GLIBC_2.17)(64bit)",
|
|
- "flags": null,
|
|
- "epoch": null,
|
|
- "version": null,
|
|
- "release": null,
|
|
- "pkgKey": 35,
|
|
- "pre": "FALSE",
|
|
- "relation": [{ "bin_name": "glibc", "src_name": "glibc" }],
|
|
- "requires_type": "install"
|
|
- }
|
|
- ]
|
|
- }
|
|
-
|
|
\ No newline at end of file
|
|
+ "pkgKey": 35,
|
|
+ "pkgId": "df487e3623660d477f556899fce77ac650322c4362d82e047c6efc013e07ae5b",
|
|
+ "name": "Judy",
|
|
+ "arch": "aarch64",
|
|
+ "version": "1.0.5",
|
|
+ "epoch": "0",
|
|
+ "release": "19.oe1",
|
|
+ "summary": "C library array",
|
|
+ "description": "The package provides the most advanced core technology, the main\nadvantages are scalability, high performance and memory efficiency.",
|
|
+ "url": "http://sourceforge.net/projects/judy/",
|
|
+ "time_file": 1601219934,
|
|
+ "time_build": 1601219910,
|
|
+ "rpm_license": "LGPLv2+",
|
|
+ "rpm_vendor": "http://openeuler.org",
|
|
+ "rpm_group": "Unspecified",
|
|
+ "rpm_buildhost": "obs-worker-0016",
|
|
+ "rpm_sourcerpm": "Judy-1.0.5-19.oe1.src.rpm",
|
|
+ "rpm_header_start": 5096,
|
|
+ "rpm_header_end": 8772,
|
|
+ "rpm_packager": "http://openeuler.org",
|
|
+ "size_package": 114276,
|
|
+ "size_installed": 356971,
|
|
+ "size_archive": 358048,
|
|
+ "location_href": "Packages/Judy-1.0.5-19.oe1.aarch64.rpm",
|
|
+ "location_base": null,
|
|
+ "checksum_type": "sha256",
|
|
+ "src_name": "Judy",
|
|
+ "provides": [
|
|
+ {
|
|
+ "name": "Judy",
|
|
+ "flags": "EQ",
|
|
+ "epoch": "0",
|
|
+ "version": "1.0.5",
|
|
+ "release": "19.oe1",
|
|
+ "pkgKey": 35
|
|
+ },
|
|
+ {
|
|
+ "name": "Judy(aarch-64)",
|
|
+ "flags": "EQ",
|
|
+ "epoch": "0",
|
|
+ "version": "1.0.5",
|
|
+ "release": "19.oe1",
|
|
+ "pkgKey": 35
|
|
+ },
|
|
+ {
|
|
+ "name": "libJudy.so.1()(64bit)",
|
|
+ "flags": null,
|
|
+ "epoch": null,
|
|
+ "version": null,
|
|
+ "release": null,
|
|
+ "pkgKey": 35
|
|
+ }
|
|
+ ],
|
|
+ "files": [
|
|
+ {
|
|
+ "name": "/etc/ima/digest_lists/0-metadata_list-compact-Judy-1.0.5-19.oe1.aarch64",
|
|
+ "type": "file",
|
|
+ "pkgKey": 35
|
|
+ },
|
|
+ {
|
|
+ "name": "/etc/ima/digest_lists.tlv/0-metadata_list-compact_tlv-Judy-1.0.5-19.oe1.aarch64",
|
|
+ "type": "file",
|
|
+ "pkgKey": 35
|
|
+ }
|
|
+ ],
|
|
+ "filelists": [
|
|
+ {
|
|
+ "pkgKey": 35,
|
|
+ "dirname": "/usr/share/licenses",
|
|
+ "filenames": "Judy",
|
|
+ "filetypes": "d"
|
|
+ },
|
|
+ {
|
|
+ "pkgKey": 35,
|
|
+ "dirname": "/usr/share/licenses/Judy",
|
|
+ "filenames": "COPYING",
|
|
+ "filetypes": "f"
|
|
+ },
|
|
+ {
|
|
+ "pkgKey": 35,
|
|
+ "dirname": "/etc/ima/digest_lists.tlv",
|
|
+ "filenames": "0-metadata_list-compact_tlv-Judy-1.0.5-19.oe1.aarch64",
|
|
+ "filetypes": "f"
|
|
+ },
|
|
+ {
|
|
+ "pkgKey": 35,
|
|
+ "dirname": "/usr/lib64",
|
|
+ "filenames": "libJudy.so.1/libJudy.so.1.0.3",
|
|
+ "filetypes": "ff"
|
|
+ },
|
|
+ {
|
|
+ "pkgKey": 35,
|
|
+ "dirname": "/etc/ima/digest_lists",
|
|
+ "filenames": "0-metadata_list-compact-Judy-1.0.5-19.oe1.aarch64",
|
|
+ "filetypes": "f"
|
|
+ }
|
|
+ ],
|
|
+ "src_version": "1.0.5",
|
|
+ "requires": [
|
|
+ {
|
|
+ "name": "coreutils",
|
|
+ "flags": null,
|
|
+ "epoch": null,
|
|
+ "version": null,
|
|
+ "release": null,
|
|
+ "pkgKey": 14,
|
|
+ "pre": "FALSE",
|
|
+ "requires_type": "build"
|
|
+ },
|
|
+ {
|
|
+ "name": "gawk",
|
|
+ "flags": null,
|
|
+ "epoch": null,
|
|
+ "version": null,
|
|
+ "release": null,
|
|
+ "pkgKey": 14,
|
|
+ "pre": "FALSE",
|
|
+ "requires_type": "build"
|
|
+ },
|
|
+ {
|
|
+ "name": "gcc",
|
|
+ "flags": "GE",
|
|
+ "epoch": "0",
|
|
+ "version": "4.1",
|
|
+ "release": null,
|
|
+ "pkgKey": 14,
|
|
+ "pre": "FALSE",
|
|
+ "requires_type": "build"
|
|
+ },
|
|
+ {
|
|
+ "name": "make",
|
|
+ "flags": null,
|
|
+ "epoch": null,
|
|
+ "version": null,
|
|
+ "release": null,
|
|
+ "pkgKey": 14,
|
|
+ "pre": "FALSE",
|
|
+ "requires_type": "build"
|
|
+ },
|
|
+ {
|
|
+ "name": "sed",
|
|
+ "flags": null,
|
|
+ "epoch": null,
|
|
+ "version": null,
|
|
+ "release": null,
|
|
+ "pkgKey": 14,
|
|
+ "pre": "FALSE",
|
|
+ "requires_type": "build"
|
|
+ },
|
|
+ {
|
|
+ "name": "/bin/sh",
|
|
+ "flags": null,
|
|
+ "epoch": null,
|
|
+ "version": null,
|
|
+ "release": null,
|
|
+ "pkgKey": 35,
|
|
+ "pre": "TRUE",
|
|
+ "requires_type": "install"
|
|
+ },
|
|
+ {
|
|
+ "name": "/bin/sh",
|
|
+ "flags": null,
|
|
+ "epoch": null,
|
|
+ "version": null,
|
|
+ "release": null,
|
|
+ "pkgKey": 35,
|
|
+ "pre": "FALSE",
|
|
+ "requires_type": "install"
|
|
+ },
|
|
+ {
|
|
+ "name": "ld-linux-aarch64.so.1()(64bit)",
|
|
+ "flags": null,
|
|
+ "epoch": null,
|
|
+ "version": null,
|
|
+ "release": null,
|
|
+ "pkgKey": 35,
|
|
+ "pre": "FALSE",
|
|
+ "requires_type": "install"
|
|
+ },
|
|
+ {
|
|
+ "name": "ld-linux-aarch64.so.1(GLIBC_2.17)(64bit)",
|
|
+ "flags": null,
|
|
+ "epoch": null,
|
|
+ "version": null,
|
|
+ "release": null,
|
|
+ "pkgKey": 35,
|
|
+ "pre": "FALSE",
|
|
+ "requires_type": "install"
|
|
+ },
|
|
+ {
|
|
+ "name": "rtld(GNU_HASH)",
|
|
+ "flags": null,
|
|
+ "epoch": null,
|
|
+ "version": null,
|
|
+ "release": null,
|
|
+ "pkgKey": 35,
|
|
+ "pre": "FALSE",
|
|
+ "requires_type": "install"
|
|
+ },
|
|
+ {
|
|
+ "name": "libc.so.6(GLIBC_2.17)(64bit)",
|
|
+ "flags": null,
|
|
+ "epoch": null,
|
|
+ "version": null,
|
|
+ "release": null,
|
|
+ "pkgKey": 35,
|
|
+ "pre": "FALSE",
|
|
+ "requires_type": "install"
|
|
+ }
|
|
+ ]
|
|
+}
|
|
\ No newline at end of file
|
|
diff --git a/test/cli/init_command/comparison_relation_case/relationship/source.json b/test/cli/init_command/comparison_relation_case/relationship/source.json
|
|
index 664add83ce8467e7d40d0f0f36676579e68775c6..e09f3cb33648a139e8f0a81ff831a55c83f1270b 100644
|
|
--- a/test/cli/init_command/comparison_relation_case/relationship/source.json
|
|
+++ b/test/cli/init_command/comparison_relation_case/relationship/source.json
|
|
@@ -1,72 +1,74 @@
|
|
{
|
|
- "pkgKey": 3,
|
|
- "pkgId": "a2c8963c6d5bdea8d3c9dc1bfa609db643c5a17077eff4eca21aa6e33ff9d4e5",
|
|
- "name": "CUnit",
|
|
- "arch": "src",
|
|
- "version": "2.1.3",
|
|
- "epoch": "0",
|
|
- "release": "21.oe1",
|
|
- "summary": "A Unit Testing Framework for C",
|
|
- "description": "CUnit is a lightweight system for writing, administering, and running unit tests in C\nIt provides C programmers a basic testing functionality with a flexible variety of user\ninterfaces.\n\nCUnit is built as a static library which is linked with the user's testing code. It\nuses a simple framework for building test structures, and provides a rich set of\nassertions for testing common data types. In addition, several different interfaces are\nprovided for running tests and reporting results.",
|
|
- "url": "http://cunit.sourceforge.net/",
|
|
- "time_file": 1601215538,
|
|
- "time_build": 1601215498,
|
|
- "rpm_license": "LGPLv2+",
|
|
- "rpm_vendor": "http://openeuler.org",
|
|
- "rpm_group": "Unspecified",
|
|
- "rpm_buildhost": "obs-worker-009",
|
|
- "rpm_sourcerpm": "",
|
|
- "rpm_header_start": 5096,
|
|
- "rpm_header_end": 7552,
|
|
- "rpm_packager": "http://openeuler.org",
|
|
- "size_package": 523353,
|
|
- "size_installed": 516791,
|
|
- "size_archive": 517172,
|
|
- "location_href": "Packages/CUnit-2.1.3-21.oe1.src.rpm",
|
|
- "location_base": null,
|
|
- "checksum_type": "sha256",
|
|
- "requires": [
|
|
- {
|
|
- "name": "automake",
|
|
- "flags": null,
|
|
- "epoch": null,
|
|
- "version": null,
|
|
- "release": null,
|
|
- "pkgKey": 3,
|
|
- "pre": "FALSE",
|
|
- "relation": [{ "bin_name": "automake", "src_name": "automake" }],
|
|
- "requires_type": "build"
|
|
- },
|
|
- {
|
|
- "name": "git",
|
|
- "flags": null,
|
|
- "epoch": null,
|
|
- "version": null,
|
|
- "release": null,
|
|
- "pkgKey": 3,
|
|
- "pre": "FALSE",
|
|
- "relation": [
|
|
- { "bin_name": "git", "src_name": "git" },
|
|
- { "bin_name": "git", "src_name": "git" }
|
|
- ],
|
|
- "requires_type": "build"
|
|
- },
|
|
- {
|
|
- "name": "libtool",
|
|
- "flags": null,
|
|
- "epoch": null,
|
|
- "version": null,
|
|
- "release": null,
|
|
- "pkgKey": 3,
|
|
- "pre": "FALSE",
|
|
- "relation": [{ "bin_name": "libtool", "src_name": "libtool" }],
|
|
- "requires_type": "build"
|
|
- }
|
|
- ],
|
|
- "subpacks": [
|
|
- { "name": "CUnit", "version": "2.1.3" },
|
|
- { "name": "CUnit-devel", "version": "2.1.3" },
|
|
- { "name": "CUnit-help", "version": "2.1.3" }
|
|
- ]
|
|
- }
|
|
-
|
|
\ No newline at end of file
|
|
+ "pkgKey": 3,
|
|
+ "pkgId": "a2c8963c6d5bdea8d3c9dc1bfa609db643c5a17077eff4eca21aa6e33ff9d4e5",
|
|
+ "name": "CUnit",
|
|
+ "arch": "src",
|
|
+ "version": "2.1.3",
|
|
+ "epoch": "0",
|
|
+ "release": "21.oe1",
|
|
+ "summary": "A Unit Testing Framework for C",
|
|
+ "description": "CUnit is a lightweight system for writing, administering, and running unit tests in C\nIt provides C programmers a basic testing functionality with a flexible variety of user\ninterfaces.\n\nCUnit is built as a static library which is linked with the user's testing code. It\nuses a simple framework for building test structures, and provides a rich set of\nassertions for testing common data types. In addition, several different interfaces are\nprovided for running tests and reporting results.",
|
|
+ "url": "http://cunit.sourceforge.net/",
|
|
+ "time_file": 1601215538,
|
|
+ "time_build": 1601215498,
|
|
+ "rpm_license": "LGPLv2+",
|
|
+ "rpm_vendor": "http://openeuler.org",
|
|
+ "rpm_group": "Unspecified",
|
|
+ "rpm_buildhost": "obs-worker-009",
|
|
+ "rpm_sourcerpm": "",
|
|
+ "rpm_header_start": 5096,
|
|
+ "rpm_header_end": 7552,
|
|
+ "rpm_packager": "http://openeuler.org",
|
|
+ "size_package": 523353,
|
|
+ "size_installed": 516791,
|
|
+ "size_archive": 517172,
|
|
+ "location_href": "Packages/CUnit-2.1.3-21.oe1.src.rpm",
|
|
+ "location_base": null,
|
|
+ "checksum_type": "sha256",
|
|
+ "requires": [
|
|
+ {
|
|
+ "name": "automake",
|
|
+ "flags": null,
|
|
+ "epoch": null,
|
|
+ "version": null,
|
|
+ "release": null,
|
|
+ "pkgKey": 3,
|
|
+ "pre": "FALSE",
|
|
+ "requires_type": "build"
|
|
+ },
|
|
+ {
|
|
+ "name": "git",
|
|
+ "flags": null,
|
|
+ "epoch": null,
|
|
+ "version": null,
|
|
+ "release": null,
|
|
+ "pkgKey": 3,
|
|
+ "pre": "FALSE",
|
|
+ "requires_type": "build"
|
|
+ },
|
|
+ {
|
|
+ "name": "libtool",
|
|
+ "flags": null,
|
|
+ "epoch": null,
|
|
+ "version": null,
|
|
+ "release": null,
|
|
+ "pkgKey": 3,
|
|
+ "pre": "FALSE",
|
|
+ "requires_type": "build"
|
|
+ }
|
|
+ ],
|
|
+ "subpacks": [
|
|
+ {
|
|
+ "name": "CUnit",
|
|
+ "version": "2.1.3"
|
|
+ },
|
|
+ {
|
|
+ "name": "CUnit-devel",
|
|
+ "version": "2.1.3"
|
|
+ },
|
|
+ {
|
|
+ "name": "CUnit-help",
|
|
+ "version": "2.1.3"
|
|
+ }
|
|
+ ]
|
|
+}
|
|
\ No newline at end of file
|
|
diff --git a/test/cli/init_command/comparison_relation_case/test_relationship.py b/test/cli/init_command/comparison_relation_case/test_relationship.py
|
|
index 7e389297339217f58438053e472b65030fd76fe2..147bb9823cadd0bfb3aec1dae8c62bf443a9042c 100644
|
|
--- a/test/cli/init_command/comparison_relation_case/test_relationship.py
|
|
+++ b/test/cli/init_command/comparison_relation_case/test_relationship.py
|
|
@@ -11,6 +11,7 @@
|
|
# See the Mulan PSL v2 for more details.
|
|
# ******************************************************************************/
|
|
# -*- coding:utf-8 -*-
|
|
+import json
|
|
import os
|
|
import shutil
|
|
from pathlib import Path
|
|
diff --git a/test/unpack/compress_files/gz_error.txt b/test/unpack/compress_files/gz_error.txt
|
|
new file mode 100644
|
|
index 0000000000000000000000000000000000000000..9ea415ee96ce4459710a2c5cab997053cb5c207f
|
|
--- /dev/null
|
|
+++ b/test/unpack/compress_files/gz_error.txt
|
|
@@ -0,0 +1 @@
|
|
+gz error file
|
|
\ No newline at end of file
|
|
diff --git a/test/unpack/compress_files/tar_error.txt b/test/unpack/compress_files/tar_error.txt
|
|
new file mode 100644
|
|
index 0000000000000000000000000000000000000000..beb36750c7e906599a4765ec8debf914f4c0d035
|
|
--- /dev/null
|
|
+++ b/test/unpack/compress_files/tar_error.txt
|
|
@@ -0,0 +1 @@
|
|
+tar file error
|
|
\ No newline at end of file
|
|
diff --git a/test/unpack/compress_files/xz_error.txt b/test/unpack/compress_files/xz_error.txt
|
|
new file mode 100644
|
|
index 0000000000000000000000000000000000000000..3fd014f7e5ccf3864da047743a6af767355c4937
|
|
--- /dev/null
|
|
+++ b/test/unpack/compress_files/xz_error.txt
|
|
@@ -0,0 +1 @@
|
|
+xz file error
|
|
\ No newline at end of file
|
|
diff --git a/test/unpack/test_unpack.py b/test/unpack/test_unpack.py
|
|
index 64ad3381e58867c83e1c10a9f125341771e2c454..90bcae8dcba6e27375467c292e675e84a64d1e9b 100644
|
|
--- a/test/unpack/test_unpack.py
|
|
+++ b/test/unpack/test_unpack.py
|
|
@@ -34,13 +34,13 @@ class TestUnpack(TestCase):
|
|
def test_gz_unpack(self):
|
|
"""unpack gz file"""
|
|
with self.assertRaises(UnpackError):
|
|
- Unpack.dispatch(".gz", file_path=os.path.join(self.path, "bz2_error.txt"),
|
|
+ Unpack.dispatch(".gz", file_path=os.path.join(self.path, "gz_error.txt"),
|
|
save_file=os.path.join(self.path, "bz2_unpack.sqlite"))
|
|
|
|
def test_error_tar(self):
|
|
"""error tar file"""
|
|
with self.assertRaises(IOError):
|
|
- Unpack.dispatch(".tar", file_path=os.path.join(self.path, "bz2_error.txt"),
|
|
+ Unpack.dispatch(".tar", file_path=os.path.join(self.path, "tar_error.txt"),
|
|
save_file=os.path.join(self.path, "bz2_unpack.sqlite"))
|
|
|
|
def test_tar_unpack(self):
|
|
@@ -50,9 +50,14 @@ class TestUnpack(TestCase):
|
|
|
|
def test_error_zip_unpack(self):
|
|
"""unpack error zip file"""
|
|
+ file = os.path.join(self.path, "zip_error.txt")
|
|
+ with open(file, "w", encoding="utf-8") as f:
|
|
+ f.write("error zip file")
|
|
with self.assertRaises(IOError):
|
|
- Unpack.dispatch(".zip", file_path=os.path.join(self.path, "bz2_error.txt"),
|
|
+ Unpack.dispatch(".zip", file_path=file,
|
|
save_file=os.path.join(self.path, "zip_file.sqlite"))
|
|
+ if os.path.exists(file):
|
|
+ os.remove(file)
|
|
|
|
def test_zip_unpack(self):
|
|
"""unpack zip file"""
|
|
@@ -64,7 +69,7 @@ class TestUnpack(TestCase):
|
|
def test_xz_unpack(self):
|
|
"""unpack xz file"""
|
|
with self.assertRaises(UnpackError):
|
|
- Unpack.dispatch(".xz", file_path=os.path.join(self.path, "bz2_error.txt"),
|
|
+ Unpack.dispatch(".xz", file_path=os.path.join(self.path, "xz_error.txt"),
|
|
save_file=os.path.join(self.path, "xz.sqlite"))
|
|
|
|
def test_file_path_none(self):
|