Skip to content

Commit 8d6af53

Browse files
authored
Generate docs for pkg_install (#992)
* add docs for pkg_install * update docs
1 parent 3dffe47 commit 8d6af53

File tree

2 files changed

+91
-4
lines changed

2 files changed

+91
-4
lines changed

doc_build/BUILD

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ ORDER = [
5050
("pkg_zip", "//pkg/private/zip:zip.bzl"),
5151
("pkg_zip_impl", "//pkg/private/zip:zip.bzl"),
5252
("mappings", None),
53+
("pkg_install", None),
5354
("legacy_pkg_rpm", None),
5455
]
5556

@@ -114,6 +115,17 @@ bzl_library(
114115
visibility = ["//visibility:public"],
115116
)
116117

118+
stardoc(
119+
name = "pkg_install",
120+
out = "pkg_install.md",
121+
input = "//pkg:install.bzl",
122+
deps = [
123+
":rules_pkg_lib",
124+
"@bazel_skylib//rules:common_settings",
125+
"@rules_python//python:defs_bzl",
126+
],
127+
)
128+
117129
py_binary(
118130
name = "merge",
119131
srcs = ["merge.py"],

docs/latest.md

Lines changed: 79 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# rules_pkg - 1.1.0
1+
# rules_pkg - 1.2.0
22

33
<div class="toc">
44
<h2>Common Attributes</h2>
@@ -347,7 +347,7 @@ pkg_tar(<a href="#pkg_tar-name">name</a>, <a href="#pkg_tar-deps">deps</a>, <a h
347347
<a href="#pkg_tar-allow_duplicates_with_different_content">allow_duplicates_with_different_content</a>, <a href="#pkg_tar-compression_level">compression_level</a>, <a href="#pkg_tar-compressor">compressor</a>, <a href="#pkg_tar-compressor_args">compressor_args</a>,
348348
<a href="#pkg_tar-create_parents">create_parents</a>, <a href="#pkg_tar-empty_dirs">empty_dirs</a>, <a href="#pkg_tar-empty_files">empty_files</a>, <a href="#pkg_tar-extension">extension</a>, <a href="#pkg_tar-files">files</a>, <a href="#pkg_tar-include_runfiles">include_runfiles</a>, <a href="#pkg_tar-mode">mode</a>, <a href="#pkg_tar-modes">modes</a>,
349349
<a href="#pkg_tar-mtime">mtime</a>, <a href="#pkg_tar-owner">owner</a>, <a href="#pkg_tar-ownername">ownername</a>, <a href="#pkg_tar-ownernames">ownernames</a>, <a href="#pkg_tar-owners">owners</a>, <a href="#pkg_tar-package_dir">package_dir</a>, <a href="#pkg_tar-package_dir_file">package_dir_file</a>,
350-
<a href="#pkg_tar-package_file_name">package_file_name</a>, <a href="#pkg_tar-package_variables">package_variables</a>, <a href="#pkg_tar-portable_mtime">portable_mtime</a>, <a href="#pkg_tar-preserve_mode">preserve_mode</a>,
350+
<a href="#pkg_tar-package_file_name">package_file_name</a>, <a href="#pkg_tar-package_variables">package_variables</a>, <a href="#pkg_tar-portable_mtime">portable_mtime</a>, <a href="#pkg_tar-preserve_mode">preserve_mode</a>, <a href="#pkg_tar-preserve_mtime">preserve_mtime</a>,
351351
<a href="#pkg_tar-private_stamp_detect">private_stamp_detect</a>, <a href="#pkg_tar-remap_paths">remap_paths</a>, <a href="#pkg_tar-stamp">stamp</a>, <a href="#pkg_tar-strip_prefix">strip_prefix</a>, <a href="#pkg_tar-symlinks">symlinks</a>)
352352
</pre>
353353

@@ -370,9 +370,9 @@ pkg_tar(<a href="#pkg_tar-name">name</a>, <a href="#pkg_tar-deps">deps</a>, <a h
370370
| <a id="pkg_tar-create_parents"></a>create_parents | - | Boolean | optional | `True` |
371371
| <a id="pkg_tar-empty_dirs"></a>empty_dirs | - | List of strings | optional | `[]` |
372372
| <a id="pkg_tar-empty_files"></a>empty_files | - | List of strings | optional | `[]` |
373-
| <a id="pkg_tar-extension"></a>extension | - | String | optional | `"tar"` |
373+
| <a id="pkg_tar-extension"></a>extension | The extension of the generated file. If `"gz"`, `"bz2"`, or `"xz"`, the tarball will also be compressed using that tool, and is mutually exclusive with `compressor`. Note that `xz` may not be supported based on the Python toolchain. | String | optional | `"tar"` |
374374
| <a id="pkg_tar-files"></a>files | Obsolete. Do not use. | <a href="https://bazel.build/rules/lib/dict">Dictionary: Label -> String</a> | optional | `{}` |
375-
| <a id="pkg_tar-include_runfiles"></a>include_runfiles | Include runfiles for executables. These appear as they would in bazel-bin.For example: 'path/to/myprog.runfiles/path/to/my_data.txt'. | Boolean | optional | `False` |
375+
| <a id="pkg_tar-include_runfiles"></a>include_runfiles | Include runfiles for executables. These appear as they would in bazel-bin. For example: 'path/to/myprog.runfiles/path/to/my_data.txt'. | Boolean | optional | `False` |
376376
| <a id="pkg_tar-mode"></a>mode | - | String | optional | `"0555"` |
377377
| <a id="pkg_tar-modes"></a>modes | - | <a href="https://bazel.build/rules/lib/dict">Dictionary: String -> String</a> | optional | `{}` |
378378
| <a id="pkg_tar-mtime"></a>mtime | - | Integer | optional | `-1` |
@@ -386,6 +386,7 @@ pkg_tar(<a href="#pkg_tar-name">name</a>, <a href="#pkg_tar-deps">deps</a>, <a h
386386
| <a id="pkg_tar-package_variables"></a>package_variables | See [Common Attributes](#package_variables) | <a href="https://bazel.build/concepts/labels">Label</a> | optional | `None` |
387387
| <a id="pkg_tar-portable_mtime"></a>portable_mtime | - | Boolean | optional | `True` |
388388
| <a id="pkg_tar-preserve_mode"></a>preserve_mode | If true, will add file to archive with preserved file permissions. | Boolean | optional | `False` |
389+
| <a id="pkg_tar-preserve_mtime"></a>preserve_mtime | If true, will add file to archive with preserved file mtime. | Boolean | optional | `False` |
389390
| <a id="pkg_tar-private_stamp_detect"></a>private_stamp_detect | - | Boolean | optional | `False` |
390391
| <a id="pkg_tar-remap_paths"></a>remap_paths | - | <a href="https://bazel.build/rules/lib/dict">Dictionary: String -> String</a> | optional | `{}` |
391392
| <a id="pkg_tar-stamp"></a>stamp | Enable file time stamping. Possible values: <li>stamp = 1: Use the time of the build as the modification time of each file in the archive. <li>stamp = 0: Use an "epoch" time for the modification time of each file. This gives good build result caching. <li>stamp = -1: Control the chosen modification time using the --[no]stamp flag. <div class="since"><i>Since 0.5.0</i></div> | Integer | optional | `0` |
@@ -756,6 +757,80 @@ strip_prefix.from_root(<a href="#strip_prefix.from_root-path">path</a>)
756757

757758

758759

760+
<!-- Generated with Stardoc: http://skydoc.bazel.build -->
761+
762+
Rules for creating install scripts from pkg_filegroups and friends.
763+
764+
This module provides an interface (`pkg_install`) for creating a `bazel
765+
run`-able installation script.
766+
767+
<a id="pkg_install"></a>
768+
769+
## pkg_install
770+
771+
<pre>
772+
load("@rules_pkg//pkg:install.bzl", "pkg_install")
773+
774+
pkg_install(<a href="#pkg_install-name">name</a>, <a href="#pkg_install-srcs">srcs</a>, <a href="#pkg_install-destdir">destdir</a>, <a href="#pkg_install-destdir_flag">destdir_flag</a>, <a href="#pkg_install-kwargs">**kwargs</a>)
775+
</pre>
776+
777+
Create an installer script from pkg_filegroups and friends.
778+
779+
This macro allows users to create `bazel run`nable installation scripts
780+
using the pkg_filegroup framework.
781+
782+
For example:
783+
784+
```python
785+
pkg_install(
786+
name = "install",
787+
srcs = [
788+
# mapping/grouping targets here
789+
],
790+
destdir = "out/install",
791+
)
792+
```
793+
794+
Installation can be done by invoking:
795+
796+
```
797+
bazel run -- //path/to:install
798+
```
799+
800+
Additional features can be accessed by invoking the script with the --help
801+
option:
802+
803+
```
804+
bazel run -- //path/to:install --help
805+
```
806+
807+
WARNING: While this rule does function when being run from within a bazel
808+
rule, such use is not recommended. If you do, **always** use the
809+
`--destdir` argument to specify the desired location for the installation to
810+
occur. Not doing so can lead the outputs going to an unexpected location,
811+
or in some cases, failing. Run the script command with `--help`, as
812+
mentioned above, for more details.
813+
814+
One such use would be to run the script created by `pkg_install` to produce
815+
a directory output in the build root. This may not function as expected or
816+
may suffer from poorly tested edge cases. A purpose-written rule that would
817+
allow for creation of such directories is discussed in
818+
https://github.com/bazelbuild/rules_pkg/issues/388.
819+
820+
821+
**PARAMETERS**
822+
823+
824+
| Name | Description | Default Value |
825+
| :------------- | :------------- | :------------- |
826+
| <a id="pkg_install-name"></a>name | rule name | none |
827+
| <a id="pkg_install-srcs"></a>srcs | pkg_filegroup framework mapping or grouping targets | none |
828+
| <a id="pkg_install-destdir"></a>destdir | The default destination directory.<br><br>If it is specified, this is the default destination to install the files. It is overridable by explicitly specifying `--destdir` in the command line or specifying the `DESTDIR` environment variable.<br><br>If it is not specified, `--destdir` must be set on the command line, or the `DESTDIR` environment variable must be set.<br><br>If this is an absolute path, it is used as-is. If this is a relative path, it is interpreted against `BUILD_WORKSPACE_DIRECTORY`. | `None` |
829+
| <a id="pkg_install-destdir_flag"></a>destdir_flag | A string_flag target used to obtain the value of destdir. | `None` |
830+
| <a id="pkg_install-kwargs"></a>kwargs | common rule attributes | none |
831+
832+
833+
759834
<!-- Generated with Stardoc: http://skydoc.bazel.build -->
760835

761836
Rules to create RPM archives.

0 commit comments

Comments
 (0)