Commit Graph

30168 Commits

Author SHA1 Message Date
Simon McVittie
9ceed6f0de gdatetime test: Produce more helpful output on mismatches
It's helpful for the assertion message to say what we were expecting and
what we actually got. It's also useful to have g_test_message()
diagnostics to indicate how far into the test we were.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-02-13 10:39:49 +00:00
Simon McVittie
342d6176e7 gdatetime: Exercise %c, %C format placeholders in ja_JP.eucjp
Previously we didn't test these at all, which made it hard to determine
whether %Ec, %EC had appropriate output on platforms where era-based
dates are unsupported. Now we do, and we can observe that on platforms
with no support for era-based dates, %c matches %Ec and %C matches %EC,
as desired.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-02-13 10:20:11 +00:00
Simon McVittie
988f4204a1 gdatetime: Fix ja_JA.eucjp expectations when eras are unsupported
I can't read Japanese, but these match the output of:

    env TZ=UTC LC_ALL=ja_JP.eucjp date -d2009-10-24T00:00:00Z '+%c' | iconv -f eucjp -t UTF-8
    env TZ=UTC LC_ALL=ja_JP.eucjp date -d2009-10-24T00:00:00Z '+%C' | iconv -f eucjp -t UTF-8

which seem like a reasonable thing to use as a reference.

According to Google Translate, 平成 refers to the Heisei era, which was
current during 2009, and seems unreasonable to expect as output on a
platform where era-based dates are unsupported.

Resolves: https://gitlab.gnome.org/GNOME/glib/-/issues/3252
Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-02-13 10:20:02 +00:00
Philip Withnall
c0f5e6d217 Merge branch 'threadtests-performance' into 'main'
tests: Speed up threaded toggle notify test unless -m slow is passed

See merge request GNOME/glib!3919
2024-02-13 09:46:15 +00:00
Ekaterine Papava
4d7409334e Update Georgian translation 2024-02-13 09:45:09 +00:00
Philip Withnall
3c39a23a7e tests: Speed up threaded toggle notify test unless -m slow is passed
On a fast laptop, this test currently takes about 7s to run, which is a
significant portion of the overall test suite time.

On a slower CI machine, especially running the test under valgrind, the
test can time out.

There’s no need to always run so many iterations: we run the tests under
CI so often that it’s likely a failure will eventually be hit (if there
is a bug) even with fewer iterations. We also now run the tests once a
week with `-m slow`, so the original iteration count will also still be
used then.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-02-13 08:52:15 +00:00
Philip Withnall
80e878005f tests: Don’t run lint tests under valgrind
That’s not useful, as the lint tests aren’t actually GLib code.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-02-13 08:41:59 +00:00
Philip Withnall
342fa9c161
2.79.2
Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-02-12 23:36:25 +00:00
Philip Withnall
6791878b97 Merge branch '3037-split-platform-docs' into 'main'
introspection: Generate separate GIR files and documentation for platform specific APIs

See merge request GNOME/glib!3892
2024-02-12 18:57:50 +00:00
Philip Withnall
19308d6c18 introspection: Re-add platform specific APIs to GLib-2.0.gir and Gio-2.0.gir
To avoid a big introspection API break.

These APIs are now listed in the new `{GLib,Gio}{Unix,Win32}-2.0.gir`
files, but for backwards compatibility they need to continue to be
listed in `Gio-2.0.gir` and `GLib-2.0.gir` as well, until the next major
introspection API break (and none is planned).

No new platform specific APIs should be added to these GIR files, but
these existing ones must remain.

See https://gitlab.gnome.org/GNOME/glib/-/merge_requests/3892#note_2001361

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-02-12 17:54:36 +00:00
Philip Withnall
4314944e56 introspection: Drop Unix and Win32 prefixes from platform specific APIs
So now introspection users will have to call `GLibUnix.open_pipe()`
rather than `GLibUnix.unix_open_pipe()` — or
`GLibWin32.check_windows_version()` rather than
`GLibWin32.win32_check_windows_version()`.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>

