[Dh-make-php-commits] r347 - trunk
Uwe Steinmann
steinm at alioth.debian.org
Wed Sep 1 11:45:41 UTC 2010
Author: steinm
Date: 2010-09-01 11:45:39 +0000 (Wed, 01 Sep 2010)
New Revision: 347
Modified:
trunk/phppkginfo
Log:
- added new option 'hasphpscript' which checks if a package has a
file with role='script'. It currently does not check if this is
actually a php script
Modified: trunk/phppkginfo
===================================================================
--- trunk/phppkginfo 2010-09-01 11:44:17 UTC (rev 346)
+++ trunk/phppkginfo 2010-09-01 11:45:39 UTC (rev 347)
@@ -17,9 +17,26 @@
echo " license - License of package\n";
echo " date - Date of release\n";
echo " changelog - Full changelog of package\n";
+ echo " hasphpscript - Check if package contains files of type 'script'\n";
echo " all - print_r() of complete package file\n";
}
+function checkForPhpScript($content) {
+ foreach($content as $name=>$item) {
+ if($name == 'dir') {
+ return checkForPhpScript($item);
+ } elseif($name == 'file') {
+ foreach($item as $file) {
+ if($file['attribs']['role'] == 'script') {
+// echo "Found file of type ".$file['attribs']['role'].": ".$file['attribs']['name']."\n";
+ return 1;
+ }
+ }
+ }
+ }
+ return 0;
+}
+
if($_SERVER["argc"] < 3) {
usage();
exit;
@@ -81,6 +98,10 @@
echo " ".str_replace("\n", "\n ", wordwrap(ereg_replace("[[:space:]]+", " ", $changelog["release_notes"])))."\n\n";
}
break;
+ case "hasphpscript":
+ /* not yet implemented for verion 1.0 package files */
+ echo "0";
+ break;
case "all":
print_r($pf->_packageInfo);
break;
@@ -138,6 +159,11 @@
echo " ".str_replace("\n", "\n ", wordwrap(ereg_replace("[[:space:]]+", " ", $changelog["notes"])))."\n\n";
}
break;
+ case "hasphpscript":
+ $content = $pf->_packageInfo['contents'];
+ $hasscript = checkForPhpScript($content);
+ echo $hasscript;
+ break;
case "all":
print_r($pf->_packageInfo);
break;
More information about the Dh-make-php-commits
mailing list