Update of /cvsroot/fink/scripts/pdb
In directory sc8-pr-cvs5.sourceforge.net:/tmp/cvs-serv26298

Modified Files:
      Tag: redesign_pdb
        .cvsignore HOWTO dump inject pdb_full_update-piecewise 
        pdb_full_update-unified schema.sql update.sh 
Removed Files:
      Tag: redesign_pdb
        fink.conf 
Log Message:
First step to redesigning the package database (pdb)
Some of these things are described at:
http://wiki.finkproject.org/index.php/Fink:PDB

- .cvsignore: 
  'db.inc.pl' doesn't seem to be used anymore
  'basepath_fink.inc' and' htdocs_pdb.inc' are new settings files for the 
  local basepath (where fink is installed) and for the htdocs dir
- HOWTO: updated with instructions on how to bootstrap (not tested)
- dump:
  - No longer needs a fake 'fink.conf' file to initialize
  - Virtual packages are no longer included
  - Now stores info file location and change date in db
  - Description is no longer pre-formatted here (will be done in php)
  - 'fullname' is no longer stored in db (was redundant)
- inject, pdb_full_update-piecewise, pdb_full_update-unified: 
  - now use 'htdocs_pdb.inc' to find the htdocs dir
- schema.sql: 
  - Drop tables before creating
  - 'collate latin1_bin'
  - 'fullname' no longer in db
  - new 'infofile' and 'infofilechanged' fields
- update.sh: Add some more comments
- fink.conf: Removed. Fink is now initialized directly in dump



Index: .cvsignore
===================================================================
RCS file: /cvsroot/fink/scripts/pdb/.cvsignore,v
retrieving revision 1.4
retrieving revision 1.4.2.1
diff -u -d -r1.4 -r1.4.2.1
--- .cvsignore  16 Jun 2006 18:51:21 -0000      1.4
+++ .cvsignore  27 Jan 2007 03:45:30 -0000      1.4.2.1
@@ -3,5 +3,6 @@
 *-stable.sql
 current.sql
 timestamp.inc
-db.inc.pl
 maintlist.txt
+basepath_fink.inc
+htdocs_pdb.inc

Index: dump
===================================================================
RCS file: /cvsroot/fink/scripts/pdb/dump,v
retrieving revision 1.32
retrieving revision 1.32.2.1
diff -u -d -r1.32 -r1.32.2.1
--- dump        11 Jan 2007 05:08:16 -0000      1.32
+++ dump        27 Jan 2007 03:45:30 -0000      1.32.2.1
@@ -30,6 +30,8 @@
 use Fink::Config qw(&set_options);
 use Fink::Package;
 use Fink::Command qw(rm_f);
+use File::stat;
+use POSIX qw(strftime);
 
 use Getopt::Long;
 
@@ -48,8 +50,17 @@
 &die_with_usage unless defined $distribution && defined $tree && defined 
$release;
 $architecture = 'powerpc' unless defined $architecture;
 
-### read config
-my $config = &read_config("fink.conf");
+### set default config
+open (BASEPATH, "basepath_fink.inc") || die "couldn't open 
'basepath_fink.inc'!";
+my $basepath = <BASEPATH>;
+close(BASEPATH);
+chomp $basepath;
+
+my $properties;
+$properties->{'basepath'} = $basepath;
+$properties->{'trees'} = 'stable/main stable/crypto';
+$properties->{'distribution'} = '10.4';
+my $config = Fink::Config->new_from_properties($properties);
 
 ### read package info
 
@@ -63,19 +74,20 @@
 # (since we may use the dists/ symlink not the actual $distribution dir)
 my $treelink = $config->{'basepath'} . "/fink/dists/$distribution-$tree";
 rm_f $treelink;
+my $disttree = $tree;
 if (-e $treelink) {
     print "Could not remove old $treelink\n";
     undef $treelink;
 } else {
     if (symlink $tree, $treelink) {
-       $tree = "$distribution-$tree";
+       $disttree = "$distribution-$tree";
     } else {
        print "Could not create symlink $treelink: $!\n";
        undef $treelink;
     }
 }
 