Helps: #3037
2024-02-12 17:54:36 +00:00
Philip Withnall
2b4bfadfb7 tests: Remove an unnecessary include from test-common.h
It causes a build failure on mingw32, as `_WIN32_WINNT` is redefined.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-02-12 17:54:36 +00:00
Philip Withnall
c428d6e673 ci: Build and tar the platform specific documentation
Enable the msys2-mingw32 CI job for merges, just like the fedora-x86_64
job is. The pair of them can then build the platform specific GIR and
documentation files.

The `download-reference.sh` script in the `docs-gtk-org` branch of GTK
can then download the docs as an artifact from the latest GLib build of
`main`, and publish them on docs.gtk.org, as is currently done for the
platform agnostic documentation.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>

Helps: #3037
2024-02-12 17:54:35 +00:00
Philip Withnall
434d3ff524 docs: Mention GioUnix-2.0 GIR namespace alongside gio-unix-2.0.pc
This should clarify things a little for users of language bindings, who
don’t directly use `.pc` files.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-02-12 17:54:10 +00:00
Philip Withnall
c498c9a8c9 docs: Split out platform specific GIO and GLib documentation
This creates `GioUnix`, `GioWin32`, `GLibUnix` and `GLibWin32`. These
bodies of documentation are in addition to the main, platform agnostic,
documentation for both libraries.

This commit necessarily includes various mechanical changes to update
the repository namespace used in various existing documentation links to
platform specific APIs.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>

Helps: #3037
2024-02-12 17:54:10 +00:00
Philip Withnall
5021d002ab introspection: Generate separate GIR files for platform specific APIs
For both GLib and GIO. (GObject, GIRepository and GModule don’t have any
platform specific APIs.)

This is needed for two reasons:
 * If the same GIR file is shipped on multiple platforms, it has no way
   to conditionally define/not-define an API based on the platform (like
   an `#ifdef` in a C header). So we either end up shipping differing
   GIR APIs on different platforms, or shipping a GIR file which
   declares APIs which aren’t resolvable by `dlopen()` on certain
   platforms, and will cause a language runtime error.
 * The API reference documentation is now generated from the GIR, and
   similar problems are present there: if the GIR contains different
   symbols depending on the platform, there is no way to generate API
   documentation for the union of all of them.

The fix is to ensure that there are no conditional symbols in a GIR, by
splitting out the platform specific symbols into platform specific GIR
files. Platform specific documentation can then be generated from these,
in addition to the main, platform agnostic, documentation.

The documentation changes will following in a subsequent commit.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>

Helps: #3037
2024-02-12 17:54:10 +00:00
Philip Withnall
1f9e44d623 glib: Install platform specific headers in a separate step
Maintain them in separate lists within `meson.build`. This makes no
functional difference at the moment, but will be used in an upcoming
commit to generate separate GIR files per platform.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>

Helps: #3037
2024-02-12 17:54:10 +00:00
Philip Withnall
0d9170c6b8 gio: Remove unnecessary appinfo_sources variable
There was no obvious logical need to list the `GAppInfo` subclass
sources separately in the build. It makes more sense to add them to the
platform-specific source lists, since they are platform specific.

This will be used in an upcoming commit which generates
platform-specific GIR files, so needs the full platform-specific lists
of sources.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>

Helps: #3037
2024-02-12 17:54:10 +00:00
Philip Withnall
f63cc38328 gfiledescriptorbased: Move across typedef from giotypes.h
`GFileDescriptorBased` is in `gio-unix-2.0` rather than `gio-2.0`, so
its types shouldn’t be declared in a header belonging to the latter.

This hasn’t been a problem previously because C is fine with that. But
upcoming commits are going to split the introspection scanning for
`gio-2.0` and `gio-unix-2.0`, and the introspection scanner is a little
more picky about declarations not being spread all over the place.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>

