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

Add modulemd-validator man page #445

Merged
merged 6 commits into from
Feb 10, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
1 change: 1 addition & 0 deletions .travis/archlinux/Dockerfile.deps.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ RUN pacman -Syu --needed --noconfirm \
glib2-docs \
gobject-introspection \
gtk-doc \
help2man \
libyaml \
meson \
python-gobject \
Expand Down
1 change: 1 addition & 0 deletions .travis/centos/Dockerfile.deps.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ ifelse(eval(_RELEASE_ >= 8), 1, `dnl
glib2-doc \
gobject-introspection-devel \
gtk-doc \
help2man \
libyaml-devel \
meson \
ninja-build \
Expand Down
1 change: 1 addition & 0 deletions .travis/fedora/Dockerfile.deps.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ RUN dnf -y --setopt=install_weak_deps=False --setopt=tsflags='' --skip-broken i
glib2-doc \
gobject-introspection-devel \
gtk-doc \
help2man \
libyaml-devel \
meson \
ninja-build \
Expand Down
1 change: 1 addition & 0 deletions .travis/mageia/Dockerfile.deps.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ RUN dnf -y --setopt=install_weak_deps=False --setopt=tsflags='' install \
/usr/share/gtk-doc/html/glib/index.html \
gobject-introspection-devel \
gtk-doc \
help2man \
libyaml-devel \
meson \
ninja-build \
Expand Down
1 change: 1 addition & 0 deletions .travis/openmandriva/Dockerfile.deps.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ RUN dnf -y --setopt=install_weak_deps=False --setopt=tsflags='' install \
clang \
clang-analyzer \
cmake \
help2man \
meson \
ninja \
rpmdevtools \
Expand Down
1 change: 1 addition & 0 deletions .travis/opensuse/Dockerfile.deps.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ RUN zypper install --no-confirm --no-recommends \
glib2-devel \
gobject-introspection-devel \
gtk-doc \
help2man \
libyaml-devel \
meson \
ninja \
Expand Down
2 changes: 2 additions & 0 deletions libmodulemd.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ BuildRequires: python3-gobject-base
%ifarch %{valgrind_arches}
BuildRequires: valgrind
%endif
BuildRequires: help2man

# Patches

Expand Down Expand Up @@ -134,6 +135,7 @@ mv %{buildroot}%{_bindir}/modulemd-validator \
%else
%{_bindir}/modulemd-validator
%endif
%{_mandir}/man1/modulemd-validator.1*
%{_libdir}/%{name}.so.2*
%dir %{_libdir}/girepository-1.0
%{_libdir}/girepository-1.0/Modulemd-2.0.typelib
Expand Down
3 changes: 3 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ if with_docs
endif
endif

with_manpages = get_option('with_manpages')
help2man = find_program('help2man', required: with_manpages)


# Check whether this version of glib has the GDate autoptr defined
gdate_check = '''#include <glib.h>
Expand Down
8 changes: 5 additions & 3 deletions meson_options.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,16 @@ option('skip_introspection', type : 'boolean', value : false,
description : 'Do not generate GObject Introspection data.')

option('test_dirty_git', type : 'boolean', value : false,
description : 'Check whether the automatic formatting tools have made changes. Used during CI to verify coding style compliance')
description : 'Check whether the automatic formatting tools have made changes. Used during CI to verify coding style compliance.')

option('test_installed_lib', type : 'boolean', value : false,
description : 'Build only the test suite and run it against a copy of libmodulemd installed on the local system.')

option('with_docs', type : 'boolean', value : true,
description : 'Build API documentation.')

option('with_py2', type : 'boolean', value : false,
description : 'Build Python 2 language bindings and run Python 2 tests')
option('with_manpages', type : 'feature', value : 'auto',
description : 'Build manual pages for included executables.')

option('with_py2', type : 'boolean', value : false,
description : 'Build Python 2 language bindings and run Python 2 tests.')
13 changes: 13 additions & 0 deletions modulemd/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -529,3 +529,16 @@ if with_docs
install : true,
)
endif

help2man_opts = [
'--no-info',
'--section=1',
]
custom_target(

Choose a reason for hiding this comment

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

I think this target needs to be under the with_manpages condition, as it can't be generated when help2man is not found.

Copy link
Collaborator

Choose a reason for hiding this comment

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

@jon-turney

from meson.build

with_manpages = get_option('with_manpages')
help2man = find_program('help2man', required: with_manpages)

This means that if with_manpages is set to enabled, the meson configure step will fail with an error (since the program is required) if help2man cannot be located. If with_manpages is auto (the default), it means that it will be built if help2man happens to be available, but if it's not, the help2man variable will be a disabler() object. A disabler() object means that any target that requires it will simply be skipped. If with_manpages is disabled, a disabler() object is always returned.

Copy link

@jon-turney jon-turney Feb 11, 2020

Choose a reason for hiding this comment

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

Thanks.

But I'm not sure if that's quite right. Don't you need to write find_program('help2man', required: with_manpages, disabler: true) to get a disabler object?

In any event, this doesn't appear to be currently working as you expect: see https://travis-ci.org/jon-turney/meson-corpus-test/jobs/648623888.

Is this a meson regression (i.e. you've seen this work as expected for some meson version?). A bug? Or a problem with the meson documentation?

'modulemd-validator.1',
output: 'modulemd-validator.1',
command: [
help2man, help2man_opts, '--output=@OUTPUT@', modulemd_validator,
],
install: true,
install_dir: join_paths(get_option('mandir'), 'man1'))
13 changes: 12 additions & 1 deletion modulemd/modulemd-validator.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,16 @@ struct validator_options

struct validator_options options = { 0, NULL };

static gboolean
print_version (const gchar *option_name,
const gchar *value,
gpointer data,
GError **error)
{
g_fprintf (stdout, "modulemd-validator %s\n", modulemd_get_version ());
exit (1);
}

static gboolean
set_verbosity (const gchar *option_name,
const gchar *value,
Expand Down Expand Up @@ -89,9 +99,10 @@ set_verbosity (const gchar *option_name,

// clang-format off
static GOptionEntry entries[] = {
{ "debug", 0, G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK, set_verbosity, "Output debugging messages", NULL },
{ "quiet", 'q', G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK, set_verbosity, "Print no output", NULL },
{ "verbose", 'v', G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK, set_verbosity, "Be verbose", NULL },
{ "debug", 0, G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK, set_verbosity, "Output debugging messages", NULL },
{ "version", 'V', G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK, print_version, "Print version number, then exit", NULL },
{ G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &options.filenames, "Files to be validated", NULL },
{ NULL } };
// clang-format on
Expand Down