chromiumos/repohooks.git
15 months agosort project hooks 55/66755/2 master
Mike Frysinger [Fri, 23 Aug 2013 02:25:22 +0000 (22:25 -0400)]
sort project hooks

BUG=None
TEST=None

Change-Id: I6f082a2c554ae6d2467fa2fb602d1050c4251dae
Reviewed-on: https://gerrit.chromium.org/gerrit/66755
Reviewed-by: Matt Tennant <mtennant@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
17 months agoTry to check for missing revbumps of ebuilds 05/60105/5 factory-4455.B factory-pit-4390.B factory-pit-4471.B firmware-falco_peppy-4389.B firmware-leon-4389.26.B firmware-pit-4482.B firmware-wolf-4389.24.B release-R30-4537.B stabilize-4443.B stabilize-4512.B
Doug Anderson [Wed, 26 Jun 2013 17:45:36 +0000 (10:45 -0700)]
Try to check for missing revbumps of ebuilds

The idea here is to at least do some basic checking to look for cases
that we think there should be an ebuild revbump.  We still might miss
some cases, but this is better than nothing.

BUG=chromium:254502
TEST=Test on my and Todd's recent build breakers and see that they
would have been caught.  See patchset #2 of
<https://gerrit.chromium.org/gerrit/#/c/59953/> and see
<https://gerrit.chromium.org/gerrit/#/c/59996/>.  Fix these and see
that hook passes.
TEST=In chromiumos-overlay, run:
  .../src/repohooks/pre-upload.py  --rerun-since=2013-06-01
Check each revbump error.  There are a few false positives that
fall into categories like:
* https://gerrit.chromium.org/gerrit/59245 - brand new ebuild
  doesn't technically need a revbump.
* https://gerrit.chromium.org/gerrit/58988 - uses full versions

Change-Id: I3f6fd85366b07f49238314865923032710930d06
Reviewed-on: https://gerrit.chromium.org/gerrit/60105
Tested-by: Doug Anderson <dianders@chromium.org>
Reviewed-by: David James <davidjames@chromium.org>
Commit-Queue: Doug Anderson <dianders@chromium.org>

17 months agoAdd testing features to the pre-upload hook 31/60131/5
Doug Anderson [Wed, 26 Jun 2013 20:38:29 +0000 (13:38 -0700)]
Add testing features to the pre-upload hook

Add two different ways to test the pre-upload hook.  You can either
pass a list of commit hashes and run the upload hook against those
commits or you can use the '--rerun-since' option to re-run against
all non-bot commits that have happened since a certain date.

BUG=None
TEST=In chromium-os-overlay run:
  .../src/repohooks/pre-upload.py --rerun-since=2013-06-01
TEST=In chromium-os-overlay, test normal case:
  repo start foo .
  git reset --hard b4d4048a~
  git cherry-pick b4d4048a
  .../src/repohooks/pre-upload.py

Change-Id: I3db65b64f38e467cef67dced91f2c4f9f85b663d
Reviewed-on: https://gerrit.chromium.org/gerrit/60131
Tested-by: Doug Anderson <dianders@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Commit-Queue: Doug Anderson <dianders@chromium.org>

17 months agoUpdate checkpatch to match kernel v3.10-rc7 08/60008/2
Doug Anderson [Wed, 26 Jun 2013 00:21:30 +0000 (17:21 -0700)]
Update checkpatch to match kernel v3.10-rc7

The checkpatch we were running was really old.  Update it to match the
current kernel style.

BUG=None
TEST=Run "pre-upload.py" with a checkpatch error and see it's caught.
TEST=Run "pre-upload.py" without a checkpatch error and see no errors.

Change-Id: I3c07d06fecb89aea38ae7e8f2057cab431d3198e
Reviewed-on: https://gerrit.chromium.org/gerrit/60008
Tested-by: Doug Anderson <dianders@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Olof Johansson <olofj@chromium.org>
Commit-Queue: Doug Anderson <dianders@chromium.org>

19 months agoAdd more repos to the 'checkpatch.pl' set 21/50221/2 factory-4128.B factory-4290.B factory-pit-4280.B factory-spring-4131.B factory-spring-4262.B release-R28-4100.B release-R29-4319.B stabilize-4100.38.B stabilize-4255.B stabilize-4287.B stabilize-spring-4100.53.B toolchainB
Vadim Bendebury [Mon, 6 May 2013 21:16:34 +0000 (14:16 -0700)]
Add more repos to the 'checkpatch.pl' set

Private Exynos u-boot and kernel trees are not being subjected to
checkpatch.pl checks, which results in missing of some coding style
violations (like lines longer than 80 cols, foo* bar vs foo *bar,
etc.)

Since these checks are not controlled by top level PRESUBMIT.cfg files
(which is unfortunate), an actual code change is required.

BUG=none
TEST=manual

 . tried 'repo upload' an Exynos u-boot source change with code
   violations, it was passing before, and is rejected now.

Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Change-Id: I883f49cc065a66c54ecb5a522a1b727e3858ce9f
Reviewed-on: https://gerrit.chromium.org/gerrit/50221
Commit-Queue: Vadim Bendebury <vbendeb@chromium.org>
Tested-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-by: Ryan Cui <rcui@chromium.org>
20 months agoAdd check for a valid CQ-DEPEND field. 39/47239/4 stabilize-4008.0.B stabilize-4035.0.B stabilize-4068.0.B
David James [Wed, 3 Apr 2013 16:17:03 +0000 (09:17 -0700)]
Add check for a valid CQ-DEPEND field.

Common errors I've seen in the past:
  CQ-DEPENDS=1234
  CQ-DEPEND:1234

This CL catches all of the above plus more.