-$config->set_param("Trees", "$tree/main $tree/crypto");
+$config->set_param("Trees", "$disttree/main $disttree/crypto");
 if (defined $architecture) {
     $config->set_param("Architecture", $architecture);
     $config->set_param("Debarch", "darwin-$architecture");
@@ -84,7 +96,7 @@
 # we don't (and mustn't) call save()
 
 # omit actual locally-installed fink if it is present
-set_options({exclude_trees=>[qw/status/]});
+set_options({exclude_trees=>[qw/status virtual/]});
 
 # load the package database
 Fink::Package->require_packages();
@@ -102,7 +114,7 @@
 ### loop over packages
 
 my ($package, $po, $version, $vo);
-my ($maintainer, $email, $desc, $parent);
+my ($maintainer, $email, $desc, $parent, $infofile, $infofilechanged);
 my ($q, $v, $s, $key, $parentkey, %data, %splitoffdata);
 
 foreach $package (Fink::Package->list_packages()) {
@@ -114,17 +126,25 @@
   # Skip splitoffs
   #next if $vo->has_parent();
 
+  # get info file
+  $infofile = $vo->get_info_filename();
+  if ($infofile) {
+    my $sb = stat($infofile);
+    $infofile =~ s/$treelink\///s;
+    $infofile = "fink/dists/$distribution/$tree/$infofile";
+    $infofilechanged = strftime "%Y-%m-%d %H:%M:%S", gmtime $sb->mtime;
+  }
+  
   # gather fields
   $maintainer = $vo->param_default("Maintainer", "(not set)");
 
-  $desc = "<p>".$vo->get_description(1,1);
+  $desc = $vo->get_desc_detail(1);
+  chomp $desc;
   $desc =~ s/\s+$//s;
-  $desc =~ s/\n/<\/p><p>/s;
-  $desc =~ s/\n\s*\.\n/<\/p><p>/sg;
-  $desc .= "</p>";
+  $desc =~ s/\n/\\n/g;
  
-  %data = ( 'release' => $release,
-           'fullname' => $vo->get_fullname(),
+  %data = ( 
+           'release' => $release,
            'name' => $vo->get_name(),
            'version' => $vo->get_version(),
            'revision' => $vo->get_revision(),
@@ -134,7 +154,9 @@
            'maintainer' => $maintainer,
            'license' => $vo->get_license(),
            'homepage' => $vo->param_default("Homepage", ""),
-           'section' => $vo->get_section()
+           'section' => $vo->get_section(),
+           'infofile' => $infofile,
+           'infofilechanged' => $infofilechanged,
          );
            
   # Determine the splitoff parent of this package

Index: schema.sql
===================================================================
RCS file: /cvsroot/fink/scripts/pdb/schema.sql,v
retrieving revision 1.8
retrieving revision 1.8.2.1
diff -u -d -r1.8 -r1.8.2.1
--- schema.sql  28 Aug 2004 17:54:20 -0000      1.8
+++ schema.sql  27 Jan 2007 03:45:30 -0000      1.8.2.1
@@ -1,36 +1,42 @@
+drop table if exists release;
+drop table if exists sections;
+drop table if exists splitoffs;
+drop table if exists package;
+
 create table release (
  name varchar(50) not null,
  description text,
  primary key (name)
-);
+) collate latin1_bin;
 
 create table sections (
  name varchar(32) not null,
  description text,
  primary key (name)
-);
+) collate latin1_bin;
 
 create table splitoffs (
  name varchar(64) not null,
  parentkey varchar(84) not null,
  descshort varchar(80) not null default '',
  primary key(parentkey, name)
-);
+) collate latin1_bin;
 
 create table package (
  release varchar(50) not null,
- fullname varchar(128) not null,
  name varchar(64) not null,
  parentname varchar(64),
  version varchar(64) not null,
  revision varchar (16) not null,
  epoch tinyint not null default '0',
- section varchar(32) not null,
  descshort varchar(80) not null default '',
  desclong text,
  maintainer varchar(255),
- homepage varchar(255),
  license varchar(64),
+ homepage varchar(255),
+ section varchar(32) not null,
+ infofile varchar(255) not null default '',
+ infofilechanged datetime,
  latest tinyint not null default '0',
  needtest tinyint not null default '0',
  primary key (release,name),
@@ -38,5 +44,5 @@
  index (section),
  index (latest),
  index (needtest)
-);
+) collate latin1_bin;
 

