Skip to content

Commit

Permalink
Merge pull request networkupstools#2275 from jimklimov/FTY-remerge-20…
Browse files Browse the repository at this point in the history
…240123

FTY remerge from master as of 2024-03-02
  • Loading branch information
jimklimov authored Mar 4, 2024
2 parents dfa7552 + 7c7e304 commit 839287b
Show file tree
Hide file tree
Showing 785 changed files with 78,637 additions and 20,252 deletions.
181 changes: 181 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,181 @@
# Content modeled after settings tested with .travis.yml
# TODO: Implement a similar envvar-based matrix
# https://circleci.com/docs/2.0/env-vars/#circleci-environment-variable-descriptions
# TODO: save_cache installed brew dependencies? => seems not possible to reliably cache/restore outside user homedir
# TODO: Windows eventually?
# TODO: yaml-aliases to define steps once? => https://circleci.com/blog/decrease-your-build-times-by-running-jobs-in-parallel-with-workflows/

# Use the latest 2.1 version of CircleCI pipeline process engine.
# See: https://circleci.com/docs/2.0/configuration-reference
version: 2.1

# Define a job to be invoked later in a workflow.
# See: https://circleci.com/docs/2.0/configuration-reference/#jobs
# https://circleci.com/docs/2.0/configuration-reference/#parameters-requires-version-21
jobs:
osx-xcode:
parameters:
XCODE_VER:
type: string
default: "12.5.1"
CC:
type: string
default: "" # e.g. "clang"
CXX:
type: string
default: "" # e.g. "clang++"
CC_STDVER:
type: string
default: "" # e.g. "-std=gnu17"
CXX_STDVER:
type: string
default: "" # e.g. "-std=gnu++17"
BUILD_TYPE:
type: string
default: "default-all-errors"
CI_BUILDDIR:
type: string
default: "" # e.g. "obj" for out-of-tree build tests
BREW_MORE:
type: string
default: "" # e.g. "avahi" for all-driver tests

environment:
CC: << parameters.CC >>
CXX: << parameters.CXX >>
CC_STDVER: << parameters.CC_STDVER >>
CXX_STDVER: << parameters.CXX_STDVER >>
BUILD_TYPE: << parameters.BUILD_TYPE >>
CI_BUILDDIR: << parameters.CI_BUILDDIR >>
BREW_MORE: << parameters.BREW_MORE >>

# Specify the execution environment. You can specify an image from Dockerhub or use one of our Convenience Images from CircleCI's Developer Hub.
# See: https://circleci.com/docs/2.0/configuration-reference/#docker-machine-macos-windows-executor
macos:
xcode: << parameters.XCODE_VER >>

# Add steps to the job
# See: https://circleci.com/docs/2.0/configuration-reference/#steps
steps:
- checkout

# - run:
# name: "check shell"
# command: /usr/bin/env bash --version || true; command -v bash || true

# Note: MacOS default /bin/bash 3.x is too old for ci_build.sh
# Brew brings /usr/local/bin/bash 5.x as of this writing
# TODO: Are Binutils needed?
- run:
name: "homebrew"
command: |-
HOMEBREW_NO_AUTO_UPDATE=1; export HOMEBREW_NO_AUTO_UPDATE;
brew install ccache bash libtool pkg-config gd libusb neon net-snmp openssl $BREW_MORE #binutils
# - run:
# name: "homebrew-libtool"
# command: |-
# #find /usr /opt /lib* -name '*ltdl*' -ls 2>/dev/null || true
# brew unlink libtool && brew link libtool
# #find /usr /opt /lib* -name '*ltdl*' -ls 2>/dev/null || true

- restore_cache:
keys:
- ccache-{{ .Branch }}-{{ arch }}-{{ .Environment.CIRCLE_JOB }}
- ccache-master-{{ arch }}-{{ .Environment.CIRCLE_JOB }}

# - run:
# name: "check shell"
# command: /usr/bin/env bash --version || true; command -v bash || true