BUG=chromium:206541
CQ-DEPEND=CL:47271
TEST=Test with valid and invalid CQ-DEPEND fields.

Change-Id: Iafa4cb351d8f870289d72b09542218321ee6fa3c
Reviewed-on: https://gerrit.chromium.org/gerrit/47239
Tested-by: David James <davidjames@chromium.org>
Reviewed-by: Ryan Cui <rcui@chromium.org>
Commit-Queue: David James <davidjames@chromium.org>

20 months agoDisallow 'chromium-os:' in BUG field. 38/47238/2
David James [Wed, 3 Apr 2013 15:48:52 +0000 (08:48 -0700)]
Disallow 'chromium-os:' in BUG field.

The chromium-os tracker is disallowed in favor of the chromium tracker.

BUG=chromium:226095
TEST=Try out the hook with valid and invalid commit messages.
Change-Id: I2b3b1531c9a4302b39170cc956d6a781f06d63f7
Reviewed-on: https://gerrit.chromium.org/gerrit/47238
Tested-by: David James <davidjames@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Commit-Queue: David James <davidjames@chromium.org>

20 months agoUse git-format-patch to generate patch 47/46347/2 release-R27-3912.B stabilize-3912.79.B toolchainA
Che-Liang Chiou [Sat, 23 Mar 2013 01:47:55 +0000 (18:47 -0700)]
Use git-format-patch to generate patch

pre-upload.py feeds patches of commits to checkpatch.pl for style check.
However it generates patches using git-show instead of git-format-patch.
The problem with git-show is that its output format is configurable
through git-config, and so it might generate a illegitimate formatted
patch.  Besides, git-format-patch should be used to generate patches
anyway.

BUG=none
TEST=Run commands below:
       cd path/to/kernel
       git config --local --add format.pretty oneline
       path/to/pre-upload.py
     You should see no "ERROR: Missing Signed-off-by: line(s)".

Change-Id: Ica7e2f91ba67a4ba4d4ba1034c9594c67126b06d
Reviewed-on: https://gerrit.chromium.org/gerrit/46347
Tested-by: Che-Liang Chiou <clchiou@chromium.org>
Reviewed-by: Mandeep Singh Baines <msb@chromium.org>
Reviewed-by: Ryan Cui <rcui@chromium.org>
Commit-Queue: Che-Liang Chiou <clchiou@chromium.org>

21 months agoDon't try to read non-existant files in _verify_header_content. 67/44167/2 factory-spring-3842.B firmware-spring-3824.4.B firmware-spring-3824.55.B firmware-spring-3824.84.B firmware-spring-3824.B firmware-spring-3833.B stabilize-3881.0.B
Gabe Black [Wed, 27 Feb 2013 08:26:13 +0000 (00:26 -0800)]
Don't try to read non-existant files in _verify_header_content.

If you're trying to upload a series of CLs, each is run through the
verification hooks before they're actually sent to the server. In
_verify_header_content, it first gets a list of files that are involved in the
CL, and then for each of them opens the file and checks for an appropriate
copyright header at the top.

The problem is, it opens the file from the filesystem directly, and that means
it will see whatever is in your current checkout, most likely the result of
the topmost CL, not the result of the CL its trying to verify.

This can be especially problematic when a file is changed and then later
deleted since the script will try to open a non-existant file. It won't just
check the wrong thing, it'll crash and fail. To avoid that particlar problem,
this change adds a check and skips over files that no longer exist.

Ideally what it would do is to actually retrieve the contents of the file in
question as it would appear after the CL that's being verified. That would
involve several extra calls to git which might add enough overhead to be
noticable, although there's a good chance it would be fast enough to not
matter. It also seems better to make sure the script won't crash right now and
then worry about a more complete/correct fix as time permits.

BUG=None
TEST=Ran repo upload on a branch where a file was modified and then deleted
and saw the verification script crash. Ran it again with this modification and
saw the crash go away.

Change-Id: I2f7110544d936c38ec3292bdfd1f9650659da93e
Signed-off-by: Gabe Black <gabeblack@google.com>
Reviewed-on: https://gerrit.chromium.org/gerrit/44167
Reviewed-by: David James <davidjames@chromium.org>
Commit-Queue: Gabe Black <gabeblack@chromium.org>
Tested-by: Gabe Black <gabeblack@chromium.org>
22 months agocheck for ".corp.google.com" suffix in FQDN for copyright hook 92/42792/5 release-R26-3701.B stabilize-3701.30.0 stabilize-3701.30.0b stabilize-3701.46.B stabilize-3701.81.B stabilize-bluetooth-smart toolchain-3701.42.B
David Hendricks [Wed, 6 Feb 2013 21:46:38 +0000 (13:46 -0800)]
check for ".corp.google.com" suffix in FQDN for copyright hook

This will cause _check_google_copyright() to simply return if
the committer's fully qualified domain name does not end in
".corp.google.com". The idea is to enforce the check for Googlers
but avoid blocking partners and external contributors.

BUG=none
TEST=Tested manually using different arguments to endswith().

Change-Id: I2d36a62de9b0623b8b5960f2f36aa5d2d101f5fb
Reviewed-on: https://gerrit.chromium.org/gerrit/42792
Reviewed-by: David James <davidjames@chromium.org>
Reviewed-by: Doug Anderson <dianders@chromium.org>
Commit-Queue: David Hendricks <dhendrix@chromium.org>
Tested-by: David Hendricks <dhendrix@chromium.org>
22 months agouse greedy regular expressions 38/42638/3
David Hendricks [Tue, 5 Feb 2013 19:35:56 +0000 (11:35 -0800)]
use greedy regular expressions

Non-greedy regular expressions require extra syntax and usually
have a specific purpose for their usage. Greedy regular expressions
work fine in all cases currently in this file and are simpler. This
patch changes the regexen to be greedy to make the code more readable.