Helps: #3037
2024-02-12 17:54:10 +00:00
Philip Withnall
4c178fa623 build: Combine duplicate urlmap.js files
Seems no point in keeping them separate. It doesn’t seem to matter if
they contain entries which are unused for a particular docs build.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-02-12 17:54:10 +00:00
Philip Withnall
3695249ebb docs: Drop unnecessary GdkPixbuf reference from urlmap.js
It was unused.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-02-12 17:54:10 +00:00
Philip Withnall
e58abedf28 Revert "gwin32: Un-hide symbols when building GIR"
This reverts commit 50d432c77b.

The platform-specific headers of GLib and Gio are now introspected
separately, so the documentation for them can be built separately, and
this workaround is no longer needed.

Helps: #3037
2024-02-12 17:54:10 +00:00
Philip Withnall
19f7143ae2 Merge branch 'build-girepository-docs' into 'main'
ci: Build and tar libgirepository documentation

See merge request GNOME/glib!3917
2024-02-12 17:34:35 +00:00
Philip Withnall
d426f33cf3 ci: Build and tar libgirepository documentation
Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-02-12 17:01:15 +00:00
Marco Trevisan
7beb137c99 Merge branch 'skip-lint-bash' into 'main'
tests: Skip lint tests if bash is not available

See merge request GNOME/glib!3916
2024-02-12 14:52:59 +00:00
Philip Withnall
81700d9aa6 tests: Skip lint tests if bash is not available
They all require bash.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-02-12 14:15:51 +00:00
Philip Withnall
3a7dfb14c6 Merge branch '3245-boxed-info-typing' into 'main'
gibaseinfo: Stop building GIBoxedInfo instances and use gi_registered_type_info_is_boxed() instead

Closes #3245

See merge request GNOME/glib!3905
2024-02-12 14:11:36 +00:00
Marco Trevisan
730a348574 Merge branch '3244-typelib-path' into 'main'
girepository: Export builddir typelib and GIR paths

Closes #3244

See merge request GNOME/glib!3880
2024-02-12 13:45:00 +00:00
Philip Withnall
5ddd4b91b8 girepository: Drop unneeded include from girepository-private.h
It was causing a build failure on some platforms:
```
In file included from ../girepository/gthash.c:29:
In file included from ../girepository/gitypelib-internal.h:30:
../girepository/girepository-private.h:26:10: fatal error: 'ffi.h' file not found
 #include <ffi.h>
          ^~~~~~~
```

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-02-12 13:30:17 +00:00
Philip Withnall
f51398af91 girepository: Drop GIBoxedInfo
See the previous commit for details.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>

Helps: #3245
2024-02-12 13:17:04 +00:00
Philip Withnall
0fd99a9f16 gibaseinfo: Stop building GIBoxedInfo instances
Instead, add a method on `GIRegisteredTypeInfo` which indicates whether
the registered type is a boxed type. This will return true for
`GIStructInfo` and `GIUnionInfo` instances which are boxed (not all
structs and unions are).

This makes `GIBoxedInfo` redundant, and it’ll be dropped in a following
commit.

---

There are several different things which typelibs need to be able to
represent:
 1. Plain old datatype (POD) structs
 2. POD unions
 3. Structs with a copy func and/or free func
 4. Unions with a copy func and/or free func
 5. Structs which are the ‘GType struct’ for an object or interface (i.e.
    the class or instance or interface struct)
 6. Structs with a copy func and free func *and* boxed GType
 7. Unions with a copy func and free func *and* boxed GType
 8. Boxed GTypes which represent something other than a struct or union

So there’s a lot going on here. In commit
e28078c70cbf4a57c7dbd39626f43f9bd2674145, a lot of this was reworked,
and support was added for boxed unions and boxed ‘others’ (the last item
on the list above).

Since then, support for boxed types other than structs seems to have
atrophied a bit, and the whole lot has got a bit confusing.

