From: mdw Date: Fri, 30 Jul 1999 18:48:17 +0000 (+0000) Subject: Tidy up the software index file. X-Git-Tag: 1.0.2~12 X-Git-Url: https://git.distorted.org.uk/~mdw/sw-tools/commitdiff_plain/0d60dade85e63da36c7f88f2b074d76b8d1ccfe8 Tidy up the software index file. --- diff --git a/perl/sw-tidy.1 b/perl/sw-tidy.1 new file mode 100644 index 0000000..0e0ebe6 --- /dev/null +++ b/perl/sw-tidy.1 @@ -0,0 +1,98 @@ +.\" -*-nroff-*- +.\" +.\" $Id: sw-tidy.1,v 1.1 1999/07/30 18:48:16 mdw Exp $ +.\" +.\" Manual page for `sw-tidy' +.\" +.\" (c) 1999 EBI +.\" +. +.\"----- Licensing notice --------------------------------------------------- +.\" +.\" This file is part of sw-tools. +.\" +.\" sw-tools 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 2 of the License, or +.\" (at your option) any later version. +.\" +.\" sw-tools 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 sw-tools; if not, write to the Free Software Foundation, +.\" Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +. +.\"----- Revision history --------------------------------------------------- +.\" +.\" $Log: sw-tidy.1,v $ +.\" Revision 1.1 1999/07/30 18:48:16 mdw +.\" Tidy up the software index file. +.\" +. +.ie \n(.g \{\ +. fam P +. ds mw \fR[\f(BImdw\fR] +.\} +.el .ds mw \fR[\fBmdw\fR] +.ds sw \fBsw\fP +. +.\"----- Main manual text --------------------------------------------------- +. +.TH sw-tidy 1 "30 July 1999" sw-tools +. +.\"-------------------------------------------------------------------------- +. +.SH NAME +. +sw-tidy \- tidy \fBsw\fP's index file +. +.\"-------------------------------------------------------------------------- +. +.SH "SYNOPSIS" +. +.B sw-tidy +. +.\"-------------------------------------------------------------------------- +. +.SH "DESCRIPTION" +. +The +.B sw-tidy +command reads +.BR sw (1)'s +index file +.IB prefix /sw-index +and writes out a new version with duplicate packages removed. This +makes it take less space, and lets programs read it faster. Also, as a +side-effect, the new version is written out in alphabetical order of +package-name, although that's not very important. +.PP +The program copes (a bit) if the index file is written to while it's +being tidied. +. +.\"-------------------------------------------------------------------------- +. +.SH "BUGS" +. +Perhaps there ought to be a locking convention for the index file. +However, it's nice that people can update it using +.BR cat (1) +and text editors. +. +.\"-------------------------------------------------------------------------- +. +.SH "SEE ALSO" +. +.BR sw (1), +.BR sw-info (5). +. +.SH "AUTHOR" +. +The \*(sw program, and this manual, are \*(mw productions, in association +with the European Bioinformatics Institute. They were written by Mark +Wooding . Go and ask him if you have problems. +. +.\"----- That's all, folks -------------------------------------------------- diff --git a/perl/sw-tidy.in b/perl/sw-tidy.in new file mode 100644 index 0000000..dac7fa5 --- /dev/null +++ b/perl/sw-tidy.in @@ -0,0 +1,52 @@ +#! @PERL@ +# -*-perl-*- +# +# $Id: sw-tidy.in,v 1.1 1999/07/30 18:48:17 mdw Exp $ +# +# Tidy the `sw' index file +# +# (c) 1999 EBI +# + +#----- Licensing notice ----------------------------------------------------- +# +# This file is part of sw-tools. +# +# sw-tools 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 2 of the License, or +# (at your option) any later version. +# +# sw-tools 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 sw-tools; if not, write to the Free Software Foundation, +# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#----- Revision history ----------------------------------------------------- +# +# $Log: sw-tidy.in,v $ +# Revision 1.1 1999/07/30 18:48:17 mdw +# Tidy up the software index file. +# + +use lib "@pkgdatadir@"; +use SWConfig; +use SW; + +($me = $0) =~ s:^.*/::; + +sub barf($) { + my ($err) = @_; + print STDERR "$me: $err\n"; + exit(1); +} + +$sw = SW->new(); +$sw->write() or barf("couldn't write new index file: $!"); +exit(0); + +#----- That's all, folks ----------------------------------------------------