summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpjmattal <pjmattal>2004-09-14 03:15:56 +0000
committerpjmattal <pjmattal>2004-09-14 03:15:56 +0000
commitcd539facb844f3dff6df33dce6760550df4cafa3 (patch)
tree9295b858aba12f30a58f14751b14692607886b22
parent272d00879c880bed8f2ae1f51dedbf6b6929959d (diff)
added parsing of PKGBUILD by using bash
-rwxr-xr-xtupkg/update/tupkgupdate29
1 files changed, 26 insertions, 3 deletions
diff --git a/tupkg/update/tupkgupdate b/tupkg/update/tupkgupdate
index 3f2de3a..97b269c 100755
--- a/tupkg/update/tupkgupdate
+++ b/tupkg/update/tupkgupdate
@@ -51,9 +51,32 @@ def areFilesIdentical(file_a, file_b):
############################################################
def infoFromPackageFile(filename):
- pkgbuild = pacman.load(filename)
- return pkgbuild.name, pkgbuild.version + "-" + pkgbuild.release
+ pkg = pacman.load(filename)
+ return pkg.name, pkg.version + "-" + pkg.release
+def infoFromPkgbuildFile(filename):
+ # open and source the file
+ pf_stdin, pf_stdout = os.popen2("/bin/bash", 't', 0)
+ print >>pf_stdin, ". " + filename
+
+ # get pkgname
+ print >>pf_stdin, 'echo $pkgname'
+ pkgname = pf_stdout.readline().strip()
+
+ # get pkgver
+ print >>pf_stdin, 'echo $pkgver'
+ pkgver = pf_stdout.readline().strip()
+
+ # get pkgrel
+ print >>pf_stdin, 'echo $pkgrel'
+ pkgrel = pf_stdout.readline().strip()
+
+ # clean up
+ pf_stdin.close()
+ pf_stdout.close()
+
+ return pkgname, pkgver + "-" + pkgrel
+
############################################################
# Functions for doing the final steps of execution
############################################################
@@ -126,7 +149,7 @@ delete = list()
a_files = pkgbuildsInTree(pkgbuild_dir)
for a_file in a_files:
- pkgname, ver = infoFromPackageFile(a_file)
+ pkgname, ver = infoFromPkgbuildFile(a_file)
# Error (and skip) if we encounter any invalid PKGBUILD files
if (pkgname == None or ver == None):