Skip to content
This repository has been archived by the owner on May 30, 2023. It is now read-only.

Commit

Permalink
import chromeos stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
Brandon Philips committed Feb 8, 2013
1 parent b991473 commit d2023a3
Show file tree
Hide file tree
Showing 2,574 changed files with 190,368 additions and 0 deletions.
74 changes: 74 additions & 0 deletions PRESUBMIT.py
@@ -0,0 +1,74 @@
# 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)
211 changes: 211 additions & 0 deletions ROOT_PRESUBMIT.py
@@ -0,0 +1,211 @@
# 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']
28 changes: 28 additions & 0 deletions WATCHLISTS
@@ -0,0 +1,28 @@
# 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'],
},
}
30 changes: 30 additions & 0 deletions app-admin/eselect-mesa/eselect-mesa-0.0.8.ebuild
@@ -0,0 +1,30 @@
# Copyright 1999-2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/app-admin/eselect-mesa/eselect-mesa-0.0.8.ebuild,v 1.2 2010/11/28 15:37:34 chithanh Exp $

EAPI=3

DESCRIPTION="Utility to change the Mesa OpenGL driver being used"
HOMEPAGE="http://www.gentoo.org/"

SRC_URI="mirror://gentoo/${P}.tar.gz"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~alpha amd64 arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sh ~sparc x86 ~x86-fbsd"
IUSE=""

DEPEND=""
RDEPEND=">=app-admin/eselect-1.2.4"

src_install() {
insinto /usr/share/eselect/modules
doins mesa.eselect || die
}

pkg_postinst() {
if has_version ">=media-libs/mesa-7.9" && \
! [ -f "${EROOT}"/usr/share/mesa/eselect-mesa.conf ]; then
eerror "Rebuild media-libs/mesa for ${PN} to work."
fi
}
39 changes: 39 additions & 0 deletions app-benchmarks/bootchart/bootchart-0.9.2-r1.ebuild
@@ -0,0 +1,39 @@
# Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
# Distributed under the terms of the GNU General Public License v2

# NOTE: This is based on the bootchart found in Ubuntu, which is a re-working
# of the bootchart project to use a C-based collector daemon. There wasn't a
# good link to a source tarball to use in the ebuild and all we need are the
# collector and gather files from it so they are inlined in the FILESDIR.

inherit toolchain-funcs

DESCRIPTION="Performance analysis and visualization of the system boot process"
HOMEPAGE="http://packages.ubuntu.com/lucid/bootchart"
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="amd64 arm x86"
IUSE=""

DEPEND=""
RDEPEND=""

src_unpack() {
mkdir "${S}"
cp "${FILESDIR}/bootchart-collector.c" "${S}/collector.c"
cp "${FILESDIR}/bootchart-gather.sh" "${S}/gather"
cp "${FILESDIR}/bootchart.conf" "${S}"
}

src_compile() {
$(tc-getCC) ${CFLAGS} -o collector collector.c ||
die "Unable to compile bootchart collector."
}

src_install() {
exeinto /lib/bootchart
doexe collector gather

insinto /etc/init
doins bootchart.conf
}

0 comments on commit d2023a3

Please sign in to comment.