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

[RHELC-1748] Manpage generation check #1422

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
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
318 changes: 0 additions & 318 deletions man/convert2rhel.8
Original file line number Diff line number Diff line change
@@ -1,318 +0,0 @@
.TH CONVERT2RHEL "1" "2024\-03\-04" "convert2rhel 1.7.1" "General Commands Manual"
.SH NAME
convert2rhel \- Automates the conversion of Red Hat Enterprise Linux derivative distributions to Red Hat Enterprise Linux.
.SH SYNOPSIS
.
convert2rhel [--version] [-h]
convert2rhel <subcommand> [-u username] [-p password | -c conf_file_path] [--pool pool_id | -a] [--disablerepo repoid] [--enablerepo repoid] [--serverurl url] [--no-rpm-va] [--els] [--eus] [--debug] [--restart] [-y]
convert2rhel <subcommand> [--no-rhsm] [--disablerepo repoid] [--enablerepo repoid] [--no-rpm-va] [--els] [--eus] [--debug] [--restart] [-y]
convert2rhel <subcommand> [-k activation_key | -c conf_file_path] [-o organization] [--pool pool_id | -a] [--disablerepo repoid] [--enablerepo repoid] [--serverurl url] [--no-rpm-va] [--els] [--eus] [--debug] [--restart] [-y]
.SH DESCRIPTION
The Convert2RHEL utility automates converting Red Hat Enterprise Linux derivative distributions to Red Hat Enterprise Linux. The whole conversion procedure is performed on the running RHEL derivative OS installation and a restart is needed at the end of the conversion to boot into the RHEL kernel. The utility replaces the original OS packages with the RHEL ones. Available are conversions of CentOS Linux 7/8, Oracle Linux 7/8, Scientific Linux 7, Alma Linux 8, and Rocky Linux 8 to the respective major version of RHEL.

.SH OPTIONS
.TP
\fB\-\-version\fR
Show convert2rhel version and exit.

.TP
\fB\-\-debug\fR
Print traceback in case of an abnormal exit and messages that could help find
an issue.

.SH
SUBCOMMANDS
.TP
\fBconvert2rhel\fR \fI\,analyze\/\fR
Run all Convert2RHEL initial checks up until the Point of no Return (PONR) and generate a report with the findings. A rollback is initiated after the checks to put the system back in the original state.
.TP
\fBconvert2rhel\fR \fI\,convert\/\fR
Convert the system. If no subcommand is given, 'convert' is used as a default.

.SH COMMAND \fI\,'convert2rhel analyze'\/\fR
usage:
convert2rhel [\-\-version] [\-h]
convert2rhel analyze [\-u username] [\-p password | \-c conf_file_path] [\-\-pool pool_id | \-a] [\-\-disablerepo repoid] [\-\-enablerepo repoid] [\-\-serverurl url] [\-\-no\-rpm\-va] [\-\-els] [\-\-eus] [\-\-debug] [\-\-restart] [\-y]
convert2rhel analyze [\-\-no\-rhsm] [\-\-disablerepo repoid] [\-\-enablerepo repoid] [\-\-no\-rpm\-va] [\-\-els] [\-\-eus] [\-\-debug] [\-\-restart] [\-y]
convert2rhel analyze [\-k activation_key | \-c conf_file_path] [\-o organization] [\-\-pool pool_id | \-a] [\-\-disablerepo repoid] [\-\-enablerepo repoid] [\-\-serverurl url] [\-\-no\-rpm\-va] [\-\-els] [\-\-eus] [\-\-debug] [\-\-restart] [\-y]

.SH OPTIONS \fI\,'convert2rhel analyze'\/\fR
.TP
\fB\-\-version\fR
Show convert2rhel version and exit.

.TP
\fB\-\-debug\fR
Print traceback in case of an abnormal exit and messages that could help find
an issue.

.TP
\fB\-\-no\-rpm\-va\fR
Skip gathering changed rpm files using 'rpm \-Va'. By default it's performed
before and after the conversion with the output stored in log files rpm_va.log
and rpm_va_after_conversion.log. At the end of the conversion, these logs are
compared to show you what rpm files have been affected by the conversion.
Cannot be used with analyze subcommand. The environment variable
CONVERT2RHEL_INCOMPLETE_ROLLBACK needs to be set to 1 to use this
argument.

.TP
\fB\-\-els\fR
Utilize Extended Lifecycle Support (els) repositories. Necessary for RHEL 7
servers to land on a system patched with the latest security errata.

.TP
\fB\-\-eus\fR
Automatically recognize the system as eus, utilizing eus repos. 8.6 systems do
not require this option as they are recognized as eus automatically. This
option is meant for 8.8+ systems.

