Skip to content

Commit

Permalink
feat(probe-builder): Ability to crawl EulerOS kernel packages
Browse files Browse the repository at this point in the history
Signed-off-by: Daniele De Lorenzi <daniele.delorenzi@sysdig.com>
  • Loading branch information
dark-vex committed Jun 24, 2024
1 parent a15510f commit 5796088
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 1 deletion.
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
20 changes: 20 additions & 0 deletions probe_builder/kernel_crawler/euleros.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
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),
rpm.RpmMirror('http://mirrors.huaweicloud.com/euler/', '/os/{}/'.format(crawler_filter.machine)),

]
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

0 comments on commit 5796088

Please sign in to comment.