Skip to content

Commit 932a5b5

Browse files
committed
meson: generate and distribute spec files and AUTHORS
Signed-off-by: Pavel Hrdina <phrdina@redhat.com> Reviewed-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Neal Gompa <ngompa13@gmail.com>
1 parent c3669c8 commit 932a5b5

File tree

7 files changed

+74
-22
lines changed

7 files changed

+74
-22
lines changed

AUTHORS.in

+1-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ Stefan de Konink <dekonink@kinkrsoftware.nl>
9393
Takahashi Tomohiro <takatom@jp.fujitsu.com>
9494
Tatsuro Enokura <fj7716hz@aa.jp.fujitsu.com>
9595

96-
#contributorslist#
96+
@contributorslist@
9797

9898
The libvirt logo was designed by Diana Fong
9999

Makefile.am

-19
Original file line numberDiff line numberDiff line change
@@ -31,24 +31,5 @@ rpm: clean
3131
srpm: clean
3232
@(unset CDPATH ; $(MAKE) dist && rpmbuild -ts $(distdir).tar.xz)
3333

34-
dist-hook: gen-AUTHORS
35-
36-
.PHONY: gen-AUTHORS
37-
gen-AUTHORS:
38-
$(AM_V_GEN)\
39-
if test -d $(srcdir)/.git; then \
40-
( \
41-
cd $(srcdir) && \
42-
git log --pretty=format:'%aN <%aE>' | sort -u \
43-
) > all.list && \
44-
sort -u $(srcdir)/AUTHORS.in > maint.list && \
45-
comm -23 all.list maint.list > contrib.list && \
46-
contrib="`cat contrib.list`" && \
47-
perl -p -e "s/#contributorslist#// and print '$$contrib'" \
48-
< $(srcdir)/AUTHORS.in > $(distdir)/AUTHORS-tmp && \
49-
mv -f $(distdir)/AUTHORS-tmp $(distdir)/AUTHORS && \
50-
rm -f all.list maint.list contrib.list; \
51-
fi
52-
5334
ci-%:
5435
$(MAKE) -C $(srcdir)/ci/ $@

configure.ac

+1-2
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,5 @@ AC_CONFIG_FILES([run],
108108
AC_CONFIG_FILES([\
109109
Makefile \
110110
.color_coded \
111-
.ycm_extra_conf.py \
112-
libvirt.spec mingw-libvirt.spec])
111+
.ycm_extra_conf.py])
113112
AC_OUTPUT

meson.build

+48
Original file line numberDiff line numberDiff line change
@@ -2263,6 +2263,54 @@ foreach file : pkgconfig_files
22632263
)
22642264
endforeach
22652265

2266+
2267+
# generate dist files
2268+
2269+
if git
2270+
spec_files = [
2271+
'libvirt.spec.in',
2272+
'mingw-libvirt.spec.in',
2273+
]
2274+
2275+
spec_conf = configuration_data()
2276+
spec_conf.set('VERSION', meson.project_version())
2277+
2278+
foreach file : spec_files
2279+
configure_file(
2280+
input: file,
2281+
output: '@BASENAME@',
2282+
configuration: spec_conf,
2283+
)
2284+
endforeach
2285+
2286+
authors = run_command(python3_prog, meson_gen_authors_prog.path(), env: runutf8)
2287+
authors_file = 'AUTHORS.in'
2288+
2289+
authors_conf = configuration_data()
2290+
authors_conf.set('contributorslist', authors.stdout())
2291+
2292+
configure_file(
2293+
input: authors_file,
2294+
output: '@BASENAME@',
2295+
configuration: authors_conf,
2296+
)
2297+
2298+
# Using return values from configure_file in add_dist_script is possible since 0.55.0
2299+
dist_files = [
2300+
'libvirt.spec',
2301+
'mingw-libvirt.spec',
2302+
'AUTHORS',
2303+
]
2304+
2305+
foreach file : dist_files
2306+
meson.add_dist_script(
2307+
meson_python_prog.path(), python3_prog.path(), meson_dist_prog.path(),
2308+
meson.build_root(), file
2309+
)
2310+
endforeach
2311+
endif
2312+
2313+
22662314
# generate meson-config.h file
22672315
configure_file(output: 'meson-config.h', configuration: conf)
22682316

scripts/meson-dist.py

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/usr/bin/env python3
2+
3+
import os
4+
import sys
5+
6+
meson_build_root = sys.argv[1]
7+
file_name = sys.argv[2]
8+
9+
meson_dist_root = os.environ['MESON_DIST_ROOT']
10+
11+
os.system('cp {0} {1}'.format(
12+
os.path.join(meson_build_root, file_name),
13+
os.path.join(meson_dist_root, file_name)
14+
))

scripts/meson-gen-authors.py

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/usr/bin/env python3
2+
3+
import os
4+
5+
meson_source_root = os.environ['MESON_SOURCE_ROOT']
6+
7+
os.chdir(meson_source_root)
8+
os.system('git log --pretty=format:"%aN <%aE>" | sort -u')

scripts/meson.build

+2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ scripts = [
1818
'header-ifdef.py',
1919
'hvsupport.py',
2020
'hyperv_wmi_generator.py',
21+
'meson-dist.py',
22+
'meson-gen-authors.py',
2123
'meson-gen-def.py',
2224
'meson-gen-sym.py',
2325
'meson-html-gen.py',

0 commit comments

Comments
 (0)