.TP
\fB\-\-enablerepo\fR \fI\,repoidglob\/\fR
Enable specific repositories by ID or glob. For more repositories to enable,
use this option multiple times. If you don't use the \-\-no\-rhsm option, you can
use this option to override the default RHEL repoids that convert2rhel enables
through subscription\-manager.

.TP
\fB\-\-disablerepo\fR \fI\,repoidglob\/\fR
Disable specific repositories by ID or glob. For more repositories to disable,
use this option multiple times. This option defaults to all repositories
('*').

.TP
\fB\-r\fR, \fB\-\-restart\fR
Restart the system when it is successfully converted to RHEL to boot the new
RHEL kernel. It has no effect when used with the 'analyze' subcommand.

.TP
\fB\-y\fR
Answer yes to all yes/no questions the tool asks.

.SH SUBSCRIPTION MANAGER OPTIONS \fI\,'convert2rhel analyze'\/\fR
The following options are specific to using subscription\-manager.

.TP
\fB\-u\fR \fI\,USERNAME\/\fR, \fB\-\-username\fR \fI\,USERNAME\/\fR
Username for the subscription\-manager. If neither \-\-username nor \-\-activation\-
key option is used, the user is asked to enter the username.

.TP
\fB\-p\fR \fI\,PASSWORD\/\fR, \fB\-\-password\fR \fI\,PASSWORD\/\fR
Password for the subscription\-manager. If \-\-password, \-\-config\-file or
\-\-activationkey are not used, the user is asked to enter the password. We
recommend using the \-\-config\-file option instead to prevent leaking the
password through a list of running processes.

.TP
\fB\-f\fR \fI\,PASSWORD_FROM_FILE\/\fR, \fB\-\-password\-from\-file\fR \fI\,PASSWORD_FROM_FILE\/\fR
File containing password for the subscription\-manager in the plain text form.
It's an alternative to the \-\-password option. Deprecated, use \-\-config\-file
instead.

.TP
\fB\-k\fR \fI\,ACTIVATIONKEY\/\fR, \fB\-\-activationkey\fR \fI\,ACTIVATIONKEY\/\fR
Activation key used for the system registration by the subscription\-manager.
It requires to have the \-\-org option specified. We recommend using the
\-\-config\-file option instead to prevent leaking the activation key through a
list of running processes.

.TP
\fB\-o\fR \fI\,ORG\/\fR, \fB\-\-org\fR \fI\,ORG\/\fR
Organization with which the system will be registered by the subscription\-
manager. A list of available organizations is possible to obtain by running
'subscription\-manager orgs'. From the listed pairs Name:Key, use the Key here.

.TP
\fB\-c\fR \fI\,CONFIG_FILE\/\fR, \fB\-\-config\-file\fR \fI\,CONFIG_FILE\/\fR
The configuration file is an optional way to safely pass either a user
password or an activation key to the subscription\-manager to register the
system. This is more secure than passing these values through the
\-\-activationkey or \-\-password option, which might leak the values through a
list of running processes. You can edit the pre\-installed configuration file
template at /etc/convert2rhel.ini or create a new configuration file at
~/.convert2rhel.ini. The convert2rhel utility loads the configuration from
either of those locations, the latter having preference over the former.
Alternatively, you can specify a path to the configuration file using the
\-\-config\-file option to override other configurations.

.TP
\fB\-a\fR, \fB\-\-auto\-attach\fR
Automatically attach compatible subscriptions to the system.

.TP
\fB\-\-pool\fR \fI\,POOL\/\fR
Subscription pool ID. A list of the available subscriptions is possible to
obtain by running 'subscription\-manager list \-\-available'. If no pool ID is
provided, the \-\-auto option is used

.TP
\fB\-\-serverurl\fR \fI\,SERVERURL\/\fR
Hostname of the subscription service to be used when registering the system
with subscription\-manager. The default is the Customer Portal Subscription
Management service (subscription.rhsm.redhat.com). It is not to be used to
specify a Satellite server. For that, read the product documentation at
https://access.redhat.com/.

.TP
\fB\-\-keep\-rhsm\fR
Deprecated. This option has no effect. Convert2rhel will now use whatever
subscription\-manager packages are present on the system.

.SH ALTERNATIVE INSTALLATION OPTIONS \fI\,'convert2rhel analyze'\/\fR
The following options are required if you do not intend on using subscription\-manager.

.TP
\fB\-\-disable\-submgr\fR
Replaced by \-\-no\-rhsm. Both options have the same effect.