(credit goes to davidjames for pointing this out)

BUG=none
TEST=Tested by attempting to "repo upload" a non-conforming file.

Change-Id: Id2034e83b3f5d8b3f19b42f1d660b142e05df9ec
Reviewed-on: https://gerrit.chromium.org/gerrit/42638
Reviewed-by: David James <davidjames@chromium.org>
Commit-Queue: David Hendricks <dhendrix@chromium.org>
Tested-by: David Hendricks <dhendrix@chromium.org>
22 months agoAdd Google copyright check for Coreboot 70/42570/8
David Hendricks [Tue, 5 Feb 2013 01:53:02 +0000 (17:53 -0800)]
Add Google copyright check for Coreboot

Coreboot is a third-party project which we frequently send patches
to. Since most (or all) code we're developing internally eventually
goes upstream, we want to use assign copyright to "Google Inc"
instead of "The Chromium OS Authors".

BUG=none
TEST=tested manually with good/bad copyright lines

Change-Id: I5913135bce111bf963580c003db6c4d8c25a590a
Reviewed-on: https://gerrit.chromium.org/gerrit/42570
Commit-Queue: David Hendricks <dhendrix@chromium.org>
Reviewed-by: David Hendricks <dhendrix@chromium.org>
Tested-by: David Hendricks <dhendrix@chromium.org>
22 months agoAdd a check for "Google Inc." copyright 69/42569/7
David Hendricks [Tue, 5 Feb 2013 01:51:55 +0000 (17:51 -0800)]
Add a check for "Google Inc." copyright

For third-party projects where we are pushing code upstream we
should assign copyright to "Google Inc." rather than "The Chromium
OS" authors.

See the Chromium OS Kernel Faq and "How To Open Source Google
Code" on the OSPO site for details.

BUG=none
TEST=Tested in a follow-up CL with good/bad copyrights for a
     GPLv2 project

Change-Id: I5abd5a089a4d45a4c6d8d70c5ece337d7383e758
Reviewed-on: https://gerrit.chromium.org/gerrit/42569
Commit-Queue: David Hendricks <dhendrix@chromium.org>
Reviewed-by: David Hendricks <dhendrix@chromium.org>
Tested-by: David Hendricks <dhendrix@chromium.org>
Reviewed-by: David James <davidjames@chromium.org>
22 months agoFactor out re-usable code from _check_license 94/42594/4
David Hendricks [Tue, 5 Feb 2013 01:49:16 +0000 (17:49 -0800)]
Factor out re-usable code from _check_license

This factors out the string parsing code from _check_license. This
enables us to easily add hooks for various licenses and other header
information which may apply to third_party projects that do not
follow the Chrome/Chromium OS convention.

Hooks which check for content in a file header will only need to do
two things:
1. Specify the content to find.
2. Specify a custom string to display in case of a mismatch.

BUG=none
TEST=tested by attempting to add a file with bad CrOS-style header

Change-Id: Ibf750863dfa8425ae8dd72a536e6e2e909df081c
Signed-off-by: David Hendricks <dhendrix@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/42594
Reviewed-by: David James <davidjames@chromium.org>
Reviewed-by: Doug Anderson <dianders@chromium.org>
2 years agoMinor tweaks to custom repo hooks. factory-2914.B factory-2985.B factory-2993.B factory-3004.B factory-3536.B release-R23-2913.B release-R25-3428.B stabilize stabilize-3428.110.0 stabilize-3428.149 stabilize-3428.149.B stabilize-3428.193 stabilize-3658.0.0 stabilize-daisy stabilize-link stabilize-link-2913.278 stabilize2 toolchain-3428.65.B
Jon Salz [Thu, 30 Aug 2012 22:03:16 +0000 (06:03 +0800)]
Minor tweaks to custom repo hooks.

- Include stderr in error message
- Indent error message to make it easier to read
- Put quotation marks around hook command for clarity

BUG=chromium-os:34021
TEST=custom repohook in platform/factory

Change-Id: I9f207a09ba8071eeaf6637bbbb055a924e12b31c
Reviewed-on: https://gerrit.chromium.org/gerrit/31954
Tested-by: Jon Salz <jsalz@chromium.org>
Reviewed-by: Chris Sosa <sosa@chromium.org>
Reviewed-by: Jon Salz <jsalz@chromium.org>
Commit-Ready: Jon Salz <jsalz@chromium.org>

2 years agoAdd presubmit for kernel config/code changes
Olof Johansson [Tue, 4 Sep 2012 23:20:03 +0000 (16:20 -0700)]
Add presubmit for kernel config/code changes

We don't allow kernel configs to be changed at the same time as code,
and to avoid having to comment on it on code review, add a presubmit
hook to check for it.

BUG=chromium-os:34143
TEST=run new unit test

Change-Id: Ia8e824d79235c1913276e8b9b6cca659943ab85d
Reviewed-on: https://gerrit.chromium.org/gerrit/32187
Commit-Ready: Olof Johansson <olofj@chromium.org>
Tested-by: Olof Johansson <olofj@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
2 years agoAdd [Hook Scripts] config section. factory-2846.B factory-2848.B
Jon Salz [Sat, 18 Aug 2012 05:54:22 +0000 (13:54 +0800)]
Add [Hook Scripts] config section.

BUG=chromium-os:34021
TEST=CL:30805

Change-Id: I21855971282da8ac21eb0f981bfdd9ef800e7b49
Reviewed-on: https://gerrit.chromium.org/gerrit/30806
Tested-by: Jon Salz <jsalz@chromium.org>
Reviewed-by: Chris Sosa <sosa@chromium.org>
Commit-Ready: Jon Salz <jsalz@chromium.org>

