Update of /cvsroot/fink/scripts/pdb
In directory sc8-pr-cvs17:/tmp/cvs-serv7006
Modified Files:
.cvsignore HOWTO drop.sql dump dumprelease inject
pdb_full_update-piecewise pdb_full_update-unified refresh
releases.sql schema.sql update.sh
Added Files:
fix_permissions.sh
Removed Files:
fink.conf flag
Log Message:
merged pdb redesign branch
Index: .cvsignore
===================================================================
RCS file: /cvsroot/fink/scripts/pdb/.cvsignore,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- .cvsignore 10 Apr 2007 17:31:48 -0000 1.5
+++ .cvsignore 27 Sep 2007 19:55:05 -0000 1.6
@@ -3,7 +3,6 @@
fink
basepath
*-stable.sql
-current.sql
-timestamp.inc
-db.inc.pl
-maintlist.txt
+current_pdb_dump.sql
+basepath_fink.inc
+htdocs_pdb.inc
Index: releases.sql
===================================================================
RCS file: /cvsroot/fink/scripts/pdb/releases.sql,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- releases.sql 12 Apr 2007 01:19:07 -0000 1.27
+++ releases.sql 27 Sep 2007 19:55:05 -0000 1.28
@@ -1,20 +1,42 @@
+delete from `distribution`;
delete from `release`;
-insert into `release` values ('current-10.2-gcc3.3-stable', 'Packages that are
in 10.2-gcc3.3/stable in CVS, updated daily.');
-insert into `release` values ('current-10.2-gcc3.3-unstable', 'Packages that
are in 10.2-gcc3.3/unstable in CVS, updated daily.');
-insert into `release` values ('current-10.3-stable', 'Packages that are in
10.3/stable in CVS, updated daily.');
-insert into `release` values ('current-10.3-unstable', 'Packages that are in
10.3/unstable in CVS, updated daily.');
-insert into `release` values ('current-10.4-powerpc-stable', 'Packages that
are in 10.4/stable in CVS for arch=powerpc, updated daily.');
-insert into `release` values ('current-10.4-powerpc-unstable-powerpc',
'Packages that are in 10.4/unstable in CVS for arch=powerpc, updated daily.');
-insert into `release` values ('current-10.4-i386-stable', 'Packages that are
in 10.4/stable in CVS for arch=i386, updated daily.');
-insert into `release` values ('current-10.4-i386-unstable', 'Packages that are
in 10.4/unstable in CVS for arch=i386, updated daily.');
+insert into `distribution` (dist_id, identifier, description, architecture,
priority, active, visible, unsupported) values (null, '10.1', '10.1',
'powerpc', 1, 0, 0, 1);
+select @last_dist_id := last_insert_id();
+insert into `release` (rel_id, dist_id, type, version, priority, active)
values (null, @last_dist_id, 'bindist', '0.4.1', 1, 0);
-insert into `release` values ('0.4.1-stable', 'Packages shipped with Fink
0.4.1 (For Mac OS X 10.1)');
-insert into `release` values ('0.5.2-stable', 'Packages shipped with Fink
0.5.3 (For Mac OS X 10.2)');
-insert into `release` values ('0.6.3-stable', 'Packages shipped with Fink
0.6.3 (For Mac OS X 10.2)');
-insert into `release` values ('0.6.4-stable', 'Packages shipped with Fink
0.6.4 (For Mac OS X 10.2)');
-insert into `release` values ('0.7.1-stable', 'Packages shipped with Fink
0.7.1 (For Mac OS X 10.3)');
-insert into `release` values ('0.7.2-stable', 'Packages shipped with Fink
0.7.2 (For Mac OS X 10.3)');
-insert into `release` values ('0.8.0-stable', 'Packages shipped with Fink
0.8.0 (For Mac OS X 10.4)');
-insert into `release` values ('0.8.1-powerpc-stable', 'Packages shipped with
Fink 0.8.1 (For Mac OS X 10.4/powerpc)');
-insert into `release` values ('0.8.1-i386-stable', 'Packages shipped with Fink
0.8.1 (For Mac OS X 10.4/intel)');
+insert into `distribution` (dist_id, identifier, description, architecture,
priority, active, visible, unsupported) values (null, '10.2-gcc3.3',
'10.2\n(gcc3.3 only)', 'powerpc', 2, 1, 1, 1);
+select @last_dist_id := last_insert_id();
+insert into `release` (rel_id, dist_id, type, version, priority, active)
values (null, @last_dist_id, 'unstable', 'current', 3, 1);
+insert into `release` (rel_id, dist_id, type, version, priority, active)
values (null, @last_dist_id, 'stable', 'current', 2, 1);
+insert into `release` (rel_id, dist_id, type, version, priority, active)
values (null, @last_dist_id, 'bindist', '0.6.4', 1, 1);
+
+insert into `distribution` (dist_id, identifier, description, architecture,
priority, active, visible, unsupported) values (null, '10.3', '10.3',
'powerpc', 3, 1, 1, 0);
+select @last_dist_id := last_insert_id();
+insert into `release` (rel_id, dist_id, type, version, priority, active)
values (null, @last_dist_id, 'unstable', 'current', 3, 1);
+insert into `release` (rel_id, dist_id, type, version, priority, active)
values (null, @last_dist_id, 'stable', 'current', 2, 1);
+insert into `release` (rel_id, dist_id, type, version, priority, active)
values (null, @last_dist_id, 'bindist', '0.7.2', 1, 1);
+
+insert into `distribution` (dist_id, identifier, description, architecture,
priority, active, visible, unsupported) values (null, '10.4', '10.4/powerpc',
'powerpc', 4, 1, 1, 0);
+select @last_dist_id := last_insert_id();
+insert into `release` (rel_id, dist_id, type, version, priority, active)
values (null, @last_dist_id, 'unstable', 'current', 3, 1);
+insert into `release` (rel_id, dist_id, type, version, priority, active)
values (null, @last_dist_id, 'stable', 'current', 2, 1);
+insert into `release` (rel_id, dist_id, type, version, priority, active)
values (null, @last_dist_id, 'bindist', '0.8.1', 1, 1);
+
+insert into `distribution` (dist_id, identifier, description, architecture,
priority, active, visible, unsupported) values (null, '10.4', '10.4/intel',
'i386', 5, 1, 1, 0);
+select @last_dist_id := last_insert_id();
+insert into `release` (rel_id, dist_id, type, version, priority, active)
values (null, @last_dist_id, 'unstable', 'current', 3, 1);
+insert into `release` (rel_id, dist_id, type, version, priority, active)
values (null, @last_dist_id, 'stable', 'current', 2, 1);
+insert into `release` (rel_id, dist_id, type, version, priority, active)
values (null, @last_dist_id, 'bindist', '0.8.1', 1, 1);
+
+insert into `distribution` (dist_id, identifier, description, architecture,
priority, active, visible, unsupported) values (null, '10.5', '10.5/powerpc',
'powerpc', 6, 1, 0, 0);
+select @last_dist_id := last_insert_id();
+insert into `release` (rel_id, dist_id, type, version, priority, active)
values (null, @last_dist_id, 'unstable', 'current', 3, 1);
+insert into `release` (rel_id, dist_id, type, version, priority, active)
values (null, @last_dist_id, 'stable', 'current', 2, 1);
+insert into `release` (rel_id, dist_id, type, version, priority, active)
values (null, @last_dist_id, 'bindist', '0.9.0', 1, 0);
+
+insert into `distribution` (dist_id, identifier, description, architecture,
priority, active, visible, unsupported) values (null, '10.5', '10.5/intel',
'i386', 7, 1, 0, 0);
+select @last_dist_id := last_insert_id();
+insert into `release` (rel_id, dist_id, type, version, priority, active)
values (null, @last_dist_id, 'unstable', 'current', 3, 1);
+insert into `release` (rel_id, dist_id, type, version, priority, active)
values (null, @last_dist_id, 'stable', 'current', 2, 1);
+insert into `release` (rel_id, dist_id, type, version, priority, active)
values (null, @last_dist_id, 'bindist', '0.9.0', 1, 0);
Index: dump
===================================================================
RCS file: /cvsroot/fink/scripts/pdb/dump,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -d -r1.33 -r1.34
--- dump 10 Apr 2007 17:31:48 -0000 1.33
+++ dump 27 Sep 2007 19:55:05 -0000 1.34
@@ -1,4 +1,5 @@
#!/usr/bin/perl -w
+# -*- mode: Perl; tab-width: 4; -*-
#
# dump - generate SQL for Fink's online package database
# Copyright (c) 2001 Christoph Pfisterer
@@ -30,61 +31,151 @@
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;
+# temporarily send stdout to stderr
+open(OLDOUT, ">&STDOUT");
+open(STDOUT, ">&STDERR") or die "Can't dup stderr";
+select(OLDOUT); select(STDOUT); # keep 'use strict' happy
+
### get parameters
-my ($distribution, $tree, $release, $architecture, $wanthelp);
+my ($distribution, $release, $architecture, $rel_id, $tree, $wanthelp, $q);
# process command-line
GetOptions(
- 'distribution=s' => \$distribution,
- 'tree=s' => \$tree,
- 'release=s' => \$release,
- 'architecture=s' => \$architecture,
+ 'distribution:s' => \$distribution,
+ 'release:s' => \$release,
+ 'architecture:s' => \$architecture,
+ 'rel_id:s' => \$rel_id,
'help' => \$wanthelp,
) or &die_with_usage;
&die_with_usage if $wanthelp;
-&die_with_usage unless defined $distribution && defined $tree && defined
$release;
-$architecture = 'powerpc' unless defined $architecture;
+&die_with_usage if (defined $distribution && not ($distribution =~
/^[0-9a-z.\-]{2,}$/));
+&die_with_usage if (defined $release && not ($release =~
m/^[0-9.]{3,}$|^unstable$|^stable$/));
+&die_with_usage if (defined $architecture && not ($architecture =~
m/^powerpc$|^i386$/));
+#$architecture = 'powerpc' unless defined $architecture;
-### read config
-my $config = &read_config("fink.conf");
+### connect to database
-### read package info
+if (not eval { require DBI }) {
+ print "\nWARNING: Unable to connect to DB (DBI Perl module not found!)\n\n";
+ if ((not defined $rel_id) || (not $rel_id =~ m/^[0-9]+$/)) {
+ die("Call with '--rel_id=...' to specify the corresponing release id.
Stopped");
+ }
+ $tree = $release if (defined $release);
+ $tree = 'stable' if (defined $tree && $release =~ m/^[0-9.]{3,}$/);
+} else {
-# temporarily send stdout to stderr
-open(OLDOUT, ">&STDOUT");
-open(STDOUT, ">&STDERR") or die "Can't dup stderr";
-select(OLDOUT); select(STDOUT); # keep 'use strict' happy
+### Try to connect to DB
+
+my ($dbh, $sth, $rel, $mysql_datafile, $mysql_data);
+$mysql_datafile = "./.finkdbi";
+if (not -f $mysql_datafile) {
+ $mysql_datafile = $ENV{HOME}."/.finkdbi";
+}
+chomp($mysql_data = `cat $mysql_datafile`);
+$dbh = DBI->connect(split(/\|/, $mysql_data));
+
+### get distributions/releases
+
+$q = "SELECT r.*,d.* FROM `distribution` d ";
+$q .= "INNER JOIN `release` r ON r.dist_id = d.dist_id ";
+$q .= "WHERE d.active AND r.active ";
+if (defined $distribution) {
+ $q .= "AND d.identifier='$distribution' ";
+}
+if (defined $release) {
+ if ($release =~ m/^unstable$|^stable$/) {
+ $q .= "AND r.type='$release' ";
+ } else {
+ $q .= "AND r.version='$release' ";
+ }
+}
+if (defined $architecture) {
+ $q .= "AND d.architecture='$architecture' ";
+}
+$q .= "ORDER BY d.priority DESC,r.priority DESC;";
+
+$dbh->do($q);
+$sth = $dbh->prepare($q);
+$sth->execute();
+my $numRows = $sth->rows;
+if ($numRows < 1) {
+ print "No matching releases found!\n";
+} else {
+ if ($numRows > 1) {
+ print "Found more than one release (sorted by priority):\n";
+ } else {
+ print "# Dumping packages for release:\n";
+ }
+ printf "# %3s %12s %8s %8s %8s\n", 'id', 'identifier', 'arch', 'type',
'version';
+ while ($rel = $sth->fetchrow_hashref()) {
+ printf "# %3s %12s %8s %8s %8s\n", "$rel->{'rel_id'}",
"$rel->{'identifier'}", "$rel->{'architecture'}", "$rel->{'type'}",
"$rel->{'version'}";
+ # Set all values, even if not given on command line
+ $rel_id = $rel->{'rel_id'};
+ $distribution = $rel->{'identifier'};
+ $architecture = $rel->{'architecture'};
+ if ($rel->{'type'} eq 'bindist') {
+ $tree = 'stable';
+ } else {
+ $tree = $rel->{'type'};
+ }
+ }
+ printf "\n";
+}
+
+$sth->finish();
+
+$dbh->disconnect();
+
+&die_with_usage if ($numRows != 1); # nothing to do
+
+} # if (eval { require DBI })
+
+
+&die_with_usage if (not defined $distribution);
+&die_with_usage if (not defined $release);
+&die_with_usage if (not defined $architecture);
+
+
+### set up our fink
+
+open (BASEPATH, "basepath_fink.inc") || die "couldn't open
'basepath_fink.inc'!";
+my $basepath = <BASEPATH>;
+close(BASEPATH);
+chomp $basepath;
# if possible, use a symlink $distribution-$tree -> $tree
# so that each .info pathname is unique across all distributions
# (since we may use the dists/ symlink not the actual $distribution dir)
-my $treelink = $config->{'basepath'} . "/fink/dists/$distribution-$tree";
+my $treelink = "$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");
-if (defined $architecture) {
- $config->set_param("Architecture", $architecture);
- $config->set_param("Debarch", "darwin-$architecture");
-}
-# "Trees" and "Architecture"/"Debarch" are volatile changes vs fink.conf:
-# we don't (and mustn't) call save()
+# simulate a fink.conf; there's no actual file, so don't save() it
+my $config = Fink::Config->new_from_properties({
+ 'basepath' => $basepath,
+ 'trees' => "$disttree/main $disttree/crypto",
+ 'distribution' => $distribution,
+ 'architecture' => $architecture,
+});
# 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();
@@ -92,18 +183,19 @@
# restore stdout
open(STDOUT, ">&OLDOUT");
-### drop the previous data
+### first drop the previous data, then add packages again, doing one
+### release at a time, in one transaction
+print "# Begin dump release id = $rel_id\n";
+print "START TRANSACTION;\n";
print "# delete old rows\n";
-print "BEGIN;\n";
-print "DELETE FROM package WHERE \`release\`='$release';\n";
-print "DELETE FROM splitoffs WHERE \`parentkey\` REGEXP '^$release';\n";
+print "DELETE FROM `package` WHERE rel_id='$rel_id';\n";
### loop over packages
my ($package, $po, $version, $vo);
-my ($maintainer, $email, $desc, $parent);
-my ($q, $v, $s, $key, $parentkey, %data, %splitoffdata);
+my ($maintainer, $email, $desc, $usage, $parent, $infofile, $infofilechanged);
+my ($v, $s, $key, %data, $expand_override);
foreach $package (Fink::Package->list_packages()) {
$po = Fink::Package->package_by_name($package);
@@ -114,27 +206,55 @@
# 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 if defined $treelink;
+ my $dist_dir = readlink($config->{'basepath'} . "/fink/dists");
+ $infofile = "fink/dists/$dist_dir/$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);
+ # Always show %p as '/sw'
+ $expand_override->{'p'} = '/sw';
+
+ $desc = $vo->param_default_expanded('DescDetail', '',
+ expand_override => $expand_override,
+ err_action => 'ignore'
+ );
+ 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(),
+ $usage = $vo->param_default_expanded('DescUsage', '',
+ expand_override => $expand_override,
+ err_action => 'ignore'
+ );
+ chomp $usage;
+ $usage =~ s/\s+$//s;
+ $usage =~ s/\n/\\n/g;
+
+ %data = (
+ 'pkg_id' => 'null', # autoincrement
+ 'rel_id' => $rel_id,
'name' => $vo->get_name(),
'version' => $vo->get_version(),
'revision' => $vo->get_revision(),
'epoch' => $vo->get_epoch(),
'descshort' => $vo->get_shortdescription(),
'desclong' => $desc,
+ 'descusage' => $usage,
'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
@@ -143,7 +263,7 @@
}
# generate SQL query
- $q = "INSERT INTO package (";
+ $q = "INSERT INTO `package` (";
$v = ") VALUES (";
foreach $key (keys %data) {
$q .= "\`$key\`,";
@@ -155,50 +275,33 @@
# write it
print "# $package-$version\n";
print "$q\n";
-
- if ($vo->has_parent()) {
- %splitoffdata = ('name' => $vo->get_name(),
- 'parentkey' => $release .
$data{"parentname"},
- 'descshort' =>
$vo->get_shortdescription()
- );
-
- # generate SQL query
- $q = "INSERT INTO splitoffs (";
- $v = ") VALUES (";
- foreach $key (keys %splitoffdata) {
- $q .= "$key,";
- $s = $splitoffdata{$key};
- $s =~ s/'/\\'/g;
- $v .= "'$s',";
- }
- $q = substr($q,0,-1).substr($v,0,-1).");";
- print "$q\n";
- }
}
-
print "COMMIT;\n";
-print "OPTIMIZE TABLE package;\n";
-
-### make timestamp
-
-open(OUT,">timestamp.inc") or die "can't write timestamp.inc: $!\n";
-print OUT "<?\n\$dyndate = ".time().";\n?>";
-close(OUT) or die "can't write timestamp.inc: $!\n";
+print "OPTIMIZE TABLE `package`;\n";
+print "# End dump release id = $rel_id\n";
if (defined $treelink) {
rm_f $treelink or print "Could not remove $treelink\n";
}
+
+
+
+
sub die_with_usage {
die <<EOMSG;
Usage: $0 [options]
Options:
--distribution
- --tree
--release
--architecture
--help
+
+'distribution' is the distribution identifier (e.g. '10.4' or '10.2-gcc3.3')
+'release' is either a release version (e.g. 0.6.4) for bindists or the strings
+ 'unstable' or 'stable'
+'architecture' is either 'powerpc' or 'i386'
EOMSG
}
@@ -206,3 +309,4 @@
exit 0;
+# vim: ts=4 sw=4 noet
Index: schema.sql
===================================================================
RCS file: /cvsroot/fink/scripts/pdb/schema.sql,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- schema.sql 12 Apr 2007 01:19:07 -0000 1.9
+++ schema.sql 27 Sep 2007 19:55:05 -0000 1.10
@@ -1,42 +1,50 @@
-create table `release` (
- name varchar(50) not null,
- description text,
- primary key (name)
-);
-
-create table sections (
+create table if not exists `sections` (
name varchar(32) not null,
description text,
primary key (name)
-);
+) engine = innodb collate ascii_general_ci;
-create table splitoffs (
- name varchar(64) not null,
- parentkey varchar(84) not null,
- descshort varchar(80) not null default '',
- primary key(parentkey, name)
-);
+create table if not exists `distribution` (
+ dist_id int unsigned not null auto_increment,
+ identifier varchar(16) not null,
+ description varchar(64) not null default '',
+ architecture enum('powerpc', 'i386') not null default 'powerpc',
+ priority tinyint unsigned not null default '1',
+ active boolean default 1,
+ visible boolean default 1,
+ unsupported boolean default 0,
+ primary key (dist_id)
+) engine = innodb collate ascii_general_ci;
-create table package (
- `release` varchar(50) not null,
- fullname varchar(128) not null,
+create table if not exists `release` (
+ rel_id int unsigned not null auto_increment,
+ dist_id int unsigned not null references `distribution(dist_id)`,
+ type enum('bindist', 'stable', 'unstable') not null,
+ version varchar(16) not null,
+ priority tinyint unsigned not null default '1',
+ active boolean default 1,
+ primary key (rel_id)
+) engine = innodb collate ascii_general_ci;
+
+create table if not exists `package` (
+ pkg_id int unsigned not null auto_increment,
+ rel_id int unsigned not null references `release(rel_id)`,
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,
+ descusage text,
maintainer varchar(255),
- homepage varchar(255),
license varchar(64),
- latest tinyint not null default '0',
- needtest tinyint not null default '0',
- primary key (`release`,name),
+ homepage varchar(255),
+ section varchar(32) not null,
+ infofile varchar(255) not null default '',
+ infofilechanged datetime,
+ primary key (pkg_id),
index (name),
index (section),
- index (latest),
- index (needtest)
-);
-
+ index (rel_id)
+) engine = innodb collate ascii_general_ci;
Index: pdb_full_update-piecewise
===================================================================
RCS file: /cvsroot/fink/scripts/pdb/pdb_full_update-piecewise,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- pdb_full_update-piecewise 10 Apr 2007 17:31:48 -0000 1.8
+++ pdb_full_update-piecewise 27 Sep 2007 19:55:05 -0000 1.9
@@ -1,28 +1,21 @@
#!/bin/sh
-cd /opt/pdb
+set -e
echo "Starting PDB update: `date`"
-for dist in 10.2-gcc3.3 10.3 10.4; do
- ./refresh $dist
- ./finksql <current.sql
+for dist in 10.2-gcc3.3 10.3 10.4 10.5; do
+ ./refresh $dist && ./inject
done
-echo "" > current.sql && ./inject
-
-echo "Fixing permissions"
-chgrp -R fink_web .
-chmod -f -R g+w,a+r .
-chgrp fink_web /var/www/www.finkproject.org/pdb/timestamp.inc
-
-echo "Exporting maintainer data"
-maintfile="maintlist.txt"
-echo "select name,maintainer from package where latest=1;" | ./finksql >
$maintfile-$$.tmp
-mv $maintfile-$$.tmp $maintfile
-chgrp fink_web $maintfile
-chmod 664 $maintfile
+./fix_permissions.sh
echo "Refreshing section list"
-./finksql <sections.sql
+if [ -f finksql ]; then
+ ./finksql < sections.sql
+else
+ $HOME/bin/finksql < sections.sql
+fi
echo "Finished PDB update: `date`"
+
+exit 0
Index: HOWTO
===================================================================
RCS file: /cvsroot/fink/scripts/pdb/HOWTO,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- HOWTO 16 Jun 2006 17:33:02 -0000 1.10
+++ HOWTO 27 Sep 2007 19:55:05 -0000 1.11
@@ -1,25 +1,100 @@
+This HOWTO first explains the files in the scripts/pdb directory and then
+describes common tasks involving pdb updating.
+
+---------------------------------------------------------------------------------
+
+Files and directories in scripts/pdb:
+
+HOWTO:
+ This howto document
+basepath:
+ Directory containing the Fink package description files. This is a cvs
+ checkout of the 'fink' module but might be overwritten by rsync on the pdb
+ server when refreshing the pdb (see below for details)
+basepath_fink.inc:
+ Config file with the path to the pdb script files (the current dir)
+current_pdb_dump.sql:
+ SQL statements produced by the dump script containing the current contents of
+ the pdb.
+drop.sql:
+ SQL statements to drop all pdb tables in the db. Only needed to restart from
+ scratch.
+dump:
+ Shell script to dump the package descriptions. Used by the dumprelease and
refresh
+ scripts.
+dumprelease:
+ Shell script to dump the package description of a Fink released (defined by
+ a CVS tag). See below for a description on how to use it.
+fink:
+ A directory containing the Fink tree with the package description files. This
+ will be updated by the refresh and dumprelease scripts
+.finkdbi:
+ Config file with the information on how to connect to the database via perl
+ (Could alternatively be located in ~/.finkdbi)
+finksql:
+ Shell script to connect to the database via the shell
+fix_permissions.sh:
+ Shell script to set the file permissions
+inject:
+ Shell script to inject the sql statements in current_pdb_dump.sql into the db
+pdb_full_update-piecewise:
+ Shell script to update the pdb (calling the refresh and inject scripts)
+ distribution after distribution (10.2-gcc3.3 10.3 10.4 10.5)
+ This script is called every 8 hours on finch using the follwoing cron line:
+ 20 1,9,17 * * * root nice /opt/pdb/pdb_full_update-piecewise 2>&1 | \
+ mail -s "Web-PDB Update `date`" [EMAIL PROTECTED]
+pdb_full_update-unified:
+ Shell script to update the pdb (calling the refresh and inject scripts)
+ all in one step
+refresh:
+ Shell script to refresh the package descriptions und dump them into
+ current_pdb_dump.sql. refresh is called by the pdb_full_update-* scripts
+releases.sql:
+ SQL statements containing the information about current supported releases.
+ Needs to be updated whenever a release is added or no longer supported. See
+ below on how to use it.
+*-stable.sql:
+ SQL statements containing the package information about Fink releases.
Created
+ by the dumprelease script.
+schema.sql:
+ SQL statements containing the database schema of the pdb. See below on how
to
+ use it.
+sections.sql:
+ SQL statements containing the information about the package sections. Needs
to
+ be udpated whenever a new section is added. Called by the pdb_full_update-*
+ scripts.
+update.sh:
+ Shell script to update the cvs directories and configure the local fink. See
+ below for more information.
+
+
+---------------------------------------------------------------------------------
+
Q: How do I update the package database?
A: You normally should never have to do this since we have a cron script in
place that performs that job every 8 hours for us. But if for some reasons it
is necessary to perform such an update right on the spot, proceed as follows.
-First log into the opendarwin.org server:
- ssh [EMAIL PROTECTED]
+First log into the finkproject.org server:
+ ssh [EMAIL PROTECTED]
The first time you are doing this, you have to create two auxiliary files:
-~/bin/finksql:
+~/bin/finksql (or ./finksql if there is no home folder):
#!/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:
+~/.finkdbi (or ./.finkdbi if there is no home folder):
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/
+ cd /opt/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
@@ -36,13 +111,13 @@
A: Assuming you just released fink 0.4.5, you'll want to adjust the package
database accordingly.
-First log into the opendarwin.org server:
- ssh [EMAIL PROTECTED]
+First log into the finkproject.org server:
+ ssh [EMAIL PROTECTED]
We assume that you setup the necessary auxiliary files already, if not read
the above Q&A for information on how to do it.
Now change into the PDB directory:
- cd /Volumes/src2/fink/pdb.finkproject.org/pdb/
+ cd /opt/pdb/
Next dump the list of packages in the release. Replace 0.8.1 as appropriate,
replace '10.4' with the Fink tree you want to count as stable, and replace
@@ -50,9 +125,15 @@
./dumprelease 0.8.1 10.4 i386
+(Or:
+ ./dumprelease 0.8.1 10.4 powerpc
+ ./dumprelease 0.7.2 10.3 powerpc
+ ./dumprelease 0.6.4 10.2-gcc3.3 powerpc
+)
+
This will produce a file called 0.8.1-i386-stable.sql. Next, you must update
the
-releases.sql file for 0.8.1 (just replace the current version with the new
-one). You best do that in CVS using a developer checkout on your local machine,
+releases.sql file for 0.8.1.
+You best do that in CVS using a developer checkout on your local machine,
then check the change in, and run "cvs up" on the shell server.
Once you did this, run these commands (order is important):
~/bin/finksql < releases.sql
@@ -61,22 +142,40 @@
(If you have released 0.8.1 for multiple architectures, you can add a
command to this list such as ~/bin/finksql < 0.8.1-powerpc-stable.sql .)
-Now run the "flag" script:
- ./flag
+That's it.
-Finally, you have to tell the PHP script which renders the package description
-pages to display the information from 0.8.1 along with the current data. To do
-so, edit "pdb/releases.inc" in the "web" CVS module.
+---------------------------------------------------------------------------------
-(NOTE: prior to 0.8.1, the architecture was not included in the .sql file
-name or the release string. The current pdb/releases.inc file accounts
-for this correctly, but if the .sql files for earlier releases are ever
-rebuilt, either it will have to be modified or an earlier version of the
-dumprelease script should be used.)
+Q: How to set-up the pdb directory for the first time?
-That's it.
+A: Do the following steps:
+1)
+Check out the 'scripts/pdb' module.
+ cvs -d:pserver:[EMAIL PROTECTED]:/cvsroot/fink login
+ cvs -z3 -d:pserver:[EMAIL PROTECTED]:/cvsroot/fink co -P scripts/pdb
+2)
+Check out the module 'fink' as the folder 'basepath' [sic] inside the just
+checked out dir 'pdb'
+ cd scripts/pdb
+ cvs -z3 -d:pserver:[EMAIL PROTECTED]:/cvsroot/fink co -P -d basepath fink
+3)
+Create the following file:
+- basepath_fink.inc: Add a line with the full path to the pdb script directory
+ E.g. '/opt/pdb'
+ (or, on shell.sf.net: '/home/groups/f/fi/fink/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
+(Use '~/bin/finksql < dump.sql' to clean out the db first)
+6)
+Initialize tables with:
+ ~/bin/finksql < sections.sql
+ ~/bin/finksql < releases.sql
---------------------------------------------------------------------------------
-This HOWTO was written by Max Horn, largely based on some instructions given
-by Christoph Pfisterer. Use at your own risk.
+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.
Index: refresh
===================================================================
RCS file: /cvsroot/fink/scripts/pdb/refresh,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- refresh 10 Apr 2007 17:31:48 -0000 1.19
+++ refresh 27 Sep 2007 19:55:05 -0000 1.20
@@ -5,40 +5,60 @@
if [ $# -gt 0 ]; then
dists=($@)
else
- dists=(10.2-gcc3.3 10.3 10.4)
+ dists=(10.2-gcc3.3 10.3 10.4 10.5)
fi
-#echo "Updating from CVS..."
-#if [ -d fink ]; then
-# cd fink
-# cvs -z3 -q update -Al
-# cvs -z3 -q update -Ad [EMAIL PROTECTED]
-# cd ..
-#else
-# cvs -z3 -d:pserver:[EMAIL PROTECTED]:/cvsroot/fink co -d fink dists
-#fi
-rsync --delete -avr /var/www/finkinfo/dists.public/ fink/
+for dist in [EMAIL PROTECTED]; do
+ # 10.5 uses the 10.4 dir
+ if [ $dist = "10.5" ]; then
+ dists_dir=( "[EMAIL PROTECTED]" "10.4" )
+ else
+ dists_dir=( "[EMAIL PROTECTED]" $dist )
+ fi
+done
+
+echo ""
+if [ -d fink ] && [ -d /var/www/finkinfo/dists.public ]; then
+ echo "Updating fink/ via local rsync..."
+ rsync --delete -avr /var/www/finkinfo/dists.public/ fink/
+else
+ if [ -d fink/CVS ]; then
+ echo "Updating [EMAIL PROTECTED] from CVS..."
+ cd fink
+ cvs -z3 -q update -Al
+ cvs -z3 -q update -Ad [EMAIL PROTECTED]
+ cd ..
+ else
+ echo "Checking out [EMAIL PROTECTED] from CVS..."
+ cvs -z3 -d:pserver:[EMAIL PROTECTED]:/cvsroot/fink co -d fink dists
+ fi
+fi
# flush the previous dump
-echo -n "" > current.sql
+echo -n "" > current_pdb_dump.sql
# Dump each supported source tree of the dists
+dist_no=0
for dist in [EMAIL PROTECTED]; do
rm -f fink/dists var/db/fink.db
- ln -s $dist fink/dists
-
- for tree in stable unstable; do
echo ""
- if [ $dist = "10.4" ]; then
+ echo "Linking 'fink/dists' to '${dists_dir[$dist_no]}'..."
+ echo ""
+ ln -s ${dists_dir[$dist_no]} fink/dists
+ for release in stable unstable; do
+ if [ $dist = "10.4" ] || [ $dist = "10.5" ]; then
for arch in powerpc i386; do
- echo "Dumping $dist/$tree $arch..."
- ./dump --distribution=$dist --tree=$tree --architecture=$arch
--release=current-$dist-$arch-$tree >> current.sql
+ echo ""
+ echo "Dumping $dist/$release $arch..."
+ ./dump --distribution=$dist --release=$release --architecture=$arch
>> current_pdb_dump.sql
done
else
- echo "Dumping $dist/$tree..."
- ./dump --distribution=$dist --tree=$tree --architecture=powerpc
--release=current-$dist-$tree >> current.sql
+ echo ""
+ echo "Dumping $dist/$release..."
+ ./dump --distribution=$dist --release=$release
--architecture=powerpc >> current_pdb_dump.sql
fi
done
+ dist_no=`expr $dist_no + 1`
done
echo ""
--- fink.conf DELETED ---
--- NEW FILE: fix_permissions.sh ---
#!/bin/sh
set -e
echo "Fixing permissions..."
chgrp -R fink_web .
chmod -f -R g+w,a+r .
if [ -f .finkdbi ]; then
chmod -f go-rw .finkdbi
fi
if [ -f finksql ]; then
chmod -f go-rw finksql
chmod u+x finksql
fi
exit 0
--- flag DELETED ---
Index: dumprelease
===================================================================
RCS file: /cvsroot/fink/scripts/pdb/dumprelease,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- dumprelease 16 Jun 2006 14:46:38 -0000 1.7
+++ dumprelease 27 Sep 2007 19:55:05 -0000 1.8
@@ -2,22 +2,28 @@
set -e
release=$1
-tree=$2
+dist=$2
architecture=$3
tag=release_`echo $release | sed 's/\./_/g'`
-echo "Updating from CVS..."
+if [ -d fink ] && [ ! -d fink/CVS ]; then
+ echo "Removing fink/ (no CVS dir found)..."
+ rm -r fink
+fi
if [ ! -d fink ]; then
+ echo "Checking out fink/ from CVS..."
cvs -z3 -d:pserver:[EMAIL PROTECTED]:/cvsroot/fink co -d fink dists
fi
cd fink
+echo "Updating from CVS (Tag $tag)..."
cvs -z3 -q update -r $tag
cd ..
+echo "Linking fink/dists to $dist..."
rm -f fink/dists var/db/fink.db
-ln -s $tree fink/dists
+ln -s $dist fink/dists
-# As of 0.6.3 / 0.7.0.. you need to specify the tree you want 'stable' to be.
+# As of 0.6.3 / 0.7.0.. you need to specify the dist you want 'stable' to be.
# That is, './dumprelease 0.6.3 10.2-gcc3.3' and './dumprelease 0.7.0 10.3'
# This may be temporary till we find a better solution.
@@ -25,8 +31,13 @@
# or powerpc), and the output filename will contain the architecture string.
# That is, './dumprelease 0.8.1 10.4 i386' will produce
# $release-$architecture-stable.sql
-echo "Dumping $tree/stable to $release-$architecture-stable.sql..."
-./dump --distribution=$tree --tree=stable
--release=$release-$architecture-stable --architecture=$architecture
>$release-$architecture-stable.sql
+if [ -z "$architecture" ]; then
+ echo "Dumping $dist/stable to $release-stable.sql..."
+ ./dump --distribution=$dist --release=$release --architecture=powerpc
>$release-stable.sql
+else
+ echo "Dumping $dist/stable to $release-$architecture-stable.sql..."
+ ./dump --distribution=$dist --release=$release --architecture=$architecture
>$release-$architecture-stable.sql
+fi
if [ -f var/db/fink.db ]; then
rm var/db/fink.db
fi
Index: inject
===================================================================
RCS file: /cvsroot/fink/scripts/pdb/inject,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- inject 10 Apr 2007 17:31:48 -0000 1.3
+++ inject 27 Sep 2007 19:55:05 -0000 1.4
@@ -1,15 +1,12 @@
#!/bin/sh
set -e
-echo "Executing current.sql..."
-./finksql <current.sql
-
-echo "Calculating flags..."
-./flag
+echo "Executing current_pdb_dump.sql..."
-echo "Copying timestamp.inc..."
-if [ -d /var/www/www.finkproject.org/pdb ]; then
- install -m 664 timestamp.inc /var/www/www.finkproject.org/pdb/
+if [ -f finksql ]; then
+ ./finksql < current_pdb_dump.sql
+else
+ $HOME/bin/finksql < current_pdb_dump.sql
fi
exit 0
Index: drop.sql
===================================================================
RCS file: /cvsroot/fink/scripts/pdb/drop.sql,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- drop.sql 12 Apr 2007 01:19:07 -0000 1.4
+++ drop.sql 27 Sep 2007 19:55:05 -0000 1.5
@@ -1,4 +1,7 @@
-drop table package;
-drop table `release`;
-drop table sections;
-drop table splitoffs;
+drop table if exists `distribution`;
+drop table if exists `distribution_releases`;
+drop table if exists `package`;
+drop table if exists `sections`;
+drop table if exists `splitoffs`;
+drop table if exists `latest_pkg`;
+drop table if exists `release`;
Index: update.sh
===================================================================
RCS file: /cvsroot/fink/scripts/pdb/update.sh,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- update.sh 10 Apr 2007 17:31:48 -0000 1.9
+++ update.sh 27 Sep 2007 19:55:05 -0000 1.10
@@ -1,16 +1,16 @@
#!/bin/sh
+set -e
echo "Updating CVS..."
cvs -q update -dPl
+echo "Updating CVS (basepath)..."
cd basepath
cvs -q update -dP
cd ..
-echo "Fixing permissions"
-chgrp -R fink_web .
-chmod -f -R g+w,a+r .
+./fix_permissions.sh
-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.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- pdb_full_update-unified 10 Apr 2007 17:31:48 -0000 1.4
+++ pdb_full_update-unified 27 Sep 2007 19:55:05 -0000 1.5
@@ -1,12 +1,19 @@
#!/bin/sh
-cd /opt/pdb
+set -e
echo "Starting PDB update: `date`"
+
./refresh && ./inject
-echo "Fixing permissions"
-chgrp -R fink_web .
-chmod -f -R g+w,a+r .
-chgrp fink_web /var/www/www.finkproject.org/pdb/timestamp.inc
+./fix_permissions.sh
+
+echo "Refreshing section list"
+if [ -f finksql ]; then
+ ./finksql < sections.sql
+else
+ $HOME/bin/finksql < sections.sql
+fi
echo "Finished PDB update: `date`"
+
+exit 0
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Fink-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fink-commits