[Lsb-messages] /var/www/bzr/lsb/devel/specdb-aux-scripts r26: Support CompProvides, CompRequires and AppRequires tables

Denis Silakov dsilakov at gmail.com
Fri Jul 22 13:23:25 UTC 2016


------------------------------------------------------------
revno: 26
committer: Denis Silakov <dsilakov at gmail.com>
branch nick: specdb-aux-scripts
timestamp: Fri 2016-07-22 16:23:25 +0300
message:
  Support CompProvides, CompRequires and AppRequires tables
modified:
  community-data-processing/delete_app.pl
  community-data-processing/delete_component.pl
  community-data-processing/delete_distr.pl
  community-data-processing/dump_distr_data_from_db.pl
-------------- next part --------------
=== modified file 'community-data-processing/delete_app.pl'
--- a/community-data-processing/delete_app.pl	2010-10-22 09:58:40 +0000
+++ b/community-data-processing/delete_app.pl	2016-07-22 13:23:25 +0000
@@ -52,6 +52,7 @@
 $dbh->do("delete from AppLib where ALaid=$Aid");
 #$dbh->do("delete from AppJInt where AJIaid=$Aid");
 $dbh->do("delete from AppRInt where ARIaid=$Aid");
+$dbh->do("delete from AppRequires where ARaid=$Aid");
 $dbh->do("delete from AppRILM where ARMaid=$Aid");
 $dbh->do("delete from cache_AppRIntLib where ARIaid=$Aid");
 $dbh->do("delete from cache_AppLibUsage where Aid=$Aid");

=== modified file 'community-data-processing/delete_component.pl'
--- a/community-data-processing/delete_component.pl	2011-03-31 10:21:42 +0000
+++ b/community-data-processing/delete_component.pl	2016-07-22 13:23:25 +0000
@@ -46,6 +46,8 @@
     $dbh->do("UPDATE RawCommand SET RCcomponent=$Calias WHERE RCcomponent=$Cid");
     $dbh->do("UPDATE RawLibrary SET RLcomponent=$Calias WHERE RLcomponent=$Cid");
     $dbh->do("UPDATE CompRILM SET CRMcid=$Calias WHERE CRMcid=$Cid");
+    $dbh->do("UPDATE CompRequires SET CRcid=$Calias WHERE CRcid=$Cid");
+    $dbh->do("UPDATE CompProvides SET CPcid=$Calias WHERE CPcid=$Cid");
     $dbh->do("UPDATE CompJInt SET CJIcid=$Calias WHERE CJIcid=$Cid");
 }
 else {
@@ -54,6 +56,8 @@
     $dbh->do("DELETE FROM RawLibrary WHERE RLcomponent=$Cid");
     $dbh->do("DELETE FROM RawCommand WHERE RCcomponent=$Cid");
     $dbh->do("DELETE FROM CompRILM WHERE CRMcid=$Cid");
+    $dbh->do("DELETE FROM CompRequires WHERE CRcid=$Cid");
+    $dbh->do("DELETE FROM CompProvides WHERE CPcid=$Cid");
     $dbh->do("DELETE FROM CompJInt WHERE CJIcid=$Cid");
     $dbh->do("DELETE FROM RLibRInt WHERE EXISTS (SELECT 1 FROM tmp_Libs WHERE RLid=RLRIrlid)");
     $dbh->do("DELETE FROM WeakSymbol WHERE EXISTS (SELECT 1 FROM tmp_Libs WHERE RLid=WSrlid)");

=== modified file 'community-data-processing/delete_distr.pl'
--- a/community-data-processing/delete_distr.pl	2011-03-31 10:20:10 +0000
+++ b/community-data-processing/delete_distr.pl	2016-07-22 13:23:25 +0000
@@ -52,6 +52,8 @@
         $dbh->do("UPDATE RawCommand SET RCcomponent=$Calias WHERE RCcomponent=$Cid");
         $dbh->do("UPDATE RawLibrary SET RLcomponent=$Calias WHERE RLcomponent=$Cid");
         $dbh->do("UPDATE CompRILM SET CRMcid=$Calias WHERE CRMcid=$Cid");
+        $dbh->do("UPDATE CompProvides SET CPcid=$Calias WHERE CPcid=$Cid");
+        $dbh->do("UPDATE CompRequires SET CRcid=$Calias WHERE CRcid=$Cid");
 #        $dbh->do("UPDATE CompJInt SET CJIcid=$Calias WHERE CJIcid=$Cid");
     }
     else {
@@ -62,6 +64,8 @@
             $dbh->do("DELETE FROM RawLibrary WHERE RLcomponent=$Cid");
 	    $dbh->do("DELETE FROM RawCommand WHERE RCcomponent=$Cid");
             $dbh->do("DELETE FROM CompRILM WHERE CRMcid=$Cid");
+            $dbh->do("DELETE FROM CompRequires WHERE CRcid=$Cid");
+            $dbh->do("DELETE FROM CompProvides WHERE CPcid=$Cid");
 #   	     $dbh->do("DELETE FROM CompJInt WHERE CJIcid=$Cid");
             $dbh->do("DELETE FROM RLibRInt WHERE EXISTS (SELECT 1 FROM tmp_Libs WHERE RLid=RLRIrlid)");
 	    $dbh->do("DELETE FROM WeakSymbol WHERE EXISTS (SELECT 1 FROM tmp_Libs WHERE RLid=WSrlid)");
@@ -72,11 +76,11 @@
     $dbh->do("delete from Component where Cid=$Cid");
 }
 