2 years agoTry UTF-8 when checking for 80-character lines.
Jon Salz [Sat, 18 Aug 2012 06:48:02 +0000 (14:48 +0800)]
Try UTF-8 when checking for 80-character lines.

BUG=None
TEST=pre-upload_unittest.py

Change-Id: I8b9070935489c0049201d38a3cc95043a3786006
Reviewed-on: https://gerrit.chromium.org/gerrit/30812
Commit-Ready: Jon Salz <jsalz@chromium.org>
Reviewed-by: Jon Salz <jsalz@chromium.org>
Tested-by: Jon Salz <jsalz@chromium.org>
2 years agoadd MRC to list of repos for project specific hooks firmware-butterfly-2788.B firmware-stout-2817.B
Puneet Kumar [Wed, 15 Aug 2012 01:58:29 +0000 (18:58 -0700)]
add MRC to list of repos for project specific hooks

BUG=none
TEST="create a CL in MRC repo and check if upload checks require
      BRANCH= tag"
Change-Id: I3a9de8480533800f55c8fecedb2bf786c5d080be
Reviewed-on: https://gerrit.chromium.org/gerrit/30363
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Commit-Ready: Puneet Kumar <puneetster@chromium.org>
Tested-by: Puneet Kumar <puneetster@chromium.org>
2 years agoAdd check for BRANCH= tag on project specific repos
Puneet Kumar [Tue, 14 Aug 2012 02:01:18 +0000 (19:01 -0700)]
Add check for BRANCH= tag on project specific repos

BUG=none
TEST="Test that a upload in the projects specified by this CL
      require a BRANCH= line in the commit message;

      Also test that the check is ignored if the PRESUBMIT.cfg file
      has a branch_check: false"

Change-Id: Ia6315145e24ae7f4dcc26a40ebcef9224d4bdba5
Reviewed-on: https://gerrit.chromium.org/gerrit/30127
Reviewed-by: David James <davidjames@chromium.org>
Commit-Ready: Duncan Laurie <dlaurie@chromium.org>
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Commit-Ready: Puneet Kumar <puneetster@chromium.org>
Tested-by: Puneet Kumar <puneetster@chromium.org>
2 years agoRevert "Enforce the current year in license blurb." factory-2723.14.B release-R22-2723.B
David James [Tue, 7 Aug 2012 00:30:15 +0000 (17:30 -0700)]
Revert "Enforce the current year in license blurb."

This reverts commit 2237a6cf56ade5755856f388c900abba04791756

BUG=chromium-os:33326
TEST=repo allows any copyright year in changed files.

Change-Id: I7d5e7a66beb0cc70b07982e3f3862ce6a41eedb4
Reviewed-on: https://gerrit.chromium.org/gerrit/29374
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Commit-Ready: David James <davidjames@chromium.org>
Tested-by: David James <davidjames@chromium.org>
2 years agoEnforce the current year in license blurb. factory-2717.B firmware-link-2695.2.B firmware-link-2695.B firmware-parrot-2685.B firmware-snow-2695.90.B firmware-snow-2695.B
Gilad Arnold [Fri, 20 Jul 2012 18:53:53 +0000 (11:53 -0700)]
Enforce the current year in license blurb.

Enough is enough.

BUG=none
TEST=repo upload prohibits changed files from having the wrong year

Change-Id: Ib4029ede56826edc135673e500a701828d535e58
Reviewed-on: https://gerrit.chromium.org/gerrit/28040
Reviewed-by: Jay Srinivasan <jaysri@chromium.org>
Reviewed-by: Ryan Cui <rcui@chromium.org>
Tested-by: Gilad Arnold <garnold@chromium.org>
Commit-Ready: Gilad Arnold <garnold@chromium.org>

2 years agopre-upload.py: Don't verify jquery, minified JavaScript. factory-2268.16.B factory-2305.B factory-2338.B factory-2368.B factory-2394.B factory-2460.B factory-2475.B factory-2569.B firmware-link-2348.B release-R20-2268.B release-R21-2465.B
Andrew de los Reyes [Wed, 2 May 2012 18:42:54 +0000 (11:42 -0700)]
pre-upload.py: Don't verify jquery, minified JavaScript.

BUG=chromium-os:30403
TEST=uploaded my CL that had jquery and minified JS

Change-Id: I8f27373f2d96e1d34e361bf803b540af83f1841e
Reviewed-on: https://gerrit.chromium.org/gerrit/21653
Reviewed-by: Benson Leung <bleung@chromium.org>
Commit-Ready: Andrew de los Reyes <adlr@chromium.org>
Tested-by: Andrew de los Reyes <adlr@chromium.org>
2 years agoupdate EC repository path factory-1987.B release-R19-2046.B
Vincent Palatin [Tue, 28 Feb 2012 21:06:59 +0000 (13:06 -0800)]
update EC repository path

As the EC repository has moved, update the path in the script to ensure
we still get pre-upload checks on both public and private code.

BUG=None
TEST="repo upload" a non-conform patch and see the warnings

Change-Id: Iaf7dba453d53a20d15abb661de05b3b6f4d99898
Reviewed-on: https://gerrit.chromium.org/gerrit/16996
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Dave Parker <dparker@chromium.org>
2 years agorepohooks: Allow BUG=chromium:1234. release-R18-1660.B
Daniel Erat [Tue, 10 Jan 2012 17:48:20 +0000 (09:48 -0800)]
repohooks: Allow BUG=chromium:1234.

We previously just allowed references to the chromium-os and
chrome-os-partner trackers.

Something else will need to be changed to linkify the BUG
line in the web interface.

BUG=none
TEST=referenced an arbitrary chromium issue when first uploading this change

