-
Notifications
You must be signed in to change notification settings - Fork 172
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
DpdkTestpmd: Installation path cleanup #3426
Conversation
b0a06fa
to
0eecb81
Compare
5468cae
to
cebb660
Compare
Making one more change to make Ninja a tool since it's used by two builds and annoying to install on some systems. Edit: Change complete! Also fixed a bug when calling |
de4d216
to
ceed53a
Compare
Fixed a rebase issue, should be good to go |
I read more on the code and the problem try to solve. It looks a valid scenario to a couple of tools, like some open source. There are some thoughts and draft design. Thoughts
Designclass Downloader:
# base class of download. Due to different parameters, so use a class instead of a method.
def __init__(self, **kwargs: Any) -> None:
...
def download(self) -> path.PurePath:
# download code including with wget or git
raise NotImplementError()
class GitDownloader(Downloader):
def __init__(self, repo: str, ref: str, **kwargs: Any) -> None:
...
def download(self) -> path.PurePath:
# imp git clone and checkout, if needed
...
class FileDownloader(Downloader):
def __init__(self, url: str, **kwargs: Any) -> None:
...
def download(self) -> path.PurePath:
# imp wget download and return root path.
...
class TarFileDownloader(FileDownloader):
def download(self) -> path.PurePath:
path = super().download()
# extra tar file and return the path
...
class Installer:
def __init__(self, downloader: Downloader, **kwargs: Any) -> None:
# downloader is initialized in corresponding tools by os version, passed in parameters etc.
# kwargs can be passed through to subclasses
...
def install(self) -> None:
# implemented here to include reinstall for some reasons, like version mismatches.
# below is the skeleton code, more error handling may be added.
if self.need_install():
self.downloader.download()
self.uninstall()
self._install()
def uninstall(self) -> None:
raise NotImplementedError()
def need_install(self) -> bool:
raise NotImplementedError()
def _install(self) -> None:
raise NotImplementedError()
class BinaryInstaller(Installer):
# install by cp
...
class PackageInstaller(Installer):
# install by packages
...
class SourceInstaller(Installer):
# install by building binary.
... |
Thanks @squirrelsc. I like the mix-in idea! I was trying to implement something like that but didn't know the name of it. I'll implement that in the next PR. |
485127a
to
37949ca
Compare
The installer path has grown to be unmaintainable. We cover multiple cases: -install from pkg manager -install from source - install from git - install from tar - (implicit) use already installed version for multiple targets: - debian - ubuntu 18.04 special casing - suse - fedora and now need to allow all of these scenarios for both DPDK and rdma-core (and the linux kernel). SO... It's time for a refactor. Commit makes the 'installer' concept object-oriented. Adds a generic class 'Installer' into common.py Adds child class SourceInstall and PackageManagerInstall. Adds DpdkSourceInstall and DpdkPackageManagerInstall classes. Adds DpdkGitInstall and DpdkTarInstall implementations of the generic parent classes.
9205be7
to
240a2d3
Compare
@squirrelsc could I get one more look before Lili signs on 🥺🙏 |
@LiliDeng can you give a final review once Chi resolves his comments? Please feel free to merge once you approve. |
7fd99cd
to
974505a
Compare
59b20e2
to
e3f2344
Compare
@squirrelsc |
No others except one more polish. Please wait Lili for merging. @LiliDeng LGTM. |
e3f2344
to
38e02ef
Compare
@squirrelsc Lili is OOF for the week. |
Please share test results on major versions of Ubuntu, SUSE, RedHat, I can merge code, if no regression. |
Checked test results, no failure happens on major distro with 3 typical dpdk test cases. |
The DPDK installer path has grown to be unmaintainable, this PR series cleans it up using some classes instead of just a bunch of if/else trees. The PR looks scary; but, it is just moving code to the object-oriented replacements. This means when we get to
Tool.install()
we can just calldpdktestpmd.installer.run_installation()
My plan is to re-use the SourceInstaller and PackageManagerInstaller logic for rdma-core, though this series only implents the classes for DPDK.
For the DPDK and rdma-core installation we have to cover multiple cases:
-install from pkg manager
-install from source
And we cover these cases for multiple targets:
and now need to cover all of these scenarios for both DPDK and rdma-core.
Changes:
SourceInstall
andPackageManagerInstall
to dpdk/common.pyDpdkSourceInstall
andDpdkPackageManagerInstall
classes to dpdk/dpdktestpmd.pyDpdkGitInstall
andDpdkTarInstall
implementations of the generic DpdkSourceInstall class to dpdk/dpdktestpmd.pyThis required adding some other logic: