Skip to content

Commit d2ee9ec

Browse files
committed
Clean up and small changes (#58)
* last min cleanup * python remove * remove unused
1 parent 67c67b5 commit d2ee9ec

File tree

9 files changed

+99
-571
lines changed

9 files changed

+99
-571
lines changed

LICENSE.txt

+93-13
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,93 @@
1-
Source code in this repository is variously licensed under the Apache License
2-
Version 2.0, an Apache compatible license, or the Elastic License. Outside of
3-
the "x-pack" folder, source code in a given file is licensed under the Apache
4-
License Version 2.0, unless otherwise noted at the beginning of the file or a
5-
LICENSE file present in the directory subtree declares a separate license.
6-
Within the "x-pack" folder, source code in a given file is licensed under the
7-
Elastic License, unless otherwise noted at the beginning of the file or a
8-
LICENSE file present in the directory subtree declares a separate license.
9-
10-
The build produces two sets of binaries - one set that falls under the Elastic
11-
License and another set that falls under Apache License Version 2.0. The
12-
binaries that contain `-oss` in the artifact name are licensed under the Apache
13-
License Version 2.0.
1+
Elastic License 2.0
2+
3+
URL: https://www.elastic.co/licensing/elastic-license
4+
5+
## Acceptance
6+
7+
By using the software, you agree to all of the terms and conditions below.
8+
9+
## Copyright License
10+
11+
The licensor grants you a non-exclusive, royalty-free, worldwide,
12+
non-sublicensable, non-transferable license to use, copy, distribute, make
13+
available, and prepare derivative works of the software, in each case subject to
14+
the limitations and conditions below.
15+
16+
## Limitations
17+
18+
You may not provide the software to third parties as a hosted or managed
19+
service, where the service provides users with access to any substantial set of
20+
the features or functionality of the software.
21+
22+
You may not move, change, disable, or circumvent the license key functionality
23+
in the software, and you may not remove or obscure any functionality in the
24+
software that is protected by the license key.
25+
26+
You may not alter, remove, or obscure any licensing, copyright, or other notices
27+
of the licensor in the software. Any use of the licensor’s trademarks is subject
28+
to applicable law.
29+
30+
## Patents
31+
32+
The licensor grants you a license, under any patent claims the licensor can
33+
license, or becomes able to license, to make, have made, use, sell, offer for
34+
sale, import and have imported the software, in each case subject to the
35+
limitations and conditions in this license. This license does not cover any
36+
patent claims that you cause to be infringed by modifications or additions to
37+
the software. If you or your company make any written claim that the software
38+
infringes or contributes to infringement of any patent, your patent license for
39+
the software granted under these terms ends immediately. If your company makes
40+
such a claim, your patent license ends immediately for work on behalf of your
41+
company.
42+
43+
## Notices
44+
45+
You must ensure that anyone who gets a copy of any part of the software from you
46+
also gets a copy of these terms.
47+
48+
If you modify the software, you must include in any modified copies of the
49+
software prominent notices stating that you have modified the software.
50+
51+
## No Other Rights
52+
53+
These terms do not imply any licenses other than those expressly granted in
54+
these terms.
55+
56+
## Termination
57+
58+
If you use the software in violation of these terms, such use is not licensed,
59+
and your licenses will automatically terminate. If the licensor provides you
60+
with a notice of your violation, and you cease all violation of this license no
61+
later than 30 days after you receive that notice, your licenses will be
62+
reinstated retroactively. However, if you violate these terms after such
63+
reinstatement, any additional violation of these terms will cause your licenses
64+
to terminate automatically and permanently.
65+
66+
## No Liability
67+
68+
*As far as the law allows, the software comes as is, without any warranty or
69+
condition, and the licensor will not be liable to you for any damages arising
70+
out of these terms or the use or nature of the software, under any kind of
71+
legal claim.*
72+
73+
## Definitions
74+
75+
The **licensor** is the entity offering these terms, and the **software** is the
76+
software the licensor makes available under these terms, including any portion
77+
of it.
78+
79+
**you** refers to the individual or entity agreeing to these terms.
80+
81+
**your company** is any legal entity, sole proprietorship, or other kind of
82+
organization that you work for, plus all organizations that have control over,
83+
are under the control of, or are under common control with that
84+
organization. **control** means ownership of substantially all the assets of an
85+
entity, or the power to direct its management and policies by vote, contract, or
86+
otherwise. Control can be direct or indirect.
87+
88+
**your licenses** are all the licenses granted to you for the software under
89+
these terms.
90+
91+
**use** means anything you do with the software requiring one of your licenses.
92+
93+
**trademark** means trademarks, service marks, and similar rights.

Makefile

-33
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,6 @@ COVERAGE_DIR=$(BUILD_DIR)/coverage
33
BEATS?=elastic-agent
44
PROJECTS= $(BEATS)
55
PYTHON_ENV?=$(BUILD_DIR)/python-env
6-
PYTHON_EXE?=python3
7-
PYTHON_ENV_EXE=${PYTHON_ENV}/bin/$(notdir ${PYTHON_EXE})
8-
VENV_PARAMS?=
9-
FIND=find . -type f -not -path "*/build/*" -not -path "*/.git/*"
10-
GOLINT=golint
11-
GOLINT_REPO=golang.org/x/lint/golint
12-
XPACK_SUFFIX=''
136
MAGE_VERSION ?= v1.11.0
147
MAGE_PRESENT := $(shell mage --version 2> /dev/null | grep $(MAGE_VERSION))
158
MAGE_IMPORT_PATH ?= github.com/magefile/mage
@@ -75,32 +68,6 @@ check-no-changes:
7568
@git update-index --refresh
7669
@git diff-index --exit-code HEAD --
7770

78-
### Packaging targets ####
79-
80-
## snapshot : Builds a snapshot release.
81-
.PHONY: snapshot
82-
snapshot:
83-
@$(MAKE) SNAPSHOT=true release
84-
85-
## release : Builds a release.
86-
.PHONY: release
87-
release:
88-
@mage dumpVariables
89-
@$(foreach var,$(BEATS) ,$(MAKE) -C $(var) release || exit 1;)
90-
@$(foreach var,$(BEATS), \
91-
test -d $(var)/build/distributions && test -n "$$(ls $(var)/build/distributions)" || exit 0; \
92-
mkdir -p build/distributions/$(subst $(XPACK_SUFFIX),'',$(var)) && mv -f $(var)/build/distributions/* build/distributions/$(subst $(XPACK_SUFFIX),'',$(var))/ || exit 1;)
93-
94-
## release-manager-snapshot : Builds a snapshot release. The Go version defined in .go-version will be installed and used for the build.
95-
.PHONY: release-manager-snapshot
96-
release-manager-snapshot:
97-
@$(MAKE) SNAPSHOT=true release-manager-release
98-
99-
## release-manager-release : Builds a snapshot release. The Go version defined in .go-version will be installed and used for the build.
100-
.PHONY: release-manager-release
101-
release-manager-release:
102-
GO_VERSION=$(shell cat ./.go-version) ./dev-tools/run_with_go_ver $(MAKE) release
103-
10471
## get-version : Get the libbeat version
10572
.PHONY: get-version
10673
get-version:

dev-tools/mage/check.go

+1-33
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ import (
3232
func Check() error {
3333
fmt.Println(">> check: Checking source code for common problems")
3434

35-
mg.Deps(GoVet, CheckPythonTestNotExecutable, CheckYAMLNotExecutable)
35+
mg.Deps(GoVet, CheckYAMLNotExecutable)
3636

3737
changes, err := GitDiffIndex()
3838
if err != nil {
@@ -108,38 +108,6 @@ func GitDiff() error {
108108
return err
109109
}
110110

111-
// CheckPythonTestNotExecutable checks that none of the python test files are
112-
// executable. They are silently skipped and we don't want this to happen.
113-
func CheckPythonTestNotExecutable() error {
114-
if runtime.GOOS == "windows" {
115-
// Skip windows because it doesn't have POSIX permissions.
116-
return nil
117-
}
118-
119-
tests, err := FindFiles(pythonTestFiles...)
120-
if err != nil {
121-
return err
122-
}
123-
124-
var executableTestFiles []string
125-
for _, file := range tests {
126-
info, err := os.Stat(file)
127-
if err != nil {
128-
return err
129-
}
130-
131-
if info.Mode().Perm()&0111 > 0 {
132-
executableTestFiles = append(executableTestFiles, file)
133-
}
134-
}
135-
136-
if len(executableTestFiles) > 0 {
137-
return errors.Errorf("python test files cannot be executable because "+
138-
"they will be skipped. Fix permissions of %v", executableTestFiles)
139-
}
140-
return nil
141-
}
142-
143111
// CheckYAMLNotExecutable checks that no .yml or .yaml files are executable.
144112
func CheckYAMLNotExecutable() error {
145113
if runtime.GOOS == "windows" {

dev-tools/mage/fmt.go

+1-34
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import (
88
"fmt"
99
"os"
1010
"path/filepath"
11-
"strings"
1211

1312
"github.com/magefile/mage/mg"
1413
"github.com/magefile/mage/sh"
@@ -34,7 +33,7 @@ func Format() {
3433
if BeatProjectType != CommunityProject {
3534
mg.Deps(AddLicenseHeaders)
3635
}
37-
mg.Deps(GoImports, PythonAutopep8)
36+
mg.Deps(GoImports)
3837
}
3938

4039
// GoImports executes goimports against all .go files in and below the CWD.
@@ -64,38 +63,6 @@ func GoImports() error {
6463
return sh.RunV("goimports", args...)
6564
}
6665

67-
// PythonAutopep8 executes autopep8 on all .py files in and below the CWD. It
68-
// ignores build/ directories.
69-
func PythonAutopep8() error {
70-
pyFiles, err := FindFilesRecursive(func(path string, _ os.FileInfo) bool {
71-
return filepath.Ext(path) == ".py" && !strings.Contains(path, "build/")
72-
})
73-
if err != nil {
74-
return err
75-
}
76-
if len(pyFiles) == 0 {
77-
return nil
78-
}
79-
80-
fmt.Println(">> fmt - autopep8: Formatting Python code")
81-
ve, err := PythonVirtualenv()
82-
if err != nil {
83-
return err
84-
}
85-
86-
autopep8, err := LookVirtualenvPath(ve, "autopep8")
87-
if err != nil {
88-
return err
89-
}
90-
91-
args := append(
92-
[]string{"--in-place", "--max-line-length", "120"},
93-
pyFiles...,
94-
)
95-
96-
return sh.RunV(autopep8, args...)
97-
}
98-
9966
// AddLicenseHeaders adds license headers to .go files. It applies the
10067
// appropriate license header based on the value of devtools.BeatLicense.
10168
func AddLicenseHeaders() error {

dev-tools/mage/integtest.go

-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ var (
2929
"TEST_COVERAGE",
3030
"RACE_DETECTOR",
3131
"TEST_TAGS",
32-
"PYTHON_EXE",
3332
"MODULE",
3433
"KUBECONFIG",
3534
"KUBE_CONFIG",

0 commit comments

Comments
 (0)