Change-Id: Ibb85016eb8263cdf62a3e579eb2d62bc50e917ac
Reviewed-on: https://gerrit.chromium.org/gerrit/13941
Reviewed-by: David McMahon <djmm@chromium.org>
Tested-by: David McMahon <djmm@chromium.org>
Tested-by: Daniel Erat <derat@chromium.org>
Commit-Ready: Daniel Erat <derat@chromium.org>

2 years agocosmetic: Added docstring to main() function.
Doug Anderson [Thu, 5 Jan 2012 19:02:14 +0000 (11:02 -0800)]
cosmetic: Added docstring to main() function.

BUG=None
TEST=./pre-upload.py --test -v

Change-Id: I051a499d6d67844fcc655a3ce7b6cd90f06e3fe0
Reviewed-on: https://gerrit.chromium.org/gerrit/13714
Tested-by: Doug Anderson <dianders@chromium.org>
Reviewed-by: Mandeep Singh Baines <msb@chromium.org>
2 years agoAllow running the pre-upload hook outside of the context of repo.
Doug Anderson [Wed, 2 Nov 2011 17:37:37 +0000 (10:37 -0700)]
Allow running the pre-upload hook outside of the context of repo.

This can be useful for two things:
1. Running hooks itself without running 'repo upload'.  This might
   be useful since it should be a bit quicker.
2. Running hooks even if you don't have a full Chromium OS checkout.
   In this case, you could just fetch down the hooks and a project,
   then run the hooks directly.  In this mode, the '--project' option
   is required.

BUG=None
TEST=Ran pre-upload hooks in the context of repo (ran repo upload).

TEST=Ran doctests:
1. Ran .../hooks/pre-upload.py --test -v

TEST=Ran pre-upload hooks in a bare checkout of u-boot:
1. mkdir /tmp/pureuboot
2. cd /tmp/pureuboot/
3. git init
4. git remote add cros http://git.chromium.org/git/chromiumos/third_party/u-boot
5. git fetch cros
6. git checkout -b testing --track cros/master
7. echo '  foobar  ' >> Makefile
8. git commit -am "testing"
9. .../hooks/pre-upload.py --project=chromiumos/third_party/u-boot
10. Saw hook report an error (including signed-off-by, showing that we got
    u-boot hooks).

TEST=Ran pre-upload hooks manually in chromiumos checkout:
1. cd ~/chromiumos/src/third_party/u-boot/files
2. repo start testing .
3. echo '  foobar  ' >> Makefile
4. git commit -am "testing"
5. ~/chromiumos/src/repohooks/pre-upload.py
6. Saw hook report an error (including signed-off-by, showing that we got
   u-boot hooks).

Change-Id: Ia9ee51d21bba5a3fdc94f140e2d2308ed97f0273
Reviewed-on: https://gerrit.chromium.org/gerrit/11056
Tested-by: Doug Anderson <dianders@chromium.org>
Reviewed-by: Mandeep Singh Baines <msb@chromium.org>
3 years agoAdd EC source code to pre-upload checks
Vincent Palatin [Wed, 7 Dec 2011 23:57:47 +0000 (23:57 +0000)]
Add EC source code to pre-upload checks

The EC code base should follow Linux kernel coding style.

BUG=None
TEST="repo upload" a non-conform patch and see the warnings

Change-Id: Ifbacd574d0e0f485279a989188c9821e1fd2cdf7
Reviewed-on: https://gerrit.chromium.org/gerrit/12595
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
3 years agorepohooks: allow tabs in .mk files factory-1412.B release-R17-1412.B
Elly Jones [Tue, 15 Nov 2011 19:57:06 +0000 (14:57 -0500)]
repohooks: allow tabs in .mk files

BUG=None
TEST=Adhoc
'repo upload' with a CL with tabs in a .mk file.

Change-Id: I845e21a893611ff0ccb24f4ea7db700ad5cb90bf
Signed-off-by: Elly Jones <ellyjones@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/11718
Reviewed-by: Will Drewry <wad@chromium.org>
3 years agoSuppress checks for files in overlay profiles factory-1284.B firmware-kiev-2.112.B firmware-uboot_v2-1299.B
Doug Anderson [Tue, 25 Oct 2011 23:45:41 +0000 (16:45 -0700)]
Suppress checks for files in overlay profiles

I was getting warnings like these upon repo upload:
  Found a bad license header in these files:
      * /usr/local/google/home/dianders/chromiumos/src/overlays/overlay-waluigi/profiles/base/parent
      * /usr/local/google/home/dianders/chromiumos/src/overlays/overlay-waluigi/profiles/base/virtuals
      * /usr/local/google/home/dianders/chromiumos/src/overlays/overlay-waluigi/profiles/kernel-next/parent
      * /usr/local/google/home/dianders/chromiumos/src/overlays/overlay-waluigi/profiles/kernel-next/virtuals

BUG=None
TEST=No longer get warnings mentioned above upon repo upload.

Change-Id: I94076141ad08079f6a309e9260c280b9afd5148c
Reviewed-on: https://gerrit.chromium.org/gerrit/10686
Tested-by: Doug Anderson <dianders@chromium.org>
Reviewed-by: Ryan Cui <rcui@chromium.org>
Commit-Ready: Doug Anderson <dianders@chromium.org>

3 years agoAdd u-boot-vboot-integration to pre-upload checks factory-1235.B
Che-Liang Chiou [Thu, 20 Oct 2011 08:14:38 +0000 (16:14 +0800)]
Add u-boot-vboot-integration to pre-upload checks

u-boot-vboot-integration is imported from our U-Boot repo and so it
follows Linux kernel coding style.

BUG=chromium-os:20453
TEST=Submit a u-boot-vboot-integration patch and observe checkpatch
     violations