It was perhaps less confusing when all the `GIBaseInfo` subclasses were
actually aliases of each other, but now they have subtype relationships,
the position of `GIBoxedInfo` in that type hierarchy has become unclear.
How is it related to `GIStructInfo`, `GIUnionInfo` and
`GIRegisteredTypeInfo`?

Since a boxed type is necessarily a `GIRegisteredTypeInfo`, and the
methods of `GIRegisteredTypeInfo` are all written to allow a `GType` to
be optional, so that `GIStructInfo` and `GIUnionInfo` can safely derive
from it and still be used to represent plain old datatypes without
`GType`s, it makes sense to add a method to `GIRegisteredTypeInfo` to
indicate that the registered type is derived from `G_TYPE_BOXED`.

Accordingly, the things above are now represented in libgirepository’s
type system as:
 1. `GIStructInfo` instance, `GIRegisteredTypeInfo` methods return no
    `GType` info
 2. `GIUnionInfo` instance similarly
 3. `GIStructInfo` instance, `GIRegisteredTypeInfo` methods return no
    `GType` info, `gi_struct_info_get_{copy,free}_function_name()` return
    non-`NULL` values
 4. `GIUnionInfo` instance similarly
 5. `GIStructInfo` instance, `GIRegisteredTypeInfo` methods return no
    `GType` info, `gi_struct_info_is_gtype_struct()` returns true
 6. `GIStructInfo` instance, `GIRegisteredTypeInfo` methods return valid
    `GType` information, `gi_registered_type_info_is_boxed()` returns
    true, `gi_struct_info_get_{copy,free}_function_name()` return
    `NULL` values (because the copy/free functions are hidden inside the
    boxed type registration at runtime)
 7. `GIUnionInfo` instance similarly
 8. Not representable, but could be represented in future by re-adding a
    `GIBoxedInfo` type which derives from `GIRegisteredTypeInfo` and is
    used solely for boxed ‘other’ types, *not* boxed structs or unions

Signed-off-by: Philip Withnall <pwithnall@gnome.org>

Fixes: #3245
2024-02-12 13:16:07 +00:00
Philip Withnall
54f156bd63 gitypelib: Explicitly convert from GITypelibBlobType to GIInfoType
When creating `GIBaseInfo` instances from binary blobs, so far the code
has used an undocumented implicit conversion from one enum type to the
other. That’s a bit nasty, as it means the two enum types need to be
kept in sync (without that need being documented).

Introduce an explicit conversion function to make things more explicit.
Currently it does nothing, but in an upcoming commit it will be used to
deprecate a blob type.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>

Helps: #3245
2024-02-12 13:15:38 +00:00
Ekaterine Papava
75885d52ca Update Georgian translation 2024-02-12 13:04:38 +00:00
Philip Withnall
dbc38b28aa Merge branch 'wip/smcv/cmph-typo' into 'main'
cmph: Fix a typo

See merge request GNOME/glib!3913
2024-02-12 12:25:53 +00:00
Philip Withnall
2ee2397622 Merge branch '3155-update-generate-and-inspect' into 'main'
Rename g-ir-generate and g-ir-inspect and update to girepository-2.0

See merge request GNOME/glib!3909
2024-02-09 23:31:21 +00:00
Philip Withnall
d12a9f00d9 Merge branch 'unix-pipe-open-docs' into 'main'
glib-unix: Fix reference to FD_CLOEXEC in docs for g_unix_pipe_open()

See merge request GNOME/glib!3912
2024-02-09 21:59:59 +00:00
Philip Withnall
5c1cb975d6 Merge branch 'drop-msvc-workaround' into 'main'
Revert "ci: Remove not-printable chars from generated junit file"

See merge request GNOME/glib!3914
2024-02-09 21:53:50 +00:00
Philip Withnall
d03727c07d girwriter: Stop using gi_base_info_get_info_type()
While it’s an internal API which `girwriter.c` has access to, it’s not
available inside `libgirepository-internals.so`. This wasn’t spotted
before commit 343027d5d landed because none of the existing users of
`libgirepository-internals.so` use the relevant code in `girwriter.c`,
so it got compiled out (`libgirepository-internals.so` is statically
linked and can be optimised like this).