Index: pdb_full_update-piecewise
===================================================================
RCS file: /cvsroot/fink/scripts/pdb/pdb_full_update-piecewise,v
retrieving revision 1.7
retrieving revision 1.7.2.1
diff -u -d -r1.7 -r1.7.2.1
--- pdb_full_update-piecewise   29 Sep 2006 04:28:08 -0000      1.7
+++ pdb_full_update-piecewise   27 Jan 2007 03:45:30 -0000      1.7.2.1
@@ -1,5 +1,11 @@
 #!/bin/sh
-cd /Volumes/src2/fink/pdb.finkproject.org/pdb
+
+if [ -f htdocs_pdb.inc ]; then
+  PDB_HTDOCS=`cat htdocs_pdb.inc`
+else
+  echo "'htdocs_pdb.inc' not found!"
+  exit 1
+fi
 
 echo "Starting PDB update: `date`"
 
@@ -15,7 +21,7 @@
 echo "Fixing permissions"
 chgrp -R fink .
 chmod -f -R g+w,a+r .
-chgrp fink /Volumes/src2/fink/pdb.finkproject.org/htdocs/pdb/timestamp.inc
+chgrp fink $PDB_HTDOCS/timestamp.inc
 
 echo "Exporting maintainer data"
 maintfile="maintlist.txt"
@@ -28,3 +34,5 @@
 $HOME/bin/finksql <sections.sql
 
 echo "Finished PDB update: `date`"
+
+exit 0

Index: HOWTO
===================================================================
RCS file: /cvsroot/fink/scripts/pdb/HOWTO,v
retrieving revision 1.10
retrieving revision 1.10.2.1
diff -u -d -r1.10 -r1.10.2.1
--- HOWTO       16 Jun 2006 17:33:02 -0000      1.10
+++ HOWTO       27 Jan 2007 03:45:30 -0000      1.10.2.1
@@ -11,15 +11,18 @@
 ~/bin/finksql:
 #!/bin/sh
 exec mysql -h localhost -u fink --password=DBPASSWORD fink
+(or, on shell.sf.net: exec mysql -h mysql4-f.sourceforge.net -u f17203rw 
--password=DBPASSWORD f17203_pdb )
 
 ~/.finkdbi:
 DBI:mysql:database=fink;host=localhost|fink|DBPASSWORD
+(or, on shell.sf.net: 
DBI:mysql:database=f17203_pdb;host=mysql4-f.sourceforge.net|f17203rw|DBPASSWORD 
)
 
 You probably should chmod go-rw the two files, and also chmod u+x the finksql
 script. If you don't know the value for "DBPASSWORD", ask the project admin.
 
 Now change into the PDB directory:
   cd /Volumes/src2/fink/pdb.finkproject.org/pdb/
+(or, on shell.sf.net: cd /home/groups/f/fi/fink/pdb )
 
 Refresh the list of packages (essentially this runs a 'cvs up'):
   ./refresh
@@ -78,5 +81,33 @@
 
 
---------------------------------------------------------------------------------
 
-This HOWTO was written by Max Horn, largely based on some instructions given
-by Christoph Pfisterer. Use at your own risk.
+Q: How to set-up the pdb directory for the first time?
+
+A: Do the following steps:
+1)
+Check out the 'scripts/pdb' module.
+2)
+Check out the module 'fink' as the folder 'basepath' [sic]
+3)
+Create the following files:
+- basepath_fink.inc: Add a line with the full path to the pdb script directory
+  E.g. '/Volumes/src2/fink/pdb.finkproject.org/pdb'
+  (or, on shell.sf.net: '/home/groups/f/fi/fink/pdb' )
+- htdocs_pdb.inc: Add a line with the full path to the pdb webpage directory
+  E.g. '/Volumes/src2/fink/pdb.finkproject.org/htdocs/pdb'
+  (or, on shell.sf.net: '/home/groups/f/fi/fink/htdocs/pdb' )
+4)
+Update the cvs directories and configure your local fink by doing:
+  ./update.sh
+5)
+Set up the database by doing:
+  ~/bin/finksql < schema.sql
+6) 
+Initialize tables with:
+  ~/bin/finksql < sections.sql
+  ~/bin/finksql < releases.sql
+
+---------------------------------------------------------------------------------
+
+The original content of this HOWTO was written by Max Horn, largely based on 
+some instructions given by Christoph Pfisterer. Use at your own risk.

