diff options
| author | Nic <poster@poster-desktop.(none)> | 2009-06-09 15:45:02 -0400 |
|---|---|---|
| committer | Nic <poster@poster-desktop.(none)> | 2009-06-09 15:45:02 -0400 |
| commit | b3bb7cf7334a1a6ab125b4d2383d65ae44b2586d (patch) | |
| tree | 704bd532ee84dafdd8a98994cd202b65c2e259fb | |
| parent | 01a510cf5c325616c80b76690194eab319b8e127 (diff) | |
| download | chkpkglic-master.tar.gz | |
new file: DESIGN.local
new file: fossology_plugins/savane-check.php
| -rw-r--r-- | DESIGN.local | 38 | ||||
| -rw-r--r-- | fossology_plugins/savane-check.php | 138 |
2 files changed, 176 insertions, 0 deletions
diff --git a/DESIGN.local b/DESIGN.local new file mode 100644 index 0000000..2257246 --- /dev/null +++ b/DESIGN.local @@ -0,0 +1,38 @@ +SUMMARY + +The design focuses on creating stupid, local scripts as a way to help +verify freedom compliance of the software package. + +EXPECTATIONS + +1. The scripts should be able to differentiate what type of licenses are +used by the files in the package. + +2. It should allow the user to confirm that those files really are using +those licenses. Ask the user if the script should claim it a) complies , +b) does not comply , c) or skip to confirm another time. + +3. Verifying freedoms takes a very long time so, there should be way to +continue a previous session in case the user decides to quit during the +process. + +REQUIREMENTS + +GNU grep, GNU Less, GNU coreutils + +METHOD + +1. To complete Expectation 1, the script uses the grep command to +organize the files into a list by notice type. The list is outputed to a +file called something like, projectName_bsd_type. + +2. There should be a way to put the list of files into an array, to +bring up files automatically with the pager to allow the user to view +the license notice. After viewing the file, hopefully the user recalls +whether file complies or not to answer the interactive question, that +are used to further organize the files between non-compliant and +compliant. + +RESOURCES + + diff --git a/fossology_plugins/savane-check.php b/fossology_plugins/savane-check.php new file mode 100644 index 0000000..b9e7a90 --- /dev/null +++ b/fossology_plugins/savane-check.php @@ -0,0 +1,138 @@ +<?php
+/***********************************************************
+ Copyright (C) 2009 Federico Gimenez Nieto - [email protected]
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ ***********************************************************/
+
+/*************************************************
+ Restrict usage: Every PHP file should have this
+ at the very beginning.
+ This supposedly prevents cracking attempts.
+ *************************************************/
+global $GlobalReady;
+if (!isset($GlobalReady)) { exit; }
+
+class savane_check extends FO_Plugin
+{
+ public $Name = "savane_check";
+ public $Title = "Check package for Savannah inclusion";
+ public $MenuList = "Savane::Check";
+ public $Version = "0.1";
+ public $Dependency = array("db");
+ public $DBaccess = PLUGIN_DB_ANALYZE;
+
+ /*
+ DoSearchModel($Packagename): searchs on the database for a packagename
+ */
+ function DoSearchModel($Packagename, $DB){
+ $SQL="SELECT
+ uploadtree_pk, upload_pk, upload_filename
+ FROM
+ upload
+ INNER JOIN
+ uploadtree
+ ON
+ upload_fk=upload_pk
+ AND parent IS NULL
+ WHERE
+ upload_filename LIKE '%$Packagename%';";
+
+ return $DB->Action($SQL);
+ }
+
+ /*
+ SearchResultsView($Results): returns html for the searched results with links
+ */
+ function SearchResultsView($Results,$search_string){
+ if(count($Results)==0)
+ $output="<p>Sorry, no entries found with <i>$search_string</i>!</p>";
+
+ else{
+ $output="<p>Results found with <i>$search_string</i></p>";
+ foreach($Results as $result)
+ $output.="<p><strong>".$result['upload_filename']."</strong></p>";
+ }
+
+ return $output;
+ }
+
+ /*
+ CheckResultView($Packageid):
+ */
+ function CheckResultView($Packageid){
+
+ }
+
+ /*
+ FormView(): returns the html code for the search form
+ */
+ function FormView($Packagename=''){
+ $V = "";
+ $Uri = preg_replace("/&packagename=[^&]*/","",Traceback());
+
+ $V .= "<hr/><form action='$Uri' method='POST'>\n";
+ $V .= "<ul>\n";
+ $V .= "<li>Enter the string to search for:<P>";
+ $V .= "<INPUT type='text' name='packagename' size='40' value='" . htmlentities ($Packagename) . "'>\n";
+ $V .= "</ul>\n";
+ $V .= "<input type='submit' value='Search!'>\n";
+ $V .= "</form>\n";
+
+ return $V;
+ }
+
+
+ /*********************************************
+ Output(): Generate the text for this plugin.
+ *********************************************/
+ function Output()
+ {
+ if ($this->State != PLUGIN_STATE_READY) { return; }
+ global $DB;
+ $V="";
+ switch($this->OutputType)
+ {
+ case "XML":
+ break;
+ case "HTML":
+ #Controller code
+ #Extract params
+ $Packagename = GetParm("packagename",PARM_STRING);
+ $Packageid = GetParm("packageid",PARM_STRING);
+
+ if(!empty($Packagename))
+ #Do search and show results
+ $V .= $this->SearchResultsView($this->DoSearchModel($Packagename, $DB),$Packagename);
+
+ else if(!empty($Packageid))
+ #Show check result for this package
+ $V .= $this->CheckResultView($Packageid);
+
+ $V .= $this->FormView($Packagename);
+
+ break;
+ case "Text":
+ break;
+ default:
+ break;
+ }
+ if (!$this->OutputToStdout) { return($V); }
+ print("$V");
+ return;
+ }
+};
+$NewPlugin = new savane_check;
+$NewPlugin->Initialize();
|