Now that `gi-decompile-repository` uses the relevant code from
`girwriter.c`, the problem is obvious and `gi-decompile-repository`
fails to link.

Fix that by no longer using `gi_base_info_get_info_type()` in
`girwriter.c`. These are changes which would have eventually been made
anyway in issue #3253.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>

Helps: #3253
2024-02-09 20:41:44 +00:00
Philip Withnall
8248382d8b gi-inspect-repository: Change --version argument to --typelib-version
`--version` is conventionally used to find the version of the program
itself. While that’s not currently implemented in
`gi-inspect-repository`, let’s not box ourselves into a corner.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-02-09 20:41:17 +00:00
Philip Withnall
268871426a gi-inspect-repository: Port to girepository-2.0
Update the code to the latest standards and to use girepository-2.0
after it’s been imported to this repository.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>

Helps: #3155
2024-02-09 20:40:47 +00:00
Philip Withnall
aaed30f3dc gi-decompile-repository: Port to girepository-2.0
Update the code to the latest standards and to use girepository-2.0
after it’s been imported to this repository.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>

Helps: #3155
2024-02-09 20:40:47 +00:00
Philip Withnall
d6d845aee3 docs: Add missing migration guide for gi_repository_get_shared_libraries()
Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-02-09 20:40:47 +00:00
Philip Withnall
45468f1bb8 docs: Document girepository-2.0 utility program name changes
Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-02-09 20:40:46 +00:00
Philip Withnall
5c3c2cf6b3 girepository: Rename g-ir-generate and g-ir-inspect
Rename them to `gi-decompile-repository` and `gi-inspect-repository` to
match the existing `gi-compile-repository`. The names have to differ
from those used in girepository-1.0 to avoid collisions.

‘generate’ has been changed to ‘decompile’ because it does the inverse
of what `gi-compile-repository` does: it converts a typelib to a GIR
file. ‘generate’ never really made much sense for this anyway — it’s
almost a synonym of ‘compile’.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>

Helps: #3155
2024-02-09 20:40:17 +00:00
Philip Withnall
bb9f69d8b2 Revert "ci: Remove not-printable chars from generated junit file"
This reverts commit 94273b0ebf.

Meson 1.2.0 contains a fix for the underlying issue (in commit
bd3d2cf91894b1f91128011b2cf56a5bd2c326ae), and we now depend on 1.2.0.
So the workaround is no longer needed.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-02-09 20:22:35 +00:00
Philip Withnall
a59499ab0a Merge branch 'no-override-g-ir-compiler' into 'main'
build: Only override g-ir-compiler when GIR generation is enabled

See merge request GNOME/glib!3876
2024-02-09 20:18:39 +00:00
Evan Welsh
e36839818a build: Only override g-ir-compiler when GIR generation is enabled
GLib is used a subproject with GObject Introspection and overriding
this binary breaks that usage. For now we will make overriding the
binary conditional until Meson is updated to handle the binary changes.
2024-02-09 06:56:38 -08:00
Simon McVittie
8a8ce72a7a cmph: Fix a typo
In the project from which this copy of cmph was forked, this was fixed
in version 2.0.2 by commit
bbf77c63c9/

Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-02-09 14:44:34 +00:00
Philip Withnall
8300b52cbb Merge branch 'wip/smcv/closefrom' into 'main'
glib-unix: Add g_closefrom(), g_fdwalk_set_cloexec()

Closes #3247

See merge request GNOME/glib!3884
2024-02-09 14:06:52 +00:00
Philip Withnall
f9cbd07003 Merge branch 'wip/smcv/pipes' into 'main'
glib/tests/unix: Mostly pass O_CLOEXEC to g_unix_pipe_open()

See merge request GNOME/glib!3911
2024-02-09 13:48:02 +00:00