From 41baae87ce4e24f296acc7f2448e3ad94e5cc1db Mon Sep 17 00:00:00 2001 From: Joshua Harlow Date: Mon, 25 Jun 2012 13:07:57 -0700 Subject: Continue working on getting a specfile generated. --- packages/brpm | 44 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) (limited to 'packages') diff --git a/packages/brpm b/packages/brpm index 829303ea..f2c3dac4 100755 --- a/packages/brpm +++ b/packages/brpm @@ -1,3 +1,45 @@ -#!/bin/sh +#!/usr/bin/python +# vi: ts=4 expandtab +import os +import subprocess +import sys +import tempfile +import re +import tempita + +# This is more just for running from the bin folder so that +# cloud-init binary can find the cloudinit module +possible_topdir = os.path.normpath(os.path.join(os.path.abspath( + sys.argv[0]), os.pardir, os.pardir)) +if os.path.exists(os.path.join(possible_topdir, "cloudinit", "__init__.py")): + sys.path.insert(0, possible_topdir) + +PWD = os.getcwd() + +def info(msg): + sys.stderr.write("INFO: %s\n" % (msg)) + + +def warn(msg): + sys.stderr.write("WARNING: %s\n" % (msg)) + + +def main(): + if not os.path.isfile(os.path.join(PWD, 'brpm.tmpl')): + warn("Can not find required template file 'brpm.tmpl'") + return 1 + if not os.path.isfile(os.path.join(os.pardir, 'setup.py')): + warn("Can not find required root 'setup.py' file") + return 1 + + cmd = [os.path.join(os.pardir, 'tools', 'read-version')] + version = subprocess.check_Call(cmd) + + + return 0 + + +if __name__ == '__main__': + sys.exit(main()) -- cgit v1.2.3