summaryrefslogtreecommitdiffstats
path: root/lib.php
diff options
context:
space:
mode:
authorRomain d'Alverny <rda@mageia.org>2012-09-04 17:04:21 +0000
committerRomain d'Alverny <rda@mageia.org>2012-09-04 17:04:21 +0000
commit32a5e12669c01d4bce6c28835eb24bd410d7e5a9 (patch)
tree4154eeab0805c143e2abf3c4d8cdcefd9a477c4f /lib.php
parentb6a1bffd90a5f5fd38bb7208bc79e210ff6030ae (diff)
downloadpkgsubmit-32a5e12669c01d4bce6c28835eb24bd410d7e5a9.tar
pkgsubmit-32a5e12669c01d4bce6c28835eb24bd410d7e5a9.tar.gz
pkgsubmit-32a5e12669c01d4bce6c28835eb24bd410d7e5a9.tar.bz2
pkgsubmit-32a5e12669c01d4bce6c28835eb24bd410d7e5a9.tar.xz
pkgsubmit-32a5e12669c01d4bce6c28835eb24bd410d7e5a9.zip
new get_submitted_packages()
Diffstat (limited to 'lib.php')
-rw-r--r--lib.php20
1 files changed, 20 insertions, 0 deletions
diff --git a/lib.php b/lib.php
index aff9929..a888c21 100644
--- a/lib.php
+++ b/lib.php
@@ -19,6 +19,26 @@
*/
/**
+ * List all packages submitted to the BS.
+ *
+ * @param string $upload_dir
+ *
+ * @return array
+*/
+function get_submitted_packages($upload_dir)
+{
+ chdir($upload_dir);
+
+ $matches = array();
+ $all_files = shell_exec("find \( -name '*.rpm' -o -name '*.src.rpm.info' -o -name '*.lock' -o -name '*.done' -o -name '*.upload' \) -ctime -$max_modified -printf \"%p\t%T@\\n\"");
+ $re = "!^\./(\w+)/((\w+)/(\w+)/(\w+)/(\d+)\.(\w+)\.(\w+)\.(\d+))_?(.*)(\.src\.rpm(?:\.info)?|\.lock|\.done|\.upload)\s+(\d+\.\d+)$!m";
+ $r = preg_match_all($re,
+ $all_files,
+ $matches,
+ PREG_SET_ORDER);
+}
+
+/**
* Return a human-readable label for this package build status.
*
* @param array $pkg package information