.TP
\fB\-\-no\-rhsm\fR
Do not use the subscription\-manager, use custom repositories instead. See
\-\-enablerepo/\-\-disablerepo options. Without this option, the subscription\-
manager is used to access RHEL repositories by default. Using this option
requires to have the \-\-enablerepo specified.

.SH COMMAND \fI\,'convert2rhel convert'\/\fR
usage:
convert2rhel [\-\-version] [\-h]
convert2rhel convert [\-u username] [\-p password | \-c conf_file_path] [\-\-pool pool_id | \-a] [\-\-disablerepo repoid] [\-\-enablerepo repoid] [\-\-serverurl url] [\-\-no\-rpm\-va] [\-\-els] [\-\-eus] [\-\-debug] [\-\-restart] [\-y]
convert2rhel convert [\-\-no\-rhsm] [\-\-disablerepo repoid] [\-\-enablerepo repoid] [\-\-no\-rpm\-va] [\-\-els] [\-\-eus] [\-\-debug] [\-\-restart] [\-y]
convert2rhel convert [\-k activation_key | \-c conf_file_path] [\-o organization] [\-\-pool pool_id | \-a] [\-\-disablerepo repoid] [\-\-enablerepo repoid] [\-\-serverurl url] [\-\-no\-rpm\-va] [\-\-els] [\-\-eus] [\-\-debug] [\-\-restart] [\-y]

.SH OPTIONS \fI\,'convert2rhel convert'\/\fR
.TP
\fB\-\-version\fR
Show convert2rhel version and exit.

.TP
\fB\-\-debug\fR
Print traceback in case of an abnormal exit and messages that could help find
an issue.

.TP
\fB\-\-no\-rpm\-va\fR
Skip gathering changed rpm files using 'rpm \-Va'. By default it's performed
before and after the conversion with the output stored in log files rpm_va.log
and rpm_va_after_conversion.log. At the end of the conversion, these logs are
compared to show you what rpm files have been affected by the conversion.
Cannot be used with analyze subcommand. The environment variable
CONVERT2RHEL_INCOMPLETE_ROLLBACK needs to be set to 1 to use this
argument.

.TP
\fB\-\-els\fR
Utilize Extended Lifecycle Support (els) repositories. Necessary for RHEL 7
servers to land on a system patched with the latest security errata.

.TP
\fB\-\-eus\fR
Automatically recognize the system as eus, utilizing eus repos. 8.6 systems do
not require this option as they are recognized as eus automatically. This
option is meant for 8.8+ systems.

.TP
\fB\-\-enablerepo\fR \fI\,repoidglob\/\fR
Enable specific repositories by ID or glob. For more repositories to enable,
use this option multiple times. If you don't use the \-\-no\-rhsm option, you can
use this option to override the default RHEL repoids that convert2rhel enables
through subscription\-manager.

.TP
\fB\-\-disablerepo\fR \fI\,repoidglob\/\fR
Disable specific repositories by ID or glob. For more repositories to disable,
use this option multiple times. This option defaults to all repositories
('*').

.TP
\fB\-r\fR, \fB\-\-restart\fR
Restart the system when it is successfully converted to RHEL to boot the new
RHEL kernel. It has no effect when used with the 'analyze' subcommand.

.TP
\fB\-y\fR
Answer yes to all yes/no questions the tool asks.

.SH SUBSCRIPTION MANAGER OPTIONS \fI\,'convert2rhel convert'\/\fR
The following options are specific to using subscription\-manager.

.TP
\fB\-u\fR \fI\,USERNAME\/\fR, \fB\-\-username\fR \fI\,USERNAME\/\fR
Username for the subscription\-manager. If neither \-\-username nor \-\-activation\-
key option is used, the user is asked to enter the username.

.TP
\fB\-p\fR \fI\,PASSWORD\/\fR, \fB\-\-password\fR \fI\,PASSWORD\/\fR
Password for the subscription\-manager. If \-\-password, \-\-config\-file or
\-\-activationkey are not used, the user is asked to enter the password. We
recommend using the \-\-config\-file option instead to prevent leaking the
password through a list of running processes.

.TP
\fB\-f\fR \fI\,PASSWORD_FROM_FILE\/\fR, \fB\-\-password\-from\-file\fR \fI\,PASSWORD_FROM_FILE\/\fR
File containing password for the subscription\-manager in the plain text form.
It's an alternative to the \-\-password option. Deprecated, use \-\-config\-file
instead.

.TP
\fB\-k\fR \fI\,ACTIVATIONKEY\/\fR, \fB\-\-activationkey\fR \fI\,ACTIVATIONKEY\/\fR
Activation key used for the system registration by the subscription\-manager.
It requires to have the \-\-org option specified. We recommend using the
\-\-config\-file option instead to prevent leaking the activation key through a
list of running processes.

