Commit Graph

510 Commits

Author SHA1 Message Date
Alex Eagle 6ad211b6f9
Make pkg_zip compression configurable (#737)
Zip offers different compression algorithms and levels. For packaging,
sometimes faster compression speed is more important than size. With
`pkg_tar`, there is already the option to use a custom compressor,
there's no similar option for `pkg_zip` yet.

This PR exposes the zip `compression_level` and `compression_type`
arguments for `pkg_zip`, thus enabling the use case.

The list of compressions is the same as Python's `ZipFile`:
https://docs.python.org/3/library/zipfile.html#zipfile.ZIP_STORED

There's a new test case that verifies that the compression settings work
by comparing the compressed file sizes.

The default compression level is the same as in this recent change for
`pkg_tar` in #720
2023-08-17 07:52:12 -07:00
flode ed49ca3f9f Add logging and extend doc 2023-08-17 16:20:03 +02:00
flode df31c3ee07 Fix test on python 3.6 2023-08-17 15:50:51 +02:00
flode 7662961878 Fix python 3.6, doesn't support compresslevel
Python3.6 is already end-of-life but seems to still be used in the CI.
2023-08-17 15:38:48 +02:00
flode b035a74ffa Make pkg_zip compression configurable
Zip offers different compression algorithms and levels. For packaging,
sometimes faster compression speed is more important than size.
With pkg_tar, there is already the option to use a custom compressor.

For pkg_zip these use case are now possible with the exposed zip
compression_level and compression_type arguments in this PR.

There's a new test case that verifies that the compression settings work by
comparing the compressed file sizes.

The default compression level is the same as recently change for pkg_tar in
2023-08-17 13:53:21 +02:00
Tomasz Wojno 40e1477e71
Append changelog to RPM spec file (#726)
Consume input changelog file and append the content to generated spec file
2023-08-16 23:50:03 -04:00
Tomasz Wojno 322c525bff
Fix pkg_deb changelog flag getter (#734) 2023-08-16 23:36:44 -04:00
aiuto 8bf0872e13
Add basic include_runfiles to pkg_files. (#724)
* Add basic include_runfiles to pkg_files.

Show it working in a mappings tests.
Improve the mapping test to print something a little more useful.

Next step: Make the same code callable from pkg_tar and pkg_zip

* utf8 wierdness with python vesrions
2023-08-14 15:03:15 -04:00
Tomasz Wojno d89754085f
Add changelog attribute to pkg_deb (#725)
Allow passing changelog file to pkg_deb rule
2023-08-14 14:17:26 -04:00
Alex Eagle 08cfc9529e
chore: automate publishing releases to BCR (#722)
This matches the layout that was manually published for prior releases:
https://github.com/bazelbuild/bazel-central-registry/blob/main/modules/rules_pkg/
2023-08-11 23:28:54 -04:00
Alex Eagle 93562c92b9
Grab bag of fixes (#718)
Get load statements correct for rules_python.
Add defaults for some args in process_src.
2023-08-10 07:03:06 -07:00
Tony Aiuto a9a7689775 bump platforms because bazel at head requires it. sigh 2023-08-09 15:54:01 -04:00
Paul Draper 3ebf3b2fd7
Use Gzip compress level 6 (#720)
Much faster and comparable quality to level 9
2023-08-09 15:42:54 -04:00
Tony Aiuto 6b1484757e remove a ling to trtigger build 2023-08-09 15:39:35 -04:00
Alex Eagle 3aadc773a7
Update CODEOWNERS (#721)
I'll take over for @nacl in general, leaving him as the domain expert on rpm for now.
2023-08-09 15:37:49 -04:00
Tony Aiuto 8170478013 default uid and guid on process_src to None 2023-07-17 20:02:54 -04:00
Tony Aiuto 28d62a94a4 fix load(py_library) => load(py_binary) 2023-07-17 10:31:39 -04:00
Tony Aiuto e2101d81fe remove unneeded py_binary load 2023-07-17 10:24:07 -04:00
aiuto a40a8f4ab9
write debian Date field in UTC rather than local time (#712) 2023-07-03 21:30:40 -04:00
aiuto 89465ed8de
fix import in rpm test. (#713)
fix import in rpm test.
2023-06-28 22:09:47 -04:00
aiuto 08843716cb
Create scorecard.yml (#710) 2023-06-27 12:07:47 -04:00
Sam Schwebach 02eb6cfd90
Merge verify_archive_test_lib with verify_archive_test_main.py.tpl (#705)
* Use Label constructor for verify_archive_test macro

One of the `deps` within the `verify_archive_test` macro
depends on a label, which would be incorrectly evaluated
in a caller's BUILD file to be a non-external package.

Add a Label() call to the label to ensure it is evaluated in the
context of rules_pkg. Also add a test to ensure this can be
correctly used from another workspace.

* Merge verify_archive_test_lib into test template

Instead of exporting verify_archive_test_lib as a
public library embed it into the template for the
test itself.
2023-06-12 00:00:23 -04:00
aiuto 1efacb254b
Add a MODULE.bazel hint to the release not generator (#709)
add MODULE.bazel stanza to workspace printer
2023-06-06 20:11:51 -04:00
Jean-Hadrien Chabran 253231471d
docs: add a note in pkg_tar#strip_prefix docs (v.0.8.0) about flattening (#699)
* docs: add a note in pkg_tar#strip_prefix about flattening

* More gramatical description

* make the message more accurate

---------

Co-authored-by: aiuto <aiuto@google.com>
2023-06-05 17:32:11 -04:00
Ignas Kaziukėnas 59325192e6
[pkg_deb] Fix multiline fields in changes file (#691)
* fix multiline fields in changes files

* multiline is an enum now
2023-06-05 16:45:00 -04:00
aiuto ec4ad13c92
Add a check to ensure that version.bzl and MODULE.bazel remain in sync. (#697)
* add MODULE.bazel

* Add a check to ensure that version.bzl and MODULE.bazel remain in sync.
2023-05-23 00:38:01 -04:00
Adrian Vogelsgesang 5bf5a90199
Fix typos in doc strings in `verify_archive.bzl` (#700) 2023-05-18 10:17:35 -04:00
aiuto 3fe3cd1cc7
fix working dir on integration tests (#701)
* fix working dir on integration test configuration
2023-05-18 10:14:51 -04:00
Austin Schuh e7a1ba187c
Add support for setting uid/gid from pkg_attributes (#671)
This enables the user to produce identical tarballs to fix
https://github.com/bazelbuild/rules_pkg/issues/670

Signed-off-by: Austin Schuh <austin.linux@gmail.com>
Co-authored-by: aiuto <aiuto@google.com>
2023-05-01 13:36:09 -04:00
Vertexwahn 0aa9277cc6
Fix spelling mistakes (#695) 2023-05-01 13:19:34 -04:00
aiuto c86a3e56eb
Remove top level .bzl files. They are all in //pkg. (#688)
* remove top level .bzl files. All of them should be loaded from //pkg:x.bzl

* fix the rest
2023-05-01 13:18:29 -04:00
Yun Peng 81da43d25c
Merge pull request #693 from bazelbuild/lberki-bazel-dev-archive
Replace reference to bazel-dev with GitHub Discussions.
2023-04-21 15:22:22 +02:00
Lukacs T. Berki 2a2b03fa8f Replace reference to bazel-dev with GitHub Discussions. 2023-04-21 13:10:11 +00:00
aiuto 7d7a076544
add MODULE.bazel (#690)
* add MODULE.bazel
2023-03-28 23:44:42 -04:00
aiuto 88109c3b45
Bump to 0.9.0 (#687)
* v 0.9.0

* compat=1
2023-03-28 23:17:25 -04:00
aiuto dd1cb33762
swtich example to OutputGroupInfo (#689) 2023-03-28 18:59:54 -04:00
Tomasz Wojno 3121d6b6c3
Add OutputGroupInfo for pkg_rpm rule (#684)
* Add OutputGroupInfo for pkg_rpm rule
2023-03-28 17:34:25 -04:00
Clint Harrison edd4d3d643
pkg_tar should not prefix tree artifacts with ./ (#681) 2023-03-15 23:30:05 -04:00
aiuto f117c6311b
exec_tools -> tools (#680) 2023-03-15 10:45:49 -04:00
aiuto 27719a86f1
Update advise about pkg_files. (#679)
Fixes: #678
2023-03-01 14:49:04 -05:00
aiuto 3b8e3f150f
Add verify_archive rule to do e2e tests on built archives. (#669)
We could do more, but this should be good enough to start.

Fixes #644
2023-02-15 12:06:19 -05:00
Qingyu Sui 23a3cb4117
Fix a potential TypeException caused by None type (#668) 2023-02-15 10:58:59 -05:00
aiuto 7c2983c869
pkg_zip: Some unicode file handling fixes and basic tests (#641)
Add primitive zip unicode filename handling tests
- Just make sure we can create an archive with non-ASCII file names.
2023-02-13 23:25:09 -05:00
Ryan Beasley f9cf7959cd
pkg_tar, pkg_zip: improve support for long paths on Windows (#672)
* pkg_zip: improve support for long paths on Windows

This commit updates `pkg_zip` and `pkg_tar` to, when running on Windows, convert
files' input paths to extended-length paths by (1) making them absolute
and then (2) prepending with `\\?\`.
2023-02-13 22:18:11 -05:00
aiuto 694e3ad1b3
Update to rules_license 0.0.4 (#667)
- Update to a newer rules_license
- update ci to prove that we can work with --incompatible_use_platforms_repo_for_constraints
- do not test with no_host_transition yet
2023-02-09 17:49:20 -05:00
Andrew Psaltis f98a82173e
Genericize package manifest system and interface (#660)
Genericize package manifest system and interface

The current way that rules_pkg communicates with must packagers is using a
manifest file, which is currently a JSON data structure based on a an array of
arrays.  While generally readable, it looks strange, as it was to reduce Bazel
resource usage (JSON strings in memory).  Further, our Python code is directly
bound to this data structure format.

However, if we want to add more or change this, it becomes cumbersome on both
the Starlark and Python sides. This change alleviates concerns generally by:

- Converting all manifests to a JSON "object" style, improving readability.
  Numerous golden tests were updated to support this.
- Replace the `collections.namedtuple`-based `ManifestEntry` object with one
  that is a little more flexible and type-safe.
- Providing a function (`read_entries_from`) that converts a file-like object
  into a list of `ManifestEntry`s, and replacing all JSON reading in packagers
  (`tar`, `zip`, `install`) and their tests with this function.

Other convenience factors or things addressed:

- `ManifestEntry.entry_type` is now just `ManifestEntry.type`
- Bazel 6 now stringifies repository-local labels with a preceding `@`, unlike
  prior versions.  Adapt to this in the manifest writer.

Future changes will extend this interface to allow for custom attributes to be
passed from `pkg_files` and friends, which, among other things, will be
necessary to more generically support `pkg_rpm`.

Provides groundwork for (but doesn't resolve) #385.
2023-02-08 17:11:46 -05:00
aiuto bf19e06e03
update version to 8.1 to sync with bzlmod (#665) 2023-02-07 17:30:40 -05:00
aiuto 9d4b0ed8c0
Update MODULE.bazel
Fix version number
2023-02-07 16:49:39 -05:00
Alex Eagle 547077f0b1
feat: expose tar manifest as an output (#643)
* feat: expose tar manifest as an output

This allows targets to run something like jq over the manifest contents
2023-01-11 13:14:26 -05:00
Nils Semmelrock 52ed3efd76
Support license attribute in pkg_deb (#651)
Add optional attribute to add a short license description to the meta data of created debian artifacts
2023-01-11 11:34:12 -05:00