Commit Graph

16 Commits

Author SHA1 Message Date
Stephen Kitt
f146b4287f
Licensing: skip modules with fewer subdirs than mods
This came up when updating go-oidc. After updating go-oidc (with its
dependency tree), cloud.google.com/go was no longer used as a package
import, but still listed in the module dependency graph; as a result,
"go mod vendor" no longer pulled in cloud.google.com/go itself, but
update-vendor-licenses.sh still wanted a license file for it since it
appeared in the list of modules.

This scenario is already supposed to be handled: when a module doesn't
contain any *files* as first-level content, if the number of
subdirectories it contains *equals* the number of submodules it
contains (excluding itself), the module is skipped. This fails for
cloud.google.com/go because several submodules are included in the
module dependency graph but aren't actually used, and therefore not
vendored.

Updating the test to check that the number of subdirectories is less
than or equal to the number of expected submodules fixes this.

The correct fix would be to process the submodules first, keeping a
note of which ones really have content, then check that the top-level
module only contains subdirectories corresponding to those modules;
but it's not clear to me that this is worth the effort (especially in
a shell script).

Signed-off-by: Stephen Kitt <skitt@redhat.com>
2023-01-03 16:48:35 +01:00
Jordan Liggitt
1176b7ca28 Update go.mod files to go1.18, update license vendor script 2022-05-04 10:22:27 -04:00
Davanum Srinivas
40f1db8d2d
update license gathering script for forked code
Signed-off-by: Davanum Srinivas <davanum@gmail.com>
2021-07-08 07:48:19 -04:00
David Ashpole
cbdf84a374 handle longer vendor paths without go files 2020-09-21 14:48:19 -07:00
Jordan Liggitt
49b78b88dc Fix searching for licenses in single-segment modules 2020-07-01 16:12:36 -04:00
Giuseppe Scrivano
78d295d168
hack/update-vendor-licenses.sh: skip empty packages
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2020-06-24 18:39:49 +02:00
Jordan Liggitt
660c290bbf go1.14: set -mod=mod while rebuilding/linting vendor and building licenses, preserve explicit imports in modules.txt 2020-06-23 19:04:43 -04:00
Tim Hockin
7cbef7b26f Fix truncated logfile in verify-vendor
Writing to /dev/stderr causes a new FD to be opened.  If this is a
literal file, that file can get truncated.  `>&2` does not suffer the
same problem.
2020-05-07 21:49:06 -07:00
Tim Hockin
325ea6e3c2 Restructure licenses again (revert cd4474a)
This moves licenses of vendored code from one monolith file into a tree
of individual files for easier reviews.  This fixes both the bash and
bazel paths.
2020-05-07 21:48:59 -07:00
Davanum Srinivas
ff6a888180
generate LICENSES used in tools
Signed-off-by: Davanum Srinivas <davanum@gmail.com>
2020-04-20 13:45:46 -04:00
Jordan Liggitt
cd4474ae4f Revert "76093 restructure LICENSES file generation"
This reverts commit d39ac98cc5.
2019-11-13 10:24:32 -05:00
Ji Shan Xing
d39ac98cc5 76093 restructure LICENSES file generation 2019-11-12 20:38:57 -05:00
Jordan Liggitt
7232c0fd0b Fix license script to handle single-segment packages 2019-07-31 16:06:13 -04:00
Benjamin Elder
c8a6a720c3 use kube::util::md5 for update-vendor-licenses.sh 2019-06-23 12:08:05 -07:00
SataQiu
67509020ca fix shellcheck failures of hack/update-vendor-licenses.sh 2019-04-09 13:47:30 +08:00
Jordan Liggitt
2ea3cbdcbc Update hack scripts to use go mod 2019-04-03 10:19:39 -04:00