Skip to content

Commit

Permalink
Add modulemd-validator man page
Browse files Browse the repository at this point in the history
Signed-off-by: Merlin Mathesius <mmathesi@redhat.com>
  • Loading branch information
mmathesius committed Feb 7, 2020
1 parent ef551a2 commit 049ba37
Show file tree
Hide file tree
Showing 11 changed files with 37 additions and 1 deletion.
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 @@ -35,6 +35,7 @@ BuildRequires: valgrind
BuildRequires: glib2-doc
BuildRequires: rpm-devel
BuildRequires: file-devel
BuildRequires: help2man

# Patches

Expand Down Expand Up @@ -116,6 +117,7 @@ export MMD_SKIP_VALGRIND=1
%license COPYING
%doc README.md
%{_bindir}/modulemd-validator
%{_mandir}/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_manpage = get_option('with_manpage')
help2man = find_program('help2man', required: with_manpage)


# Check whether this version of glib has the GDate autoptr defined
gdate_check = '''#include <glib.h>
Expand Down
1 change: 1 addition & 0 deletions meson_options.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@ option('skip_introspection', type : 'boolean', value : false)
option('test_dirty_git', type : 'boolean', value : false)
option('test_installed_lib', type : 'boolean', value : false)
option('with_docs', type : 'boolean', value : true)
option('with_manpage', type : 'feature', value : 'auto')
option('with_py2_overrides', type : 'boolean', value : true)
option('with_py3_overrides', type : 'boolean', value : true)
13 changes: 13 additions & 0 deletions modulemd/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -527,3 +527,16 @@ if with_docs
install : true,
)
endif

help2man_opts = [
'--no-info',
'--section=1',
]
custom_target(
'modulemd-validator.1',
output: 'modulemd-validator.1',
command: [
help2man, help2man_opts, '--output=@OUTPUT@', modulemd_validator,
],
install: true,
install_dir: join_paths(meson.current_build_dir(), 'man/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

0 comments on commit 049ba37

Please sign in to comment.