aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/markdown/Gnome-module.md4
-rw-r--r--docs/markdown/Release-notes-for-0.41.0.md4
-rw-r--r--docs/markdown/Release-notes-for-0.42.0.md5
-rw-r--r--mesonbuild/modules/gnome.py2
-rw-r--r--mesonbuild/scripts/dist.py36
-rw-r--r--mesonbuild/scripts/yelphelper.py15
-rwxr-xr-xrun_project_tests.py3
-rwxr-xr-xrun_unittests.py46
-rw-r--r--test cases/frameworks/13 yelp/help/meson.build8
-rw-r--r--test cases/frameworks/13 yelp/installed_files.txt7
-rw-r--r--test cases/windows/1 basic/prog.c2
11 files changed, 106 insertions, 26 deletions
diff --git a/docs/markdown/Gnome-module.md b/docs/markdown/Gnome-module.md
index 61b88ad..805ceaa 100644
--- a/docs/markdown/Gnome-module.md
+++ b/docs/markdown/Gnome-module.md
@@ -127,9 +127,11 @@ This also creates two targets for translations `help-$project-update-po` and `he
* `sources`: list of pages
* `media`: list of media such as images
-* `symlink_media`: if media should be symlinked (requires newish yelp) defaults to `false`
+* `symlink_media`: if media should be symlinked not copied (defaults to `true` since 0.41.0)
* `languages`: list of languages for translations
+Note that very old versions of yelp may not support symlinked media; At least 3.10 should work.
+
*Added 0.36.0*
### gnome.gtkdoc()
diff --git a/docs/markdown/Release-notes-for-0.41.0.md b/docs/markdown/Release-notes-for-0.41.0.md
index eb565ab..1ddde95 100644
--- a/docs/markdown/Release-notes-for-0.41.0.md
+++ b/docs/markdown/Release-notes-for-0.41.0.md
@@ -11,7 +11,7 @@ Native support for linking against LLVM using the `dependency` function.
## vcs_tag keyword fallback is is now optional
-The `fallback` keyword in `vcs_tag` is now optional. If not given, its value
+The `fallback` keyword in `vcs_tag()` is now optional. If not given, its value
defaults to the return value of `meson.project_version()`.
## Better quoting of special characters in ninja command invocations
@@ -56,7 +56,7 @@ Targets for building rust now take a `rust_args` keyword.
Code coverage can be generated for tests by passing the `--cov` argument to
the `run_tests.py` test runner. Note, since multiple processes are used,
-coverage must be combined before producing a report (`coverage3 combine`.)
+coverage must be combined before producing a report (`coverage3 combine`).
## Reproducible builds
diff --git a/docs/markdown/Release-notes-for-0.42.0.md b/docs/markdown/Release-notes-for-0.42.0.md
index 5ea0d18..dcb86c3 100644
--- a/docs/markdown/Release-notes-for-0.42.0.md
+++ b/docs/markdown/Release-notes-for-0.42.0.md
@@ -7,4 +7,7 @@ short-description: Release notes for 0.42 (preliminary)
# New features
-Add features here as code is merged to master.
+## Distribution tarballs from Mercurial repositories
+
+Creating distribution tarballs can now be made out of projects based on
+Mercurial. As before, this remains possible only with the Ninja backend.
diff --git a/mesonbuild/modules/gnome.py b/mesonbuild/modules/gnome.py
index 7d539aa..fe85aa0 100644
--- a/mesonbuild/modules/gnome.py
+++ b/mesonbuild/modules/gnome.py
@@ -621,7 +621,7 @@ class GnomeModule(ExtensionModule):
langs = mesonlib.stringlistify(kwargs.pop('languages', []))
media = mesonlib.stringlistify(kwargs.pop('media', []))
- symlinks = kwargs.pop('symlink_media', False)
+ symlinks = kwargs.pop('symlink_media', True)
if not isinstance(symlinks, bool):
raise MesonException('symlink_media must be a boolean')
diff --git a/mesonbuild/scripts/dist.py b/mesonbuild/scripts/dist.py
index 325a882..cb3bbe2 100644
--- a/mesonbuild/scripts/dist.py
+++ b/mesonbuild/scripts/dist.py
@@ -13,6 +13,7 @@
# limitations under the License.
+import lzma
import os
import shutil
import subprocess
@@ -29,10 +30,11 @@ def create_hash(fname):
m = hashlib.sha256()
m.update(open(fname, 'rb').read())
with open(hashname, 'w') as f:
- f.write('%s %s\n' % (m.hexdigest(), os.path.split(fname)[-1]))
+ f.write('%s %s\n' % (m.hexdigest(), os.path.basename(fname)))
+
def create_zip(zipfilename, packaging_dir):
- prefix = os.path.split(packaging_dir)[0]
+ prefix = os.path.dirname(packaging_dir)
removelen = len(prefix) + 1
with zipfile.ZipFile(zipfilename,
'w',
@@ -70,7 +72,8 @@ def process_submodules(dirname):
continue
del_gitfiles(os.path.join(dirname, v))
-def create_dist(dist_name, src_root, bld_root, dist_sub):
+
+def create_dist_git(dist_name, src_root, bld_root, dist_sub):
distdir = os.path.join(dist_sub, dist_name)
if os.path.exists(distdir):
shutil.rmtree(distdir)
@@ -81,13 +84,29 @@ def create_dist(dist_name, src_root, bld_root, dist_sub):
xzname = distdir + '.tar.xz'
# Should use shutil but it got xz support only in 3.5.
with tarfile.open(xzname, 'w:xz') as tf:
- tf.add(distdir, os.path.split(distdir)[1])
+ tf.add(distdir, dist_name)
# Create only .tar.xz for now.
# zipname = distdir + '.zip'
# create_zip(zipname, distdir)
shutil.rmtree(distdir)
return (xzname, )
+
+def create_dist_hg(dist_name, src_root, bld_root, dist_sub):
+ os.makedirs(dist_sub, exist_ok=True)
+
+ tarname = os.path.join(dist_sub, dist_name + '.tar')
+ xzname = tarname + '.xz'
+ subprocess.check_call(['hg', 'archive', '-R', src_root, '-S', '-t', 'tar', tarname])
+ with lzma.open(xzname, 'wb') as xf, open(tarname, 'rb') as tf:
+ shutil.copyfileobj(tf, xf)
+ os.unlink(tarname)
+ # Create only .tar.xz for now.
+ # zipname = os.path.join(dist_sub, dist_name + '.zip')
+ # subprocess.check_call(['hg', 'archive', '-R', src_root, '-S', '-t', 'zip', zipname])
+ return (xzname, )
+
+
def check_dist(packagename, meson_command):
print('Testing distribution package %s.' % packagename)
unpackdir = tempfile.mkdtemp()
@@ -132,10 +151,13 @@ def run(args):
dist_name = build.project_name + '-' + build.project_version
- if not os.path.isdir(os.path.join(src_root, '.git')):
- print('Dist currently only works with Git repos.')
+ if os.path.isdir(os.path.join(src_root, '.git')):
+ names = create_dist_git(dist_name, src_root, bld_root, dist_sub)
+ elif os.path.isdir(os.path.join(src_root, '.hg')):
+ names = create_dist_hg(dist_name, src_root, bld_root, dist_sub)
+ else:
+ print('Dist currently only works with Git or Mercurial repos.')
return 1
- names = create_dist(dist_name, src_root, bld_root, dist_sub)
if names is None:
return 1
error_count = 0
diff --git a/mesonbuild/scripts/yelphelper.py b/mesonbuild/scripts/yelphelper.py
index 47dfb71..978a870 100644
--- a/mesonbuild/scripts/yelphelper.py
+++ b/mesonbuild/scripts/yelphelper.py
@@ -74,13 +74,24 @@ def install_help(srcdir, blddir, sources, media, langs, install_dir, destdir, pr
if not os.path.exists(infile):
if lang == 'C':
mlog.warning('Media file "%s" did not exist in C directory' % m)
+ continue
elif symlinks:
srcfile = os.path.join(c_install_dir, m)
mlog.log('Symlinking %s to %s.' % (outfile, srcfile))
if '/' in m or '\\' in m:
os.makedirs(os.path.dirname(outfile), exist_ok=True)
- os.symlink(srcfile, outfile)
- continue
+ try:
+ try:
+ os.symlink(srcfile, outfile)
+ except FileExistsError:
+ os.remove(outfile)
+ os.symlink(srcfile, outfile)
+ continue
+ except (NotImplementedError, OSError):
+ mlog.warning('Symlinking not supported, falling back to copying')
+ else:
+ # Lang doesn't have media file so copy it over 'C' one
+ infile = os.path.join(srcdir, 'C', m)
mlog.log('Installing %s to %s' % (infile, outfile))
if '/' in m or '\\' in m:
os.makedirs(os.path.dirname(outfile), exist_ok=True)
diff --git a/run_project_tests.py b/run_project_tests.py
index 66d7eb0..3c89d75 100755
--- a/run_project_tests.py
+++ b/run_project_tests.py
@@ -214,7 +214,8 @@ def validate_install(srcdir, installdir, compiler):
expected[platform_fix_name(line.strip())] = False
# Check if expected files were found
for fname in expected:
- if os.path.exists(os.path.join(installdir, fname)):
+ file_path = os.path.join(installdir, fname)
+ if os.path.exists(file_path) or os.path.islink(file_path):
expected[fname] = True
for (fname, found) in expected.items():
if not found:
diff --git a/run_unittests.py b/run_unittests.py
index 95f418d..63462d8 100755
--- a/run_unittests.py
+++ b/run_unittests.py
@@ -1161,18 +1161,50 @@ class AllPlatformTests(BasePlatformTests):
self.build()
self.run_tests()
- def test_dist(self):
+ def test_dist_git(self):
if not shutil.which('git'):
raise unittest.SkipTest('Git not found')
+
+ def git_init(project_dir):
+ subprocess.check_call(['git', 'init'], cwd=project_dir)
+ subprocess.check_call(['git', 'config',
+ 'user.name', 'Author Person'], cwd=project_dir)
+ subprocess.check_call(['git', 'config',
+ 'user.email', 'teh_coderz@example.com'], cwd=project_dir)
+ subprocess.check_call(['git', 'add', 'meson.build', 'distexe.c'], cwd=project_dir)
+ subprocess.check_call(['git', 'commit', '-a', '-m', 'I am a project'], cwd=project_dir)
+
try:
- self.dist_impl()
+ self.dist_impl(git_init)
except PermissionError:
# When run under Windows CI, something (virus scanner?)
# holds on to the git files so cleaning up the dir
# fails sometimes.
pass
- def dist_impl(self):
+ def test_dist_hg(self):
+ if not shutil.which('hg'):
+ raise unittest.SkipTest('Mercurial not found')
+ if self.backend is not Backend.ninja:
+ raise unittest.SkipTest('Dist is only supported with Ninja')
+
+ def hg_init(project_dir):
+ subprocess.check_call(['hg', 'init'], cwd=project_dir)
+ with open(os.path.join(project_dir, '.hg', 'hgrc'), 'w') as f:
+ print('[ui]', file=f)
+ print('username=Author Person <teh_coderz@example.com>', file=f)
+ subprocess.check_call(['hg', 'add', 'meson.build', 'distexe.c'], cwd=project_dir)
+ subprocess.check_call(['hg', 'commit', '-m', 'I am a project'], cwd=project_dir)
+
+ try:
+ self.dist_impl(hg_init)
+ except PermissionError:
+ # When run under Windows CI, something (virus scanner?)
+ # holds on to the hg files so cleaning up the dir
+ # fails sometimes.
+ pass
+
+ def dist_impl(self, vcs_init):
# Create this on the fly because having rogue .git directories inside
# the source tree leads to all kinds of trouble.
with tempfile.TemporaryDirectory() as project_dir:
@@ -1189,13 +1221,7 @@ int main(int argc, char **argv) {
return 0;
}
''')
- subprocess.check_call(['git', 'init'], cwd=project_dir)
- subprocess.check_call(['git', 'config',
- 'user.name', 'Author Person'], cwd=project_dir)
- subprocess.check_call(['git', 'config',
- 'user.email', 'teh_coderz@example.com'], cwd=project_dir)
- subprocess.check_call(['git', 'add', 'meson.build', 'distexe.c'], cwd=project_dir)
- subprocess.check_call(['git', 'commit', '-a', '-m', 'I am a project'], cwd=project_dir)
+ vcs_init(project_dir)
self.init(project_dir)
self.build('dist')
distfile = os.path.join(self.distdir, 'disttest-1.4.3.tar.xz')
diff --git a/test cases/frameworks/13 yelp/help/meson.build b/test cases/frameworks/13 yelp/help/meson.build
index 7c6f01d..85bc980 100644
--- a/test cases/frameworks/13 yelp/help/meson.build
+++ b/test cases/frameworks/13 yelp/help/meson.build
@@ -3,5 +3,13 @@ gnome = import('gnome')
gnome.yelp('meson',
sources: 'index.page',
media: 'media/test.txt',
+ symlink_media: false,
+ languages: ['de', 'es'],
+)
+
+gnome.yelp('meson-symlink',
+ sources: 'index.page',
+ media: 'media/test.txt',
+ symlink_media: true,
languages: ['de', 'es'],
)
diff --git a/test cases/frameworks/13 yelp/installed_files.txt b/test cases/frameworks/13 yelp/installed_files.txt
index 59d2158..9fc097d 100644
--- a/test cases/frameworks/13 yelp/installed_files.txt
+++ b/test cases/frameworks/13 yelp/installed_files.txt
@@ -3,3 +3,10 @@ usr/share/help/C/meson/media/test.txt
usr/share/help/es/meson/index.page
usr/share/help/es/meson/media/test.txt
usr/share/help/de/meson/index.page
+usr/share/help/de/meson/media/test.txt
+usr/share/help/C/meson-symlink/index.page
+usr/share/help/C/meson-symlink/media/test.txt
+usr/share/help/es/meson-symlink/media/test.txt
+usr/share/help/es/meson-symlink/index.page
+usr/share/help/de/meson-symlink/index.page
+usr/share/help/de/meson-symlink/media/test.txt
diff --git a/test cases/windows/1 basic/prog.c b/test cases/windows/1 basic/prog.c
index 8703980..58162a4 100644
--- a/test cases/windows/1 basic/prog.c
+++ b/test cases/windows/1 basic/prog.c
@@ -1,4 +1,4 @@
-#include <Windows.h>
+#include <windows.h>
int main(int argc, char **argv) {
return 0;