summaryrefslogtreecommitdiffstats
path: root/build_tools/bin
diff options
context:
space:
mode:
authorMichael Hanson <hansonorders@verizon.net>2011-01-12 03:50:25 (GMT)
committerMichael Hanson <hansonorders@verizon.net>2011-01-12 03:50:25 (GMT)
commitb24e3493f47d372dd821efa211044567d696288d (patch)
treede4eea1619a85259c84a5f222807f4d561be568e /build_tools/bin
parent1d0f7353d1a4178ddd25d8cfffa9ce6f5dd491c1 (diff)
downloadlinhes_dev-b24e3493f47d372dd821efa211044567d696288d.zip
mp.py: Updated to deal with custom PKGBUILD variables
Diffstat (limited to 'build_tools/bin')
-rwxr-xr-xbuild_tools/bin/mp.py54
1 files changed, 29 insertions, 25 deletions
diff --git a/build_tools/bin/mp.py b/build_tools/bin/mp.py
index 068b089..5c20011 100755
--- a/build_tools/bin/mp.py
+++ b/build_tools/bin/mp.py
@@ -16,6 +16,7 @@ PKGHOME = "/data/pkg_repo/packages"
SRCPKGHOME = "/data/pkg_repo/src_packages"
mydir = os.getcwd()
repolist = ['core', 'extra']
+variables = ['pkgbase','pkgname','pkgver','pkgrel','arch']
cli_dict = {}
cli_list = []
makepkg_cmd = ['makepkg']
@@ -212,10 +213,10 @@ def find_repo():
def update_repo():
# pkgname could be a list of several pkgs. Since bash array format is
# loose, let bash parse the pkgname(s) first, then return a list for us.
- b = subprocess.Popen(['/bin/bash','-c', 'source ' + pkgfile + '; echo ${pkgname[@]}'], stdout = subprocess.PIPE,)
- output = b.communicate()[0].strip('\n')
- print "Pkglist:",output
- pkglist = list(output.split())
+ #b = subprocess.Popen(['/bin/bash','-c', 'source ' + pkgfile + '; echo ${pkgname[@]}'], stdout = subprocess.PIPE,)
+ #output = b.communicate()[0].strip('\n')
+ #print "Pkglist:",output
+ #pkglist = list(output.split())
os.chdir(DOCROOT)
print
@@ -305,8 +306,10 @@ def config_file():
global pkgfile
global pkgbase
global pkgname
+ global pkglist
global pkgver
global pkgrel
+ global arch
global SRCPKG
global CARCH
global PKGDEST
@@ -323,27 +326,28 @@ def config_file():
print "ERROR in function config_file: Can't find ",pkgfile,"!"
sys.exit(2)
else:
- f=open(pkgfile,"r")
- # Read file contents to memory
- pkgbuild_contents=f.readlines()
- f.close()
-
- # Loop over contents to get our variables
- for line in pkgbuild_contents:
- if line.strip().startswith("pkgbase"):
- pkgbase = line.partition("=")[2].strip('\n')
- print "Package Base Name:",pkgbase
- if line.strip().startswith("pkgname"):
- pkgname = line.partition("=")[2].strip('\n')
- print "Package Name:",pkgname
- if line.strip().startswith("pkgver"):
- pkgver = line.partition("=")[2].strip('\n')
- print "Package Version:",pkgver
- if line.strip().startswith("pkgrel"):
- pkgrel = line.partition("=")[2].strip('\n')
- print "Package Release:",pkgrel
- if line.strip().startswith("arch"):
- arch = line.partition("=")[2].strip('\n')
+ # Loop over contents to get our variables
+ # Use bash to do it because PKGBUILDs are very loose with their format
+ for item in variables:
+ v = subprocess.Popen(['/bin/bash','-c', 'source ' + pkgfile + '; echo ${' + item + '[@]}'], stdout = subprocess.PIPE,)
+ value = v.communicate()[0].strip('\n')
+ if item == "pkgbase":
+ pkgbase = value
+ print "pkgbase:",pkgbase
+ if item == "pkgname":
+ pkgname = value
+ print "pkgname:",pkgname
+ pkglist = list(value.split())
+ print "pkglist:",pkglist
+ if item == "pkgver":
+ pkgver = value
+ print "pkgver:",pkgver
+ if item == "pkgrel":
+ pkgrel = value
+ print "pkgrel:",pkgrel
+ if item == "arch":
+ arch = value
+ print "arch:",arch
if pkgbase:
SRCPKG = pkgbase + "-" + pkgver + "-" + pkgrel + ".src.tar.gz"