[Lsb-messages] /var/www/bzr/lsb/devel/build_env r1981: allow regenerating stubs for a single lib (bug 3615)

Mats Wichmann mats at linuxfoundation.org
Tue Jun 26 14:04:17 UTC 2012


------------------------------------------------------------
revno: 1981
committer: Mats Wichmann <mats at linuxfoundation.org>
branch nick: build_env
timestamp: Tue 2012-06-26 08:04:17 -0600
message:
  allow regenerating stubs for a single lib (bug 3615)
modified:
  stub_libs/Makefile
  stub_libs/mkstublibs
-------------- next part --------------
=== modified file 'stub_libs/Makefile'
--- a/stub_libs/Makefile	2012-05-18 16:59:21 +0000
+++ b/stub_libs/Makefile	2012-06-26 14:04:17 +0000
@@ -53,6 +53,9 @@
 dbfiles: 
 	for version in $(LSB_VERSIONS) $(LSB_DEVEL_VERSIONS); do for arch in $(LSB_SUPPORTED_ARCHS); do ./mkstublibs -a $$arch -v $$version; done; done
 
+dbfiles-%: 
+	for version in $(LSB_VERSIONS) $(LSB_DEVEL_VERSIONS); do for arch in $(LSB_SUPPORTED_ARCHS); do ./mkstublibs -a $$arch -v $$version -l $(shell echo "$@" | sed s/dbfiles-//); done; done
+
 # only need to depend on one filelist, the rule above will gen them all
 gensrc: versionfiles dbfiles core_filelist_3.0
 

=== modified file 'stub_libs/mkstublibs'
--- a/stub_libs/mkstublibs	2012-03-20 13:16:07 +0000
+++ b/stub_libs/mkstublibs	2012-06-26 14:04:17 +0000
@@ -19,6 +19,7 @@
 my ($DBUser) = $LSBUSER;
 my ($DBPass) = $LSBDBPASSWD;
 my ($DBHost) = $LSBDBHOST;
+my ($LibName) = "";
 my ($lsbversion);
 my ($TargetArch);
 my ($TargetArchId);
@@ -114,16 +115,16 @@
     $create = "CREATE TEMPORARY TABLE tmp_LibInts_$libId "
         . "(KEY `Iid`(`Iid`)) "
         . "SELECT Iid, Iname, Itype, Ilibrary FROM Interface "
-        . "LEFT JOIN LGInt ON LGIint=Iid "
-        . "LEFT JOIN LibGroup ON LGid=LGIlibg "
+        . "JOIN LGInt ON LGIint=Iid "
+        . "JOIN LibGroup ON LGid=LGIlibg "
         . "WHERE LGlib=$libId";
     $sth = $dbh->prepare($create) || die $dbh->errstr;
     $sth->execute() || die $sth->errstr;
 
     $create = "CREATE TEMPORARY TABLE tmp_LibIncludedInts_$libId "
-        . "(KEY `Iid`(`Iid`), KEY `AIarch`(`AIarch`), KEY `Iname`(`Iname`,`AIarch`), KEY `Itype`(`Itype`,`AIarch`)) "
+        . "(KEY `Iid`(`Iid`), KEY `AIarch`(`AIarch`), KEY `Itype`(`Itype`,`AIarch`)) "
         . "SELECT Iid, Iname, AIreturn, Itype, AIarch, AIversion, AIdeprecatedsince, Ilibrary FROM tmp_LibInts_$libId "
-        . "LEFT JOIN ArchInt ON AIint=Iid "
+        . "JOIN ArchInt ON AIint=Iid "
         . "WHERE (AIappearedin <= '$lsbversion' and AIappearedin > '') "
         . "AND (AIwithdrawnin IS NULL OR AIwithdrawnin >'$lsbversion') ";
     $sth = $dbh->prepare($create) || die $dbh->errstr;
@@ -391,17 +392,18 @@
 
 ######################################################################
 # Main bit
-getopts( 'd:u:p:v:o:ha:', \%Options );
+getopts( 'd:u:p:v:o:l:ha:', \%Options );
 
 if ( ( exists( $Options{'h'} ) ) or ( not exists( $Options{'v'} ) ) ) {
     print STDERR <<"EOM"
-Usage $0 -a arch -v lsbversion [-d db_name] [-u username] [-p password] [-o hostname] [-h]
+Usage $0 -a arch -v lsbversion [-d db_name] [-u username] [-p password] [-o hostname] [-l library] [-h]
     -h           Display this help
     -v           Target LSB version
     -d db_name   Database name
     -u username  Name of user for db access
     -p password  Password for db access
     -o hostname  Hostname for DB
+    -l library   Generate code for the given library only
     -a arch      Architecture to generate shared libraries for
                  (Note this is not magic - you have to compile it on
                   the correct platform still!)
@@ -424,6 +426,9 @@
 $DBHost = $Options{'o'} if exists( $Options{'o'} );
 $DBName = $Options{'d'} if exists( $Options{'d'} );
 
+
+$LibName = exists( $Options{'l'} ) ? $Options{'l'} : "";
+
 my ($dbh);
 my ($sth);
 my ($row);
@@ -458,8 +463,10 @@
 
 # Map of name to run-time name of shared library
 local (*LIBMAPFILE);
-open( LIBMAPFILE, ">$DestinationDirectory/LibNameMap.txt" )
-  || die "Could not open file LibNameMap.txt file for writing\n";
+if( !$LibName ) {
+  open( LIBMAPFILE, ">$DestinationDirectory/LibNameMap.txt" )
+    || die "Could not open file LibNameMap.txt file for writing\n";
+}
 
 # Get list of libraries we want to produce stub libraries for
 my $select;
@@ -470,8 +477,11 @@
   . "WHERE (ALappearedin <= \'$lsbversion\' and ALappearedin<>\'\') "
   . "AND (ALwithdrawnin IS NULL OR ALwithdrawnin > \'$lsbversion\') "
   . "AND ( ALaid=\'$TargetArchId\' OR ALaid=1 ) "
-  . "AND ALrunname<>\'\' "
-  . "ORDER BY Lname";
+  . "AND ALrunname<>\'\' ";
+if( $LibName ) {
+    $select.= "AND Lname='$LibName' ";
+}
+  $select.="ORDER BY Lname";
 $sth = $dbh->prepare($select)
   || die $dbh->errstr;
 $sth->execute() || die $sth->errstr;
@@ -483,7 +493,9 @@
     if ( $row->{Lname} eq $lastlib ) { next; }
     $lastlib = $row->{Lname};
     print "Generating c stubs for $row->{Lname} library ($row->{ALrunname})\n";
-    print LIBMAPFILE "$row->{Lname} $row->{ALrunname}\n";
+    if( !$LibName ) {
+        print LIBMAPFILE "$row->{Lname} $row->{ALrunname}\n";
+    }
     CreateTmpLibTable( $dbh, $row->{Lid} );
     GenerateLibrary( $dbh, $row->{Lname}, $row->{Lid} );
 }



More information about the lsb-messages mailing list