aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomasz Wojno <tomasz.wojno@sandboxquantum.com>2023-08-14 20:17:26 +0200
committerGitHub <noreply@github.com>2023-08-14 14:17:26 -0400
commitd89754085f251524b89a4ad70d25ee0e354ee9d0 (patch)
tree7b06ced46b9040aee4ff43832e96b052a060552b
parent08cfc9529ec0b560396500b7e56ee1b9c5f047d2 (diff)
downloadrules_pkg-d89754085f251524b89a4ad70d25ee0e354ee9d0.tar.gz
Add changelog attribute to pkg_deb (#725)
Allow passing changelog file to pkg_deb rule
-rw-r--r--pkg/private/deb/deb.bzl9
-rw-r--r--pkg/private/deb/make_deb.py7
2 files changed, 16 insertions, 0 deletions
diff --git a/pkg/private/deb/deb.bzl b/pkg/private/deb/deb.bzl
index 2541d86..d9b6935 100644
--- a/pkg/private/deb/deb.bzl
+++ b/pkg/private/deb/deb.bzl
@@ -107,6 +107,10 @@ def _pkg_deb_impl(ctx):
else:
fail("Neither description_file nor description attribute was specified")
+ if ctx.attr.changelog:
+ args += ["--changelog=@" + ctx.file.changelog.path]
+ files += [ctx.file.changelog]
+
# Built using can also be specified by a file or inlined (but is not mandatory)
if ctx.attr.built_using_file:
if ctx.attr.built_using:
@@ -215,6 +219,11 @@ pkg_deb_impl = rule(
See https://www.debian.org/doc/debian-policy/ch-binary.html#prompting-in-maintainer-scripts.""",
allow_single_file = True,
),
+ "changelog": attr.label(
+ doc = """The package changelog.
+ See https://www.debian.org/doc/debian-policy/ch-source.html#s-dpkgchangelog.""",
+ allow_single_file = True
+ ),
"description": attr.string(
doc = """The package description. Must not be used with `description_file`.""",
),
diff --git a/pkg/private/deb/make_deb.py b/pkg/private/deb/make_deb.py
index f5efa9c..bfbcba9 100644
--- a/pkg/private/deb/make_deb.py
+++ b/pkg/private/deb/make_deb.py
@@ -198,6 +198,7 @@ def CreateDeb(output,
templates=None,
triggers=None,
conffiles=None,
+ changelog=None,
**kwargs):
"""Create a full debian package."""
extrafiles = OrderedDict()
@@ -217,6 +218,8 @@ def CreateDeb(output,
extrafiles['triggers'] = (triggers, 0o644)
if conffiles:
extrafiles['conffiles'] = ('\n'.join(conffiles) + '\n', 0o644)
+ if changelog:
+ extrafiles['changelog'] = (changelog, 0o644)
control = CreateDebControl(extrafiles=extrafiles, **kwargs)
# Write the final AR archive (the deb package)
@@ -367,6 +370,9 @@ def main():
parser.add_argument(
'--conffile', action='append',
help='List of conffiles (prefix item with @ to provide a path)')
+ parser.add_argument(
+ "--changelog",
+ help='The changelog file (prefix item with @ to provide a path).')
AddControlFlags(parser)
options = parser.parse_args()
@@ -381,6 +387,7 @@ def main():
templates=helpers.GetFlagValue(options.templates, False),
triggers=helpers.GetFlagValue(options.triggers, False),
conffiles=GetFlagValues(options.conffile),
+ changelog=GetFlagValues(options.changelog),
package=options.package,
version=helpers.GetFlagValue(options.version),
description=helpers.GetFlagValue(options.description),