Automated PaŃkage versions update for tags
Module repos.py
- ReposInfo(), walks mirror using HTTP and builds
all repos map available
- RepoManager(), using repos map builds package versions map
either for specific tags or for all of them
Fixes:
- Progress class clears line remainder on change
Utils:
- Download GZ file into memory
- TGZ file interface, CRU (no deletion)
Change-Id: Ifdb37aa4b68fb25f642b2089cf16cd242ed25a0b
Related-PROD: PROD-28199
diff --git a/cfg_checker/common/const.py b/cfg_checker/common/const.py
index 1ae2bba..490d879 100644
--- a/cfg_checker/common/const.py
+++ b/cfg_checker/common/const.py
@@ -65,3 +65,23 @@
"rgw": "storage_rados",
"unk": "uknown"
}
+
+ubuntu_releases = ["trusty", "xenial", "ubuntu"]
+all_arch = ["amd64"]
+repo_types = {
+ "main": "Officially supported software",
+ "restricted": "Supported software that is not "
+ "available under a completely free license",
+ "universe": "Community maintained software, "
+ "i.e. not officially supported software",
+ "multiverse": "Software that is not free",
+ "contrib": "Free software, but is dependent to non-free software",
+ "uknown": "No specific description available"
+}
+
+_repos_info_archive = "repo.info.tgz"
+_repos_versions_archive = "repo.versions.tgz"
+_pkg_desc_archive = "pkg.descriptions.tgz"
+
+_repos_index_filename = "repoindex.json"
+_repos_versions_filename = "versions.json"
diff --git a/cfg_checker/common/file_utils.py b/cfg_checker/common/file_utils.py
index d508121..684fc30 100644
--- a/cfg_checker/common/file_utils.py
+++ b/cfg_checker/common/file_utils.py
@@ -82,3 +82,14 @@
}
return _dict
+
+
+def get_gzipped_file(url):
+ # imports
+ from io import BytesIO
+ from requests import get
+ import gzip
+ # download a file
+ _bytes = BytesIO(get(url).content)
+ with gzip.GzipFile(fileobj=_bytes) as gz:
+ return gz.read()