From 32a5e12669c01d4bce6c28835eb24bd410d7e5a9 Mon Sep 17 00:00:00 2001 From: Romain d'Alverny Date: Tue, 4 Sep 2012 17:04:21 +0000 Subject: new get_submitted_packages() --- lib.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'lib.php') diff --git a/lib.php b/lib.php index aff9929..a888c21 100644 --- a/lib.php +++ b/lib.php @@ -18,6 +18,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. * -- cgit v1.2.1