diff options
author | Joshua Harlow <harlowja@yahoo-inc.com> | 2012-09-28 15:38:48 -0400 |
---|---|---|
committer | Scott Moser <smoser@ubuntu.com> | 2012-09-28 15:38:48 -0400 |
commit | 92cbc3ae78b560cd6e81f2894d743b72b744eee1 (patch) | |
tree | 9c51e3eb3cea77b7c9c855c773105a5f3ebd2451 /packages | |
parent | dfa62e70bd9942fd3c82d77217d48615a78bbcfc (diff) | |
parent | 46be69003044a7d60d9566dbddd1b7fd93054c8f (diff) | |
download | vyos-cloud-init-92cbc3ae78b560cd6e81f2894d743b72b744eee1.tar.gz vyos-cloud-init-92cbc3ae78b560cd6e81f2894d743b72b744eee1.zip |
rpm spec and rpm build, better handle case with no package_mirrors
Diffstat (limited to 'packages')
-rwxr-xr-x | packages/brpm | 15 | ||||
-rw-r--r-- | packages/redhat/cloud-init.spec.in | 18 |
2 files changed, 29 insertions, 4 deletions
diff --git a/packages/brpm b/packages/brpm index 77de0cf2..1735f5bb 100755 --- a/packages/brpm +++ b/packages/brpm @@ -91,7 +91,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')] @@ -148,7 +148,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 +166,10 @@ def main(): " (default: %(default)s)"), default=False, action='store_true') + 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 +198,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/redhat/cloud-init.spec.in b/packages/redhat/cloud-init.spec.in index 35b27beb..12f0b144 100644 --- a/packages/redhat/cloud-init.spec.in +++ b/packages/redhat/cloud-init.spec.in @@ -5,6 +5,10 @@ # 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} @@ -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 |