.TP
\fB\-o\fR \fI\,ORG\/\fR, \fB\-\-org\fR \fI\,ORG\/\fR
Organization with which the system will be registered by the subscription\-
manager. A list of available organizations is possible to obtain by running
'subscription\-manager orgs'. From the listed pairs Name:Key, use the Key here.

.TP
\fB\-c\fR \fI\,CONFIG_FILE\/\fR, \fB\-\-config\-file\fR \fI\,CONFIG_FILE\/\fR
The configuration file is an optional way to safely pass either a user
password or an activation key to the subscription\-manager to register the
system. This is more secure than passing these values through the
\-\-activationkey or \-\-password option, which might leak the values through a
list of running processes. You can edit the pre\-installed configuration file
template at /etc/convert2rhel.ini or create a new configuration file at
~/.convert2rhel.ini. The convert2rhel utility loads the configuration from
either of those locations, the latter having preference over the former.
Alternatively, you can specify a path to the configuration file using the
\-\-config\-file option to override other configurations.

.TP
\fB\-a\fR, \fB\-\-auto\-attach\fR
Automatically attach compatible subscriptions to the system.

.TP
\fB\-\-pool\fR \fI\,POOL\/\fR
Subscription pool ID. A list of the available subscriptions is possible to
obtain by running 'subscription\-manager list \-\-available'. If no pool ID is
provided, the \-\-auto option is used

.TP
\fB\-\-serverurl\fR \fI\,SERVERURL\/\fR
Hostname of the subscription service to be used when registering the system
with subscription\-manager. The default is the Customer Portal Subscription
Management service (subscription.rhsm.redhat.com). It is not to be used to
specify a Satellite server. For that, read the product documentation at
https://access.redhat.com/.

.TP
\fB\-\-keep\-rhsm\fR
Deprecated. This option has no effect. Convert2rhel will now use whatever
subscription\-manager packages are present on the system.

.SH ALTERNATIVE INSTALLATION OPTIONS \fI\,'convert2rhel convert'\/\fR
The following options are required if you do not intend on using subscription\-manager.

.TP
\fB\-\-disable\-submgr\fR
Replaced by \-\-no\-rhsm. Both options have the same effect.

.TP
\fB\-\-no\-rhsm\fR
Do not use the subscription\-manager, use custom repositories instead. See
\-\-enablerepo/\-\-disablerepo options. Without this option, the subscription\-
manager is used to access RHEL repositories by default. Using this option
requires to have the \-\-enablerepo specified.
21 changes: 15 additions & 6 deletions scripts/manpage_generation.sh
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not enough to check with the previous version. I would like to see the manpages generated and the difference checked to see if there are any changes. Not just if the version changed.

As this will fail every time we submit a new version it's already too late to update too.

Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,26 @@
# Directory to store the generated manpages
MANPAGE_DIR="man"

echo Generating manpages
# Ensure the manpage directory exists
mkdir -p "$MANPAGE_DIR"
Comment on lines +6 to +7
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM


VER=$(grep -oP '^Version:\s+\K\S+' packaging/convert2rhel.spec)
echo "Generating manpages"

echo Generating for version $VER
# Generate a file with convert2rhel synopsis for argparse-manpage
/usr/bin/python -c 'from convert2rhel import toolopts; print("[synopsis]\n."+toolopts.CLI.usage())' > man/synopsis
python -c 'from convert2rhel import toolopts; print("[synopsis]\n."+toolopts.CLI.usage())' > "$MANPAGE_DIR/synopsis"

/usr/bin/python -m pip install argparse-manpage six pexpect
# Extract the current version from the spec file
CURRENT_VER=$(grep -oP '^Version:\s+\K\S+' packaging/convert2rhel.spec)
echo "Current version: $CURRENT_VER"

# Generate the manpage using argparse-manpage
PYTHONPATH=. /usr/bin/python /home/runner/.local/bin/argparse-manpage --pyfile man/__init__.py --function get_parser --manual-title="General Commands Manual" --description="Automates the conversion of Red Hat Enterprise Linux derivative distributions to Red Hat Enterprise Linux." --project-name "convert2rhel $VER" --prog="convert2rhel" --include man/distribution --include man/synopsis > "$MANPAGE_DIR/convert2rhel.8"

git status
# Check for differences in the generated manpage
if ! git diff --quiet HEAD -- "$MANPAGE_DIR/convert2rhel.8"; then
echo "Manpages are outdated. Please update them."
exit 1
else
echo "Manpages are up-to-date."
exit 0
fi
Comment on lines +22 to +28
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect!

Loading