-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(GODT-2677): add COPYING_NOTES and script to maintain it. (#360)
- Loading branch information
1 parent
fb7689b
commit b13a5db
Showing
2 changed files
with
147 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
# Copying | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2020 James Houlahan | ||
Copyright (c) 2021 Proton AG | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. | ||
|
||
# Dependencies | ||
Gluon includes the following 3rd party software: | ||
|
||
* [The Go Project libraries](https://golang.org/project/) | Available under [BSD license](https://golang.org/LICENSE) | ||
|
||
<!-- START AUTOGEN --> | ||
* [ent](https://entgo.io/ent) available under [license](https://pkg.go.dev/entgo.io/ent?tab=licenses) | ||
* [go-mbox](https://github.com/ProtonMail/go-mbox) available under [license](https://github.com/ProtonMail/go-mbox/blob/master/LICENSE) | ||
* [juniper](https://github.com/bradenaw/juniper) available under [license](https://github.com/bradenaw/juniper/blob/master/LICENSE) | ||
* [go-imap](https://github.com/emersion/go-imap) available under [license](https://github.com/emersion/go-imap/blob/master/LICENSE) | ||
* [go-imap-uidplus](https://github.com/emersion/go-imap-uidplus) available under [license](https://github.com/emersion/go-imap-uidplus/blob/master/LICENSE) | ||
* [mock](https://github.com/golang/mock) available under [license](https://github.com/golang/mock/blob/master/LICENSE) | ||
* [uuid](https://github.com/google/uuid) available under [license](https://github.com/google/uuid/blob/master/LICENSE) | ||
* [go-sqlite3](https://github.com/mattn/go-sqlite3) available under [license](https://github.com/mattn/go-sqlite3/blob/master/LICENSE) | ||
* [lz4](https://github.com/pierrec/lz4/v4) available under [license](https://github.com/pierrec/lz4/v4/blob/master/LICENSE) | ||
* [profile](https://github.com/pkg/profile) available under [license](https://github.com/pkg/profile/blob/master/LICENSE) | ||
* [logrus](https://github.com/sirupsen/logrus) available under [license](https://github.com/sirupsen/logrus/blob/master/LICENSE) | ||
* [testify](https://github.com/stretchr/testify) available under [license](https://github.com/stretchr/testify/blob/master/LICENSE) | ||
* [goleak](https://go.uber.org/goleak) available under [license](https://pkg.go.dev/go.uber.org/goleak?tab=licenses) | ||
* [exp](https://golang.org/x/exp) available under [license](https://cs.opensource.google/go/x/exp/+/master:LICENSE) | ||
* [sys](https://golang.org/x/sys) available under [license](https://cs.opensource.google/go/x/sys/+/master:LICENSE) | ||
* [text](https://golang.org/x/text) available under [license](https://cs.opensource.google/go/x/text/+/master:LICENSE) | ||
* [yaml](https://gopkg.in/yaml.v3) available under [license](https://github.com/go-yaml/yaml/blob/v3.0.1/LICENSE) | ||
* [atlas](https://ariga.io/atlas) available under [license](https://github.com/ariga/atlas/blob/master/LICENSE) | ||
* [levenshtein](https://github.com/agext/levenshtein) available under [license](https://github.com/agext/levenshtein/blob/master/LICENSE) | ||
* [go-textseg](https://github.com/apparentlymart/go-textseg/v13) available under [license](https://github.com/apparentlymart/go-textseg/v13/blob/master/LICENSE) | ||
* [go-spew](https://github.com/davecgh/go-spew) available under [license](https://github.com/davecgh/go-spew/blob/master/LICENSE) | ||
* [go-sasl](https://github.com/emersion/go-sasl) available under [license](https://github.com/emersion/go-sasl/blob/master/LICENSE) | ||
* [fgprof](https://github.com/felixge/fgprof) available under [license](https://github.com/felixge/fgprof/blob/master/LICENSE) | ||
* [inflect](https://github.com/go-openapi/inflect) available under [license](https://github.com/go-openapi/inflect/blob/master/LICENSE) | ||
* [go-cmp](https://github.com/google/go-cmp) available under [license](https://github.com/google/go-cmp/blob/master/LICENSE) | ||
* [pprof](https://github.com/google/pprof) available under [license](https://github.com/google/pprof/blob/master/LICENSE) | ||
* [hcl](https://github.com/hashicorp/hcl/v2) available under [license](https://github.com/hashicorp/hcl/v2/blob/master/LICENSE) | ||
* [pretty](https://github.com/kr/pretty) available under [license](https://github.com/kr/pretty/blob/master/LICENSE) | ||
* [go-wordwrap](https://github.com/mitchellh/go-wordwrap) available under [license](https://github.com/mitchellh/go-wordwrap/blob/master/LICENSE) | ||
* [go-difflib](https://github.com/pmezard/go-difflib) available under [license](https://github.com/pmezard/go-difflib/blob/master/LICENSE) | ||
* [go-cty](https://github.com/zclconf/go-cty) available under [license](https://github.com/zclconf/go-cty/blob/master/LICENSE) | ||
* [mod](https://golang.org/x/mod) available under [license](https://cs.opensource.google/go/x/mod/+/master:LICENSE) | ||
* [sync](https://golang.org/x/sync) available under [license](https://cs.opensource.google/go/x/sync/+/master:LICENSE) | ||
* [check](https://gopkg.in/check.v1) available under [license](https://github.com/go-check/check/blob/v1/LICENSE) | ||
<!-- END AUTOGEN --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
#!/bin/bash | ||
|
||
set -eo pipefail | ||
|
||
src=go.mod | ||
tgt=COPYING_NOTES.md | ||
|
||
STARTAUTOGEN="<!-- START AUTOGEN -->" | ||
ENDAUTOGEN="<!-- END AUTOGEN -->" | ||
RE_STARTAUTOGEN="^${STARTAUTOGEN}$" | ||
RE_ENDAUTOGEN="^${ENDAUTOGEN}$" | ||
tmpDepLicenses="" | ||
|
||
error(){ | ||
echo "Error: $*" | ||
exit 1 | ||
} | ||
|
||
generate_dep_licenses(){ | ||
[ -r $src ] || error "Cannot read file '$src'" | ||
|
||
|
||
tmpDepLicenses="$(mktemp)" | ||
|
||
# Collect all go.mod lines beginig with tab: | ||
# * which no replace | ||
# * which have replace | ||
grep -E $'^\t[^=>]*$' $src | sed -r 's/\t([^ ]*) v.*/\1/g' > "$tmpDepLicenses" | ||
# Replace each line with formated link | ||
sed -i -r '/^github.com\/therecipe\/qt\/internal\/binding\/files\/docs\//d;' "$tmpDepLicenses" | ||
sed -i -r 's|^(.*)/([[:alnum:]-]+)/(v[[:digit:]]+)$|* [\2](https://\1/\2/\3)|g' "$tmpDepLicenses" | ||
sed -i -r 's|^(.*)/([[:alnum:]-]+)$|* [\2](https://\1/\2)|g' "$tmpDepLicenses" | ||
sed -i -r 's|^(.*)/([[:alnum:]-]+).(v[[:digit:]]+)$|* [\2](https://\1/\2.\3)|g' "$tmpDepLicenses" | ||
|
||
## add license file to github links, and others | ||
sed -i -r '/github.com/s|^(.*(https://[^)]+).*)$|\1 available under [license](\2/blob/master/LICENSE) |g' "$tmpDepLicenses" | ||
sed -i -r '/golang.org\/x/s|^(.*golang.org/x/([^)]+).*)$|\1 available under [license](https://cs.opensource.google/go/x/\2/+/master:LICENSE) |g' "$tmpDepLicenses" | ||
sed -i -r '/go.uber.org\/goleak/s|^(.*)$|\1 available under [license](https://pkg.go.dev/go.uber.org/goleak?tab=licenses) |g' "$tmpDepLicenses" | ||
sed -i -r '/gopkg.in\/yaml\.v3/s|^(.*)$|\1 available under [license](https://github.com/go-yaml/yaml/blob/v3.0.1/LICENSE) |g' "$tmpDepLicenses" | ||
sed -i -r '/ariga.io\/atlas/s|^(.*)$|\1 available under [license](https://github.com/ariga/atlas/blob/master/LICENSE) |g' "$tmpDepLicenses" | ||
sed -i -r '/entgo.io\/ent/s|^(.*)$|\1 available under [license](https://pkg.go.dev/entgo.io/ent?tab=licenses) |g' "$tmpDepLicenses" | ||
sed -i -r '/gopkg.in\/check\.v1/s|^(.*)$|\1 available under [license](https://github.com/go-check/check/blob/v1/LICENSE) |g' "$tmpDepLicenses" | ||
} | ||
|
||
|
||
check_dependecies(){ | ||
generate_dep_licenses | ||
|
||
tmpHaveLicenses=$(mktemp) | ||
sed "/${RE_STARTAUTOGEN}/,/${RE_ENDAUTOGEN}/!d;//d" $tgt > "$tmpHaveLicenses" | ||
|
||
diffOK=0 | ||
if ! diff "$tmpHaveLicenses" "$tmpDepLicenses"; then diffOK=1; fi | ||
|
||
rm "$tmpDepLicenses" || echo "Failed to clean tmp file" | ||
rm "$tmpHaveLicenses" || echo "Failed to clean tmp file" | ||
|
||
[ $diffOK -eq 0 ] || error "Dependency licenses are not up-to-date" | ||
exit 0 | ||
} | ||
|
||
update_dependecies(){ | ||
generate_dep_licenses | ||
|
||
sed -i -e "/${RE_STARTAUTOGEN}/,/${RE_ENDAUTOGEN}/!b" \ | ||
-e "/${RE_ENDAUTOGEN}/i ${STARTAUTOGEN}" \ | ||
-e "/${RE_ENDAUTOGEN}/r $tmpDepLicenses" \ | ||
-e "/${RE_ENDAUTOGEN}/a ${ENDAUTOGEN}" \ | ||
-e "d" \ | ||
$tgt | ||
|
||
|
||
rm "$tmpDepLicenses" || echo "Failed to clean tmp file" | ||
|
||
exit 0 | ||
} | ||
|
||
case $1 in | ||
"check") check_dependecies;; | ||
"update") update_dependecies;; | ||
*) error "One of actions needed: check update" ;; | ||
esac |