Linux kernel compatibility helper to add version guards for an out-of-tree modules or to get the tag information for a particular commit.
For maintaining an out-of-tree module it is important to support multiple kernel version compatibility
using Linux kernel version guards, we can get the exact commit for the fix by using git blame
or git bisect
etc, but the main problem is to figure out the version number which the fix
is present first.
If you have clone Linus tovarlds linux.git
then we can use below command to figure out the tag in which the commit first appeared. But cloning this repo
and keeping it up-to-date is inconvinient.
$ git describe --contains <commit_sha>
This repo is kept up-to-date and we can use the Github API to query commits and tags without cloning the repo and maintaining it. This module uses this approach and does a simple binary search based on commit and tag date.
- Github API token with proper permissions
pipenv
installed- Tested on Ubuntu Distribution, but should work in others.
-
Create and Install the virtual environment
pipenv install
-
Run the application, below command will display the usage.
pipenv run lk-get-tag -h
$ export GITHUB_API_TOKEN=<token>
$ pipenv install
$ pipenv run lk-get-tag -c <commit_sha>
This package can also be directly installed using pip
and then can be run, see below steps
- Github API token with proper permissions
pip
installed (preferably the latest version)- Tested on Ubuntu Distribution, but should work in others.
-
Create and Install the package from
pypi
pip install linux-kernel-compat-helper
-
Run the application, below command will display the usage.
lk-get-tag -h
Note:
pip
installation pathbin
directory should be in the$PATH
for this command to work.