aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2020-11-09Snap for 6960446 from 737bf2785d1be8e857943224b401750d0b5f2184 to ↵androidx-enterprise-releaseandroid-build-prod (mdb)
androidx-enterprise-release Change-Id: I87d87f6c508ef995b003388252edab413b1e68a5
2020-11-03sixish: delete Python 2/3 compat moduleMike Frysinger
We require Python 3 everywhere, so no point in this. Bug: None Test: unittests pass Change-Id: If47bc351829610f7d7677f5255dc433ca1294079
2020-10-20Add support for automatic fixups to gofmt.androidx-print-releaseLiz Kammer
gofmt -w writes the gofmt result to the source file for the files that gofmt reports issues. Bug: 116112526 Test: ran hook for gofmt can now auto-fix formatting Change-Id: Ic676a588a567fbe5cf3f7a1411ac8048bde2af06
2020-09-16hooks: support Python 3.6 for ExclusionScopeThiébaud Weksteen
re.Pattern was only introduced in Python 3.7. Test: ./pre-upload Bug: 168593718 Change-Id: I9dc685a8d1863808d9c475539a8f1fdbd96474d0
2020-09-09tools: switch all our tools to python3 shebangMike Frysinger
We did this for pylint already, so switch the rest too. Bug: None Test: running each tool with --help works Change-Id: I0c6156cbcfabf2ebb7874cbb8a52059b1a88dfcc
2020-09-08Add [Builtin Hooks Exclude Paths] section am: ea52820de8Thiébaud Weksteen
Original change: https://android-review.googlesource.com/c/platform/tools/repohooks/+/1395027 Change-Id: Ia33c2a2caf6d02259fb3b393157a08d7e5e64a3f
2020-09-02Add [Builtin Hooks Exclude Paths] sectionThiébaud Weksteen
There is currently no convenient option to enable a hook globally if some projects will fail the processing. The recommended setup is to enable the hook within each project's repository (using PREUPLOAD.cfg). This creates inconsistencies for large codebase. Adds a new configuration section to explicitly exclude some projects during the processing of a hook. The intent of this change is to enable rustfmt globally in AOSP, except for some paths (e.g. external/, vendor/). Test: Modified GLOBAL-PREUPLOAD.cfg to enable the new option, manually creates changes and review output of pre-upload.py Bug: 160223496 Change-Id: I94dbbf0ce2e6b58c4d4b4fc89c56a2a87543d878
2020-09-02drop python2 testing entirely am: ec4cdcbeeeMike Frysinger
Original change: https://android-review.googlesource.com/c/platform/tools/repohooks/+/1417624 Change-Id: I80c4a873c4e87b9936104d94e6723a72b3649341
2020-09-02drop python2 testing entirelyMike Frysinger
No point in linting or testing when the code forces Python 3.6+. Bug: None Test: `repo upload` still works Change-Id: I5af19b5dc70be3f5be99157d1fc4287e4437c553
2020-09-01config: refactor PreUploadSettingsTests am: 324296b110Thiébaud Weksteen
Original change: https://android-review.googlesource.com/c/platform/tools/repohooks/+/1413981 Change-Id: I929668c32fb13fa260cd12562f00b026fdff3d52
2020-09-01config: add {Local,Global}PreUploadFile classes am: c9ba009aabThiébaud Weksteen
Original change: https://android-review.googlesource.com/c/platform/tools/repohooks/+/1413980 Change-Id: Ie264829e1cbf047d0bc6af3cc021d42f4a304dc4
2020-09-01config: refactor PreUploadSettingsTestsThiébaud Weksteen
PreUploadFileTests and PreUploadSettingsTests share the same setup and teardown for writing configuration files. Extract that behaviour into a new class (FileTestsBase). Test: pre-upload.py Bug: 160223496 Change-Id: I8b572cdb0f43ae4557323a43a69e66ead67d87fe
2020-09-01config: add {Local,Global}PreUploadFile classesThiébaud Weksteen
Creates 2 new classes to differentiate local (PREUPLOAD.cfg) and global (GLOBAL-PREUPLOAD.cfg) files. While not useful yet, this allows to implement validation that is specific to local files. Ideally, PreUploadFile would be declared as @abstractclass but the support for py2/py3 makes this constraint tedious to implement. Test: pre-upload.py Bug: 160223496 Change-Id: I75e0e644f713002f1ba50a405965362c1c5a7589
2020-08-31pre-upload: drop support for Python 2 am: 7698778fb0Mike Frysinger
Original change: https://android-review.googlesource.com/c/platform/tools/repohooks/+/1373921 Change-Id: I2f0e1d3939e10be0763b24ecc0b14118c1be048e
2020-08-31pre-upload: drop support for Python 2Mike Frysinger
Repo itself has been warning about Python 2 support for over a year, while pre-uplooad has been warning for about a month. We don't actually rip out any code (yet) to make sure this sticks in case we have to revert things temporarily. Bug: None Test: `repo upload` still works w/Python 3.6 Change-Id: Ia00bc3c9a59b0e6828df2691f47c6da94adb8038
2020-08-27config: refactor file management am: 1baec120bfMike Frysinger
Original change: https://android-review.googlesource.com/c/platform/tools/repohooks/+/1409412 Change-Id: Id7ed769c4436ae3d316ad046d1c181fd316f60b3
2020-08-27config: refactor file managementMike Frysinger
The existing config management started out with just one file, but has grown to load & merge from multiple sources. Refactor classes to better reflect this: one class to represent a single file, and another to represent the union of them all. By itself, this isn't interesting. But it lays the groundwork to be able to load config files from subdirs instead of only one file per project. Bug: 160223496 Test: Unittests pass Change-Id: I522b18fa8bc31f787c92cf95db7da4168007915e
2020-08-26config: add Python 3 compat APIs am: 41a1fd1aacMike Frysinger
Original change: https://android-review.googlesource.com/c/platform/tools/repohooks/+/1409411 Change-Id: I20b225c3916994aabf677b5fdc86c5f5dbdae60f
2020-08-25config: fix handling of optional args am: 0d0796a3eaMike Frysinger
Original change: https://android-review.googlesource.com/c/platform/tools/repohooks/+/1409410 Change-Id: Ie20fc9502b2683e80f3f172255a4275c2131cfbf
2020-08-25config: pull valid sections into a class constant am: 3798d7e067Mike Frysinger
Original change: https://android-review.googlesource.com/c/platform/tools/repohooks/+/1409409 Change-Id: I17090f93848c0aaf47245df5a53ca3ce6aefc351
2020-08-25config: add Python 3 compat APIsMike Frysinger
Extend the items API to be like Python 3 with an optional |section|, and add a read_dict API for Python 2 that matches Python 3. We'll use both of these in the next commit. Bug: 160223496 Test: Unittests pass Change-Id: I2b9cb987ae25f852f86427dccb18e10fe80a35da
2020-08-25config: fix handling of optional argsMike Frysinger
The current logic only works for a single optional arg, and the counts are off by one atm (for reporting). Rework the logic to simplify and so a follow up change is easier to extend. Bug: 160223496 Test: Unittests pass Change-Id: Ibcb9e159486620c9e69312ed47ba9063cf2477b9
2020-08-25config: pull valid sections into a class constantMike Frysinger
This matches the VALID_OPTIONS style, and will make follow up refactors easier. Bug: 160223496 Test: Unittests pass Change-Id: I161e4b714a6faa3432588306e50ef02ab30763a2
2020-08-19hooks: rustfmt: handle multiple commits am: f773756405Thiébaud Weksteen
Original change: https://android-review.googlesource.com/c/platform/tools/repohooks/+/1399689 Change-Id: Ib0b684b692726004efd8859569e3a3f513078498
2020-08-19hooks: rustfmt: handle multiple commitsThiébaud Weksteen
The rustfmt hook was relying on ${PREUPLOAD_FILES} which is only correct when evaluating HEAD. Update the hook to parse the correct version of the file. Before 2.0, rustfmt does not support --check when passing the source via stdin. Handle this case by comparing the input with the output and report a command to fix the issue to the user. Bug: 164111102 Test: Added multiples changes to system/security (typo and incorrect indentation). Run pre-upload.py manually. Change-Id: Ibd1bfcb9e630f0b21abfb1e1feb1248fcddf2236
2020-08-15hooks: use dedicated None asserts am: 8ee0f2a826Mike Frysinger
Original change: https://android-review.googlesource.com/c/platform/tools/repohooks/+/1401348 Change-Id: I5f8d55c2c1cdcca60971fa8d6acc5164b2c10fdb
2020-08-14hooks: use dedicated None assertsMike Frysinger
These provide better diagnostics & checking than Equal. Bug: None Test: unittests still pass Change-Id: I0c34bc1dae6d32fa58cfe0c45414157b2363b1ee
2020-08-04git: simplify commit message extraction command am: 7e07d8f6fdJonathan Nieder
Original change: https://android-review.googlesource.com/c/platform/tools/repohooks/+/1383801 Change-Id: Ie063537cd26e5e967160b4878cca3b4c87b7c0e0
2020-08-02pre-upload: use first-parent diff for list of affected files am: ce8e83897bJonathan Nieder
Original change: https://android-review.googlesource.com/c/platform/tools/repohooks/+/1383803 Change-Id: Ie176a524ce0a8c77a8b7900cbc4f949a2fc4519a
2020-08-01git: use "git rev-list" to get a revision listing am: 2e1406dfa9Jonathan Nieder
Original change: https://android-review.googlesource.com/c/platform/tools/repohooks/+/1383802 Change-Id: Ie436d3aa297c3410246571f7fe7c6ce2bdf7b3e4
2020-07-31git: simplify commit message extraction commandJonathan Nieder
Instead of using "git log <commit>^!", which means "perform a walk that includes <commit> and excludes its parents", perform a non-walking command. We could use "git log --no-walk <commit>" for this. Instead, let's use the lower-level "git diff-tree", to get into the habit of using plumbing commands that try to support scripting by behaving simply and predictably. Noticed by code inspection. Change-Id: I167e0920c0c0f67d9def1bdbdd34bd88941193a5
2020-07-31pre-upload: use first-parent diff for list of affected filesJonathan Nieder
Otherwise, trying to upload a merge can fail with errors like ValueError: Failed to parse diff output: ::100644 100644 100644 4d2b33a 4d2b33a d63fea7 MM BUILD because "git diff <foo>^!" returns a diff against all parents that DIFF_RE does not know how to parse. Reported-by: Matthew Maurer <mmaurer@google.com> Change-Id: Iafd846f083c0c078b383f7d48ad00cce896a404c
2020-07-31git: use "git rev-list" to get a revision listingJonathan Nieder
As a lower-level plumbing command designed for scripting, this can be counted on to behave simply and predictably over time. Change-Id: I628727686898a3fa5441a2dc58f9edb867d2aec7
2020-07-29Pull upstream cpplint.py from github.com/google/styleguide am: 7a814a1785Alex Light
Original change: https://android-review.googlesource.com/c/platform/tools/repohooks/+/1375269 Change-Id: I07073b9adfb2f719906a8ec200f76bd5c1de91cb
2020-07-29Pull upstream cpplint.py from github.com/google/styleguideAlex Light
Update language to comply with Android's inclusive language guidance See https://source.android.com/setup/contribute/respectful-code for reference Bug: 161896447 Test: None Change-Id: I7c18212291d7bfe57a0452a3d317a90cedd079c5
2020-07-17pre-upload: drop support for Python 3.4 am: 07107e6bd3android11-devMike Frysinger
Original change: https://android-review.googlesource.com/c/platform/tools/repohooks/+/1365079 Change-Id: I07696a11bac1fae9836cce41d3baff4dddf4058d
2020-07-15pre-upload: enable Python 2 deprecation warning am: e67d4807ccMike Frysinger
Original change: https://android-review.googlesource.com/c/platform/tools/repohooks/+/1363256 Change-Id: Idef74a1004a90285c123c8359163fddda507935f
2020-07-15Merge "pylint: always run python3 check with --py3" am: 00ebc1ad7dMike Frysinger
Original change: https://android-review.googlesource.com/c/platform/tools/repohooks/+/1363136 Change-Id: I6218a1ec51ce8fc28202b379faa51d573a955b98
2020-07-15pre-upload: drop support for Python 3.4Mike Frysinger
We've been emitting warnings about this for ~6 months, and our pylint helper actually already requires Python 3.5, so require it in the main script now too. We still emit warnings for Python 3.5 being deprecated. Bug: None Test: `repo upload` still works w/Python 3.6 Change-Id: Ib78d3d6d082ba9bfd1a26ac582a93f1f088b304f
2020-07-15pre-upload: enable Python 2 deprecation warningMike Frysinger
We don't support Python 2 at all. Warn anyone still using that version so they need to migrate by end of year. Bug: None Test: `repo-1 upload` using python2 emits a warning Change-Id: I8d7265399273086a7ac4151039e699277841be2e
2020-07-15Merge "pylint: always run python3 check with --py3"Mike Frysinger
2020-07-15pylint: always run python3 check with --py3Mike Frysinger
To help people diagnose bad host environments, check for Python 3 compatibility all the time with pylint3=True. Bug: 161198640 Test: `repo upload` with python2-only pylint emits a warning Change-Id: I856cd3d81557cedab28d21e83bcba83920abf4df
2020-06-19Fix regex in commit_msg_relnote_for_current_txt repo hook am: d7363ec065ndk-sysroot-r21Nick Anthony
Original change: https://android-review.googlesource.com/c/platform/tools/repohooks/+/1344736 Change-Id: I38cfd364bf23c3ac851d66b4a6d6f87f62bcc9ce
2020-06-19Fix regex in commit_msg_relnote_for_current_txt repo hookandroid-r-beta-3android-r-beta-2Nick Anthony
The current (incorrect) regex only enforces a Relnote tag for current.txt files in the root directory of the repo. However, current.txt can be in any repo subdirectory, so we need to enforce it everywhere. This change removes the up carrot in the regex that enforces matches must start at the line start. Bug: 159449967 Test: ./pre-upload.py (with commit_msg_relnote_for_current_txt = true) Change-Id: I7555398df6edaf410af60ce0def05894ef53ea11
2020-06-11hooks: require a Relnote field when changing current.txt am: bf70aed747Nick Anthony
Original change: https://android-review.googlesource.com/c/platform/tools/repohooks/+/1274027 Change-Id: Icd6bbf51132eff965b966bc195ad05ab11db307a
2020-06-11utils: run: fix stderr set as str instead of bytes am: 5664c11635Mike Frysinger
Original change: https://android-review.googlesource.com/c/platform/tools/repohooks/+/1315257 Change-Id: Icf32a67ac7a053f7ca3b160d33ee9c7fd327845b
2020-06-11hooks: rustfmt: fix pylint warning am: ed81c3526aMike Frysinger
Original change: https://android-review.googlesource.com/c/platform/tools/repohooks/+/1312703 Change-Id: I05a3b213888f23df3f60c8a0355bd5d3845639a1
2020-06-11pylint: find Python 3 version better am: da09d40474Mike Frysinger
Original change: https://android-review.googlesource.com/c/platform/tools/repohooks/+/1312702 Change-Id: Ifc34cbe6d6dee84f7e2ca27ab48a9fcc6e77aded
2020-06-11Merge "Add rustfmt checks" am: b13418d22cTreehugger Robot
Original change: https://android-review.googlesource.com/c/platform/tools/repohooks/+/1294805 Change-Id: I7abaa949416092ef8314725dc749a2b6a68472df
2020-06-11utils: sudo_run: delete am: 95222193d7Mike Frysinger
Original change: https://android-review.googlesource.com/c/platform/tools/repohooks/+/1293391 Change-Id: I48266f5b64979527b7ddf0ab25b6c73c17bf8359