1. 18 Apr, 2019 2 commits
  2. 16 Apr, 2019 1 commit
    • Lubomir Rintel's avatar
      all: goodbye libnm-glib · 5801f89f
      Lubomir Rintel authored
      This removes libnm-glib, libnm-glib-vpn, and libnm-util for good.
      The it has been replaced with libnm since NetworkManager 1.0, disabled
      by default since 1.12 and no up-to-date distributions ship it for years
      now.
      
      Removing the libraries allows us to:
      
      * Remove the horrible hacks that were in place to deal with accidental use
        of both the new and old library in a single process.
      * Relief the translators of maintenance burden of similar yet different
        strings.
      * Get rid of known bad code without chances of ever getting fixed
        (libnm-glib/nm-object.c and libnm-glib/nm-object-cache.c)
      * Generally lower the footprint of the releases and our workspace
      
      If there are some really really legacy users; they can just build
      libnm-glib and friends from the NetworkManager-1.16 distribution. The
      D-Bus API is stable and old libnm-glib will keep working forever.
      
      https://github.com/NetworkManager/NetworkManager/pull/308
      5801f89f
  3. 03 Apr, 2019 1 commit
  4. 19 Mar, 2019 1 commit
    • Lubomir Rintel's avatar
      all: goodbye libnm-glib · 1de8383a
      Lubomir Rintel authored
      This removes libnm-glib, libnm-glib-vpn, and libnm-util for good.
      The it has been replaced with libnm since NetworkManager 1.0, disabled
      by default since 1.12 and no up-to-date distributions ship it for years
      now.
      
      Removing the libraries allows us to:
      
      * Remove the horrible hacks that were in place to deal with accidental use
        of both the new and old library in a single process.
      * Relief the translators of maintenance burden of similar yet different
        strings.
      * Get rid of known bad code without chances of ever getting fixed
        (libnm-glib/nm-object.c and libnm-glib/nm-object-cache.c)
      * Generally lower the footprint of the releases and our workspace
      
      If there are some really really legacy users; they can just build
      libnm-glib and friends from the NetworkManager-1.16 distribution. The
      D-Bus API is stable and old libnm-glib will keep working forever.
      
      https://github.com/NetworkManager/NetworkManager/pull/308
      1de8383a
  5. 12 Feb, 2019 1 commit
  6. 11 Jul, 2018 1 commit
    • Thomas Haller's avatar
      all: don't use gchar/gshort/gint/glong but C types · e1c7a2b5
      Thomas Haller authored
      We commonly don't use the glib typedefs for char/short/int/long,
      but their C types directly.
      
          $ git grep '\<g\(char\|short\|int\|long\|float\|double\)\>' | wc -l
          587
          $ git grep '\<\(char\|short\|int\|long\|float\|double\)\>' | wc -l
          21114
      
      One could argue that using the glib typedefs is preferable in
      public API (of our glib based libnm library) or where it clearly
      is related to glib, like during
      
        g_object_set (obj, PROPERTY, (gint) value, NULL);
      
      However, that argument does not seem strong, because in practice we don't
      follow that argument today, and seldomly use the glib typedefs.
      Also, the style guide for this would be hard to formalize, because
      "using them where clearly related to a glib" is a very loose suggestion.
      
      Also note that glib typedefs will always just be typedefs of the
      underlying C types. There is no danger of glib changing the meaning
      of these typedefs (because that would be a major API break of glib).
      
      A simple style guide is instead: don't use these typedefs.
      
      No manual actions, I only ran the bash script:
      
        FILES=($(git ls-files '*.[hc]'))
        sed -i \
            -e 's/\<g\(char\|short\|int\|long\|float\|double\)\>\( [^ ]\)/\1\2/g' \
            -e 's/\<g\(char\|short\|int\|long\|float\|double\)\>  /\1   /g' \
            -e 's/\<g\(char\|short\|int\|long\|float\|double\)\>/\1/g' \
            "${FILES[@]}"
      e1c7a2b5
  7. 05 Jul, 2018 1 commit
  8. 31 May, 2018 1 commit
    • Thomas Haller's avatar
      build: use default NM_BUILD_* defines for tests · b7426e91
      Thomas Haller authored
      Use two common defines NM_BUILD_SRCDIR and NM_BUILD_BUILDDIR
      for specifying the location of srcdir and builddir.
      
      Note that this is only relevant for tests, as they expect
      a certain layout of the directories, to find files that concern
      them.
      b7426e91
  9. 11 May, 2018 1 commit
    • Thomas Haller's avatar
      tests: use libnm via pygobject in tools/test-networkmanager-service.py · 9628aabc
      Thomas Haller authored
      tools/test-networkmanager-service.py is our NetworkManager stub server.
      
      NetworkManager uses libnm(-core) heavily, for example to decide whether
      a connection verifies (nm_connection_verify()) and for normalizing
      connections (nm_connection_normalize()).
      
      If the stub server wants to mimic NetworkManager, it also must use these
      function. Luckily, we already can do so, by loading libnm using python
      GObject introspection.
      
      We already correctly set GI_TYPELIB_PATH search path, so that the
      correct libnm is loaded -- provided that we build with introspection
      enabled.
      
      We still need to gracefully fail, if starting the stub server fails.
      That requries some extra effort. If the stub server notices that
      something is missing, it shall exit with status 77. That will cause
      the tests to g_test_skip().
      9628aabc
  10. 08 Jan, 2018 1 commit
    • Thomas Haller's avatar
      build: refine the NETWORKMANAGER_COMPILATION define · 22ef6a50
      Thomas Haller authored
      Note that:
      
       - we compile some source files multiple times. Most notably those
         under "shared/".
      
       - we include a default header "shared/nm-default.h" in every source
         file. This header is supposed to setup a common environment by defining
         and including parts that are commonly used. As we always include the
         same header, the header must behave differently depending
         one whether the compilation is for libnm-core, NetworkManager or
         libnm-glib. E.g. it must include <glib/gi18n.h> or <glib/gi18n-lib.h>
         depending on whether we compile a library or an application.
      
      For that, the source files need the NETWORKMANAGER_COMPILATION #define
      to behave accordingly.
      
      Extend the define to be composed of flags. These flags are all named
      NM_NETWORKMANAGER_COMPILATION_WITH_*, they indicate which part of the
      build are available. E.g. when building libnm-core.la itself, then
      WITH_LIBNM_CORE, WITH_LIBNM_CORE_INTERNAL, and WITH_LIBNM_CORE_PRIVATE
      are available. When building NetworkManager, WITH_LIBNM_CORE_PRIVATE
      is not available but the internal parts are still accessible. When
      building nmcli, only WITH_LIBNM_CORE (the public part) is available.
      This granularily controls the build.
      22ef6a50
  11. 14 Nov, 2017 1 commit
  12. 14 Dec, 2016 1 commit
    • Thomas Haller's avatar
      build: allow specifying the python interpreter for building · 6070fe69
      Thomas Haller authored
      As build-requirement, we either require
        - python2 with python-gobject-base
        - python3 with python3-gobject-base
      Previously, we would require that a plain `python` gives the desired
      interpreter version.
      
      If somebody's "/usr/bin/env python" however points to a different
      python version, there was no easy way to change it -- aside
      resetting the $PATH variable to some desired "python" binary.
      
      Now, you can specify it during configure:
      
        ./configure PYTHON=python3 ...
      
      This especially matters, if you only have python3-gobject-base
      installed, you /usr/bin/python is a symlink to python2.
      
      https://bugzilla.gnome.org/show_bug.cgi?id=775768
      6070fe69
  13. 19 Feb, 2016 1 commit
    • Thomas Haller's avatar
      all: cleanup includes and let "nm-default.h" include "config.h" · 8bace23b
      Thomas Haller authored
      - All internal source files (except "examples", which are not internal)
        should include "config.h" first. As also all internal source
        files should include "nm-default.h", let "config.h" be included
        by "nm-default.h" and include "nm-default.h" as first in every
        source file.
        We already wanted to include "nm-default.h" before other headers
        because it might contains some fixes (like "nm-glib.h" compatibility)
        that is required first.
      
      - After including "nm-default.h", we optinally allow for including the
        corresponding header file for the source file at hand. The idea
        is to ensure that each header file is self contained.
      
      - Don't include "config.h" or "nm-default.h" in any header file
        (except "nm-sd-adapt.h"). Public headers anyway must not include
        these headers, and internal headers are never included after
        "nm-default.h", as of the first previous point.
      
      - Include all internal headers with quotes instead of angle brackets.
        In practice it doesn't matter, because in our public headers we must
        include other headers with angle brackets. As we use our public
        headers also to compile our interal source files, effectively the
        result must be the same. Still do it for consistency.
      
      - Except for <config.h> itself. Include it with angle brackets as suggested by
        https://www.gnu.org/software/autoconf/manual/autoconf.html#Configuration-Headers
      8bace23b
  14. 26 Dec, 2015 4 commits
  15. 24 Dec, 2015 4 commits
    • Thomas Haller's avatar
      build: rename directory "include" to "shared" · db80ec05
      Thomas Haller authored
      Up to now, the "include" directory contained (only) header files that were
      used project-wide by libs, core, clients, et al.
      
      Since the directory now also contains a non-header file, the "include"
      name is misleading. Instead of adding yet another directory that is
      project-wide, with non-header-only content, rename the "include"
      directory to "shared".
      db80ec05
    • Thomas Haller's avatar
      libnm/tests: rename test functions to follow common pattern · bc06dd93
      Thomas Haller authored
      Like the test utility functions in nm-test-utils.h and
      platform's common.h, rename the helper functions to have
      a nmtst(c) prefix.
      bc06dd93
    • Thomas Haller's avatar
      libnm/tests: move common testing code to nm-test-libnm-utils · fa3093e1
      Thomas Haller authored
      The unit tests for libnm and libnm-glib use a NetworkManager stub
      service written in Python (test-networkmanager-service.py). As they
      share the same server, it makes sense to also share the same utility
      code to drive the stub.
      
      Move the common code to include/.
      
      Note that contrary to "nm-test-utils.h", "nm-test-libnm-utils.h" is not
      a header-only file. Instead its implementation is in "nm-test-utils-impl.c".
      The reason for that this split is, if we later have yet another non-header-only
      test-utility, then all the implementations are in "nm-test-utils-impl.c", requiring
      the tests to link only one object file.
      fa3093e1
    • Thomas Haller's avatar
      libnm/tests: unify common test code for libnm and libnm-glib · 70713ee1
      Thomas Haller authored
      Unify the common test code to drive the D-Bus stub service
      test-networkmanager-service.py. They will be merged in the next
      commit.
      70713ee1
  16. 17 Aug, 2015 1 commit
  17. 05 Aug, 2015 1 commit
  18. 24 Jul, 2015 1 commit
    • Dan Winship's avatar
      all: rename nm-glib-compat.h to nm-glib.h, use everywhere · 3452ee2a
      Dan Winship authored
      Rather than randomly including one or more of <glib.h>,
      <glib-object.h>, and <gio/gio.h> everywhere (and forgetting to include
      "nm-glib-compat.h" most of the time), rename nm-glib-compat.h to
      nm-glib.h, include <gio/gio.h> from there, and then change all .c
      files in NM to include "nm-glib.h" rather than including the glib
      headers directly.
      
      (Public headers files still have to include the real glib headers,
      since nm-glib.h isn't installed...)
      
      Also, remove glib includes from header files that are already
      including a base object header file (which must itself already include
      the glib headers).
      3452ee2a
  19. 13 Nov, 2014 1 commit
    • Dan Winship's avatar
      all: consistently include config.h · 3bfb163a
      Dan Winship authored
      config.h should be included from every .c file, and it should be
      included before any other include. Fix that.
      
      (As a side effect of how I did this, this also changes us to
      consistently use "config.h" rather than <config.h>. To the extent that
      it matters [which is not much], quotes are more correct anyway, since
      we're talking about a file in our own build tree, not a system
      include.)
      3bfb163a
  20. 01 Aug, 2014 2 commits
    • Dan Winship's avatar
      libnm-glib: make test-networkmanager-service.py automatically exit with its parent · 08b91199
      Dan Winship authored
      test-nm-client.c and test-remote-settings-client.c were using their
      own assertion macros so they could kill the test service on assertion
      failure. Except that some new code didn't get the memo and used the
      g_assert* macros. Not to mention that sometimes the tests would crash
      outside of an assertion macro.
      
      We can make test-networkmanager-service.py notice that its parent has
      crashed by opening a pipe between them and taking advantage of the
      fact that the pipe will be automatically closed if the parent crashes.
      So then test-networkmanager-service.py just has to watch for that, and
      exit if the pipe closes.
      
      Then that lets us drop the test_assert* macros and just use g_assert*
      instead.
      08b91199
    • Dan Winship's avatar