summaryrefslogtreecommitdiff
path: root/packages
diff options
context:
space:
mode:
authorVlastimil Holer <vlastimil.holer@gmail.com>2012-12-19 18:03:03 +0100
committerVlastimil Holer <vlastimil.holer@gmail.com>2012-12-19 18:03:03 +0100
commit8dd9678d97a822e477915c150d528096a83c9777 (patch)
treea9b5708edd9d448508abf00abdd9b7bdeba16541 /packages
parenta9939fe768e04d52fe530c7467357d79b78a21f4 (diff)
parent3569e71a1579b97f4e33fb46ab3fcef08a4ddad4 (diff)
downloadvyos-cloud-init-8dd9678d97a822e477915c150d528096a83c9777.tar.gz
vyos-cloud-init-8dd9678d97a822e477915c150d528096a83c9777.zip
Merged trunk lp:cloud-init
Diffstat (limited to 'packages')
-rwxr-xr-xpackages/bddeb6
-rwxr-xr-xpackages/brpm47
-rw-r--r--packages/debian/watch2
-rw-r--r--packages/redhat/cloud-init.spec.in20
4 files changed, 61 insertions, 14 deletions
diff --git a/packages/bddeb b/packages/bddeb
index 2cfddb99..bda3170d 100755
--- a/packages/bddeb
+++ b/packages/bddeb
@@ -28,13 +28,13 @@ import argparse
# use in our debian 'control' file, this is a translation of the 'requires'
# file pypi package name to a debian/ubuntu package name.
PKG_MP = {
+ 'argparse': 'python-argparse',
'boto': 'python-boto',
+ 'cheetah': 'python-cheetah',
'configobj': 'python-configobj',
'oauth': 'python-oauth',
- 'pyyaml': 'python-yaml',
'prettytable': 'python-prettytable',
- 'argparse': 'python-argparse',
- 'cheetah': 'python-cheetah',
+ 'pyyaml': 'python-yaml',
}
DEBUILD_ARGS = ["-us", "-S", "-uc"]
diff --git a/packages/brpm b/packages/brpm
index 77de0cf2..eea2a046 100755
--- a/packages/brpm
+++ b/packages/brpm
@@ -34,13 +34,13 @@ from cloudinit import util
# this is a translation of the 'requires'
# file pypi package name to a redhat/fedora package name.
PKG_MP = {
+ 'argparse': 'python-argparse',
'boto': 'python-boto',
'cheetah': 'python-cheetah',
- 'prettytable': 'python-prettytable',
- 'oauth': 'python-oauth',
'configobj': 'python-configobj',
+ 'oauth': 'python-oauth',
+ 'prettytable': 'python-prettytable',
'pyyaml': 'PyYAML',
- 'argparse': 'python-argparse',
}
# Subdirectories of the ~/rpmbuild dir
@@ -58,8 +58,7 @@ def get_log_header(version):
a_rev = rev
break
if not a_rev:
- return format_change_line(datetime.now(),
- '??', version)
+ return None
# Extract who made that tag as the header
cmd = ['bzr', 'log', '-r%s' % (a_rev), '--timezone=utc']
@@ -91,7 +90,7 @@ def format_change_line(ds, who, comment=None):
return "* %s" % (d)
-def generate_spec_contents(args, tmpl_fn, arc_fn):
+def generate_spec_contents(args, tmpl_fn, top_dir, arc_fn):
# Figure out the version and revno
cmd = [util.abs_join(find_root(), 'tools', 'read-version')]
@@ -107,6 +106,10 @@ def generate_spec_contents(args, tmpl_fn, arc_fn):
subs['version'] = version
subs['revno'] = revno
subs['release'] = "bzr%s" % (revno)
+ if args.sub_release is not None:
+ subs['subrelease'] = "." + str(args.sub_release)
+ else:
+ subs['subrelease'] = ''
subs['archive_name'] = arc_fn
cmd = [util.abs_join(find_root(), 'tools', 'read-dependencies')]
@@ -127,13 +130,23 @@ def generate_spec_contents(args, tmpl_fn, arc_fn):
# Format a nice changelog (as best as we can)
changelog = util.load_file(util.abs_join(find_root(), 'ChangeLog'))
changelog_lines = []
+ missing_versions = 0
for line in changelog.splitlines():
if not line.strip():
continue
if re.match(r"^\s*[\d][.][\d][.][\d]:\s*", line):
line = line.strip(":")
header = get_log_header(line)
- changelog_lines.append(header)
+ if not header:
+ missing_versions += 1
+ if missing_versions == 1:
+ # Must be using a new 'dev'/'trunk' release
+ changelog_lines.append(format_change_line(datetime.now(), '??'))
+ else:
+ sys.stderr.write(("Changelog version line %s "
+ "does not have a corresponding tag!\n") % (line))
+ else:
+ changelog_lines.append(header)
else:
changelog_lines.append(line)
subs['changelog'] = "\n".join(changelog_lines)
@@ -148,7 +161,9 @@ def generate_spec_contents(args, tmpl_fn, arc_fn):
else:
subs['systemd'] = False
+ subs['defines'] = ["_topdir %s" % (top_dir)]
subs['init_sys'] = args.boot
+ subs['patches'] = [os.path.basename(p) for p in args.patches]
return templater.render_from_file(tmpl_fn, params=subs)
@@ -164,6 +179,17 @@ def main():
" (default: %(default)s)"),
default=False,
action='store_true')
+ parser.add_argument('-s', "--sub-release", dest="sub_release",
+ metavar="RELEASE",
+ help=("a 'internal' release number to concat"
+ " with the bzr version number to form"
+ " the final version number"),
+ type=int,
+ default=None)
+ parser.add_argument("-p", "--patch", dest="patches",
+ help=("include the following patch when building"),
+ default=[],
+ action='append')
args = parser.parse_args()
capture = True
if args.verbose:
@@ -192,16 +218,17 @@ def main():
# Form the spec file to be used
tmpl_fn = util.abs_join(find_root(), 'packages',
'redhat', 'cloud-init.spec.in')
- contents = generate_spec_contents(args, tmpl_fn,
+ contents = generate_spec_contents(args, tmpl_fn, root_dir,
os.path.basename(archive_fn))
spec_fn = util.abs_join(root_dir, 'cloud-init.spec')
util.write_file(spec_fn, contents)
print("Created spec file at %r" % (spec_fn))
+ for p in args.patches:
+ util.copy(p, util.abs_join(arc_dir, os.path.basename(p)))
# Now build it!
print("Running 'rpmbuild' in %r" % (root_dir))
- cmd = ['rpmbuild', '--clean',
- '-ba', spec_fn]
+ cmd = ['rpmbuild', '-ba', spec_fn]
util.subp(cmd, capture=capture)
# Copy the items built to our local dir
diff --git a/packages/debian/watch b/packages/debian/watch
new file mode 100644
index 00000000..0f7a600b
--- /dev/null
+++ b/packages/debian/watch
@@ -0,0 +1,2 @@
+version=3
+https://launchpad.net/cloud-init/+download .*/\+download/cloud-init-(.+)\.tar.gz
diff --git a/packages/redhat/cloud-init.spec.in b/packages/redhat/cloud-init.spec.in
index 35b27beb..30bcd050 100644
--- a/packages/redhat/cloud-init.spec.in
+++ b/packages/redhat/cloud-init.spec.in
@@ -5,9 +5,13 @@
# Or: http://fedoraproject.org/wiki/Packaging:ScriptletSnippets
# Or: http://www.rpm.org/max-rpm/ch-rpm-inside.html
+#for $d in $defines
+%define ${d}
+#end for
+
Name: cloud-init
Version: ${version}
-Release: ${release}%{?dist}
+Release: ${release}${subrelease}%{?dist}
Summary: Cloud instance init scripts
Group: System Environment/Base
@@ -36,6 +40,13 @@ Requires: shadow-utils
Requires: ${r}
#end for
+# Custom patches
+#set $size = 0
+#for $p in $patches
+Patch${size}: $p
+#set $size += 1
+#end for
+
#if $sysvinit
Requires(post): chkconfig
Requires(postun): initscripts
@@ -58,6 +69,13 @@ ssh keys and to let the user run various scripts.
%prep
%setup -q -n %{name}-%{version}~${release}
+# Custom patches activation
+#set $size = 0
+#for $p in $patches
+%patch${size} -p1
+#set $size += 1
+#end for
+
%build
%{__python} setup.py build