-$dbh->do("delete from RLibDeps where RLDrlid not in (select RLid from RawLibrary)");
-$dbh->do("delete from RLibRClass where RLRCrlid not in(select RLid from RawLibrary)");
-$dbh->do("delete from CompLDpath where CLDcid not in (select Cid from Component)");
-$dbh->do("delete from CompRILM where CRMcid not in (select Cid from Component)");
-$dbh->do("delete from RLibLink where RLLrlid not in (select RLid from RawLibrary)");
+$dbh->do("DELETE FROM RLibDeps WHERE RLDrlid NOT IN (SELECT RLid FROM RawLibrary)");
+$dbh->do("DELETE FROM RLibRClass WHERE RLRCrlid NOT IN (SELECT RLid FROM RawLibrary)");
+$dbh->do("DELETE FROM CompLDpath WHERE CLDcid NOT IN (SELECT Cid FROM Component)");
+$dbh->do("DELETE FROM CompRILM WHERE CRMcid NOT IN (SELECT Cid FROM Component)");
+$dbh->do("DELETE FROM RLibLink WHERE RLLrlid NOT IN (SELECT RLid FROM RawLibrary)");
 
 print "\n\n!!!!! REGENERATE CACHE TABLES MANUALLY !!!!!\n\n";
 

=== modified file 'community-data-processing/dump_distr_data_from_db.pl'
--- a/community-data-processing/dump_distr_data_from_db.pl	2014-06-02 06:57:41 +0000
+++ b/community-data-processing/dump_distr_data_from_db.pl	2016-07-22 13:23:25 +0000
@@ -25,6 +25,7 @@
 my $DBHost = $LSBDBHOST;
 
 sub get_machine($ );
+sub flag_to_str($ );
 
 # Database connector
 my $dbh;
@@ -61,6 +62,9 @@
 my $weak_Q = $dbh->prepare( "SELECT 1 FROM WeakSymbol WHERE WSrlid = ? AND WSriid = ?" );
 my $compat_Q = $dbh->prepare( "SELECT 1 FROM CompatSymbol WHERE CSrlid = ? AND CSriid = ?" );
 
+my $compprov_Q = $dbh->prepare( "SELECT CPcapability, IFNULL(CPflag,''), IFNULL(CPversion,'') FROM CompProvides WHERE CPcid = ?" );
+my $compreq_Q = $dbh->prepare( "SELECT CRdependency, IFNULL(CRflag,''), IFNULL(CRversion,'') FROM CompRequires WHERE CRcid = ?" );
+
 my ($total_comps) = $dbh->selectrow_array("SELECT COUNT(*) FROM Component WHERE Cdistr=$Did");
 my $cur_comp=0;
 $| = 1; # Turn on autoflush
@@ -160,11 +164,55 @@
         print DATA "!CompDesc $CIdescription\n";
         print DATA "!CompURL $CIurl\n";
     }
+
+    $compprov_Q->execute($Cid);
+    print DATA "!PkgProvides\n";
+    while ( my($CPcapability, $CPflag, $CPversion) = $compprov_Q->fetchrow_array() ) {
+        print DATA "$CPcapability";
+        if ($CPflag and $CPversion) {
+            my $flag = flag_to_str($CPflag);
+            print DATA " $flag $CPversion";
+        }
+        print DATA "\n";
+    }
+
+    $compreq_Q->execute($Cid);
+    print DATA "!PkgRequires\n";
+    while ( my($CRdependency, $CRflag, $CRversion) = $compreq_Q->fetchrow_array() ) {
+        print DATA "$CRdependency";
+        if ($CRflag and $CRversion) {
+            my $flag = flag_to_str($CRflag);
+            print DATA " $flag $CRversion";
+        }
+        print DATA "\n";
+    }
 }
 
 close(DATA);
 print "\n";
 
+# CompProv/Req flag to string
+sub flag_to_str($ )
+{
+    my $flag = $_[0];
+    if( $flag eq "eq" ) {
+        return "=";
+    }
+    if( $flag eq "lt" ) {
+        return "<";
+    }
+    if( $flag eq "gt" ) {
+        return ">";
+    }
+    if( $flag eq "ge" ) {
+        return ">=";
+    }
+    if( $flag eq "le" ) {
+        return ">=";
+    }
+    return "";
+}
+
 # Get value for ELF "Machine" field for given architecture
 sub get_machine($ )
 {



More information about the lsb-messages mailing list