Contributions guidelines
How to provide changes
Be sure, before creating a Pull Request, to:
- To install and use
Perl::Tidy
in your code. - Run the tests under
t
andxt
. - Make sure to add the comments
VERSION
andABSTRACT
in case of new packages.
Always create branches from the master
branch.
How to extend KernelReleases
You favorite Linux distribution might have available more information that you
want available. In order to have that, you must subclass
Linux::Info::KernelRelease
superclass.
- Create a new subdirectory under
t/samples/kernel
with the distribution name. - In this new directory, create a file named
sys_osrelease
with the content of/proc/sys/kernel/osrelease
file. - Create another file named
version
with the content of/proc/version
. - Under
lib/Linux/Info/KernelRelease
directory, create a new file with the distribution name, using camel case. - In this file, make sure to inherit from the class
Linux::Info::KernelRelease
. - Override the method
_set_proc_ver_regex
. - Add new getters for additional attributes with
Class::XSAccessor
. - Create a new test under
t
namedkernel-release-<DISTRO NAME>.t
.
Adding a new Distribution
The process should look like the same for KernelReleases, but with one big
difference: you must decided if the information available will be fetched from
/etc/os-release
or any other, distribution specific, file.
The /etc/os-release
is becoming a standard between distributions and parsing
it will be easier because most of the job is already taken care by the classes
Linux::Info::Distribution
and Linux::Info::Distribution::OSRelease
.
For the second case, it will be more complex. You will need to inherit from
Linux::Info::Distribution::Custom
and work on a regular expression that,
hopefully, will be enough to extract the information.
Also, you probably will need to take a look at Linux::Info::DistributionFinder
too.
In both cases, updating the class Linux::Info::DistributionFactory
is
required.