Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(probe-builder): Ability to crawl EulerOS kernel packages #140

Draft
wants to merge 2 commits into
base: dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions probe_builder/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ def get_kernels(self, _workspace, packages, _download_config, _crawler_filter):
'CentOS': CrawlDistro('centos', 'centos', 'CentOS'),
'CentOSStream': CrawlDistro('centosstream', 'centos', 'CentOSStream'),
'Debian': CrawlDistro('debian', 'debian', 'Debian'),
'EulerOS': CrawlDistro('euleros', 'centos', 'EulerOS'),
'Fedora': CrawlDistro('fedora', 'centos', 'Fedora'),
'Flatcar': CrawlDistro('flatcar', 'flatcar', 'Flatcar'),
'Oracle6': CrawlDistro('oracle6', 'oracle', 'Oracle6'),
Expand Down
2 changes: 2 additions & 0 deletions probe_builder/kernel_crawler/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from .almalinux import AlmaLinuxMirror
from .amazonlinux import AmazonLinux1Mirror, AmazonLinux2Mirror, AmazonLinux2022Mirror
from .centos import CentosMirror, CentosStreamMirror
from .euleros import EulerOSMirror
from .fedora import FedoraMirror
from .oracle import Oracle6Mirror, Oracle7Mirror, Oracle8Mirror, Oracle9Mirror
from .photon_os import PhotonOsMirror
Expand All @@ -20,6 +21,7 @@
'AmazonLinux2022': AmazonLinux2022Mirror,
'CentOS': CentosMirror,
'CentOSStream': CentosStreamMirror,
'EulerOS': EulerOSMirror,
'Fedora': FedoraMirror,
'Oracle6': Oracle6Mirror,
'Oracle7': Oracle7Mirror,
Expand Down
19 changes: 19 additions & 0 deletions probe_builder/kernel_crawler/euleros.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
from . import repo
from . import rpm

def v2(ver):
return ver.startswith('2')

class EulerOSMirror(repo.Distro):
def get_mirrors(self, crawler_filter):
mirrors = [
# EulerOS 2
# Lifecycle:
# https://developer.huaweicloud.com/intl/en-us/euleros/lifecycle-management.html
# Mirror list:
# http://mirrors.huaweicloud.com/euler/
rpm.RpmMirror('http://mirrors.huaweicloud.com/euler/', 'os/{}/'.format(crawler_filter.machine), v2),
rpm.RpmMirror('http://mirrors.huaweicloud.com/euler/', 'updates/{}/'.format(crawler_filter.machine), v2),

]
return mirrors
5 changes: 4 additions & 1 deletion probe_builder/kernel_crawler/rpm.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,10 @@ def list_drel_repos(self, crawler_filter):
dists.raise_for_status()
dists = dists.content
doc = html.fromstring(dists, self.base_url)
dists = doc.xpath('/html/body//a[not(@href="../")]/@href')
# Huawei Cloud loves do things differently
# Their page uses a table ouside body tags
# this additional filter catch it
dists = doc.xpath('/html/body//a[not(@href="../")]/@href | //table/tbody//a[not(@href="../")]/@href')

fdists = [dist for dist in dists
if dist.endswith('/')
Expand Down