Skip to content

Commit

Permalink
Add pre-commit hooks to format trailing whitespaces (#924)
Browse files Browse the repository at this point in the history
  • Loading branch information
hofbi authored Jan 20, 2025
1 parent b0b1d47 commit 7758f2c
Show file tree
Hide file tree
Showing 20 changed files with 118 additions and 131 deletions.
12 changes: 12 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,18 @@ repos:
hooks:
- id: buildifier
- id: buildifier-lint
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: check-toml
- id: destroyed-symlinks
- id: detect-private-key
- id: end-of-file-fixer
exclude: |
(?x)^(
tests/testdata/
)
- id: trailing-whitespace
- repo: https://github.com/crate-ci/typos
rev: v1.29.4
hooks:
Expand Down
50 changes: 25 additions & 25 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Thanks to: Alex Bozhenko, Chuck Grindel, Diego Ortin, and Tomasz Wojno

**Breaking Changes
- Remove PackageArtifactsInfo. (#752)

Thanks to: Adam Azarchs, Alex Eagle, August Karlstedt, Austin Schuh, Adrian Vogelsgesang,
flode, Florian Scheibner, Ignas Kaziukėnas, Jean-Hadrien Chabran, Matt,
Mike Kelly, Paul Draper, Sam Schwebach, Tomasz Wojno, and Vertexwahn
Expand Down Expand Up @@ -117,7 +117,7 @@ for contributions to this release.
- Get rid of the long deprecated archive_name and extension from pkg_zip. (#552)
- Make 'out' work in a reasonable way. Fixes #414
- Partial fix for #284

## Bug fixes:

- Only allow .deb Description to be multiline. (#573)
Expand Down Expand Up @@ -533,23 +533,23 @@ commit 48001d12e7037b04dc5b28fadfb1e10a8447e2fc
Date: Thu Mar 12 15:14:32 2020 -0400

Depend on rules_python (#140)

* load rules python

* add workspace deps

* add missing loads

commit 2b375a08bfe36d2c35885a6f4e5b12d7898c9426
Author: Ryan Beasley <[email protected]>
Date: Wed Mar 11 14:49:21 2020 -0400

Update test data in response to #121 (#137)

PR #121 changed pkg_deb's behavior but didn't update test data to match.

Reported in PR #132.

Testing Done:
- `bazelisk test ...`

Expand All @@ -558,45 +558,45 @@ commit e5919f43791b2d4c5ab9e68786087cf889b9987e
Date: Fri Feb 28 01:22:37 2020 -0500

Add pkgfilegroup for package-independent destination mappings (#128)

* Add pkgfilegroup for package-independent destination mappings

This adds an experimental rule, `pkgfilegroup`, along with associated Providers,
that gives rule developers and users a consistent mechanism for using the output
of bazel targets in packaging rules.

Inspired by #36.

Other capabilities that are provided by this that were not mentioned in #36 are:

- Creation of empty directories (`pkg_mkdirs`)
- Exclusion of files from a `pkgfilegroup` (`excludes`)
- Renames of files in a `pkgfilegroup` (`renames`)

* Add analysis tests for pkgfilegroup and friends

This provides some analysis tests for various features of `pkgfilegroup` and
`pkg_mkdirs`. See #128.

You can run them by invoking `bazel test experimental/...` from the `pkg`
directory

This implementation of pkgfilegroup was inspired by #36.

commit 7a991dea418ab17c7e86f0a7b5e7d4a87ef4304b
Author: Ryan Beasley <[email protected]>
Date: Fri Feb 28 01:02:24 2020 -0500

Improve handling of sources from external repositories (#132)

Avoid use of [`File.short_path`][1] when mapping filenames, because when
creating archives from files imported from external repositories we'll create
archive members with leading `./../` prefixes. Instead, we'll stick to stripping
to leading `File.root.path` (if present) from `File.path`, resulting in archive
members like `external/repo/package/file.txt`.

[1]: https://docs.bazel.build/versions/master/skylark/lib/File.html#short_path

Resolves #131.

commit 532f2857e712c5fcb71c662d680108685b242251
Expand All @@ -610,7 +610,7 @@ commit 5877fa85b8598b5bb2186d3addca2408b1e61c5e
Date: Fri Feb 28 05:49:40 2020 +0000

Rpm source date epoch (#113)

* Added --source_date_epoch
* Support source_date_epoch_file since stamp variables are not accessible
* Fixed _make_rpm label
Expand All @@ -628,25 +628,25 @@ commit 2f5c9815a7bde4f18acfde268bd63fedd107d87c
Date: Wed Dec 4 22:32:01 2019 +0100

Add "./" prefix to files in control.tar (#121)

This improves compatibility to Debian packages created using dpkg.

https://github.com/bazelbuild/rules_pkg/issues/116

commit 2f09779667f0d6644c2ca5914d6113a82666ec63
Author: Benjamin Peterson <[email protected]>
Date: Fri Nov 15 10:09:45 2019 -0800

pkg_deb: Support Breaks and Replaces. (#117)

https://www.debian.org/doc/debian-policy/ch-relationships.html#overwriting-files-and-replacing-packages-replaces

commit 9192d3b3a0f6ccfdecdc66f08f0b2664fa0afc0f
Author: Tony Aiuto <[email protected]>
Date: Fri Oct 4 16:33:47 2019 -0400

Fix repo names with '-' in them.

We can not use the form "@repo-name" in Bazel, so the common solution is
to transform that to "@repo_name". We auto-correct the repo names to the
required form when printing the WORKSPACE stanza.
2 changes: 1 addition & 1 deletion doc_build/merge.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def fix_stardoc_table_align(line: str) -> str:

def main(argv: typing.Sequence[str]) -> None:
wrapper_map = {}
for file in argv[1:]:
for file in argv[1:]:
merge_file(file, sys.stdout, wrapper_map)
if wrapper_map:
print("We didn't use all the @wraps()", wrapper_map, file=sys.stderr)
Expand Down
29 changes: 13 additions & 16 deletions docs/0.10.0/reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ pkg_deb(<a href="#pkg_deb-name">name</a>, <a href="#pkg_deb-architecture">archit
- `out` the Debian package or a symlink to the actual package.
- `deb` the package with any precise file name created with `package_file_name`.
- `changes` the .changes file.


**ATTRIBUTES**

Expand Down Expand Up @@ -225,7 +225,7 @@ Creates an RPM format package via `pkg_filegroup` and friends.
- `out` the RPM or a symlink to the actual package.
- `rpm` the package with any precise file name created with `package_file_name`.
- `changes` the .changes file.


**ATTRIBUTES**

Expand Down Expand Up @@ -396,30 +396,30 @@ filter_directory(<a href="#filter_directory-name">name</a>, <a href="#filter_dir
Transform directories (TreeArtifacts) using pkg_filegroup-like semantics.

Effective order of operations:

1) Files are `exclude`d
2) `renames` _or_ `strip_prefix` is applied.
3) `prefix` is applied
3) `prefix` is applied

In particular, if a `rename` applies to an individual file, `strip_prefix`
will not be applied to that particular file.

Each non-`rename``d path will look like this:

```
$OUTPUT_DIR/$PREFIX/$FILE_WITHOUT_STRIP_PREFIX
```

Each `rename`d path will look like this:

```
$OUTPUT_DIR/$PREFIX/$FILE_RENAMED
```

If an operation cannot be applied (`strip_prefix`) to any component in the
directory, or if one is unused (`exclude`, `rename`), the underlying command
will fail. See the individual attributes for details.


**ATTRIBUTES**

Expand Down Expand Up @@ -448,7 +448,7 @@ Package contents grouping rule.
This rule represents a collection of packaging specifications (e.g. those
created by `pkg_files`, `pkg_mklink`, etc.) that have something in common,
such as a prefix or a human-readable category.


**ATTRIBUTES**

Expand Down Expand Up @@ -480,7 +480,7 @@ General-purpose package target-to-destination mapping rule.
Consumers of `pkg_files`s will, where possible, create the necessary
directory structure for your files so you do not have to unless you have
special requirements. Consult `pkg_mkdirs` for more details.


**ATTRIBUTES**

Expand Down Expand Up @@ -520,7 +520,7 @@ Defines creation and ownership of directories in packages
For some package management systems (e.g. RPM), directory ownership (2) may
imply additional semantics. Consult your package manager's and target
distribution's documentation for more details.


**ATTRIBUTES**

Expand All @@ -547,7 +547,7 @@ Define a symlink within packages
Symbolic links specified by this rule may point at files/directories outside of the
package, or otherwise left dangling.



**ATTRIBUTES**

Expand Down Expand Up @@ -721,6 +721,3 @@ Legacy version
| <a id="pkg_rpm-spec_file"></a>spec_file | - | <a href="https://bazel.build/docs/build-ref.html#labels">Label</a> | required | |
| <a id="pkg_rpm-version"></a>version | - | String | optional | "" |
| <a id="pkg_rpm-version_file"></a>version_file | - | <a href="https://bazel.build/docs/build-ref.html#labels">Label</a> | optional | None |



26 changes: 12 additions & 14 deletions docs/0.6.0/reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ Creates an RPM format package via `pkg_filegroup` and friends.

Is the equivalent to `%config(missingok, noreplace)` in the `%files` list.



**ATTRIBUTES**

Expand Down Expand Up @@ -426,30 +426,30 @@ filter_directory(<a href="#filter_directory-name">name</a>, <a href="#filter_dir
Transform directories (TreeArtifacts) using pkg_filegroup-like semantics.

Effective order of operations:

1) Files are `exclude`d
2) `renames` _or_ `strip_prefix` is applied.
3) `prefix` is applied
3) `prefix` is applied

In particular, if a `rename` applies to an individual file, `strip_prefix`
will not be applied to that particular file.

Each non-`rename``d path will look like this:

```
$OUTPUT_DIR/$PREFIX/$FILE_WITHOUT_STRIP_PREFIX
```

Each `rename`d path will look like this:

```
$OUTPUT_DIR/$PREFIX/$FILE_RENAMED
```

If an operation cannot be applied (`strip_prefix`) to any component in the
directory, or if one is unused (`exclude`, `rename`), the underlying command
will fail. See the individual attributes for details.


**ATTRIBUTES**

Expand Down Expand Up @@ -478,7 +478,7 @@ Package contents grouping rule.
This rule represents a collection of packaging specifications (e.g. those
created by `pkg_files`, `pkg_mklink`, etc.) that have something in common,
such as a prefix or a human-readable category.


**ATTRIBUTES**

Expand Down Expand Up @@ -512,7 +512,7 @@ General-purpose package target-to-destination mapping rule.
Consumers of `pkg_files`s will, where possible, create the necessary
directory structure for your files so you do not have to unless you have
special requirements. Consult `pkg_mkdirs` for more details.


**ATTRIBUTES**

Expand Down Expand Up @@ -551,7 +551,7 @@ Defines creation and ownership of directories in packages
For some package management systems (e.g. RPM), directory ownership (2) may
imply additional semantics. Consult your package manager's and target
distribution's documentation for more details.


**ATTRIBUTES**

Expand All @@ -578,7 +578,7 @@ Define a symlink within packages
Symbolic links specified by this rule may point at files/directories outside of the
package, or otherwise left dangling.



**ATTRIBUTES**

Expand Down Expand Up @@ -746,5 +746,3 @@ Legacy version
| <a id="pkg_rpm-spec_file"></a>spec_file | - | <a href="https://bazel.build/docs/build-ref.html#labels">Label</a> | required | |
| <a id="pkg_rpm-version"></a>version | - | String | optional | "" |
| <a id="pkg_rpm-version_file"></a>version_file | - | <a href="https://bazel.build/docs/build-ref.html#labels">Label</a> | optional | None |


Loading

0 comments on commit 7758f2c

Please sign in to comment.