Change-Id: I0821a8822991567e6d3582a571e090435f8e78f5
Reviewed-on: http://gerrit.chromium.org/gerrit/10399
Reviewed-by: Che-Liang Chiou <clchiou@chromium.org>
Tested-by: Che-Liang Chiou <clchiou@chromium.org>
3 years agosuppress checks for ebuild Manifests and caches
Brian Harring [Tue, 18 Oct 2011 23:48:08 +0000 (16:48 -0700)]
suppress checks for ebuild Manifests and caches

BUG=chromium-os:11308, chromium-os:21049
TEST=repo upload after adding a Manifest to a tree

Change-Id: I419e9664c50d2f6aecb4c505852a69e51114626b
Reviewed-on: http://gerrit.chromium.org/gerrit/10264
Reviewed-by: David James <davidjames@chromium.org>
Reviewed-by: Ryan Cui <rcui@chromium.org>
Reviewed-by: Brian Harring <ferringb@chromium.org>
Tested-by: Brian Harring <ferringb@chromium.org>
3 years agoU-Boot: Remove old paths and add checkpatch check to U-Boot commits factory-1020.B factory-980.B release-1011.B release-R16-1193.B test-982.B
Anton Staaf [Mon, 22 Aug 2011 17:08:45 +0000 (10:08 -0700)]
U-Boot: Remove old paths and add checkpatch check to U-Boot commits

This creates a new check called _run_checkpatch_no_tree that will
run checkpatch with the --no-tree option.  This option is required
for U-Boot because U-Boot doesn't match the kernel tree.

BUG=None
TEST=Upload new patch for U-Boot with checkpatch violations.
Observe that the upload failed due to violations.

Change-Id: I8a46641fb956bc6cb14fbbf528a7487258ec5afe
Reviewed-on: http://gerrit.chromium.org/gerrit/6403
Tested-by: Anton Staaf <robotboy@chromium.org>
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
3 years agoEnsure BUG= line is formatted correctly. 0.14.811.B 0.15.877.B 780.B firmware-881-u-boot-v1 firmware-u-boot-v1
David McMahon [Fri, 10 Jun 2011 22:46:36 +0000 (15:46 -0700)]
Ensure BUG= line is formatted correctly.

BUG=chromium-os:16422
TEST=Tested using this CL

Change-Id: Idefbb0a83616a79774be88a2748f36effb05a391
Reviewed-on: http://gerrit.chromium.org/gerrit/2639
Reviewed-by: David McMahon <djmm@google.com>
Tested-by: David McMahon <djmm@google.com>
Reviewed-by: Ryan Cui <rcui@chromium.org>
3 years agoAdd .gitignore so 'repo status' doesn't show errors.pyc. 0.13.558.B 0.13.587.B
Doug Anderson [Tue, 17 May 2011 16:39:27 +0000 (09:39 -0700)]
Add .gitignore so 'repo status' doesn't show errors.pyc.

...also ignore emacs backup files (ending with ~) while we're at it.

BUG=none
TEST=Ran 'pre-upload.py', saw errors.pyc, ran 'repo status'.

Change-Id: I77894c89bf0cf5f2dffda1a8c531ca3c38280f7d
Reviewed-on: http://gerrit.chromium.org/gerrit/1030
Reviewed-by: Ryan Cui <rcui@chromium.org>
Tested-by: Doug Anderson <dianders@chromium.org>
3 years agoLook at PRESUBMIT.cfg file to disable style checks
Ryan Cui [Wed, 11 May 2011 18:38:58 +0000 (11:38 -0700)]
Look at PRESUBMIT.cfg file to disable style checks

- Use ConfigParser to look for hooks to disable in PRESUBMIT.cfg file in
  the project root.
- Add sample PRESUBMIT.cfg file that disables source style hooks.
- Add README file to explain PRESUBMIT.cfg.
- Add hint that directs user to README file for disabling hooks.

BUG=15162
TEST=Test with and without PRESUBMIT.cfg file.
     Test with and without disable flags in PRESUBMIT.cfg file
     Test without [Disable] section in PRESUBMIT.cfg file

Change-Id: Ia3a97516835f4f7f24cd35529d0e8db7afd0fbeb
Reviewed-on: http://gerrit.chromium.org/gerrit/740
Reviewed-by: Mandeep Singh Baines <msb@chromium.org>
Tested-by: Ryan Cui <rcui@chromium.org>
3 years agoRun hooks and show errors for all projects and commits before quitting. 0.13.509.B
Ryan Cui [Mon, 9 May 2011 18:01:31 +0000 (11:01 -0700)]
Run hooks and show errors for all projects and commits before quitting.

- Add functionality that formats and prints hook errors and context (project, commit info)
- No longer exit on first error.  Print errors for all projects/commits, and exit on error at the end.
- No longer throw exceptions for hook failures, instead return HookFailure instance.
- Move error reporting functionality into errors.py module
- Add hints to help user with common tasks (uploading only current project, updating hooks).

BUG=None
TEST=Ran with errors in multiple repos.  Ran with no errors.

Change-Id: I0b539a4f9ce31aac6d12e0239f203082439731df
Reviewed-on: http://gerrit.chromium.org/gerrit/558
Reviewed-by: Ryan Cui <rcui@chromium.org>
Tested-by: Ryan Cui <rcui@chromium.org>
3 years agoAdded ktop and punybench to exclusion list
Paul Taysom [Mon, 9 May 2011 21:32:42 +0000 (14:32 -0700)]
Added ktop and punybench to exclusion list

Because both ktop and punybnech have GPLv2 code, they should
not be checked for standard copywrite comment.

BUG=14974
TEST=ran "repo upload ." on ktop

