summaryrefslogtreecommitdiff
path: root/packages
diff options
context:
space:
mode:
authorzdc <zdc@users.noreply.github.com>2020-12-25 18:57:19 +0200
committerGitHub <noreply@github.com>2020-12-25 18:57:19 +0200
commit27c317f83d8e393254b6766b34fdf8d29148ea8f (patch)
treeea824de28fa639ba6ba8b212efaf53b5df2e90d9 /packages
parent66dc53b1b3f8786f3bbb25e914c1dc8161af0494 (diff)
parentc6bcb8df28daa234686a563549681082eb3283a1 (diff)
downloadvyos-cloud-init-27c317f83d8e393254b6766b34fdf8d29148ea8f.tar.gz
vyos-cloud-init-27c317f83d8e393254b6766b34fdf8d29148ea8f.zip
Merge pull request #28 from zdc/T2117-equuleus-20.4
T2117: Cloud-init updated to 20.4
Diffstat (limited to 'packages')
-rwxr-xr-xpackages/bddeb80
-rw-r--r--packages/redhat/cloud-init.spec.in9
2 files changed, 83 insertions, 6 deletions
diff --git a/packages/bddeb b/packages/bddeb
index b0f219b6..a3fb8848 100755
--- a/packages/bddeb
+++ b/packages/bddeb
@@ -5,6 +5,7 @@ import csv
import json
import os
import shutil
+import subprocess
import sys
UNRELEASED = "UNRELEASED"
@@ -99,6 +100,36 @@ def write_debian_folder(root, templ_data, cloud_util_deps):
params={'build_depends': ','.join(requires)})
+def write_debian_folder_from_branch(root, templ_data, branch):
+ """Import a debian package directory from a branch."""
+ print("Importing debian/ from branch %s to %s" % (branch, root))
+
+ p_dumpdeb = subprocess.Popen(
+ ["git", "archive", branch, "debian"], stdout=subprocess.PIPE
+ )
+ subprocess.check_call(
+ ["tar", "-v", "-C", root, "-x"],
+ stdin=p_dumpdeb.stdout
+ )
+
+ print("Adding new entry to debian/changelog")
+ full_deb_version = (
+ templ_data["version_long"] + "-1~bddeb" + templ_data["release_suffix"]
+ )
+ subp.subp(
+ [
+ "dch",
+ "--distribution",
+ templ_data["debian_release"],
+ "--newversion",
+ full_deb_version,
+ "--controlmaint",
+ "Snapshot build.",
+ ],
+ cwd=root
+ )
+
+
def read_version():
return json.loads(run_helper('read-version', ['--json']))
@@ -140,6 +171,15 @@ def get_parser():
parser.add_argument("--signuser", default=False, action='store',
help="user to sign, see man dpkg-genchanges")
+
+ parser.add_argument("--packaging-branch", nargs="?", metavar="BRANCH",
+ const="ubuntu/devel", type=str,
+ help=(
+ "Import packaging from %(metavar)s instead of"
+ " using the packages/debian/* templates"
+ " (default: %(const)s)"
+ ))
+
return parser
@@ -147,6 +187,37 @@ def main():
parser = get_parser()
args = parser.parse_args()
+ if args.packaging_branch:
+ try:
+ subp.subp(
+ [
+ "git",
+ "show-ref",
+ "--quiet",
+ "--verify",
+ "refs/heads/" + args.packaging_branch,
+ ]
+ )
+ except subp.ProcessExecutionError:
+ print("Couldn't find branch '%s'." % args.packaging_branch)
+ print("You may need to checkout the branch from the git remote.")
+ return 1
+ try:
+ subp.subp(
+ [
+ "git",
+ "cat-file",
+ "-e",
+ args.packaging_branch + ":debian/control",
+ ]
+ )
+ except subp.ProcessExecutionError:
+ print(
+ "Couldn't find debian/control in branch '%s'."
+ " Is it a packaging branch?" % args.packaging_branch
+ )
+ return 1
+
if not args.sign:
args.debuild_args.extend(['-us', '-uc'])
@@ -198,7 +269,14 @@ def main():
xdir = util.abs_join(tdir, "cloud-init-%s" % ver_data['version_long'])
templ_data.update(ver_data)
- write_debian_folder(xdir, templ_data, cloud_util_deps=args.cloud_utils)
+ if args.packaging_branch:
+ write_debian_folder_from_branch(
+ xdir, templ_data, args.packaging_branch
+ )
+ else:
+ write_debian_folder(
+ xdir, templ_data, cloud_util_deps=args.cloud_utils
+ )
print("Running 'debuild %s' in %r" % (' '.join(args.debuild_args),
xdir))
diff --git a/packages/redhat/cloud-init.spec.in b/packages/redhat/cloud-init.spec.in
index 4cff2c97..16138012 100644
--- a/packages/redhat/cloud-init.spec.in
+++ b/packages/redhat/cloud-init.spec.in
@@ -39,10 +39,7 @@ Requires(post): chkconfig
Requires(preun): chkconfig
%endif
-# These are runtime dependencies, but declared as BuildRequires so that
-# - tests can be run here.
-# - parts of cloud-init such (setup.py) use these dependencies.
-{% for r in requires %}
+{% for r in buildrequires %}
BuildRequires: {{r}}
{% endfor %}
@@ -57,8 +54,10 @@ Requires: python-argparse
%endif
-# Install 'dynamic' runtime reqs from *requirements.txt and pkg-deps.json
+# Install 'dynamic' runtime reqs from *requirements.txt and pkg-deps.json.
+# Install them as BuildRequires too as they're used for testing.
{% for r in requires %}
+BuildRequires: {{r}}
Requires: {{r}}
{% endfor %}