- run:
name: "ccache stats before build"
command: ccache -s || true

# TODO: Move -Wno-poison-system-directories into configure.ac to set
# optionally just on detected cross-build attempts (*X*code after all)
# and verifying that the compiler supports it?
# TODO: Relocate or address -Wno-deprecated-declarations (reported for
# uses of sem_init() and sem_destroy() in nut-scanner.c)
# NOTE: CANBUILD_NIT_TESTS=yes to check if single-executor environments
# do not have a problem with it.
- run:
name: "ci_build"
command: |-
CI_CCACHE_SYMLINKDIR="/usr/local/opt/ccache/libexec" \
CANBUILD_NIT_TESTS=yes \
CFLAGS="$CC_STDVER -Wno-poison-system-directories -Wno-deprecated-declarations" \
CXXFLAGS="$CXX_STDVER -Wno-poison-system-directories" \
LDFLAGS="-L/usr/local/lib" \
./ci_build.sh
- run:
name: "ccache stats after build"
command: ccache -s || true

# NOTE: Detailed key name allows every scenario to only track its
# own ccache objects, which makes sense for different compilers
# and their command-line flags which make an object unique.
# However if we were to build many scenarios with overlapping
# settings (e.g. same C standards with same compilers), it could
# be beneficial to instead share the cache between jobs; more so
# while we are on free CircleCI tier and run them sequentially.
- save_cache:
paths:
- ~/.ccache
key: ccache-{{ .Branch }}-{{ arch }}-{{ .Environment.CIRCLE_JOB }}

# Invoke jobs via workflows
# See: https://circleci.com/docs/2.0/configuration-reference/#workflows
workflows:
xcode-workflow:
jobs:
# Note: while "ccache" lists hordes of symlinks to gcc-XXX versions,
# in practice these toolkits are not installed (by default)

### This scenario is a subset of fightwarn-all below (modulo C standard),
### so disabled to not waste time from free CircleCI allowance limit:
# - osx-xcode:
# name: "gnu17-clang-xcode12_5_1-default-all-errors"
# XCODE_VER: "12.5.1"
# CC: "clang"
# CXX: "clang++"
# CC_STDVER: "-std=gnu17"
# CXX_STDVER: "-std=gnu++17"

- osx-xcode:
name: "gnu11-gcc-xcode12_5_1-out-of-tree"
CC: "gcc"
CXX: "g++"
CC_STDVER: "-std=gnu11"
CXX_STDVER: "-std=gnu++11"
# Try an out-of-tree build:
CI_BUILDDIR: "obj"

- osx-xcode:
name: "c99-cxx11-gcc-xcode12_5_1-default-distcheck"
CC: "gcc"
CXX: "g++"
CC_STDVER: "-std=c99"
CXX_STDVER: "-std=c++11"
# Try usual and distchecked build:
BUILD_TYPE: "default"

- osx-xcode:
name: "stdDefault-xcode12_5_1-fightwarn-all"
# Run "default-all-errors" with both compiler families,
# using their default C/C++ standard for current release:
BUILD_TYPE: "fightwarn-all"

### This does not work due to missing dependencies built for MacOS in homebrew:
### TODO? Evaluate other packagers (MacPorts, fink...)?
# - osx-xcode:
# name: "c17-clang-xcode12_5_1-alldrv"
# XCODE_VER: "12.5.1"
# CC: "clang"
# CXX: "clang++"
# CC_STDVER: "-std=c17"
# CXX_STDVER: "-std=c++17"
# # Try all drivers, and a distcheck:
# BUILD_TYPE: "default-alldrv"
# BREW_MORE: "avahi powerman"
82 changes: 82 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# EditorConfig is awesome: https://EditorConfig.org
# https://github.com/editorconfig/editorconfig/wiki/EditorConfig-Properties

# top-most EditorConfig file
root = true

[*]
charset = utf-8
insert_final_newline = true
trim_trailing_whitespace = true

max_line_length = 80

