NetworkManager/shared/nm-udev-aux/nm-udev-utils.h
Thomas Haller 1ce171af32
license: relicense "shared/nm-udev-aux/nm-udev-utils.[hc]" under LGPL-2.1+
>>>

  H0=a3e75f329446a93a61ca4c458a7657bd919f4fe6
  commit_has_file() {
      git ls-tree -r "$1" | grep -q "\\s$2"\$
  }
  print_commit_authors() {
      git --no-pager log --full-history --follow --no-merges --pretty='format:<%ae>' $H0 -- "$1" | sort | uniq
  }
  print_blame_authors() {
      local LAST_H

      if commit_has_file $H0 "$1"; then
          LAST_H=$H0
      else
          LAST_H="$(git log --full-history --no-merges -n1 --pretty='format:%H' $H0 -- "$1")"^1
      fi
      git blame --no-progress -C -C -C20 -M -M10 -e "$LAST_H" -- "$1" | sed 's/.*\(<[^>]\+@[^>]\+>\).*/\1/' | sort | uniq
  }
  print_grep() {
      git --no-pager log -p --full-history --follow $H0 -- "$1" | grep -i '[a-z0-9]@\|author\|copyright' | sort | uniq
  }
  prefix() {
      sed "s/^/>>>$1 /"
  }
  collect_all() {
      for F; do
         print_commit_authors "$F" | prefix 1
         echo
         print_blame_authors "$F" | prefix 2
         echo
         print_grep "$F" | prefix 3
      done |
      sort |
      uniq |
      sed 's/@/(at)/'
  }

  collect_all \
      shared/nm-udev-aux/nm-udev-utils.c \
      shared/nm-udev-aux/nm-udev-utils.h \
      shared/nm-utils/nm-udev-utils.c \
      shared/nm-utils/nm-udev-utils.h \
      ;

<<<

gives:

>>>1 <bgalvani(at)redhat.com>
>>>1 <lkundrak(at)v3.sk>
>>>1 <thaller(at)redhat.com>
>>>2 <bgalvani(at)redhat.com>
>>>2 <dcbw(at)redhat.com>
>>>2 <rstrode(at)redhat.com>
>>>2 <thaller(at)redhat.com>
>>>3 [...] Red Hat, Inc.

Everybody in this list agreed to relicensing according to RELICENSE.md.

The code was initially added by commit e32839838e ('udev: drop
libgudev in favor of libudev'). It did expand on top of existing GPL
code, which is problematic. But it was introduced as an original
contribution.
2020-10-20 16:02:00 +02:00

33 lines
1.1 KiB
C

/* SPDX-License-Identifier: LGPL-2.1+ */
/*
* Copyright (C) 2017 Red Hat, Inc.
*/
#ifndef __NM_UDEV_UTILS_H__
#define __NM_UDEV_UTILS_H__
struct udev;
struct udev_device;
struct udev_enumerate;
gboolean nm_udev_utils_property_as_boolean(const char *uproperty);
const char *nm_udev_utils_property_decode(const char *uproperty, char **to_free);
char * nm_udev_utils_property_decode_cp(const char *uproperty);
typedef struct _NMPUdevClient NMUdevClient;
typedef void (*NMUdevClientEvent)(NMUdevClient * udev_client,
struct udev_device *udevice,
gpointer event_user_data);
NMUdevClient *nm_udev_client_new(const char *const *subsystems,
NMUdevClientEvent event_handler,
gpointer event_user_data);
NMUdevClient *nm_udev_client_unref(NMUdevClient *self);
struct udev *nm_udev_client_get_udev(NMUdevClient *self);
struct udev_enumerate *nm_udev_client_enumerate_new(NMUdevClient *self);
#endif /* __NM_UDEV_UTILS_H__ */