Change-Id: Ieb02fb1ed5419169fb3bc80385290f79684be87c
Reviewed-on: http://gerrit.chromium.org/gerrit/555
Reviewed-by: Paul Taysom <taysom@google.com>
Tested-by: Paul Taysom <taysom@google.com>
3 years agoAdd u-boot-config to the list of TAB_OK projects.
Doug Anderson [Mon, 9 May 2011 22:56:25 +0000 (15:56 -0700)]
Add u-boot-config to the list of TAB_OK projects.

BUG=none
TEST=Tried uploading something from u-boot-config.

Change-Id: I944dd9915e55a440c477835c8047cf805542c3c4
Signed-off-by: Doug Anderson <dianders@chromium.org>
Reviewed-on: http://gerrit.chromium.org/gerrit/564
Reviewed-by: Ryan Cui <rcui@chromium.org>
3 years agoAdjust pre-upload to give cleaner errors.
Don Garrett [Thu, 5 May 2011 22:17:14 +0000 (15:17 -0700)]
Adjust pre-upload to give cleaner errors.

_report_error will now throw a specific exception. Error handlers
will check for that exception and give friendler errors than a
stack trace.

BUG=None
TEST=Used it.

Change-Id: If686d3a48ca6605e7ae501a9ed81df387650b6ae
Reviewed-on: http://gerrit.chromium.org/gerrit/379
Reviewed-by: Ryan Cui <rcui@chromium.org>
Tested-by: Don Garrett <dgarrett@chromium.org>
3 years agoPrint which project _get_commits() failed for
Ryan Cui [Fri, 6 May 2011 18:16:55 +0000 (11:16 -0700)]
Print which project _get_commits() failed for

'repo upload' may run hooks on multiple repositories.  Add error info for which project is not on a tracking branch.

BUG=None
TEST=Ran hooks with no tracking branch, and with tracking branch

Change-Id: I9c743bbac9d951045b68916236feeeddcbd31514
Reviewed-on: http://gerrit.chromium.org/gerrit/439
Tested-by: Ryan Cui <rcui@chromium.org>
Reviewed-by: Don Garrett <dgarrett@chromium.org>
3 years ago[repohooks] Remove %B in favour of %s & %b
Sean Paul [Fri, 6 May 2011 17:10:44 +0000 (13:10 -0400)]
[repohooks] Remove %B in favour of %s & %b

Remove the requirement for git 1.7.2 and instead switch --format=%B for
--format=%s and --format=%b

BUG=none
TEST=Test using git 1.7.1 and 1.7.2.3 to ensure the same result.

Change-Id: Ib82249a2ea984f1431417ba0777214cba1e2fcc8
Reviewed-on: http://gerrit.chromium.org/gerrit/426
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Tested-by: Sean Paul <seanpaul@chromium.org>
3 years agoUse the upstream tracking branch of current branch as base, instead of m/master.
Ryan Cui [Thu, 5 May 2011 22:41:19 +0000 (15:41 -0700)]
Use the upstream tracking branch of current branch as base, instead of m/

Check for the tracking branch of the current branch to use for finding new commits.
Errors out if repo is not on a branch or is not on a tracking branch.

BUG=14931
TEST=Uploaded this change

Change-Id: If6e94dc149a37d7242d5a85f37e9a4b2bd7cfa32
Reviewed-on: http://gerrit.chromium.org/gerrit/383
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Reviewed-by: Mandeep Singh Baines <msb@chromium.org>
Tested-by: Ryan Cui <rcui@chromium.org>
3 years agoAdd a _run_command() function that executes shell commands.
Ryan Cui [Thu, 5 May 2011 21:51:33 +0000 (14:51 -0700)]
Add a _run_command() function that executes shell commands.

BUG=None
TEST=Uploaded this CL

Change-Id: Ifec031352cd1d6ec90ad3e523cf08b61e1315269
Reviewed-on: http://gerrit.chromium.org/gerrit/375
Reviewed-by: Mandeep Singh Baines <msb@chromium.org>
Tested-by: Ryan Cui <rcui@chromium.org>
3 years ago[repohooks] Fix bug in pre-upload.py that fails on versions with characters 70/370/1
Sean Paul [Thu, 5 May 2011 21:10:31 +0000 (17:10 -0400)]
[repohooks] Fix bug in pre-upload.py that fails on versions with characters

There was a bug in my previous CL to pre-upload.py which rejected git versions
with characters in them (i.e. 1.7.5.rc3). This change ignores characters at the
end of the version string (thus making the above example 1.7.5).

BUG=none
TEST=Tested with version string 1.7.5.rc3, 1.7.1, 1.7.2.3 and ensured the
     behaviour was as expected.

Change-Id: Ia5fbe6a7dd8ffe888bf45679889f9bd0aa726cb9

3 years ago[repohooks] Update pre-upload.py script to check git version 42/342/2
Sean Paul [Thu, 5 May 2011 15:36:23 +0000 (11:36 -0400)]
[repohooks] Update pre-upload.py script to check git version

This change checks the git version and fails if it is 1.7.2.0 or
lower.

BUG=none
TEST=Ran repo upload in environment with sufficient and
     insufficient git versions. Ensured it fails when the version
     is 1.7.1 and succeeds when the version is 1.7.2.3

Change-Id: I34ee42fbc40f2419529e87da4f9bf79d8583c591

3 years agoPartially revert "Disable source file checks for src/third_party repos and reorder... 22/322/1
Ryan Cui [Thu, 5 May 2011 04:00:45 +0000 (21:00 -0700)]
Partially revert "Disable source file checks for src/third_party repos and reorder source file hooks"

This partially reverts commit e37fe1a907de01f11ae6523c890333b4a30e0513.
Source file checks are re-enabled for third party repos, but keep the reordering of the source file hooks.

BUG=None
TEST=uploaded this change

