mirror of
https://github.com/flatcar/scripts.git
synced 2025-08-20 22:11:39 +02:00
Merge pull request #1143 from marineam/readme
README: document that ebuilds are licensed under the GPLv2
This commit is contained in:
commit
2144037241
@ -1,74 +0,0 @@
|
||||
# Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
"""Top-level presubmit script for Chromium OS.
|
||||
|
||||
See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
|
||||
for more details about the presubmit API built into gcl and git cl.
|
||||
"""
|
||||
|
||||
import difflib
|
||||
import os
|
||||
import re
|
||||
|
||||
_EBUILD_FILES = (
|
||||
r".*\.ebuild",
|
||||
)
|
||||
|
||||
def _IsCrosWorkonEbuild(ebuild_contents):
|
||||
pattern = re.compile('^ *inherit[-\._a-z0-9 ]*cros-workon')
|
||||
for line in ebuild_contents:
|
||||
if pattern.match(line):
|
||||
return True
|
||||
return False
|
||||
|
||||
def Check9999Updated(input_api, output_api, source_file_filter=None):
|
||||
"""Checks that the 9999 ebuild was also modified."""
|
||||
output = []
|
||||
inconsistent = set()
|
||||
missing_9999 = set()
|
||||
for f in input_api.AffectedSourceFiles(source_file_filter):
|
||||
ebuild_contents = f.NewContents()
|
||||
# only look at non-9999
|
||||
if f.LocalPath().endswith('-9999.ebuild'):
|
||||
continue
|
||||
if _IsCrosWorkonEbuild(ebuild_contents):
|
||||
dir = os.path.dirname(f.AbsoluteLocalPath())
|
||||
ebuild = os.path.basename(dir)
|
||||
devebuild_path = os.path.join(dir, ebuild + '-9999.ebuild')
|
||||
# check if 9999 ebuild exists
|
||||
if not os.path.isfile(devebuild_path):
|
||||
missing_9999.add(ebuild)
|
||||
continue
|
||||
diff = difflib.ndiff(ebuild_contents,
|
||||
open(devebuild_path).read().splitlines())
|
||||
for line in diff:
|
||||
if line.startswith('+') or line.startswith('-'):
|
||||
# ignore empty-lines
|
||||
if len(line) == 2:
|
||||
continue
|
||||
if not (line[2:].startswith('KEYWORDS=') or
|
||||
line[2:].startswith('CROS_WORKON_COMMIT=')):
|
||||
inconsistent.add(f.LocalPath())
|
||||
|
||||
if missing_9999:
|
||||
output.append(output_api.PresubmitPromptWarning(
|
||||
'Missing 9999 for these cros-workon ebuilds:', items=missing_9999))
|
||||
if inconsistent:
|
||||
output.append(output_api.PresubmitPromptWarning(
|
||||
'Following ebuilds are inconsistent with 9999:', items=inconsistent))
|
||||
return output
|
||||
|
||||
def CheckChange(input_api, output_api, committing):
|
||||
ebuilds = lambda x: input_api.FilterSourceFile(x, white_list=_EBUILD_FILES)
|
||||
results = []
|
||||
results += Check9999Updated(input_api, output_api,
|
||||
source_file_filter=ebuilds)
|
||||
return results
|
||||
|
||||
def CheckChangeOnUpload(input_api, output_api):
|
||||
return CheckChange(input_api, output_api, False)
|
||||
|
||||
def CheckChangeOnCommit(input_api, output_api):
|
||||
return CheckChange(input_api, output_api, True)
|
7
sdk_container/src/third_party/coreos-overlay/README.md
vendored
Normal file
7
sdk_container/src/third_party/coreos-overlay/README.md
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
This overlay contains CoreOS specific packages and Gentoo packages
|
||||
that differ from their upstream Gentoo versions.
|
||||
|
||||
Licensing information can be found in the respective files, so consult
|
||||
them directly. Most ebuilds are licensed under the GPL version 2.
|
||||
|
||||
Upstream Gentoo sources: http://sources.gentoo.org/gentoo-x86/
|
@ -1,211 +0,0 @@
|
||||
# Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
"""Top-level presubmit script for Chromium OS.
|
||||
|
||||
See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
|
||||
for more details about the presubmit API built into gcl and git cl.
|
||||
"""
|
||||
|
||||
import re
|
||||
|
||||
_EXCLUDED_PATHS = (
|
||||
r"^inherit-review-settings-ok$",
|
||||
r".*[\\\/]debian[\\\/]rules$",
|
||||
)
|
||||
|
||||
# These match files that should contain tabs as indentation.
|
||||
_TAB_OK_PATHS = (
|
||||
r"/src/third_party/kernel/",
|
||||
r"/src/third_party/kernel-next/",
|
||||
r"/src/third_party/u-boot/",
|
||||
r"/src/third_party/u-boot-next/",
|
||||
r".*\.ebuild$",
|
||||
r".*\.eclass$",
|
||||
)
|
||||
|
||||
# These match files that are part of out "next" developemnt flow and as such
|
||||
# do not require a valid BUG= field to commit, but it's still a good idea.
|
||||
_NEXT_PATHS = (
|
||||
r"/src/third_party/kernel-next",
|
||||
r"/src/third_party/u-boot-next",
|
||||
)
|
||||
|
||||
_LICENSE_HEADER = (
|
||||
r".*? Copyright \(c\) 20[-0-9]{2,7} The Chromium OS Authors\. All rights "
|
||||
r"reserved\." "\n"
|
||||
r".*? Use of this source code is governed by a BSD-style license that can "
|
||||
"be\n"
|
||||
r".*? found in the LICENSE file\."
|
||||
"\n"
|
||||
)
|
||||
|
||||
|
||||
def CheckAndShowLicense(input_api, output_api, source_file_filter=None):
|
||||
"""Check that the source files have a valid License header.
|
||||
|
||||
The license header must matches our template. If not also show the
|
||||
header that should have been used.
|
||||
|
||||
"""
|
||||
results = []
|
||||
license_check = input_api.canned_checks.CheckLicense(
|
||||
input_api, output_api, _LICENSE_HEADER, source_file_filter)
|
||||
results.extend(license_check)
|
||||
if license_check:
|
||||
results.extend([output_api.PresubmitNotifyResult(
|
||||
"License header should match the following:",
|
||||
long_text=_LICENSE_HEADER)])
|
||||
return results
|
||||
|
||||
|
||||
def CheckChangeHasMandatoryBugField(input_api,
|
||||
output_api,
|
||||
source_file_filter=None):
|
||||
"""Check that the commit contains a valid BUG= field."""
|
||||
msg = ('Changelist must reference a bug number using BUG=\n'
|
||||
'For example, BUG=chromium-os:8205\n'
|
||||
'BUG=none is allowed.')
|
||||
|
||||
if (not input_api.AffectedSourceFiles(source_file_filter) or
|
||||
input_api.change.BUG):
|
||||
return []
|
||||
else:
|
||||
return [output_api.PresubmitError(msg)]
|
||||
|
||||
|
||||
def CheckChangeHasBugField(input_api, output_api, source_file_filter=None):
|
||||
# This function is required because the canned BugField check doesn't
|
||||
# take a source filter.
|
||||
return input_api.canned_checks.CheckChangeHasBugField(input_api,
|
||||
output_api)
|
||||
|
||||
|
||||
def CheckChangeHasTestField(input_api, output_api, source_file_filter=None):
|
||||
# This function is required because the canned TestField check doesn't
|
||||
# take a source filter.
|
||||
return input_api.canned_checks.CheckChangeHasTestField(input_api,
|
||||
output_api)
|
||||
|
||||
|
||||
def CheckTreeIsOpen(input_api, output_api, source_file_filter=None):
|
||||
"""Make sure the tree is 'open'. If not, don't submit."""
|
||||
return input_api.canned_checks.CheckTreeIsOpen(
|
||||
input_api,
|
||||
output_api,
|
||||
json_url='http://chromiumos-status.appspot.com/current?format=json')
|
||||
|
||||
|
||||
def CheckBuildbotPendingBuilds(input_api, output_api, source_file_filter=None):
|
||||
"""Check to see if there's a backlog on the pending CL queue"""
|
||||
return input_api.canned_checks.CheckBuildbotPendingBuilds(
|
||||
input_api,
|
||||
output_api,
|
||||
'http://build.chromium.org/p/chromiumos/json/builders?filter=1',
|
||||
6,
|
||||
[])
|
||||
|
||||
|
||||
def FilterAbsoluteSourceFile(input_api, affected_file, white_list, black_list):
|
||||
"""Filters out files that aren't considered "source file".
|
||||
|
||||
The lists will be compiled as regular expression and
|
||||
AffectedFile.AbsoluteLocalPath() needs to pass both list.
|
||||
|
||||
Note: This function was coppied from presubmit_support.py and modified to
|
||||
check against (AbsoluteLocalPath - PresubmitLocalPath) instead of LocalPath
|
||||
because LocalPath doesn't contain enough information to disambiguate kernel,
|
||||
u-boot and -next files from the rest of ChromiumOS.
|
||||
|
||||
"""
|
||||
presubmit_local_path = input_api.PresubmitLocalPath()
|
||||
|
||||
def RelativePath(affected_file):
|
||||
absolute_local_path = affected_file.AbsoluteLocalPath()
|
||||
|
||||
assert absolute_local_path.startswith(presubmit_local_path)
|
||||
return absolute_local_path[len(presubmit_local_path):]
|
||||
|
||||
def Find(relative_path, items):
|
||||
for item in items:
|
||||
if re.match(item, relative_path):
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
relative_path = RelativePath(affected_file)
|
||||
|
||||
return (Find(relative_path, white_list) and
|
||||
not Find(relative_path, black_list))
|
||||
|
||||
def RunChecklist(input_api, output_api, checklist):
|
||||
"""Run through a set of checks provided in a checklist.
|
||||
|
||||
The checklist is a list of tuples, each of which contains the check to run
|
||||
and a list of regular expressions of paths to ignore for this check
|
||||
|
||||
"""
|
||||
results = []
|
||||
|
||||
for check, paths in checklist:
|
||||
white_list = input_api.DEFAULT_WHITE_LIST
|
||||
|
||||
# Construct a black list from the DEFAULT_BLACK_LIST supplied by
|
||||
# depot_tools and the paths that this check should not be applied to.
|
||||
#
|
||||
# We also remove the third_party rule here because our paterns are
|
||||
# matching against the entire path from the root of the ChromiumOS
|
||||
# project. We use the rooted paths because we want to be able to apply
|
||||
# some of the presubmit checks to things like the kernel and u-boot that
|
||||
# live in the third_party directory.
|
||||
black_list = list(input_api.DEFAULT_BLACK_LIST)
|
||||
black_list.remove(r".*\bthird_party[\\\/].*")
|
||||
black_list.extend(paths)
|
||||
sources = lambda path: FilterAbsoluteSourceFile(input_api,
|
||||
path,
|
||||
white_list,
|
||||
black_list)
|
||||
results.extend(check(input_api, output_api, source_file_filter=sources))
|
||||
|
||||
return results
|
||||
|
||||
|
||||
def MakeCommonChecklist(input_api):
|
||||
return [(input_api.canned_checks.CheckLongLines, _EXCLUDED_PATHS),
|
||||
(input_api.canned_checks.CheckChangeHasNoStrayWhitespace,
|
||||
_EXCLUDED_PATHS),
|
||||
(CheckChangeHasTestField, _EXCLUDED_PATHS),
|
||||
(CheckAndShowLicense, _EXCLUDED_PATHS),
|
||||
(input_api.canned_checks.CheckChangeHasNoTabs,
|
||||
_EXCLUDED_PATHS + _TAB_OK_PATHS)]
|
||||
|
||||
|
||||
def MakeUploadChecklist(input_api):
|
||||
return [(CheckChangeHasBugField, _EXCLUDED_PATHS)]
|
||||
|
||||
|
||||
def MakeCommitChecklist(input_api):
|
||||
return [(CheckChangeHasMandatoryBugField, _EXCLUDED_PATHS),
|
||||
(CheckTreeIsOpen, _EXCLUDED_PATHS),
|
||||
(CheckBuildbotPendingBuilds, _EXCLUDED_PATHS)]
|
||||
|
||||
|
||||
def CheckChangeOnUpload(input_api, output_api):
|
||||
"""On upload we check against the common and upload lists."""
|
||||
return RunChecklist(input_api,
|
||||
output_api,
|
||||
MakeCommonChecklist(input_api) +
|
||||
MakeUploadChecklist(input_api))
|
||||
|
||||
|
||||
def CheckChangeOnCommit(input_api, output_api):
|
||||
"""On commit we check against the common and commit lists."""
|
||||
return RunChecklist(input_api,
|
||||
output_api,
|
||||
MakeCommonChecklist(input_api) +
|
||||
MakeCommitChecklist(input_api))
|
||||
|
||||
|
||||
def GetPreferredTrySlaves():
|
||||
return ['ChromiumOS x86']
|
@ -1,28 +0,0 @@
|
||||
# See http://dev.chromium.org/developers/contributing-code/watchlists for
|
||||
# a description of this file's format.
|
||||
# Please keep these keys in alphabetical order.
|
||||
|
||||
{
|
||||
'WATCHLIST_DEFINITIONS': {
|
||||
'all': {
|
||||
'filepath': '.',
|
||||
},
|
||||
'fonts': {
|
||||
'filepath': 'media-fonts/|media-libs/(fontconfig|freetype)/',
|
||||
},
|
||||
'chromeos-image' : {
|
||||
'filepath': 'chromeos-base/chromeos(/|-dev|-test)',
|
||||
},
|
||||
'xorg' : {
|
||||
'filepath': 'chromeos-base/xorg-conf/|x11-(base|drivers|libs|misc)/',
|
||||
},
|
||||
},
|
||||
'WATCHLISTS': {
|
||||
'all': ['adlr+crosoverlay@chromium.org',
|
||||
'msb+crosoverlay@chromium.org',
|
||||
'anush@chromium.org'],
|
||||
'chromeos-image' : ['petkov@chromium.org', 'sosa@chromium.org'],
|
||||
'fonts' : ['derat@chromium.org'],
|
||||
'xorg' : ['derat@chromium.org', 'marcheu@chromium.org'],
|
||||
},
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user