Commit Graph

18 Commits

Author SHA1 Message Date
Ivo List 6a9eaf2ce9
Load py_binary from rules_python (#895) 2024-09-25 09:44:50 -04:00
aiuto 36433a92a4
Update to new stardoc so we can work with bzlmod. (#853)
* Update to new stardoc so we can work with bzlmod.
* Requires update to merge.py to account for stardoc changes.
* put integration test back on bazel at head.

Fixes #808
2024-04-16 22:17:21 -04:00
Mike Kelly 2aa2b8e842
Add pkg_sub_rpm rule for RPM subpackages (#824)
* rpm: Add support for sub packages to make_rpm.py script

Before we can enable support for sub RPM building as part of a single
`pkg_rpm()` rule we must add the underlying support to make_pkg.py
which is the underlying driver for `pkg_rpm()`.

This covers three pieces:

 * specifying `buildsubdir` rpm variable
 * capturing multiple RPM files as outputs
 * injecting sub RPM definitions into specfile

* rpm: Factor out rpm_ctx helper

The various processing functions pass around a bunch of collections
everywhere which is a bit fragile.  This collects them together into a
struct to make it a bit less messy.

* rpm: Factor out _process_dep() helper function

_process_dep() handles processing an individual dep and is currently
called from the processing loop.  We'll need to re-use this logic for
processing individual sub RPMs as well so we want it in a helper.

* rpm: Capture generated output RPM files in rpm_ctx

Currently we only generate one RPM file, but once we generate sub RPM
files we'll need to be able to capture those outputs as well.  This
prepares us for that step.

* rpm: Add args for make_rpm to rpm_ctx

We'll need to add additional arguments to make_rpm for sub RPM
building.  It's easier to capture this in our context object than to
try to shuttle these bits around.

* rpm: Pass correct `--name` argument to make_rpm

If we don't pass the correct RPM name to `make_rpm.py` than we won't be
able to correctly determine the subrpm names.  Currently, the name is
only used by `make_rpm` to generate some progress output, so this
shouldn't break anything internally.

* rpm: Implementation of `pkg_sub_rpm` rule

This introduces a `pkg_sub_rpm` rule that allows us to generate and
capture RPM subpackages and generate them as part of a single RPM
invocation in lieu of cobbling this together from multiple RPM rules.
This has a few benefits:

- faster execution due to single rpmbuild invocation
- sharing configuration between RPMs in the same fashion as vanilla
  RPM building from a specfile
- will enable the proper construction of debuginfo RPMs in a later PR

The current implementation *only* works with non-specfile based rules
and currently allows for a subset of the general RPM configuration.

Internally, the process is for `pkg_sub_rpm` to generate a
PackageSubRPMInfo provider that will subsequently get consumed by the
`pkg_rpm` rule that generates the actual RPMs.  We re-use the internal
dependency processing logic that's used by the top-level RPM to
generate the content related to the sub-RPM.

* rpm: Update entry points for RPM rules to include pkg_sub_rpm

This change updates `rpm.bzl` in two ways to account for sub RPMs:

- it adds an entrypoint for `pkg_sub_rpm`

- it adds a check in `pkg_rpm` to assert incompatibility with
  `spec_file`

* examples: Add an example of how to use the subrpm rule

This provides a basic example using the `pkg_sub_rpm` rule to generate
multiple RPMs.

* Fix buildifier noise

* Fix make_rpm failures

* doc: Clean up sub-RPM docstring and add to doc_build

The initial docstring for pkg_sub_rpm is not great, so this change
fixes that while adding this to the list of rules to have
documentation generated for them.

* doc: Additional documentation for subrpms in pkg_rpm

This clarifies the `subrpms` attribute usage as well as indicating the
incompatibility with `spec_file` mode.

* Fix issue in subrpm passthrough

When adding the check to verify if we can use subrpms, this pass
through wasn't added.

* Add a basic test for pkg_sub_rpm

This introduces a basic test with a single sub RPM and main RPM each
containing a single source file.

* Tweaks to test

* Test fixes for CentOS 7

The `rpm` version on CentOS 7 doesn't work exactly the same way as
newer versions of rpm and requires a `-p` parameter to inspect
non-installed RPMs.  CentOS 7 also inserts a `Relocations` field that
we didn't see on other platforms so we'll filter that out to make our
test a bit more portable.

* Move PackageSubRPMInfoProvider into rpm_pfg.bzl

This is private to the RPM rules so should probably live there.
2024-03-14 22:36:15 -04:00
Alex Eagle eb46104bc5
chore: buildifier format all files (#775) 2023-11-06 13:29:07 -05:00
aiuto 835ee2455e
Clean up some nits (#751)
A bunch of things which were doing debug printing or messing up the docs.
2023-09-16 22:06:31 -04:00
Florian Scheibner 19ef5a6d5e
Document that package_dir also uses package_variables (#747)
* Document that package_dir also uses package_variables

The pkg_zip and pkg_tar rule already support variable substitution in their
package_dir parameter, it was only documented for package_variables so far.

* Make Common Attributes linkable
2023-09-05 15:06:12 -04:00
aiuto f117c6311b
exec_tools -> tools (#680) 2023-03-15 10:45:49 -04:00
aiuto 914b0e5ef8
Update docs to show $(var) usage and using ctx.var directly. (#621)
Add example of new ctx.var and $(var) usage in file names.
Update common docs
- fix since regexp
- use 0.8.0 for since
- remove unneeded load
2022-10-21 10:01:05 -04:00
aiuto 4891d9fe6c
Rough prototype of @since processing. (#617)
When we merge generated docs into the final form, convert
@since(text) to emphasized (currently italic) text.

This is not intended to be perfect. It is just to get the concept out
there to start playing with it. Ideally, StarDoc will eventually support
@since natively and we can delete this.
2022-10-10 09:32:30 -04:00
aiuto 76f5651ed9
Make the .bzl files available as input to a bzl_library (#567)
* Make the .bzl files available as input to a bzl_library, without having to resort to the invasivness of a shadow tree of just the .bzl files without the other distributable files.
2022-04-07 12:12:14 -04:00
aiuto 3c0b36498e
Add @rules_license style license declarations (#508)
* Add @rules_license declarations.

This is a little more unwieldy than we would like, in that we
hand add them to each BUILD file.

This should be enforced with a test, but it should be a non-Bazel
test at the source code level.
2022-02-16 11:01:43 -05:00
aiuto a8638d628c
Try to make the docs a little better. (#524)
* Try to make the docs a little better.
- Fix stardoc adding <p align=center> in markdown tables.
- Add rough capability to handle macros that wrap a rule.

The wrapping technique is:
- In the wrapping macro, use the docstring  @wraps(some_rule)
- Then we don't emit the docs for the wrapper
- In the docs for some_rule, replace the string "some_rule" with the
  name of the wrapper macro.

It is a first attempt to make things better.  It is crude, but it
mostly works.It is a first attempt to make things better. It is crude, but it mostly works. If Stardoc ever adds this capability [(feature request)[https://github.com/bazelbuild/stardoc/issues/120] we can move to that.
2022-02-16 10:39:01 -05:00
aiuto 6135142861
Make the docs table of contents more useful by including the .bzl files (#530)
where the rules are defined. Without that, you just have to know.

It would be nice if stardoc had support for adding the bzl path out of the box.
https://github.com/bazelbuild/stardoc/issues/120
2022-02-15 19:58:14 -05:00
aiuto cce90a09ce
split pkg_tar code out of //pkg:pkg.bzl (#528) 2022-02-08 19:23:56 -05:00
aiuto 7499938b1e
Fix some lint warnings. (#519)
Make buildifier shut up about some docstrings and ordering of attributes. More to do in another pass.
2022-02-03 21:38:56 -05:00
aiuto e173e40a8c
Add docs baseline for 0.6.0 (#509)
* Add 0.6.0 doc tree
* fix <li>s in stamp docs
* fix the <li> in tables with a stardoc bug workaround.
* remove obsolete reference.md that was imbedded in the wrong place
2022-01-28 15:31:58 -05:00
aiuto bc5cf69318
fix toc in doc generation (#494)
Fix doc toc and republish head snapshot
2021-12-22 00:03:08 -05:00
aiuto 002daac66e
Improved doc generation: Produce a single reference doc. (#474)
* Improved doc generation: Produce a single reference doc.

- moves doc generation out of distro into a separate doc_build tree
- creates a single reference.md from the common attributes section
  plus the individual page.

Future plans
- post transform the .html to add links between sections
- post transform the .html to add external links to Bazel docs.
- add procedures to cut doc releases alongside distribution releases
2021-12-07 01:15:58 -05:00