indent_style = tab
tab_width = 4
#indent_style = space
#indent_size = 4

# Platform-dependent, except for certain interpreters
# whose sources must use LF, see .gitattributes
###end_of_line = lf

#ij_formatter_enabled = false

[.editorconfig]
trim_trailing_whitespace = false

[*.{bat,cmd,ps1}]
end_of_line = crlf

[*.{am,hwdb,service,target,path}{,.in}]
end_of_line = lf
line_comment = #

[*.sh{,.in}]
end_of_line = lf
line_comment = #

# Borrowed from https://github.com/armbian/build/blob/master/.editorconfig
shell_variant = bash
binary_next_line = false
switch_case_indent = true
space_redirects = true
keep_padding = false
function_next_line = false

[*.{m4,ac}{,.in}]
end_of_line = lf
line_comment = dnl

[*.{conf,sample}{,.in}]
max_line_length = 76
line_comment = #

[*.txt{,.in},*.adoc{,.in},AUTHORS,COPYING,INSTALL.nut,MAINTAINERS,NEWS,README,TODO,UPGRADING]
max_line_length = 76
indent_style = space
indent_size = 4

# Assumes asciidoc comments:
block_comment_start = ////////
block_comment_end = ////////

[*.{yaml,yml,json}{,.in}]
indent_style = space
indent_size = 4

################################################################
# Primary concern: C/C++ style
# See also docs/developers.txt => Code Style chapter

[*.{c,h,cpp}{,.in}]
spaces_around_operators = true
spaces_around_brackets = none

# Plus one TAB:
continuation_indent_size = 1

indent_brace_style = K&R

block_comment_start = /*
block_comment_end = */
25 changes: 25 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Windows script files should be CR+LF always:
*.bat text eol=crlf

# Unix/Linux script files should be LF always:
*.sh text eol=lf
*.m4 text eol=lf
*.ac text eol=lf
*.am text eol=lf
*.hwdb text eol=lf

# Aspell claims issues finding `utf-8\r` sometimes (from heading line of
# the dictionary file), with messages like this:
# .cset" could not be opened for reading or does not exist.lib/aspell/utf-8
# which tends to happen in mixed-OS development environments. Tracer shows it:
# read(3, "personal_ws-1.1 en 3225 utf-8\r\nA"..., 4096) = 4096
# access("/usr/lib/aspell/utf-8\r.cset", F_OK) = -1 ENOENT (No such file or directory)
/docs/nut.dict text eol=lf

# Some files are binary always:
*.png bin
*.ico bin

# The rest are assumed text sources with platform-dependent EOL being okay,
# or we let Git guess otherwise:
* text=auto
2 changes: 2 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
github: networkupstools
open_collective: networkupstools
9 changes: 8 additions & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
as for which text documents to update. See also docs/developer-guide.txt
for general points on NUT architecture and design.
* Please note that we require "Signed-Off-By" tags in each Git Commit
message, to conform to the common DCO (Developer Certificate of Origin)
as posted in LICENSE-DCO at root of NUT codebase as well as published
at https://developercertificate.org/
* The checklist below is more of a reminder of steps to take and "dangers"
to look out for. PRs to update this template are also welcome :)
Expand All @@ -22,6 +27,8 @@
of "real" changes in the other commits. Similarly for typo fixes in
comments or text documents.

- [ ] Please star NUT on GitHub, this helps with sponsorships! ;)

## Frequent "underwater rocks" for driver addition/update PRs

- [ ] Revised existing driver families and added a sub-driver if applicable
Expand All @@ -45,7 +52,7 @@
(several vendors do use same interface chips for unrelated protocols).

- [ ] For new USB devices, built and committed the changes for the
`scripts/upower/95-upower-hid.rules` file
`scripts/upower/95-upower-hid.hwdb` file

- [ ] Proposed NUT data mapping is aligned with existing `docs/nut-names.txt`
file. If the device exposes useful data points not listed in the file, the
Expand Down
Loading

0 comments on commit 839287b

Please sign in to comment.