--- fink.conf DELETED ---

Index: inject
===================================================================
RCS file: /cvsroot/fink/scripts/pdb/inject,v
retrieving revision 1.2
retrieving revision 1.2.2.1
diff -u -d -r1.2 -r1.2.2.1
--- inject      25 Oct 2005 00:52:20 -0000      1.2
+++ inject      27 Jan 2007 03:45:30 -0000      1.2.2.1
@@ -7,9 +7,18 @@
 echo "Calculating flags..."
 ./flag
 
-echo "Copying timestamp.inc..."
-if [ -d /Volumes/src2/fink/pdb.finkproject.org/htdocs/pdb ]; then
-  install -m 664 timestamp.inc 
/Volumes/src2/fink/pdb.finkproject.org/htdocs/pdb/
+if [ -f htdocs_pdb.inc ]; then
+  PDB_HTDOCS=`cat htdocs_pdb.inc`
+else
+  echo "'htdocs_pdb.inc' not found!"
+  exit 1
+fi
+echo "Copying timestamp.inc to $PDB_HTDOCS/..."
+if [ -d $PDB_HTDOCS/ ]; then
+  install -m 664 timestamp.inc $PDB_HTDOCS/
+else
+  echo "   Path $PDB_HTDOCS/ not found!"
+  exit 1
 fi
 
 exit 0

Index: update.sh
===================================================================
RCS file: /cvsroot/fink/scripts/pdb/update.sh,v
retrieving revision 1.8
retrieving revision 1.8.2.1
diff -u -d -r1.8 -r1.8.2.1
--- update.sh   16 Jun 2006 18:49:06 -0000      1.8
+++ update.sh   27 Jan 2007 03:45:30 -0000      1.8.2.1
@@ -2,15 +2,16 @@
 
 echo "Updating CVS..."
 cvs -q update -dPl
+echo "Updating CVS (basepath)..."
 cd basepath
 cvs -q update -dP
 cd ..
 
-echo "Fixing permissions"
+echo "Fixing permissions..."
 chgrp -R fink .
 chmod -f -R g+w,a+r .
 
-echo "Creating fink itself"
+echo "Creating fink itself..."
 cd basepath
 ./setup.sh $PWD/basepath
 cd ..

Index: pdb_full_update-unified
===================================================================
RCS file: /cvsroot/fink/scripts/pdb/pdb_full_update-unified,v
retrieving revision 1.3
retrieving revision 1.3.2.1
diff -u -d -r1.3 -r1.3.2.1
--- pdb_full_update-unified     1 May 2006 15:43:19 -0000       1.3
+++ pdb_full_update-unified     27 Jan 2007 03:45:30 -0000      1.3.2.1
@@ -1,5 +1,11 @@
 #!/bin/sh
-cd /Volumes/src2/fink/pdb.finkproject.org/pdb
+
+if [ -f htdocs_pdb.inc ]; then
+  PDB_HTDOCS=`cat htdocs_pdb.inc`
+else
+  echo "'htdocs_pdb.inc' not found!"
+  exit 1
+fi
 
 echo "Starting PDB update: `date`"
 ./refresh && ./inject
@@ -7,6 +13,8 @@
 echo "Fixing permissions"
 chgrp -R fink .
 chmod -f -R g+w,a+r .
-chgrp fink /Volumes/src2/fink/pdb.finkproject.org/htdocs/pdb/timestamp.inc
+chgrp fink $PDB_HTDOCS/timestamp.inc
 
 echo "Finished PDB update: `date`"
+
+exit 0


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Fink-commits mailing list
Fink-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/fink-commits

Reply via email to