Change-Id: Iaaeb5cac871d69c4193b4b4e91cc820dfa61fe07

3 years agoDisable source file checks for src/third_party repos and reorder hooks 87/287/2
Ryan Cui [Wed, 4 May 2011 02:00:10 +0000 (19:00 -0700)]
Disable source file checks for src/third_party repos and reorder hooks

Disable source file checks for src/third_party repos until we find a better way to decide when to run source file hooks.
Reorder hooks to run commit message checks first.

BUG=None
TEST=Tested on src/third_party repo and non-third_party repo.

Change-Id: I5dbc8dd08631174a2cf5c99bebe40c959924708a

3 years agopre-upload.py: check that Change-Id is in the last line 08/308/7
Mandeep Singh Baines [Wed, 4 May 2011 20:43:25 +0000 (13:43 -0700)]
pre-upload.py: check that Change-Id is in the last line

If the Change-Id is not on the last line a new review gets created
on upload.

BUG=none
TEST=Tested by adding stuff below Change-Id in this cl.

Change-Id: Iea595752f267df29248f59fc69d417c63519181a

3 years agoFix broken JSON validator. Needs list and not a string. 88/288/1
Dale Curtis [Wed, 4 May 2011 19:01:05 +0000 (12:01 -0700)]
Fix broken JSON validator. Needs list and not a string.

BUG=none
TEST=Ran against repo w/ JSON and without JSON changes.

Change-Id: I37590abc7622bbfdfa13f7346e4aa27d848d2164

3 years agoAdd JSON verification hooks for autotest-tools repo. 37/237/1
Dale Curtis [Wed, 4 May 2011 00:25:20 +0000 (17:25 -0700)]
Add JSON verification hooks for autotest-tools repo.

BUG=none
TEST=Ran "repo upload" with good/bad JSON.

Change-Id: I2e5455a3775469e4abbc034af0d7d3c25f0a6ac0
Signed-off-by: Dale Curtis <dalecurtis@chromium.org>
3 years agopre-upload.py: simplify BUG and TEST checks 83/183/5
Mandeep Singh Baines [Tue, 3 May 2011 18:10:25 +0000 (11:10 -0700)]
pre-upload.py: simplify BUG and TEST checks

Modified get_description to return a string instead of a list.

TEST=Used this change to test. Tried with out TEST= and then without BUG=.
BUG=none

Change-Id: Ia2c40e07fa23ed4cf43d042f5dd212f716d09073

3 years agopre-upload.py: inform user about commit and project which is failing 88/188/1
Mandeep Singh Baines [Tue, 3 May 2011 18:37:02 +0000 (11:37 -0700)]
pre-upload.py: inform user about commit and project which is failing

BUG=none
TEST=Tested via not initially having a TEST= line.

Change-Id: Ic2d62212e9f1572b18293a48cc7f73eadfdb7ba6

3 years agoPort git-cl-upload hooks over to the 'repo upload' workflow 06/106/5
Ryan Cui [Mon, 2 May 2011 21:15:25 +0000 (14:15 -0700)]
Port git-cl-upload hooks over to the 'repo upload' workflow

Port hooks we run for most repos (i.e., check long lines).

JSON file checks for autotest-tools are not yet implemented.

BUG=14696
TEST=tested each hook manually

Change-Id: I050b16003fa26349547d127dc78f92629a642978

3 years agoMerge "Run checkpatch on kernel-next, too."
Doug Anderson [Mon, 2 May 2011 20:29:02 +0000 (13:29 -0700)]
Merge "Run checkpatch on kernel-next, too."

3 years agoRun checkpatch on kernel-next, too. 00/100/1
Doug Anderson [Mon, 2 May 2011 17:08:37 +0000 (10:08 -0700)]
Run checkpatch on kernel-next, too.

TEST=Created a bad change in kernel-next and tried 'repo upload'.

Change-Id: I38201460aac94b4a16eb23c29647151e8e947bc3

3 years agoUpdate checkpatch to the one from 2.6.38. 99/99/2
Doug Anderson [Mon, 2 May 2011 16:49:48 +0000 (09:49 -0700)]
Update checkpatch to the one from 2.6.38.

This makes sure that we have the checkpatch from kernel-next.
Should be fine for checking patches even against 2.6.37 or
even 2.6.32.

Change-Id: I8e737ec83976858b6c25062b9eead42d15bf89e8

3 years agopre-upload.py: iterate over each commit 85/85/1
Mandeep Singh Baines [Fri, 29 Apr 2011 22:32:06 +0000 (15:32 -0700)]
pre-upload.py: iterate over each commit

BUG=none
TEST=Tested on a kernel branch with two commits.

Change-Id: I2aa5db8f6bc41f6fb2237a969048634c0d2f74cc

3 years agopre-upload.py: Generalize a framework and add kernel checkpatch.pl 82/82/1
Mandeep Singh Baines [Wed, 27 Apr 2011 22:16:37 +0000 (15:16 -0700)]
pre-upload.py: Generalize a framework and add kernel checkpatch.pl

pre-upload.py is now capable of checking kernel committs.

Change-Id: I6d055d384310f6813d3a8c23e4bfe30ead09bf15

3 years agopre-upload.py: import random
Mandeep Singh Baines [Wed, 6 Apr 2011 17:34:52 +0000 (10:34 -0700)]
pre-upload.py: import random

Also, fix white-space.

Change-Id: I3ab627e646d5ac11ad770e6acdfb731f8de1ffe1
(cherry picked from commit 69c843a246f9a8bbf2db6283b3d2d045976b58b4)

3 years agoAdd pre-upload.py sample
Anush Elangovan [Wed, 23 Mar 2011 07:41:27 +0000 (00:41 -0700)]
Add pre-upload.py sample