From 932a5b5499ae2faffc77cee6f87a4a9d6e1f13b0 Mon Sep 17 00:00:00 2001 From: Pavel Hrdina Date: Tue, 28 Jul 2020 17:51:53 +0200 Subject: [PATCH] meson: generate and distribute spec files and AUTHORS Signed-off-by: Pavel Hrdina Reviewed-by: Peter Krempa Reviewed-by: Neal Gompa --- AUTHORS.in | 2 +- Makefile.am | 19 -------------- configure.ac | 3 +-- meson.build | 48 ++++++++++++++++++++++++++++++++++++ scripts/meson-dist.py | 14 +++++++++++ scripts/meson-gen-authors.py | 8 ++++++ scripts/meson.build | 2 ++ 7 files changed, 74 insertions(+), 22 deletions(-) create mode 100755 scripts/meson-dist.py create mode 100755 scripts/meson-gen-authors.py diff --git a/AUTHORS.in b/AUTHORS.in index 443006640f..f4ab42ea9f 100644 --- a/AUTHORS.in +++ b/AUTHORS.in @@ -93,7 +93,7 @@ Stefan de Konink Takahashi Tomohiro Tatsuro Enokura -#contributorslist# +@contributorslist@ The libvirt logo was designed by Diana Fong diff --git a/Makefile.am b/Makefile.am index e6a37deb4a..7490acbcfb 100644 --- a/Makefile.am +++ b/Makefile.am @@ -31,24 +31,5 @@ rpm: clean srpm: clean @(unset CDPATH ; $(MAKE) dist && rpmbuild -ts $(distdir).tar.xz) -dist-hook: gen-AUTHORS - -.PHONY: gen-AUTHORS -gen-AUTHORS: - $(AM_V_GEN)\ - if test -d $(srcdir)/.git; then \ - ( \ - cd $(srcdir) && \ - git log --pretty=format:'%aN <%aE>' | sort -u \ - ) > all.list && \ - sort -u $(srcdir)/AUTHORS.in > maint.list && \ - comm -23 all.list maint.list > contrib.list && \ - contrib="`cat contrib.list`" && \ - perl -p -e "s/#contributorslist#// and print '$$contrib'" \ - < $(srcdir)/AUTHORS.in > $(distdir)/AUTHORS-tmp && \ - mv -f $(distdir)/AUTHORS-tmp $(distdir)/AUTHORS && \ - rm -f all.list maint.list contrib.list; \ - fi - ci-%: $(MAKE) -C $(srcdir)/ci/ $@ diff --git a/configure.ac b/configure.ac index b1a7ceff6e..a227555b89 100644 --- a/configure.ac +++ b/configure.ac @@ -108,6 +108,5 @@ AC_CONFIG_FILES([run], AC_CONFIG_FILES([\ Makefile \ .color_coded \ - .ycm_extra_conf.py \ - libvirt.spec mingw-libvirt.spec]) + .ycm_extra_conf.py]) AC_OUTPUT diff --git a/meson.build b/meson.build index 2f2868f775..1ab88acd0d 100644 --- a/meson.build +++ b/meson.build @@ -2263,6 +2263,54 @@ foreach file : pkgconfig_files ) endforeach + +# generate dist files + +if git + spec_files = [ + 'libvirt.spec.in', + 'mingw-libvirt.spec.in', + ] + + spec_conf = configuration_data() + spec_conf.set('VERSION', meson.project_version()) + + foreach file : spec_files + configure_file( + input: file, + output: '@BASENAME@', + configuration: spec_conf, + ) + endforeach + + authors = run_command(python3_prog, meson_gen_authors_prog.path(), env: runutf8) + authors_file = 'AUTHORS.in' + + authors_conf = configuration_data() + authors_conf.set('contributorslist', authors.stdout()) + + configure_file( + input: authors_file, + output: '@BASENAME@', + configuration: authors_conf, + ) + + # Using return values from configure_file in add_dist_script is possible since 0.55.0 + dist_files = [ + 'libvirt.spec', + 'mingw-libvirt.spec', + 'AUTHORS', + ] + + foreach file : dist_files + meson.add_dist_script( + meson_python_prog.path(), python3_prog.path(), meson_dist_prog.path(), + meson.build_root(), file + ) + endforeach +endif + + # generate meson-config.h file configure_file(output: 'meson-config.h', configuration: conf) diff --git a/scripts/meson-dist.py b/scripts/meson-dist.py new file mode 100755 index 0000000000..a1d36c2533 --- /dev/null +++ b/scripts/meson-dist.py @@ -0,0 +1,14 @@ +#!/usr/bin/env python3 + +import os +import sys + +meson_build_root = sys.argv[1] +file_name = sys.argv[2] + +meson_dist_root = os.environ['MESON_DIST_ROOT'] + +os.system('cp {0} {1}'.format( + os.path.join(meson_build_root, file_name), + os.path.join(meson_dist_root, file_name) +)) diff --git a/scripts/meson-gen-authors.py b/scripts/meson-gen-authors.py new file mode 100755 index 0000000000..f58bf6383b --- /dev/null +++ b/scripts/meson-gen-authors.py @@ -0,0 +1,8 @@ +#!/usr/bin/env python3 + +import os + +meson_source_root = os.environ['MESON_SOURCE_ROOT'] + +os.chdir(meson_source_root) +os.system('git log --pretty=format:"%aN <%aE>" | sort -u') diff --git a/scripts/meson.build b/scripts/meson.build index 74662db4b0..39b0e899f4 100644 --- a/scripts/meson.build +++ b/scripts/meson.build @@ -18,6 +18,8 @@ scripts = [ 'header-ifdef.py', 'hvsupport.py', 'hyperv_wmi_generator.py', + 'meson-dist.py', + 'meson-gen-authors.py', 'meson-gen-def.py', 'meson-gen-sym.py', 'meson-html-gen.py',