mirror of https://github.com/fspc/dswim
freesource
24 years ago
commit
26c15dd62f
87 changed files with 34128 additions and 0 deletions
@ -0,0 +1,28 @@ |
|||||
|
# CVS default ignores begin |
||||
|
tags |
||||
|
TAGS |
||||
|
.make.state |
||||
|
.nse_depinfo |
||||
|
*~ |
||||
|
#* |
||||
|
.#* |
||||
|
,* |
||||
|
_$* |
||||
|
*$ |
||||
|
*.old |
||||
|
*.bak |
||||
|
*.BAK |
||||
|
*.orig |
||||
|
*.rej |
||||
|
.del-* |
||||
|
*.a |
||||
|
*.olb |
||||
|
*.o |
||||
|
*.obj |
||||
|
*.so |
||||
|
*.exe |
||||
|
*.Z |
||||
|
*.elc |
||||
|
*.ln |
||||
|
core |
||||
|
# CVS default ignores end |
@ -0,0 +1,8 @@ |
|||||
|
* Permissions of some directories are weird using mkdir(). |
||||
|
* ftp()/qftp() doesn't handle timeout problems very well, if alarm() |
||||
|
and SIG{ALRM} are used program quits with stdout "Alarm Bell". |
||||
|
* Debian md5sum program has different output than non-Debian md5sum |
||||
|
programs, will probably switch to MD5 module. |
||||
|
* --ftp, swimz.list, for non-US using the dists/arch/ notation doesn't |
||||
|
work on all sites, normal notation works if the site is set-up |
||||
|
this way. |
@ -0,0 +1,340 @@ |
|||||
|
GNU GENERAL PUBLIC LICENSE |
||||
|
Version 2, June 1991 |
||||
|
|
||||
|
Copyright (C) 1989, 1991 Free Software Foundation, Inc. |
||||
|
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
||||
|
Everyone is permitted to copy and distribute verbatim copies |
||||
|
of this license document, but changing it is not allowed. |
||||
|
|
||||
|
Preamble |
||||
|
|
||||
|
The licenses for most software are designed to take away your |
||||
|
freedom to share and change it. By contrast, the GNU General Public |
||||
|
License is intended to guarantee your freedom to share and change free |
||||
|
software--to make sure the software is free for all its users. This |
||||
|
General Public License applies to most of the Free Software |
||||
|
Foundation's software and to any other program whose authors commit to |
||||
|
using it. (Some other Free Software Foundation software is covered by |
||||
|
the GNU Library General Public License instead.) You can apply it to |
||||
|
your programs, too. |
||||
|
|
||||
|
When we speak of free software, we are referring to freedom, not |
||||
|
price. Our General Public Licenses are designed to make sure that you |
||||
|
have the freedom to distribute copies of free software (and charge for |
||||
|
this service if you wish), that you receive source code or can get it |
||||
|
if you want it, that you can change the software or use pieces of it |
||||
|
in new free programs; and that you know you can do these things. |
||||
|
|
||||
|
To protect your rights, we need to make restrictions that forbid |
||||
|
anyone to deny you these rights or to ask you to surrender the rights. |
||||
|
These restrictions translate to certain responsibilities for you if you |
||||
|
distribute copies of the software, or if you modify it. |
||||
|
|
||||
|
For example, if you distribute copies of such a program, whether |
||||
|
gratis or for a fee, you must give the recipients all the rights that |
||||
|
you have. You must make sure that they, too, receive or can get the |
||||
|
source code. And you must show them these terms so they know their |
||||
|
rights. |
||||
|
|
||||
|
We protect your rights with two steps: (1) copyright the software, and |
||||
|
(2) offer you this license which gives you legal permission to copy, |
||||
|
distribute and/or modify the software. |
||||
|
|
||||
|
Also, for each author's protection and ours, we want to make certain |
||||
|
that everyone understands that there is no warranty for this free |
||||
|
software. If the software is modified by someone else and passed on, we |
||||
|
want its recipients to know that what they have is not the original, so |
||||
|
that any problems introduced by others will not reflect on the original |
||||
|
authors' reputations. |
||||
|
|
||||
|
Finally, any free program is threatened constantly by software |
||||
|
patents. We wish to avoid the danger that redistributors of a free |
||||
|
program will individually obtain patent licenses, in effect making the |
||||
|
program proprietary. To prevent this, we have made it clear that any |
||||
|
patent must be licensed for everyone's free use or not licensed at all. |
||||
|
|
||||
|
The precise terms and conditions for copying, distribution and |
||||
|
modification follow. |
||||
|
|
||||
|
GNU GENERAL PUBLIC LICENSE |
||||
|
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION |
||||
|
|
||||
|
0. This License applies to any program or other work which contains |
||||
|
a notice placed by the copyright holder saying it may be distributed |
||||
|
under the terms of this General Public License. The "Program", below, |
||||
|
refers to any such program or work, and a "work based on the Program" |
||||
|
means either the Program or any derivative work under copyright law: |
||||
|
that is to say, a work containing the Program or a portion of it, |
||||
|
either verbatim or with modifications and/or translated into another |
||||
|
language. (Hereinafter, translation is included without limitation in |
||||
|
the term "modification".) Each licensee is addressed as "you". |
||||
|
|
||||
|
Activities other than copying, distribution and modification are not |
||||
|
covered by this License; they are outside its scope. The act of |
||||
|
running the Program is not restricted, and the output from the Program |
||||
|
is covered only if its contents constitute a work based on the |
||||
|
Program (independent of having been made by running the Program). |
||||
|
Whether that is true depends on what the Program does. |
||||
|
|
||||
|
1. You may copy and distribute verbatim copies of the Program's |
||||
|
source code as you receive it, in any medium, provided that you |
||||
|
conspicuously and appropriately publish on each copy an appropriate |
||||
|
copyright notice and disclaimer of warranty; keep intact all the |
||||
|
notices that refer to this License and to the absence of any warranty; |
||||
|
and give any other recipients of the Program a copy of this License |
||||
|
along with the Program. |
||||
|
|
||||
|
You may charge a fee for the physical act of transferring a copy, and |
||||
|
you may at your option offer warranty protection in exchange for a fee. |
||||
|
|
||||
|
2. You may modify your copy or copies of the Program or any portion |
||||
|
of it, thus forming a work based on the Program, and copy and |
||||
|
distribute such modifications or work under the terms of Section 1 |
||||
|
above, provided that you also meet all of these conditions: |
||||
|
|
||||
|
a) You must cause the modified files to carry prominent notices |
||||
|
stating that you changed the files and the date of any change. |
||||
|
|
||||
|
b) You must cause any work that you distribute or publish, that in |
||||
|
whole or in part contains or is derived from the Program or any |
||||
|
part thereof, to be licensed as a whole at no charge to all third |
||||
|
parties under the terms of this License. |
||||
|
|
||||
|
c) If the modified program normally reads commands interactively |
||||
|
when run, you must cause it, when started running for such |
||||
|
interactive use in the most ordinary way, to print or display an |
||||
|
announcement including an appropriate copyright notice and a |
||||
|
notice that there is no warranty (or else, saying that you provide |
||||
|
a warranty) and that users may redistribute the program under |
||||
|
these conditions, and telling the user how to view a copy of this |
||||
|
License. (Exception: if the Program itself is interactive but |
||||
|
does not normally print such an announcement, your work based on |
||||
|
the Program is not required to print an announcement.) |
||||
|
|
||||
|
These requirements apply to the modified work as a whole. If |
||||
|
identifiable sections of that work are not derived from the Program, |
||||
|
and can be reasonably considered independent and separate works in |
||||
|
themselves, then this License, and its terms, do not apply to those |
||||
|
sections when you distribute them as separate works. But when you |
||||
|
distribute the same sections as part of a whole which is a work based |
||||
|
on the Program, the distribution of the whole must be on the terms of |
||||
|
this License, whose permissions for other licensees extend to the |
||||
|
entire whole, and thus to each and every part regardless of who wrote it. |
||||
|
|
||||
|
Thus, it is not the intent of this section to claim rights or contest |
||||
|
your rights to work written entirely by you; rather, the intent is to |
||||
|
exercise the right to control the distribution of derivative or |
||||
|
collective works based on the Program. |
||||
|
|
||||
|
In addition, mere aggregation of another work not based on the Program |
||||
|
with the Program (or with a work based on the Program) on a volume of |
||||
|
a storage or distribution medium does not bring the other work under |
||||
|
the scope of this License. |
||||
|
|
||||
|
3. You may copy and distribute the Program (or a work based on it, |
||||
|
under Section 2) in object code or executable form under the terms of |
||||
|
Sections 1 and 2 above provided that you also do one of the following: |
||||
|
|
||||
|
a) Accompany it with the complete corresponding machine-readable |
||||
|
source code, which must be distributed under the terms of Sections |
||||
|
1 and 2 above on a medium customarily used for software interchange; or, |
||||
|
|
||||
|
b) Accompany it with a written offer, valid for at least three |
||||
|
years, to give any third party, for a charge no more than your |
||||
|
cost of physically performing source distribution, a complete |
||||
|
machine-readable copy of the corresponding source code, to be |
||||
|
distributed under the terms of Sections 1 and 2 above on a medium |
||||
|
customarily used for software interchange; or, |
||||
|
|
||||
|
c) Accompany it with the information you received as to the offer |
||||
|
to distribute corresponding source code. (This alternative is |
||||
|
allowed only for noncommercial distribution and only if you |
||||
|
received the program in object code or executable form with such |
||||
|
an offer, in accord with Subsection b above.) |
||||
|
|
||||
|
The source code for a work means the preferred form of the work for |
||||
|
making modifications to it. For an executable work, complete source |
||||
|
code means all the source code for all modules it contains, plus any |
||||
|
associated interface definition files, plus the scripts used to |
||||
|
control compilation and installation of the executable. However, as a |
||||
|
special exception, the source code distributed need not include |
||||
|
anything that is normally distributed (in either source or binary |
||||
|
form) with the major components (compiler, kernel, and so on) of the |
||||
|
operating system on which the executable runs, unless that component |
||||
|
itself accompanies the executable. |
||||
|
|
||||
|
If distribution of executable or object code is made by offering |
||||
|
access to copy from a designated place, then offering equivalent |
||||
|
access to copy the source code from the same place counts as |
||||
|
distribution of the source code, even though third parties are not |
||||
|
compelled to copy the source along with the object code. |
||||
|
|
||||
|
4. You may not copy, modify, sublicense, or distribute the Program |
||||
|
except as expressly provided under this License. Any attempt |
||||
|
otherwise to copy, modify, sublicense or distribute the Program is |
||||
|
void, and will automatically terminate your rights under this License. |
||||
|
However, parties who have received copies, or rights, from you under |
||||
|
this License will not have their licenses terminated so long as such |
||||
|
parties remain in full compliance. |
||||
|
|
||||
|
5. You are not required to accept this License, since you have not |
||||
|
signed it. However, nothing else grants you permission to modify or |
||||
|
distribute the Program or its derivative works. These actions are |
||||
|
prohibited by law if you do not accept this License. Therefore, by |
||||
|
modifying or distributing the Program (or any work based on the |
||||
|
Program), you indicate your acceptance of this License to do so, and |
||||
|
all its terms and conditions for copying, distributing or modifying |
||||
|
the Program or works based on it. |
||||
|
|
||||
|
6. Each time you redistribute the Program (or any work based on the |
||||
|
Program), the recipient automatically receives a license from the |
||||
|
original licensor to copy, distribute or modify the Program subject to |
||||
|
these terms and conditions. You may not impose any further |
||||
|
restrictions on the recipients' exercise of the rights granted herein. |
||||
|
You are not responsible for enforcing compliance by third parties to |
||||
|
this License. |
||||
|
|
||||
|
7. If, as a consequence of a court judgment or allegation of patent |
||||
|
infringement or for any other reason (not limited to patent issues), |
||||
|
conditions are imposed on you (whether by court order, agreement or |
||||
|
otherwise) that contradict the conditions of this License, they do not |
||||
|
excuse you from the conditions of this License. If you cannot |
||||
|
distribute so as to satisfy simultaneously your obligations under this |
||||
|
License and any other pertinent obligations, then as a consequence you |
||||
|
may not distribute the Program at all. For example, if a patent |
||||
|
license would not permit royalty-free redistribution of the Program by |
||||
|
all those who receive copies directly or indirectly through you, then |
||||
|
the only way you could satisfy both it and this License would be to |
||||
|
refrain entirely from distribution of the Program. |
||||
|
|
||||
|
If any portion of this section is held invalid or unenforceable under |
||||
|
any particular circumstance, the balance of the section is intended to |
||||
|
apply and the section as a whole is intended to apply in other |
||||
|
circumstances. |
||||
|
|
||||
|
It is not the purpose of this section to induce you to infringe any |
||||
|
patents or other property right claims or to contest validity of any |
||||
|
such claims; this section has the sole purpose of protecting the |
||||
|
integrity of the free software distribution system, which is |
||||
|
implemented by public license practices. Many people have made |
||||
|
generous contributions to the wide range of software distributed |
||||
|
through that system in reliance on consistent application of that |
||||
|
system; it is up to the author/donor to decide if he or she is willing |
||||
|
to distribute software through any other system and a licensee cannot |
||||
|
impose that choice. |
||||
|
|
||||
|
This section is intended to make thoroughly clear what is believed to |
||||
|
be a consequence of the rest of this License. |
||||
|
|
||||
|
8. If the distribution and/or use of the Program is restricted in |
||||
|
certain countries either by patents or by copyrighted interfaces, the |
||||
|
original copyright holder who places the Program under this License |
||||
|
may add an explicit geographical distribution limitation excluding |
||||
|
those countries, so that distribution is permitted only in or among |
||||
|
countries not thus excluded. In such case, this License incorporates |
||||
|
the limitation as if written in the body of this License. |
||||
|
|
||||
|
9. The Free Software Foundation may publish revised and/or new versions |
||||
|
of the General Public License from time to time. Such new versions will |
||||
|
be similar in spirit to the present version, but may differ in detail to |
||||
|
address new problems or concerns. |
||||
|
|
||||
|
Each version is given a distinguishing version number. If the Program |
||||
|
specifies a version number of this License which applies to it and "any |
||||
|
later version", you have the option of following the terms and conditions |
||||
|
either of that version or of any later version published by the Free |
||||
|
Software Foundation. If the Program does not specify a version number of |
||||
|
this License, you may choose any version ever published by the Free Software |
||||
|
Foundation. |
||||
|
|
||||
|
10. If you wish to incorporate parts of the Program into other free |
||||
|
programs whose distribution conditions are different, write to the author |
||||
|
to ask for permission. For software which is copyrighted by the Free |
||||
|
Software Foundation, write to the Free Software Foundation; we sometimes |
||||
|
make exceptions for this. Our decision will be guided by the two goals |
||||
|
of preserving the free status of all derivatives of our free software and |
||||
|
of promoting the sharing and reuse of software generally. |
||||
|
|
||||
|
NO WARRANTY |
||||
|
|
||||
|
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY |
||||
|
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN |
||||
|
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES |
||||
|
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED |
||||
|
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
||||
|
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS |
||||
|
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE |
||||
|
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, |
||||
|
REPAIR OR CORRECTION. |
||||
|
|
||||
|
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING |
||||
|
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR |
||||
|
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, |
||||
|
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING |
||||
|
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED |
||||
|
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY |
||||
|
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER |
||||
|
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE |
||||
|
POSSIBILITY OF SUCH DAMAGES. |
||||
|
|
||||
|
END OF TERMS AND CONDITIONS |
||||
|
|
||||
|
How to Apply These Terms to Your New Programs |
||||
|
|
||||
|
If you develop a new program, and you want it to be of the greatest |
||||
|
possible use to the public, the best way to achieve this is to make it |
||||
|
free software which everyone can redistribute and change under these terms. |
||||
|
|
||||
|
To do so, attach the following notices to the program. It is safest |
||||
|
to attach them to the start of each source file to most effectively |
||||
|
convey the exclusion of warranty; and each file should have at least |
||||
|
the "copyright" line and a pointer to where the full notice is found. |
||||
|
|
||||
|
<one line to give the program's name and a brief idea of what it does.> |
||||
|
Copyright (C) 19yy <name of author> |
||||
|
|
||||
|
This program 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. |
||||
|
|
||||
|
This program 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 this program; if not, write to the Free Software |
||||
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
||||
|
|
||||
|
|
||||
|
Also add information on how to contact you by electronic and paper mail. |
||||
|
|
||||
|
If the program is interactive, make it output a short notice like this |
||||
|
when it starts in an interactive mode: |
||||
|
|
||||
|
Gnomovision version 69, Copyright (C) 19yy name of author |
||||
|
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. |
||||
|
This is free software, and you are welcome to redistribute it |
||||
|
under certain conditions; type `show c' for details. |
||||
|
|
||||
|
The hypothetical commands `show w' and `show c' should show the appropriate |
||||
|
parts of the General Public License. Of course, the commands you use may |
||||
|
be called something other than `show w' and `show c'; they could even be |
||||
|
mouse-clicks or menu items--whatever suits your program. |
||||
|
|
||||
|
You should also get your employer (if you work as a programmer) or your |
||||
|
school, if any, to sign a "copyright disclaimer" for the program, if |
||||
|
necessary. Here is a sample; alter the names: |
||||
|
|
||||
|
Yoyodyne, Inc., hereby disclaims all copyright interest in the program |
||||
|
`Gnomovision' (which makes passes at compilers) written by James Hacker. |
||||
|
|
||||
|
<signature of Ty Coon>, 1 April 1989 |
||||
|
Ty Coon, President of Vice |
||||
|
|
||||
|
This General Public License does not permit incorporating your program into |
||||
|
proprietary programs. If your program is a subroutine library, you may |
||||
|
consider it more useful to permit linking proprietary applications with the |
||||
|
library. If this is what you want to do, use the GNU Library General |
||||
|
Public License instead of this License. |
@ -0,0 +1,672 @@ |
|||||
|
# Package administration and research tool for Debian |
||||
|
# Copyright (C) 1999-2000 Jonathan D. Rosenbaum |
||||
|
|
||||
|
# This program 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. |
||||
|
|
||||
|
# This program 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 this program; if not, write to the Free Software |
||||
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
||||
|
|
||||
|
|
||||
|
package SWIM::Conf; |
||||
|
use vars qw(@ISA @EXPORT %EXPORT_TAGS); |
||||
|
use Exporter; |
||||
|
@ISA = qw(Exporter); |
||||
|
|
||||
|
@EXPORT = qw($my_number $tmp $architecture $distribution @user_defined_section |
||||
|
$default_directory $default_root_directory $permission $dpkg |
||||
|
$dpkg_deb $ar $gcc $apt_get $apt_cache $sources @FTP $spl $cat |
||||
|
$sort $md5sum $zcat $tar $grep $gzip $fastswim $slowswim $longswim |
||||
|
$mount $umount $mke2fs $copy $pager $base $pwd $parent $library |
||||
|
$splt $mv $imswim $swim_conf $debug $port $timeout |
||||
|
$firewall $passive $apt_sources $HISTORY $alt); |
||||
|
%EXPORT_TAGS = ( |
||||
|
Path => [ qw($tmp $parent $base $library) ], |
||||
|
Deb => [ qw($pwd $dpkg_deb $ar $tar $grep $tmp $md5sum $cat $mv) ], |
||||
|
Qftp => [ qw($default_root_directory $permission @FTP |
||||
|
$default_directory $swim_conf) ], |
||||
|
Info => [ qw($parent $base $zcat) ] |
||||
|
); |
||||
|
|
||||
|
|
||||
|
|
||||
|
############################# |
||||
|
# DEFAULT PROGRAM VARIABLES # |
||||
|
############################# |
||||
|
|
||||
|
# You can change this to how many lines you would like "swim -qf <>" to |
||||
|
# print out, before asking for -t or --total, it will automatically ask |
||||
|
# though, if there is more than one package and you used the option -i. |
||||
|
# Remember -t can be used with --scripts family members to view the |
||||
|
# title of the script file regardless of this setting, and if -t has to be |
||||
|
# used, the titles will be displayed, which makes sense. |
||||
|
$my_number = 23; |
||||
|
|
||||
|
# Just like a shell, you can keep a history of whatever length you want. |
||||
|
$HISTORY = 10; |
||||
|
|
||||
|
# For not-installed: |
||||
|
# This part supplies the default value for --arch. |
||||
|
# |
||||
|
# You can determine the default architecture used when -n is |
||||
|
# called or a not-installed database is made. Architectures are always |
||||
|
# being added so check with Debian to find a list. There is alpha, arm, |
||||
|
# hurd (alternative kernel to linux), i386, m68k, powerpc, sparc. Just use |
||||
|
# the arch found after the hyphen in the Contents-(arch) file. |
||||
|
$architecture = "i386"; |
||||
|
|
||||
|
# For not-installed: |
||||
|
# This part supplies the default value for --dists. |
||||
|
# |
||||
|
# The default distribution can be either stable, unstable, frozen, or |
||||
|
# experimental (rare). These represent the state of development that the |
||||
|
# packages are under. The unstable distribution can have lot's of changes |
||||
|
# within a very short time period, and frozen may or may not be available. |
||||
|
$distribution = "unstable"; |
||||
|
|
||||
|
|
||||
|
#For not-installed: |
||||
|
#This part supplies the default value for --main, --contrib, --non-free, |
||||
|
#and --non-us. |
||||
|
|
||||
|
# Distributions are divided into the sections. These sections are called |
||||
|
# distributions in the version 2.4.1.0 packaging manual, because they were at |
||||
|
# one time separate distributions, but this has since changed. You can |
||||
|
# determine which of these sections (main, non-free, contrib or non-US) to |
||||
|
# pull out of the Contents file if you don't want to use --main, --contrib, |
||||
|
# --non-free, and --non-us to selectively pick sections. Basically, whatever |
||||
|
# you pull out should match the Package(s) file(s) you are targetting, this |
||||
|
# program is friendly if you make a mistake, but it's more effecient to pull |
||||
|
# out just what you want. If the same package happens to exist in two |
||||
|
# different sections, main and non-us for example (which is really a |
||||
|
# situation that shouldn't exist, yet it does), you will still be able to |
||||
|
# find this package in the non-us group, but its section and locations will be |
||||
|
# the one which main recognizes assuming that you use the order in the example |
||||
|
# below. |
||||
|
|
||||
|
# Setting it up: |
||||
|
# Example: You just want to pull out main and contrib every time you run |
||||
|
# --initndb, --rebuildndb, or --ndb. |
||||
|
# @user_defined_section = qw(main contrib non-US); |
||||
|
# remember "non-US" not "non-us". |
||||
|
|
||||
|
# untill non-US is fixed the second is better |
||||
|
#@user_defined_section = qw(main contrib non-free non-US); |
||||
|
@user_defined_section = qw(main contrib non-free); |
||||
|
|
||||
|
# Usually, this is |
||||
|
$alt = "debian"; |
||||
|
|
||||
|
################ |
||||
|
# DF LOCATION # |
||||
|
################ |
||||
|
|
||||
|
# A little philosophy: |
||||
|
# swim was developed for maximum versatility, so whether you are just |
||||
|
# interested in researching, and keeping tabs on the newest packages, |
||||
|
# or maintaining a Debian virtual distribution on a non-Debian real |
||||
|
# distribution, or you are a using swim for distribution development, swim |
||||
|
# provides a way. The default directory (DF - which can also mean |
||||
|
# directory/file) keeps track of Contents and Packages files downloaded |
||||
|
# using --ftp, and gives the files names specific to the distribution and |
||||
|
# architectures they represent. But, you also have the freedom not to use |
||||
|
# the default directory in this case swim will still do the renaming and |
||||
|
# keeping track of the mtime, but you will have to remember where you put |
||||
|
# the files. On the other hand, if you use apt, you won't even have to use |
||||
|
# the DF directory for Packages files because you can get the ones specific |
||||
|
# to your own systems architecture from apt, but if you want to look at |
||||
|
# other architectures you will need to use the DF directory or one of your |
||||
|
# own choice. |
||||
|
# Naming Convention: Contents = Contents-dist.gz |
||||
|
# Packages = Packages-arch-dist-section.gz |
||||
|
$default_directory = '/root/.swim'; |
||||
|
|
||||
|
|
||||
|
# The default root directory is the key to easy management of packages |
||||
|
# downloaded through --ftp and --file, and provides an easy way to put together |
||||
|
# a personalized distribution. Future implementations of swim will provide |
||||
|
# a distribution called personal..Packages and Contents files specific to |
||||
|
# this distribution will automatically be made. This directory can be a |
||||
|
# real ftp site on your computer, or put where ever else you are allowed |
||||
|
# to have directories. dists/distribution/section/architecture/subject will be |
||||
|
# placed above this directory. No matter what, debian must be the final |
||||
|
# directory before dists. Other distributions are placed alongside debian, |
||||
|
# like debian-non-US or personal. |
||||
|
# Feel free to change the permissions. This directory is above your default_ |
||||
|
# directory. |
||||
|
$default_root_directory = '/pub/debian'; |
||||
|
|
||||
|
# Because you may be using a real ftp site, this configuration allows you |
||||
|
# to determine what permissions swim will set for directories it creates |
||||
|
# above the default root directory. |
||||
|
$permission = '0755'; |
||||
|
|
||||
|
|
||||
|
############### |
||||
|
# AR or DPKG? # |
||||
|
############### |
||||
|
|
||||
|
# NOTE: users set these next two with the $package_tool variable. |
||||
|
|
||||
|
# packaging friends dpkg and dpkg-deb come from the essential and |
||||
|
# required dpkg package. ar from the package binutils can also be used (below). |
||||
|
# This is the archival program used for deb packages, but binutils is just |
||||
|
# a standard non-essential package, and the ar capabilities are built into |
||||
|
# dpkg-deb, and it's better not to assume that the standard packages are |
||||
|
# even established, yet. |
||||
|
$dpkg = (); |
||||
|
$dpkg_deb = (); |
||||
|
|
||||
|
|
||||
|
# If you don't have the dpkg package on your system then you can use ar |
||||
|
# from the package binutils. This would be a standard, but not an essential |
||||
|
# package in Debian, but this package is also fairly standard amongst all |
||||
|
# distributions, and can even be found in the free djgpp for M$ Oses. |
||||
|
# Since people who have both dpkg and ar may want to try the ar method, |
||||
|
# rather than creating an automatic check, just assign a value to either |
||||
|
# ($dpkg & $dpkg_deb) or just $ar. |
||||
|
#my $ar = '/usr/bin/ar'; # same for RH |
||||
|
$ar = '/usr/bin/ar'; |
||||
|
|
||||
|
|
||||
|
####### |
||||
|
# APT # |
||||
|
####### |
||||
|
|
||||
|
# NOTE: users set apt-get and apt-cache with the $apt variable |
||||
|
|
||||
|
# If you have apt you are in luck. |
||||
|
$apt_get = (); |
||||
|
$apt_cache = (); |
||||
|
$sources = '/etc/apt/sources.list'; |
||||
|
$apt_sources = '/var/state/apt/lists'; |
||||
|
|
||||
|
######### |
||||
|
# PAGER # |
||||
|
######### |
||||
|
|
||||
|
# less is a nice pager, unless you like more! There is an option |
||||
|
# --nopager or -n. Pager is used for --help and swim called without any |
||||
|
# options. more comes from the required package util-linux, whereas |
||||
|
# less comes from a standard package called less. In the future there is |
||||
|
# a possiblity that a large percentage of swim may use an internal pager. |
||||
|
# less, more, or most or... |
||||
|
#$ENV{PAGER} = "/usr/bin/less"; # same RH |
||||
|
$ENV{PAGER} = "less"; |
||||
|
$pager = $ENV{PAGER}; |
||||
|
|
||||
|
|
||||
|
|
||||
|
################# |
||||
|
# SWIM PROGRAMS # |
||||
|
################# |
||||
|
|
||||
|
# This is replaced by the Makefile. |
||||
|
$pre="/usr"; |
||||
|
|
||||
|
# This is the hash making program fastswim. |
||||
|
$fastswim = "$pre/lib/SWIM/fastswim"; |
||||
|
|
||||
|
# imswim in an alternative to fastswim for --lowmem |
||||
|
$imswim = "$pre/lib/SWIM/imswim"; |
||||
|
|
||||
|
# This is the low memory program slowswim. |
||||
|
$slowswim = "$pre/lib/SWIM/slowswim"; |
||||
|
|
||||
|
# This is the dir/file making program longswim. |
||||
|
$longswim = "$pre/lib/SWIM/longswim"; |
||||
|
|
||||
|
############ |
||||
|
# TEMP DIR # |
||||
|
############ |
||||
|
|
||||
|
# If you want to set an alternative directory for the temporary files |
||||
|
# created when the databases are made, change here. You may want to make |
||||
|
# $tmp a RAM disk. See package loadlin for initrd documentation and an |
||||
|
# explanation for making such a disk. There is also |
||||
|
# /usr/src/kernel-source.version/Documentation. Whether this will speed |
||||
|
# things up is a subject of experimentation. |
||||
|
$tmp = '/tmp'; |
||||
|
|
||||
|
################## |
||||
|
# MAIN CONFFILES # |
||||
|
################## |
||||
|
|
||||
|
# if configuration files are not kept in /etc change this |
||||
|
# and set up the directories by hand. |
||||
|
|
||||
|
$swim_conf = '/etc/swim'; |
||||
|
|
||||
|
|
||||
|
############# |
||||
|
# UTILITIES # |
||||
|
############# |
||||
|
|
||||
|
|
||||
|
# This probably never will have to be changed. |
||||
|
$pwd = `pwd`; |
||||
|
chomp $pwd; |
||||
|
|
||||
|
# If the command split is somewhere else besides /usr/bin change this. |
||||
|
# The required package textutils provides this. |
||||
|
#my $splt = '/usr/bin/split'; # same RH |
||||
|
$splt = 'split'; |
||||
|
|
||||
|
# cat comes from the essential and required package textutils. |
||||
|
#my $cat = '/bin/cat'; # same RH |
||||
|
$cat = 'cat'; |
||||
|
|
||||
|
# This command also omes from the required and essential package textutils. |
||||
|
#my $sort = '/usr/bin/sort'; # same RH |
||||
|
$sort = 'sort'; |
||||
|
|
||||
|
# This program uses md5sum from the dpkg package, it can also use md5sum |
||||
|
# from the RH package. |
||||
|
#my $md5sum = '/usr/bin/md5sum'; # same RH |
||||
|
$md5sum = 'md5sum'; |
||||
|
|
||||
|
# If you want to view compressed files make sure this is correct. |
||||
|
# The required package gzip provides this. |
||||
|
#my $zcat = '/bin/zcat'; # same RH |
||||
|
$zcat = 'zcat'; |
||||
|
|
||||
|
# tar comes from the essential and required package tar. |
||||
|
#my $tar = '/bin/tar'; # same RH |
||||
|
$tar = 'tar'; |
||||
|
|
||||
|
# grep comes from the essential and required package grep. This seems |
||||
|
# to require a path. |
||||
|
$grep = '/bin/grep'; # same RH |
||||
|
|
||||
|
# gzip comes from the essential and required package gzip. |
||||
|
#my $gzip = "/bin/gzip"; # same RH |
||||
|
$gzip = "gzip"; |
||||
|
|
||||
|
# mount comes from the essential and required package mount. |
||||
|
#my $mount = '/bin/mount'; # same RH |
||||
|
#my $umount = '/bin/umount'; # same RH |
||||
|
$mount = 'mount'; |
||||
|
$umount = 'umount'; |
||||
|
|
||||
|
# If your file system isn't an ext2 filesystem, you may want to change |
||||
|
# this. mke2fs comes from the essential and required package e2fsprogs. |
||||
|
#my $mke2fs = '/sbin/mke2fs'; # same RH |
||||
|
$mke2fs = 'mke2fs'; |
||||
|
|
||||
|
# cp and mv from the essential and required package fileutils |
||||
|
#my $copy = '/bin/cp'; # same RH |
||||
|
$copy = 'cp'; |
||||
|
$mv = 'mv'; |
||||
|
|
||||
|
# Your system definitely has gcc if you have ar. gcc is a standard package |
||||
|
# in debian. |
||||
|
$gcc = 'gcc'; |
||||
|
|
||||
|
|
||||
|
###### |
||||
|
# FTP # |
||||
|
####### |
||||
|
|
||||
|
# Major mode --ftp and --file automates the download of Contents and Packages |
||||
|
# files. Even if you have apt installed, you may still want to download Packages |
||||
|
# from alternative architectures, and the Contents file for your own architecture |
||||
|
# or other architectures. If you want virtual and/or -ld capabilities you need |
||||
|
# the Contents file. You specify a list of ftp or file sites using urls (like |
||||
|
# apt). For your system's architecture specify the type deb, for other |
||||
|
# architectures specify deb(hyphen)architecture (ex: deb-alpha). Regardless of |
||||
|
# whether or not you specify an architecture, deb implies /dist* found under the |
||||
|
# base directory specified by the ftp url, except in the case of experimental, |
||||
|
# and to a degree non-us. minor mode --ftp, and --file will use the sites in this |
||||
|
# configuration as well, on a fifo (first in first out) basis, so choose the |
||||
|
# order of sites based on which are closest, most current, as well as fast. |
||||
|
|
||||
|
# IMPORTANT: It is a BIG MISTAKE to use the distributions name (slink,po,etc) |
||||
|
# anywhere in the sources list, or in swim's configuration file..in fact swim |
||||
|
# won't work properly, not to mention the fact that someday your favorite name |
||||
|
# will suddenly disappear. This is because swim thinks in terms of the real |
||||
|
# distribution name (stable,unstable,frozen, experimental). The problem goes |
||||
|
# like this - slink remains slink, but goes from unstable to frozen to stable. |
||||
|
# At first, using the distributions alias may seem appropriate, but the |
||||
|
# purpose of swim is to keep tabs on the dists, and not to ignore changes in |
||||
|
# the states, this also makes managing swim's databases much easier and |
||||
|
# intuitive...more about this later. |
||||
|
|
||||
|
# Fun experiments: Swim uses the naming conventions of apt, but leaves the |
||||
|
# Package files compressed in the DF directory. So you can always decompress |
||||
|
# the databases and move them to /var/state/apt/lists. This ofcourse assumes |
||||
|
# that the appropriate changes to the sources.list reflecting these Packages |
||||
|
# (need to be the same architecture as your system) existed before you |
||||
|
# update. (author needs to do this experiment :*) |
||||
|
|
||||
|
$ftp1 = "deb ftp://localhost/pub/debian unstable main contrib non-free non-US"; |
||||
|
$ftp2 = "deb ftp://localhost/pub/debian unstable main contrib non-free"; |
||||
|
$ftp3 = "deb ftp://localhost/pub/debian project/experimental/"; |
||||
|
@FTP = ($ftp1,$ftp2,$ftp3); |
||||
|
|
||||
|
# These next variables allow some characteristics of the ftp client |
||||
|
# to be altered. See Net::FTP for ways of altering some of these |
||||
|
# variables through the environment. |
||||
|
|
||||
|
$firewall = 0; |
||||
|
$port = 0; |
||||
|
$timeout = 120; |
||||
|
$debug = 0; |
||||
|
$passive = 0; |
||||
|
|
||||
|
|
||||
|
######################################## |
||||
|
# STUFF THAT NEVER NEEDS TO BE CHANGED # |
||||
|
######################################## |
||||
|
|
||||
|
# You will never need to change this unless for some weird reason all the |
||||
|
# files under dpkg are somewhere else (including /info*) , see --dbpath as |
||||
|
# an alternative if you decide to access or make the databases somewhere |
||||
|
# else. |
||||
|
$base = '/var/lib/dpkg'; |
||||
|
|
||||
|
# --dbpath takes care of this so don't touch. |
||||
|
$parent = '/'; |
||||
|
$library = '/var/lib/dpkg'; |
||||
|
|
||||
|
|
||||
|
############################# |
||||
|
# LOAD CUSTOM CONFIGURATION # |
||||
|
############################# |
||||
|
|
||||
|
|
||||
|
# Here we load in the customized configuration which override the defaults |
||||
|
# Might as well use do, let the world learn Perl ... compare this to apt's |
||||
|
# configuation file with scopes. Swim's sources.list file (/etc/swim/swimz.list), |
||||
|
# will be grabbed at SWIM::Apt and SWIM::Qftp if it exists. |
||||
|
|
||||
|
do "$swim_conf/swimrc"; |
||||
|
do "$ENV{HOME}/.swim/swimrc"; |
||||
|
if ((defined $dpkg && !defined $dpkg_deb) || |
||||
|
(!defined $dpkg && defined $dpkg_deb)) { |
||||
|
print "swim: need to give both \$dpkg and \$dpkg_deb a value if you want dpkg\n"; |
||||
|
exit; |
||||
|
} |
||||
|
if (defined $package_tool) { |
||||
|
if ($package_tool =~ /ar/) { |
||||
|
$ar = $ar; |
||||
|
} |
||||
|
else { |
||||
|
$dpkg = 'dpkg'; |
||||
|
$dpkg_deb = 'dpkg-deb'; |
||||
|
undef $ar; |
||||
|
} |
||||
|
} |
||||
|
if (defined $apt) { |
||||
|
$apt_get = 'apt-get'; |
||||
|
$apt_cache = 'apt-cache'; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
############################### |
||||
|
# MAKE ANY NEEDED DIRECTORIES # |
||||
|
############################### |
||||
|
|
||||
|
# make sure all the appropriate directories are made |
||||
|
if (!-d $default_directory) { |
||||
|
if (-e $default_directory) { |
||||
|
print "swim: can not create default directory because a file exists\n"; |
||||
|
exit; |
||||
|
} |
||||
|
my @DRD = split(m,/,,$default_directory); |
||||
|
my $placement = "/"; |
||||
|
for (1 .. $#DRD) { |
||||
|
$_ == 1 ? ($placement = "/$DRD[$_]") |
||||
|
: ($placement = $placement . "/" . $DRD[$_]); |
||||
|
-d $placement or mkdir("$placement",0755); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
if (!-d "$default_directory$default_root_directory") { |
||||
|
my @DRD = split(m,/,,$default_root_directory); |
||||
|
print "swim: debian must be the final directory before dists\n" |
||||
|
if $DRD[$#DRD] ne "debian"; |
||||
|
exit if $DRD[$#DRD] ne "debian"; |
||||
|
my $placement = "/"; |
||||
|
for (1 .. $#DRD) { |
||||
|
$_ == 1 ? ($placement = "/$DRD[$_]") |
||||
|
: ($placement = $placement . "/" . $DRD[$_]); |
||||
|
unless (-d "$default_directory$placement") { |
||||
|
mkdir("$default_directory$placement",0755) |
||||
|
or die "swim: could not create root default directory\n"; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
# Makefile will make sure these directories exist, unless for some strange |
||||
|
# reason you have to change them. |
||||
|
|
||||
|
if (!-d $library) { |
||||
|
mkdir($library,0755) or die "Couldn't create default directory\n"; |
||||
|
} |
||||
|
|
||||
|
if (!-d $base) { |
||||
|
mkdir($base,0755) or die "Couldn't create default directory\n"; |
||||
|
} |
||||
|
|
||||
|
if (!-d $swim_conf) { |
||||
|
mkdir($swim_conf,0666) or die "Couldn't create configuration file directory, |
||||
|
please make the directories which are needed.\n"; |
||||
|
} |
||||
|
|
||||
|
1; |
||||
|
|
||||
|
__END__ |
||||
|
|
||||
|
=head1 NAME |
||||
|
|
||||
|
swimrc - swim configuration file |
||||
|
|
||||
|
=head1 DESCRIPTION |
||||
|
|
||||
|
B<swimrc> is the configuartion file for swim allowing many default values |
||||
|
to be set so that they do not have to be mentioned on the command line. |
||||
|
Swimrc interacts directly with Perl allowing a wide variety of variables |
||||
|
found in B<SWIW::Conf> to be altered. |
||||
|
|
||||
|
=cut |
||||
|
|
||||
|
=head1 USAGE |
||||
|
|
||||
|
Values for variable can be altered for B<swim> by assigning different |
||||
|
values enclosed in quotes or quoted whitespace (qw()), and ended with a |
||||
|
semi-colon. |
||||
|
|
||||
|
$variable = "value"; |
||||
|
$variable = "qw(value1 value2 ..)"; |
||||
|
|
||||
|
=head1 VARIABLES |
||||
|
|
||||
|
This is a list of variables with explanations. The default values for |
||||
|
B<swim> are shown. |
||||
|
|
||||
|
=head2 OUTPUT VARIABLE |
||||
|
|
||||
|
$my_number can be changed to how many lines you would like "swim -qf <>" |
||||
|
to print out, before the program asks for C<-t> or C<--total>. Exception: |
||||
|
If C<-i> is used in the query and there is more than one package then the |
||||
|
total will be presented. |
||||
|
|
||||
|
Hint: C<-t> can be used with all the various C<--scripts> family members |
||||
|
to view the title of the script file regardless of this variable setting, |
||||
|
and if C<-t> has to be used, the titles will be displayed, which makes |
||||
|
sense. |
||||
|
|
||||
|
B<$my_number = 23;> |
||||
|
|
||||
|
=head2 HISTORY |
||||
|
|
||||
|
This is a shell-like history kept in relation to searches and the most |
||||
|
recent edit when C<--stdin> is used. |
||||
|
|
||||
|
B<$HISTORY = 10;> |
||||
|
|
||||
|
=head2 AR or DPKG? |
||||
|
|
||||
|
Debian packages are ar archives. If you are using a Debian Distribution |
||||
|
assign "dpkg" to $package_tool, otherwise assign "ar" to $package_tool. |
||||
|
|
||||
|
B<$package_tool = "/usr/bin/ar";> |
||||
|
|
||||
|
=head2 APT |
||||
|
|
||||
|
B<Swim> does not assign a value for apt. To use C<--apt> and C<-xyz> |
||||
|
assign $apt the value "yes". |
||||
|
|
||||
|
Example: B<$apt = "yes";> |
||||
|
|
||||
|
=head2 PAGER |
||||
|
|
||||
|
less is a nice pager, unless you like more! Pager is used for C<--help> |
||||
|
and B<swim> called without any options. There is an option C<--nopager> or |
||||
|
C<-n>. more comes from the required package util-linux, whereas less |
||||
|
comes from a standard package called less. Values: "less", "more", or |
||||
|
"most" or... |
||||
|
|
||||
|
B<$ENV{PAGER} = "less";> |
||||
|
|
||||
|
=head2 NOT-INSTALLED VARIABLES |
||||
|
|
||||
|
Assign values for $architecture and/or $distribution to avoid having to |
||||
|
use C<--arch> and C<--dists> everytime the not-installed databases are |
||||
|
accessed with C<-n> or made or altered. |
||||
|
|
||||
|
Architectures are always being added so check with Debian to find a list. |
||||
|
There is I<alpha, arm, hurd-i386 (alternative kernel to linux), i386, |
||||
|
m68k, powerpc, sparc>. Just use the arch found after the hyphen in the |
||||
|
Contents-(arch) file. |
||||
|
|
||||
|
B<$architecture = "i386";> |
||||
|
|
||||
|
The distribution can be either I<stable, unstable, frozen, or experimental |
||||
|
(rare)>. These represent the state of development that the packages are |
||||
|
under. The unstable distribution can have lot's of changes within a very |
||||
|
short time period, and frozen may or may not be available. |
||||
|
|
||||
|
B<$distribution = "unstable";> |
||||
|
|
||||
|
Distributions are divided into sections. These sections were called |
||||
|
distributions in the version 2.4.1.0 packaging manual, because they were |
||||
|
at one time separate distributions, but this has since changed. |
||||
|
|
||||
|
You can determine which of the sections I<main, non-free, contrib or |
||||
|
non-US> to pull out of the Contents file if you don't want to use |
||||
|
C<--main>, C<--contrib>, C<--non-free>, and C<--non-us> to selectively |
||||
|
pick the sections. |
||||
|
|
||||
|
For efficiency, you should choose the sections which you will be pulling |
||||
|
out of the Packages file(s) being targetted. |
||||
|
|
||||
|
Rule: Use "non-US" not "non-us". |
||||
|
|
||||
|
B<@user_defined_section = qw(main contrib non-free non-US);> |
||||
|
|
||||
|
=head2 DF LOCATION |
||||
|
|
||||
|
A little philosophy: B<swim> was developed for maximum versatility, so |
||||
|
whether you are just interested in researching, and keeping tabs on the |
||||
|
newest packages, or maintaining a Debian virtual distribution on a |
||||
|
non-Debian distribution, or you are a using B<swim> for distribution |
||||
|
development, B<swim> provides a way. |
||||
|
|
||||
|
The next two variables determine the location of the DF (default |
||||
|
directory/file system) |
||||
|
|
||||
|
The default directory keeps track of Contents and/or Packages databases |
||||
|
retrieved with --ftp. The Contents and Packages databases and Release |
||||
|
file are give names specific to the distribution and architectures they |
||||
|
represent using the naming convention found in apt's sources directory. |
||||
|
You also have the freedom not to use the default directory, in which case |
||||
|
swim will still do the renaming and keeping track of the mtime, but you |
||||
|
will have to remember where you put the files. |
||||
|
|
||||
|
B<$default_directory = '/root/.swim';> |
||||
|
|
||||
|
The default root directory (DRD) is the key to easy management of binary |
||||
|
packages, source, dsc, and diff files received from --ftp, and provides an |
||||
|
easy way to put together a personalized distribution. This directory can |
||||
|
be a real ftp site on your computer, or put wherever else you are |
||||
|
allowed to have directories. The DRD is always placed below the value |
||||
|
assigned to $default_directory. According to the previous assignment to |
||||
|
$default_directory, if the DRD is "/pub/a/debian" then the full path |
||||
|
would be "/root/.swim/pub/a/debian". |
||||
|
|
||||
|
Example: When a package is downloaded it will be placed in |
||||
|
dists/distribution/section/architecture/subject below the DRD. |
||||
|
|
||||
|
Rule: debian must be the final directory before dists, this is because |
||||
|
other distributions are placed alongside debian, like debian-non-US or |
||||
|
personal (specialized distribution). |
||||
|
|
||||
|
B<$default_root_directory = '/pub/debian';> |
||||
|
|
||||
|
Because you may be using a real ftp site, this variable allows you to |
||||
|
determine what permissions B<swim> will assign for directories it creates |
||||
|
below the DRD. |
||||
|
|
||||
|
B<$permission = '0755';> |
||||
|
|
||||
|
=head2 TEMPORARY DIRECTORY |
||||
|
|
||||
|
If you want to set an alternative directory for the temporary files |
||||
|
created when the databases are made, change here. You may want to make |
||||
|
$tmp a RAM disk. See package loadlin for initrd documentation and an |
||||
|
explanation for making such a disk. There is also documentation in |
||||
|
/usr/src/kernel-source.version/Documentation. Whether this will speed |
||||
|
things up is a subject of experimentation. |
||||
|
|
||||
|
B<$tmp = "/tmp";> |
||||
|
|
||||
|
=head2 FTP |
||||
|
|
||||
|
You can alter the Firewall, Port, Timeout, Debug and Passive |
||||
|
characteristics of the ftp client as defined in Net::FTP(3pm) by providing |
||||
|
arguments to these variables. All variables but $timeout are set to untrue |
||||
|
by default. |
||||
|
|
||||
|
$firewall = 0; (FTP firewall machine name) |
||||
|
$port = 0; (defaults to 23) |
||||
|
$timeout = 120; (120 seconds) |
||||
|
$debug = 0; (1 will turn on STDERR) |
||||
|
$passive = 0; (1 will enable) |
||||
|
|
||||
|
=head1 OTHER VARIABLES |
||||
|
|
||||
|
see SWIM::Conf |
||||
|
|
||||
|
=head1 FILES |
||||
|
|
||||
|
/etc/swim/swimrc |
||||
|
~/.swim/swimrc |
||||
|
|
||||
|
=head1 SEE ALSO |
||||
|
|
||||
|
swim(8), Net::FTP(3pm) |
||||
|
|
||||
|
=head1 BUGS |
||||
|
|
||||
|
Send directly to mttrader@access.mountain.net. |
||||
|
|
||||
|
=head1 AUTHOR |
||||
|
|
||||
|
Jonathan D. Rosenbaum <mttrader@access.mountain.net> |
||||
|
|
||||
|
=head1 COPYRIGHT |
||||
|
|
||||
|
|
||||
|
Copyright (c) 1999 Jonathan Rosenbaum. All rights reserved. This program |
||||
|
is free software; you can redistribute it and/or modify it under the GPL. |
||||
|
|
||||
|
=cut |
@ -0,0 +1,672 @@ |
|||||
|
# Package administration and research tool for Debian |
||||
|
# Copyright (C) 1999-2000 Jonathan D. Rosenbaum |
||||
|
|
||||
|
# This program 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. |
||||
|
|
||||
|
# This program 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 this program; if not, write to the Free Software |
||||
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
||||
|
|
||||
|
|
||||
|
package SWIM::Conf; |
||||
|
use vars qw(@ISA @EXPORT %EXPORT_TAGS); |
||||
|
use Exporter; |
||||
|
@ISA = qw(Exporter); |
||||
|
|
||||
|
@EXPORT = qw($my_number $tmp $architecture $distribution @user_defined_section |
||||
|
$default_directory $default_root_directory $permission $dpkg |
||||
|
$dpkg_deb $ar $gcc $apt_get $apt_cache $sources @FTP $spl $cat |
||||
|
$sort $md5sum $zcat $tar $grep $gzip $fastswim $slowswim $longswim |
||||
|
$mount $umount $mke2fs $copy $pager $base $pwd $parent $library |
||||
|
$splt $mv $imswim $swim_conf $debug $port $timeout |
||||
|
$firewall $passive $apt_sources $HISTORY $alt); |
||||
|
%EXPORT_TAGS = ( |
||||
|
Path => [ qw($tmp $parent $base $library) ], |
||||
|
Deb => [ qw($pwd $dpkg_deb $ar $tar $grep $tmp $md5sum $cat $mv) ], |
||||
|
Qftp => [ qw($default_root_directory $permission @FTP |
||||
|
$default_directory $swim_conf) ], |
||||
|
Info => [ qw($parent $base $zcat) ] |
||||
|
); |
||||
|
|
||||
|
|
||||
|
|
||||
|
############################# |
||||
|
# DEFAULT PROGRAM VARIABLES # |
||||
|
############################# |
||||
|
|
||||
|
# You can change this to how many lines you would like "swim -qf <>" to |
||||
|
# print out, before asking for -t or --total, it will automatically ask |
||||
|
# though, if there is more than one package and you used the option -i. |
||||
|
# Remember -t can be used with --scripts family members to view the |
||||
|
# title of the script file regardless of this setting, and if -t has to be |
||||
|
# used, the titles will be displayed, which makes sense. |
||||
|
$my_number = 23; |
||||
|
|
||||
|
# Just like a shell, you can keep a history of whatever length you want. |
||||
|
$HISTORY = 10; |
||||
|
|
||||
|
# For not-installed: |
||||
|
# This part supplies the default value for --arch. |
||||
|
# |
||||
|
# You can determine the default architecture used when -n is |
||||
|
# called or a not-installed database is made. Architectures are always |
||||
|
# being added so check with Debian to find a list. There is alpha, arm, |
||||
|
# hurd (alternative kernel to linux), i386, m68k, powerpc, sparc. Just use |
||||
|
# the arch found after the hyphen in the Contents-(arch) file. |
||||
|
$architecture = "i386"; |
||||
|
|
||||
|
# For not-installed: |
||||
|
# This part supplies the default value for --dists. |
||||
|
# |
||||
|
# The default distribution can be either stable, unstable, frozen, or |
||||
|
# experimental (rare). These represent the state of development that the |
||||
|
# packages are under. The unstable distribution can have lot's of changes |
||||
|
# within a very short time period, and frozen may or may not be available. |
||||
|
$distribution = "unstable"; |
||||
|
|
||||
|
|
||||
|
#For not-installed: |
||||
|
#This part supplies the default value for --main, --contrib, --non-free, |
||||
|
#and --non-us. |
||||
|
|
||||
|
# Distributions are divided into the sections. These sections are called |
||||
|
# distributions in the version 2.4.1.0 packaging manual, because they were at |
||||
|
# one time separate distributions, but this has since changed. You can |
||||
|
# determine which of these sections (main, non-free, contrib or non-US) to |
||||
|
# pull out of the Contents file if you don't want to use --main, --contrib, |
||||
|
# --non-free, and --non-us to selectively pick sections. Basically, whatever |
||||
|
# you pull out should match the Package(s) file(s) you are targetting, this |
||||
|
# program is friendly if you make a mistake, but it's more effecient to pull |
||||
|
# out just what you want. If the same package happens to exist in two |
||||
|
# different sections, main and non-us for example (which is really a |
||||
|
# situation that shouldn't exist, yet it does), you will still be able to |
||||
|
# find this package in the non-us group, but its section and locations will be |
||||
|
# the one which main recognizes assuming that you use the order in the example |
||||
|
# below. |
||||
|
|
||||
|
# Setting it up: |
||||
|
# Example: You just want to pull out main and contrib every time you run |
||||
|
# --initndb, --rebuildndb, or --ndb. |
||||
|
# @user_defined_section = qw(main contrib non-US); |
||||
|
# remember "non-US" not "non-us". |
||||
|
|
||||
|
#untill non-US is fixed the second is better |
||||
|
#@user_defined_section = qw(main contrib non-free non-US); |
||||
|
@user_defined_section = qw(main contrib non-free); |
||||
|
|
||||
|
# Usually, this is |
||||
|
$alt = "debian"; |
||||
|
|
||||
|
################ |
||||
|
# DF LOCATION # |
||||
|
################ |
||||
|
|
||||
|
# A little philosophy: |
||||
|
# swim was developed for maximum versatility, so whether you are just |
||||
|
# interested in researching, and keeping tabs on the newest packages, |
||||
|
# or maintaining a Debian virtual distribution on a non-Debian real |
||||
|
# distribution, or you are a using swim for distribution development, swim |
||||
|
# provides a way. The default directory (DF - which can also mean |
||||
|
# directory/file) keeps track of Contents and Packages files downloaded |
||||
|
# using --ftp, and gives the files names specific to the distribution and |
||||
|
# architectures they represent. But, you also have the freedom not to use |
||||
|
# the default directory in this case swim will still do the renaming and |
||||
|
# keeping track of the mtime, but you will have to remember where you put |
||||
|
# the files. On the other hand, if you use apt, you won't even have to use |
||||
|
# the DF directory for Packages files because you can get the ones specific |
||||
|
# to your own systems architecture from apt, but if you want to look at |
||||
|
# other architectures you will need to use the DF directory or one of your |
||||
|
# own choice. |
||||
|
# Naming Convention: Contents = Contents-dist.gz |
||||
|
# Packages = Packages-arch-dist-section.gz |
||||
|
$default_directory = '/root/.swim'; |
||||
|
|
||||
|
|
||||
|
# The default root directory is the key to easy management of packages |
||||
|
# downloaded through --ftp and --file, and provides an easy way to put together |
||||
|
# a personalized distribution. Future implementations of swim will provide |
||||
|
# a distribution called personal..Packages and Contents files specific to |
||||
|
# this distribution will automatically be made. This directory can be a |
||||
|
# real ftp site on your computer, or put where ever else you are allowed |
||||
|
# to have directories. dists/distribution/section/architecture/subject will be |
||||
|
# placed above this directory. No matter what, debian must be the final |
||||
|
# directory before dists. Other distributions are placed alongside debian, |
||||
|
# like debian-non-US or personal. |
||||
|
# Feel free to change the permissions. This directory is above your default_ |
||||
|
# directory. |
||||
|
$default_root_directory = '/pub/debian'; |
||||
|
|
||||
|
# Because you may be using a real ftp site, this configuration allows you |
||||
|
# to determine what permissions swim will set for directories it creates |
||||
|
# above the default root directory. |
||||
|
$permission = '0755'; |
||||
|
|
||||
|
|
||||
|
############### |
||||
|
# AR or DPKG? # |
||||
|
############### |
||||
|
|
||||
|
# NOTE: users set these next two with the $package_tool variable. |
||||
|
|
||||
|
# packaging friends dpkg and dpkg-deb come from the essential and |
||||
|
# required dpkg package. ar from the package binutils can also be used (below). |
||||
|
# This is the archival program used for deb packages, but binutils is just |
||||
|
# a standard non-essential package, and the ar capabilities are built into |
||||
|
# dpkg-deb, and it's better not to assume that the standard packages are |
||||
|
# even established, yet. |
||||
|
$dpkg = (); |
||||
|
$dpkg_deb = (); |
||||
|
|
||||
|
|
||||
|
# If you don't have the dpkg package on your system then you can use ar |
||||
|
# from the package binutils. This would be a standard, but not an essential |
||||
|
# package in Debian, but this package is also fairly standard amongst all |
||||
|
# distributions, and can even be found in the free djgpp for M$ Oses. |
||||
|
# Since people who have both dpkg and ar may want to try the ar method, |
||||
|
# rather than creating an automatic check, just assign a value to either |
||||
|
# ($dpkg & $dpkg_deb) or just $ar. |
||||
|
#my $ar = '/usr/bin/ar'; # same for RH |
||||
|
$ar = '/usr/bin/ar'; |
||||
|
|
||||
|
|
||||
|
####### |
||||
|
# APT # |
||||
|
####### |
||||
|
|
||||
|
# NOTE: users set apt-get and apt-cache with the $apt variable |
||||
|
|
||||
|
# If you have apt you are in luck. |
||||
|
$apt_get = (); |
||||
|
$apt_cache = (); |
||||
|
$sources = '/etc/apt/sources.list'; |
||||
|
$apt_sources = '/var/state/apt/lists'; |
||||
|
|
||||
|
######### |
||||
|
# PAGER # |
||||
|
######### |
||||
|
|
||||
|
# less is a nice pager, unless you like more! There is an option |
||||
|
# --nopager or -n. Pager is used for --help and swim called without any |
||||
|
# options. more comes from the required package util-linux, whereas |
||||
|
# less comes from a standard package called less. In the future there is |
||||
|
# a possiblity that a large percentage of swim may use an internal pager. |
||||
|
# less, more, or most or... |
||||
|
#$ENV{PAGER} = "/usr/bin/less"; # same RH |
||||
|
$ENV{PAGER} = "less"; |
||||
|
$pager = $ENV{PAGER}; |
||||
|
|
||||
|
|
||||
|
|
||||
|
################# |
||||
|
# SWIM PROGRAMS # |
||||
|
################# |
||||
|
|
||||
|
# This is replaced by the Makefile. |
||||
|
$pre="/usr"; # AUTOREPLACE done by Makefile, do not edit. |
||||
|
|
||||
|
# This is the hash making program fastswim. |
||||
|
$fastswim = "$pre/lib/SWIM/bin/fastswim"; |
||||
|
|
||||
|
# imswim in an alternative to fastswim for --lowmem |
||||
|
$imswim = "$pre/lib/SWIM/bin/imswim"; |
||||
|
|
||||
|
# This is the low memory program slowswim. |
||||
|
$slowswim = "$pre/lib/SWIM/bin/slowswim"; |
||||
|
|
||||
|
# This is the dir/file making program longswim. |
||||
|
$longswim = "$pre/lib/SWIM/bin/longswim"; |
||||
|
|
||||
|
############ |
||||
|
# TEMP DIR # |
||||
|
############ |
||||
|
|
||||
|
# If you want to set an alternative directory for the temporary files |
||||
|
# created when the databases are made, change here. You may want to make |
||||
|
# $tmp a RAM disk. See package loadlin for initrd documentation and an |
||||
|
# explanation for making such a disk. There is also |
||||
|
# /usr/src/kernel-source.version/Documentation. Whether this will speed |
||||
|
# things up is a subject of experimentation. |
||||
|
$tmp = '/tmp'; |
||||
|
|
||||
|
################## |
||||
|
# MAIN CONFFILES # |
||||
|
################## |
||||
|
|
||||
|
# if configuration files are not kept in /etc change this |
||||
|
# and set up the directories by hand. |
||||
|
|
||||
|
$swim_conf = '/etc/swim'; |
||||
|
|
||||
|
|
||||
|
############# |
||||
|
# UTILITIES # |
||||
|
############# |
||||
|
|
||||
|
|
||||
|
# This probably never will have to be changed. |
||||
|
$pwd = `pwd`; |
||||
|
chomp $pwd; |
||||
|
|
||||
|
# If the command split is somewhere else besides /usr/bin change this. |
||||
|
# The required package textutils provides this. |
||||
|
#my $splt = '/usr/bin/split'; # same RH |
||||
|
$splt = 'split'; |
||||
|
|
||||
|
# cat comes from the essential and required package textutils. |
||||
|
#my $cat = '/bin/cat'; # same RH |
||||
|
$cat = 'cat'; |
||||
|
|
||||
|
# This command also omes from the required and essential package textutils. |
||||
|
#my $sort = '/usr/bin/sort'; # same RH |
||||
|
$sort = 'sort'; |
||||
|
|
||||
|
# This program uses md5sum from the dpkg package, it can also use md5sum |
||||
|
# from the RH package. |
||||
|
#my $md5sum = '/usr/bin/md5sum'; # same RH |
||||
|
$md5sum = 'md5sum'; |
||||
|
|
||||
|
# If you want to view compressed files make sure this is correct. |
||||
|
# The required package gzip provides this. |
||||
|
#my $zcat = '/bin/zcat'; # same RH |
||||
|
$zcat = 'zcat'; |
||||
|
|
||||
|
# tar comes from the essential and required package tar. |
||||
|
#my $tar = '/bin/tar'; # same RH |
||||
|
$tar = 'tar'; |
||||
|
|
||||
|
# grep comes from the essential and required package grep. This seems |
||||
|
# to require a path. |
||||
|
$grep = '/bin/grep'; # same RH |
||||
|
|
||||
|
# gzip comes from the essential and required package gzip. |
||||
|
#my $gzip = "/bin/gzip"; # same RH |
||||
|
$gzip = "gzip"; |
||||
|
|
||||
|
# mount comes from the essential and required package mount. |
||||
|
#my $mount = '/bin/mount'; # same RH |
||||
|
#my $umount = '/bin/umount'; # same RH |
||||
|
$mount = 'mount'; |
||||
|
$umount = 'umount'; |
||||
|
|
||||
|
# If your file system isn't an ext2 filesystem, you may want to change |
||||
|
# this. mke2fs comes from the essential and required package e2fsprogs. |
||||
|
#my $mke2fs = '/sbin/mke2fs'; # same RH |
||||
|
$mke2fs = 'mke2fs'; |
||||
|
|
||||
|
# cp and mv from the essential and required package fileutils |
||||
|
#my $copy = '/bin/cp'; # same RH |
||||
|
$copy = 'cp'; |
||||
|
$mv = 'mv'; |
||||
|
|
||||
|
# Your system definitely has gcc if you have ar. gcc is a standard package |
||||
|
# in debian. |
||||
|
$gcc = 'gcc'; |
||||
|
|
||||
|
|
||||
|
###### |
||||
|
# FTP # |
||||
|
####### |
||||
|
|
||||
|
# Major mode --ftp and --file automates the download of Contents and Packages |
||||
|
# files. Even if you have apt installed, you may still want to download Packages |
||||
|
# from alternative architectures, and the Contents file for your own architecture |
||||
|
# or other architectures. If you want virtual and/or -ld capabilities you need |
||||
|
# the Contents file. You specify a list of ftp or file sites using urls (like |
||||
|
# apt). For your system's architecture specify the type deb, for other |
||||
|
# architectures specify deb(hyphen)architecture (ex: deb-alpha). Regardless of |
||||
|
# whether or not you specify an architecture, deb implies /dist* found under the |
||||
|
# base directory specified by the ftp url, except in the case of experimental, |
||||
|
# and to a degree non-us. minor mode --ftp, and --file will use the sites in this |
||||
|
# configuration as well, on a fifo (first in first out) basis, so choose the |
||||
|
# order of sites based on which are closest, most current, as well as fast. |
||||
|
|
||||
|
# IMPORTANT: It is a BIG MISTAKE to use the distributions name (slink,po,etc) |
||||
|
# anywhere in the sources list, or in swim's configuration file..in fact swim |
||||
|
# won't work properly, not to mention the fact that someday your favorite name |
||||
|
# will suddenly disappear. This is because swim thinks in terms of the real |
||||
|
# distribution name (stable,unstable,frozen, experimental). The problem goes |
||||
|
# like this - slink remains slink, but goes from unstable to frozen to stable. |
||||
|
# At first, using the distributions alias may seem appropriate, but the |
||||
|
# purpose of swim is to keep tabs on the dists, and not to ignore changes in |
||||
|
# the states, this also makes managing swim's databases much easier and |
||||
|
# intuitive...more about this later. |
||||
|
|
||||
|
# Fun experiments: Swim uses the naming conventions of apt, but leaves the |
||||
|
# Package files compressed in the DF directory. So you can always decompress |
||||
|
# the databases and move them to /var/state/apt/lists. This ofcourse assumes |
||||
|
# that the appropriate changes to the sources.list reflecting these Packages |
||||
|
# (need to be the same architecture as your system) existed before you |
||||
|
# update. (author needs to do this experiment :*) |
||||
|
|
||||
|
$ftp1 = "deb ftp://localhost/pub/debian unstable main contrib non-free non-US"; |
||||
|
$ftp2 = "deb ftp://localhost/pub/debian unstable main contrib non-free"; |
||||
|
$ftp3 = "deb ftp://localhost/pub/debian project/experimental/"; |
||||
|
@FTP = ($ftp1,$ftp2,$ftp3); |
||||
|
|
||||
|
# These next variables allow some characteristics of the ftp client |
||||
|
# to be altered. See Net::FTP for ways of altering some of these |
||||
|
# variables through the environment. |
||||
|
|
||||
|
$firewall = 0; |
||||
|
$port = 0; |
||||
|
$timeout = 120; |
||||
|
$debug = 0; |
||||
|
$passive = 0; |
||||
|
|
||||
|
|
||||
|
######################################## |
||||
|
# STUFF THAT NEVER NEEDS TO BE CHANGED # |
||||
|
######################################## |
||||
|
|
||||
|
# You will never need to change this unless for some weird reason all the |
||||
|
# files under dpkg are somewhere else (including /info*) , see --dbpath as |
||||
|
# an alternative if you decide to access or make the databases somewhere |
||||
|
# else. |
||||
|
$base = '/var/lib/dpkg'; |
||||
|
|
||||
|
# --dbpath takes care of this so don't touch. |
||||
|
$parent = '/'; |
||||
|
$library = '/var/lib/dpkg'; |
||||
|
|
||||
|
|
||||
|
############################# |
||||
|
# LOAD CUSTOM CONFIGURATION # |
||||
|
############################# |
||||
|
|
||||
|
|
||||
|
# Here we load in the customized configuration which override the defaults |
||||
|
# Might as well use do, let the world learn Perl ... compare this to apt's |
||||
|
# configuation file with scopes. Swim's sources.list file (/etc/swim/swimz.list), |
||||
|
# will be grabbed at SWIM::Apt and SWIM::Qftp if it exists. |
||||
|
|
||||
|
do "$swim_conf/swimrc"; |
||||
|
do "$ENV{HOME}/.swim/swimrc"; |
||||
|
if ((defined $dpkg && !defined $dpkg_deb) || |
||||
|
(!defined $dpkg && defined $dpkg_deb)) { |
||||
|
print "swim: need to give both \$dpkg and \$dpkg_deb a value if you want dpkg\n"; |
||||
|
exit; |
||||
|
} |
||||
|
if (defined $package_tool) { |
||||
|
if ($package_tool =~ /ar/) { |
||||
|
$ar = $ar; |
||||
|
} |
||||
|
else { |
||||
|
$dpkg = 'dpkg'; |
||||
|
$dpkg_deb = 'dpkg-deb'; |
||||
|
undef $ar; |
||||
|
} |
||||
|
} |
||||
|
if (defined $apt) { |
||||
|
$apt_get = 'apt-get'; |
||||
|
$apt_cache = 'apt-cache'; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
############################### |
||||
|
# MAKE ANY NEEDED DIRECTORIES # |
||||
|
############################### |
||||
|
|
||||
|
# make sure all the appropriate directories are made |
||||
|
if (!-d $default_directory) { |
||||
|
if (-e $default_directory) { |
||||
|
print "swim: can not create default directory because a file exists\n"; |
||||
|
exit; |
||||
|
} |
||||
|
my @DRD = split(m,/,,$default_directory); |
||||
|
my $placement = "/"; |
||||
|
for (1 .. $#DRD) { |
||||
|
$_ == 1 ? ($placement = "/$DRD[$_]") |
||||
|
: ($placement = $placement . "/" . $DRD[$_]); |
||||
|
-d $placement or mkdir("$placement",0755); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
if (!-d "$default_directory$default_root_directory") { |
||||
|
my @DRD = split(m,/,,$default_root_directory); |
||||
|
print "swim: debian must be the final directory before dists\n" |
||||
|
if $DRD[$#DRD] ne "debian"; |
||||
|
exit if $DRD[$#DRD] ne "debian"; |
||||
|
my $placement = "/"; |
||||
|
for (1 .. $#DRD) { |
||||
|
$_ == 1 ? ($placement = "/$DRD[$_]") |
||||
|
: ($placement = $placement . "/" . $DRD[$_]); |
||||
|
unless (-d "$default_directory$placement") { |
||||
|
mkdir("$default_directory$placement",0755) |
||||
|
or die "swim: could not create root default directory\n"; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
# Makefile will make sure these directories exist, unless for some strange |
||||
|
# reason you have to change them. |
||||
|
|
||||
|
if (!-d $library) { |
||||
|
mkdir($library,0755) or die "Couldn't create default directory\n"; |
||||
|
} |
||||
|
|
||||
|
if (!-d $base) { |
||||
|
mkdir($base,0755) or die "Couldn't create default directory\n"; |
||||
|
} |
||||
|
|
||||
|
if (!-d $swim_conf) { |
||||
|
mkdir($swim_conf,0666) or die "Couldn't create configuration file directory, |
||||
|
please make the directories which are needed.\n"; |
||||
|
} |
||||
|
|
||||
|
1; |
||||
|
|
||||
|
__END__ |
||||
|
|
||||
|
=head1 NAME |
||||
|
|
||||
|
swimrc - swim configuration file |
||||
|
|
||||
|
=head1 DESCRIPTION |
||||
|
|
||||
|
B<swimrc> is the configuartion file for swim allowing many default values |
||||
|
to be set so that they do not have to be mentioned on the command line. |
||||
|
Swimrc interacts directly with Perl allowing a wide variety of variables |
||||
|
found in B<SWIW::Conf> to be altered. |
||||
|
|
||||
|
=cut |
||||
|
|
||||
|
=head1 USAGE |
||||
|
|
||||
|
Values for variable can be altered for B<swim> by assigning different |
||||
|
values enclosed in quotes or quoted whitespace (qw()), and ended with a |
||||
|
semi-colon. |
||||
|
|
||||
|
$variable = "value"; |
||||
|
$variable = "qw(value1 value2 ..)"; |
||||
|
|
||||
|
=head1 VARIABLES |
||||
|
|
||||
|
This is a list of variables with explanations. The default values for |
||||
|
B<swim> are shown. |
||||
|
|
||||
|
=head2 OUTPUT VARIABLE |
||||
|
|
||||
|
$my_number can be changed to how many lines you would like "swim -qf <>" |
||||
|
to print out, before the program asks for C<-t> or C<--total>. Exception: |
||||
|
If C<-i> is used in the query and there is more than one package then the |
||||
|
total will be presented. |
||||
|
|
||||
|
Hint: C<-t> can be used with all the various C<--scripts> family members |
||||
|
to view the title of the script file regardless of this variable setting, |
||||
|
and if C<-t> has to be used, the titles will be displayed, which makes |
||||
|
sense. |
||||
|
|
||||
|
B<$my_number = 23;> |
||||
|
|
||||
|
=head2 HISTORY |
||||
|
|
||||
|
This is a shell-like history kept in relation to searches and the most |
||||
|
recent edit when C<--stdin> is used. |
||||
|
|
||||
|
B<$HISTORY = 10;> |
||||
|
|
||||
|
=head2 AR or DPKG? |
||||
|
|
||||
|
Debian packages are ar archives. If you are using a Debian Distribution |
||||
|
assign "dpkg" to $package_tool, otherwise assign "ar" to $package_tool. |
||||
|
|
||||
|
B<$package_tool = "/usr/bin/ar";> |
||||
|
|
||||
|
=head2 APT |
||||
|
|
||||
|
B<Swim> does not assign a value for apt. To use C<--apt> and C<-xyz> |
||||
|
assign $apt the value "yes". |
||||
|
|
||||
|
Example: B<$apt = "yes";> |
||||
|
|
||||
|
=head2 PAGER |
||||
|
|
||||
|
less is a nice pager, unless you like more! Pager is used for C<--help> |
||||
|
and B<swim> called without any options. There is an option C<--nopager> or |
||||
|
C<-n>. more comes from the required package util-linux, whereas less |
||||
|
comes from a standard package called less. Values: "less", "more", or |
||||
|
"most" or... |
||||
|
|
||||
|
B<$ENV{PAGER} = "less";> |
||||
|
|
||||
|
=head2 NOT-INSTALLED VARIABLES |
||||
|
|
||||
|
Assign values for $architecture and/or $distribution to avoid having to |
||||
|
use C<--arch> and C<--dists> everytime the not-installed databases are |
||||
|
accessed with C<-n> or made or altered. |
||||
|
|
||||
|
Architectures are always being added so check with Debian to find a list. |
||||
|
There is I<alpha, arm, hurd-i386 (alternative kernel to linux), i386, |
||||
|
m68k, powerpc, sparc>. Just use the arch found after the hyphen in the |
||||
|
Contents-(arch) file. |
||||
|
|
||||
|
B<$architecture = "i386";> |
||||
|
|
||||
|
The distribution can be either I<stable, unstable, frozen, or experimental |
||||
|
(rare)>. These represent the state of development that the packages are |
||||
|
under. The unstable distribution can have lot's of changes within a very |
||||
|
short time period, and frozen may or may not be available. |
||||
|
|
||||
|
B<$distribution = "unstable";> |
||||
|
|
||||
|
Distributions are divided into sections. These sections were called |
||||
|
distributions in the version 2.4.1.0 packaging manual, because they were |
||||
|
at one time separate distributions, but this has since changed. |
||||
|
|
||||
|
You can determine which of the sections I<main, non-free, contrib or |
||||
|
non-US> to pull out of the Contents file if you don't want to use |
||||
|
C<--main>, C<--contrib>, C<--non-free>, and C<--non-us> to selectively |
||||
|
pick the sections. |
||||
|
|
||||
|
For efficiency, you should choose the sections which you will be pulling |
||||
|
out of the Packages file(s) being targetted. |
||||
|
|
||||
|
Rule: Use "non-US" not "non-us". |
||||
|
|
||||
|
B<@user_defined_section = qw(main contrib non-free non-US);> |
||||
|
|
||||
|
=head2 DF LOCATION |
||||
|
|
||||
|
A little philosophy: B<swim> was developed for maximum versatility, so |
||||
|
whether you are just interested in researching, and keeping tabs on the |
||||
|
newest packages, or maintaining a Debian virtual distribution on a |
||||
|
non-Debian distribution, or you are a using B<swim> for distribution |
||||
|
development, B<swim> provides a way. |
||||
|
|
||||
|
The next two variables determine the location of the DF (default |
||||
|
directory/file system) |
||||
|
|
||||
|
The default directory keeps track of Contents and/or Packages databases |
||||
|
retrieved with --ftp. The Contents and Packages databases and Release |
||||
|
file are give names specific to the distribution and architectures they |
||||
|
represent using the naming convention found in apt's sources directory. |
||||
|
You also have the freedom not to use the default directory, in which case |
||||
|
swim will still do the renaming and keeping track of the mtime, but you |
||||
|
will have to remember where you put the files. |
||||
|
|
||||
|
B<$default_directory = '/root/.swim';> |
||||
|
|
||||
|
The default root directory (DRD) is the key to easy management of binary |
||||
|
packages, source, dsc, and diff files received from --ftp, and provides an |
||||
|
easy way to put together a personalized distribution. This directory can |
||||
|
be a real ftp site on your computer, or put wherever else you are |
||||
|
allowed to have directories. The DRD is always placed below the value |
||||
|
assigned to $default_directory. According to the previous assignment to |
||||
|
$default_directory, if the DRD is "/pub/a/debian" then the full path |
||||
|
would be "/root/.swim/pub/a/debian". |
||||
|
|
||||
|
Example: When a package is downloaded it will be placed in |
||||
|
dists/distribution/section/architecture/subject below the DRD. |
||||
|
|
||||
|
Rule: debian must be the final directory before dists, this is because |
||||
|
other distributions are placed alongside debian, like debian-non-US or |
||||
|
personal (specialized distribution). |
||||
|
|
||||
|
B<$default_root_directory = '/pub/debian';> |
||||
|
|
||||
|
Because you may be using a real ftp site, this variable allows you to |
||||
|
determine what permissions B<swim> will assign for directories it creates |
||||
|
below the DRD. |
||||
|
|
||||
|
B<$permission = '0755';> |
||||
|
|
||||
|
=head2 TEMPORARY DIRECTORY |
||||
|
|
||||
|
If you want to set an alternative directory for the temporary files |
||||
|
created when the databases are made, change here. You may want to make |
||||
|
$tmp a RAM disk. See package loadlin for initrd documentation and an |
||||
|
explanation for making such a disk. There is also documentation in |
||||
|
/usr/src/kernel-source.version/Documentation. Whether this will speed |
||||
|
things up is a subject of experimentation. |
||||
|
|
||||
|
B<$tmp = "/tmp";> |
||||
|
|
||||
|
=head2 FTP |
||||
|
|
||||
|
You can alter the Firewall, Port, Timeout, Debug and Passive |
||||
|
characteristics of the ftp client as defined in Net::FTP(3pm) by providing |
||||
|
arguments to these variables. All variables but $timeout are set to untrue |
||||
|
by default. |
||||
|
|
||||
|
$firewall = 0; (FTP firewall machine name) |
||||
|
$port = 0; (defaults to 23) |
||||
|
$timeout = 120; (120 seconds) |
||||
|
$debug = 0; (1 will turn on STDERR) |
||||
|
$passive = 0; (1 will enable) |
||||
|
|
||||
|
=head1 OTHER VARIABLES |
||||
|
|
||||
|
see SWIM::Conf |
||||
|
|
||||
|
=head1 FILES |
||||
|
|
||||
|
/etc/swim/swimrc |
||||
|
~/.swim/swimrc |
||||
|
|
||||
|
=head1 SEE ALSO |
||||
|
|
||||
|
swim(8), Net::FTP(3pm) |
||||
|
|
||||
|
=head1 BUGS |
||||
|
|
||||
|
Send directly to mttrader@access.mountain.net. |
||||
|
|
||||
|
=head1 AUTHOR |
||||
|
|
||||
|
Jonathan D. Rosenbaum <mttrader@access.mountain.net> |
||||
|
|
||||
|
=head1 COPYRIGHT |
||||
|
|
||||
|
|
||||
|
Copyright (c) 1999 Jonathan Rosenbaum. All rights reserved. This program |
||||
|
is free software; you can redistribute it and/or modify it under the GPL. |
||||
|
|
||||
|
=cut |
@ -0,0 +1,51 @@ |
|||||
|
To install swim, become root and type "make install". |
||||
|
|
||||
|
To install extra and important documentation, type "make installdoc". |
||||
|
|
||||
|
To remove, type "make remove". |
||||
|
|
||||
|
Pod documentation is found in Conf.pm and swim.pod if you want to make |
||||
|
different types of documention using pod translators. There are SGML |
||||
|
documents conforming to the debiandoc DTD for swimrc and swim which can be |
||||
|
converted using tools from the debiandoc-sgml package. |
||||
|
|
||||
|
(The modules mentioned below can be located at CPAN at www.perl.com.) |
||||
|
|
||||
|
Some distributions may require this module for ftp capabilities. |
||||
|
|
||||
|
Net::FTP from libnet-perl |
||||
|
|
||||
|
This module provides readline libraries. There are other similiar modules |
||||
|
which also work with Perl's Term::ReadLine(3pm). |
||||
|
|
||||
|
Term::ReadLine::Gnu from libterm-readline-gnu-perl or |
||||
|
Term::ReadLine::Perl from libterm-readline-perl-perl |
||||
|
|
||||
|
Also read QUICKSTART.text or QUICKSTART.html for additional information. |
||||
|
_________________________________________________________________ |
||||
|
|
||||
|
Alternative Installation |
||||
|
|
||||
|
The modules are put into /usr/lib/perl5/SWIM because this is in Perl's |
||||
|
@INC path, and does not violate Debian's Policy, on the other hand the |
||||
|
modules are rather specific to swim, although they definitely could be |
||||
|
used for other things. To put it in /usr/lib meant either using 'use lib |
||||
|
"/usr/lib"' or pushing the alternative directory into @INC doing a |
||||
|
'BEGIN{}', or setting the Environment variable PERL5LIB. The first method |
||||
|
slowed swim down, the second method caused a bad bug in SWIM::Deb, and the |
||||
|
third method involved trying to make a universe of shells happy, but this |
||||
|
is the best approach for an alternative @INC path. |
||||
|
|
||||
|
That's why there is Makefile.alternative. If you already did a 'make |
||||
|
install', now do a 'make remove'. Change the name of Makefile, and change |
||||
|
Makefile.alternative's name to Makefile. You can change PREFIX in this |
||||
|
Makefile to /usr/local if you want to. Follow the same steps as for the |
||||
|
original Makefile, but add one more step, set the Environment vaiable |
||||
|
PERL5LIB to the directory where the modules are. If the PREFIX was not |
||||
|
changed, and you are using a bash shell then 'export PERL5LIB=/usr/lib'. |
||||
|
|
||||
|
This alternative Makefile uses the tradition /usr/doc, /usr/man |
||||
|
directories whereas the other Makefile uses /usr/share/doc and |
||||
|
/usr/share/man, this is because of Debian's adherence to the next |
||||
|
generation fsstnd. |
||||
|
|
@ -0,0 +1,76 @@ |
|||||
|
# Use Makefile.alternative if you want the modules in /usr or /usr/local,
|
||||
|
# not in /usr/lib/perl5, see INSTALL.
|
||||
|
|
||||
|
PREFIX=/usr |
||||
|
|
||||
|
all: |
||||
|
|
||||
|
clean: |
||||
|
-rm build |
||||
|
-rm *.bak |
||||
|
|
||||
|
install: |
||||
|
install -d $(DESTDIR)/var/lib/dpkg |
||||
|
install -d $(DESTDIR)/$(PREFIX)/sbin |
||||
|
cp -a swim $(DESTDIR)/$(PREFIX)/sbin/swim |
||||
|
install -d $(DESTDIR)/$(PREFIX)/lib/perl5/SWIM |
||||
|
cp -f Conf.pm $(DESTDIR)/$(PREFIX)/lib/perl5/SWIM/Conf.pm |
||||
|
cp -fa lib/* $(DESTDIR)/$(PREFIX)/lib/perl5/SWIM |
||||
|
install -d $(DESTDIR)/$(PREFIX)/lib/SWIM |
||||
|
cp -fa bin/* $(DESTDIR)/$(PREFIX)/lib/SWIM |
||||
|
install -d $(DESTDIR)/$(PREFIX)/share/man/man8 |
||||
|
cp -f swim.8 $(DESTDIR)/$(PREFIX)/share/man/man8 |
||||
|
install -d $(DESTDIR)/$(PREFIX)/share/man/man5 |
||||
|
cp -f swimrc.5 $(DESTDIR)/$(PREFIX)/share/man/man5 |
||||
|
install -d $(DESTDIR)/usr/share/doc/swim/swim.html |
||||
|
cp -fa swim.html/* $(DESTDIR)/usr/share/doc/swim/swim.html |
||||
|
install -d $(DESTDIR)/usr/share/doc/swim/swimrc.html |
||||
|
cp -fa swimrc.html/* $(DESTDIR)/usr/share/doc/swim/swimrc.html |
||||
|
cp -f QUICKSTART.html $(DESTDIR)/usr/share/doc/swim |
||||
|
cp -f REQUIREMENTS.html $(DESTDIR)/usr/share/doc/swim |
||||
|
cp -f swim_by_example.html $(DESTDIR)/usr/share/doc/swim |
||||
|
install -d $(DESTDIR)/usr/share/doc/swim/examples |
||||
|
cp -fa examples/* $(DESTDIR)/usr/share/doc/swim/examples |
||||
|
install -d $(DESTDIR)/etc/swim |
||||
|
cp -f swimz.list $(DESTDIR)/etc/swim |
||||
|
cp -f swimrc $(DESTDIR)/etc/swim |
||||
|
|
||||
|
installdoc: |
||||
|
install -d $(DESTDIR)/$(PREFIX)/share/doc/swim |
||||
|
cp -a QUICKSTART.text $(DESTDIR)/$(PREFIX)/share/doc/swim |
||||
|
cp -a REQUIREMENTS.text $(DESTDIR)/$(PREFIX)/share/doc/swim |
||||
|
cp -a swim_by_example.html $(DESTDIR)/$(PREFIX)/share/doc/swim |
||||
|
cp -a THEMES $(DESTDIR)/$(PREFIX)/share/doc/swim |
||||
|
cp -a TODO $(DESTDIR)/$(PREFIX)/share/doc/swim |
||||
|
cp -a BUGS $(DESTDIR)/$(PREFIX)/share/doc/swim |
||||
|
cp -a TODO $(DESTDIR)/$(PREFIX)/share/doc/swim |
||||
|
cp -a COPYING $(DESTDIR)/$(PREFIX)/share/doc/swim |
||||
|
cp -a contact_and_website $(DESTDIR)/$(PREFIX)/share/doc/swim |
||||
|
cp -a changelog $(DESTDIR)/$(PREFIX)/share/doc/swim |
||||
|
cp -a swim.text $(DESTDIR)/$(PREFIX)/share/doc/swim |
||||
|
cp -a swimrc.text $(DESTDIR)/$(PREFIX)/share/doc/swim |
||||
|
|
||||
|
remove: |
||||
|
rm $(PREFIX)/lib/perl5/SWIM/* |
||||
|
rmdir $(PREFIX)/lib/perl5/SWIM |
||||
|
rm $(PREFIX)/sbin/swim |
||||
|
rm /usr/share/doc/swim/swim.html/* |
||||
|
rmdir /usr/share/doc/swim/swim.html |
||||
|
rm /usr/share/doc/swim/swimrc.html/* |
||||
|
rmdir /usr/share/doc/swim/swimrc.html |
||||
|
rm /usr/share/doc/swim/examples/* |
||||
|
rmdir /usr/share/doc/swim/examples |
||||
|
rm /usr/share/doc/swim/* |
||||
|
rmdir /usr/share/doc/swim |
||||
|
rm $(PREFIX)/share/man/man5/swimrc.5 |
||||
|
rm $(PREFIX)/share/man/man8/swim.8 |
||||
|
rm $(PREFIX)/lib/SWIM/* |
||||
|
rmdir $(PREFIX)/lib/SWIM |
||||
|
|
||||
|
debian: |
||||
|
dpkg-buildpackage -tc -rfakeroot |
||||
|
|
||||
|
|
||||
|
dist: debian localdist stampede rpm |
||||
|
|
||||
|
.PHONY: debian |
@ -0,0 +1,73 @@ |
|||||
|
# Set this to wherever you want swim to install. Eg, /usr/local or /usr
|
||||
|
PREFIX=/usr |
||||
|
|
||||
|
all: |
||||
|
|
||||
|
clean: |
||||
|
-rm build |
||||
|
-rm *.bak |
||||
|
|
||||
|
install: |
||||
|
install -d $(DESTDIR)/var/lib/dpkg |
||||
|
install -d $(DESTDIR)/$(PREFIX)/sbin |
||||
|
cp -a swim $(DESTDIR)/$(PREFIX)/sbin/swim |
||||
|
install -d $(DESTDIR)/$(PREFIX)/lib/SWIM/bin |
||||
|
perl -pe '$$_="\$$pre=\"$(PREFIX)\";\n" \
|
||||
|
if /AUTOREPLACE/' Conf.pm.alternative \
|
||||
|
> $(DESTDIR)/$(PREFIX)/lib/SWIM/Conf.pm |
||||
|
chmod 644 $(DESTDIR)/$(PREFIX)/lib/SWIM/Conf.pm |
||||
|
cp -fa lib/* $(DESTDIR)/$(PREFIX)/lib/SWIM |
||||
|
cp -fa bin/* $(DESTDIR)/$(PREFIX)/lib/SWIM/bin |
||||
|
install -d $(DESTDIR)/$(PREFIX)/man/man8 |
||||
|
cp -f swim.8 $(DESTDIR)/$(PREFIX)/man/man8 |
||||
|
install -d $(DESTDIR)/$(PREFIX)/man/man5 |
||||
|
cp -f swimrc.5 $(DESTDIR)/$(PREFIX)/man/man5 |
||||
|
install -d $(DESTDIR)/usr/doc/swim/swim.html |
||||
|
cp -fa swim.html/* $(DESTDIR)/usr/doc/swim/swim.html |
||||
|
install -d $(DESTDIR)/usr/doc/swim/swimrc.html |
||||
|
cp -fa swimrc.html/* $(DESTDIR)/usr/doc/swim/swimrc.html |
||||
|
cp -f QUICKSTART.html $(DESTDIR)/usr/doc/swim |
||||
|
cp -f REQUIREMENTS.html $(DESTDIR)/usr/doc/swim |
||||
|
cp -f swim_by_example.html $(DESTDIR)/usr/doc/swim |
||||
|
install -d $(DESTDIR)/usr/doc/swim/examples |
||||
|
cp -fa examples/* $(DESTDIR)/usr/doc/swim/examples |
||||
|
install -d $(DESTDIR)/etc/swim |
||||
|
cp -f swimz.list $(DESTDIR)/etc/swim |
||||
|
cp -f swimrc $(DESTDIR)/etc/swim |
||||
|
|
||||
|
installdoc: |
||||
|
install -d $(DESTDIR)/$(PREFIX)/doc/swim |
||||
|
cp -a QUICKSTART.text $(DESTDIR)/$(PREFIX)/doc/swim |
||||
|
cp -a REQUIREMENTS.text $(DESTDIR)/$(PREFIX)/doc/swim |
||||
|
cp -a swim_by_example.html $(DESTDIR)/$(PREFIX)/doc/swim |
||||
|
cp -a THEMES $(DESTDIR)/$(PREFIX)/doc/swim |
||||
|
cp -a TODO $(DESTDIR)/$(PREFIX)/doc/swim |
||||
|
cp -a BUGS $(DESTDIR)/$(PREFIX)/doc/swim |
||||
|
cp -a TODO $(DESTDIR)/$(PREFIX)/doc/swim |
||||
|
cp -a COPYING $(DESTDIR)/$(PREFIX)/doc/swim |
||||
|
cp -a contact_and_website $(DESTDIR)/$(PREFIX)/doc/swim |
||||
|
cp -a changelog $(DESTDIR)/$(PREFIX)/doc/swim |
||||
|
cp -a swim.text $(DESTDIR)/$(PREFIX)/doc/swim |
||||
|
cp -a swimrc.text $(DESTDIR)/$(PREFIX)/doc/swim |
||||
|
remove: |
||||
|
rm -rf $(PREFIX)/lib/SWIM/* |
||||
|
rmdir $(PREFIX)/lib/SWIM |
||||
|
rm $(PREFIX)/sbin/swim |
||||
|
rm /usr/doc/swim/swim.html/* |
||||
|
rmdir /usr/doc/swim/swim.html |
||||
|
rm /usr/doc/swim/swimrc.html/* |
||||
|
rmdir /usr/doc/swim/swimrc.html |
||||
|
rm /usr/doc/swim/examples/* |
||||
|
rmdir /usr/doc/swim/examples |
||||
|
rm /usr/doc/swim/* |
||||
|
rmdir /usr/doc/swim |
||||
|
rm $(PREFIX)/man/man5/swimrc.5 |
||||
|
rm $(PREFIX)/man/man8/swim.8 |
||||
|
|
||||
|
debian: |
||||
|
dpkg-buildpackage -tc -rfakeroot |
||||
|
|
||||
|
|
||||
|
dist: debian localdist stampede rpm |
||||
|
|
||||
|
.PHONY: debian |
@ -0,0 +1,114 @@ |
|||||
|
Database Structure |
||||
|
|
||||
|
note: what's below was written for readability, not to |
||||
|
indicate complex structures, all databases are normal hashes. stripped |
||||
|
implies that the control field was removed, but the data afterwards kept. |
||||
|
|
||||
|
Structure of statusindex.deb |
||||
|
|
||||
|
1). Initially made in SWIM::DB_Init::database |
||||
|
2). Updated in SWIM::DB::db |
||||
|
3). $sb(packagename) = qw(packagename_version group priority |
||||
|
status(separated with :)); |
||||
|
All fields stripped |
||||
|
|
||||
|
Structure of nstatusindex-arch-dists.deb |
||||
|
|
||||
|
1). Initally made in SWIM::NDB_Init::not_installed |
||||
|
2). Updated in SWIM::NDB::update_packages_ndb |
||||
|
3). $nsb(packagename) = qw(packagename_version group priority); |
||||
|
$nsb{"/."} = qw(packagename_version ...); |
||||
|
All fields stripped |
||||
|
|
||||
|
|
||||
|
Structure of packages.deb |
||||
|
|
||||
|
1). Initally made in SWIM::DB_Init::database |
||||
|
2). Updated in SWIM::DB::db |
||||
|
3). %db = [ @name => (packagename packagename_version ...), |
||||
|
@Tdescriptions => (packagename_version format_info ...), |
||||
|
@conf => (packagename_versionCONF |
||||
|
every_indented_line_after_Conffiles ...), |
||||
|
@REPLACE => (packagename_version(with PRE, DEP, REC, SUG, |
||||
|
CON, PRO, or REP appended) |
||||
|
package_relationship_field (unstripped) ...) |
||||
|
] |
||||
|
|
||||
|
Structure of npackages-arch-dists.deb |
||||
|
|
||||
|
1). Initially made in SWIM::NDB_Init::not_installed |
||||
|
2). Updated in SWIM::NDB::update_packages_ndb |
||||
|
3). %ndb = [ @name => (packagename packagename_version ...), |
||||
|
@Tdescriptions => (packagename_version format_info ...), |
||||
|
@conf => (empty), |
||||
|
@REPLACE => (packagename_version(with PRE, DEP, REC, SUG, |
||||
|
CON, PRO, REP, MD, and FN appended) |
||||
|
package_relationship_field (unstripped) ...), |
||||
|
@FILENAME => (packagename_versionFN Filename_field(stripped) ...), |
||||
|
@MD5SUM => (packagename_versionMD |
||||
|
package_MD5_checksum(stripped) ...), |
||||
|
@revision => (packagename_versionMD(this comes from the |
||||
|
Filename field) "packagename_versionMD REVISION" |
||||
|
(this time the version comes from the Version |
||||
|
field) ...) |
||||
|
] |
||||
|
|
||||
|
The revision field is unusual and occurs in the experimental distribution. |
||||
|
The hash is used by -p so that the version can be figured out. (check |
||||
|
"revision: situation" in SWIM::Deb). |
||||
|
|
||||
|
Structure of groupindex.deb |
||||
|
|
||||
|
1). Initally made in SWIM::DB_Init::database |
||||
|
2). Updated in SWIM::DB::db |
||||
|
3). $gb(group) = qw(packagenames ......) group stripped from Section: |
||||
|
|
||||
|
Structure of ngroupindex-arch-dists.deb |
||||
|
|
||||
|
1). Initially made in SWIM::NDB_Init::not_installed |
||||
|
2). Updated in SWIM::NDB::update_packages_ndb |
||||
|
3). $ngb = qw(packagenames ......) group stripped from Section: |
||||
|
|
||||
|
Structure of searchindex.deb and dirindex.deb |
||||
|
|
||||
|
1). When SWIM::DB_Init::database finishes SWIM::DB_Init::md begins. |
||||
|
This writes @dpackage to transfer.deb, which is processed by either |
||||
|
fastswim (filedir -> big and long) or imswim (which is like longswim, |
||||
|
which produces one large file - filedir.deb), and slowswim (big and |
||||
|
long) into the two files big.debian and long.debian and then the |
||||
|
databases are finished by SWIM::MD::process_md(). |
||||
|
2). Rebuilt by SWIM::DB::rebuildflatdb |
||||
|
3). searchindex.deb = /path/filename\n ...... (1 package) |
||||
|
dirindex.deb = /path/dir\n ...... (> 1 package) |
||||
|
|
||||
|
Structure of nsearchindex-arch-dists.deb and ndirindex-arch-dists.deb |
||||
|
|
||||
|
1). After SWIM::NDB_Init::initndb runs SWIM::NDB_Init::not_installed, |
||||
|
SWIM::NDB_Init::nmd runs longswim which produces |
||||
|
filedir.deb, then initndb runs slowswim producing big.debian and |
||||
|
long.debian. Then the database(s) are finished by |
||||
|
SWIM::MD::prcess_md. |
||||
|
2). |
||||
|
3). nsearchindex-arch-dists.deb = /path/filename\n ...... (1 package) |
||||
|
ndirindex-arch-dists.deb = /path/dir\n ...... (> 1 package) |
||||
|
Note: nsearch* includes elements which pertain to only one |
||||
|
package, this generally implies files, not directories, however |
||||
|
the ni often has more than one package sharing a file, so its |
||||
|
placed into ndir* (this would be rare with an i system). |
||||
|
SWIM::Search::search processes these two files differently, |
||||
|
which is more effecient for the much larger nsearch*, for this |
||||
|
reason you can't merge the two databases together. |
||||
|
|
||||
|
Structure of ncontentsindex-arch-dists.deb. |
||||
|
|
||||
|
1). A compressed Contents database, no alterations (originally the headers |
||||
|
were removed, but this is a waste of time.) If the FDB (flat database |
||||
|
option if given) SWIM::Library::compress_contents is called from |
||||
|
initndb(), otherwise longswim called from SWIM::NDB_Init::nmd |
||||
|
copies and compresses. The longswim method compresses, but |
||||
|
compress_contents does a cp (not -a). In both cases the header |
||||
|
removal has been depreciated. The important thing is that the utime |
||||
|
remains the same. |
||||
|
2). The new Contents database is copied (utime) and renamed via |
||||
|
compress_contents called from SWIM::NDB. |
||||
|
3). Contents format |
@ -0,0 +1,206 @@ |
|||||
|
<html> |
||||
|
<head><title>Quickstart</title></head> |
||||
|
<body text="#000000" bgcolor="#FFFFFF" link="#0000EF" vlink="#51188E" |
||||
|
alink="#FF0000"> |
||||
|
|
||||
|
<br><br><br> |
||||
|
|
||||
|
<h1 align=center>QUICKSTART</h1> |
||||
|
|
||||
|
<br><br> |
||||
|
|
||||
|
<h5>READ THE <A HREF="REQUIREMENTS.html">REQUIREMENTS</A></h5> |
||||
|
|
||||
|
Now you can skip the next three steps if you have an installed Debian |
||||
|
distribution and you are in a hurry for a demonstration, but you will miss |
||||
|
out on swim's more awesome capabilities. With that said..... |
||||
|
|
||||
|
<p> |
||||
|
<b>FIRST GET SWIMRC PREPARED</b> |
||||
|
|
||||
|
<p> Edit the swimrc configution file, you should read <A |
||||
|
HREF="swimrc.html/index.html">swimrc(5)</A>, but I'll ask you some |
||||
|
question right now. You can find swimrc in /etc/swim, and swimrc can be |
||||
|
placed in your home directory in the subdirectory .swim. Entries in the |
||||
|
home directory swimrc override ones in /etc/swim. |
||||
|
|
||||
|
<p> |
||||
|
Are you using an installed Debian system? If so, you almost definitely |
||||
|
have dpkg installed. So uncomment this line in /etc/swim/swimrc by |
||||
|
removing the pound sign. |
||||
|
|
||||
|
<p> |
||||
|
<code>$package_tool = "/usr/bin/dpkg";</code> |
||||
|
|
||||
|
<p>otherwise |
||||
|
|
||||
|
<p> |
||||
|
<code>$package_tool = "/usr/bin/ar";</code> |
||||
|
|
||||
|
<p> |
||||
|
Do you have the apt package installed? Configure this, or -xyz will not |
||||
|
work. |
||||
|
|
||||
|
<p> |
||||
|
<code>$apt = "yes";</code> |
||||
|
|
||||
|
<p> |
||||
|
Now you need to decide what architecture you would like to be swim's |
||||
|
default value when you download, build, and query the not-installed |
||||
|
databases. |
||||
|
|
||||
|
<p> |
||||
|
What flavor, do you want alpha, arm, hurd-i386, i386, m68k, powerpc, |
||||
|
or sparc? (more coming :*) I decided on ..... |
||||
|
|
||||
|
<p> |
||||
|
<code>$architecture = "i386";</code> |
||||
|
|
||||
|
<p> |
||||
|
What kind of distribution do you want to be your default? stable, |
||||
|
unstable, frozen, or experimental (rare) I like the ever changing ... |
||||
|
|
||||
|
<p> |
||||
|
<code>$distribution = "unstable";</code> |
||||
|
|
||||
|
<p> |
||||
|
Decide which sections you want? You can have this |
||||
|
|
||||
|
<p> |
||||
|
<code>@user_defined_section = qw(main contrib non-free);</code> |
||||
|
|
||||
|
<p> |
||||
|
or this. |
||||
|
|
||||
|
<p> |
||||
|
<code>@user_defined_section = qw(main);</code> |
||||
|
|
||||
|
<p> |
||||
|
or ..... |
||||
|
|
||||
|
<p> |
||||
|
<b>SECOND GET SWIMZ.LIST PREPARED</b> |
||||
|
|
||||
|
<p> Now grab a copy of the <A |
||||
|
HREF="http://www.debian.org/misc/README.mirrors">README.mirrors</A> from |
||||
|
http://www.debian.org/misc/README.mirrors", |
||||
|
you will need this to set-up the configuration file /etc/swim/swimz.list. |
||||
|
|
||||
|
<p> If your using apt make sure to read <A |
||||
|
HREF="swim.html/index.html">swim(8)</A> to get the nitty gritty on how you |
||||
|
can synchronize swim along with apt :*} using <A |
||||
|
HREF="swim.html/ch-important.html#s5.6">swimz.list</A>. |
||||
|
|
||||
|
<p> |
||||
|
Humm, you found a site which has the distribution you want, and you know |
||||
|
which section you want, and you are happy knowing about packages which can |
||||
|
install on the architecture you computer happens to have. |
||||
|
|
||||
|
<p> |
||||
|
So what site is that? |
||||
|
|
||||
|
<p> |
||||
|
<code>deb ftp://ftp.swimz.org</code> |
||||
|
|
||||
|
<p> |
||||
|
What was the directory you happened to notice in the README.mirrors page? |
||||
|
|
||||
|
<p> |
||||
|
<code>deb ftp://ftp.swimz.org/pub/debian</code> |
||||
|
|
||||
|
<p> |
||||
|
What distribution did you want? Note: You won't want to use the Release |
||||
|
code name for the distribution, see |
||||
|
<A HREF="swim.html/ch-important.html#s5.6">swimz.list</A>. |
||||
|
|
||||
|
<p> |
||||
|
<code>deb ftp://ftp.swimz.org/pub/debian unstable</code> |
||||
|
|
||||
|
<p> |
||||
|
What sections did you want? |
||||
|
|
||||
|
<p> |
||||
|
<code>deb ftp://ftp.swimz.org/pub/debian unstable main contrib |
||||
|
non-free</code> |
||||
|
|
||||
|
<p> |
||||
|
Now put this line in the swimz.list, exactly like written, and ofcourse |
||||
|
use the values you want. |
||||
|
|
||||
|
<p> |
||||
|
<b>THIRD GET THE DEBIAN DATABASE WITH FTP</b> |
||||
|
|
||||
|
<p> |
||||
|
Just issue this command. |
||||
|
|
||||
|
<p> |
||||
|
<kbd>swim --ftp --Contents DF --Packages DF</kbd> |
||||
|
|
||||
|
<p> |
||||
|
and wait a little bit. |
||||
|
|
||||
|
<p> |
||||
|
<b>FOURTH BUILD THE DATABASES</b> |
||||
|
|
||||
|
<p> |
||||
|
This is for a computer system with a Debian distribution installed. |
||||
|
|
||||
|
<p> |
||||
|
<kbd>swim --initdb</kbd> |
||||
|
|
||||
|
<p> |
||||
|
This next part applies to people who followed all the steps to get here, |
||||
|
and also read the important requirements at the top. This makes the |
||||
|
not-installed databases. Go take a walk, or a swim :*} |
||||
|
|
||||
|
<p> |
||||
|
<kbd>swim --initndb --Contents DF DF</kbd> |
||||
|
|
||||
|
<p> |
||||
|
When either of these commands are complete they will say "<samp>over and |
||||
|
out</samp>". |
||||
|
|
||||
|
<p> |
||||
|
<b>NOW WHAT?</b> |
||||
|
|
||||
|
<p> Now the real fun begins. If you happen to have some experience with |
||||
|
rpm you already know some of the options which swim uses, but be prepared |
||||
|
for surpises. <A HREF="swim.html/index.html">swim(8)</A> goes into more detail, the |
||||
|
<A HREF="http://www.rpm.org/maximum-rpm.ps.gz">"<cite>Maximum |
||||
|
RPM</cite>"</A> book by Edward C. Bailey which is freely available may |
||||
|
provide help for swim's <kbd>--query</kbd> option, but you will find that |
||||
|
swim greatly diverges from rpm. |
||||
|
|
||||
|
<p> Try something like this, and do not use the <kbd>-n</kbd> unless you |
||||
|
made the not-installed databases, on the other hand, <em>REMEMBER</em> to |
||||
|
use <kbd>-n</kbd> if you do not have an installed Debian system.... |
||||
|
|
||||
|
<p> |
||||
|
<kbd>swim -n --search swim</kbd> |
||||
|
|
||||
|
<p> |
||||
|
now do this.. |
||||
|
|
||||
|
<p> |
||||
|
<kbd>swim -qnSi</kbd> or <kbd>swim -hn</kbd> |
||||
|
|
||||
|
<p> |
||||
|
go to the directory /usr/bin and do |
||||
|
|
||||
|
<p> |
||||
|
<kbd>swim -qnf</kbd> <b>.</b> |
||||
|
|
||||
|
<p> |
||||
|
you probably will have to do |
||||
|
|
||||
|
<p> |
||||
|
<kbd>swim -qnft</kbd> <b>.</b> |
||||
|
|
||||
|
<p> |
||||
|
<b>...the fun is just beginning...</b> |
||||
|
|
||||
|
<p> |
||||
|
<em>Where are you swimming to today?</em> |
||||
|
|
||||
|
</body> |
||||
|
</html> |
@ -0,0 +1,140 @@ |
|||||
|
READ THE REQUIREMENTS |
||||
|
|
||||
|
Now you can skip the next three steps if you have an installed Debian |
||||
|
distribution and you are in a hurry for a demonstration, but you will miss |
||||
|
out on swim's more awesome capabilities. With that said..... |
||||
|
|
||||
|
FIRST GET SWIMRC PREPARED |
||||
|
|
||||
|
Edit the swimrc configution file, you should read swimrc(5), but I'll ask |
||||
|
you some question right now. You can find swimrc in /etc/swim, and in |
||||
|
your home directory in the subdirectory .swim. Entries in the home |
||||
|
directory swimrc override ones in /etc/swim. |
||||
|
|
||||
|
Are you using an installed Debian system? If so, you almost definitely |
||||
|
have dpkg installed. So uncomment this line in /etc/swim/swimrc by |
||||
|
removing the pound sign. |
||||
|
|
||||
|
$package_tool = "/usr/bin/dpkg"; |
||||
|
|
||||
|
otherwise |
||||
|
|
||||
|
$package_tool = "/usr/bin/ar"; |
||||
|
|
||||
|
Do you have the apt package installed? Configure this, or -xyz will not |
||||
|
work. |
||||
|
|
||||
|
$apt = "yes"; |
||||
|
|
||||
|
Now you need to decide what architecture you would like to be swim's |
||||
|
default value when you download, build, and query the not-installed |
||||
|
databases. |
||||
|
|
||||
|
What flavor, do you want alpha, arm, hurd-i386, i386, m68k, powerpc, |
||||
|
or sparc? (more coming :*) I decided on ..... |
||||
|
|
||||
|
$architecture = "i386"; |
||||
|
|
||||
|
What kind of distribution do you want to be your default? stable, |
||||
|
unstable, frozen, or experimental (rare) I like the ever changing ... |
||||
|
|
||||
|
$distribution = "unstable"; |
||||
|
|
||||
|
Decide which sections you want? You can have this |
||||
|
|
||||
|
@user_defined_section = qw(main contrib non-free); |
||||
|
|
||||
|
or this. |
||||
|
|
||||
|
@user_defined_section = qw(main); |
||||
|
|
||||
|
or ..... |
||||
|
|
||||
|
|
||||
|
SECOND GET SWIMZ.LIST PREPARED |
||||
|
|
||||
|
Now grab a copy of the README.mirrors from |
||||
|
http://www.debian.org/misc/README.mirrors, you will need this to set-up |
||||
|
the configuration file /etc/swim/swimz.list. |
||||
|
|
||||
|
If your using apt make sure to read swim(8) to get the nitty gritty on how |
||||
|
you can synchronize swim along with apt :*} using swimz.list. |
||||
|
|
||||
|
Humm, you found a site which has the distribution you want, and you know |
||||
|
which section you want, and you are happy knowing about packages which can |
||||
|
install on the architecture you computer happens to have. |
||||
|
|
||||
|
So what site is that? |
||||
|
|
||||
|
deb ftp://ftp.swimz.org |
||||
|
|
||||
|
What was the directory you happened to notice in the README.mirrors page? |
||||
|
|
||||
|
deb ftp://ftp.swimz.org/pub/debian |
||||
|
|
||||
|
What distribution did you want? Note: You won't want to use the Release |
||||
|
code name for the distribution, see swimz.list. |
||||
|
|
||||
|
deb ftp://ftp.swimz.org/pub/debian unstable |
||||
|
|
||||
|
What sections did you want? |
||||
|
|
||||
|
deb ftp://ftp.swimz.org/pub/debian unstable main contrib non-free |
||||
|
|
||||
|
Now put this line in the swimz.list, exactly like written, and ofcourse |
||||
|
use the values you want. |
||||
|
|
||||
|
THIRD GET THE DEBIAN DATABASE WITH FTP |
||||
|
|
||||
|
Just issue this command. |
||||
|
|
||||
|
swim --ftp --Contents DF --Packages DF |
||||
|
|
||||
|
and wait a little bit. |
||||
|
|
||||
|
|
||||
|
FOURTH BUILD THE DATABASES |
||||
|
|
||||
|
This is for a computer system with a Debian distribution installed. |
||||
|
|
||||
|
swim --initdb |
||||
|
|
||||
|
This next part applies to people who followed all the steps to get here, |
||||
|
and also read the important requirements at the top. This makes the |
||||
|
not-installed databases. Go take a walk, or a swim :*} |
||||
|
|
||||
|
swim --initndb --Contents DF DF |
||||
|
|
||||
|
When either of these commands are complete they will say "over and out". |
||||
|
|
||||
|
NOW WHAT? |
||||
|
|
||||
|
Now the real fun begins. If you happen to have some experience with rpm |
||||
|
you already know some of the options which swim uses, but be prepared for |
||||
|
surpises. swim(8) goes into more detail, the "Maximum RPM" book by |
||||
|
Edward C. Bailey which is freely available may provide help for swim's |
||||
|
--query option, but you will find that swim greatly diverges from rpm. |
||||
|
|
||||
|
Try something like this, and do not use the -n unless you made the |
||||
|
not-installed databases, on the other hand, REMEMBER to use -n if you |
||||
|
do not have an installed system.... |
||||
|
|
||||
|
swim -n --search swim |
||||
|
|
||||
|
now do this.. |
||||
|
|
||||
|
swim -qnSi or swim -hn |
||||
|
|
||||
|
go to the directory /usr/bin and do |
||||
|
|
||||
|
swim -qnf . |
||||
|
|
||||
|
you probably will have to do |
||||
|
|
||||
|
swim -qnft . |
||||
|
|
||||
|
...the fun is just beginning... |
||||
|
|
||||
|
Where are you swimming to today? |
||||
|
|
||||
|
|
@ -0,0 +1,139 @@ |
|||||
|
<html> |
||||
|
<head><title>Requirements</title></head> |
||||
|
<body text="#000000" bgcolor="#FFFFFF" link="#0000EF" vlink="#51188E" |
||||
|
alink="#FF0000"> |
||||
|
|
||||
|
<br><br><br> |
||||
|
|
||||
|
|
||||
|
<h2>REQUIRMENTS:</h2> |
||||
|
|
||||
|
<p> |
||||
|
Don't get intimidated, this is just to cover all bases, most computer |
||||
|
systems meet the requirements.<p> |
||||
|
|
||||
|
<b>PERL</b>: Yes, preferably Perl 5.004.04 or greater. |
||||
|
|
||||
|
<p> <b>FTP CAPABILITIES (optional)</b>: You may need to get <A |
||||
|
HREF="ftp://www.perl.com/pub/perl/CPAN/modules/by-category/05_Networking_Devices_IPC/Net/libnet-1.0606.tar.gz">Net::FTP</A> |
||||
|
(Debian libnet-perl package) which depends on Data::Dumper (Debian |
||||
|
data-dumper package). You also need <b>gcc</b> if you do not have a |
||||
|
Debian system so that <em>swim</em> can figure out what architecture your |
||||
|
machine is. You can also find these modules at the <A |
||||
|
HREF="http://www.perl.com">CPAN mirrors</A> or the PACKAGES below. |
||||
|
|
||||
|
<p> <b>READLINE CAPABILITIES (optional)</b>: For nice readline |
||||
|
cpabilities get <A |
||||
|
HREF="ftp://www.perl.com/pub/perl/CPAN/modules/by-module/Term/Term-ReadLine-Gnu-1.03.tar.gz">Term::ReadLine::Gnu</A> |
||||
|
or alternatively <A |
||||
|
HREF="ftp://www.perl.com/pub/perl/CPAN/modules/by-module/Term/Term-ReadLine-Perl-0.990 |
||||
|
6.tar.gz">Term::ReadLine::Perl</A> which depends on <A |
||||
|
HREF="ftp://www.perl.com/pub/perl/CPAN/modules/by-module/Term/TermReadKey-2.12.tar.gz">Term::ReadKey</A> |
||||
|
. <em>Term::ReadLine::Gnu</em> may be tricky to set-up on non Debian |
||||
|
systems because it depends on <em>ncurses3.4</em> and the <em>GNU Readline |
||||
|
Library version 2.1 or later</em>, but <em>Term::ReadLine::Perl</em> is |
||||
|
much easier to set-up and allows a huge amount of package names to be |
||||
|
present on the command line without a segmentation fault. You could get |
||||
|
swim's ftp capabilities working first, and then just fetch the Debian |
||||
|
ReadLine package(s) and then use swim's --extract option to set the |
||||
|
package(s) up, but, it is sure fun doing a 'make test' when setting up the |
||||
|
ReadLine modules! You can also find these modules at the <A |
||||
|
HREF="http://www.perl.com">CPAN mirrors</A> or the PACKAGES below. <p> |
||||
|
|
||||
|
<b>DATABASE CAPABILITIES</b>: DB_File comes standard with Perl. But, |
||||
|
this doesn't mean it is compiled for the newer Berkeley Database |
||||
|
Libraries. DB 1.85 has |
||||
|
known <A |
||||
|
HREF="http://www.sleepycat.com/historic.html"> |
||||
|
bugs</A> which effect SWIM. SWIM can work with |
||||
|
1.85, but <kbd>--rebuildflatdb</kbd> and <kbd>--rebuildflatndb</kbd> will |
||||
|
not work properly. You can run a test to find out whether or not you need |
||||
|
to make the change if you have db_dump available on your system (which |
||||
|
db_dump). Enter this: |
||||
|
|
||||
|
<P> |
||||
|
<code>perl -e 'use DB_File; tie %testdb,'DB_File',"testdb";';<br> |
||||
|
db_dump testdb</code> |
||||
|
|
||||
|
<P>If 'db_dump testdb' produces an error you need to make the change by |
||||
|
installing the newest DB_File. If you have a version of libc6 less than |
||||
|
2.1, first, install a new version ( 2.3.4 or greater) of the <A |
||||
|
HREF="http://www.sleepycat.com">Berkeley DB</A> if you don't already |
||||
|
have it installed. If you get |
||||
|
<A |
||||
|
HREF="ftp://www.perl.com/pub/perl/CPAN/modules/by-module/DB_File/DB_File-1.65.tar.gz"> |
||||
|
DB_File</A> |
||||
|
from CPAN you will need to edit |
||||
|
config.in to point to the location of where libdb2 installed db.h, where |
||||
|
libdb2 is installed on your system, and the name of the library. For |
||||
|
Debian this would be: |
||||
|
|
||||
|
<P><code>INCLUDE = /usr/include/db2<br> |
||||
|
LIB = /usr/lib<br> |
||||
|
DBNAME = -ldb2</code> |
||||
|
|
||||
|
<p><b>PACKAGES</b>: You can get the CPAN modules in some package formats. |
||||
|
Debian 2.1 and Red Hat 5.0 have been tested with these packages: |
||||
|
|
||||
|
<p> |
||||
|
<u><em>Debian</em></u><br> |
||||
|
<A |
||||
|
HREF="http://www.debian.org/Packages/unstable/base/libnet-perl.html">libnet-perl</A> |
||||
|
and<br> |
||||
|
<A |
||||
|
HREF="http://www.debian.org/Packages/unstable/base/data-dumper.html">data-dumper</A> |
||||
|
and<br> |
||||
|
<A |
||||
|
HREF="http://www.debian.org/Packages/unstable/interpreters/libterm-readline-gnu-perl.html">libterm-readline-gnu-perl</A> |
||||
|
(plus a lot more) or<br> |
||||
|
<A |
||||
|
HREF="http://www.debian.org/Packages/unstable/interpreters/libterm-readline-perl-perl.html">libterm-readline-perl-perl</A> |
||||
|
and<br> |
||||
|
<A |
||||
|
HREF="http://www.debian.org/Packages/unstable/libs/libterm-readkey-perl.html">libterm-readkey-perl</A><br> |
||||
|
<A HREF="http://www.debian.org/Packages/unstable/libs/libdb2.html">libdb2</A> |
||||
|
(dump_db utility is now part of libc6 2.1)<br> |
||||
|
|
||||
|
<p> |
||||
|
<u><em>Red Hat</em></u><br> |
||||
|
<A |
||||
|
HREF="http://filewatcher.org/filename-search/?q=perl-libnet">perl-libnet</A> |
||||
|
and<br> |
||||
|
<A |
||||
|
HREF="http://filewatcher.org/filename-search/?q=perl-Data-Dumper">perl-Data-Dumper</A><br> |
||||
|
<A HREF="http://filewatcher.org/description-search/?q=libdb">db-?</a> |
||||
|
|
||||
|
<p> |
||||
|
<b>USER</b>: root. Some of swim's most important functions will not work |
||||
|
properly unless you are running the program as root. |
||||
|
|
||||
|
<p><b>HARD DRIVE SPACE</b>: Make sure you have enough hard drive space. |
||||
|
1500 |
||||
|
installed packages produces a 10MB fileindex.deb, and the virtual |
||||
|
not-installed filesystem database for the unstable distribution is now |
||||
|
over 40MB. 100MB of free space on your hard drive is probably a good |
||||
|
safety margin, if you run out of hard drive space the program will just |
||||
|
hang or quit. |
||||
|
|
||||
|
<p> |
||||
|
|
||||
|
<b>MEMORY</b>: Databases made for an installed Debian system require |
||||
|
memory in proportion to the amount of packages actually installed; the |
||||
|
<kbd>--lowmem</kbd> option is an excellent alternative for making the |
||||
|
databases if the computer system is either overloaded or low on memory. |
||||
|
If you get "out of memory" warnings try to free up some memory first then |
||||
|
make the databases. You can also avoid making the virtual filesystem by |
||||
|
not using the <kbd>--Contents</kbd> option or using the FDB argument for |
||||
|
that option. Updating the databases uses very little memory. |
||||
|
|
||||
|
<p> <b>OTHER SWIM FUNCTIONS</b>: Most free operating systems have these |
||||
|
packages installed: On a non Debian system, <b>ar</b> from |
||||
|
<em>binutils</em> is used to query Debian binary packages. These next |
||||
|
packages are essential in a free operating system (Linux) - |
||||
|
<em>textutils</em>, <em>fileutils</em>, <em>grep</em>, <em>tar</em>, |
||||
|
<em>gzip</em>, and <em>mount</em>. |
||||
|
|
||||
|
<p> |
||||
|
|
||||
|
</body> |
||||
|
</html> |
@ -0,0 +1,90 @@ |
|||||
|
REQUIRMENTS: |
||||
|
|
||||
|
Don't get intimidated, this is just to cover all bases, most computer |
||||
|
systems meet the requirements. |
||||
|
|
||||
|
PERL: Yes, preferably Perl 5.004.04 or greater. |
||||
|
|
||||
|
FTP CAPABILITIES: (optional) You may need to get Net::FTP (Debian |
||||
|
libnet-perl package) which depends on Data::Dumper (Debian data-dumper |
||||
|
package). Also check the CPAN mirrors or the PACKAGES below. You also |
||||
|
need gcc if you do not have a Debian system so that swim can figure out |
||||
|
what architecture your machine is. You can also find these modules at the |
||||
|
CPAN mirrors or the PACKAGES below. |
||||
|
|
||||
|
READLINE CAPABILITIES: (optional) For nice readline cpabilities get |
||||
|
Term::ReadLine::Gnu or alternatively Term::ReadLine::Perl which depends on |
||||
|
Term::ReadKey. Term::ReadLine::Gnu may be tricky to set-up on non Debian |
||||
|
systems because it depends on ncurses3.4 and the GNU Readline Library |
||||
|
version 2.1 or later, but Term::ReadLine::Perl is much easier to set-up |
||||
|
and allows a huge amount of package names to be present on the command |
||||
|
line without a segmentation fault. You could get swim's ftp capabilities |
||||
|
working first, and then just fetch the Debian ReadLine package(s) and then |
||||
|
use swim's --extract option to set the package(s) up, but, it is sure fun |
||||
|
doing a 'make test' when setting up the ReadLine modules! You can also |
||||
|
find these modules at the CPAN mirrors or the PACKAGES below. |
||||
|
|
||||
|
DATABASE CAPABILITIES: DB_File comes standard with Perl. But, this |
||||
|
doesn't mean it is compiled for the newer Berkeley Database Libraries. DB |
||||
|
1.85 has known bugs which effect SWIM. SWIM can work with 1.85, but |
||||
|
--rebuildflatdb and --rebuildflatndb will not work properly. You can run |
||||
|
a test to find out whether or not you need to make the change if you have |
||||
|
db_dump available on your system (which db_dump). Enter this: |
||||
|
|
||||
|
perl -e 'use DB_File; tie %testdb,'DB_File',"testdb";'; |
||||
|
db_dump testdb |
||||
|
|
||||
|
If 'db_dump testdb' produces an error you need to make the change by |
||||
|
installing the newest DB_File. If you have a version of libc6 less than |
||||
|
2.1, first, install a new version (2.3.4 or greater) of the Berkeley DB if |
||||
|
you don't already have it installed. If you get DB_File from CPAN you |
||||
|
will need to edit config.in to point to the location of where libdb2 |
||||
|
installed db.h, where libdb2 is installed on your system, and the name of |
||||
|
the library. For Debian this would be: |
||||
|
|
||||
|
INCLUDE = /usr/include/db2 |
||||
|
LIB = /usr/lib |
||||
|
DBNAME = -ldb2 |
||||
|
|
||||
|
PACKAGES - You can get the CPAN modules in some package formats. Debian |
||||
|
2.1 and Red Hat 5.0 have been tested with these packages: |
||||
|
|
||||
|
Debian - |
||||
|
|
||||
|
libnet-perl and |
||||
|
data-dumper and |
||||
|
libterm-readline-gnu-perl (plus a lot more) or |
||||
|
libterm-readline-perl-perl and |
||||
|
libterm-readkey-perl |
||||
|
libdb2 |
||||
|
|
||||
|
Red Hat - |
||||
|
|
||||
|
perl-libnet and |
||||
|
perl-Data-Dumper |
||||
|
db-? |
||||
|
|
||||
|
USER: root. Some of swim's most important functions will not work |
||||
|
properly unless you are running the program as root. |
||||
|
|
||||
|
HARD DRIVE SPACE: Make sure you have enough hard drive space. 1500 |
||||
|
installed packages produces a 10MB fileindex.deb, and the virtual |
||||
|
not-installed filesystem database for the unstable distribution is now |
||||
|
over 40MB. 100MB of free space on your hard drive is probably a good |
||||
|
safety margin, if you run out of hard drive space the program will just |
||||
|
hang or quit. |
||||
|
|
||||
|
MEMORY: Databases made for an installed Debian system require memory in |
||||
|
proportion to the amount of packages actually installed; the --lowmem |
||||
|
option is an excellent alternative for making the databases if the |
||||
|
computer system is either overloaded or low on memory. If you get "out of |
||||
|
memory" warnings try to free up some memory first then make the databases. |
||||
|
You can also avoid making the virtual filesystem by not using the |
||||
|
--Contents option or using the FDB argument for that option. Updating the |
||||
|
databases uses very little memory. |
||||
|
|
||||
|
OTHER SWIM FUNCTIONS: Most free operating systems have these packages |
||||
|
installed: On a non Debian system, ar from binutils is used to query |
||||
|
Debian binary packages. These next packages are essential in a free |
||||
|
operating system (Linux) - textutils, fileutils, grep, tar, gzip, and |
||||
|
mount. |
@ -0,0 +1,34 @@ |
|||||
|
Swim's design gives it the ability to implement features which were once |
||||
|
just fiction. |
||||
|
|
||||
|
Most people involved with WM (Window Managers) have heard of themes. |
||||
|
Themes have become very popular. You can design a real cool look for your |
||||
|
WM and then pass it on to other people to recreate what you have. But, |
||||
|
who ever thought that themes could also apply to distributions? The only |
||||
|
requirement to develop a theme from the Debian distributions is to create |
||||
|
a customized Packages database. Apt can take it from there, by simply |
||||
|
clearing the old cache, making a new cache from this Package, and |
||||
|
installing everything. This theme can even be installed along with an |
||||
|
existing installation because apt will figure out what needs to be done. |
||||
|
|
||||
|
Themes can easily be made using swim. Here's a list of ideas. |
||||
|
|
||||
|
* A module with the capability of taking the output from apt, and creating |
||||
|
a database which would correlate to a successful installation without ever |
||||
|
installing one package. This would essentially be a not-installed |
||||
|
database with one major difference, this database would represent the real |
||||
|
state of a successful installation. This would allow a developer to test |
||||
|
a hypothetical installation, and look at it's structure. Then a Packages |
||||
|
file could be made from this database and tested on a real installation. |
||||
|
|
||||
|
Although this module doesn't exist, yet, it could easily be made with a |
||||
|
special designated database interacting with the other functions offered |
||||
|
by swim's existing modules. |
||||
|
|
||||
|
* Swim already allows Packages files to be made from *debs placed in the |
||||
|
DF - including creating a place for a personalized distribution (coming). |
||||
|
A person can make there own real personalized distribution in this |
||||
|
manner, and then share their unique Packages file with the rest of the |
||||
|
world, allowing other people to recreate the state of your own |
||||
|
distribution on their machines. |
||||
|
|
@ -0,0 +1,126 @@ |
|||||
|
* Configuration for --dbpath, --root, --main, --contrib, --non-free, |
||||
|
--non-us, --arch, --dists could be automated so that a state could be |
||||
|
established on the command line, without needing to enter any of these |
||||
|
options again, untill a new state was desired, --default would bring |
||||
|
everything back to the default directory /var/lib/dpkg. |
||||
|
|
||||
|
* Non-root users could run all functions if permissions were changed, |
||||
|
probably this should be left up to the system administrator. |
||||
|
|
||||
|
* Add --todo --bugs to -q. |
||||
|
|
||||
|
* Looks like --source and --source_only is kind of deprecated now that apt_0.3.6 |
||||
|
is out, and there are Sources.gz in the appropriate places. But, now |
||||
|
there exists three unique ways to get sources, debget which doesn't use |
||||
|
databases, apt which uses databases, and swim which combines the |
||||
|
approaches of both apt and debget, all three ways have their advantages. |
||||
|
Swim isn't dependent on the existence of an up to date Sources.gz. |
||||
|
|
||||
|
* --ftp automatically removes packages with changed upstream-revisions.. |
||||
|
perhaps move them to a storage location. |
||||
|
|
||||
|
* base-files package has changed it's file/dir listing, eventually |
||||
|
SWIM::File can be modified in the future. |
||||
|
|
||||
|
* SWIM::Apt needs to be modified so that when it reads the Packages names |
||||
|
in the default directory it will look at the basename to take into |
||||
|
account non-Debian distributions. Non-Debian distributions should |
||||
|
be presented separately when DF is used as an argument. Probably a new |
||||
|
option will be added. This adheres to the swim philosophy of allowing |
||||
|
independent distributions with the exact directory structure of a normal |
||||
|
Debian distribution to exist. |
||||
|
|
||||
|
* mention netselect to help people find the best mirror site, and maybe |
||||
|
automatically use netselect on swimz.list to find which sites are up, |
||||
|
and are best to use first, overridding the default sequential order! |
||||
|
|
||||
|
* Yes, you can 'cp -a' and 'gzip -d' sources from swim to sources for |
||||
|
apt, then just do a swim --apt --check or vica versa. |
||||
|
|
||||
|
* Make sure this doesn't happen for proposed-updates - "swim: |
||||
|
dists/proposed-updates/single/binary-i386/Release does not exist on the |
||||
|
server", and make a note of proposed-updates in the manual, no Contents. |
||||
|
Incoming can be grabbed by doing something like this, "deb url |
||||
|
debian/Incoming" vs experimental "deb url/debian project/experimental/". |
||||
|
Packages are available here, too, no Release or Contents. swim is too |
||||
|
hardwired and this needs to be changed. |
||||
|
|
||||
|
* For now, a trade-off will be made in respect to updating the n* virtual |
||||
|
filesystem, even if Contents hasn't been updated, the versions of C,CR |
||||
|
will still be updated with the old Contents, on the other hand if |
||||
|
nfile* was version-less this wouldn't be necessary, then the behavior |
||||
|
mentioned next could be implemented anyways. If Contents are ever |
||||
|
updated on a more consistent basis, this behavior will be changed to |
||||
|
wait for these packages untill the next Contents, but basically this |
||||
|
should be done anyways, it will mean, quick updates during the week, and |
||||
|
one long one when the new Contents becomes available, the lack of |
||||
|
versioning would make this viable. Basically, a database will be kept |
||||
|
for .packagesdiff-arch-dist.deb, nfile* will remain versioned because |
||||
|
this means faster lookups. |
||||
|
|
||||
|
* Implement the "on the fly" distribution creation system. |
||||
|
|
||||
|
* Add the DF virtual system which will allow --apt2df and --df2apt to |
||||
|
work. |
||||
|
|
||||
|
* a search for everything found in -T |
||||
|
|
||||
|
* -o DPkg::Options::=--purge once --remove isn't a standard option to dpkg |
||||
|
for "remove", and possible --admindir (like --dbpath) --root (like |
||||
|
--root) and --instdir (where packages should be installed). |
||||
|
|
||||
|
* add --force-* at least for --purge and depends. |
||||
|
|
||||
|
* an option which would show all packages relationships for a package |
||||
|
being --ftp or -xyrz on the --stdin line |
||||
|
|
||||
|
* Complete menuindex() which allows a search of the debian menu system. |
||||
|
|
||||
|
* add the pid (personal information database) editing, and data storage. |
||||
|
|
||||
|
* Use the MD5 module from libmd5-perl for --md5sum? |
||||
|
|
||||
|
* gnupg, pgp, and md5sum checking for source probably using dscverify from |
||||
|
package devscripts, this uses the MD5 module |
||||
|
|
||||
|
* Need to add the capability to deal with weird non-standard Filename: .* |
||||
|
situations, both in retrieval, and archiving. In situations like this, |
||||
|
the distribution may not be apparent, but the package could still be |
||||
|
found and placed in a special area, and a special database could store |
||||
|
the information. This database could be transparent, and available for |
||||
|
quering regardless of the distribution default, or command line |
||||
|
specification. |
||||
|
|
||||
|
* Add the --file and --http capabilities or at least the capability to |
||||
|
look at Packages from strange directories grabbed by apt using these |
||||
|
methods. Meanwhile, swim's ftp capabilities make slow modems happy, and |
||||
|
allow for precise downloading versus downloading every package related |
||||
|
to -T. |
||||
|
|
||||
|
* Add a hash option so that swim can know that po -> unstable, this would |
||||
|
work fine, because swim shows the Release version, but the author is |
||||
|
against implementing this ability. |
||||
|
|
||||
|
* Instead of PWD!full_path, allow multiple filenames to be quoted without |
||||
|
pathnames for --extract. |
||||
|
|
||||
|
* .., ../, ../../, ../../file-or-dir (not ../../file-or-dir/) ability for |
||||
|
-qf|p works, but more complex ../ is not implemented, yet. ../ will |
||||
|
also follow a symbolic link, this is a feature. |
||||
|
|
||||
|
* --search by dirs when in place using -f. |
||||
|
|
||||
|
* Add the retro full spectrum of dpkg options, it's nice sometimes to just |
||||
|
do a simple install. |
||||
|
|
||||
|
* Gather together all the build children into a giant family including the |
||||
|
teacher and the checker. |
||||
|
|
||||
|
* Do the Perl for Non Free OSes thing. |
||||
|
|
||||
|
* Remove a large percentage of the bold and underlining from the |
||||
|
documentation. |
||||
|
|
||||
|
* Make needed changes and improvements to the Manual - a constant TODO. |
||||
|
|
||||
|
* swim faster and faster! |
@ -0,0 +1,167 @@ |
|||||
|
#!/usr/bin/perl -w |
||||
|
#use diagnostics; |
||||
|
require 5.004; |
||||
|
use strict; |
||||
|
|
||||
|
################################################################################ |
||||
|
# Package administration and research tool for Debian # |
||||
|
# Copyright (C) 1999-2000 Jonathan D. Rosenbaum # |
||||
|
# # |
||||
|
# This program 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. # |
||||
|
# # |
||||
|
# This program 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 this program; if not, write to the Free Software # |
||||
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.# |
||||
|
################################################################################ |
||||
|
|
||||
|
|
||||
|
# Because it is a better to write to disk, rather than trying to do |
||||
|
# everthing in memory, and then it's good to close the process which |
||||
|
# accomplished this. I am sure there are better ways. |
||||
|
|
||||
|
# Anyways if you want to test fastswim do something like this: |
||||
|
# fastswim --transfer /var/lib/dpkg/info /tmp /var/lib/dpkg and create a |
||||
|
# transfer.deb file beforehand in /tmp which has the packagename_version |
||||
|
# one to a line. |
||||
|
|
||||
|
my @ppackage; |
||||
|
my %repeaters; |
||||
|
my $thingy; |
||||
|
my $tingy; |
||||
|
my $temp; |
||||
|
my %HL; |
||||
|
my @name; |
||||
|
my %version; |
||||
|
|
||||
|
#$| = 1; |
||||
|
#$#name = 2000; |
||||
|
#$#ppackage = 2000; |
||||
|
|
||||
|
# This way has been de-pre-c-whatever-ated because it lacks version |
||||
|
# rememberance, and is just kept for testing purposes |
||||
|
if ($#ARGV == -1) { |
||||
|
print "swim: fastswim requires option/arguments, see program for instructions\n"; |
||||
|
exit; |
||||
|
chdir("$ARGV[1]"); |
||||
|
#consider readdir |
||||
|
@ppackage = <*.list>; |
||||
|
} |
||||
|
# This does the work |
||||
|
elsif ($ARGV[0] eq "--transfer") { |
||||
|
open(TRANSFER, "$ARGV[2]/transfer.deb"); |
||||
|
while (<TRANSFER>) { |
||||
|
chomp $_; |
||||
|
if (defined $_) { |
||||
|
my @the = split(/_/, $_); |
||||
|
push(@ppackage, "$the[0].list"); |
||||
|
# remember the version. |
||||
|
chomp $the[1]; |
||||
|
$version{$the[0]} = $the[1]; |
||||
|
} |
||||
|
} |
||||
|
close(TRANSFER); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
# Make a nice md. I decided on a Hash of Lists, giving all |
||||
|
# files/dirs unique name, and then a list of packages which |
||||
|
# correspond..because this should be faster than a Hash of Hash |
||||
|
# where you'd have to loop through all packages names..find the |
||||
|
# files/dir in all packages names which are the same..I'd assume a HL |
||||
|
# would be a quicker query, even though the Hash would be enormous. |
||||
|
# Possible things: a tree for faster query. |
||||
|
|
||||
|
# Put everything into an array..every other is package name |
||||
|
# Better check for packages which don't have /. in their *.list... |
||||
|
# which is rare, but does happen. Sometimes *.list(s) don't have |
||||
|
# all the parent directories, but we won't worry about that. |
||||
|
print " Making the massive hash\n"; |
||||
|
$| = 1; my $x = 1; |
||||
|
foreach $thingy (sort @ppackage) { |
||||
|
open(LIST, "$ARGV[1]/$thingy") or die "Humm, strange"; |
||||
|
# Because of the version..there are sometimes dots |
||||
|
$thingy =~ m,(.*)\.list,; |
||||
|
my $count = 0; |
||||
|
my @count = <LIST>; |
||||
|
close(LIST); |
||||
|
foreach (@count) { |
||||
|
$x = 1 if $x == 6; |
||||
|
print "|\r" if $x == 1 || $x == 4; print "/\r" if $x == 2; |
||||
|
print "-\r" if $x == 3 || $x == 6; print "\\\r" if $x == 5; |
||||
|
$x++; |
||||
|
chomp $_; |
||||
|
# does /. exist? it should be first. |
||||
|
if ($count == 0) { |
||||
|
if ($_ !~ m,\/\.,) { |
||||
|
my $shifter = $_; |
||||
|
my @redolist = @count; |
||||
|
push(@count,$shifter); |
||||
|
# humm let's rebuild the offending backup list, this |
||||
|
# is important for --db. |
||||
|
unshift(@redolist,"/."); |
||||
|
open(REDOLIST, ">$ARGV[1]/backup/$thingy.bk.bk") |
||||
|
or warn "needed to edit $thingy because it lacked /., |
||||
|
but could not open up a backup file\n"; |
||||
|
my $rd; |
||||
|
foreach $rd (@redolist) { |
||||
|
chomp $rd; |
||||
|
print REDOLIST "$rd\n"; |
||||
|
} |
||||
|
close(REDOLIST); |
||||
|
rename |
||||
|
("$ARGV[1]/backup/$thingy.bk.bk","$ARGV[1]/backup/$thingy.bk"); |
||||
|
$_ = "/."; |
||||
|
} |
||||
|
} |
||||
|
$count = 1; |
||||
|
$repeaters{$_}++; |
||||
|
if ($repeaters{$_} == 1) { |
||||
|
$temp = 0; |
||||
|
} |
||||
|
else { |
||||
|
$temp = $repeaters{$_} - 1; |
||||
|
} |
||||
|
if (defined $version{$1}) { |
||||
|
$HL{$_}[$temp] = "$1_$version{$1}"; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
undef @ppackage; |
||||
|
|
||||
|
# We will create one file with the 1..and another with >1.. |
||||
|
# than split..reverse..and order.accordingly..this makes |
||||
|
# things much faster. Remember clean-up routines for kill. |
||||
|
print " Starting ... writing to $ARGV[2]!\n"; |
||||
|
# Create the database |
||||
|
open(BIG, ">$ARGV[2]/big.debian") or die; |
||||
|
open(LONG, ">$ARGV[2]/long.debian") or die; |
||||
|
foreach $thingy (sort keys %HL ) { |
||||
|
$x = 1 if $x == 6; |
||||
|
print "|\r" if $x == 1 || $x == 4; print "/\r" if $x == 2; |
||||
|
print "-\r" if $x == 3 || $x == 6; print "\\\r" if $x == 5; |
||||
|
$x++; |
||||
|
# Humm, will split or grep be faster? |
||||
|
#my $tingy = "@{ $HL{$thingy} }" . " " . @{ $HL{$thingy} }; |
||||
|
my $tingy = "@{ $HL{$thingy} }"; |
||||
|
if (@{ $HL{$thingy} } > 1 || @{ $HL{$thingy} } eq "") { |
||||
|
print LONG "$thingy -> $tingy\n"; |
||||
|
} |
||||
|
elsif (@{ $HL{$thingy} } == 1) { |
||||
|
print BIG "$thingy -> $tingy\n"; |
||||
|
} |
||||
|
} |
||||
|
#print "Finished\n"; |
||||
|
close(BIG); |
||||
|
close(LONG); |
||||
|
#undef %HL; |
||||
|
print " Cleaning up\n"; |
||||
|
|
||||
|
__END__ |
@ -0,0 +1,99 @@ |
|||||
|
#!/usr/bin/perl -w |
||||
|
#use diagnostics; |
||||
|
require 5.004; |
||||
|
use strict; |
||||
|
|
||||
|
################################################################################ |
||||
|
# Package administration and research tool for Debian # |
||||
|
# Copyright (C) 1999-2000 Jonathan D. Rosenbaum # |
||||
|
# # |
||||
|
# This program 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. # |
||||
|
# # |
||||
|
# This program 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 this program; if not, write to the Free Software # |
||||
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.# |
||||
|
################################################################################ |
||||
|
|
||||
|
|
||||
|
=pod |
||||
|
|
||||
|
This allows computers with a small amount of memory or overloaded system |
||||
|
to succeed in making the databases for SWIM::DB_Init. Instead of using |
||||
|
transfer.deb to grab everything into memory and then creating the |
||||
|
long.debian and big.debian files right out of memory for processing by |
||||
|
SWIM::MD, it works like longswim by creating one large file to the disk |
||||
|
(this can use lots of memory, but can swap easily) then it uses slowswim |
||||
|
to create long.debian and big.debian using a minimal memory method, then |
||||
|
it finishes using SWIM::MD. |
||||
|
|
||||
|
To test supply these arguments - info dir, temporary dir "imswim |
||||
|
/var/lib/dpkg/info /tmp" and create a transfer.deb file |
||||
|
beforehand in the temporary dir which has the packagename_version one to a |
||||
|
line. |
||||
|
|
||||
|
=cut |
||||
|
|
||||
|
|
||||
|
if ($#ARGV == -1) { |
||||
|
print "swim: imswim requires arguments, see program for instructions\n"; |
||||
|
exit; |
||||
|
} |
||||
|
else { |
||||
|
$| = 1; my $x = 1; |
||||
|
open(FILEDIR, ">$ARGV[1]/filedir.deb") |
||||
|
or warn "could not create filedir.deb\n"; |
||||
|
open(TRANSFER, "$ARGV[1]/transfer.deb") or warn "needs transfer.deb"; |
||||
|
while (<TRANSFER>) { |
||||
|
chomp; |
||||
|
my @the = split(/_/, $_); |
||||
|
open (LIST, "$ARGV[0]/$the[0].list") |
||||
|
or warn "could not file *list"; |
||||
|
chomp; |
||||
|
# better check if /. is missing in any of the *list |
||||
|
my $count = 0; |
||||
|
my @count = <LIST>; |
||||
|
close(LIST); |
||||
|
foreach (@count) { |
||||
|
$x = 1 if $x == 6; |
||||
|
print "|\r" if $x == 1 || $x == 4; print "/\r" if $x == 2; |
||||
|
print "-\r" if $x == 3 || $x == 6; print "\\\r" if $x == 5; |
||||
|
$x++; |
||||
|
chomp $_; |
||||
|
# does /. exist? it should be first. |
||||
|
if ($count == 0) { |
||||
|
if ($_ !~ m,\/\.,) { |
||||
|
my $shifter = $_; |
||||
|
my @redolist = @count; |
||||
|
push(@count,$shifter); |
||||
|
# humm let's rebuild the offending backup list, this |
||||
|
# is important for --db. |
||||
|
unshift(@redolist,"/."); |
||||
|
open(REDOLIST, ">$ARGV[0]/backup/$the[0].list.bk.bk") |
||||
|
or warn "needed to edit $the[0].list because it lacked /., |
||||
|
but could not open up a backup file\n"; |
||||
|
my $rd; |
||||
|
foreach $rd (@redolist) { |
||||
|
chomp $rd; |
||||
|
print REDOLIST "$rd\n"; |
||||
|
} |
||||
|
close(REDOLIST); |
||||
|
rename("$ARGV[0]/backup/$the[0].list.bk.bk", |
||||
|
"$ARGV[0]/backup/$the[0].list.bk"); |
||||
|
$_ = "/."; |
||||
|
} |
||||
|
} |
||||
|
$count = 1; |
||||
|
print FILEDIR "$_ -> $the[0]_$the[1]\n"; |
||||
|
} # foreach @count |
||||
|
} # while TRANSFER |
||||
|
close(TRANSFER); |
||||
|
close(FILEDIR); |
||||
|
} # else |
@ -0,0 +1,591 @@ |
|||||
|
#!/usr/bin/perl -w |
||||
|
|
||||
|
#use diagnostics; |
||||
|
use strict; |
||||
|
use DB_File; |
||||
|
|
||||
|
################################################################################ |
||||
|
# Package administration and research tool for Debian # |
||||
|
# Copyright (C) 1999-2000 Jonathan D. Rosenbaum # |
||||
|
# # |
||||
|
# This program 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. # |
||||
|
# # |
||||
|
# This program 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 this program; if not, write to the Free Software # |
||||
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.# |
||||
|
################################################################################ |
||||
|
|
||||
|
|
||||
|
=pod |
||||
|
|
||||
|
This program creates the file filedir.deb using choice() and |
||||
|
comma_choice() (which both use timing() in case Contents is newer than |
||||
|
Packages). It establishes the file based on --main, --contrib, --non-free, |
||||
|
--non-us or the default. This program is quite time consuming and uses |
||||
|
more and more memory as it runs. Afterwared, the output can be processed |
||||
|
by fastswim (high memory approach) or slowswim (low memory approach), |
||||
|
whether either is faster is still subject to experimentation. swim packs |
||||
|
everything into the databases. It also produces the report |
||||
|
.contentsdiff-arch-dists.deb which shows which packages exist in Contents |
||||
|
which don't exist in Packages. |
||||
|
|
||||
|
This program takes a large amount of arguments. Look at nmd() in |
||||
|
SWIM::NDB_Init. |
||||
|
|
||||
|
=cut |
||||
|
|
||||
|
|
||||
|
if ($#ARGV == -1) { |
||||
|
print "swim: longswim requires many arguments, see program for instructions\n"; |
||||
|
exit; |
||||
|
} |
||||
|
|
||||
|
my $Contents; |
||||
|
my $contentsindex; |
||||
|
my ($main,$contrib,$non_free,$non_us); |
||||
|
my $tmp; |
||||
|
my (%watch,%ndb); |
||||
|
my $npackages; |
||||
|
my $gzip; |
||||
|
my $place; |
||||
|
|
||||
|
# process @ARGV |
||||
|
$Contents = $ARGV[0]; $contentsindex = $ARGV[1]; |
||||
|
$main = $ARGV[2]; $contrib = $ARGV[3]; |
||||
|
$non_free = $ARGV[4]; $non_us = $ARGV[5]; |
||||
|
$tmp = $ARGV[6]; |
||||
|
$npackages = $ARGV[7]; |
||||
|
$gzip = $ARGV[8]; |
||||
|
$place = $ARGV[9]; |
||||
|
my $Contents_mtime = $ARGV[10]; |
||||
|
|
||||
|
# tie it once not a quarter million times |
||||
|
tie %ndb, 'DB_File', "$npackages" or die "DB_File: $!"; |
||||
|
|
||||
|
# Let's find the arch and dists |
||||
|
my @archdist = split(m,/,,$contentsindex); |
||||
|
my($arch,$dist) = (split(m,-,,$archdist[$#archdist]))[1,2]; |
||||
|
$dist =~ s,\.deb,,; |
||||
|
|
||||
|
unlink("$place/.contentsdiff-$arch-$dist.deb") |
||||
|
if -e "$place/.contentsdiff-$arch-$dist.deb"; |
||||
|
|
||||
|
nmd(); |
||||
|
|
||||
|
# main processing program |
||||
|
sub nmd { |
||||
|
|
||||
|
my %again; |
||||
|
my %all; |
||||
|
|
||||
|
$| = 1; my $x = 1; |
||||
|
open(CONTENTS, "$Contents") or die "where is it?\n"; |
||||
|
open(FILEDIR,">$tmp/filedir.deb"); |
||||
|
open(CONTENTSDB,">$contentsindex"); |
||||
|
while (<CONTENTS>) { |
||||
|
print CONTENTSDB $_; |
||||
|
if (/^FILE\s*LOCATION$/) { |
||||
|
while (<CONTENTS>) { |
||||
|
s,^(\./)+,,; # filter for Debians altered dir structure |
||||
|
print CONTENTSDB $_; |
||||
|
$x = 1 if $x == 6; |
||||
|
print "|\r" if $x == 1 || $x == 4; print "/\r" if $x == 2; |
||||
|
print "-\r" if $x == 3 || $x == 6; print "\\\r" if $x == 5; |
||||
|
$x++; |
||||
|
chomp $_; |
||||
|
# find all directories |
||||
|
# split is the way to go. |
||||
|
# If it ends with / its a directory |
||||
|
my($dirfile,$package,@packs,@dirfile,@package,@comma); |
||||
|
|
||||
|
|
||||
|
###################### |
||||
|
# ENDS WITH / # |
||||
|
###################### |
||||
|
if (m,.*/\s+\w*,) { |
||||
|
($dirfile,$package) = split(/\s+/,$_,2); |
||||
|
if ($package !~ m,^[a-z0-9-]*/.*$|^[a-z0-9-]*/.*/.*$,) { |
||||
|
my @more_things = split(/\s+/,$package); |
||||
|
$package = $more_things[$#more_things]; |
||||
|
(my $backpackage = $package) =~ s,\+,\\+,g; |
||||
|
my @dirfile = split(/\s+$backpackage/,$_); |
||||
|
$dirfile = $dirfile[0]; |
||||
|
} |
||||
|
@dirfile = split(/\//,$dirfile); $dirfile =~ s,/$,,; |
||||
|
@comma = split(/,/,$package); |
||||
|
|
||||
|
################# |
||||
|
# HAS A COMMA # |
||||
|
################# |
||||
|
if (scalar(@comma) >= 2) { |
||||
|
# humm many packages share this file/dir |
||||
|
my @choice_package; |
||||
|
########## |
||||
|
## MAIN ## |
||||
|
########## |
||||
|
if ($main eq "yes") { |
||||
|
foreach (@comma) { |
||||
|
if (defined $_) { |
||||
|
if ($_ !~ m,^non-free/|^contrib/|^non-us/,) { |
||||
|
push(@choice_package,$_); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
@packs = comma_choice(@choice_package); |
||||
|
} # choice in main |
||||
|
############ |
||||
|
##NON-FREE## |
||||
|
############ |
||||
|
if ($non_free eq "yes") { |
||||
|
foreach (@comma) { |
||||
|
if (m,^non-free/,) { |
||||
|
push(@choice_package,$_); |
||||
|
} |
||||
|
} |
||||
|
@packs = comma_choice(@choice_package); |
||||
|
} # choice non-free |
||||
|
########### |
||||
|
##CONTRIB## |
||||
|
########### |
||||
|
if ($contrib eq "yes") { |
||||
|
foreach (@comma) { |
||||
|
if (m,^contrib/,) { |
||||
|
push(@choice_package,$_); |
||||
|
} |
||||
|
} |
||||
|
@packs = comma_choice(@choice_package); |
||||
|
} # choice contrib |
||||
|
######### |
||||
|
#NON-US## |
||||
|
######### |
||||
|
if ($non_us eq "yes") { |
||||
|
foreach (@comma) { |
||||
|
if (m,^non-us/,) { |
||||
|
push(@choice_package,$_); |
||||
|
} |
||||
|
} |
||||
|
@packs = comma_choice(@choice_package); |
||||
|
} # choice non-us |
||||
|
|
||||
|
} # scalar @comma >= 2 |
||||
|
|
||||
|
# When only one package exists for dir |
||||
|
############# |
||||
|
############## |
||||
|
# NO COMMA # |
||||
|
############## |
||||
|
elsif (scalar(@comma) == 1) { |
||||
|
my $choice_package; |
||||
|
########## |
||||
|
## MAIN ## |
||||
|
########## |
||||
|
if ($main eq "yes") { |
||||
|
# only one package found related to choice section |
||||
|
if (defined $package) { |
||||
|
if ($package !~ m,^non-free/|^contrib/|^non-us/,) { |
||||
|
$choice_package = $package; |
||||
|
@package = split(/\//,$choice_package); |
||||
|
} |
||||
|
} |
||||
|
@packs = choice(@package); |
||||
|
} # end choice main |
||||
|
|
||||
|
############ |
||||
|
##NON-FREE## |
||||
|
############ |
||||
|
if ($non_free eq "yes") { |
||||
|
if (defined $package) { |
||||
|
if ($package =~ m,^non-free/,) { |
||||
|
$choice_package = $package; |
||||
|
@package = split(/\//,$choice_package); |
||||
|
} |
||||
|
} |
||||
|
@packs = choice(@package); |
||||
|
} # end choice main |
||||
|
|
||||
|
########### |
||||
|
##CONTRIB## |
||||
|
########### |
||||
|
if ($contrib eq "yes") { |
||||
|
if (defined $package) { |
||||
|
if ($package =~ m,^contrib/,) { |
||||
|
$choice_package = $package; |
||||
|
@package = split(/\//,$choice_package); |
||||
|
} |
||||
|
} |
||||
|
@packs = choice(@package); |
||||
|
} # end choice main |
||||
|
|
||||
|
######### |
||||
|
#NON-US## |
||||
|
######### |
||||
|
if ($non_us eq "yes") { |
||||
|
if (defined $package) { |
||||
|
if ($package =~ m,^non-us/,) { |
||||
|
$choice_package = $package; |
||||
|
@package = split(/\//,$choice_package); |
||||
|
} |
||||
|
} |
||||
|
@packs = choice(@package); |
||||
|
} # end choice main |
||||
|
|
||||
|
|
||||
|
} # @comma = 1 |
||||
|
|
||||
|
################# |
||||
|
# WRITE TO FILE # |
||||
|
################# |
||||
|
foreach $package (@packs) { |
||||
|
my ($count,$holder); |
||||
|
for ($count = 0; $count <= $#dirfile; $count++) { |
||||
|
if ($count == 0) { |
||||
|
$holder = "/$dirfile[$count]"; |
||||
|
my $again = "$dirfile[$count] -> $package"; |
||||
|
my $all = "/. -> $package"; |
||||
|
$again{$again}++; |
||||
|
$all{$all}++; |
||||
|
if ($all{$all} == 1) { |
||||
|
print FILEDIR "/. -> $package\n"; |
||||
|
##repeaters("/.",$package); |
||||
|
} |
||||
|
if ($again{$again} == 1) { |
||||
|
print FILEDIR "/$dirfile[$count] -> $package\n"; |
||||
|
##repeaters("/$dirfile[$count]",$package); |
||||
|
} |
||||
|
} |
||||
|
else { |
||||
|
$holder = $holder . "/$dirfile[$count]"; |
||||
|
#print "$holder -> $package\n"; |
||||
|
#repeaters($holder,$package); |
||||
|
my $again = "$holder -> $package"; |
||||
|
$again{$again}++; |
||||
|
if ($again{$again} == 1) { |
||||
|
print FILEDIR "$holder -> $package\n"; |
||||
|
##repeaters($holder,$package); |
||||
|
} |
||||
|
} |
||||
|
} # end for |
||||
|
} |
||||
|
} # does end with / |
||||
|
|
||||
|
###################### |
||||
|
# DOESN'T END WITH / # |
||||
|
###################### |
||||
|
# find all files and directories |
||||
|
else { |
||||
|
($dirfile,$package) = split(/\s+/,$_,2); |
||||
|
if ($package !~ m,^[a-z0-9-]*/.*$|^[a-z0-9-]*/.*/.*$,) { |
||||
|
my @more_things = split(/\s+/,$package); |
||||
|
$package = $more_things[$#more_things]; |
||||
|
(my $backpackage = $package) =~ s,\+,\\+,g; |
||||
|
# watch this |
||||
|
my @dirfile = split(/\s+$backpackage/,$_); |
||||
|
$dirfile = $dirfile[0]; |
||||
|
} |
||||
|
@dirfile = split(/\//,$dirfile); |
||||
|
@comma = split(/,/,$package); |
||||
|
|
||||
|
################# |
||||
|
# HAS A COMMA # |
||||
|
################# |
||||
|
if (scalar(@comma) >= 2) { |
||||
|
# humm many packages share this file/dir |
||||
|
my @choice_package; |
||||
|
########## |
||||
|
## MAIN ## |
||||
|
########## |
||||
|
if ($main eq "yes") { |
||||
|
foreach (@comma) { |
||||
|
if (defined $_) { |
||||
|
if ($_ !~ m,^non-free/|^contrib/|^non-us/,) { |
||||
|
push(@choice_package,$_); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
@packs = comma_choice(@choice_package); |
||||
|
} # choice in main |
||||
|
############ |
||||
|
##NON-FREE## |
||||
|
############ |
||||
|
if ($non_free eq "yes") { |
||||
|
foreach (@comma) { |
||||
|
if (m,^non-free/,) { |
||||
|
push(@choice_package,$_); |
||||
|
} |
||||
|
} |
||||
|
@packs = comma_choice(@choice_package); |
||||
|
} # choice non-free |
||||
|
########### |
||||
|
##CONTRIB## |
||||
|
########### |
||||
|
if ($contrib eq "yes") { |
||||
|
foreach (@comma) { |
||||
|
if (m,^contrib/,) { |
||||
|
push(@choice_package,$_); |
||||
|
} |
||||
|
} |
||||
|
@packs = comma_choice(@choice_package); |
||||
|
} # choice contrib |
||||
|
######### |
||||
|
#NON-US## |
||||
|
######### |
||||
|
if ($non_us eq "yes") { |
||||
|
foreach (@comma) { |
||||
|
if (m,^non-us/,) { |
||||
|
push(@choice_package,$_); |
||||
|
} |
||||
|
} |
||||
|
@packs = comma_choice(@choice_package); |
||||
|
} # choice non-us |
||||
|
|
||||
|
} # scalar @comma == 2 |
||||
|
|
||||
|
# When only one package exists for file |
||||
|
############# |
||||
|
############## |
||||
|
# NO COMMA # |
||||
|
############## |
||||
|
elsif (scalar(@comma) == 1) { |
||||
|
my $choice_package; |
||||
|
########## |
||||
|
## MAIN ## |
||||
|
########## |
||||
|
if ($main eq "yes") { |
||||
|
# only one package found related to choice section |
||||
|
if (defined $package) { |
||||
|
if ($package !~ m,^non-free/|^contrib/|^non-us/,) { |
||||
|
$choice_package = $package; |
||||
|
@package = split(/\//,$choice_package); |
||||
|
} |
||||
|
} |
||||
|
@packs = choice(@package); |
||||
|
} # end choice main |
||||
|
|
||||
|
############ |
||||
|
##NON-FREE## |
||||
|
############ |
||||
|
if ($non_free eq "yes") { |
||||
|
if (defined $package) { |
||||
|
if ($package =~ m,^non-free/,) { |
||||
|
$choice_package = $package; |
||||
|
@package = split(/\//,$choice_package); |
||||
|
} |
||||
|
} |
||||
|
@packs = choice(@package); |
||||
|
} # end choice main |
||||
|
|
||||
|
########### |
||||
|
##CONTRIB## |
||||
|
########### |
||||
|
if ($contrib eq "yes") { |
||||
|
if (defined $package) { |
||||
|
if ($package =~ m,^contrib/,) { |
||||
|
$choice_package = $package; |
||||
|
@package = split(/\//,$choice_package); |
||||
|
} |
||||
|
} |
||||
|
@packs = choice(@package); |
||||
|
} # end choice main |
||||
|
|
||||
|
######### |
||||
|
#NON-US## |
||||
|
######### |
||||
|
if ($non_us eq "yes") { |
||||
|
if (defined $package) { |
||||
|
if ($package =~ m,^non-us/,) { |
||||
|
$choice_package = $package; |
||||
|
@package = split(/\//,$choice_package); |
||||
|
} |
||||
|
} |
||||
|
@packs = choice(@package); |
||||
|
} # end choice main |
||||
|
|
||||
|
|
||||
|
} # @comma = 1 |
||||
|
|
||||
|
################# |
||||
|
# WRITE TO FILE # |
||||
|
################# |
||||
|
foreach $package (@packs) { |
||||
|
my ($count,$holder); |
||||
|
for ($count = 0; $count <= $#dirfile; $count++) { |
||||
|
if ($count == 0) { |
||||
|
$holder = "/$dirfile[$count]"; |
||||
|
my $again = "$dirfile[$count] -> $package"; |
||||
|
my $all = "/. -> $package"; |
||||
|
$again{$again}++; |
||||
|
$all{$all}++; |
||||
|
if ($all{$all} == 1) { |
||||
|
print FILEDIR "/. -> $package\n"; |
||||
|
} |
||||
|
if ($again{$again} == 1) { |
||||
|
print FILEDIR "/$dirfile[$count] -> $package\n"; |
||||
|
} |
||||
|
} |
||||
|
# Here's where things really start to turn ugly. |
||||
|
else { |
||||
|
$holder = $holder . "/$dirfile[$count]"; |
||||
|
my $again = "$holder -> $package"; |
||||
|
$again{$again}++; |
||||
|
if ($again{$again} == 1) { |
||||
|
print FILEDIR "$holder -> $package\n"; |
||||
|
} |
||||
|
} |
||||
|
} # end for |
||||
|
} # @packs - more than one package for this file |
||||
|
} # end else not dir |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
close(FILEDIR); |
||||
|
close(CONTENTS); |
||||
|
|
||||
|
print "Compress contents\n"; |
||||
|
system "$gzip", "-9", "$contentsindex"; |
||||
|
utime(time,$Contents_mtime,$contentsindex); |
||||
|
print "Cleaning up\n"; |
||||
|
# this will add a newline, but better to do a Ctrl-C than to have the |
||||
|
# process hang and respawn itself - something which sometimes happens |
||||
|
kill INT => $$; |
||||
|
print "swim: please press Ctrl-c\n"; # just in case :) |
||||
|
|
||||
|
# probably don't need to do this ends the program |
||||
|
#undef %all; |
||||
|
#undef %again; |
||||
|
|
||||
|
} # end sub nmd |
||||
|
|
||||
|
# this finds the package or none which equal choice section when a |
||||
|
# file/dir is found with one package |
||||
|
sub choice { |
||||
|
|
||||
|
my (@package) = @_; |
||||
|
my @packs; |
||||
|
if ($#package == 1) { |
||||
|
my $what = timing($package[1]); |
||||
|
if (defined $what) { |
||||
|
#$package[1] = version($package[1]); |
||||
|
@packs = $what; |
||||
|
} |
||||
|
} |
||||
|
elsif ($#package == 2) { |
||||
|
my $what = timing($package[2]); |
||||
|
if (defined $what) { |
||||
|
#$package[2] = version($package[2]); |
||||
|
@packs = $what; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
return @packs; |
||||
|
|
||||
|
} # end sub choice |
||||
|
|
||||
|
|
||||
|
# this finds the package(s) or none which equal choice section when a |
||||
|
# file/dir is found with more than one package |
||||
|
sub comma_choice { |
||||
|
|
||||
|
my (@choice_package) = @_; |
||||
|
my (@package,@packs); |
||||
|
|
||||
|
if (@choice_package) { |
||||
|
if ($#choice_package == 0) { |
||||
|
@package = split(/\//,$choice_package[0]); |
||||
|
if ($#package == 1) { |
||||
|
my $what = timing($package[1]); |
||||
|
if (defined $what) { |
||||
|
#$package[1] = version($package[1]); |
||||
|
push(@packs,$what); |
||||
|
} |
||||
|
} |
||||
|
elsif ($#package == 2) { |
||||
|
my $what = timing($package[2]); |
||||
|
if (defined $what) { |
||||
|
#$package[2] = version($package[2]); |
||||
|
push(@packs,$what); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
elsif ($#choice_package > 0) { |
||||
|
# Basically, we will keep all conflicting dirs/files |
||||
|
# because often they are related |
||||
|
foreach (@choice_package) { |
||||
|
@package = split(/\//,$_); |
||||
|
if ($#package == 1) { |
||||
|
my $what = timing($package[1]); |
||||
|
if (defined $what) { |
||||
|
push(@packs,$what); |
||||
|
} |
||||
|
} |
||||
|
elsif ($#package == 2) { |
||||
|
my $what = timing($package[2]); |
||||
|
if (defined $what) { |
||||
|
push(@packs,$what); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} # else more than 1 for choice |
||||
|
} # defined choice |
||||
|
return @packs; |
||||
|
|
||||
|
} # end sub comma_choice |
||||
|
|
||||
|
|
||||
|
# this sub produces a report file..in case Packages is older than Contents |
||||
|
# there will be other reports, ofcourse, like if Packages is newer than |
||||
|
# Contents. Uses version(); |
||||
|
sub timing { |
||||
|
|
||||
|
my ($lookup) = @_; |
||||
|
|
||||
|
my $afterlookup = nversion($lookup); |
||||
|
if ($afterlookup eq 1) { |
||||
|
$watch{$lookup}++; |
||||
|
if ($watch{$lookup} == 1) { |
||||
|
open(REPORT,">>$place/.contentsdiff-$arch-$dist.deb") |
||||
|
or die "can't create a file\n"; |
||||
|
print REPORT "Found in Contents, not in Packages: $lookup\n"; |
||||
|
close(REPORT); |
||||
|
} |
||||
|
return; |
||||
|
} |
||||
|
else { |
||||
|
return $afterlookup; |
||||
|
} |
||||
|
|
||||
|
} # end my timing |
||||
|
|
||||
|
# checks npackage.deb to find version for package found in Contents |
||||
|
sub nversion { |
||||
|
|
||||
|
my ($argument) = @_; |
||||
|
#ndb(); |
||||
|
|
||||
|
if (defined $argument) { |
||||
|
# We will check for more than two..just in case |
||||
|
if ($argument !~ /_/) { |
||||
|
if (defined $ndb{$argument}) { |
||||
|
$argument = $ndb{$argument}; |
||||
|
return $argument; |
||||
|
} |
||||
|
# fixed the space packages |
||||
|
else { |
||||
|
return 1; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
#untie %ndb; |
||||
|
|
||||
|
} # end sub nversion |
||||
|
|
||||
|
sub ndb { |
||||
|
#tie %ndb, 'DB_File', "$npackages" or die "DB_File: $!"; |
||||
|
} # end sub ndb |
@ -0,0 +1,131 @@ |
|||||
|
#!/usr/bin/perl -w |
||||
|
|
||||
|
#use diagnostics; |
||||
|
use strict; |
||||
|
|
||||
|
################################################################################ |
||||
|
# Package administration and research tool for Debian # |
||||
|
# Copyright (C) 1999-2000 Jonathan D. Rosenbaum # |
||||
|
# # |
||||
|
# This program 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. # |
||||
|
# # |
||||
|
# This program 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 this program; if not, write to the Free Software # |
||||
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.# |
||||
|
################################################################################ |
||||
|
|
||||
|
|
||||
|
=pod |
||||
|
|
||||
|
This program only takes two argument, a temp directory and the name of the |
||||
|
binary sort..sort. You can test a filedir.deb file. |
||||
|
|
||||
|
|
||||
|
=cut |
||||
|
|
||||
|
if ($#ARGV == -1) { |
||||
|
print "swim: slowswim requires arguments, see program for instructions\n"; |
||||
|
exit; |
||||
|
} |
||||
|
|
||||
|
my $tmp = $ARGV[0]; |
||||
|
my $sort = $ARGV[1]; |
||||
|
|
||||
|
pre_md(); |
||||
|
|
||||
|
# This is nmd()'s version of fastswim..also a lowmem method, after making |
||||
|
# long.debian and big.debian, process_md() finishes the job. |
||||
|
sub pre_md { |
||||
|
|
||||
|
my %HL; |
||||
|
my $temp; |
||||
|
my %repeaters; |
||||
|
my $fcount = 0; |
||||
|
my @tempholder; |
||||
|
|
||||
|
print "Sorting everything\n"; |
||||
|
system ("$sort $tmp/filedir.deb > $tmp/sortfiledir.deb"); |
||||
|
unlink("$tmp/filedir.deb"); |
||||
|
|
||||
|
# grab the keys from the sorted file |
||||
|
print "Making the massive hash using lowmem\n"; |
||||
|
$| = 1; my $x = 1; |
||||
|
open(FILEDIR, "$tmp/sortfiledir.deb") or die "where is sortfiledir.deb?\n"; |
||||
|
while (<FILEDIR>) { |
||||
|
$x = 1 if $x == 6; |
||||
|
print "|\r" if $x == 1 || $x == 4; print "/\r" if $x == 2; |
||||
|
print "-\r" if $x == 3 || $x == 6; print "\\\r" if $x == 5; |
||||
|
$x++; |
||||
|
my ($place, $packname) = split(/ -> /,$_,2); |
||||
|
push(@tempholder,"$place -> $packname"); |
||||
|
if ($fcount != 0) { |
||||
|
my($tplace,$tpackname) = split(/ -> /,$tempholder[$fcount - 1],2); |
||||
|
chomp $tpackname; |
||||
|
# As long as they aren't different add to HL because they |
||||
|
# belong to a group. |
||||
|
if ($tplace eq $place) { |
||||
|
#print "$tplace and $place\n"; |
||||
|
$repeaters{$tplace}++; |
||||
|
if ($repeaters{$tplace} == 1) { |
||||
|
$temp = 0; |
||||
|
} |
||||
|
else { |
||||
|
$temp = $repeaters{$tplace} - 1; |
||||
|
} |
||||
|
$HL{$tplace}[$temp] = $tpackname; |
||||
|
} |
||||
|
# they new guy is different, but the old guy belongs to the |
||||
|
# previous group or not, so finish adding to %HL and then |
||||
|
# print out, and undef %HL |
||||
|
else { |
||||
|
#print "I AM DIFF $tplace\n"; |
||||
|
# finish adding |
||||
|
$repeaters{$tplace}++; |
||||
|
if ($repeaters{$tplace} == 1) { |
||||
|
$temp = 0; |
||||
|
} |
||||
|
else { |
||||
|
$temp = $repeaters{$tplace} - 1; |
||||
|
} |
||||
|
$HL{$tplace}[$temp] = $tpackname; |
||||
|
|
||||
|
# print out |
||||
|
open(BIG, ">>$tmp/big.debian") or die; |
||||
|
open(LONG, ">>$tmp/long.debian") or die; |
||||
|
my $thingo; |
||||
|
foreach $thingo (sort keys %HL ) { |
||||
|
my $tingy = "@{ $HL{$thingo} }"; |
||||
|
if (@{ $HL{$thingo} } > 1 || @{ $HL{$thingo} } eq "") { |
||||
|
print LONG "$thingo -> $tingy\n"; |
||||
|
} |
||||
|
elsif (@{ $HL{$thingo} } == 1) { |
||||
|
print BIG "$thingo -> $tingy\n"; |
||||
|
} |
||||
|
} |
||||
|
close(BIG); |
||||
|
close(LONG); |
||||
|
|
||||
|
# The whole key for lowmem systems |
||||
|
undef %repeaters; |
||||
|
undef %HL; |
||||
|
undef $tempholder[$fcount - 1]; |
||||
|
|
||||
|
} |
||||
|
} # if fcount ne 0 |
||||
|
|
||||
|
$fcount++; |
||||
|
} |
||||
|
|
||||
|
# also do this in db() & ndb() |
||||
|
unlink("$tmp/sortfiledir.deb"); |
||||
|
|
||||
|
|
||||
|
} # end sub pre_md |
@ -0,0 +1,78 @@ |
|||||
|
swim (0.3.6) - October 20 2000 |
||||
|
|
||||
|
-- Made swim perl-5.6 happy. Thanks to Douglas du Boulay |
||||
|
<ddb@crystal.uwa.edu.au> for pointing this out. |
||||
|
|
||||
|
swim (0.3.5) - January 28 2000 |
||||
|
|
||||
|
-- Fixed a minor bug pertaining to the mtime of Contents which occured |
||||
|
during initial building of the uninstalled filesystem using FDBDF or |
||||
|
DF. This bug arose as a result of a bug fix in 0.3.4. |
||||
|
|
||||
|
swim (0.3.4) - January 23 2000 |
||||
|
|
||||
|
-- Made the changelog and copyright option work properly in relation to |
||||
|
the fsstnd Debian has adopted with backwards compatibility. Fixed a |
||||
|
regexp in Qftp to properly deal with packages which match one another, |
||||
|
but aren't the same. Fixed xyzr to work properly with ps. Fixed share |
||||
|
-d/l output for p option. Added an indication when extraction |
||||
|
succeeds. Now Contents is properly filtered for ndb. Removed extra |
||||
|
output from menu for package option. Added example documentation, |
||||
|
thanks to John Lapeyre for the suggestion. Also, thanks to Joel Soete |
||||
|
for reporting corrupt sources from a faulty upload, and to tucows.com |
||||
|
for adding swim to their archive and awarding swim 5 Penguins. |
||||
|
|
||||
|
swim (0.3.3) - January 15 2000 |
||||
|
|
||||
|
-- Repaired a bug in longswim causing the uninstalled filesystem to be |
||||
|
made with packages which looked like spaces due to a return code error, |
||||
|
which caused some trouble for the virtual directories. ncontents is |
||||
|
now filtered of ./, though it was cool to look at. |
||||
|
|
||||
|
swim (0.3.2) - January 05 2000 |
||||
|
|
||||
|
-- Fixed to properly find documentation in the not-installed new Debian |
||||
|
share directories, perl5 in Depends for the new Debian perl policy, and |
||||
|
year 2000 in help. |
||||
|
|
||||
|
swim (0.3.1) - January 04 2000 |
||||
|
|
||||
|
-- Because of change in Debian's directory structure in Contents, added a |
||||
|
filter so that not-installed database is properly made without repeats. |
||||
|
Fixed a documentation error in QUICKSTART. Made swim@the.netpedia.net |
||||
|
default anonymous login. Minor documentation improvements. |
||||
|
|
||||
|
swim (0.3.0) - June 15 1999 |
||||
|
|
||||
|
-- The cleaned up version of 0.2.9. Rebuild databases if you were using |
||||
|
version 0.2.8 or less. |
||||
|
|
||||
|
swim (0.2.9) - May 14 1999 |
||||
|
|
||||
|
-- This is an interim release until 0.3.0 is released. Major bug fixes, |
||||
|
and some new features, including a history, and updating for |
||||
|
not-installed db. Rebuild databases if you were using an older version. |
||||
|
|
||||
|
swim (0.2.8) - Mar 13 1999 |
||||
|
|
||||
|
-- Fixed a minor bug which was preventing virtual options --xyz and --ftp |
||||
|
from working with searches. |
||||
|
-- Set the $swim_version variable to the right version number, and |
||||
|
automated the release process to avoid problems like the failure to |
||||
|
change this variable in the 0.2.7 release from occurring again. |
||||
|
|
||||
|
swim (0.2.7) - Mar 12 1999 |
||||
|
|
||||
|
-- Fixed a file test in SWIM::Conf which kept the initial directories from |
||||
|
being created on startup, making the program fail. Three names deserve |
||||
|
recognition: John Lapeyre, Jonathan P. Tomer, and Cale Epstein who all |
||||
|
provided their own perspective to the problem, I combined all three |
||||
|
approaches. Shaleh pointed out a packaging error. |
||||
|
|
||||
|
swim (0.2.6) |
||||
|
|
||||
|
-- First initial public offering around the beginning of March, 1999, |
||||
|
includes the main swim program, four exercise programs to help with |
||||
|
database creation, important swim manuals and twenty-five module |
||||
|
members. |
||||
|
-- swimmers ... take your mark ... go! |
@ -0,0 +1,7 @@ |
|||||
|
email: |
||||
|
|
||||
|
Jonathan D. Rosenbaum <mttrader@access.mountain.net> |
||||
|
|
||||
|
http: |
||||
|
|
||||
|
the.netpedia.net |
@ -0,0 +1,20 @@ |
|||||
|
#!/bin/bash |
||||
|
|
||||
|
# This is a simple approach. You could have a monthly Cron for stable and |
||||
|
# then update if any changes were observed, a weekly Cron for frozen, and |
||||
|
# a daily Cron for unstable. |
||||
|
|
||||
|
# For this example a default of unstable is assumed. |
||||
|
# This downloads only one Contents-arch for the unstable distribution. |
||||
|
# Updates the Packages using apt, and grabs the Contents-arch and Packages |
||||
|
# for the stable distribution if there are any changes. |
||||
|
# Update the sources: |
||||
|
swim --ftp --Contents DF --onec >> /var/log/swim.log 2>&1; |
||||
|
swim --apt --update >> /var/log/swim.log 2>&1; |
||||
|
swim --ftp --dists stable --onec >> /var/log/swim.log 2>&1; |
||||
|
|
||||
|
# This will update the database for the default distribution/architecture |
||||
|
# using 'cron' to automatically pick the newest packages. |
||||
|
# Update the databases: |
||||
|
swim --db >> /var/log/swim.log 2>&1; |
||||
|
swim --ndb APT --cron --Contents DF >> /var/log/swim.log 2>&1; |
@ -0,0 +1,263 @@ |
|||||
|
# Package administration and research tool for Debian |
||||
|
# Copyright (C) 1999-2000 Jonathan D. Rosenbaum |
||||
|
|
||||
|
# This program 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. |
||||
|
|
||||
|
# This program 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 this program; if not, write to the Free Software |
||||
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
||||
|
|
||||
|
|
||||
|
package SWIM::Ag; |
||||
|
use strict; |
||||
|
use SWIM::Global qw(:Info $file_now); |
||||
|
use SWIM::DB_Library qw(:Xyz); |
||||
|
use SWIM::Info; |
||||
|
use SWIM::Pn_print; |
||||
|
use SWIM::Deps; |
||||
|
use vars qw(@ISA @EXPORT); |
||||
|
use Exporter; |
||||
|
@ISA = qw(Exporter); |
||||
|
@EXPORT = qw(description q_description); |
||||
|
|
||||
|
|
||||
|
# stuff to query package names, -a, and groups |
||||
|
|
||||
|
# -qi <packages name> Anotherwards that big thing of info...also |
||||
|
# -c, -l |
||||
|
sub description { |
||||
|
|
||||
|
my ($commands) = @_; |
||||
|
my %commands = %$commands; |
||||
|
|
||||
|
if ($commands->{"scripts"} || $commands->{"preinst"} || |
||||
|
$commands->{"postinst"} || $commands->{"prerm"} || |
||||
|
$commands->{"postrm"}) { |
||||
|
scripts(\%commands); |
||||
|
} |
||||
|
menu(\%commands) if $commands->{"menu"} || $commands->{"m"}; |
||||
|
copyright(\%commands) if $commands->{"copyright"}; |
||||
|
changelog(\%commands) if $commands->{"changelog"}; |
||||
|
|
||||
|
if (!$commands->{"n"}) { |
||||
|
dbi(\%commands); |
||||
|
} |
||||
|
else { |
||||
|
ndb(\%commands); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
if (defined $argument) { |
||||
|
# We will check for more than two..just in case |
||||
|
if ($argument !~ /_/) { |
||||
|
if (defined $db{$argument}) { |
||||
|
$argument = $db{$argument}; |
||||
|
} |
||||
|
} |
||||
|
if ($db{"$argument"}){ |
||||
|
my $package = $db{"$argument"}; |
||||
|
print $package; |
||||
|
} |
||||
|
else { |
||||
|
print "package $argument is not installed\n"; |
||||
|
exit; |
||||
|
} |
||||
|
} |
||||
|
untie %db; |
||||
|
|
||||
|
|
||||
|
character(\%commands); |
||||
|
shlibs(\%commands) if $commands->{"shlibs"}; |
||||
|
|
||||
|
if ($commands->{"c"} && !($commands->{"l"} || $commands->{"d"})) { |
||||
|
if (conf(\%commands) ne 0) { |
||||
|
print conf(\%commands) if !$commands->{"md5sum"}; |
||||
|
# here for a reason |
||||
|
# if -i because calls from qindexer. |
||||
|
if ($commands->{"i"}) { |
||||
|
require SWIM::File; |
||||
|
SWIM::File->import(qw(file)); |
||||
|
file(\%commands) |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
if (($commands->{"c"} && ($commands->{"l"} || $commands->{"d"})) || |
||||
|
($commands->{"l"} || $commands->{"d"})) { |
||||
|
if ($commands->{"c"} && conf(\%commands) ne 0) { |
||||
|
print conf(\%commands) if !$commands->{"md5sum"}; |
||||
|
} |
||||
|
require SWIM::File; |
||||
|
SWIM::File->import(qw(file)); |
||||
|
file(\%commands); |
||||
|
} |
||||
|
|
||||
|
if (!($commands->{"z"} || $commands->{"ftp"} || |
||||
|
$commands->{"remove"} || $commands->{"r"} || |
||||
|
$commands->{"purge"})) { |
||||
|
if ($commands->{"x"} || $commands->{"ftp"} || $commands->{"source"} || |
||||
|
$commands->{"source_only"} || $commands->{"remove"} || |
||||
|
$commands->{"r"} || $commands->{"purge"}) { |
||||
|
require SWIM::Safex; |
||||
|
SWIM::Safex->import(qw(safex)); |
||||
|
safex(\%commands); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
} # end sub description |
||||
|
|
||||
|
# Access Descriptions, and other stuff for known <packages>. |
||||
|
# This includes -ql(d)c, -qc or plain -q (just the package name and |
||||
|
# version). Anotherwards if -i isn't used this sub is called. And |
||||
|
# -ql is handled by file. Mostly, this was designed for calling a single |
||||
|
# package name on the command line without a known package title except |
||||
|
# when -q is called by itself, but using -T is an exception since this is |
||||
|
# useful. |
||||
|
sub q_description { |
||||
|
|
||||
|
my ($commands) = @_; |
||||
|
my %commands = %$commands; |
||||
|
|
||||
|
if ($commands->{"scripts"} || $commands->{"preinst"} || |
||||
|
$commands->{"postinst"} || $commands->{"prerm"} || |
||||
|
$commands->{"postrm"}) { |
||||
|
scripts(\%commands); |
||||
|
} |
||||
|
menu(\%commands) if $commands->{"menu"} || $commands->{"m"}; |
||||
|
copyright(\%commands) if $commands->{"copyright"}; |
||||
|
changelog(\%commands) if $commands->{"changelog"}; |
||||
|
|
||||
|
|
||||
|
if (!$commands->{"n"}) { |
||||
|
dbi(\%commands); |
||||
|
} |
||||
|
else { |
||||
|
ndb(\%commands); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
if (defined $argument) { |
||||
|
if ($argument !~ /_/) { |
||||
|
if (defined $db{$argument}) { |
||||
|
$argument = $db{$argument}; |
||||
|
} |
||||
|
if ($commands->{"c"} && $commands->{"d"}) { |
||||
|
require SWIM::File; |
||||
|
SWIM::File->import(qw(file)); |
||||
|
print "$argument\n" if $commands->{"g"}; |
||||
|
character(\%commands); |
||||
|
shlibs(\%commands) if $commands->{"shlibs"}; |
||||
|
if (conf(\%commands) ne 0) { |
||||
|
print conf(\%commands) if !$commands->{"md5sum"}; |
||||
|
} |
||||
|
# it's nice to print out -d with -c, so this was added. |
||||
|
file(\%commands); |
||||
|
} |
||||
|
elsif ($commands->{"c"}) { |
||||
|
# this produces annoying spaces |
||||
|
print "$argument\n" if $commands->{"g"} && conf(\%commands) ne 0; |
||||
|
character(\%commands); |
||||
|
shlibs(\%commands) if $commands->{"shlibs"}; |
||||
|
if (conf(\%commands) ne 0) { |
||||
|
print conf(\%commands) if !$commands->{"md5sum"}; |
||||
|
if ($commands->{"md5sum"}) { |
||||
|
require SWIM::File; |
||||
|
SWIM::File->import(qw(file)); |
||||
|
file(\%commands); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
elsif ($db{$argument} && !$commands->{"c"}) { |
||||
|
print "$argument\n" if $commands->{"T"} || |
||||
|
$commands->{"depends"} || $commands->{"pre_depends"} || |
||||
|
$commands->{"recommends"} || $commands->{"suggests"} || |
||||
|
$commands->{"conflicts"} || $commands->{"replaces"} || |
||||
|
$commands->{"provides"}; |
||||
|
singular(\%commands); |
||||
|
character(\%commands); |
||||
|
shlibs(\%commands) if $commands->{"shlibs"}; |
||||
|
print "\n" if $commands->{"T"} || |
||||
|
$commands->{"depends"} || $commands->{"pre_depends"} || |
||||
|
$commands->{"recommends"} || $commands->{"suggests"} || |
||||
|
$commands->{"conflicts"} || $commands->{"replaces"} || |
||||
|
$commands->{"provides"}; |
||||
|
} |
||||
|
else { print "package $argument is not installed\n"; } |
||||
|
} |
||||
|
elsif ($argument =~ /_/) { |
||||
|
if ($commands->{"c"} && $commands->{"d"}) { |
||||
|
print "$argument\n" if $commands->{"g"}; |
||||
|
character(\%commands); |
||||
|
shlibs(\%commands) if $commands->{"shlibs"}; |
||||
|
print conf(\%commands) if conf(\%commands) ne 0 && !$commands->{"md5sum"}; |
||||
|
require SWIM::File; |
||||
|
SWIM::File->import(qw(file)); |
||||
|
file(\%commands); |
||||
|
} |
||||
|
elsif ($commands->{"c"}) { |
||||
|
my $check = conf(\%commands); |
||||
|
print "$argument\n" if $commands->{"g"} && $check ne 0 || |
||||
|
$commands->{"l"}; |
||||
|
character(\%commands); |
||||
|
shlibs(\%commands) if $commands->{"shlibs"}; |
||||
|
if (conf(\%commands) ne 0) { |
||||
|
print conf(\%commands) if !$commands->{"md5sum"}; |
||||
|
require SWIM::File; |
||||
|
SWIM::File->import(qw(file)); |
||||
|
file(\%commands); |
||||
|
} |
||||
|
elsif (conf(\%commands) == 0) { |
||||
|
require SWIM::File; |
||||
|
SWIM::File->import(qw(file)); |
||||
|
file(\%commands); |
||||
|
} |
||||
|
} |
||||
|
elsif ($db{$argument} && !$commands->{"c"}) { |
||||
|
# watch this |
||||
|
##print "$argument\n" if $commands->{"g"}; |
||||
|
print "$argument\n" if $commands->{"T"} || |
||||
|
$commands->{"depends"} || $commands->{"pre_depends"} || |
||||
|
$commands->{"recommends"} || $commands->{"suggests"} || |
||||
|
$commands->{"conflicts"} || $commands->{"replaces"} || |
||||
|
$commands->{"provides"}; |
||||
|
singular(\%commands); |
||||
|
character(\%commands); |
||||
|
shlibs(\%commands) if $commands->{"shlibs"}; |
||||
|
print "\n" if $commands->{"T"} || |
||||
|
$commands->{"depends"} || $commands->{"pre_depends"} || |
||||
|
$commands->{"recommends"} || $commands->{"suggests"} || |
||||
|
$commands->{"conflicts"} || $commands->{"replaces"} || |
||||
|
$commands->{"provides"}; |
||||
|
} |
||||
|
else { print "package $argument is not installed\n"; } |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
untie %db; |
||||
|
|
||||
|
if (!defined $file_now && |
||||
|
!($commands->{"z"} || $commands->{"ftp"} || |
||||
|
$commands->{"remove"} || $commands->{"r"} || |
||||
|
$commands->{"purge"})) { |
||||
|
if ($commands->{"x"} || $commands->{"ftp"} || $commands->{"source"} || |
||||
|
$commands->{"source_only"} || $commands->{"remove"} || |
||||
|
$commands->{"r"} || $commands->{"purge"}) { |
||||
|
require SWIM::Safex; |
||||
|
SWIM::Safex->import(qw(safex)); |
||||
|
safex(\%commands); |
||||
|
} |
||||
|
} |
||||
|
} # end sub q_description |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
1; |
File diff suppressed because it is too large
@ -0,0 +1,358 @@ |
|||||
|
# Package administration and research tool for Debian |
||||
|
# Copyright (C) 1999-2000 Jonathan D. Rosenbaum |
||||
|
|
||||
|
# This program 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. |
||||
|
|
||||
|
# This program 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 this program; if not, write to the Free Software |
||||
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
||||
|
|
||||
|
|
||||
|
package SWIM::Compare; |
||||
|
use strict; |
||||
|
use SWIM::Conf qw($dpkg); |
||||
|
use SWIM::Library; |
||||
|
use vars qw(@ISA @EXPORT %EXPORT_TAGS); |
||||
|
use Exporter; |
||||
|
@ISA = qw(Exporter); |
||||
|
@EXPORT = qw(comparison compare_versions); |
||||
|
|
||||
|
# comparison function and checking function (-v) for not-installed databases |
||||
|
|
||||
|
=pod |
||||
|
|
||||
|
DEVELOPMENTAL |
||||
|
|
||||
|
This uses the comparison method mentioned in the packaging manual. It |
||||
|
will look for an epoch *: or the absence, and a revision -* or the |
||||
|
absence. First the epoch is compared, then the upstream-version, than |
||||
|
the debian-revision. The sub will stop and return a value as soon as |
||||
|
a difference is found. A look in the dpkg attic helped out (compare_vnumbers) |
||||
|
here, but lib.pl used separate subs, and doesn't appear to check for |
||||
|
an epoch separately, ofcourse there may have not been an epoch. This |
||||
|
uses the special variable $&, but apparently this isn't as big a waste |
||||
|
of resources in later versions of Perl, but there will be some |
||||
|
experiments and benchmarks for alternatives in the future for this sub. |
||||
|
There some rules built into comparison() to deal with patch to non-patch, |
||||
|
more than one hyphen (-). This involves a little transformation. |
||||
|
You can verify that this sub is working by doing perl -e '$five =\ |
||||
|
system "dpkg --compare-versions 10 gt 1.0.17"; print "nop\n" if $five\ |
||||
|
== 256; print "yes\n" if $five == 0', take a look at the scripts, too. |
||||
|
Also, use -v (compare_versions()) when using --initndb or --rebuildndb |
||||
|
for a report. |
||||
|
|
||||
|
=cut |
||||
|
|
||||
|
sub comparison { |
||||
|
|
||||
|
# $pversion = version from Packages.gz |
||||
|
# $eversion = version from nstatusindex-arch-dist.deb |
||||
|
|
||||
|
my($pversion,$eversion) = @_; |
||||
|
my($epoch, $upstream, $revision); |
||||
|
my($eepoch, $eupstream, $erevision); |
||||
|
my($revisiond,$erevisiond); |
||||
|
my $result; |
||||
|
|
||||
|
# If the two versions "eq" one another no reason to go on |
||||
|
if ($pversion ne $eversion) { |
||||
|
|
||||
|
# check epoch first, go on if the same |
||||
|
######### |
||||
|
# EPOCH # |
||||
|
######### |
||||
|
if ($pversion =~ /:/ || $eversion =~ /:/) { |
||||
|
if ($pversion =~ /:/) { |
||||
|
($epoch,$upstream) = split(/:/,$pversion,2); |
||||
|
} |
||||
|
else { |
||||
|
$epoch = 0; $upstream = $pversion; |
||||
|
} |
||||
|
if ($eversion =~ /:/) { |
||||
|
($eepoch,$eupstream) = split(/:/,$eversion,2); |
||||
|
} |
||||
|
else { |
||||
|
$eepoch = 0; $eupstream = $eversion; |
||||
|
} |
||||
|
do { |
||||
|
|
||||
|
$epoch =~ s/^\d*//; my $epochd = $&; |
||||
|
$eepoch =~ s/^\d*//; my $eepochd = $&; |
||||
|
$result = $epochd <=> $eepochd; |
||||
|
return "<" if $result == -1; |
||||
|
return ">" if $result == 1; |
||||
|
|
||||
|
} while (length ($epoch) && length ($eepoch)); |
||||
|
#return length ($a) cmp length ($b); |
||||
|
} # end if epoch |
||||
|
else { |
||||
|
$epoch = 0; $upstream = $pversion; |
||||
|
$eepoch = 0; $eupstream = $eversion; |
||||
|
} |
||||
|
|
||||
|
# Check the upstream-revision next |
||||
|
##################### |
||||
|
# UPSTREAM-REVISION # |
||||
|
##################### |
||||
|
if ($upstream || $eupstream) { |
||||
|
# we need to run a little test in case hyphens exists more than once |
||||
|
if ($upstream =~ /-/) { |
||||
|
my $hyphen = ($upstream =~ tr/-//); |
||||
|
if ($hyphen > 1) { |
||||
|
$upstream =~ m,(^.*)-(.*$),; |
||||
|
$upstream = $1; |
||||
|
$revision = $2; |
||||
|
} |
||||
|
else { |
||||
|
($upstream,$revision) = split(/-/,$upstream,2); |
||||
|
} |
||||
|
} |
||||
|
else { |
||||
|
# because the absence is considered earlier, and the convention |
||||
|
# is to use -1. |
||||
|
$revision = 0; |
||||
|
} |
||||
|
# we need to run a little test in case hyphens exists more than once |
||||
|
if ($eupstream =~ /-/) { |
||||
|
my $hyphen = ($eupstream =~ tr/-//); |
||||
|
if ($hyphen > 1) { |
||||
|
$eupstream =~ m,(^.*)-(.*$),; |
||||
|
$eupstream = $1; |
||||
|
$erevision = $2; |
||||
|
} |
||||
|
else { |
||||
|
($eupstream,$erevision) = split(/-/,$eupstream,2); |
||||
|
} |
||||
|
} |
||||
|
else { |
||||
|
# because the absence is considered earlier, and the convention |
||||
|
# is to use -1. |
||||
|
$erevision = 0; |
||||
|
} |
||||
|
do { |
||||
|
# letters |
||||
|
$upstream =~ s/^\D*//; my $upstreamd = $&; |
||||
|
$eupstream =~ s/^\D*//; my $eupstreamd = $&; |
||||
|
|
||||
|
# hopefully this handles nasty beta situations |
||||
|
if ($upstreamd eq "b" and $eupstreamd eq "." ) { |
||||
|
return "<"; |
||||
|
} |
||||
|
elsif ($upstreamd eq "." and $eupstreamd eq "b" ) { |
||||
|
return ">"; |
||||
|
} |
||||
|
elsif ($upstreamd eq "beta" and $eupstreamd eq "." ) { |
||||
|
return "<"; |
||||
|
} |
||||
|
elsif ($upstreamd eq "." and $eupstreamd eq "beta" ) { |
||||
|
return ">"; |
||||
|
} |
||||
|
elsif ($upstreamd eq "." and $eupstreamd eq "-pre-") { |
||||
|
return ">"; |
||||
|
} |
||||
|
elsif ($eupstreamd eq "." and $upstreamd eq "-pre-") { |
||||
|
return "<"; |
||||
|
} |
||||
|
|
||||
|
# solves problems when "." is compared to letters, and also a weird |
||||
|
# case involving a patched version changing to a non-patched version. |
||||
|
if ($upstreamd =~ /\./) { |
||||
|
if ($eupstreamd =~ /\w/) { |
||||
|
if ($eupstreamd =~ /pl/ && $upstreamd !~ /pl/) { |
||||
|
$eupstreamd = ""; |
||||
|
} |
||||
|
elsif ($upstreamd !~ /\.\w{2,10}/) { |
||||
|
$eupstreamd = "."; |
||||
|
} |
||||
|
} |
||||
|
elsif ($eupstreamd eq "") { |
||||
|
$eupstreamd = "."; |
||||
|
} |
||||
|
} |
||||
|
# the weird -pre situation |
||||
|
elsif ($upstreamd =~ /-pre/ || $eupstreamd =~ /-pre/) { |
||||
|
$upstreamd = ""; $eupstreamd = ""; |
||||
|
} |
||||
|
|
||||
|
if ( $eupstreamd =~ /\./) { |
||||
|
if ($upstreamd =~ /\w/) { |
||||
|
if ($upstreamd =~ /pl/ && $eupstreamd !~ /pl/) { |
||||
|
$upstreamd = ""; |
||||
|
} |
||||
|
elsif ($upstreamd !~ /\.\w{2,10}/) { |
||||
|
$upstreamd = "."; |
||||
|
} |
||||
|
} |
||||
|
elsif ($upstreamd eq "") { |
||||
|
$upstreamd = "."; |
||||
|
} |
||||
|
} |
||||
|
# the weird -pre situation |
||||
|
elsif ($upstreamd =~ /-pre/ || $eupstreamd =~ /-pre/) { |
||||
|
$upstreamd = ""; $eupstreamd = ""; |
||||
|
} |
||||
|
|
||||
|
$result = $upstreamd cmp $eupstreamd; |
||||
|
return "<" if $result == -1; |
||||
|
return ">" if $result == 1; |
||||
|
# it's importantant to realize that . & + are being checked for |
||||
|
# above. : and - have already been dealt with. cmp seems to deal with |
||||
|
# these characters with no problems. |
||||
|
|
||||
|
|
||||
|
# numbers |
||||
|
|
||||
|
# found a little problem with <=> when number's eq "", |
||||
|
# but this doesn't effect cmp. |
||||
|
if ($upstream eq "") { |
||||
|
if ($eupstream eq ".") { |
||||
|
$upstream = "."; |
||||
|
} |
||||
|
else { |
||||
|
$upstream = 0; |
||||
|
} |
||||
|
} |
||||
|
if ( $eupstream eq "") { |
||||
|
if ($upstream eq ".") { |
||||
|
$eupstream = "."; |
||||
|
} |
||||
|
else { |
||||
|
$eupstream = 0; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
$upstream =~ s/^\d*//; $upstreamd = $&; |
||||
|
$eupstream =~ s/^\d*//; $eupstreamd = $&; |
||||
|
$result = $upstreamd <=> $eupstreamd; |
||||
|
return "<" if $result == -1; |
||||
|
return ">" if $result == 1; |
||||
|
} while (length ($upstream) || length ($eupstream)) |
||||
|
} # end if upstream |
||||
|
else { |
||||
|
$revision = 0; |
||||
|
$erevision = 0; |
||||
|
} |
||||
|
|
||||
|
# Finally, check the revision |
||||
|
############ |
||||
|
# REVISION # |
||||
|
############ |
||||
|
if ($revision || $erevision) { |
||||
|
do { |
||||
|
# letters |
||||
|
$revision =~ s/^\D*//; $revisiond = $&; #$revisiond =~ s/\W/ /g; |
||||
|
$erevision =~ s/^\D*//; $erevisiond = $&; #$erevisiond =~ s/\W/ /g; |
||||
|
|
||||
|
# pre in the revision |
||||
|
if ($revisiond eq "." and $erevisiond eq "pre") { |
||||
|
return "r>"; |
||||
|
} |
||||
|
elsif ($erevisiond eq "." and $revisiond eq "pre") { |
||||
|
return "r<"; |
||||
|
} |
||||
|
$result = $revisiond cmp $erevisiond; |
||||
|
return "r<" if $result == -1; |
||||
|
return "r>" if $result == 1; |
||||
|
# it's importantant to realize that . & + are being checked for |
||||
|
# above. : and - have already been dealt with. cmp seems to deal with |
||||
|
# these characters with no problems. |
||||
|
|
||||
|
# numbers |
||||
|
# found a little problem with <=> when number's eq "", |
||||
|
# but this doesn't effect cmp. |
||||
|
if ($revision eq "") { |
||||
|
if ($erevision eq ".") { |
||||
|
$revision = "."; |
||||
|
} |
||||
|
else { |
||||
|
$revision = 0; |
||||
|
} |
||||
|
} |
||||
|
if ( $erevision eq "") { |
||||
|
if ($revision eq ".") { |
||||
|
$erevision = "."; |
||||
|
} |
||||
|
else { |
||||
|
$erevision = 0; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
$revision =~ s/^\d*//; $revisiond = $&; |
||||
|
$erevision =~ s/^\d*//; $erevisiond = $&; |
||||
|
$result = $revisiond <=> $erevisiond; |
||||
|
return "r<" if $result == -1; |
||||
|
return "r>" if $result == 1; |
||||
|
} while (length ($revision) && length ($erevision)); |
||||
|
} # end if revision |
||||
|
|
||||
|
# still 0? check the remainder..this is just for letters which may have |
||||
|
# been mulled over because they looked like words \w. |
||||
|
if ($result == 0) { |
||||
|
$result = $epoch cmp $eepoch || $upstream cmp $eupstream || |
||||
|
$revision cmp $erevision; |
||||
|
return "<" if $result == -1; |
||||
|
return ">" if $result == 1; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
} # end sub comparison |
||||
|
|
||||
|
|
||||
|
# This produces a report to make sure that comparison() is up to par, and |
||||
|
# is called with -v. It uses dpkg's --compare-versions. The advantage of |
||||
|
# not normally running --compare-versions is portability. People using |
||||
|
# other distribution's don't need dpkg installed, and people using weird |
||||
|
# Oses who can't use dpkg can still explore a virtual installation. |
||||
|
sub compare_versions { |
||||
|
|
||||
|
# The test result is put in .version_compare |
||||
|
|
||||
|
# $result = operand (result from comparison) |
||||
|
# $virtual = version from Packages.gz |
||||
|
# $installed = version from nstatusindex-arch-dist.deb |
||||
|
# $name = packagename |
||||
|
# $commands = options |
||||
|
|
||||
|
my ($result, $virtual, $installed, $name, $commands) = @_; |
||||
|
my %commands = %$commands; |
||||
|
my ($cv, $cv_result, $cresult); |
||||
|
my $place = finddb(\%commands); |
||||
|
|
||||
|
# usually it will be greater |
||||
|
if (defined $dpkg) { |
||||
|
$cv = system "$dpkg", "--compare-versions", "$virtual", "gt", "$installed"; |
||||
|
|
||||
|
$cv_result = "no" if $cv == 256; |
||||
|
$cv_result = "yes" if $cv == 0; |
||||
|
#$cresult = "no" if $result =~ m,[r]?<,; |
||||
|
#$cresult = "yes" if $result =~ m,[r]?>,; |
||||
|
$cresult = "no" if $result eq "<" || $result eq "r<"; |
||||
|
$cresult = "yes" if $result eq ">" || $result eq "r>"; |
||||
|
|
||||
|
open(CV,">>$place/.version_compare") |
||||
|
or warn "couldn't create version compare report\n"; |
||||
|
if ($cresult eq "yes" && $cv_result eq "no") { |
||||
|
print CV "$name:\ndpkg - $virtual < $installed\nswim - $virtual > $installed\n\n"; |
||||
|
} |
||||
|
elsif ($cresult eq "no" && $cv_result eq "yes") { |
||||
|
print CV "$name:\ndpkg - $virtual > $installed\nswim - $virtual < $installed\n\n"; |
||||
|
} |
||||
|
else { |
||||
|
return; |
||||
|
} |
||||
|
close(CV); |
||||
|
} |
||||
|
|
||||
|
} # end sub compare_versions |
||||
|
|
||||
|
|
||||
|
|
||||
|
1; |
@ -0,0 +1,672 @@ |
|||||
|
# Package administration and research tool for Debian |
||||
|
# Copyright (C) 1999-2000 Jonathan D. Rosenbaum |
||||
|
|
||||
|
# This program 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. |
||||
|
|
||||
|
# This program 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 this program; if not, write to the Free Software |
||||
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
||||
|
|
||||
|
|
||||
|
package SWIM::Conf; |
||||
|
use vars qw(@ISA @EXPORT %EXPORT_TAGS); |
||||
|
use Exporter; |
||||
|
@ISA = qw(Exporter); |
||||
|
|
||||
|
@EXPORT = qw($my_number $tmp $architecture $distribution @user_defined_section |
||||
|
$default_directory $default_root_directory $permission $dpkg |
||||
|
$dpkg_deb $ar $gcc $apt_get $apt_cache $sources @FTP $spl $cat |
||||
|
$sort $md5sum $zcat $tar $grep $gzip $fastswim $slowswim $longswim |
||||
|
$mount $umount $mke2fs $copy $pager $base $pwd $parent $library |
||||
|
$splt $mv $imswim $swim_conf $debug $port $timeout |
||||
|
$firewall $passive $apt_sources $HISTORY $alt); |
||||
|
%EXPORT_TAGS = ( |
||||
|
Path => [ qw($tmp $parent $base $library) ], |
||||
|
Deb => [ qw($pwd $dpkg_deb $ar $tar $grep $tmp $md5sum $cat $mv) ], |
||||
|
Qftp => [ qw($default_root_directory $permission @FTP |
||||
|
$default_directory $swim_conf) ], |
||||
|
Info => [ qw($parent $base $zcat) ] |
||||
|
); |
||||
|
|
||||
|
|
||||
|
|
||||
|
############################# |
||||
|
# DEFAULT PROGRAM VARIABLES # |
||||
|
############################# |
||||
|
|
||||
|
# You can change this to how many lines you would like "swim -qf <>" to |
||||
|
# print out, before asking for -t or --total, it will automatically ask |
||||
|
# though, if there is more than one package and you used the option -i. |
||||
|
# Remember -t can be used with --scripts family members to view the |
||||
|
# title of the script file regardless of this setting, and if -t has to be |
||||
|
# used, the titles will be displayed, which makes sense. |
||||
|
$my_number = 23; |
||||
|
|
||||
|
# Just like a shell, you can keep a history of whatever length you want. |
||||
|
$HISTORY = 10; |
||||
|
|
||||
|
# For not-installed: |
||||
|
# This part supplies the default value for --arch. |
||||
|
# |
||||
|
# You can determine the default architecture used when -n is |
||||
|
# called or a not-installed database is made. Architectures are always |
||||
|
# being added so check with Debian to find a list. There is alpha, arm, |
||||
|
# hurd (alternative kernel to linux), i386, m68k, powerpc, sparc. Just use |
||||
|
# the arch found after the hyphen in the Contents-(arch) file. |
||||
|
$architecture = "i386"; |
||||
|
|
||||
|
# For not-installed: |
||||
|
# This part supplies the default value for --dists. |
||||
|
# |
||||
|
# The default distribution can be either stable, unstable, frozen, or |
||||
|
# experimental (rare). These represent the state of development that the |
||||
|
# packages are under. The unstable distribution can have lot's of changes |
||||
|
# within a very short time period, and frozen may or may not be available. |
||||
|
$distribution = "unstable"; |
||||
|
|
||||
|
|
||||
|
#For not-installed: |
||||
|
#This part supplies the default value for --main, --contrib, --non-free, |
||||
|
#and --non-us. |
||||
|
|
||||
|
# Distributions are divided into the sections. These sections are called |
||||
|
# distributions in the version 2.4.1.0 packaging manual, because they were at |
||||
|
# one time separate distributions, but this has since changed. You can |
||||
|
# determine which of these sections (main, non-free, contrib or non-US) to |
||||
|
# pull out of the Contents file if you don't want to use --main, --contrib, |
||||
|
# --non-free, and --non-us to selectively pick sections. Basically, whatever |
||||
|
# you pull out should match the Package(s) file(s) you are targetting, this |
||||
|
# program is friendly if you make a mistake, but it's more effecient to pull |
||||
|
# out just what you want. If the same package happens to exist in two |
||||
|
# different sections, main and non-us for example (which is really a |
||||
|
# situation that shouldn't exist, yet it does), you will still be able to |
||||
|
# find this package in the non-us group, but its section and locations will be |
||||
|
# the one which main recognizes assuming that you use the order in the example |
||||
|
# below. |
||||
|
|
||||
|
# Setting it up: |
||||
|
# Example: You just want to pull out main and contrib every time you run |
||||
|
# --initndb, --rebuildndb, or --ndb. |
||||
|
# @user_defined_section = qw(main contrib non-US); |
||||
|
# remember "non-US" not "non-us". |
||||
|
|
||||
|
# untill non-US is fixed the second is better |
||||
|
#@user_defined_section = qw(main contrib non-free non-US); |
||||
|
@user_defined_section = qw(main contrib non-free); |
||||
|
|
||||
|
# Usually, this is |
||||
|
$alt = "debian"; |
||||
|
|
||||
|
################ |
||||
|
# DF LOCATION # |
||||
|
################ |
||||
|
|
||||
|
# A little philosophy: |
||||
|
# swim was developed for maximum versatility, so whether you are just |
||||
|
# interested in researching, and keeping tabs on the newest packages, |
||||
|
# or maintaining a Debian virtual distribution on a non-Debian real |
||||
|
# distribution, or you are a using swim for distribution development, swim |
||||
|
# provides a way. The default directory (DF - which can also mean |
||||
|
# directory/file) keeps track of Contents and Packages files downloaded |
||||
|
# using --ftp, and gives the files names specific to the distribution and |
||||
|
# architectures they represent. But, you also have the freedom not to use |
||||
|
# the default directory in this case swim will still do the renaming and |
||||
|
# keeping track of the mtime, but you will have to remember where you put |
||||
|
# the files. On the other hand, if you use apt, you won't even have to use |
||||
|
# the DF directory for Packages files because you can get the ones specific |
||||
|
# to your own systems architecture from apt, but if you want to look at |
||||
|
# other architectures you will need to use the DF directory or one of your |
||||
|
# own choice. |
||||
|
# Naming Convention: Contents = Contents-dist.gz |
||||
|
# Packages = Packages-arch-dist-section.gz |
||||
|
$default_directory = '/root/.swim'; |
||||
|
|
||||
|
|
||||
|
# The default root directory is the key to easy management of packages |
||||
|
# downloaded through --ftp and --file, and provides an easy way to put together |
||||
|
# a personalized distribution. Future implementations of swim will provide |
||||
|
# a distribution called personal..Packages and Contents files specific to |
||||
|
# this distribution will automatically be made. This directory can be a |
||||
|
# real ftp site on your computer, or put where ever else you are allowed |
||||
|
# to have directories. dists/distribution/section/architecture/subject will be |
||||
|
# placed above this directory. No matter what, debian must be the final |
||||
|
# directory before dists. Other distributions are placed alongside debian, |
||||
|
# like debian-non-US or personal. |
||||
|
# Feel free to change the permissions. This directory is above your default_ |
||||
|
# directory. |
||||
|
$default_root_directory = '/pub/debian'; |
||||
|
|
||||
|
# Because you may be using a real ftp site, this configuration allows you |
||||
|
# to determine what permissions swim will set for directories it creates |
||||
|
# above the default root directory. |
||||
|
$permission = '0755'; |
||||
|
|
||||
|
|
||||
|
############### |
||||
|
# AR or DPKG? # |
||||
|
############### |
||||
|
|
||||
|
# NOTE: users set these next two with the $package_tool variable. |
||||
|
|
||||
|
# packaging friends dpkg and dpkg-deb come from the essential and |
||||
|
# required dpkg package. ar from the package binutils can also be used (below). |
||||
|
# This is the archival program used for deb packages, but binutils is just |
||||
|
# a standard non-essential package, and the ar capabilities are built into |
||||
|
# dpkg-deb, and it's better not to assume that the standard packages are |
||||
|
# even established, yet. |
||||
|
$dpkg = (); |
||||
|
$dpkg_deb = (); |
||||
|
|
||||
|
|
||||
|
# If you don't have the dpkg package on your system then you can use ar |
||||
|
# from the package binutils. This would be a standard, but not an essential |
||||
|
# package in Debian, but this package is also fairly standard amongst all |
||||
|
# distributions, and can even be found in the free djgpp for M$ Oses. |
||||
|
# Since people who have both dpkg and ar may want to try the ar method, |
||||
|
# rather than creating an automatic check, just assign a value to either |
||||
|
# ($dpkg & $dpkg_deb) or just $ar. |
||||
|
#my $ar = '/usr/bin/ar'; # same for RH |
||||
|
$ar = '/usr/bin/ar'; |
||||
|
|
||||
|
|
||||
|
####### |
||||
|
# APT # |
||||
|
####### |
||||
|
|
||||
|
# NOTE: users set apt-get and apt-cache with the $apt variable |
||||
|
|
||||
|
# If you have apt you are in luck. |
||||
|
$apt_get = (); |
||||
|
$apt_cache = (); |
||||
|
$sources = '/etc/apt/sources.list'; |
||||
|
$apt_sources = '/var/state/apt/lists'; |
||||
|
|
||||
|
######### |
||||
|
# PAGER # |
||||
|
######### |
||||
|
|
||||
|
# less is a nice pager, unless you like more! There is an option |
||||
|
# --nopager or -n. Pager is used for --help and swim called without any |
||||
|
# options. more comes from the required package util-linux, whereas |
||||
|
# less comes from a standard package called less. In the future there is |
||||
|
# a possiblity that a large percentage of swim may use an internal pager. |
||||
|
# less, more, or most or... |
||||
|
#$ENV{PAGER} = "/usr/bin/less"; # same RH |
||||
|
$ENV{PAGER} = "less"; |
||||
|
$pager = $ENV{PAGER}; |
||||
|
|
||||
|
|
||||
|
|
||||
|
################# |
||||
|
# SWIM PROGRAMS # |
||||
|
################# |
||||
|
|
||||
|
# This is replaced by the Makefile. |
||||
|
$pre="/usr"; |
||||
|
|
||||
|
# This is the hash making program fastswim. |
||||
|
$fastswim = "$pre/lib/SWIM/fastswim"; |
||||
|
|
||||
|
# imswim in an alternative to fastswim for --lowmem |
||||
|
$imswim = "$pre/lib/SWIM/imswim"; |
||||
|
|
||||
|
# This is the low memory program slowswim. |
||||
|
$slowswim = "$pre/lib/SWIM/slowswim"; |
||||
|
|
||||
|
# This is the dir/file making program longswim. |
||||
|
$longswim = "$pre/lib/SWIM/longswim"; |
||||
|
|
||||
|
############ |
||||
|
# TEMP DIR # |
||||
|
############ |
||||
|
|
||||
|
# If you want to set an alternative directory for the temporary files |
||||
|
# created when the databases are made, change here. You may want to make |
||||
|
# $tmp a RAM disk. See package loadlin for initrd documentation and an |
||||
|
# explanation for making such a disk. There is also |
||||
|
# /usr/src/kernel-source.version/Documentation. Whether this will speed |
||||
|
# things up is a subject of experimentation. |
||||
|
$tmp = '/tmp'; |
||||
|
|
||||
|
################## |
||||
|
# MAIN CONFFILES # |
||||
|
################## |
||||
|
|
||||
|
# if configuration files are not kept in /etc change this |
||||
|
# and set up the directories by hand. |
||||
|
|
||||
|
$swim_conf = '/etc/swim'; |
||||
|
|
||||
|
|
||||
|
############# |
||||
|
# UTILITIES # |
||||
|
############# |
||||
|
|
||||
|
|
||||
|
# This probably never will have to be changed. |
||||
|
$pwd = `pwd`; |
||||
|
chomp $pwd; |
||||
|
|
||||
|
# If the command split is somewhere else besides /usr/bin change this. |
||||
|
# The required package textutils provides this. |
||||
|
#my $splt = '/usr/bin/split'; # same RH |
||||
|
$splt = 'split'; |
||||
|
|
||||
|
# cat comes from the essential and required package textutils. |
||||
|
#my $cat = '/bin/cat'; # same RH |
||||
|
$cat = 'cat'; |
||||
|
|
||||
|
# This command also omes from the required and essential package textutils. |
||||
|
#my $sort = '/usr/bin/sort'; # same RH |
||||
|
$sort = 'sort'; |
||||
|
|
||||
|
# This program uses md5sum from the dpkg package, it can also use md5sum |
||||
|
# from the RH package. |
||||
|
#my $md5sum = '/usr/bin/md5sum'; # same RH |
||||
|
$md5sum = 'md5sum'; |
||||
|
|
||||
|
# If you want to view compressed files make sure this is correct. |
||||
|
# The required package gzip provides this. |
||||
|
#my $zcat = '/bin/zcat'; # same RH |
||||
|
$zcat = 'zcat'; |
||||
|
|
||||
|
# tar comes from the essential and required package tar. |
||||
|
#my $tar = '/bin/tar'; # same RH |
||||
|
$tar = 'tar'; |
||||
|
|
||||
|
# grep comes from the essential and required package grep. This seems |
||||
|
# to require a path. |
||||
|
$grep = '/bin/grep'; # same RH |
||||
|
|
||||
|
# gzip comes from the essential and required package gzip. |
||||
|
#my $gzip = "/bin/gzip"; # same RH |
||||
|
$gzip = "gzip"; |
||||
|
|
||||
|
# mount comes from the essential and required package mount. |
||||
|
#my $mount = '/bin/mount'; # same RH |
||||
|
#my $umount = '/bin/umount'; # same RH |
||||
|
$mount = 'mount'; |
||||
|
$umount = 'umount'; |
||||
|
|
||||
|
# If your file system isn't an ext2 filesystem, you may want to change |
||||
|
# this. mke2fs comes from the essential and required package e2fsprogs. |
||||
|
#my $mke2fs = '/sbin/mke2fs'; # same RH |
||||
|
$mke2fs = 'mke2fs'; |
||||
|
|
||||
|
# cp and mv from the essential and required package fileutils |
||||
|
#my $copy = '/bin/cp'; # same RH |
||||
|
$copy = 'cp'; |
||||
|
$mv = 'mv'; |
||||
|
|
||||
|
# Your system definitely has gcc if you have ar. gcc is a standard package |
||||
|
# in debian. |
||||
|
$gcc = 'gcc'; |
||||
|
|
||||
|
|
||||
|
###### |
||||
|
# FTP # |
||||
|
####### |
||||
|
|
||||
|
# Major mode --ftp and --file automates the download of Contents and Packages |
||||
|
# files. Even if you have apt installed, you may still want to download Packages |
||||
|
# from alternative architectures, and the Contents file for your own architecture |
||||
|
# or other architectures. If you want virtual and/or -ld capabilities you need |
||||
|
# the Contents file. You specify a list of ftp or file sites using urls (like |
||||
|
# apt). For your system's architecture specify the type deb, for other |
||||
|
# architectures specify deb(hyphen)architecture (ex: deb-alpha). Regardless of |
||||
|
# whether or not you specify an architecture, deb implies /dist* found under the |
||||
|
# base directory specified by the ftp url, except in the case of experimental, |
||||
|
# and to a degree non-us. minor mode --ftp, and --file will use the sites in this |
||||
|
# configuration as well, on a fifo (first in first out) basis, so choose the |
||||
|
# order of sites based on which are closest, most current, as well as fast. |
||||
|
|
||||
|
# IMPORTANT: It is a BIG MISTAKE to use the distributions name (slink,po,etc) |
||||
|
# anywhere in the sources list, or in swim's configuration file..in fact swim |
||||
|
# won't work properly, not to mention the fact that someday your favorite name |
||||
|
# will suddenly disappear. This is because swim thinks in terms of the real |
||||
|
# distribution name (stable,unstable,frozen, experimental). The problem goes |
||||
|
# like this - slink remains slink, but goes from unstable to frozen to stable. |
||||
|
# At first, using the distributions alias may seem appropriate, but the |
||||
|
# purpose of swim is to keep tabs on the dists, and not to ignore changes in |
||||
|
# the states, this also makes managing swim's databases much easier and |
||||
|
# intuitive...more about this later. |
||||
|
|
||||
|
# Fun experiments: Swim uses the naming conventions of apt, but leaves the |
||||
|
# Package files compressed in the DF directory. So you can always decompress |
||||
|
# the databases and move them to /var/state/apt/lists. This ofcourse assumes |
||||
|
# that the appropriate changes to the sources.list reflecting these Packages |
||||
|
# (need to be the same architecture as your system) existed before you |
||||
|
# update. (author needs to do this experiment :*) |
||||
|
|
||||
|
$ftp1 = "deb ftp://localhost/pub/debian unstable main contrib non-free non-US"; |
||||
|
$ftp2 = "deb ftp://localhost/pub/debian unstable main contrib non-free"; |
||||
|
$ftp3 = "deb ftp://localhost/pub/debian project/experimental/"; |
||||
|
@FTP = ($ftp1,$ftp2,$ftp3); |
||||
|
|
||||
|
# These next variables allow some characteristics of the ftp client |
||||
|
# to be altered. See Net::FTP for ways of altering some of these |
||||
|
# variables through the environment. |
||||
|
|
||||
|
$firewall = 0; |
||||
|
$port = 0; |
||||
|
$timeout = 120; |
||||
|
$debug = 0; |
||||
|
$passive = 0; |
||||
|
|
||||
|
|
||||
|
######################################## |
||||
|
# STUFF THAT NEVER NEEDS TO BE CHANGED # |
||||
|
######################################## |
||||
|
|
||||
|
# You will never need to change this unless for some weird reason all the |
||||
|
# files under dpkg are somewhere else (including /info*) , see --dbpath as |
||||
|
# an alternative if you decide to access or make the databases somewhere |
||||
|
# else. |
||||
|
$base = '/var/lib/dpkg'; |
||||
|
|
||||
|
# --dbpath takes care of this so don't touch. |
||||
|
$parent = '/'; |
||||
|
$library = '/var/lib/dpkg'; |
||||
|
|
||||
|
|
||||
|
############################# |
||||
|
# LOAD CUSTOM CONFIGURATION # |
||||
|
############################# |
||||
|
|
||||
|
|
||||
|
# Here we load in the customized configuration which override the defaults |
||||
|
# Might as well use do, let the world learn Perl ... compare this to apt's |
||||
|
# configuation file with scopes. Swim's sources.list file (/etc/swim/swimz.list), |
||||
|
# will be grabbed at SWIM::Apt and SWIM::Qftp if it exists. |
||||
|
|
||||
|
do "$swim_conf/swimrc"; |
||||
|
do "$ENV{HOME}/.swim/swimrc"; |
||||
|
if ((defined $dpkg && !defined $dpkg_deb) || |
||||
|
(!defined $dpkg && defined $dpkg_deb)) { |
||||
|
print "swim: need to give both \$dpkg and \$dpkg_deb a value if you want dpkg\n"; |
||||
|
exit; |
||||
|
} |
||||
|
if (defined $package_tool) { |
||||
|
if ($package_tool =~ /ar/) { |
||||
|
$ar = $ar; |
||||
|
} |
||||
|
else { |
||||
|
$dpkg = 'dpkg'; |
||||
|
$dpkg_deb = 'dpkg-deb'; |
||||
|
undef $ar; |
||||
|
} |
||||
|
} |
||||
|
if (defined $apt) { |
||||
|
$apt_get = 'apt-get'; |
||||
|
$apt_cache = 'apt-cache'; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
############################### |
||||
|
# MAKE ANY NEEDED DIRECTORIES # |
||||
|
############################### |
||||
|
|
||||
|
# make sure all the appropriate directories are made |
||||
|
if (!-d $default_directory) { |
||||
|
if (-e $default_directory) { |
||||
|
print "swim: can not create default directory because a file exists\n"; |
||||
|
exit; |
||||
|
} |
||||
|
my @DRD = split(m,/,,$default_directory); |
||||
|
my $placement = "/"; |
||||
|
for (1 .. $#DRD) { |
||||
|
$_ == 1 ? ($placement = "/$DRD[$_]") |
||||
|
: ($placement = $placement . "/" . $DRD[$_]); |
||||
|
-d $placement or mkdir("$placement",0755); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
if (!-d "$default_directory$default_root_directory") { |
||||
|
my @DRD = split(m,/,,$default_root_directory); |
||||
|
print "swim: debian must be the final directory before dists\n" |
||||
|
if $DRD[$#DRD] ne "debian"; |
||||
|
exit if $DRD[$#DRD] ne "debian"; |
||||
|
my $placement = "/"; |
||||
|
for (1 .. $#DRD) { |
||||
|
$_ == 1 ? ($placement = "/$DRD[$_]") |
||||
|
: ($placement = $placement . "/" . $DRD[$_]); |
||||
|
unless (-d "$default_directory$placement") { |
||||
|
mkdir("$default_directory$placement",0755) |
||||
|
or die "swim: could not create root default directory\n"; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
# Makefile will make sure these directories exist, unless for some strange |
||||
|
# reason you have to change them. |
||||
|
|
||||
|
if (!-d $library) { |
||||
|
mkdir($library,0755) or die "Couldn't create default directory\n"; |
||||
|
} |
||||
|
|
||||
|
if (!-d $base) { |
||||
|
mkdir($base,0755) or die "Couldn't create default directory\n"; |
||||
|
} |
||||
|
|
||||
|
if (!-d $swim_conf) { |
||||
|
mkdir($swim_conf,0666) or die "Couldn't create configuration file directory, |
||||
|
please make the directories which are needed.\n"; |
||||
|
} |
||||
|
|
||||
|
1; |
||||
|
|
||||
|
__END__ |
||||
|
|
||||
|
=head1 NAME |
||||
|
|
||||
|
swimrc - swim configuration file |
||||
|
|
||||
|
=head1 DESCRIPTION |
||||
|
|
||||
|
B<swimrc> is the configuartion file for swim allowing many default values |
||||
|
to be set so that they do not have to be mentioned on the command line. |
||||
|
Swimrc interacts directly with Perl allowing a wide variety of variables |
||||
|
found in B<SWIW::Conf> to be altered. |
||||
|
|
||||
|
=cut |
||||
|
|
||||
|
=head1 USAGE |
||||
|
|
||||
|
Values for variable can be altered for B<swim> by assigning different |
||||
|
values enclosed in quotes or quoted whitespace (qw()), and ended with a |
||||
|
semi-colon. |
||||
|
|
||||
|
$variable = "value"; |
||||
|
$variable = "qw(value1 value2 ..)"; |
||||
|
|
||||
|
=head1 VARIABLES |
||||
|
|
||||
|
This is a list of variables with explanations. The default values for |
||||
|
B<swim> are shown. |
||||
|
|
||||
|
=head2 OUTPUT VARIABLE |
||||
|
|
||||
|
$my_number can be changed to how many lines you would like "swim -qf <>" |
||||
|
to print out, before the program asks for C<-t> or C<--total>. Exception: |
||||
|
If C<-i> is used in the query and there is more than one package then the |
||||
|
total will be presented. |
||||
|
|
||||
|
Hint: C<-t> can be used with all the various C<--scripts> family members |
||||
|
to view the title of the script file regardless of this variable setting, |
||||
|
and if C<-t> has to be used, the titles will be displayed, which makes |
||||
|
sense. |
||||
|
|
||||
|
B<$my_number = 23;> |
||||
|
|
||||
|
=head2 HISTORY |
||||
|
|
||||
|
This is a shell-like history kept in relation to searches and the most |
||||
|
recent edit when C<--stdin> is used. |
||||
|
|
||||
|
B<$HISTORY = 10;> |
||||
|
|
||||
|
=head2 AR or DPKG? |
||||
|
|
||||
|
Debian packages are ar archives. If you are using a Debian Distribution |
||||
|
assign "dpkg" to $package_tool, otherwise assign "ar" to $package_tool. |
||||
|
|
||||
|
B<$package_tool = "/usr/bin/ar";> |
||||
|
|
||||
|
=head2 APT |
||||
|
|
||||
|
B<Swim> does not assign a value for apt. To use C<--apt> and C<-xyz> |
||||
|
assign $apt the value "yes". |
||||
|
|
||||
|
Example: B<$apt = "yes";> |
||||
|
|
||||
|
=head2 PAGER |
||||
|
|
||||
|
less is a nice pager, unless you like more! Pager is used for C<--help> |
||||
|
and B<swim> called without any options. There is an option C<--nopager> or |
||||
|
C<-n>. more comes from the required package util-linux, whereas less |
||||
|
comes from a standard package called less. Values: "less", "more", or |
||||
|
"most" or... |
||||
|
|
||||
|
B<$ENV{PAGER} = "less";> |
||||
|
|
||||
|
=head2 NOT-INSTALLED VARIABLES |
||||
|
|
||||
|
Assign values for $architecture and/or $distribution to avoid having to |
||||
|
use C<--arch> and C<--dists> everytime the not-installed databases are |
||||
|
accessed with C<-n> or made or altered. |
||||
|
|
||||
|
Architectures are always being added so check with Debian to find a list. |
||||
|
There is I<alpha, arm, hurd-i386 (alternative kernel to linux), i386, |
||||
|
m68k, powerpc, sparc>. Just use the arch found after the hyphen in the |
||||
|
Contents-(arch) file. |
||||
|
|
||||
|
B<$architecture = "i386";> |
||||
|
|
||||
|
The distribution can be either I<stable, unstable, frozen, or experimental |
||||
|
(rare)>. These represent the state of development that the packages are |
||||
|
under. The unstable distribution can have lot's of changes within a very |
||||
|
short time period, and frozen may or may not be available. |
||||
|
|
||||
|
B<$distribution = "unstable";> |
||||
|
|
||||
|
Distributions are divided into sections. These sections were called |
||||
|
distributions in the version 2.4.1.0 packaging manual, because they were |
||||
|
at one time separate distributions, but this has since changed. |
||||
|
|
||||
|
You can determine which of the sections I<main, non-free, contrib or |
||||
|
non-US> to pull out of the Contents file if you don't want to use |
||||
|
C<--main>, C<--contrib>, C<--non-free>, and C<--non-us> to selectively |
||||
|
pick the sections. |
||||
|
|
||||
|
For efficiency, you should choose the sections which you will be pulling |
||||
|
out of the Packages file(s) being targetted. |
||||
|
|
||||
|
Rule: Use "non-US" not "non-us". |
||||
|
|
||||
|
B<@user_defined_section = qw(main contrib non-free non-US);> |
||||
|
|
||||
|
=head2 DF LOCATION |
||||
|
|
||||
|
A little philosophy: B<swim> was developed for maximum versatility, so |
||||
|
whether you are just interested in researching, and keeping tabs on the |
||||
|
newest packages, or maintaining a Debian virtual distribution on a |
||||
|
non-Debian distribution, or you are a using B<swim> for distribution |
||||
|
development, B<swim> provides a way. |
||||
|
|
||||
|
The next two variables determine the location of the DF (default |
||||
|
directory/file system) |
||||
|
|
||||
|
The default directory keeps track of Contents and/or Packages databases |
||||
|
retrieved with --ftp. The Contents and Packages databases and Release |
||||
|
file are give names specific to the distribution and architectures they |
||||
|
represent using the naming convention found in apt's sources directory. |
||||
|
You also have the freedom not to use the default directory, in which case |
||||
|
swim will still do the renaming and keeping track of the mtime, but you |
||||
|
will have to remember where you put the files. |
||||
|
|
||||
|
B<$default_directory = '/root/.swim';> |
||||
|
|
||||
|
The default root directory (DRD) is the key to easy management of binary |
||||
|
packages, source, dsc, and diff files received from --ftp, and provides an |
||||
|
easy way to put together a personalized distribution. This directory can |
||||
|
be a real ftp site on your computer, or put wherever else you are |
||||
|
allowed to have directories. The DRD is always placed below the value |
||||
|
assigned to $default_directory. According to the previous assignment to |
||||
|
$default_directory, if the DRD is "/pub/a/debian" then the full path |
||||
|
would be "/root/.swim/pub/a/debian". |
||||
|
|
||||
|
Example: When a package is downloaded it will be placed in |
||||
|
dists/distribution/section/architecture/subject below the DRD. |
||||
|
|
||||
|
Rule: debian must be the final directory before dists, this is because |
||||
|
other distributions are placed alongside debian, like debian-non-US or |
||||
|
personal (specialized distribution). |
||||
|
|
||||
|
B<$default_root_directory = '/pub/debian';> |
||||
|
|
||||
|
Because you may be using a real ftp site, this variable allows you to |
||||
|
determine what permissions B<swim> will assign for directories it creates |
||||
|
below the DRD. |
||||
|
|
||||
|
B<$permission = '0755';> |
||||
|
|
||||
|
=head2 TEMPORARY DIRECTORY |
||||
|
|
||||
|
If you want to set an alternative directory for the temporary files |
||||
|
created when the databases are made, change here. You may want to make |
||||
|
$tmp a RAM disk. See package loadlin for initrd documentation and an |
||||
|
explanation for making such a disk. There is also documentation in |
||||
|
/usr/src/kernel-source.version/Documentation. Whether this will speed |
||||
|
things up is a subject of experimentation. |
||||
|
|
||||
|
B<$tmp = "/tmp";> |
||||
|
|
||||
|
=head2 FTP |
||||
|
|
||||
|
You can alter the Firewall, Port, Timeout, Debug and Passive |
||||
|
characteristics of the ftp client as defined in Net::FTP(3pm) by providing |
||||
|
arguments to these variables. All variables but $timeout are set to untrue |
||||
|
by default. |
||||
|
|
||||
|
$firewall = 0; (FTP firewall machine name) |
||||
|
$port = 0; (defaults to 23) |
||||
|
$timeout = 120; (120 seconds) |
||||
|
$debug = 0; (1 will turn on STDERR) |
||||
|
$passive = 0; (1 will enable) |
||||
|
|
||||
|
=head1 OTHER VARIABLES |
||||
|
|
||||
|
see SWIM::Conf |
||||
|
|
||||
|
=head1 FILES |
||||
|
|
||||
|
/etc/swim/swimrc |
||||
|
~/.swim/swimrc |
||||
|
|
||||
|
=head1 SEE ALSO |
||||
|
|
||||
|
swim(8), Net::FTP(3pm) |
||||
|
|
||||
|
=head1 BUGS |
||||
|
|
||||
|
Send directly to mttrader@access.mountain.net. |
||||
|
|
||||
|
=head1 AUTHOR |
||||
|
|
||||
|
Jonathan D. Rosenbaum <mttrader@access.mountain.net> |
||||
|
|
||||
|
=head1 COPYRIGHT |
||||
|
|
||||
|
|
||||
|
Copyright (c) 1999 Jonathan Rosenbaum. All rights reserved. This program |
||||
|
is free software; you can redistribute it and/or modify it under the GPL. |
||||
|
|
||||
|
=cut |
@ -0,0 +1,947 @@ |
|||||
|
# Package administration and research tool for Debian |
||||
|
# Copyright (C) 1999-2000 Jonathan D. Rosenbaum |
||||
|
|
||||
|
# This program 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. |
||||
|
|
||||
|
# This program 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 this program; if not, write to the Free Software |
||||
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
||||
|
|
||||
|
|
||||
|
package SWIM::DB; |
||||
|
use strict; |
||||
|
use SWIM::DB_Library qw(:Db); |
||||
|
use SWIM::Format; |
||||
|
use SWIM::Conf qw(:Path); |
||||
|
use SWIM::Global; |
||||
|
use vars qw(@ISA @EXPORT_OK); |
||||
|
|
||||
|
use Exporter; |
||||
|
@ISA = qw(Exporter); |
||||
|
@EXPORT_OK = qw(db rebuildflatdb); |
||||
|
|
||||
|
|
||||
|
# --db --rebuildflatdb db() rebuildflatdb() |
||||
|
|
||||
|
# The goal here is to save some time by just updating the database rather |
||||
|
# than rebuilding it. Generally, though, swim -i <package> would be the |
||||
|
# favorable way of doing this, and ultimately may become the primary way of |
||||
|
# setting up the databases after the required packages for this program are |
||||
|
# set-up. This is because --db has to check the status file, whereas -i |
||||
|
# uses statusindex.db, and grabs package information right from the |
||||
|
# package, there are exceptions to this, certain things like the status |
||||
|
# will have to be found from the status file or some other method. |
||||
|
sub db { |
||||
|
|
||||
|
# Well, we better check for any changes in the status file, before we |
||||
|
# attempt anything. This is made easy by the version reference hash created |
||||
|
# when --initdb or --rebuilddb is run, and then comparing this to the new |
||||
|
# results when --db is run. Only then will we process, add, and remove |
||||
|
# packages when we know what is gone, and what is new (whether its a |
||||
|
# new package name, or a package with a new version or older version). |
||||
|
# The statusindex.deb could be used for version checking, instead the |
||||
|
# important status field is compared, so if we have situations like |
||||
|
# "deinstall ok config-file" this will be recognized as a CHANGE. The |
||||
|
# update takes place so that the status field remain proper. |
||||
|
|
||||
|
my ($commands) = @_; |
||||
|
my %commands = %$commands; |
||||
|
|
||||
|
# description stuff |
||||
|
my (@description, @ldescription); |
||||
|
# my @dpackage; # not needed here |
||||
|
|
||||
|
# does status exist |
||||
|
my $the_status; |
||||
|
|
||||
|
# Keep track of changes to the status file |
||||
|
my $rootsky = "/."; |
||||
|
my @package; |
||||
|
my @name; |
||||
|
my $status; |
||||
|
my @changed_packages; |
||||
|
my @gone; |
||||
|
my (@GONE, @CHANGED, @NEW); |
||||
|
my @before; |
||||
|
my %compare; |
||||
|
|
||||
|
# The mys for NEW |
||||
|
my $count = 0; |
||||
|
# a special one to deal with package[1] version change. |
||||
|
my $packv; |
||||
|
my (@essential,$priority,$section,$installed_size,$maintainer,$source); |
||||
|
my (%group, $group); |
||||
|
|
||||
|
# Keeps a package->version database |
||||
|
# to save time over using status |
||||
|
my @status; |
||||
|
my ($replaces, $provides, $depends, $pre_depends, $recommends, $suggests, |
||||
|
$conflicts); |
||||
|
my (@conffiles,$line_before,@conf,@complete,@form,@formly); |
||||
|
my $format_deb = "$tmp/format.deb"; |
||||
|
|
||||
|
dbi(\%commands); ib(\%commands); sb(\%commands); |
||||
|
# Check differences now. |
||||
|
print "checking for new, changed, and removed packages\n"; |
||||
|
if (($commands->{"dbpath"} && $commands->{"root"}) || |
||||
|
($commands->{"dbpath"} && !$commands->{"root"}) || |
||||
|
(!$commands->{"dbpath"} && !$commands->{"root"})) { |
||||
|
open(DIFFERENCE,"$parent$library/status"); |
||||
|
} |
||||
|
elsif (!$commands->{"dbpath"} && $commands->{"root"}) { |
||||
|
open(DIFFERENCE,"$parent$base/status"); |
||||
|
} |
||||
|
while (<DIFFERENCE>) { |
||||
|
# Package name |
||||
|
if (/^Package:/i) { |
||||
|
@package = split(/: /,$_); |
||||
|
chomp $package[1]; |
||||
|
} |
||||
|
elsif (/^Status:/) { |
||||
|
chomp; |
||||
|
$status = substr($_,8); |
||||
|
# a test |
||||
|
#if ($status eq "purge ok not-installed") { |
||||
|
# if (defined $db{$package[1]}) { |
||||
|
# print "$db{$package[1]}\n"; |
||||
|
# } |
||||
|
#} |
||||
|
} |
||||
|
# hold ok not-installed - may want to change this just to |
||||
|
# non-installed. |
||||
|
########### |
||||
|
# VERSION # |
||||
|
########### |
||||
|
elsif (/^Version:/ && $status !~ /not-installed/) { |
||||
|
my $version = $_; chomp $version; |
||||
|
my $ver = m,Version:\s(.*),; my $statusname; |
||||
|
if (defined $sb{$package[1]}) { |
||||
|
$statusname = (split(/\s/,$sb{$package[1]}))[3]; |
||||
|
$statusname =~ s/:/ /g; |
||||
|
} |
||||
|
######## |
||||
|
# GONE # |
||||
|
######## |
||||
|
if (defined $db{$package[1]}) { |
||||
|
push(@gone,"$package[1]_$1"); |
||||
|
if ("$package[1]_$1" ne $db{$package[1]}) { |
||||
|
$compare{$package[1]} = "$package[1]_$1"; |
||||
|
} |
||||
|
# Version remained the same, but status changed |
||||
|
# even though $statusname may be undefined..this |
||||
|
# routine is only done when it does exist. |
||||
|
###### |
||||
|
# CR # |
||||
|
###### |
||||
|
elsif ("$package[1]_$1" eq $db{$package[1]} && |
||||
|
$statusname ne $status) { |
||||
|
push(@changed_packages, "$package[1]"); |
||||
|
$compare{$package[1]} = "$package[1]_$1"; |
||||
|
} |
||||
|
} |
||||
|
####### |
||||
|
# NEW # |
||||
|
####### |
||||
|
elsif (!defined $db{$package[1]}) { |
||||
|
push(@NEW,$package[1]); |
||||
|
$compare{$package[1]} = "$package[1]_$1"; |
||||
|
push(@gone,"$package[1]_$1"); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
close(DIFFERENCE); |
||||
|
|
||||
|
# lets find what existed before, ofcourse mistakes in /. better be |
||||
|
# taken care of beforehand, because this ignores those here. Some time |
||||
|
# may have been saved by using a separate database rather than /., but, |
||||
|
# this keeps things clean. |
||||
|
if ($ib{$rootsky}){ |
||||
|
@before = split(/\s/,$ib{$rootsky}); |
||||
|
my %tracker; |
||||
|
grep($tracker{$_}++,@gone); |
||||
|
my @goners = grep(!$tracker{$_},@before); |
||||
|
foreach (@goners) { |
||||
|
m,(^.*)_.*$,; |
||||
|
if (!defined $compare{$1}) { |
||||
|
push(@GONE,$1); |
||||
|
} |
||||
|
else { |
||||
|
# these will be process like @GONE for original, and @NEW for |
||||
|
# new |
||||
|
push(@CHANGED,$1); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
else { |
||||
|
print "swim: missing important database\n"; exit; |
||||
|
} |
||||
|
|
||||
|
foreach (@GONE) { |
||||
|
print "GONE $_\n"; |
||||
|
} |
||||
|
foreach (@CHANGED) { |
||||
|
print "CHANGED $_\n"; |
||||
|
} |
||||
|
foreach (@changed_packages) { |
||||
|
push(@CHANGED,$_); |
||||
|
print "CHANGED STATUS $_\n"; |
||||
|
} |
||||
|
foreach (@NEW) { |
||||
|
print "NEW $_\n"; |
||||
|
} |
||||
|
|
||||
|
my $new=$#NEW + 1; my $cr=$#changed_packages + 1; |
||||
|
my $ch=($#CHANGED + 1) - $cr; my $gon= $#GONE + 1; |
||||
|
if ($commands->{"check"}) { |
||||
|
print "\n TOTAL\n -----\n"; |
||||
|
print "NEW $new\n"; print "GONE $gon\n"; |
||||
|
print "CHANGED $ch\n"; print "CHANGED STATUS $cr\n"; exit; |
||||
|
} |
||||
|
print "\n TOTAL\n -----\n"; |
||||
|
print "NEW $new\n"; print "GONE $gon\n"; |
||||
|
print "CHANGED $ch\n"; print "CHANGED STATUS $cr\n"; |
||||
|
|
||||
|
|
||||
|
@GONE = (@GONE,@CHANGED); |
||||
|
@NEW = (@NEW,@CHANGED); |
||||
|
|
||||
|
undef @before; # can use below. |
||||
|
untie %db; |
||||
|
undef %db; |
||||
|
untie %ib; |
||||
|
undef %ib; |
||||
|
|
||||
|
# Going to be adding some stuff to nsearchindex.deb and ndirindex.deb |
||||
|
# so better remove any compressed versions if they exist |
||||
|
if (defined @GONE || defined @NEW) { |
||||
|
if (($commands->{"dbpath"} && $commands->{"root"}) || |
||||
|
($commands->{"dbpath"} && !$commands->{"root"}) || |
||||
|
(!$commands->{"dbpath"} && !$commands->{"root"})) { |
||||
|
if (-e "$parent$library/searchindex.deb") { |
||||
|
unlink("$parent$library/searchindex.deb.gz"); |
||||
|
unlink("$parent$library/dirindex.deb.gz"); |
||||
|
} |
||||
|
} |
||||
|
elsif (!$commands->{"dbpath"} && $commands->{"root"}) { |
||||
|
if (-e "$parent$base/searchindex.deb") { |
||||
|
unlink("$parent$base/searchindex.deb.gz"); |
||||
|
unlink("$parent$base/dirindex.deb.gz"); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
# Time for some fun stuff |
||||
|
# There are three states: GONE - all information about this package |
||||
|
# needs to be removed from the databases. NEW - all information about |
||||
|
# this package needs to be put in the databases. CHANGED - a |
||||
|
# combination of the two previous, information could be cross |
||||
|
# referenced and checked for changes, but it's probably no saving of |
||||
|
# time, so first remove information from the same package of a |
||||
|
# different version, then add the information about the package of the |
||||
|
# new version (older or newer) |
||||
|
|
||||
|
############# |
||||
|
# # |
||||
|
# GONE # |
||||
|
# # |
||||
|
############# |
||||
|
# GONE. (reverse applies to NEW) |
||||
|
# For package.deb - Delete description |
||||
|
# (packagename_version), packagenameREP, packagenamePRO, |
||||
|
# packagenameDEP, packagenamePRE, packagenameREC, |
||||
|
# packagenameSUG, packagenameCON, packagenameCONF. delete package -> |
||||
|
# version. |
||||
|
# |
||||
|
# for fileindex.deb - |
||||
|
# Find all files and directories associated with the package. Delete |
||||
|
# these files (keys). Find all directories where the file |
||||
|
# exists..delete package name from value, delete whole key if it is the |
||||
|
# only package name. |
||||
|
# |
||||
|
# for groupindex - delete package name (value) from Section |
||||
|
# it belonged to..humm, find section package belongs to in |
||||
|
# statusuindex.deb, and delete whole Section key if only one. |
||||
|
# |
||||
|
# for statusindex.deb - |
||||
|
# delete package -> version group. |
||||
|
# |
||||
|
# for flat files dirindex and searchindex - |
||||
|
# the removal of files and/or directories can be put on hold, and |
||||
|
# done with an option at a later time, since fileindex.deb remembers |
||||
|
# current state, at a later time the old state of the flat files can be |
||||
|
# compared to the new state of fileindex, and these files can be |
||||
|
# rewritten. This is all o.k. because these extra files or directories |
||||
|
# will return undef in search() if the packages don't exist. |
||||
|
|
||||
|
ping(\%commands); # uses $ping for package.deb |
||||
|
zing(\%commands); # uses $zing for fileindex.deb |
||||
|
ging(\%commands); # uses $ging for groupindex.deb |
||||
|
sing(\%commands); # uses $sing for statusindex.deb |
||||
|
|
||||
|
$| = 1; my $x = 1; |
||||
|
foreach (@GONE) { |
||||
|
print "G|C|CS $x $_.list\r"; |
||||
|
$x++; |
||||
|
#first delete keys from package.deb |
||||
|
# If I kept this the name_version would be remembered. |
||||
|
$ping->del($_); |
||||
|
my $orig_argument = $_; |
||||
|
my $packname_version = (split(/\s/,$sb{$orig_argument}))[0]; |
||||
|
$packname_version =~ s,\+,\\\+,g; |
||||
|
$argument = "$_"; |
||||
|
ver(\%commands); |
||||
|
$ping->del($argument); |
||||
|
my $conf = $argument . "CONF"; |
||||
|
$ping->del($conf); |
||||
|
$conf = $argument . "REP"; |
||||
|
$ping->del($conf); |
||||
|
$conf = $argument . "PRO"; |
||||
|
$ping->del($conf); |
||||
|
$conf = $argument . "DEP"; |
||||
|
$ping->del($conf); |
||||
|
$conf = $argument . "PRE"; |
||||
|
$ping->del($conf); |
||||
|
$conf = $argument . "REC"; |
||||
|
$ping->del($conf); |
||||
|
$conf = $argument . "SUG"; |
||||
|
$ping->del($conf); |
||||
|
$conf = $argument . "CON"; |
||||
|
$ping->del($conf); |
||||
|
untie $ping; |
||||
|
|
||||
|
# next let's go into fileindex.deb and hunt down all directories and |
||||
|
# files associated with this package. It would be kind of nice to use |
||||
|
# package_name.list, but it's probably more realistic not to depend on |
||||
|
# the existence of these file..unless a backup is made. Now if -i is used |
||||
|
# this would be a simple matter, but in this case things are different. |
||||
|
# A database to accomplish this wasn't realistic, so the backup |
||||
|
# files for *.list are in ./info/backup/*.list.bk. We will also have to |
||||
|
# deal with those rare cases that forget /. (smail 2.0v). We should remove |
||||
|
# this file as well as the packagename-conf.md5sums file below. |
||||
|
my $file = "$parent$base/info/backup/$_.list.bk"; |
||||
|
my $md5sum_file = "$parent$base/info/$_-conf.md5sums"; |
||||
|
open(LIST,"$file"); |
||||
|
while (<LIST>) { |
||||
|
chomp; |
||||
|
if (defined $ib{$_}) { |
||||
|
my $status = ($ib{$_} =~ s,$packname_version ,,); |
||||
|
if ($status eq "") { |
||||
|
$status = ($ib{$_} =~ s, $packname_version,,); |
||||
|
if ($status eq "") { |
||||
|
$ib{$_} =~ s,$packname_version,,; |
||||
|
} |
||||
|
} |
||||
|
if ($ib{$_} eq "") { |
||||
|
$zing->del($_); |
||||
|
} |
||||
|
} # if defined |
||||
|
} |
||||
|
close(LIST); |
||||
|
unlink("$file"); |
||||
|
|
||||
|
####################### |
||||
|
# deinstall situation # |
||||
|
####################### |
||||
|
my $yit = (split(/\s/,$sb{$orig_argument}))[3]; |
||||
|
if ($yit eq "deinstall:ok:config-files" || |
||||
|
$yit eq "purge:ok:config-files") { |
||||
|
if (defined $ib{"/."}) { |
||||
|
my $status = ($ib{"/."} =~ s,$packname_version ,,); |
||||
|
if ($status eq "") { |
||||
|
$status = ($ib{"/."} =~ s, $packname_version,,); |
||||
|
if ($status eq "") { |
||||
|
$ib{"/."} =~ s,$packname_version,,; |
||||
|
} |
||||
|
} |
||||
|
if ($ib{"/."} eq "") { |
||||
|
$zing->del($_); |
||||
|
} |
||||
|
} # if defined |
||||
|
} # deinstall situation |
||||
|
|
||||
|
if (-e $md5sum_file) { |
||||
|
unlink("$md5sum_file"); |
||||
|
} |
||||
|
|
||||
|
# remove from the group, and if only one remove the group. |
||||
|
# Let's first find out which group this monster belongs to. |
||||
|
if (defined $sb{$orig_argument}) { |
||||
|
(my $oa = $orig_argument) =~ s,\+,\\\+,g; |
||||
|
my($section) = (split(/\s/,$sb{$orig_argument}))[1]; |
||||
|
if (defined $gb{$section}) { |
||||
|
my $status = ($gb{$section} =~ s,$oa ,,); |
||||
|
if ($status eq "") { |
||||
|
$status = ($gb{$section} =~ s, $oa,,); |
||||
|
if ($status eq "") { |
||||
|
$gb{$section} =~ s,$oa,,; |
||||
|
} |
||||
|
} |
||||
|
if ($gb{$section} eq "") { |
||||
|
$ging->del($section); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
# Now ditch the package->version group in statusindex.deb |
||||
|
$sing->del($orig_argument); |
||||
|
untie $sing; |
||||
|
|
||||
|
} # end foreach OLD |
||||
|
|
||||
|
print "\n" if $#GONE != -1 && $#NEW == -1; |
||||
|
|
||||
|
############# |
||||
|
# # |
||||
|
# NEW # |
||||
|
# # |
||||
|
############# |
||||
|
if (-e "$parent$base/status" && -e "$parent$base/info") { |
||||
|
$the_status = "$parent$base/status"; |
||||
|
} |
||||
|
else { |
||||
|
print "swim: crucial file(s)/directories are missing in $parent\n"; |
||||
|
exit; |
||||
|
} |
||||
|
my %exacts; |
||||
|
my $goon; |
||||
|
print "\n" if $#NEW != -1; $x = 1; |
||||
|
foreach (@NEW) { |
||||
|
$exacts{$_} = "yes"; |
||||
|
} |
||||
|
# first let's find the fields to put into packages.deb |
||||
|
# We'll have to go through the status file again, something we |
||||
|
# wouldn't have had to do with swim -i. As it turns out, a good |
||||
|
# percentage of the information can be processed into the database |
||||
|
# while going through status. |
||||
|
open(PRETTY, ">$format_deb"); |
||||
|
open(AVAIL, "$the_status"); |
||||
|
while (<AVAIL>) { |
||||
|
# here's the difference with database(), we just find the packages |
||||
|
# which belong to the hash %exacts |
||||
|
# Package name |
||||
|
if (/^Package:|^PACKAGE:/) { |
||||
|
@package = split(/: /,$_); |
||||
|
chomp $package[1]; |
||||
|
if (defined $exacts{$package[1]}) { |
||||
|
print "N|C|CS $x\r"; $x++; |
||||
|
$goon = "yes"; |
||||
|
} |
||||
|
else { |
||||
|
$goon = "no"; |
||||
|
undef @package; |
||||
|
next; |
||||
|
} |
||||
|
} |
||||
|
elsif ($goon eq "no") { |
||||
|
next; |
||||
|
} |
||||
|
elsif (/^Status:/) { |
||||
|
$status = $_; |
||||
|
} |
||||
|
elsif (/^Essential/) { |
||||
|
@essential = split(/: /,$_); |
||||
|
} |
||||
|
# missing priority and section will be dealt with below |
||||
|
elsif (/^Priority:/) { |
||||
|
$priority = $_; |
||||
|
} |
||||
|
elsif (/^Section:/) { |
||||
|
$section = $_; |
||||
|
# make the hash for the groupindex.deb |
||||
|
$group = substr($section,9); |
||||
|
chomp $group; |
||||
|
# we will put not-installed in their own group for reference |
||||
|
if ($status !~ /not-installed/) { |
||||
|
if (!defined $gb{$group}) { |
||||
|
$ging->put($group,$package[1]); |
||||
|
} |
||||
|
else { |
||||
|
my $change_group = "$gb{$group} $package[1]"; |
||||
|
$ging->del($group); |
||||
|
$ging->put($group,"$change_group"); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
elsif (/^Installed-Size:/) { |
||||
|
$installed_size = $_; |
||||
|
} |
||||
|
elsif (/^Maintainer:/) { |
||||
|
$maintainer = $_; |
||||
|
} |
||||
|
elsif (/^Source:/) { |
||||
|
$source = $_; |
||||
|
} |
||||
|
# hold ok not-installed - may want to change this just to |
||||
|
# non-installed. |
||||
|
elsif (/^Version:/ && $status !~ /not-installed/) { |
||||
|
my $version = $_; |
||||
|
chomp $version; |
||||
|
########### |
||||
|
# SECTION # |
||||
|
########### |
||||
|
if (defined $section) { |
||||
|
chomp $section; |
||||
|
} |
||||
|
else { |
||||
|
nsb(\%commands); |
||||
|
if (defined $nsb{$package[1]}) { |
||||
|
my ($nvname,$ngname,$npriorname) = |
||||
|
split(/\s/,"$nsb{$package[1]}",3); |
||||
|
$group = $ngname; |
||||
|
} |
||||
|
else { |
||||
|
$group = "unavailable"; |
||||
|
} |
||||
|
} |
||||
|
$col1 = "Package: $package[1]"; |
||||
|
$col2 = $status; |
||||
|
write PRETTY; |
||||
|
$col1 = $version; |
||||
|
my $ver = m,Version:\s(.*),; |
||||
|
# This creates a name -> version index in package.deb, |
||||
|
# and the statusindex.deb database which will serve to |
||||
|
# determine if the status has changed when --db or -i is |
||||
|
# run. |
||||
|
$packv = "$package[1]_$1"; |
||||
|
$ping->put($package[1],$packv); |
||||
|
my ($priory,$statusy); |
||||
|
############ |
||||
|
# PRIORITY # |
||||
|
############ |
||||
|
if (defined $priority) { |
||||
|
$priory = substr($priority,10); |
||||
|
} |
||||
|
else { |
||||
|
nsb(\%commands); |
||||
|
if (defined $nsb{$package[1]}) { |
||||
|
my ($nvname,$ngname,$npriorname) = |
||||
|
split(/\s/,"$nsb{$package[1]}",3); |
||||
|
$priory = $npriorname; |
||||
|
} |
||||
|
else { |
||||
|
$priory = "unavailable"; |
||||
|
} |
||||
|
} |
||||
|
chomp $priory; |
||||
|
$statusy = substr($status,8); |
||||
|
chomp $statusy; |
||||
|
$statusy =~ s/\s/:/g; |
||||
|
my $thimk = "$packv $group $priory $statusy"; |
||||
|
$sing->put($package[1],$thimk); |
||||
|
$package[1] = "$packv"; |
||||
|
if(defined($essential[1])) { |
||||
|
$col2 = "Essential: $essential[1]"; |
||||
|
@essential = (); |
||||
|
} |
||||
|
else { |
||||
|
$col2 = "Essential: no\n"; |
||||
|
} |
||||
|
write PRETTY; |
||||
|
###################### |
||||
|
# SECTION & PRIORITY # |
||||
|
###################### |
||||
|
if (defined $section) { |
||||
|
$col1 = $section; |
||||
|
} |
||||
|
else { |
||||
|
nsb(\%commands); |
||||
|
$package[1] =~ m,(.*)_.*,; |
||||
|
my $packthing = $1; |
||||
|
if (defined $nsb{$packthing}) { |
||||
|
my ($nvname,$ngname,$npriorname) = |
||||
|
split(/\s/,"$nsb{$packthing}",3); |
||||
|
$col1 = "Section: $ngname"; |
||||
|
# we can put it in now, no deletion needed |
||||
|
if (!defined $gb{$group}) { |
||||
|
$ging->put($group,$packthing); |
||||
|
} |
||||
|
else { |
||||
|
my $change_group = "$gb{$group} $packthing"; |
||||
|
$ging->del($group); |
||||
|
$ging->put($group,"$change_group"); |
||||
|
} |
||||
|
} |
||||
|
else { |
||||
|
$col1 = "Section: unavailable"; |
||||
|
} |
||||
|
} |
||||
|
if (defined $priority) { |
||||
|
$col2 = $priority; |
||||
|
} |
||||
|
else { |
||||
|
nsb(\%commands); |
||||
|
$package[1] =~ m,(.*)_.*,; |
||||
|
my $packthing = $1; |
||||
|
if (defined $nsb{$packthing}) { |
||||
|
my ($nvname,$ngname,$npriorname) = |
||||
|
split(/\s/,"$nsb{$packthing}",3); |
||||
|
$col2 = "Section: $npriorname"; |
||||
|
} |
||||
|
else { |
||||
|
$col2 = "Priority: unavailable\n"; |
||||
|
} |
||||
|
} |
||||
|
write PRETTY; |
||||
|
#my $cool = $installed_size . $maintainer; |
||||
|
#print PRETTY $cool; |
||||
|
$col1 = $installed_size; |
||||
|
if (defined $source) { |
||||
|
$col2 = $source; |
||||
|
} |
||||
|
else { |
||||
|
$col2 = ""; |
||||
|
} |
||||
|
write PRETTY; |
||||
|
undef $source; |
||||
|
print PRETTY $maintainer |
||||
|
} |
||||
|
|
||||
|
# This stuff will be available with seperate query flags or All |
||||
|
elsif (/^Replaces:/) { |
||||
|
$replaces = $_; |
||||
|
if (defined($replaces)) { |
||||
|
$ping->put("$package[1]REP",$replaces); |
||||
|
} |
||||
|
} |
||||
|
elsif (/^Provides:/) { |
||||
|
$provides = $_; |
||||
|
if (defined($provides)) { |
||||
|
$ping->put("$package[1]PRO",$provides); |
||||
|
} |
||||
|
} |
||||
|
elsif (/^Depends:/) { |
||||
|
$depends = $_; |
||||
|
if (defined($depends)) { |
||||
|
$ping->put("$package[1]DEP",$depends); |
||||
|
} |
||||
|
} |
||||
|
elsif (/^Pre-Depends:/) { |
||||
|
$pre_depends = $_; |
||||
|
if (defined($pre_depends)) { |
||||
|
$ping->put("$package[1]PRE",$pre_depends); |
||||
|
} |
||||
|
} |
||||
|
elsif (/^Recommends:/) { |
||||
|
$recommends = $_; |
||||
|
if (defined($recommends)) { |
||||
|
$ping->put("$package[1]REC",$recommends); |
||||
|
} |
||||
|
} |
||||
|
elsif (/^Suggests:/) { |
||||
|
$suggests = $_; |
||||
|
if (defined($suggests)) { |
||||
|
$ping->put("$package[1]SUG",$suggests); |
||||
|
} |
||||
|
} |
||||
|
elsif (/^Conflicts:/) { |
||||
|
$conflicts = $_; |
||||
|
if (defined($conflicts)) { |
||||
|
$ping->put("$package[1]CON",$conflicts); |
||||
|
} |
||||
|
} |
||||
|
# Gather the Configuration Files, Description comes after. |
||||
|
# Available with a single flag. |
||||
|
elsif (/^Conffiles:/) { |
||||
|
my $line = <AVAIL>; |
||||
|
while ($line !~ /^Description:/) { |
||||
|
push(@conffiles,$line); |
||||
|
$line = <AVAIL>; |
||||
|
if ($line =~ /^Description/) { |
||||
|
$line_before = $line; |
||||
|
# put conffiles into one variable |
||||
|
if (defined $package[1]) { |
||||
|
} |
||||
|
my ($c, $cool); |
||||
|
if ($#conffiles != 0) { |
||||
|
for ($c = $#conffiles; $c >= 0; $c--) { |
||||
|
if ($c > 0) { |
||||
|
$cool = $conffiles[$c-1] .= $conffiles[$c]; |
||||
|
} |
||||
|
} #end for |
||||
|
} |
||||
|
else { |
||||
|
$cool = $conffiles[0]; |
||||
|
} |
||||
|
@conffiles = (); |
||||
|
$ping->put("$package[1]CONF",$cool); |
||||
|
} #if ($line =~ /^Desc |
||||
|
} # while ($line ! /^Desc |
||||
|
} # elsif (/^Conffiles |
||||
|
untie %nsb; |
||||
|
|
||||
|
# Only interested in available packages..so this is fine. |
||||
|
# To be combined with first fields. |
||||
|
if (/Description:|^\s\w*|^\s\.\w*/ || |
||||
|
defined($line_before) =~ /^Description/){ |
||||
|
my $many_lines; |
||||
|
if (defined($line_before)) { |
||||
|
push(@ldescription, $line_before); |
||||
|
push(@ldescription, $_); |
||||
|
$line_before = (); |
||||
|
} |
||||
|
else { |
||||
|
$many_lines = $_; |
||||
|
} |
||||
|
if ($_ !~ /^\n$/) { |
||||
|
$count++; |
||||
|
if ($count == 1) { |
||||
|
if (defined $package[1]) { |
||||
|
#chomp $package[1]; |
||||
|
#push(@dpackage,$package[1]); |
||||
|
push(@description,$package[1]); |
||||
|
} |
||||
|
} |
||||
|
if (defined($many_lines)) { |
||||
|
push(@ldescription,$many_lines); |
||||
|
} |
||||
|
} # end if ($_ !~ /^\n$/ |
||||
|
else { |
||||
|
$count = 0; |
||||
|
# let's put each description into one scalar |
||||
|
my ($c, $cool); |
||||
|
if ($#ldescription != 0) { |
||||
|
for ($c = $#ldescription; $c >= 0; $c--) { |
||||
|
if ($c > 0) { |
||||
|
$cool = $ldescription[$c-1] .= $ldescription[$c]; |
||||
|
} |
||||
|
} #end for |
||||
|
} # end if ($#ld |
||||
|
else { |
||||
|
$cool = $ldescription[0]; |
||||
|
} |
||||
|
if (defined $cool) { |
||||
|
push(@description,$cool); |
||||
|
} |
||||
|
@ldescription = (); |
||||
|
} # end else |
||||
|
$line_before = (); |
||||
|
} |
||||
|
untie $ping; |
||||
|
untie $ging; |
||||
|
untie $sing; |
||||
|
} # end while (<AVAIL>) |
||||
|
close(PRETTY); |
||||
|
|
||||
|
|
||||
|
# Let's put together the description with the rest of its fields. |
||||
|
open(FIELDS,"$format_deb"); |
||||
|
while (<FIELDS>) { |
||||
|
push(@form,$_); |
||||
|
} |
||||
|
close(FIELDS); |
||||
|
|
||||
|
foreach (@form) { |
||||
|
push(@formly,$_); |
||||
|
my ($cool); |
||||
|
$count++; |
||||
|
if ($count == 5) { |
||||
|
my ($c, $cool); |
||||
|
if ($#formly != 0) { |
||||
|
for ($c = $#formly; $c >= 0; $c--) { |
||||
|
if ($c > 0) { |
||||
|
$cool = $formly[$c-1] .= $formly[$c]; |
||||
|
} |
||||
|
} #end for |
||||
|
} # end if ($#ld |
||||
|
else { |
||||
|
$cool = $formly[0]; |
||||
|
} |
||||
|
push(@complete,$cool); |
||||
|
@formly = (); |
||||
|
$count = 0; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
my $name_version; |
||||
|
foreach (@description) { |
||||
|
if ($count == 1) { |
||||
|
# -i |
||||
|
my $lingo = shift(@complete); |
||||
|
$lingo = $lingo . $_; |
||||
|
#push(@Tdescription, $lingo); |
||||
|
$ping->put($name_version,$lingo); |
||||
|
$lingo = (); |
||||
|
$count = 1; |
||||
|
} |
||||
|
else { |
||||
|
# packagename_version |
||||
|
#push(@Tdescription, $_); |
||||
|
$name_version = $_; |
||||
|
$count = 0; |
||||
|
} |
||||
|
$count++; |
||||
|
untie $ping; |
||||
|
} |
||||
|
undef $ping; |
||||
|
|
||||
|
unlink($format_deb); |
||||
|
|
||||
|
# Now time to do some file/dir stuff. A backup of *list needs to be |
||||
|
# made, might as well use this. There is a possibility this can be |
||||
|
# used instead of fastswim for initial fileindex.deb. |
||||
|
my $package_name; |
||||
|
if (!-d "$parent$base/info/backup") { |
||||
|
mkdir("$parent$base/info/backup",0666); |
||||
|
} |
||||
|
print "\n" if $#NEW != -1; $x = 1; |
||||
|
|
||||
|
foreach $package_name (@NEW) { |
||||
|
open(FILENAME,"$parent$base/info/$package_name.list"); |
||||
|
open(CP,">$parent$base/info/backup/$package_name.list.bk"); |
||||
|
while (<FILENAME>) { |
||||
|
print CP $_; |
||||
|
} |
||||
|
close(FILENAME); |
||||
|
close(CP); |
||||
|
|
||||
|
my $file = "$parent$base/info/backup/$package_name.list.bk"; |
||||
|
print "#$x"; print " N|C $package_name.list \r"; |
||||
|
$x++; |
||||
|
open(LIST,"$file"); |
||||
|
while (<LIST>) { |
||||
|
chomp; |
||||
|
|
||||
|
# Better add the new stuff to the flat files first |
||||
|
if (!defined $ib{$_}) { |
||||
|
if (($commands->{"dbpath"} && $commands->{"root"}) || |
||||
|
($commands->{"dbpath"} && !$commands->{"root"}) || |
||||
|
(!$commands->{"dbpath"} && !$commands->{"root"})) { |
||||
|
open(SEARCHINDEX,">>$parent$library/searchindex.deb"); |
||||
|
} |
||||
|
elsif (!$commands->{"dbpath"} && $commands->{"root"}) { |
||||
|
open(SEARCHINDEX,">>$parent$base/searchindex.deb"); |
||||
|
} |
||||
|
if (!-d) { |
||||
|
print SEARCHINDEX "$_\n"; |
||||
|
} |
||||
|
if (($commands->{"dbpath"} && $commands->{"root"}) || |
||||
|
($commands->{"dbpath"} && !$commands->{"root"}) || |
||||
|
(!$commands->{"dbpath"} && !$commands->{"root"})) { |
||||
|
open(DIRINDEX,">>$parent$library/dirindex.deb"); |
||||
|
} |
||||
|
elsif (!$commands->{"dbpath"} && $commands->{"root"}) { |
||||
|
open(DIRINDEX,">>$parent$base/dirindex.deb"); |
||||
|
} |
||||
|
if (-d) { |
||||
|
print DIRINDEX "$_\n"; |
||||
|
} |
||||
|
} # !defined |
||||
|
|
||||
|
# If the directory already exists we can just append |
||||
|
# to the end of the value |
||||
|
if (defined $ib{$_}) { |
||||
|
dbi(\%commands); |
||||
|
my $cvalue = $ib{$_} . " $db{$package_name}"; |
||||
|
# put overwrites by default! |
||||
|
$zing->put($_,$cvalue); |
||||
|
} # if defined |
||||
|
else { |
||||
|
dbi(\%commands); |
||||
|
$zing->put($_,$db{$package_name}); |
||||
|
} |
||||
|
untie %db; |
||||
|
untie $zing; |
||||
|
} |
||||
|
close(LIST); |
||||
|
close(SEARCHINDEX); |
||||
|
close(DIRINDEX); |
||||
|
|
||||
|
my $zit; my ($nit,$yit) = (split(/\s/,$sb{$package_name}))[0,3]; |
||||
|
if ($yit eq "deinstall:ok:config-files" || |
||||
|
$yit eq "purge:ok:config-files") { |
||||
|
($zit = $nit) =~ s,\+,\\\+,; |
||||
|
if ($ib{"/."} !~ m,$zit,) { |
||||
|
$ib{"/."} = $ib{"/."} . " $zit"; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
} # end foreach NEW |
||||
|
print "\n" if $#NEW != -1; |
||||
|
|
||||
|
} # end sub db |
||||
|
|
||||
|
# Generally, it's unecessary to rebuild the flat databases unless major |
||||
|
# changes have occurred to a person's installation, and the database has |
||||
|
# become very repetitive, or a file has changed into a directory. This |
||||
|
# function has also been tried by tieing the flat file to an array, but |
||||
|
# there doesn't seem to be that much of a speed advantage unless ib() |
||||
|
# happens to be in memory, but more experimentation will be tried in the |
||||
|
# future. |
||||
|
sub rebuildflatdb { |
||||
|
|
||||
|
my($commands) = @_; |
||||
|
my %commands = %$commands; |
||||
|
ib(\%commands); |
||||
|
|
||||
|
print scalar(localtime), "\n"; |
||||
|
|
||||
|
my $file; |
||||
|
my $dir; |
||||
|
|
||||
|
if (($commands->{"dbpath"} && $commands->{"root"}) || |
||||
|
($commands->{"dbpath"} && !$commands->{"root"}) || |
||||
|
!($commands->{"dbpath"} && $commands->{"root"})) { |
||||
|
if (-e "$parent$library/searchindex.deb") { |
||||
|
$dir = "$parent$library/dirindex.deb"; |
||||
|
$file = "$parent$library/searchindex.deb"; |
||||
|
unlink($file); |
||||
|
unlink("$file.gz") if -e "$file.gz"; |
||||
|
unlink($dir); |
||||
|
unlink("$dir.gz") if -e "$dir.gz"; |
||||
|
} |
||||
|
else { |
||||
|
print "swim: operation only implemented for installed system\n"; |
||||
|
exit; |
||||
|
} |
||||
|
} |
||||
|
elsif (!$commands->{"dbpath"} && $commands->{"root"}) { |
||||
|
if (-e "$parent$base/searchindex.deb") { |
||||
|
$file = "$parent$base/searchindex.deb"; |
||||
|
$dir = "$parent$base/dirindex.deb"; |
||||
|
unlink($file); |
||||
|
unlink("$file.gz") if -e "$file.gz"; |
||||
|
unlink($dir); |
||||
|
unlink("$dir.gz") if -e "$dir.gz"; |
||||
|
} |
||||
|
else { |
||||
|
print "swim: operation only implemented for installed system\n"; |
||||
|
exit; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
open(DIR,">$dir"); |
||||
|
open(FILE,">$file"); |
||||
|
# We need to reconstruct long.debian & DEBIAN*, but can't take into account |
||||
|
# weirdisms with the database - NEW packages which aren't NEW. |
||||
|
foreach (keys %ib) { |
||||
|
if (defined $ib{$_}) { |
||||
|
my $filedir = $_; |
||||
|
my $package = $ib{$_}; |
||||
|
#$package =~ s/\s/\n/g; |
||||
|
my @the_amount = split(/\s/, $package); |
||||
|
if ($#the_amount > 0) { |
||||
|
print DIR "$filedir\n"; |
||||
|
} |
||||
|
elsif ($#the_amount == 0) { |
||||
|
print FILE "$filedir\n"; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
untie %ib; |
||||
|
print scalar(localtime), "\n"; |
||||
|
|
||||
|
} # end sub rebuildflatdb |
||||
|
|
||||
|
|
||||
|
|
||||
|
1; |
@ -0,0 +1,648 @@ |
|||||
|
# Package administration and research tool for Debian |
||||
|
# Copyright (C) 1999-2000 Jonathan D. Rosenbaum |
||||
|
|
||||
|
# This program 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. |
||||
|
|
||||
|
# This program 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 this program; if not, write to the Free Software |
||||
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
||||
|
|
||||
|
|
||||
|
package SWIM::DB_Init; |
||||
|
use strict; |
||||
|
use SWIM::Conf qw(:Path $fastswim $imswim $slowswim $sort); |
||||
|
#use SWIM::Global; |
||||
|
use SWIM::Format; |
||||
|
use SWIM::MD; |
||||
|
use DB_File; |
||||
|
use vars qw(@ISA @EXPORT); |
||||
|
use Exporter; |
||||
|
@ISA = qw(Exporter); |
||||
|
@EXPORT = qw(database); |
||||
|
|
||||
|
|
||||
|
# database() md() --initdb --rebuilddb |
||||
|
|
||||
|
# Time to get serious and make a database |
||||
|
sub database { |
||||
|
|
||||
|
|
||||
|
my ($commands) = @_; |
||||
|
my %commands = %$commands; |
||||
|
print scalar(localtime), "\n"; |
||||
|
|
||||
|
#my whatever that is |
||||
|
my @dpackage; # passes name_version to md() |
||||
|
my @Tdescription; |
||||
|
my @description; |
||||
|
my @ldescription; |
||||
|
my @package; |
||||
|
my %db; |
||||
|
my @name; |
||||
|
my $count = 0; |
||||
|
|
||||
|
my $the_status; |
||||
|
|
||||
|
my $status; |
||||
|
my @essential; |
||||
|
my $priority; |
||||
|
my $section; |
||||
|
my $installed_size; |
||||
|
my $maintainer; |
||||
|
my $source; |
||||
|
my $version; |
||||
|
my $ver; |
||||
|
|
||||
|
my %gb; |
||||
|
my %group; |
||||
|
my $group; |
||||
|
|
||||
|
# Keeps a package->version database |
||||
|
# to save time over using status |
||||
|
my %sb; |
||||
|
my @status; |
||||
|
|
||||
|
my ($replaces, @REPLACE, $provides, $depends, $pre_depends, |
||||
|
$recommends, $suggests, $conflicts); |
||||
|
|
||||
|
my @conffiles; |
||||
|
my $line_before; |
||||
|
my @conf; |
||||
|
my @complete; |
||||
|
my @form; |
||||
|
my @formly; |
||||
|
my $format_deb = "$tmp/format.deb"; |
||||
|
|
||||
|
# Let's decide whether we should even go on. If it is --initdb, and |
||||
|
# the databases already exist, nothing should be touched, but if it is |
||||
|
# --rebuilddb and they exist, then they are removed and remade from |
||||
|
# scratch. |
||||
|
|
||||
|
# But first, better clean up any files in $tmp in case of an aborted |
||||
|
# database formation |
||||
|
unlink(<$tmp/DEBIAN*>) if -e "$tmp/DEBIANaa"; |
||||
|
unlink("$tmp/transfer.deb") if -e "$tmp/transfer.deb"; |
||||
|
unlink("$tmp/big.debian") if -e "$tmp/big.debian"; |
||||
|
unlink("$tmp/long.debian") if -e "$tmp/long.debian"; |
||||
|
|
||||
|
|
||||
|
if (-e "$parent$base/status" && -e "$parent$base/info") { |
||||
|
$the_status = "$parent$base/status"; |
||||
|
} |
||||
|
else { |
||||
|
print "swim: crucial file(s)/directories are missing in $parent\n"; |
||||
|
exit; |
||||
|
} |
||||
|
|
||||
|
if (($commands->{"dbpath"} && $commands->{"root"}) || |
||||
|
($commands->{"dbpath"} && !$commands->{"root"}) || |
||||
|
(!$commands->{"dbpath"} && !$commands->{"root"})) { |
||||
|
if ($commands->{"initdb"}) { |
||||
|
if (-e "$parent$library/packages.deb" && |
||||
|
-e "$parent$library/fileindex.deb") { |
||||
|
print "swim: use --rebuilddb\n"; |
||||
|
exit; |
||||
|
} |
||||
|
else { |
||||
|
# if a database happens to be missing |
||||
|
if (-e "$parent$library/packages.deb") { |
||||
|
unlink("$parent$library/packages.deb"); |
||||
|
} |
||||
|
if (-e "$parent$library/fileindex.deb") { |
||||
|
unlink("$parent$library/fileindex.deb"); |
||||
|
} |
||||
|
if (-e "$parent$library/groupindex.deb") { |
||||
|
unlink("$parent$library/groupindex.deb"); |
||||
|
} |
||||
|
if (-e "$parent$library/statusindex.deb") { |
||||
|
unlink("$parent$library/statusindex.deb"); |
||||
|
} |
||||
|
if (-e "$parent$library/searchindex.deb") { |
||||
|
unlink("$parent$library/searchindex.deb"); |
||||
|
} |
||||
|
if (-e "$parent$library/searchindex.deb.gz") { |
||||
|
unlink("$parent$library/searchindex.deb.gz"); |
||||
|
} |
||||
|
if (-e "$parent$library/dirindex.deb") { |
||||
|
unlink("$parent$library/dirindex.deb"); |
||||
|
} |
||||
|
if (-e "$parent$library/dirindex.deb.gz") { |
||||
|
unlink("$parent$library/dirindex.deb.gz"); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
# this only works if all databases exist. |
||||
|
elsif ($commands->{"rebuilddb"}) { |
||||
|
if (-e "$parent$library/packages.deb" && |
||||
|
-e "$parent$library/fileindex.deb") { |
||||
|
unlink("$parent$library/packages.deb"); |
||||
|
unlink("$parent$library/fileindex.deb"); |
||||
|
unlink("$parent$library/groupindex.deb"); |
||||
|
unlink("$parent$library/statusindex.deb"); |
||||
|
unlink("$parent$library/searchindex.deb"); |
||||
|
unlink("$parent$library/searchindex.deb") |
||||
|
if -e "$parent$library/searchindex.deb"; |
||||
|
unlink("$parent$library/dirindex.deb"); |
||||
|
unlink("$parent$library/dirindex.deb") |
||||
|
if -e "$parent$library/dirindex.deb.gz"; |
||||
|
} |
||||
|
else { |
||||
|
print "swim: use --initdb to create databases\n"; |
||||
|
exit; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
elsif (!$commands->{"dbpath"} && $commands->{"root"}) { |
||||
|
if ($commands->{"initdb"}) { |
||||
|
if (-e "$parent$base/packages.deb" && |
||||
|
-e "$parent$base/fileindex.deb") { |
||||
|
print "swim: use --rebuilddb\n"; |
||||
|
exit; |
||||
|
} |
||||
|
else { |
||||
|
# if a database happens to be missing |
||||
|
if (-e "$parent$base/packages.deb") { |
||||
|
unlink("$parent$base/packages.deb"); |
||||
|
} |
||||
|
if (-e "$parent$base/fileindex.deb") { |
||||
|
unlink("$parent$base/fileindex.deb"); |
||||
|
} |
||||
|
if (-e "$parent$base/groupindex.deb") { |
||||
|
unlink("$parent$base/groupindex.deb"); |
||||
|
} |
||||
|
if (-e "$parent$library/statusindex.deb") { |
||||
|
unlink("$parent$library/statusindex.deb"); |
||||
|
} |
||||
|
if (-e "$parent$library/searchindex.deb") { |
||||
|
unlink("$parent$library/searchindex.deb"); |
||||
|
} |
||||
|
if (-e "$parent$library/searchindex.deb.gz") { |
||||
|
unlink("$parent$library/searchindex.deb.gz"); |
||||
|
} |
||||
|
if (-e "$parent$library/dirindex.deb") { |
||||
|
unlink("$parent$library/dirindex.deb"); |
||||
|
} |
||||
|
if (-e "$parent$library/dirindex.deb.gz") { |
||||
|
unlink("$parent$library/dirindex.deb.gz"); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
# this only works if all databases exist. |
||||
|
elsif ($commands->{"rebuilddb"}) { |
||||
|
if (-e "$parent$base/packages.deb" && |
||||
|
-e "$parent$base/fileindex.deb") { |
||||
|
unlink("$parent$base/packages.deb"); |
||||
|
unlink("$parent$base/fileindex.deb"); |
||||
|
unlink("$parent$base/groupindex.deb"); |
||||
|
unlink("$parent$base/statusindex.deb"); |
||||
|
unlink("$parent$library/searchindex.deb"); |
||||
|
unlink("$parent$library/searchindex.deb") |
||||
|
if -e "$parent$library/searchindex.deb"; |
||||
|
unlink("$parent$library/dirindex.deb"); |
||||
|
unlink("$parent$library/dirindex.deb") |
||||
|
if -e "$parent$library/dirindex.deb.gz"; |
||||
|
} |
||||
|
else { |
||||
|
print "swim: use --initdb to create databases\n"; |
||||
|
exit; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
# This makes a backup of all the *.list files in ./backup. When |
||||
|
# --initdb/--rebuilddb runs these files should be built or rebuilt, |
||||
|
# but if changes have occured and --db(-i wasn't used) wasn't run |
||||
|
# this won't cause problems because everything is rebuilt, there may |
||||
|
# just be some lingering small files in backup. |
||||
|
|
||||
|
# Seems like both approaches are about the same speed. |
||||
|
#use File::Copy; |
||||
|
print "Making backups of *.list\n"; |
||||
|
if (!-d "$parent$base/info/backup") { |
||||
|
mkdir("$parent$base/info/backup",0666); |
||||
|
} |
||||
|
opendir(COPY,"$parent$base/info"); |
||||
|
foreach (sort grep(/\.list$/, readdir(COPY))) { |
||||
|
#copy ("$parent$base/info/$_","$parent$base/info/backup/$_.bk"); |
||||
|
open(FILENAME,"$parent$base/info/$_"); |
||||
|
open(CP,">$parent$base/info/backup/$_.bk"); |
||||
|
while (<FILENAME>) { |
||||
|
print CP $_; |
||||
|
} |
||||
|
} |
||||
|
closedir(COPY); |
||||
|
|
||||
|
print "Description Database is being made\n"; |
||||
|
|
||||
|
$| = 1; my $x = 0; |
||||
|
open(PRETTY, ">$format_deb"); |
||||
|
open(AVAIL, "$the_status"); |
||||
|
while (<AVAIL>) { |
||||
|
# Package name |
||||
|
if (/^Package:|^PACKAGE:/) { |
||||
|
@package = split(/: /,$_); |
||||
|
chomp $package[1]; |
||||
|
$x = 1 if $x == 6; |
||||
|
print "|\r" if $x == 1 || $x == 4; print "/\r" if $x == 2; |
||||
|
print "-\r" if $x == 3 || $x == 6; print "\\\r" if $x == 5; |
||||
|
$x++; |
||||
|
} |
||||
|
# Some other pertinent fields |
||||
|
# All this stuff can be placed together..since it is generally nice |
||||
|
# to know these things at one glance, in this order. |
||||
|
# Package: Status: |
||||
|
# Version: Essential: (yes or no) |
||||
|
# Section: Priority: |
||||
|
# Installed-Size: |
||||
|
# Maintainer: |
||||
|
# Description: |
||||
|
|
||||
|
elsif (/^Status:/) { |
||||
|
$status = $_; |
||||
|
} |
||||
|
elsif (/^Essential/) { |
||||
|
@essential = split(/: /,$_); |
||||
|
} |
||||
|
elsif (/^Priority:/) { |
||||
|
$priority = $_; |
||||
|
} |
||||
|
elsif (/^Section:/) { |
||||
|
$section = $_; |
||||
|
# make the hash for the groupindex.deb |
||||
|
$group = substr($section,9); |
||||
|
chomp $group; |
||||
|
# we will put not-installed in their own group for reference |
||||
|
if ($status !~ /not-installed/) { |
||||
|
if (!defined $group{$group}) { |
||||
|
$group{$group} = $package[1]; |
||||
|
} |
||||
|
else { |
||||
|
$group{$group} = "$group{$group} $package[1]"; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
elsif (/^Installed-Size:/) { |
||||
|
$installed_size = $_; |
||||
|
} |
||||
|
elsif (/^Maintainer:/) { |
||||
|
$maintainer = $_; |
||||
|
} |
||||
|
elsif (/^Source:/) { |
||||
|
$source = $_; |
||||
|
} |
||||
|
# hold ok not-installed - may want to change this just to |
||||
|
# non-installed. |
||||
|
elsif (/^Version:/ && $status !~ /not-installed/) { |
||||
|
$version = $_; |
||||
|
chomp($version, $section); |
||||
|
$col1 = "Package: $package[1]"; |
||||
|
$col2 = $status; |
||||
|
write PRETTY; |
||||
|
$col1 = $version; |
||||
|
$ver = m,Version:\s(.*),; |
||||
|
# This creates a name -> version index in package.deb, |
||||
|
# and the statusindex.deb database which will serve to |
||||
|
# determine if the status has changed when --db or -i is |
||||
|
# ran. |
||||
|
push(@name, $package[1]); |
||||
|
push(@status, $package[1]); |
||||
|
$package[1] = "$package[1]_$1"; |
||||
|
push(@name, $package[1]); |
||||
|
my $priory = substr($priority,10); |
||||
|
chomp $priory; |
||||
|
my $statusy = substr($status,8); |
||||
|
chomp $statusy; |
||||
|
$statusy =~ s/\s/:/g; |
||||
|
my $thimk = "$package[1] $group $priory $statusy"; |
||||
|
push(@status, $thimk); |
||||
|
if(defined($essential[1])) { |
||||
|
$col2 = "Essential: $essential[1]"; |
||||
|
@essential = (); |
||||
|
} |
||||
|
else { |
||||
|
$col2 = "Essential: no\n"; |
||||
|
} |
||||
|
write PRETTY; |
||||
|
if (defined $section) { |
||||
|
$col1 = $section; |
||||
|
} |
||||
|
else { |
||||
|
$col1 = "Section: unavailable"; |
||||
|
} |
||||
|
if (defined $priority) { |
||||
|
$col2 = $priority; |
||||
|
} |
||||
|
else { |
||||
|
$col2 = "Priority: unavailable\n"; |
||||
|
} |
||||
|
write PRETTY; |
||||
|
#my $cool = $installed_size . $maintainer; |
||||
|
$col1 = $installed_size; |
||||
|
if (defined $source) { |
||||
|
$col2 = $source; |
||||
|
} |
||||
|
else { |
||||
|
$col2 = ""; |
||||
|
} |
||||
|
write PRETTY; |
||||
|
undef $source; |
||||
|
print PRETTY $maintainer |
||||
|
} |
||||
|
|
||||
|
# This stuff will be available with seperate query flags or All |
||||
|
elsif (/^Replaces:/) { |
||||
|
$replaces = $_; |
||||
|
if (defined($replaces)) { |
||||
|
push(@REPLACE, "$package[1]REP"); |
||||
|
push(@REPLACE, $replaces); |
||||
|
} |
||||
|
} |
||||
|
elsif (/^Provides:/) { |
||||
|
$provides = $_; |
||||
|
if (defined($provides)) { |
||||
|
push(@REPLACE, "$package[1]PRO"); |
||||
|
push(@REPLACE, $provides); |
||||
|
} |
||||
|
} |
||||
|
elsif (/^Depends:/) { |
||||
|
$depends = $_; |
||||
|
if (defined($depends)) { |
||||
|
push(@REPLACE, "$package[1]DEP"); |
||||
|
push(@REPLACE, $depends); |
||||
|
} |
||||
|
} |
||||
|
elsif (/^Pre-Depends:/) { |
||||
|
$pre_depends = $_; |
||||
|
if (defined($pre_depends)) { |
||||
|
push(@REPLACE, "$package[1]PRE"); |
||||
|
push(@REPLACE, $pre_depends); |
||||
|
} |
||||
|
} |
||||
|
elsif (/^Recommends:/) { |
||||
|
$recommends = $_; |
||||
|
if (defined($recommends)) { |
||||
|
push(@REPLACE, "$package[1]REC"); |
||||
|
push(@REPLACE, $recommends); |
||||
|
} |
||||
|
} |
||||
|
elsif (/^Suggests:/) { |
||||
|
$suggests = $_; |
||||
|
if (defined($suggests)) { |
||||
|
push(@REPLACE, "$package[1]SUG"); |
||||
|
push(@REPLACE, $suggests); |
||||
|
} |
||||
|
} |
||||
|
elsif (/^Conflicts:/) { |
||||
|
$conflicts = $_; |
||||
|
if (defined($conflicts)) { |
||||
|
push(@REPLACE, "$package[1]CON"); |
||||
|
push(@REPLACE, $conflicts); |
||||
|
} |
||||
|
} |
||||
|
# Gather the Configuration Files, Description comes after. |
||||
|
# Available with a single flag. |
||||
|
elsif (/^Conffiles:/) { |
||||
|
my $line = <AVAIL>; |
||||
|
while ($line !~ /^Description:/) { |
||||
|
push(@conffiles,$line); |
||||
|
$line = <AVAIL>; |
||||
|
if ($line =~ /^Description/) { |
||||
|
$line_before = $line; |
||||
|
# put conffiles into one variable |
||||
|
if (defined $package[1]) { |
||||
|
#chomp $package[1]; |
||||
|
push(@conf,"$package[1]CONF"); |
||||
|
} |
||||
|
my ($c, $cool); |
||||
|
if ($#conffiles != 0) { |
||||
|
for ($c = $#conffiles; $c >= 0; $c--) { |
||||
|
if ($c > 0) { |
||||
|
$cool = $conffiles[$c-1] .= $conffiles[$c]; |
||||
|
} |
||||
|
} #end for |
||||
|
} |
||||
|
else { |
||||
|
$cool = $conffiles[0]; |
||||
|
} |
||||
|
@conffiles = (); |
||||
|
push(@conf,$cool); |
||||
|
} #if ($line =~ /^Desc |
||||
|
} # while ($line ! /^Desc |
||||
|
} # elsif (/^Conffiles |
||||
|
|
||||
|
# Only interested in available packages..so this is fine. |
||||
|
# To be combined with first fields. |
||||
|
if (/Description:|^\s\w*|^\s\.\w*/ || |
||||
|
defined($line_before) =~ /^Description/){ |
||||
|
my $many_lines; |
||||
|
if (defined($line_before)) { |
||||
|
push(@ldescription, $line_before); |
||||
|
push(@ldescription, $_); |
||||
|
$line_before = (); |
||||
|
} |
||||
|
else { |
||||
|
$many_lines = $_; |
||||
|
} |
||||
|
if ($_ !~ /^\n$/) { |
||||
|
$count++; |
||||
|
if ($count == 1) { |
||||
|
if (defined $package[1]) { |
||||
|
#chomp $package[1]; |
||||
|
push(@dpackage,$package[1]); |
||||
|
push(@description,$package[1]); |
||||
|
} |
||||
|
} |
||||
|
if (defined($many_lines)) { |
||||
|
push(@ldescription,$many_lines); |
||||
|
} |
||||
|
} # end if ($_ !~ /^\n$/ |
||||
|
else { |
||||
|
$count = 0; |
||||
|
# let's put each description into one scalar |
||||
|
my ($c, $cool); |
||||
|
if ($#ldescription != 0) { |
||||
|
for ($c = $#ldescription; $c >= 0; $c--) { |
||||
|
if ($c > 0) { |
||||
|
$cool = $ldescription[$c-1] .= $ldescription[$c]; |
||||
|
} |
||||
|
} #end for |
||||
|
} # end if ($#ld |
||||
|
else { |
||||
|
$cool = $ldescription[0]; |
||||
|
} |
||||
|
if (defined $cool) { |
||||
|
push(@description,$cool); |
||||
|
} |
||||
|
@ldescription = (); |
||||
|
} # end else |
||||
|
$line_before = (); |
||||
|
} |
||||
|
} # end while (<AVAIL>) |
||||
|
close(PRETTY); |
||||
|
|
||||
|
# Let's put together the description with the rest of its fields. |
||||
|
open(FIELDS,"$format_deb"); |
||||
|
while (<FIELDS>) { |
||||
|
push(@form,$_); |
||||
|
} |
||||
|
close(FIELDS); |
||||
|
|
||||
|
foreach (@form) { |
||||
|
push(@formly,$_); |
||||
|
my ($cool); |
||||
|
$count++; |
||||
|
if ($count == 5) { |
||||
|
my ($c, $cool); |
||||
|
if ($#formly != 0) { |
||||
|
for ($c = $#formly; $c >= 0; $c--) { |
||||
|
if ($c > 0) { |
||||
|
$cool = $formly[$c-1] .= $formly[$c]; |
||||
|
} |
||||
|
} #end for |
||||
|
} # end if ($#ld |
||||
|
else { |
||||
|
$cool = $formly[0]; |
||||
|
} |
||||
|
push(@complete,$cool); |
||||
|
@formly = (); |
||||
|
$count = 0; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
foreach (@description) { |
||||
|
if ($count == 1) { |
||||
|
my $lingo = shift(@complete); |
||||
|
$lingo = $lingo . $_; |
||||
|
push(@Tdescription, $lingo); |
||||
|
$lingo = (); |
||||
|
$count = 1; |
||||
|
} |
||||
|
else { |
||||
|
push(@Tdescription, $_); |
||||
|
$count = 0; |
||||
|
} |
||||
|
$count++; |
||||
|
|
||||
|
} |
||||
|
unlink($format_deb); |
||||
|
|
||||
|
# We'll keep databases local so that md() doesn't get confused with |
||||
|
# database(). |
||||
|
|
||||
|
# Put the groups into the groupindex.deb database. |
||||
|
print "Group Database is being made\n"; |
||||
|
if (($commands->{"dbpath"} && $commands->{"root"}) || |
||||
|
($commands->{"dbpath"} && !$commands->{"root"}) || |
||||
|
(!$commands->{"dbpath"} && !$commands->{"root"})) { |
||||
|
tie %gb, 'DB_File', "$parent$library/groupindex.deb" or die "DB_File: $!"; |
||||
|
} |
||||
|
elsif (!$commands->{"dbpath"} && $commands->{"root"}) { |
||||
|
tie %gb, 'DB_File', "$parent$base/groupindex.deb" or die "DB_File: $!"; |
||||
|
} |
||||
|
|
||||
|
%gb = %group; |
||||
|
|
||||
|
untie %gb; |
||||
|
undef %gb; |
||||
|
undef %group; |
||||
|
|
||||
|
# Create the important status database. |
||||
|
print "Status Database is being made\n"; |
||||
|
if (($commands->{"dbpath"} && $commands->{"root"}) || |
||||
|
($commands->{"dbpath"} && !$commands->{"root"}) || |
||||
|
(!$commands->{"dbpath"} && !$commands->{"root"})) { |
||||
|
tie %sb, 'DB_File', "$parent$library/statusindex.deb" or die "DB_File: $!"; |
||||
|
} |
||||
|
elsif (!$commands->{"dbpath"} && $commands->{"root"}) { |
||||
|
tie %sb, 'DB_File', "$parent$base/statusindex.deb" or die "DB_File: $!"; |
||||
|
} |
||||
|
|
||||
|
%sb = @status; |
||||
|
|
||||
|
untie %sb; |
||||
|
undef %sb; |
||||
|
undef @status; |
||||
|
|
||||
|
# Put everything into the package.deb database. |
||||
|
if (($commands->{"dbpath"} && $commands->{"root"}) || |
||||
|
($commands->{"dbpath"} && !$commands->{"root"}) || |
||||
|
(!$commands->{"dbpath"} && !$commands->{"root"})) { |
||||
|
tie %db, 'DB_File', "$parent$library/packages.deb" or die "DB_File: $!"; |
||||
|
} |
||||
|
elsif (!$commands->{"dbpath"} && $commands->{"root"}) { |
||||
|
tie %db, 'DB_File', "$parent$base/packages.deb" or die "DB_File: $!"; |
||||
|
} |
||||
|
|
||||
|
%db = (@name,@Tdescription,@conf,@REPLACE); |
||||
|
untie %db; |
||||
|
undef @Tdescription; |
||||
|
undef @conf; |
||||
|
undef @REPLACE; |
||||
|
undef %db; |
||||
|
|
||||
|
|
||||
|
# To the total db thing. |
||||
|
if ($commands->{"initdb"} || $commands->{"rebuilddb"}) { |
||||
|
md(\@dpackage,\%commands); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
} # end sub database |
||||
|
|
||||
|
|
||||
|
# Basically, this writes @dpackage to transfer.deb, which is processed by |
||||
|
# either fastswim into two files big.debian and long.debian for further |
||||
|
# processing by process_md() or is processed by imswim, then slowswim into |
||||
|
# the two files big.debian and long.debian then finished by process_md() |
||||
|
sub md { |
||||
|
|
||||
|
my($dpackage,$commands) = @_; # creates transfer.deb |
||||
|
my %commands = %$commands; |
||||
|
|
||||
|
|
||||
|
unless (-e "$parent$base/info") { |
||||
|
die 'This program requires the /var/lib/dpkg/info directory set-up by dpkg'; |
||||
|
} |
||||
|
|
||||
|
# Put all file/dir(*.list)->package_name(s) into an massive array. |
||||
|
# fastswim runs this process separately. |
||||
|
|
||||
|
# This enables info files to be used from a different root system |
||||
|
my $argument2 = "$parent$base/info"; |
||||
|
|
||||
|
# This is just for testing purposes, and serves no real purpose. |
||||
|
if (!defined(@$dpackage)) { |
||||
|
system("$fastswim"); |
||||
|
} |
||||
|
# This is what is used. |
||||
|
else { |
||||
|
open(TRANSFER, ">$tmp/transfer.deb"); |
||||
|
foreach (@$dpackage) { |
||||
|
print TRANSFER "$_\n"; |
||||
|
} |
||||
|
close(TRANSFER); |
||||
|
if (!$commands->{"lowmem"}) { |
||||
|
system $fastswim, "--transfer", $argument2, $tmp; |
||||
|
} |
||||
|
else { |
||||
|
print "Gathering the file(s)/dir(s)\n"; |
||||
|
system $imswim, $argument2, $tmp; |
||||
|
system $slowswim, $tmp, $sort; |
||||
|
} |
||||
|
} |
||||
|
undef @$dpackage; |
||||
|
process_md(\%commands); |
||||
|
|
||||
|
} # end sub md |
||||
|
|
||||
|
|
||||
|
|
||||
|
1; |
@ -0,0 +1,497 @@ |
|||||
|
# Package administration and research tool for Debian |
||||
|
# Copyright (C) 1999-2000 Jonathan D. Rosenbaum |
||||
|
|
||||
|
# This program 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. |
||||
|
|
||||
|
# This program 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 this program; if not, write to the Free Software |
||||
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
||||
|
|
||||
|
|
||||
|
package SWIM::DB_Library; |
||||
|
use strict; |
||||
|
use SWIM::Conf; |
||||
|
use SWIM::Global; |
||||
|
use SWIM::Library; |
||||
|
use DB_File; |
||||
|
use vars qw(@ISA @EXPORT %EXPORT_TAGS); |
||||
|
|
||||
|
use Exporter; |
||||
|
@ISA = qw(Exporter); |
||||
|
@EXPORT = qw(ib nib dbi ndb sb exist_sb nsb ping zing nzing ging gb |
||||
|
ngb sing ram_on version ver nver nping nzing nging nsing); |
||||
|
%EXPORT_TAGS = ( |
||||
|
Search => [ qw(ib dbi nib nsb ndb gb ram_on version ngb) ], |
||||
|
Db => [ qw(sb ib gb nsb ver dbi zing ging ping sing) ], |
||||
|
Md => [ qw(sb ib nsb nzing) ], |
||||
|
Deb => [ qw(sb nsb ndb) ], |
||||
|
NDb => [ qw(ndb nsb ngb nver nping nzing nging nsing |
||||
|
exist_sb sb) ], |
||||
|
Groups => [ qw(gb ngb) ], |
||||
|
Xyz => [ qw(dbi ndb) ] |
||||
|
); |
||||
|
|
||||
|
|
||||
|
# functions which use DB_File |
||||
|
|
||||
|
|
||||
|
sub ib { |
||||
|
|
||||
|
my ($commands) = @_; |
||||
|
|
||||
|
if (($commands->{"dbpath"} && $commands->{"root"}) || |
||||
|
($commands->{"dbpath"} && !$commands->{"root"}) || |
||||
|
(!$commands->{"dbpath"} && !$commands->{"root"})) { |
||||
|
if (-e "$parent$library/fileindex.deb") { |
||||
|
tie %ib, 'DB_File', "$parent$library/fileindex.deb" or die "DB_File: $!"; |
||||
|
} |
||||
|
} |
||||
|
elsif (!$commands->{"dbpath"} && $commands->{"root"}) { |
||||
|
if (-e "$parent$base/fileindex.deb") { |
||||
|
tie %ib, 'DB_File', "$parent$base/fileindex.deb" or die "DB_File: $!"; |
||||
|
} |
||||
|
} |
||||
|
} # end sub ib |
||||
|
|
||||
|
sub dbi { |
||||
|
|
||||
|
my ($commands) = @_; |
||||
|
|
||||
|
if (($commands->{"dbpath"} && $commands->{"root"}) || |
||||
|
($commands->{"dbpath"} && !$commands->{"root"}) || |
||||
|
(!$commands->{"dbpath"} && !$commands->{"root"})) { |
||||
|
if (-e "$parent$library/packages.deb" || |
||||
|
($commands->{"initndb"} || $commands->{"rebuildndb"})) { |
||||
|
tie %db, 'DB_File', "$parent$library/packages.deb" or die "DB_File: $!"; |
||||
|
} |
||||
|
} |
||||
|
elsif (!$commands->{"dbpath"} && $commands->{"root"}) { |
||||
|
if (-e "$parent$base/packages.deb" || |
||||
|
($commands->{"initndb"} || $commands->{"rebuildndb"})) { |
||||
|
tie %db, 'DB_File', "$parent$base/packages.deb" or die "DB_File: $!"; |
||||
|
} |
||||
|
} |
||||
|
} # end sub dbi |
||||
|
|
||||
|
|
||||
|
|
||||
|
sub nib { |
||||
|
|
||||
|
my ($commands) = @_; |
||||
|
my %commands = %$commands; |
||||
|
|
||||
|
my ($arch,$dist) = which_archdist(\%commands); |
||||
|
if (($commands->{"dbpath"} && $commands->{"root"}) || |
||||
|
($commands->{"dbpath"} && !$commands->{"root"}) || |
||||
|
(!$commands->{"dbpath"} && !$commands->{"root"})) { |
||||
|
if (!-e "$parent$library/nfileindex$arch$dist.deb") { |
||||
|
return; |
||||
|
} |
||||
|
tie %ib, 'DB_File', "$parent$library/nfileindex$arch$dist.deb" or die "DB_File: $!"; |
||||
|
} |
||||
|
elsif (!$commands->{"dbpath"} && $commands->{"root"}) { |
||||
|
if (!-e "$parent$base/nfileindex$arch$dist.deb") { |
||||
|
return; |
||||
|
} |
||||
|
tie %ib, 'DB_File', "$parent$base/nfileindex$arch$dist.deb" or die "DB_File: $!"; |
||||
|
} |
||||
|
} # end sub nib |
||||
|
|
||||
|
|
||||
|
sub ndb { |
||||
|
|
||||
|
my ($commands) = @_; |
||||
|
my %commands = %$commands; |
||||
|
|
||||
|
my ($arch,$dist) = which_archdist(\%commands); |
||||
|
if (($commands->{"dbpath"} && $commands->{"root"}) || |
||||
|
($commands->{"dbpath"} && !$commands->{"root"}) || |
||||
|
(!$commands->{"dbpath"} && !$commands->{"root"})) { |
||||
|
if (-e "$parent$library/npackages$arch$dist.deb" || |
||||
|
($commands->{"initndb"} || $commands->{"rebuildndb"} || |
||||
|
$commands->{"ndb"})) { |
||||
|
tie %db, 'DB_File', "$parent$library/npackages$arch$dist.deb" |
||||
|
or die "swim: use pre-existing databases for this option"; |
||||
|
} |
||||
|
} |
||||
|
elsif (!$commands->{"dbpath"} && $commands->{"root"}) { |
||||
|
if (-e "$parent$base/npackages$arch$dist.deb" || |
||||
|
($commands->{"initndb"} || $commands->{"rebuildndb"} || |
||||
|
$commands->{"ndb"})) { |
||||
|
tie %db, 'DB_File', "$parent$base/npackages$arch$dist.deb" |
||||
|
or die "swim: use pre-existing databases for this option"; |
||||
|
} |
||||
|
} |
||||
|
} # end sub ndb |
||||
|
|
||||
|
|
||||
|
sub sb { |
||||
|
|
||||
|
my ($commands) = @_; |
||||
|
my %commands = %$commands; |
||||
|
|
||||
|
if (($commands->{"dbpath"} && $commands->{"root"}) || |
||||
|
($commands->{"dbpath"} && !$commands->{"root"}) || |
||||
|
(!$commands->{"dbpath"} && !$commands->{"root"})) { |
||||
|
if (-e "$parent$library/statusindex.deb") { |
||||
|
tie %sb, 'DB_File', "$parent$library/statusindex.deb" |
||||
|
or die "DB_File: $!"; |
||||
|
} |
||||
|
else { |
||||
|
return; |
||||
|
} |
||||
|
} |
||||
|
elsif (!$commands->{"dbpath"} && $commands->{"root"}) { |
||||
|
if (-e "$parent$base/statusindex.deb") { |
||||
|
tie %sb, 'DB_File', "$parent$base/statusindex.deb" |
||||
|
or die "DB_File: $!"; |
||||
|
} |
||||
|
else { |
||||
|
return; |
||||
|
} |
||||
|
} |
||||
|
} # end sub sb |
||||
|
|
||||
|
# exist_sb & sb seem to be used primarily in NDB_Init |
||||
|
|
||||
|
# This first looks in the immediate directory for statusindex.deb, if it |
||||
|
# isn't found here, it look in the default directory. It then returns |
||||
|
# undef, or initializes the database based on its findings. |
||||
|
sub exist_sb { |
||||
|
|
||||
|
my ($commands) = @_; |
||||
|
my %commands = %$commands; |
||||
|
|
||||
|
my $yep; |
||||
|
if (($commands->{"dbpath"} && $commands->{"root"}) || |
||||
|
($commands->{"dbpath"} && !$commands->{"root"}) || |
||||
|
(!$commands->{"dbpath"} && !$commands->{"root"})) { |
||||
|
if (-e "$parent$library/statusindex.deb") { |
||||
|
$yep = "yes"; |
||||
|
} |
||||
|
} |
||||
|
elsif (!$commands->{"dbpath"} && $commands->{"root"}) { |
||||
|
if (-e "$parent$base/statusindex.deb") { |
||||
|
$yep = "yes"; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
if (!defined $yep) { |
||||
|
if (-e "$parent$base/statusindex.deb") { |
||||
|
tie %sb, 'DB_File', "$parent$base/statusindex.deb" |
||||
|
or die "DB_File: $!"; |
||||
|
return "yes"; |
||||
|
} |
||||
|
else { |
||||
|
return; |
||||
|
} |
||||
|
} |
||||
|
elsif (defined $yep) { |
||||
|
sb(\%commands); |
||||
|
return "yes"; |
||||
|
} |
||||
|
|
||||
|
} # end sub exist_sb |
||||
|
|
||||
|
sub nsb { |
||||
|
|
||||
|
my ($commands) = @_; |
||||
|
my %commands = %$commands; |
||||
|
|
||||
|
my($arch,$dist) = which_archdist(\%commands); |
||||
|
if (($commands->{"dbpath"} && $commands->{"root"}) || |
||||
|
($commands->{"dbpath"} && !$commands->{"root"}) || |
||||
|
(!$commands->{"dbpath"} && !$commands->{"root"})) { |
||||
|
if (-e "$parent$library/nstatusindex$arch$dist.deb" || |
||||
|
($commands->{"initndb"} || $commands->{"rebuildndb"} || |
||||
|
$commands->{"ndb"})) { |
||||
|
tie %nsb, 'DB_File', "$parent$library/nstatusindex$arch$dist.deb" |
||||
|
or die "swim: use pre-existing databases for this option"; |
||||
|
} |
||||
|
} |
||||
|
elsif (!$commands->{"dbpath"} && $commands->{"root"}) { |
||||
|
if (-e "$parent$base/nstatusindex$arch$dist.deb" || |
||||
|
($commands->{"initndb"} || $commands->{"rebuildndb"} || |
||||
|
$commands->{"ndb"})) { |
||||
|
tie %nsb, 'DB_File', "$parent$base/nstatusindex$arch$dist.deb" or die |
||||
|
or die "swim: use pre-existing databases for this option"; |
||||
|
} |
||||
|
} |
||||
|
} # end sub nsb |
||||
|
|
||||
|
sub ping { |
||||
|
|
||||
|
my ($commands) = @_; |
||||
|
|
||||
|
if (($commands->{"dbpath"} && $commands->{"root"}) || |
||||
|
($commands->{"dbpath"} && !$commands->{"root"}) || |
||||
|
(!$commands->{"dbpath"} && !$commands->{"root"})) { |
||||
|
$ping = tie %db, 'DB_File', "$parent$library/packages.deb" or die "DB_File: $!"; |
||||
|
} |
||||
|
elsif (!$commands->{"dbpath"} && $commands->{"root"}) { |
||||
|
$ping = tie %db, 'DB_File', "$parent$base/packages.deb" or die "DB_File: $!"; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
sub nping { |
||||
|
|
||||
|
my ($commands) = @_; |
||||
|
my %commands = %$commands; |
||||
|
|
||||
|
my ($arch,$dist) = which_archdist(\%commands); |
||||
|
if (($commands->{"dbpath"} && $commands->{"root"}) || |
||||
|
($commands->{"dbpath"} && !$commands->{"root"}) || |
||||
|
(!$commands->{"dbpath"} && !$commands->{"root"})) { |
||||
|
$ping = tie %db, 'DB_File', "$parent$library/npackages$arch$dist.deb" |
||||
|
or die "DB_File: $!"; |
||||
|
} |
||||
|
elsif (!$commands->{"dbpath"} && $commands->{"root"}) { |
||||
|
$ping = tie %db, 'DB_File', "$parent$base/npackages$arch$dist.deb" |
||||
|
or die "DB_File: $!"; |
||||
|
} |
||||
|
} # end sub nping |
||||
|
|
||||
|
|
||||
|
sub zing { |
||||
|
|
||||
|
my ($commands) = @_; |
||||
|
|
||||
|
if (($commands->{"dbpath"} && $commands->{"root"}) || |
||||
|
($commands->{"dbpath"} && !$commands->{"root"}) || |
||||
|
(!$commands->{"dbpath"} && !$commands->{"root"})) { |
||||
|
$zing = tie %ib, 'DB_File', "$parent$library/fileindex.deb" |
||||
|
or die "DB_File: $!"; |
||||
|
} |
||||
|
elsif (!$commands->{"dbpath"} && $commands->{"root"}) { |
||||
|
$zing = tie %ib, 'DB_File', "$parent$base/fileindex.deb" |
||||
|
or die "DB_File: $!"; |
||||
|
} |
||||
|
} # end sub zing |
||||
|
|
||||
|
sub nzing { |
||||
|
|
||||
|
my ($commands) = @_; |
||||
|
my %commands = %$commands; |
||||
|
|
||||
|
my ($arch,$dist) = which_archdist(\%commands); |
||||
|
if (($commands->{"dbpath"} && $commands->{"root"}) || |
||||
|
($commands->{"dbpath"} && !$commands->{"root"}) || |
||||
|
(!$commands->{"dbpath"} && !$commands->{"root"})) { |
||||
|
$zing = tie %ib, 'DB_File', "$parent$library/nfileindex$arch$dist.deb" |
||||
|
or die "DB_File: $!"; |
||||
|
} |
||||
|
elsif (!$commands->{"dbpath"} && $commands->{"root"}) { |
||||
|
$zing = tie %ib, 'DB_File', "$parent$base/nfileindex$arch$dist.deb" |
||||
|
or die "DB_File: $!"; |
||||
|
} |
||||
|
} # end sub nzing |
||||
|
|
||||
|
|
||||
|
sub ging { |
||||
|
|
||||
|
my ($commands) = @_; |
||||
|
|
||||
|
if (($commands->{"dbpath"} && $commands->{"root"}) || |
||||
|
($commands->{"dbpath"} && !$commands->{"root"}) || |
||||
|
(!$commands->{"dbpath"} && !$commands->{"root"})) { |
||||
|
$ging = tie %gb, 'DB_File', "$parent$library/groupindex.deb" or die "DB_File: $!"; |
||||
|
} |
||||
|
elsif (!$commands->{"dbpath"} && $commands->{"root"}) { |
||||
|
$ging = tie %gb, 'DB_File', "$parent$base/groupindex.deb" or die "DB_File: $!"; |
||||
|
} |
||||
|
} #end sub ging |
||||
|
|
||||
|
|
||||
|
sub nging { |
||||
|
|
||||
|
my ($commands) = @_; |
||||
|
my %commands = %$commands; |
||||
|
|
||||
|
my ($arch,$dist) = which_archdist(\%commands); |
||||
|
if (($commands->{"dbpath"} && $commands->{"root"}) || |
||||
|
($commands->{"dbpath"} && !$commands->{"root"}) || |
||||
|
(!$commands->{"dbpath"} && !$commands->{"root"})) { |
||||
|
$ging = tie %gb, 'DB_File',"$parent$library/ngroupindex$arch$dist.deb" |
||||
|
or die "DB_File: $!"; |
||||
|
} |
||||
|
elsif (!$commands->{"dbpath"} && $commands->{"root"}) { |
||||
|
$ging = tie %gb, 'DB_File', "$parent$base/ngroupindex$arch$dist.deb" |
||||
|
or die "DB_File: $!"; |
||||
|
} |
||||
|
} # end sub nging |
||||
|
|
||||
|
|
||||
|
sub gb { |
||||
|
|
||||
|
my ($commands) = @_; |
||||
|
|
||||
|
if (($commands->{"dbpath"} && $commands->{"root"}) || |
||||
|
($commands->{"dbpath"} && !$commands->{"root"}) || |
||||
|
(!$commands->{"dbpath"} && !$commands->{"root"})) { |
||||
|
if (-e "$parent$library/groupindex.deb" || |
||||
|
($commands->{"initndb"} || $commands->{"rebuildndb"})) { |
||||
|
tie %gb, 'DB_File', "$parent$library/groupindex.deb" or die "DB_File: $!"; |
||||
|
} |
||||
|
} |
||||
|
elsif (!$commands->{"dbpath"} && $commands->{"root"}) { |
||||
|
if (-e "$parent$base/groupindex.deb" || |
||||
|
($commands->{"initndb"} || $commands->{"rebuildndb"})) { |
||||
|
tie %gb, 'DB_File', "$parent$base/groupindex.deb" or die "DB_File: $!"; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
sub ngb { |
||||
|
|
||||
|
my ($commands) = @_; |
||||
|
my %commands = %$commands; |
||||
|
|
||||
|
my ($arch,$dist) = which_archdist(\%commands); |
||||
|
if (($commands->{"dbpath"} && $commands->{"root"}) || |
||||
|
($commands->{"dbpath"} && !$commands->{"root"}) || |
||||
|
(!$commands->{"dbpath"} && !$commands->{"root"})) { |
||||
|
if (-e "$parent$library/ngroupindex$arch$dist.deb" || |
||||
|
($commands->{"initndb"} || $commands->{"rebuildndb"})) { |
||||
|
tie %gb, 'DB_File', "$parent$library/ngroupindex$arch$dist.deb" |
||||
|
or die "DB_File: $!"; |
||||
|
} |
||||
|
} |
||||
|
elsif (!$commands->{"dbpath"} && $commands->{"root"}) { |
||||
|
if (-e "$parent$base/ngroupindex$arch$dist.deb" || |
||||
|
($commands->{"initndb"} || $commands->{"rebuildndb"})) { |
||||
|
tie %gb, 'DB_File', "$parent$base/ngroupindex$arch$dist.deb" |
||||
|
or die "DB_File: $!"; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
sub sing { |
||||
|
|
||||
|
my ($commands) = @_; |
||||
|
|
||||
|
if (($commands->{"dbpath"} && $commands->{"root"}) || |
||||
|
($commands->{"dbpath"} && !$commands->{"root"}) || |
||||
|
(!$commands->{"dbpath"} && !$commands->{"root"})) { |
||||
|
$sing = tie %sb, 'DB_File', "$parent$library/statusindex.deb" |
||||
|
or die "DB_File: $!"; |
||||
|
} |
||||
|
elsif (!$commands->{"dbpath"} && $commands->{"root"}) { |
||||
|
$sing = tie %sb, 'DB_File', "$parent$base/statusindex.deb" or die "DB_File: $!"; |
||||
|
} |
||||
|
} # sub sing |
||||
|
|
||||
|
sub nsing { |
||||
|
|
||||
|
my ($commands) = @_; |
||||
|
my %commands = %$commands; |
||||
|
|
||||
|
my ($arch,$dist) = which_archdist(\%commands); |
||||
|
if (($commands->{"dbpath"} && $commands->{"root"}) || |
||||
|
($commands->{"dbpath"} && !$commands->{"root"}) || |
||||
|
(!$commands->{"dbpath"} && !$commands->{"root"})) { |
||||
|
$sing = tie %nsb, 'DB_File', "$parent$library/nstatusindex$arch$dist.deb" |
||||
|
or die "DB_File: $!"; |
||||
|
} |
||||
|
elsif (!$commands->{"dbpath"} && $commands->{"root"}) { |
||||
|
$sing = tie %nsb, 'DB_File', "$parent$base/nstatusindex$arch$dist.deb" |
||||
|
or die "DB_File: $!"; |
||||
|
} |
||||
|
} # end sub nsing |
||||
|
|
||||
|
|
||||
|
# This doesn't depend on DB so it can be placed somewhere else if it is used by more |
||||
|
# than SWIM::Search. |
||||
|
|
||||
|
# checks to see if ramdisk is on, searchdf() & nfile()-process_nfile() |
||||
|
# (used by file()) uses this |
||||
|
sub ram_on { |
||||
|
|
||||
|
my $ramdisk; |
||||
|
|
||||
|
# this monster runs for every argument |
||||
|
my $rambo = "$cat /proc/mounts|"; |
||||
|
open(RAM, "$rambo"); |
||||
|
while (<RAM>) { |
||||
|
if (/ram/) { |
||||
|
my($device,$mount) = split(/\s/,$_,2); |
||||
|
if ($mount =~ /dramdisk/) { |
||||
|
$ramdisk = "yes"; |
||||
|
return $ramdisk; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
close(RAM); |
||||
|
} # end sub ram_on |
||||
|
|
||||
|
|
||||
|
|
||||
|
# finds package name and version |
||||
|
sub version { |
||||
|
|
||||
|
my ($commands) = @_; |
||||
|
my %commands = %$commands; |
||||
|
|
||||
|
if (!$commands{"n"}) { |
||||
|
dbi(\%commands); |
||||
|
} |
||||
|
else { |
||||
|
ndb(\%commands); |
||||
|
} |
||||
|
|
||||
|
if (defined $argument) { |
||||
|
# We will check for more than two..just in case |
||||
|
if ($argument !~ /_/) { |
||||
|
if (defined $db{$argument}) { |
||||
|
$argument = $db{$argument}; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
} # end sub version |
||||
|
# returns version but and then is untied |
||||
|
sub ver { |
||||
|
|
||||
|
my ($commands) = @_; |
||||
|
my %commands = %$commands; |
||||
|
dbi(\%commands); |
||||
|
|
||||
|
if (defined $argument) { |
||||
|
# We will check for more than two..just in case |
||||
|
if ($argument !~ /_/) { |
||||
|
if (defined $db{$argument}) { |
||||
|
$argument = $db{$argument}; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
untie %db; |
||||
|
|
||||
|
} # end sub ver |
||||
|
|
||||
|
sub nver { |
||||
|
|
||||
|
my ($commands) = @_; |
||||
|
my %commands = %$commands; |
||||
|
ndb(\%commands); |
||||
|
|
||||
|
if (defined $argument) { |
||||
|
# We will check for more than two..just in case |
||||
|
if ($argument !~ /_/) { |
||||
|
if (defined $db{$argument}) { |
||||
|
$argument = $db{$argument}; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
untie %db; |
||||
|
|
||||
|
} # end sub nver |
||||
|
|
File diff suppressed because it is too large
@ -0,0 +1,456 @@ |
|||||
|
# Package administration and research tool for Debian |
||||
|
# Copyright (C) 1999-2000 Jonathan D. Rosenbaum |
||||
|
|
||||
|
# This program 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. |
||||
|
|
||||
|
# This program 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 this program; if not, write to the Free Software |
||||
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
||||
|
|
||||
|
|
||||
|
package SWIM::Deps; |
||||
|
use strict; |
||||
|
use SWIM::Global qw(:Info); |
||||
|
use SWIM::DB_Library qw(:Xyz); |
||||
|
use vars qw(@ISA @EXPORT); |
||||
|
@ISA = qw(Exporter); |
||||
|
@EXPORT = qw(character s_character which_character the_character); |
||||
|
|
||||
|
# the -T and siblings |
||||
|
|
||||
|
# process the database for replaces |
||||
|
sub replaces { |
||||
|
my ($commands) = @_; |
||||
|
my %commands = %$commands; |
||||
|
!$commands->{"n"} ? dbi(\%commands) : ndb(\%commands); |
||||
|
if (defined $argument) { |
||||
|
my $conf = $argument . "REP"; |
||||
|
if (defined $db{$conf}) { |
||||
|
return $db{$conf}; |
||||
|
} |
||||
|
else { return ""; } |
||||
|
} |
||||
|
untie %db; |
||||
|
} # end sub replaces |
||||
|
|
||||
|
# process the database for provides |
||||
|
sub provides { |
||||
|
my ($commands) = @_; |
||||
|
my %commands = %$commands; |
||||
|
!$commands->{"n"} ? dbi(\%commands) : ndb(\%commands); |
||||
|
if (defined $argument) { |
||||
|
my $conf = $argument . "PRO"; |
||||
|
if (defined $db{$conf}) { |
||||
|
return $db{$conf}; |
||||
|
} |
||||
|
else { return ""; } |
||||
|
} |
||||
|
untie %db; |
||||
|
} # end sub provides |
||||
|
|
||||
|
# process the database for depends |
||||
|
sub depends { |
||||
|
my ($commands) = @_; |
||||
|
my %commands = %$commands; |
||||
|
!$commands->{"n"} ? dbi(\%commands) : ndb(\%commands); |
||||
|
if (defined $argument) { |
||||
|
my $conf = $argument . "DEP"; |
||||
|
if (defined $db{$conf}) { |
||||
|
return $db{$conf}; |
||||
|
} |
||||
|
else { return ""; } |
||||
|
} |
||||
|
untie %db; |
||||
|
} # end sub depends |
||||
|
|
||||
|
# process the database for replaces |
||||
|
sub pre_depends { |
||||
|
my ($commands) = @_; |
||||
|
my %commands = %$commands; |
||||
|
!$commands->{"n"} ? dbi(\%commands) : ndb(\%commands); |
||||
|
if (defined $argument) { |
||||
|
my $conf = $argument . "PRE"; |
||||
|
if (defined $db{$conf}) { |
||||
|
return $db{$conf}; |
||||
|
} |
||||
|
else { return ""; } |
||||
|
} |
||||
|
untie %db; |
||||
|
} # end sub pre_depends |
||||
|
|
||||
|
# process the database for replaces |
||||
|
sub recommends { |
||||
|
my ($commands) = @_; |
||||
|
my %commands = %$commands; |
||||
|
!$commands->{"n"} ? dbi(\%commands) : ndb(\%commands); |
||||
|
if (defined $argument) { |
||||
|
my $conf = $argument . "REC"; |
||||
|
if (defined $db{$conf}) { |
||||
|
return $db{$conf}; |
||||
|
} |
||||
|
else { return ""; } |
||||
|
} |
||||
|
untie %db; |
||||
|
} # end sub recommends |
||||
|
|
||||
|
# process the database for replaces |
||||
|
sub suggests { |
||||
|
my ($commands) = @_; |
||||
|
my %commands = %$commands; |
||||
|
!$commands->{"n"} ? dbi(\%commands) : ndb(\%commands); |
||||
|
if (defined $argument) { |
||||
|
my $conf = $argument . "SUG"; |
||||
|
if (defined $db{$conf}) { |
||||
|
return $db{$conf}; |
||||
|
} |
||||
|
else { return ""; } |
||||
|
} |
||||
|
untie %db; |
||||
|
} # end sub suggests |
||||
|
|
||||
|
# process the database for replaces |
||||
|
sub conflicts { |
||||
|
my ($commands) = @_; |
||||
|
my %commands = %$commands; |
||||
|
!$commands->{"n"} ? dbi(\%commands) : ndb(\%commands); |
||||
|
if (defined $argument) { |
||||
|
my $conf = $argument . "CON"; |
||||
|
if (defined $db{$conf}) { |
||||
|
return $db{$conf}; |
||||
|
} |
||||
|
else { return ""; } |
||||
|
} |
||||
|
untie %db; |
||||
|
} # end sub conflicts |
||||
|
|
||||
|
#These subroutines are for cases where only packages related to the |
||||
|
# characteristics are printed out. |
||||
|
# process the database for replaces |
||||
|
sub s_replaces { |
||||
|
my ($commands) = @_; |
||||
|
my %commands = %$commands; |
||||
|
!$commands->{"n"} ? dbi(\%commands) : ndb(\%commands); |
||||
|
if (defined $argument) { |
||||
|
my $conf = $argument . "REP"; |
||||
|
if (defined $db{$conf}) { |
||||
|
return "$argument\n$db{$conf}"; |
||||
|
} |
||||
|
else { return ""; } |
||||
|
} |
||||
|
untie %db; |
||||
|
} # end sub s_replaces |
||||
|
|
||||
|
# process the database for provides |
||||
|
sub s_provides { |
||||
|
my ($commands) = @_; |
||||
|
my %commands = %$commands; |
||||
|
!$commands->{"n"} ? dbi(\%commands) : ndb(\%commands); |
||||
|
if (defined $argument) { |
||||
|
my $conf = $argument . "PRO"; |
||||
|
if (defined $db{$conf}) { |
||||
|
return "$argument\n$db{$conf}"; |
||||
|
} |
||||
|
else { return ""; } |
||||
|
} |
||||
|
untie %db; |
||||
|
} # end sub s_provides |
||||
|
|
||||
|
# process the database for depends |
||||
|
sub s_depends { |
||||
|
my ($commands) = @_; |
||||
|
my %commands = %$commands; |
||||
|
!$commands->{"n"} ? dbi(\%commands) : ndb(\%commands); |
||||
|
if (defined $argument) { |
||||
|
my $conf = $argument . "DEP"; |
||||
|
if (defined $db{$conf}) { |
||||
|
return "$argument\n$db{$conf}"; |
||||
|
} |
||||
|
else { return ""; } |
||||
|
} |
||||
|
untie %db; |
||||
|
} # end sub s_depends |
||||
|
|
||||
|
# process the database for replaces |
||||
|
sub s_pre_depends { |
||||
|
my ($commands) = @_; |
||||
|
my %commands = %$commands; |
||||
|
!$commands->{"n"} ? dbi(\%commands) : ndb(\%commands); |
||||
|
if (defined $argument) { |
||||
|
my $conf = $argument . "PRE"; |
||||
|
if (defined $db{$conf}) { |
||||
|
return "$argument\n$db{$conf}"; |
||||
|
} |
||||
|
else { return ""; } |
||||
|
} |
||||
|
untie %db; |
||||
|
} # end sub s_pre_depends |
||||
|
|
||||
|
# process the database for replaces |
||||
|
sub s_recommends { |
||||
|
my ($commands) = @_; |
||||
|
my %commands = %$commands; |
||||
|
!$commands->{"n"} ? dbi(\%commands) : ndb(\%commands); |
||||
|
if (defined $argument) { |
||||
|
my $conf = $argument . "REC"; |
||||
|
if (defined $db{$conf}) { |
||||
|
return "$argument\n$db{$conf}"; |
||||
|
} |
||||
|
else { return ""; } |
||||
|
} |
||||
|
untie %db; |
||||
|
} # end sub s_recommends |
||||
|
|
||||
|
# process the database for replaces |
||||
|
sub s_suggests { |
||||
|
my ($commands) = @_; |
||||
|
my %commands = %$commands; |
||||
|
!$commands->{"n"} ? dbi(\%commands) : ndb(\%commands); |
||||
|
if (defined $argument) { |
||||
|
my $conf = $argument . "SUG"; |
||||
|
if (defined $db{$conf}) { |
||||
|
return "$argument\n$db{$conf}"; |
||||
|
} |
||||
|
else { return ""; } |
||||
|
} |
||||
|
untie %db; |
||||
|
} # end sub s_suggests |
||||
|
|
||||
|
# process the database for replaces |
||||
|
sub s_conflicts { |
||||
|
my ($commands) = @_; |
||||
|
my %commands = %$commands; |
||||
|
!$commands->{"n"} ? dbi(\%commands) : ndb(\%commands); |
||||
|
if (defined $argument) { |
||||
|
my $conf = $argument . "CON"; |
||||
|
if (defined $db{$conf}) { |
||||
|
return "$argument\n$db{$conf}"; |
||||
|
} |
||||
|
else { return ""; } |
||||
|
} |
||||
|
untie %db; |
||||
|
} # end sub s_conflicts |
||||
|
|
||||
|
|
||||
|
# This figures out which characteristics (Replaces, Provides, etc) the |
||||
|
# options are pointing to. Isn't choosey, prints all packages |
||||
|
sub character { |
||||
|
|
||||
|
my ($commands) = @_; |
||||
|
my %commands = %$commands; |
||||
|
|
||||
|
# for singular cases |
||||
|
if ($commands->{"g"} && ($commands->{"T"} || $commands->{"pre_depends"} || |
||||
|
$commands->{"depends"} || $commands->{"recommends"} || |
||||
|
$commands->{"suggests"} || $commands->{"provides"} || |
||||
|
$commands->{"replaces"} || $commands->{"conflicts"}) && |
||||
|
!($commands->{"c"} || $commands->{"d"} || $commands->{"l"} || |
||||
|
$commands->{"i"})) { |
||||
|
print "$argument\n"; |
||||
|
} |
||||
|
|
||||
|
# all the characteristics |
||||
|
if (defined $commands->{"T"}) { |
||||
|
print pre_depends(\%commands); |
||||
|
print depends(\%commands); |
||||
|
print recommends(\%commands); |
||||
|
print suggests(\%commands); |
||||
|
print provides(\%commands); |
||||
|
print replaces(\%commands); |
||||
|
print conflicts(\%commands); |
||||
|
} |
||||
|
else { |
||||
|
|
||||
|
if (defined $commands->{"pre_depends"}) { |
||||
|
print pre_depends(\%commands); |
||||
|
delete $commands{"pre_depends"} if !($commands->{"S"} || $commands->{"g"}); |
||||
|
} |
||||
|
|
||||
|
if (defined $commands->{"depends"}) { |
||||
|
print depends(\%commands); |
||||
|
delete $commands{"depends"} if !($commands->{"S"} || $commands->{"g"}); |
||||
|
} |
||||
|
|
||||
|
if (defined $commands->{"recommends"}) { |
||||
|
print recommends(\%commands); |
||||
|
delete $commands{"recommends"} if !($commands->{"S"} || $commands->{"g"}); |
||||
|
} |
||||
|
|
||||
|
if (defined $commands->{"suggests"}) { |
||||
|
print suggests(\%commands); |
||||
|
delete $commands{"suggests"} if !($commands->{"S"} || $commands->{"g"}); |
||||
|
} |
||||
|
|
||||
|
if (defined $commands->{"replaces"}) { |
||||
|
print replaces(\%commands); |
||||
|
delete $commands{"replaces"} if !($commands->{"S"} || $commands->{"g"}); |
||||
|
} |
||||
|
|
||||
|
if (defined $commands->{"provides"}) { |
||||
|
print provides(\%commands); |
||||
|
delete $commands{"provides"} if !($commands->{"S"} || $commands->{"g"}); |
||||
|
} |
||||
|
|
||||
|
if (defined $commands->{"conflicts"}) { |
||||
|
print conflicts(\%commands); |
||||
|
delete $commands{"conflicts"} if !($commands->{"S"} || $commands->{"g"}); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
} # end sub character |
||||
|
|
||||
|
# Prints out the characteristics only for the packages which have them. |
||||
|
sub s_character { |
||||
|
|
||||
|
my ($commands) = @_; |
||||
|
my %commands = %$commands; |
||||
|
|
||||
|
if ($commands->{"pre_depends"}) { |
||||
|
print s_pre_depends(\%commands); |
||||
|
delete $commands{"pre_depends"}; |
||||
|
if (s_pre_depends(\%commands) ne "") { |
||||
|
character(\%commands); |
||||
|
} |
||||
|
# else { s_character(\%commands) } |
||||
|
} |
||||
|
elsif ($commands->{"depends"}) { |
||||
|
print s_depends(\%commands); |
||||
|
delete $commands{"depends"}; |
||||
|
if (s_depends(\%commands) ne "") { |
||||
|
character(\%commands); |
||||
|
} |
||||
|
# else { s_character(\%commands) } |
||||
|
} |
||||
|
elsif ($commands->{"recommends"}) { |
||||
|
print s_recommends(\%commands); |
||||
|
delete $commands{"recommends"}; |
||||
|
if (s_recommends(\%commands) ne "") { |
||||
|
character(\%commands); |
||||
|
} |
||||
|
# else { s_character(\%commands) } |
||||
|
} |
||||
|
elsif ($commands->{"suggests"}) { |
||||
|
print s_suggests(\%commands); |
||||
|
delete $commands{"suggests"}; |
||||
|
if (s_suggests(\%commands) ne "") { |
||||
|
character(\%commands); |
||||
|
} |
||||
|
# else { s_character(\%commands) } |
||||
|
} |
||||
|
elsif ($commands->{"replaces"}) { |
||||
|
print s_replaces(\%commands); |
||||
|
delete $commands{"replaces"}; |
||||
|
if (s_replaces(\%commands) ne "") { |
||||
|
character(\%commands); |
||||
|
} |
||||
|
# else { s_character(\%commands) } |
||||
|
} |
||||
|
elsif ($commands->{"provides"}) { |
||||
|
print s_provides(\%commands); |
||||
|
delete $commands{"provides"}; |
||||
|
if (s_provides(\%commands) ne "") { |
||||
|
character(\%commands); |
||||
|
} |
||||
|
# else { s_character(\%commands) } |
||||
|
} |
||||
|
elsif ($commands->{"conflicts"}) { |
||||
|
print s_conflicts(\%commands); |
||||
|
delete $commands{"conflicts"}; |
||||
|
if (s_conflicts(\%commands) ne "") { |
||||
|
character(\%commands); |
||||
|
} |
||||
|
# else { s_character(\%commands) } |
||||
|
} |
||||
|
|
||||
|
# all the characteristics |
||||
|
if ($commands->{"T"}) { |
||||
|
print s_pre_depends(\%commands); |
||||
|
print s_depends(\%commands); |
||||
|
print s_recommends(\%commands); |
||||
|
print s_suggests(\%commands); |
||||
|
print s_provides(\%commands); |
||||
|
print s_replaces(\%commands); |
||||
|
print s_conflicts(\%commands); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
} # end sub s_character |
||||
|
|
||||
|
|
||||
|
# helps to determine if character(\%commands) should be used |
||||
|
sub which_character { |
||||
|
my ($commands) = @_; |
||||
|
if ($commands->{"pre_depends"} || $commands->{"depends"} || |
||||
|
$commands->{"recommends"} || $commands->{"suggests"} || |
||||
|
$commands->{"replaces"} || $commands->{"provides"} || |
||||
|
$commands->{"conflicts"}) { |
||||
|
return 1; |
||||
|
} |
||||
|
} # end sub which_character |
||||
|
|
||||
|
# This runs a test to see whether or not the characters being asked for |
||||
|
# apply to this package. |
||||
|
sub the_character { |
||||
|
|
||||
|
my ($commands) = @_; |
||||
|
my %commands = %$commands; |
||||
|
|
||||
|
if (defined $commands->{"pre_depends"}) { |
||||
|
if (pre_depends(\%commands) eq "") { |
||||
|
print ""; |
||||
|
} |
||||
|
else { return "ok"; } |
||||
|
} |
||||
|
|
||||
|
if (defined $commands->{"depends"}) { |
||||
|
if (depends(\%commands) eq "") { |
||||
|
print ""; |
||||
|
} |
||||
|
else { return "ok"; } |
||||
|
} |
||||
|
|
||||
|
if (defined $commands->{"recommends"}) { |
||||
|
if (recommends(\%commands) eq "") { |
||||
|
print ""; |
||||
|
} |
||||
|
else { return "ok"; } |
||||
|
} |
||||
|
|
||||
|
if (defined $commands->{"suggests"}) { |
||||
|
if (suggests(\%commands) eq "") { |
||||
|
print ""; |
||||
|
} |
||||
|
else { return "ok"; } |
||||
|
} |
||||
|
|
||||
|
if (defined $commands->{"replaces"}) { |
||||
|
if (replaces(\%commands) eq "") { |
||||
|
print ""; |
||||
|
} |
||||
|
else { return "ok"; } |
||||
|
} |
||||
|
|
||||
|
if (defined $commands->{"provides"}) { |
||||
|
if (provides(\%commands) eq "") { |
||||
|
print ""; |
||||
|
} |
||||
|
else { return "ok"; } |
||||
|
} |
||||
|
|
||||
|
if (defined $commands->{"conflicts"}) { |
||||
|
if (conflicts(\%commands) eq "") { |
||||
|
print ""; |
||||
|
} |
||||
|
else { return "ok"; } |
||||
|
} |
||||
|
|
||||
|
} # end sub the_character |
||||
|
|
||||
|
1; |
@ -0,0 +1,110 @@ |
|||||
|
# Package administration and research tool for Debian |
||||
|
# Copyright (C) 1999-2000 Jonathan D. Rosenbaum |
||||
|
|
||||
|
# This program 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. |
||||
|
|
||||
|
# This program 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 this program; if not, write to the Free Software |
||||
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
||||
|
|
||||
|
|
||||
|
package SWIM::Dir; |
||||
|
use strict; |
||||
|
use SWIM::Global qw($argument); |
||||
|
use SWIM::Conf qw($pwd); |
||||
|
use vars qw(@ISA @EXPORT @EXPORT_OK); |
||||
|
use Exporter; |
||||
|
@ISA = qw(Exporter); |
||||
|
@EXPORT = qw(dir fir); |
||||
|
|
||||
|
# dir() fir() |
||||
|
|
||||
|
# When --dir is used checks argument (when -f is called) and determines dir |
||||
|
# stuff..is it real or not. |
||||
|
sub dir { |
||||
|
|
||||
|
my ($commands) = @_; |
||||
|
|
||||
|
if ($commands->{"dir"}) { |
||||
|
if (! -d $argument) { |
||||
|
if (! -e $argument) { |
||||
|
print "$argument is not a directory or file\n"; |
||||
|
} |
||||
|
else { |
||||
|
print "$argument is not a directory\n"; |
||||
|
} |
||||
|
exit; |
||||
|
} |
||||
|
elsif ($argument =~ m,\/$,) { |
||||
|
if ($argument !~ m,^\/,) { |
||||
|
if ($pwd =~ m,^\/$,) { |
||||
|
$argument =~ m,(.*)\/$,; |
||||
|
$argument = "$pwd$1"; |
||||
|
} |
||||
|
else { |
||||
|
$argument =~ m,(.*)\/$,; |
||||
|
$argument = "$pwd/$1"; |
||||
|
} |
||||
|
} |
||||
|
else { |
||||
|
$argument =~ m,(.*)\/$,; |
||||
|
$argument = $1; |
||||
|
} |
||||
|
} |
||||
|
elsif ($argument !~ m,\/$|^\/, && $argument =~ m,\/,) { |
||||
|
if ($pwd =~ m,^\/$,) { |
||||
|
$argument = "/$argument"; |
||||
|
} |
||||
|
else { |
||||
|
$argument = "$pwd/$argument"; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} # end sub dir |
||||
|
|
||||
|
# when --dir isn't called...does the same thing as dir. |
||||
|
sub fir { |
||||
|
|
||||
|
my ($commands) = @_; |
||||
|
|
||||
|
if ($argument =~ m,\/$,) { |
||||
|
# Let's test to see whether it really is a file or directory. |
||||
|
if (! -d $argument) { |
||||
|
print "$argument is not a file\n"; |
||||
|
exit; |
||||
|
} |
||||
|
if ($argument !~ m,^\/,) { |
||||
|
if ($pwd =~ m,^\/$,) { |
||||
|
$argument =~ m,(.*)\/$,; |
||||
|
$argument = "$pwd$1"; |
||||
|
} |
||||
|
else { |
||||
|
$argument =~ m,(.*)\/$,; |
||||
|
$argument = "$pwd/$1"; |
||||
|
} |
||||
|
} |
||||
|
else { |
||||
|
$argument =~ m,(.*)\/$,; |
||||
|
$argument = $1; |
||||
|
} |
||||
|
} |
||||
|
elsif ($argument !~ m,\/$|^\/, && $argument =~ m,\/,) { |
||||
|
if ($pwd =~ m,^\/$,) { |
||||
|
$argument = "/$argument"; |
||||
|
} |
||||
|
else { |
||||
|
$argument = "$pwd/$argument"; |
||||
|
} |
||||
|
} |
||||
|
} # end sub fir |
||||
|
|
||||
|
1; |
||||
|
|
@ -0,0 +1,92 @@ |
|||||
|
# Package administration and research tool for Debian |
||||
|
# Copyright (C) 1999-2000 Jonathan D. Rosenbaum |
||||
|
|
||||
|
# This program 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. |
||||
|
|
||||
|
# This program 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 this program; if not, write to the Free Software |
||||
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
||||
|
|
||||
|
|
||||
|
package SWIM::F; |
||||
|
use Carp; |
||||
|
use strict; |
||||
|
use vars qw(@ISA @EXPORT); |
||||
|
use Exporter; |
||||
|
@ISA = qw(Exporter); |
||||
|
@EXPORT = qw(get); |
||||
|
|
||||
|
|
||||
|
# This is Net::FTP::get with minor modifications. Not all the features |
||||
|
# are used, but are kept, just in case they will be. |
||||
|
|
||||
|
sub get |
||||
|
{ |
||||
|
my($ftp,$remote,$local,$where) = @_; |
||||
|
|
||||
|
my($loc,$len,$buf,$resp,$localfd,$data); |
||||
|
local *FD; |
||||
|
$| = 1; |
||||
|
$localfd = ref($local) ? fileno($local) |
||||
|
: undef; |
||||
|
|
||||
|
($local = $remote) =~ s#^.*/## |
||||
|
unless(defined $local); |
||||
|
|
||||
|
${*$ftp}{'net_ftp_rest'} = $where |
||||
|
if ($where); |
||||
|
|
||||
|
delete ${*$ftp}{'net_ftp_port'}; |
||||
|
delete ${*$ftp}{'net_ftp_pasv'}; |
||||
|
|
||||
|
$data = $ftp->retr($remote) or |
||||
|
return undef; |
||||
|
|
||||
|
if(defined $localfd) |
||||
|
{ |
||||
|
$loc = $local; |
||||
|
} |
||||
|
else |
||||
|
{ |
||||
|
$loc = \*FD; |
||||
|
|
||||
|
unless(($where) ? open($loc,">>$local") : open($loc,">$local")) |
||||
|
{ |
||||
|
carp "Cannot open Local file $local: $!\n"; |
||||
|
$data->abort; |
||||
|
return undef; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
if($ftp->type eq 'I' && !binmode($loc)) |
||||
|
{ |
||||
|
carp "Cannot binmode Local file $local: $!\n"; |
||||
|
$data->abort; |
||||
|
return undef; |
||||
|
} |
||||
|
|
||||
|
$buf = ''; my $amt = 0; |
||||
|
#print "\n"; |
||||
|
do |
||||
|
{ |
||||
|
$len = $data->read($buf,1024); |
||||
|
$amt = $len + $amt; |
||||
|
print "[$amt]\r"; |
||||
|
} |
||||
|
while($len > 0 && syswrite($loc,$buf,$len) == $len); |
||||
|
|
||||
|
close($loc) |
||||
|
unless defined $localfd; |
||||
|
|
||||
|
$data->close(); # implied $ftp->response |
||||
|
|
||||
|
return $local; |
||||
|
} |
@ -0,0 +1,877 @@ |
|||||
|
# Package administration and research tool for Debian |
||||
|
# Copyright (C) 1999-2000 Jonathan D. Rosenbaum |
||||
|
|
||||
|
# This program 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. |
||||
|
|
||||
|
# This program 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 this program; if not, write to the Free Software |
||||
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
||||
|
|
||||
|
|
||||
|
package SWIM::File; |
||||
|
use strict; |
||||
|
use SWIM::Global; |
||||
|
use SWIM::DB_Library qw(:Xyz ram_on nsb); |
||||
|
use SWIM::Library; |
||||
|
use SWIM::Conf qw(:Path $md5sum); |
||||
|
use vars qw(@ISA @EXPORT); |
||||
|
use Exporter; |
||||
|
@ISA = qw(Exporter); |
||||
|
@EXPORT = qw(file); |
||||
|
|
||||
|
|
||||
|
#=pod |
||||
|
# |
||||
|
#This provides the list of files belonging to a package. Although a |
||||
|
#database could be used..it's probably faster, and cheaper on space |
||||
|
#accessing from the /var/lib/dpkg/info* files. And if --md5sum is |
||||
|
#called, the md5sums are shown for the -d ,-l, or -c files they exist for. |
||||
|
#md5sums are checked for, and reported back as OK or FAILED. -l or |
||||
|
#-d(overrides l). -qd(l) md5sum from RH has a slightly different |
||||
|
#output.. filepath/filename: file OK before swim's output..this can be |
||||
|
#altered |
||||
|
# |
||||
|
#=end |
||||
|
|
||||
|
sub file { |
||||
|
|
||||
|
|
||||
|
my ($commands) = @_; |
||||
|
my %commands = %$commands; |
||||
|
|
||||
|
my $file; |
||||
|
my $md5; |
||||
|
my @md5; |
||||
|
my $path; |
||||
|
my @path; |
||||
|
my $md5sums; |
||||
|
my $md5sums_conf; |
||||
|
my %md5sums = (); |
||||
|
my $orig_argument; |
||||
|
my $count = 0; |
||||
|
|
||||
|
|
||||
|
if (!$commands->{"n"}) { |
||||
|
dbi(\%commands); |
||||
|
} |
||||
|
# files/dirs will be found from contents.deb (compressed) |
||||
|
else { |
||||
|
ndb(\%commands); |
||||
|
} |
||||
|
|
||||
|
if (defined $argument) { |
||||
|
if ($argument =~ /_/) { |
||||
|
my $check; |
||||
|
if (defined $db{"$argument"}) { |
||||
|
$check = $db{"$argument"}; |
||||
|
} |
||||
|
$argument =~ m,(^.*)_(.*$),; |
||||
|
if (defined $check) { |
||||
|
$argument = $1; |
||||
|
} |
||||
|
else {} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
if (defined $argument) { |
||||
|
if (!$commands->{"n"}) { |
||||
|
$file = "$parent$base/info/$argument.list"; |
||||
|
if (-e "$parent$base/info/$argument.md5sums") { |
||||
|
$md5sums = "$parent$base/info/$argument.md5sums"; |
||||
|
} |
||||
|
if (-e "$parent$base/info/$argument-conf.md5sums" && $commands->{"c"}) { |
||||
|
$md5sums_conf = "$parent$base/info/$argument-conf.md5sums"; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
################## |
||||
|
# MD5SUMS FOR -C # |
||||
|
################## |
||||
|
if ($commands->{"md5sum"} && $commands->{"c"} && !($commands->{"d"} || |
||||
|
$commands->{"l"})) { |
||||
|
if (!defined $md5sums_conf && $commands->{"c"}) { |
||||
|
$md5sums_conf = make_conf(\%commands); |
||||
|
} |
||||
|
# now we can process $md5sums and $md5sums_conf assuming one or |
||||
|
# both actually exist |
||||
|
if (defined $md5sums_conf) { |
||||
|
chdir("/"); |
||||
|
my %path; |
||||
|
open (MD5SUM, "$md5sums_conf"); |
||||
|
open (MD5SUMCHECK, "|$md5sum -c 2>$tmp/md5sumcheck"); |
||||
|
while (<MD5SUM>) { |
||||
|
if ($_ =~ /newconffile/) { |
||||
|
$path = substr($_, 13); |
||||
|
push(@path,$path); |
||||
|
$md5 = substr($_, 0, 11); |
||||
|
push(@md5,$md5); |
||||
|
chomp $path; |
||||
|
chomp $md5; |
||||
|
$path{"$path"} = $md5; |
||||
|
print MD5SUMCHECK $_; |
||||
|
next; |
||||
|
} |
||||
|
$path = substr($_, 34); |
||||
|
push(@path,$path); |
||||
|
$md5 = substr($_, 0, 32); |
||||
|
push(@md5,$md5); |
||||
|
chomp $path; |
||||
|
chomp $md5; |
||||
|
$path{"$path"} = $md5; |
||||
|
print MD5SUMCHECK $_; |
||||
|
} |
||||
|
close(MD5SUMCHECK); |
||||
|
close(MD5SUM); |
||||
|
#now check with md5sum from the dpkg package |
||||
|
my $check_md5sum; |
||||
|
# won't bother going into this while unless there is a reason |
||||
|
if (defined "$tmp/md5sumcheck" && $md5 ne "newconffile") { |
||||
|
open(MD5SUMFILE, "$tmp/md5sumcheck"); |
||||
|
while (<MD5SUMFILE>) { |
||||
|
if ($_ !~ /no files checked/) { |
||||
|
if (/failed/) { |
||||
|
# Humm may be two situations watch or due to coding change |
||||
|
#$check_md5sum = substr($_,39); |
||||
|
$check_md5sum = substr($_,30); |
||||
|
$check_md5sum =~ s/'//; |
||||
|
chomp $check_md5sum; |
||||
|
$md5sums{"$check_md5sum"} = "FAILED"; |
||||
|
} |
||||
|
elsif (/can't open/) { |
||||
|
# Humm may be two situations watch or due to coding change |
||||
|
#$check_md5sum = substr($_,28); |
||||
|
$check_md5sum = substr($_,19); |
||||
|
chomp $check_md5sum; |
||||
|
$md5sums{"$check_md5sum"} = "MISSING"; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
close(MD5SUMCHECK); |
||||
|
unlink("$tmp/md5sumcheck"); |
||||
|
# This finishes everything |
||||
|
open (LIST,"$md5sums_conf"); |
||||
|
while (<LIST>) { |
||||
|
if ($_ =~ /newconffile/) { |
||||
|
$_ = substr($_, 13); |
||||
|
chomp; |
||||
|
} |
||||
|
else { |
||||
|
$_ = substr($_, 34); |
||||
|
chomp; |
||||
|
} |
||||
|
if (defined $path{$_}) { |
||||
|
# humm file_now() not necessary here |
||||
|
if (defined $md5sums{$_}) { |
||||
|
print " /$_ $path{$_} $md5sums{$_}\n"; |
||||
|
} |
||||
|
elsif ($path{$_} ne "newconffile") { |
||||
|
print " /$_ $path{$_} OK"; |
||||
|
print "\n"; |
||||
|
} |
||||
|
else { |
||||
|
print " /$_ $path{$_}\n"; |
||||
|
} |
||||
|
} |
||||
|
} # last while |
||||
|
close(LIST); |
||||
|
%md5sums = (); |
||||
|
%path = (); |
||||
|
@path = (); |
||||
|
@md5 = (); |
||||
|
} # do the md5sum files even exist? |
||||
|
} |
||||
|
|
||||
|
######################## |
||||
|
# MD5SUMS FOR -C &| -L # |
||||
|
######################## |
||||
|
# checking for -e $md5sums is a questionable practice because it |
||||
|
# may not exist, but the conf files do. |
||||
|
if ($commands->{"md5sum"} && !$commands->{"d"} && |
||||
|
(($commands->{"l"} && $commands->{"c"}) || $commands->{"l"})) { |
||||
|
# I decided on three while loops, because it was the most practical |
||||
|
# way to handle STDERR from md5sum, and all types of |
||||
|
# experimentation didn't yield a better way of doing it, but there |
||||
|
# is probably a better way. |
||||
|
# first do things normally, and no chomping |
||||
|
# but, first grab conf info. |
||||
|
if (!defined $md5sums_conf && $commands->{"c"}) { |
||||
|
$md5sums_conf = make_conf(\%commands); |
||||
|
} |
||||
|
# now we can process $md5sums and $md5sums_conf assuming one or |
||||
|
# both actually exist |
||||
|
if (defined $md5sums || defined $md5sums_conf) { |
||||
|
#if ($md5sums_conf ne 1) { |
||||
|
chdir("/"); |
||||
|
my %path; |
||||
|
if ($commands->{"c"} && $md5sums_conf) { |
||||
|
open (MD5SUM,"$md5sums_conf"); |
||||
|
} |
||||
|
else { |
||||
|
open (MD5SUM,"$md5sums"); |
||||
|
$count = 1; |
||||
|
} |
||||
|
while ($count <= 1) { |
||||
|
if (($count == 1 && defined $md5sums) || $count == 0) { |
||||
|
open (MD5SUMCHECK, "|$md5sum -c 2>$tmp/md5sumcheck"); |
||||
|
while (<MD5SUM>) { |
||||
|
if ($_ =~ /newconffile/) { |
||||
|
$path = substr($_, 13); |
||||
|
push(@path,$path); |
||||
|
$md5 = substr($_, 0, 11); |
||||
|
push(@md5,$md5); |
||||
|
chomp $path; |
||||
|
chomp $md5; |
||||
|
$path{"/$path"} = $md5; |
||||
|
print MD5SUMCHECK $_; |
||||
|
next; |
||||
|
} |
||||
|
$path = substr($_, 34); |
||||
|
push(@path,$path); |
||||
|
$md5 = substr($_, 0, 32); |
||||
|
push(@md5,$md5); |
||||
|
chomp $path; |
||||
|
chomp $md5; |
||||
|
$path{"/$path"} = $md5; |
||||
|
print MD5SUMCHECK $_; |
||||
|
} |
||||
|
close(MD5SUMCHECK); |
||||
|
close(MD5SUM); |
||||
|
#now check with md5sum from the dpkg package |
||||
|
my $check_md5sum; |
||||
|
#my $count = 0; |
||||
|
# won't bother going into this while unless there is a reason |
||||
|
if (defined "$tmp/md5sumcheck" && $md5 ne "newconffile") { |
||||
|
open(MD5SUMFILE, "$tmp/md5sumcheck"); |
||||
|
while (<MD5SUMFILE>) { |
||||
|
if ($_ !~ /no files checked/) { |
||||
|
if (/failed/) { |
||||
|
$check_md5sum = substr($_,30); |
||||
|
$check_md5sum =~ s/'//; |
||||
|
chomp $check_md5sum; |
||||
|
$md5sums{"/$check_md5sum"} = "FAILED"; |
||||
|
} |
||||
|
elsif (/can't open/) { |
||||
|
$check_md5sum = substr($_,19); |
||||
|
#$check_md5sum =~ s/'//; |
||||
|
chomp $check_md5sum; |
||||
|
$md5sums{"/$check_md5sum"} = "MISSING"; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
close(MD5SUMCHECK); |
||||
|
unlink("$tmp/md5sumcheck"); |
||||
|
} |
||||
|
# This finishes everything |
||||
|
# This prunes stuff out and assumes that *.list and *.md5sums |
||||
|
# overlap. |
||||
|
open (LIST,"$file"); |
||||
|
###### |
||||
|
# -L # |
||||
|
###### |
||||
|
if ($commands->{"l"} && !$commands->{"df"}) { |
||||
|
while (<LIST>) { |
||||
|
chomp; |
||||
|
if (!-d $_ && $argument ne "base-files") { |
||||
|
my $line = $_; |
||||
|
file_now(\%commands); |
||||
|
md5_print(\%path,\%md5sums,$line,$count); |
||||
|
} |
||||
|
############## |
||||
|
# BASE-FILES # |
||||
|
############## |
||||
|
elsif ($argument eq "base-files") { |
||||
|
my $line = $_; |
||||
|
md5_print(\%path,\%md5sums,$line,$count); |
||||
|
} |
||||
|
} # last while |
||||
|
} |
||||
|
############# |
||||
|
# -L & --DF # |
||||
|
############# |
||||
|
elsif ($commands->{"l"} && $commands->{"df"}) { |
||||
|
while (<LIST>) { |
||||
|
chomp; |
||||
|
my $line = $_; |
||||
|
file_now(\%commands); |
||||
|
md5_print(\%path,\%md5sums,$line,$count); |
||||
|
} # last while |
||||
|
} |
||||
|
close(LIST); |
||||
|
%md5sums = (); |
||||
|
%path = (); |
||||
|
@path = (); |
||||
|
@md5 = (); |
||||
|
$count++; |
||||
|
if ($count == 1) { |
||||
|
open (MD5SUM,"$md5sums") if $md5sums; |
||||
|
} |
||||
|
} # loop through -c or not |
||||
|
} # do the md5sum files even exist? |
||||
|
#} |
||||
|
} |
||||
|
#@@ got to watch this for -l's called directly, will allow -l to |
||||
|
# be seen whether or not --md5sum is used, changed elsif to if. |
||||
|
# if already found above don't use below here. |
||||
|
# && ||'s tricky here |
||||
|
if (-e $file && !$commands->{"d"} && (!defined $md5sums && |
||||
|
!defined $md5sums_conf) || -e $file && |
||||
|
(!$commands->{"md5sum"} && !$commands->{"d"})) { |
||||
|
file_now(\%commands) if !$commands->{"f"}; |
||||
|
open (LIST,"$file"); |
||||
|
while (<LIST>) { |
||||
|
chomp; |
||||
|
if ($commands->{"l"} && !$commands->{"df"}) { |
||||
|
if (!-d $_ && $argument ne "base-files") { |
||||
|
print "$_\n"; |
||||
|
} |
||||
|
elsif ($argument eq "base-files") { |
||||
|
print "$_\n"; |
||||
|
} |
||||
|
} |
||||
|
elsif ($commands->{"l"} && $commands->{"df"}) { |
||||
|
if ($argument ne "base-files") { |
||||
|
print "$_\n"; |
||||
|
} |
||||
|
elsif ($argument eq "base-files") { |
||||
|
print "$_\n"; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
######################## |
||||
|
# MD5SUMS FOR -C &| -D # |
||||
|
######################## |
||||
|
# for Documentation. |
||||
|
elsif ($commands->{"md5sum"} && ($commands->{"d"} || ($commands->{"d"} && |
||||
|
$commands->{"c"}))) { |
||||
|
if (!defined $md5sums_conf && $commands->{"c"}) { |
||||
|
$md5sums_conf = make_conf(\%commands); |
||||
|
} |
||||
|
# now we can process $md5sums and $md5sums_conf assuming one or |
||||
|
# both actually exist |
||||
|
if (defined $md5sums || defined $md5sums_conf) { |
||||
|
chdir("/"); |
||||
|
my %path; |
||||
|
if ($commands->{"c"} && $md5sums_conf) { |
||||
|
open (MD5SUM,"$md5sums_conf"); |
||||
|
} |
||||
|
else { |
||||
|
open (MD5SUM,"$md5sums"); |
||||
|
$count = 1; |
||||
|
} |
||||
|
while ($count <= 1) { |
||||
|
if (($count == 1 && defined $md5sums) || $count == 0) { |
||||
|
open (MD5SUMCHECK, "|$md5sum -c 2>$tmp/md5sumcheck"); |
||||
|
while (<MD5SUM>) { |
||||
|
if ($_ =~ /newconffile/) { |
||||
|
$path = substr($_, 13); |
||||
|
push(@path,$path); |
||||
|
$md5 = substr($_, 0, 11); |
||||
|
push(@md5,$md5); |
||||
|
chomp $path; |
||||
|
chomp $md5; |
||||
|
$path{"/$path"} = $md5; |
||||
|
print MD5SUMCHECK $_; |
||||
|
next; |
||||
|
} |
||||
|
$path = substr($_, 34); |
||||
|
push(@path,$path); |
||||
|
$md5 = substr($_, 0, 32); |
||||
|
push(@md5,$md5); |
||||
|
chomp $path; |
||||
|
chomp $md5; |
||||
|
$path{"/$path"} = $md5; |
||||
|
print MD5SUMCHECK $_; |
||||
|
} |
||||
|
close(MD5SUMCHECK); |
||||
|
close(MD5SUM); |
||||
|
#now check with md5sum from the dpkg package |
||||
|
my $check_md5sum; |
||||
|
# won't bother going into this while unless there is a reason |
||||
|
if (defined "$tmp/md5sumcheck") { |
||||
|
open(MD5SUMFILE, "$tmp/md5sumcheck"); |
||||
|
while (<MD5SUMFILE>) { |
||||
|
if ($_ !~ /no files checked/) { |
||||
|
if (/failed/) { |
||||
|
$check_md5sum = substr($_,30); |
||||
|
$check_md5sum =~ s/'//; |
||||
|
chomp $check_md5sum; |
||||
|
$md5sums{"/$check_md5sum"} = "FAILED"; |
||||
|
} |
||||
|
elsif (/can't open/) { |
||||
|
$check_md5sum = substr($_,19); |
||||
|
chomp $check_md5sum; |
||||
|
$md5sums{"/$check_md5sum"} = "MISSING"; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
close(MD5SUMCHECK); |
||||
|
unlink("$tmp/md5sumcheck"); |
||||
|
} |
||||
|
# This finishes everything |
||||
|
open (LIST,"$file"); |
||||
|
while (<LIST>) { |
||||
|
chomp; |
||||
|
# humm, checking for existence? |
||||
|
#if (-e $_ && $argument ne "base-files") { |
||||
|
if ($argument ne "base-files") { |
||||
|
#@@ |
||||
|
###### |
||||
|
# -D # |
||||
|
###### |
||||
|
if (defined $path{$_}) { |
||||
|
if (defined $md5sums{$_}) { |
||||
|
if ($count == 0) { |
||||
|
print " $_ $path{$_} $md5sums{$_}" if $count == 0; |
||||
|
print "$_ $path{$_} $md5sums{$_}" if $count == 1; |
||||
|
print "\n"; |
||||
|
} |
||||
|
elsif (m,/usr/doc/|/usr/share/doc/|/man[\d]/|/usr/info/|/usr/share/info/, && |
||||
|
$count == 1) { |
||||
|
print " $_ $path{$_} $md5sums{$_}" if $count == 0; |
||||
|
print "$_ $path{$_} $md5sums{$_}" if $count == 1; |
||||
|
print "\n"; |
||||
|
} |
||||
|
} |
||||
|
elsif ($path{$_} ne "newconffile") { |
||||
|
if ($count == 0) { |
||||
|
print " $_ $path{$_} OK" if $count == 0; |
||||
|
print "$_ $path{$_} OK" if $count == 1; |
||||
|
print "\n"; |
||||
|
} |
||||
|
elsif (m,/usr/doc/|/usr/share/doc/|/man[\d]/|/usr/info/|/usr/share/info/, && |
||||
|
$count == 1) { |
||||
|
print " $_ $path{$_} OK" if $count == 0; |
||||
|
print "$_ $path{$_} OK" if $count == 1; |
||||
|
print "\n"; |
||||
|
} |
||||
|
} |
||||
|
else { |
||||
|
if ($count == 0) { |
||||
|
print " $_ $path{$_}\n" if $count == 0; |
||||
|
print "$_ $path{$_}\n" if $count == 1; |
||||
|
print "\n"; |
||||
|
} |
||||
|
elsif (m,/usr/doc/|/usr/share/doc/|/man[\d]/|/usr/info/|/usr/share/info/, && |
||||
|
$count == 1) { |
||||
|
print " $_ $path{$_} OK" if $count == 0; |
||||
|
print "$_ $path{$_} OK" if $count == 1; |
||||
|
print "\n"; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
elsif ($count == 1) { |
||||
|
if (m,/usr/doc/|/usr/share/doc/|/man[\d]/|/usr/info/|/usr/share/info/, && !-d) { |
||||
|
file_now(\%commands); |
||||
|
print "$_\n"; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
# humm? treated specially, hopefully. |
||||
|
###################### |
||||
|
# BASE-FILES PACKAGE # |
||||
|
###################### |
||||
|
elsif ($argument eq "base-files") { |
||||
|
my $line = $_; |
||||
|
if ($line =~ m,/usr/doc/|/usr/share/doc/|/man[\d]/|/usr/info/|/usr/share/info/, || |
||||
|
defined $path{$line}) { |
||||
|
md5_print(\%path,\%md5sums,$line,$count); |
||||
|
} |
||||
|
} |
||||
|
} # another while |
||||
|
close(LIST); |
||||
|
%md5sums = (); |
||||
|
%path = (); |
||||
|
@path = (); |
||||
|
@md5 = (); |
||||
|
$count++; |
||||
|
if ($count == 1) { |
||||
|
open (MD5SUM,"$md5sums") if $md5sums; |
||||
|
} |
||||
|
} # loop through -c or not |
||||
|
} # do the md5sum files even exist? |
||||
|
} |
||||
|
#@@ another important change, print --md5sum and -l together |
||||
|
if (-e $file && $commands->{"d"} && (!defined $md5sums && |
||||
|
!defined $md5sums_conf) || -e $file && |
||||
|
(!$commands->{"md5sum"} && $commands->{"d"})) { |
||||
|
file_now(\%commands) if !$commands->{"f"}; |
||||
|
#if (-e $file && $commands->{"d"}) { |
||||
|
open (LIST,"$file"); |
||||
|
while (<LIST>) { |
||||
|
chomp; |
||||
|
if (m,/usr/doc/|/usr/share/doc/|/man[\d]/|/usr/info/|/usr/share/info/, && !-d) { |
||||
|
print "$_\n"; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
else { |
||||
|
#if (!defined $md5sums || !defined $md5sums_conf) { |
||||
|
if (!-e $file) { |
||||
|
print "package $argument is not installed\n"; |
||||
|
} |
||||
|
} |
||||
|
} # if !--n |
||||
|
else { |
||||
|
# Let's check first if this package actually exists, files are checked |
||||
|
# earlier. |
||||
|
if (defined $argument) { |
||||
|
if (!defined $db{"$argument"}) { |
||||
|
print "package $argument is not installed\n"; |
||||
|
exit; |
||||
|
} |
||||
|
} |
||||
|
nfile(\%commands); |
||||
|
} |
||||
|
} # if defined $argument |
||||
|
|
||||
|
untie %db; |
||||
|
|
||||
|
|
||||
|
if (defined $file_now && !($commands->{"z"} || |
||||
|
$commands->{"ftp"} || |
||||
|
$commands->{"remove"} || $commands->{"r"} || |
||||
|
$commands->{"purge"})) { |
||||
|
if ($commands{"x"} || $commands{"ftp"} || $commands{"source"} || |
||||
|
$commands{"source_only"} || $commands{"remove"} || |
||||
|
$commands{"r"} || $commands{"purge"}) { |
||||
|
require SWIM::Safex; |
||||
|
SWIM::Safex->import(qw(safex)); |
||||
|
safex(\%commands); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
} # end sub file |
||||
|
|
||||
|
# this manages situation involving -qlcx & -qglx |
||||
|
sub file_now { |
||||
|
|
||||
|
my ($commands) = @_; |
||||
|
my %commands = %$commands; |
||||
|
|
||||
|
#if (!$commands->{"g"} && !defined $file_now) { |
||||
|
if (!$commands->{"g"}) { |
||||
|
if ($arg_count < $#ARGV) { |
||||
|
push(@arg_holder,$argument); |
||||
|
# humm |
||||
|
#@PACKAGES = "DEFINEDONE"; |
||||
|
#@PACKAGES = "$ARGV[$#ARGV]"; |
||||
|
$arg_count++; |
||||
|
} |
||||
|
else { |
||||
|
@PACKAGES = @arg_holder; |
||||
|
push(@PACKAGES,$argument); |
||||
|
} |
||||
|
} |
||||
|
else { |
||||
|
if ($arg_count < $#stuff) { |
||||
|
push(@arg_holder,$argument); |
||||
|
#$arg_count++; |
||||
|
} |
||||
|
else { |
||||
|
@PACKAGES = @arg_holder; |
||||
|
push(@PACKAGES,$argument); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
} # end file_now |
||||
|
|
||||
|
# In order to run a md5sum test on configuration files directly recognized |
||||
|
# by dpkg, a file with package_name-conf.md5sums is created, in addition to |
||||
|
# any existing package_name.md5sums file. |
||||
|
sub make_conf { |
||||
|
|
||||
|
my ($commands) = @_; |
||||
|
my %commands = %$commands; |
||||
|
|
||||
|
my $md5sums_conf; |
||||
|
if (!$commands->{"n"}) { |
||||
|
dbi(\%commands); |
||||
|
} |
||||
|
# humm, just a trap |
||||
|
else { |
||||
|
ndb(\%commands); |
||||
|
} |
||||
|
|
||||
|
if ($argument !~ /_/ ) { |
||||
|
# I guess we can stop here here is there are no configuration |
||||
|
# files |
||||
|
if (defined $db{$argument}) { |
||||
|
require SWIM::Info; |
||||
|
SWIM::Info->import(qw(conf)); |
||||
|
my $orig_argument = $argument; |
||||
|
$argument = $db{$argument}; |
||||
|
my ($conf, @conf, %conf); |
||||
|
my ($m5, $dir, $thing); |
||||
|
if (conf(\%commands) ne 0) { |
||||
|
$conf = conf(\%commands); |
||||
|
@conf = split(/\n/, $conf); |
||||
|
open(PACKCONF,">$parent$base/info/$orig_argument-conf.md5sums"); |
||||
|
foreach (@conf) { |
||||
|
$_ =~ m,( \/)(.*$),; |
||||
|
($dir, $m5) = split(/ /, $2, 2); |
||||
|
$thing = "$m5 $dir\n"; |
||||
|
print PACKCONF $thing; |
||||
|
} |
||||
|
close(PACKCONF); |
||||
|
$md5sums_conf = |
||||
|
"$parent$base/info/$orig_argument-conf.md5sums"; |
||||
|
return $md5sums_conf; |
||||
|
} |
||||
|
else { |
||||
|
return; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
untie %db; |
||||
|
|
||||
|
} # end sub make_conf |
||||
|
|
||||
|
|
||||
|
# prints out the results from the md5sum test for -l & -l --df |
||||
|
sub md5_print { |
||||
|
|
||||
|
my ($path, $md5sums, $line, $count) = @_; |
||||
|
|
||||
|
if (defined $path->{$line}) { |
||||
|
if (defined $md5sums->{$line}) { |
||||
|
print " $line $path->{$line} $md5sums->{$line}" if $count == 0; |
||||
|
print "$line $path->{$line} $md5sums->{$line}" if $count == 1; |
||||
|
print "\n"; |
||||
|
} |
||||
|
elsif ($path->{$line} ne "newconffile") { |
||||
|
print " $line $path->{$line} OK" if $count == 0; |
||||
|
print "$line $path->{$line} OK" if $count == 1; |
||||
|
print "\n"; |
||||
|
} |
||||
|
else { |
||||
|
print " $line $path->{$line}\n" if $count == 0; |
||||
|
print "$line $path->{$line}\n" if $count == 1; |
||||
|
} |
||||
|
} |
||||
|
elsif ($count == 1) { |
||||
|
print "$line\n"; |
||||
|
} |
||||
|
|
||||
|
} # end md5_print |
||||
|
|
||||
|
|
||||
|
# -n The list of files/dirs belonging to a package. No md5sum here. |
||||
|
sub nfile { |
||||
|
|
||||
|
my ($commands) = @_; |
||||
|
my %commands = %$commands; |
||||
|
my $ramdisk = ram_on(\%commands); |
||||
|
|
||||
|
# Here's a case where gnu grep is faster than using open. |
||||
|
if ($ramdisk eq "yes") { |
||||
|
my $what = "yes"; |
||||
|
process_nfile($what,\%commands); |
||||
|
} # if ramdisk |
||||
|
|
||||
|
elsif ($ramdisk eq 1) { |
||||
|
my $what = "no"; |
||||
|
process_nfile($what,\%commands); |
||||
|
} |
||||
|
|
||||
|
} # end sub nfile |
||||
|
|
||||
|
# -n figure out --df, -d & -l using the contents db |
||||
|
sub process_nfile { |
||||
|
|
||||
|
my ($what,$commands) = @_; |
||||
|
my %commands = %$commands; |
||||
|
my $contentsdb = finddb(\%commands); |
||||
|
my ($arch,$dist) = which_archdist(\%commands); |
||||
|
my ($Contents,$subject); |
||||
|
|
||||
|
|
||||
|
# the + solution |
||||
|
nsb(\%commands); |
||||
|
$subject = (split(/\s/,$nsb{$argument}))[1]; |
||||
|
$argument =~ s,\+,\\\\+,g if $argument =~ m,\+,; |
||||
|
untie %nsb; |
||||
|
|
||||
|
if ($what eq "no") { |
||||
|
if (-e "$contentsdb/ncontentsindex$arch$dist.deb.gz") { |
||||
|
$Contents = "zgrep -E $argument\ $contentsdb/ncontentsindex$arch$dist.deb.gz|"; |
||||
|
} |
||||
|
else { |
||||
|
print "swim: stopping, cannot perform this operation without contents\n"; |
||||
|
exit; |
||||
|
} |
||||
|
} |
||||
|
elsif ($what eq "yes") { |
||||
|
if (-e "$contentsdb/dramdisk/ncontentsindex$arch$dist.deb.gz") { |
||||
|
$Contents = "zgrep -E $argument\ $contentsdb/dramdisk/ncontentsindex$arch$dist.deb.gz|"; |
||||
|
} |
||||
|
else { |
||||
|
print "swim: stopping, cannot perform this operation without contents\n"; |
||||
|
exit; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
my($dirfile,$package,@dirfile,@comma,%all,%again); |
||||
|
open(CONTENTSDB, "$Contents"); |
||||
|
while (<CONTENTSDB>) { |
||||
|
# changed for >= 0.2.9 - will have to watch for these |
||||
|
# guys net/sendfile, x11/xscreensaver, x11/xscreensaver, |
||||
|
# graphics/ucbmpeg, admin/cfengine .. there is a space before them |
||||
|
#if (/^FILE\s*LOCATION$/) { |
||||
|
#while (<CONTENTSDB>) { |
||||
|
if (!$commands->{"df"}) { |
||||
|
# this isn't acurate for groups of packages ,,, so will use the |
||||
|
# subject section instead of \b and $ |
||||
|
$argument =~ s,\\\\+,\\\+,g if $argument =~ m,\+,; |
||||
|
if (m,$subject/$argument,) { |
||||
|
###################### |
||||
|
# DOESN'T END WITH / # |
||||
|
###################### |
||||
|
if ($_ !~ m,.*/\s+\w*,) { |
||||
|
($dirfile,$package) = split(/\s+/,$_,2); |
||||
|
if ($package !~ m,^[a-z0-9-]*/.*$|^[a-z0-9-]*/.*/.*$,) { |
||||
|
my @more_things = split(/\s+/,$package); |
||||
|
$package = $more_things[$#more_things]; |
||||
|
(my $backpackage = $package) =~ s,\+,\\+,g; |
||||
|
my @dirfile = split(/\s+$backpackage/,$_); |
||||
|
$dirfile = $dirfile[0]; |
||||
|
} |
||||
|
$dirfile = "/$dirfile"; |
||||
|
###### |
||||
|
# -L # |
||||
|
###### |
||||
|
if (!$commands->{"d"} && $commands->{"l"}) { |
||||
|
print "$dirfile\n"; |
||||
|
} |
||||
|
###### |
||||
|
# -D # |
||||
|
###### |
||||
|
elsif ($commands->{"d"}) { |
||||
|
if ($dirfile =~ m,/usr/doc/|/usr/share/doc/|/man[\d]/|/usr/info/|/usr/share/info/,) { |
||||
|
print "$dirfile\n"; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
######## |
||||
|
# --DF # |
||||
|
######## |
||||
|
elsif ($commands->{"df"} && $commands->{"l"} && !$commands->{"d"}) { |
||||
|
$argument =~ s,\\\\+,\\\+,g if $argument =~ m,\+,; |
||||
|
if (m,$subject/$argument,) { |
||||
|
#if (m,\b$argument\b,) { |
||||
|
|
||||
|
###################### |
||||
|
# ENDS WITH / # |
||||
|
###################### |
||||
|
if (m,.*/\s+\w*,) { |
||||
|
($dirfile,$package) = split(/\s+/,$_,2); |
||||
|
if ($package !~ m,^[a-z0-9-]*/.*$|^[a-z0-9-]*/.*/.*$,) { |
||||
|
my @more_things = split(/\s+/,$package); |
||||
|
$package = $more_things[$#more_things]; |
||||
|
(my $backpackage = $package) =~ s,\+,\\+,g; |
||||
|
my @dirfile = split(/\s+$backpackage/,$_); |
||||
|
$dirfile = $dirfile[0]; |
||||
|
} |
||||
|
@dirfile = split(/\//,$dirfile); $dirfile =~ s,/$,,; |
||||
|
} |
||||
|
###################### |
||||
|
# DOESN'T END WITH / # |
||||
|
###################### |
||||
|
else { |
||||
|
($dirfile,$package) = split(/\s+/,$_,2); |
||||
|
if ($package !~ m,^[a-z0-9-]*/.*$|^[a-z0-9-]*/.*/.*$,) { |
||||
|
my @more_things = split(/\s+/,$package); |
||||
|
$package = $more_things[$#more_things]; |
||||
|
(my $backpackage = $package) =~ s,\+,\\+,g; |
||||
|
my @dirfile = split(/\s+$backpackage/,$_); |
||||
|
$dirfile = $dirfile[0]; |
||||
|
} |
||||
|
@dirfile = split(/\//,$dirfile); |
||||
|
} |
||||
|
########################### |
||||
|
# PROCESS INTO FILES/DIRS # |
||||
|
########################### |
||||
|
my ($count,$holder); |
||||
|
for ($count = 0; $count <= $#dirfile; $count++) { |
||||
|
if ($count == 0) { |
||||
|
$holder = "/$dirfile[$count]"; |
||||
|
my $again = "$dirfile[$count]"; |
||||
|
my $all = "/."; |
||||
|
$again{$again}++; |
||||
|
$all{$all}++; |
||||
|
if ($all{$all} == 1) { |
||||
|
print "/.\n"; |
||||
|
} |
||||
|
if ($again{$again} == 1) { |
||||
|
print "/$dirfile[$count]\n"; |
||||
|
} |
||||
|
} |
||||
|
else { |
||||
|
$holder = $holder . "/$dirfile[$count]"; |
||||
|
my $again = "$holder"; |
||||
|
$again{$again}++; |
||||
|
if ($again{$again} == 1) { |
||||
|
print "$holder\n"; |
||||
|
} |
||||
|
} |
||||
|
} # end for |
||||
|
} |
||||
|
} |
||||
|
################### |
||||
|
# -D & --DF &| -L # |
||||
|
################### |
||||
|
elsif (($commands->{"d"} && $commands->{"df"}) || |
||||
|
$commands->{"d"} && $commands->{"df"} && $commands->{"l"}) { |
||||
|
$argument =~ s,\\\\+,\\\+,g if $argument =~ m,\+,; |
||||
|
if (m,$subject/$argument,) { |
||||
|
#if (m,\b$argument$,) { |
||||
|
|
||||
|
###################### |
||||
|
# DOESN'T END WITH / # |
||||
|
###################### |
||||
|
if ($_ !~ m,.*/\s+\w*,) { |
||||
|
($dirfile,$package) = split(/\s+/,$_,2); |
||||
|
if ($package !~ m,^[a-z0-9-]*/.*$|^[a-z0-9-]*/.*/.*$,) { |
||||
|
my @more_things = split(/\s+/,$package); |
||||
|
$package = $more_things[$#more_things]; |
||||
|
(my $backpackage = $package) =~ s,\+,\\+,g; |
||||
|
my @dirfile = split(/\s+$backpackage/,$_); |
||||
|
$dirfile = $dirfile[0]; |
||||
|
} |
||||
|
$dirfile = "/$dirfile"; |
||||
|
###### |
||||
|
# -D # |
||||
|
###### |
||||
|
if ($dirfile =~ m,/usr/doc/|/usr/share/doc/|/man[\d]/|/usr/info/|/usr/share/info/,) { |
||||
|
print "$dirfile\n"; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
#} |
||||
|
#} |
||||
|
} # while |
||||
|
close(CONTENTSDB); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
|
||||
|
1; |
@ -0,0 +1,358 @@ |
|||||
|
# Package administration and research tool for Debian |
||||
|
# Copyright (C) 1999-2000 Jonathan D. Rosenbaum |
||||
|
|
||||
|
# This program 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. |
||||
|
|
||||
|
# This program 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 this program; if not, write to the Free Software |
||||
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
||||
|
|
||||
|
|
||||
|
package SWIM::Findex; |
||||
|
use strict; |
||||
|
use SWIM::Global; |
||||
|
use SWIM::Conf qw($my_number); |
||||
|
use SWIM::DB_Library qw(:Xyz ib nib nsb); |
||||
|
use SWIM::Info; |
||||
|
use SWIM::Deps; |
||||
|
use SWIM::Dir; |
||||
|
use vars qw(@ISA @EXPORT_OK); |
||||
|
use Exporter; |
||||
|
@ISA = qw(Exporter); |
||||
|
@EXPORT_OK = qw(findexer qindexer); |
||||
|
|
||||
|
|
||||
|
# findexer(\%commands) and qindexer used for -a -n -f |
||||
|
|
||||
|
# query filelist for file name.. -qfl -qal, but not -qfl(d)c ... actually |
||||
|
# yes... -qlfd under certain conditions, but not with -c. And -T and |
||||
|
# singular capabilities. |
||||
|
sub findexer { |
||||
|
|
||||
|
my ($commands) = @_; |
||||
|
my %commands = %$commands; |
||||
|
my @alot; |
||||
|
require SWIM::File; |
||||
|
SWIM::File->import(qw(file)); |
||||
|
|
||||
|
|
||||
|
if (!$commands->{"n"}) { |
||||
|
ib(\%commands); |
||||
|
} |
||||
|
else { |
||||
|
my $return = nib(\%commands); |
||||
|
if (!defined $return && $commands->{"a"}) { |
||||
|
untie %ib; |
||||
|
nsb(\%commands); |
||||
|
$ib{"/."} = $nsb{"/."}; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
if (defined $argument) { |
||||
|
if ($commands->{"dir"}) { |
||||
|
dir(\%commands); |
||||
|
} |
||||
|
elsif ($commands->{"f"}) { |
||||
|
fir(\%commands); |
||||
|
} |
||||
|
if ($ib{"$argument"}){ |
||||
|
my $package = $ib{"$argument"}; |
||||
|
@alot = split(/\s/, $package); |
||||
|
@PACKAGES = @alot; |
||||
|
if ($commands->{"z"} || $commands->{"ftp"} || |
||||
|
$commands->{"remove"} || $commands->{"r"} || |
||||
|
$commands->{"purge"}) { |
||||
|
require SWIM::Safex; |
||||
|
SWIM::Safex->import(qw(safex)); |
||||
|
safex(\%commands); |
||||
|
} |
||||
|
@alot = @PACKAGES; |
||||
|
if ($commands->{"total"} || $commands->{"t"}) { |
||||
|
if ($commands->{"T"}) { |
||||
|
foreach (@alot) { |
||||
|
$argument = $_; |
||||
|
if ($commands->{"scripts"} || $commands->{"preinst"} || |
||||
|
$commands->{"postinst"} || $commands->{"prerm"} || |
||||
|
$commands->{"postrm"}) { |
||||
|
scripts(\%commands); |
||||
|
} |
||||
|
menu(\%commands) if $commands->{"menu"} || $commands->{"m"}; |
||||
|
copyright(\%commands) if $commands->{"copyright"}; |
||||
|
changelog(\%commands) if $commands->{"changelog"}; |
||||
|
# nice to print package names before file listings |
||||
|
if (!$commands->{"i"} || !$commands->{"d"} || !$commands->{"c"}) { |
||||
|
print "$argument\n"; |
||||
|
} |
||||
|
character(\%commands); |
||||
|
shlibs(\%commands) if $commands->{"shlibs"}; |
||||
|
file(\%commands); |
||||
|
print "\n"; |
||||
|
} |
||||
|
} # if -T |
||||
|
elsif (which_character(\%commands)) { |
||||
|
foreach (@alot) { |
||||
|
my %store_commands = %commands; |
||||
|
$argument = $_; |
||||
|
if ($commands->{"scripts"} || $commands->{"preinst"} || |
||||
|
$commands->{"postinst"} || $commands->{"prerm"} || |
||||
|
$commands->{"postrm"}) { |
||||
|
scripts(\%commands); |
||||
|
} |
||||
|
menu(\%commands) if $commands->{"menu"} || $commands->{"m"}; |
||||
|
copyright(\%commands) if $commands->{"copyright"}; |
||||
|
changelog(\%commands) if $commands->{"changelog"}; |
||||
|
if (the_character(\%commands) ne "ok") { |
||||
|
print "$argument\n"; |
||||
|
} |
||||
|
if (defined s_character(\%commands)) {} |
||||
|
shlibs(\%commands) if $commands->{"shlibs"}; |
||||
|
file(\%commands); |
||||
|
print "\n"; |
||||
|
%commands = %store_commands; |
||||
|
undef %store_commands; |
||||
|
} |
||||
|
} |
||||
|
# no -Ts. |
||||
|
foreach (@alot) { |
||||
|
$argument = $_; |
||||
|
if ($commands->{"scripts"} || $commands->{"preinst"} || |
||||
|
$commands->{"postinst"} || $commands->{"prerm"} || |
||||
|
$commands->{"postrm"}) { |
||||
|
scripts(\%commands); |
||||
|
} |
||||
|
menu(\%commands) if $commands->{"menu"} || $commands->{"m"}; |
||||
|
copyright(\%commands) if $commands->{"copyright"}; |
||||
|
changelog(\%commands) if $commands->{"changelog"}; |
||||
|
if (defined $argument) { |
||||
|
print "\n" if $commands->{"l"}; |
||||
|
print "$argument\n"; |
||||
|
} |
||||
|
shlibs(\%commands) if $commands->{"shlibs"}; |
||||
|
file(\%commands); |
||||
|
if ($commands->{"d"} && !$commands->{"T"} && !which_character(\%commands)) { |
||||
|
print "\n" if !$commands->{"l"}; |
||||
|
} |
||||
|
} # end not's |
||||
|
} # if -t |
||||
|
|
||||
|
|
||||
|
elsif ($#ARGV > $my_number) { |
||||
|
my $total = $#ARGV + 1; |
||||
|
print "use --total or -t to see all $total packages\n"; |
||||
|
exit; |
||||
|
} |
||||
|
elsif ($#alot > $my_number) { |
||||
|
my $total = $#alot + 1; |
||||
|
print "use --total or -t to see all $total packages\n"; |
||||
|
} |
||||
|
|
||||
|
else { |
||||
|
if ($commands->{"T"}) { |
||||
|
foreach (@alot) { |
||||
|
$argument = $_; |
||||
|
if ($commands->{"scripts"} || $commands->{"preinst"} || |
||||
|
$commands->{"postinst"} || $commands->{"prerm"} || |
||||
|
$commands->{"postrm"}) { |
||||
|
scripts(\%commands); |
||||
|
} |
||||
|
menu(\%commands) if $commands->{"menu"} || $commands->{"m"}; |
||||
|
copyright(\%commands) if $commands->{"copyright"}; |
||||
|
changelog(\%commands) if $commands->{"changelog"}; |
||||
|
print "$argument\n"; |
||||
|
character(\%commands); |
||||
|
shlibs(\%commands) if $commands->{"shlibs"}; |
||||
|
file(\%commands); |
||||
|
print "\n"; |
||||
|
} |
||||
|
} # end -T |
||||
|
elsif (which_character(\%commands)) { |
||||
|
foreach (@alot) { |
||||
|
my %store_commands = %commands; |
||||
|
$argument = $_; |
||||
|
if ($commands->{"scripts"} || $commands->{"preinst"} || |
||||
|
$commands->{"postinst"} || $commands->{"prerm"} || |
||||
|
$commands->{"postrm"}) { |
||||
|
scripts(\%commands); |
||||
|
} |
||||
|
menu(\%commands) if $commands->{"menu"} || $commands->{"m"}; |
||||
|
copyright(\%commands) if $commands->{"copyright"}; |
||||
|
changelog(\%commands) if $commands->{"changelog"}; |
||||
|
if (the_character($argument) ne "ok") { |
||||
|
print "$argument\n"; |
||||
|
} |
||||
|
if (defined s_character(\%commands)) {} |
||||
|
shlibs(\%commands) if $commands->{"shlibs"}; |
||||
|
file(\%commands); |
||||
|
print "\n"; |
||||
|
%commands = %store_commands; |
||||
|
undef %store_commands; |
||||
|
} |
||||
|
} # which_character |
||||
|
foreach (@alot) { |
||||
|
$argument = $_; |
||||
|
if ($commands->{"scripts"} || $commands->{"preinst"} || |
||||
|
$commands->{"postinst"} || $commands->{"prerm"} || |
||||
|
$commands->{"postrm"}) { |
||||
|
scripts(\%commands); |
||||
|
} |
||||
|
menu(\%commands) if $commands->{"menu"} || $commands->{"m"}; |
||||
|
copyright(\%commands) if $commands->{"copyright"}; |
||||
|
changelog(\%commands) if $commands->{"changelog"}; |
||||
|
if (defined $argument) { |
||||
|
print "$argument\n"; |
||||
|
} |
||||
|
file(\%commands); |
||||
|
if ($commands->{"d"} && !$commands->{"T"} && !which_character(\%commands)) { |
||||
|
print "\n"; |
||||
|
} |
||||
|
} # end not's |
||||
|
} # else |
||||
|
} |
||||
|
else { |
||||
|
$argument =~ m,.*\/(.*$),; |
||||
|
if (defined $1) { |
||||
|
my $file = $1; |
||||
|
if (!$commands->{"n"} && -e "/usr/sbin/update-alternatives") { |
||||
|
my $it = "update-alternatives --display $1|"; |
||||
|
open (IT,"$it") or exit; |
||||
|
if (<IT> =~ /No alternatives/) { |
||||
|
print "file $file is not owned by any package\n"; |
||||
|
} |
||||
|
else { |
||||
|
my @LINES = <IT>; |
||||
|
print "For $argument ->\n"; |
||||
|
$LINES[0] =~ m,(/.*$),; $argument = $1; |
||||
|
print "@LINES\n"; findexer(\%commands); |
||||
|
} |
||||
|
} |
||||
|
else { |
||||
|
print "file $file is not owned by any package\n"; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
untie %ib; |
||||
|
|
||||
|
if (!($commands->{"z"} || $commands->{"ftp"} || |
||||
|
$commands->{"remove"} || $commands->{"r"} || |
||||
|
$commands->{"purge"})) { |
||||
|
if ($commands->{"x"} || $commands->{"ftp"} || $commands->{"source"} || |
||||
|
$commands->{"source_only"} || $commands->{"remove"} || |
||||
|
$commands->{"r"} || $commands->{"purge"}) { |
||||
|
require SWIM::Safex; |
||||
|
SWIM::Safex->import(qw(safex)); |
||||
|
safex(\%commands); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
} # end sub findexer |
||||
|
|
||||
|
|
||||
|
# query description of file name..-i (-qfi) |
||||
|
sub qindexer { |
||||
|
|
||||
|
my ($commands) = @_; |
||||
|
my %commands = %$commands; |
||||
|
require SWIM::Ag; |
||||
|
SWIM::Ag->import(qw(description)); |
||||
|
|
||||
|
if ($commands->{"scripts"} || $commands->{"preinst"} || |
||||
|
$commands->{"postinst"} || $commands->{"prerm"} || |
||||
|
$commands->{"postrm"}) { |
||||
|
scripts(\%commands); |
||||
|
} |
||||
|
menu(\%commands) if $commands->{"menu"} || $commands->{"m"}; |
||||
|
copyright(\%commands) if $commands->{"copyright"}; |
||||
|
changelog(\%commands) if $commands->{"changelog"}; |
||||
|
|
||||
|
my @alot; |
||||
|
|
||||
|
if (!$commands->{"n"}) { |
||||
|
ib(\%commands); |
||||
|
} |
||||
|
else { |
||||
|
my $return = nib(\%commands); |
||||
|
if (!defined $return && $commands->{"a"}) { |
||||
|
untie %ib; |
||||
|
nsb(\%commands); |
||||
|
$ib{"/."} = $nsb{"/."}; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
if (defined $argument) { |
||||
|
dir(\%commands); |
||||
|
fir(\%commands); |
||||
|
|
||||
|
# this will be moved above for safex(\%commands) |
||||
|
if ($ib{"$argument"}){ |
||||
|
my $package = $ib{"$argument"}; |
||||
|
@alot = split(/\s/, $package); |
||||
|
@PACKAGES = @alot; |
||||
|
if ($commands->{"z"} || $commands->{"ftp"} || |
||||
|
$commands->{"remove"} || $commands->{"r"} || |
||||
|
$commands->{"purge"}) { |
||||
|
require SWIM::Safex; |
||||
|
SWIM::Safex->import(qw(safex)); |
||||
|
safex(\%commands); |
||||
|
} |
||||
|
@alot = @PACKAGES; |
||||
|
if ($commands->{"total"} || $commands->{"t"}) { |
||||
|
foreach (@alot) { |
||||
|
$argument = $_; |
||||
|
description(\%commands); |
||||
|
print "\n"; |
||||
|
} |
||||
|
} |
||||
|
elsif ($#ARGV > 0) { |
||||
|
my $total = $#ARGV + 1; |
||||
|
print "use --total or -t to see all $total packages\n"; |
||||
|
exit; |
||||
|
} |
||||
|
elsif ($#alot > 0) { |
||||
|
my $total = $#alot + 1; |
||||
|
print "use --total or -t to see all $total packages\n"; |
||||
|
} |
||||
|
else { |
||||
|
$argument = $package; |
||||
|
description(\%commands); |
||||
|
} |
||||
|
} |
||||
|
else { |
||||
|
$argument =~ m,.*\/(.*$),; |
||||
|
if (defined $1) { |
||||
|
my $file = $1; |
||||
|
if (!$commands->{"n"} && -e "/usr/sbin/update-alternatives") { |
||||
|
my $it = "update-alternatives --display $1|"; |
||||
|
open (IT,"$it") or exit; |
||||
|
if (<IT> =~ /No alternatives/) { |
||||
|
print "file $file is not owned by any package\n"; |
||||
|
} |
||||
|
else { |
||||
|
my @LINES = <IT>; |
||||
|
print "For $argument ->\n"; |
||||
|
$LINES[0] =~ m,(/.*$),; $argument = $1; |
||||
|
print "@LINES\n"; qindexer(\%commands); |
||||
|
} |
||||
|
} |
||||
|
else { |
||||
|
print "file $file is not owned by any package\n"; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
untie %ib; |
||||
|
|
||||
|
|
||||
|
|
||||
|
} # end sub qindexer |
||||
|
|
||||
|
|
||||
|
1; |
@ -0,0 +1,62 @@ |
|||||
|
# Package administration and research tool for Debian |
||||
|
# Copyright (C) 1999-2000 Jonathan D. Rosenbaum |
||||
|
|
||||
|
# This program 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. |
||||
|
|
||||
|
# This program 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 this program; if not, write to the Free Software |
||||
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
||||
|
|
||||
|
|
||||
|
package SWIM::Format; |
||||
|
use vars qw(@ISA @EXPORT); |
||||
|
|
||||
|
use Exporter; |
||||
|
@ISA = qw(Exporter); |
||||
|
@EXPORT = qw(*PRETTY *ALLGROUPS *SUBJECT *CENTER *SDS $col1 $col2 $ag1 |
||||
|
$ag2 $ag3 $number $subsite $subdate $subsize $subrelease |
||||
|
$center $number $sdsite $sdsdate $sdsize $sdsrelease); |
||||
|
|
||||
|
|
||||
|
# A nice format to make things look prettier, hopefully. |
||||
|
format PRETTY = |
||||
|
@<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< |
||||
|
$col1, $col2 |
||||
|
. |
||||
|
|
||||
|
# A format for --allgroups, shouldn't run out of room. |
||||
|
format ALLGROUPS = |
||||
|
@<<<<<<<<<<<<<<<<<<<<<<<< @<<<<<<<<<<<<<<<<<<<<<<<< @<<<<<<<<<<<<<<<<<<<<<<<< |
||||
|
$ag1, $ag2, $ag3 |
||||
|
. |
||||
|
|
||||
|
# center for DF|APT call |
||||
|
format SUBJECT = |
||||
|
@|| @||| @||| @||||||||||| @|||||| |
||||
|
$number, $subsite, $subdate, $subsize, $subrelease |
||||
|
|
||||
|
. |
||||
|
|
||||
|
|
||||
|
format CENTER = |
||||
|
@||||||||||||||||||||||| |
||||
|
$center |
||||
|
. |
||||
|
|
||||
|
|
||||
|
format SDS = |
||||
|
@>> @||||||||||||||||||||| @||||||||||||||||||||||||||| @|||||||| @||||| |
||||
|
$number, $sdsite, $sdsdate, $sdsize, $sdsrelease |
||||
|
. |
||||
|
|
||||
|
|
||||
|
|
||||
|
1; |
@ -0,0 +1,62 @@ |
|||||
|
# Package administration and research tool for Debian |
||||
|
# Copyright (C) 1999-2000 Jonathan D. Rosenbaum |
||||
|
|
||||
|
# This program 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. |
||||
|
|
||||
|
# This program 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 this program; if not, write to the Free Software |
||||
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
||||
|
|
||||
|
|
||||
|
package SWIM::Global; |
||||
|
#use strict; |
||||
|
use vars qw(@ISA @EXPORT %EXPORT_TAGS); |
||||
|
|
||||
|
use Exporter; |
||||
|
@ISA = qw(Exporter); |
||||
|
@EXPORT = qw(%db $ping %ndb %ib $zing %gb $ging %sb $sing %nsb %commands |
||||
|
$argument $save @stuff @PACKAGES @arg_holder $file_now |
||||
|
$arg_count $aptor_count $aptor_group $swim_version); |
||||
|
%EXPORT_TAGS = ( |
||||
|
Info => [ qw($argument %db) ] |
||||
|
); |
||||
|
|
||||
|
=pod |
||||
|
|
||||
|
Globals used by all program, which are not related to SWIM::Conf globals. |
||||
|
Most will probably be placed in SWIM::DB_Library. |
||||
|
|
||||
|
=cut |
||||
|
# Nothing to be done here. |
||||
|
# these could be put into SWIM::DB_Library |
||||
|
my (%db,$ping); # package.deb |
||||
|
my %ndb; # npackage.deb |
||||
|
my (%ib, $zing, %it); # fileindex.deb |
||||
|
my (%gb, $ging); # groupindex.deb |
||||
|
my (%sb, $sing); # statusindex.deb |
||||
|
my %nsb; # nstatusindex.deb |
||||
|
my %commands; # standard for Getopt::Long, but should usually |
||||
|
# be passed from ::*, although it can be global to a module |
||||
|
my $argument; # standard for package name |
||||
|
my $save; #for pager |
||||
|
|
||||
|
# Globals related to -xyz |
||||
|
my @stuff; # for -g & x |
||||
|
my @PACKAGES; # a replacement for @ARGV |
||||
|
my @arg_holder; # helps in tricky situations -> -qxl|d |
||||
|
my $file_now; # defined flag for -qlcx & -qglx for file() |
||||
|
$arg_count = 0; # helps in tricky situations |
||||
|
my $aptor_group; # helps when -z is called for groups |
||||
|
|
||||
|
# Swim's version |
||||
|
$swim_version = "0.3.6"; |
||||
|
|
||||
|
1; |
@ -0,0 +1,73 @@ |
|||||
|
# Package administration and research tool for Debian |
||||
|
# Copyright (C) 1999-2000 Jonathan D. Rosenbaum |
||||
|
|
||||
|
# This program 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. |
||||
|
|
||||
|
# This program 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 this program; if not, write to the Free Software |
||||
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
||||
|
|
||||
|
|
||||
|
package SWIM::Groups; |
||||
|
use strict; |
||||
|
use SWIM::DB_Library qw(:Groups); |
||||
|
use SWIM::Format; |
||||
|
use SWIM::Global qw(%gb); |
||||
|
use vars qw(@ISA @EXPORT); |
||||
|
use Exporter; |
||||
|
@ISA = qw(Exporter); |
||||
|
@EXPORT = qw(allgroups); |
||||
|
|
||||
|
|
||||
|
# show all the groups present on this system and exit |
||||
|
sub allgroups { |
||||
|
|
||||
|
my ($commands) = @_; |
||||
|
my %commands = %$commands; |
||||
|
|
||||
|
if (!($commands->{"q"} || $commands->{"query"}) && $commands->{"allgroups"}) { |
||||
|
print "swim: --allgroups may only be used during queries\n"; |
||||
|
exit; |
||||
|
} |
||||
|
if ($commands->{"q"} && $commands->{"allgroups"}) { |
||||
|
$~ = "ALLGROUPS"; |
||||
|
|
||||
|
if (!$commands->{"n"}) { |
||||
|
gb(\%commands); |
||||
|
} |
||||
|
else { |
||||
|
ngb(\%commands); |
||||
|
} |
||||
|
|
||||
|
my @complete = sort keys %gb; |
||||
|
my $three = 0; |
||||
|
while ($three <= $#complete) { |
||||
|
if (defined $complete[$three]) { |
||||
|
$ag1 = $complete[$three]; |
||||
|
} |
||||
|
if (defined $complete[$three + 1]) { |
||||
|
$ag2 = $complete[$three + 1]; |
||||
|
} |
||||
|
if (defined $complete[$three + 2]) { |
||||
|
$ag3 = $complete[$three + 2]; |
||||
|
} |
||||
|
write STDOUT; |
||||
|
$ag1 = ""; |
||||
|
$ag2 = ""; |
||||
|
$ag3 = ""; |
||||
|
$three = $three + 3; |
||||
|
} |
||||
|
exit; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
1; |
@ -0,0 +1,509 @@ |
|||||
|
# Package administration and research tool for Debian |
||||
|
# Copyright (C) 1999-2000 Jonathan D. Rosenbaum |
||||
|
|
||||
|
# This program 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. |
||||
|
|
||||
|
# This program 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 this program; if not, write to the Free Software |
||||
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
||||
|
|
||||
|
|
||||
|
package SWIM::Indexer; |
||||
|
use strict; |
||||
|
use SWIM::Global; |
||||
|
use SWIM::Conf qw($my_number); |
||||
|
use SWIM::DB_Library qw(:Xyz ib nib nsb); |
||||
|
use SWIM::Info; |
||||
|
use SWIM::Pn_print; |
||||
|
use SWIM::Deps; |
||||
|
use SWIM::Dir; |
||||
|
use vars qw(@ISA @EXPORT_OK); |
||||
|
use Exporter; |
||||
|
@ISA = qw(Exporter); |
||||
|
@EXPORT_OK = qw(indexer); |
||||
|
|
||||
|
|
||||
|
# The next few subs are provided to shorten indexer |
||||
|
# for -d or -l, but not -c when -T |
||||
|
sub T_indexer { |
||||
|
|
||||
|
my ($alot,$commands) = @_; |
||||
|
my %commands = %$commands; |
||||
|
|
||||
|
foreach (@$alot) { |
||||
|
$argument = $_; |
||||
|
if ($commands->{"scripts"} || $commands->{"preinst"} || |
||||
|
$commands->{"postinst"} || $commands->{"prerm"} || |
||||
|
$commands->{"postrm"}) { |
||||
|
scripts(\%commands); |
||||
|
} |
||||
|
menu(\%commands) if $commands->{"menu"} || $commands->{"m"}; |
||||
|
copyright(\%commands) if $commands->{"copyright"}; |
||||
|
changelog(\%commands) if $commands->{"changelog"}; |
||||
|
# looks o.k. |
||||
|
print "$argument\n"; |
||||
|
character(\%commands); |
||||
|
shlibs(\%commands) if $commands->{"shlibs"}; |
||||
|
if ($commands->{"d"} && !$commands->{"c"}) { |
||||
|
require SWIM::File; |
||||
|
SWIM::File->import(qw(file)); |
||||
|
file(\%commands); |
||||
|
} |
||||
|
print "\n"; |
||||
|
} |
||||
|
} # end sub T_indexer |
||||
|
|
||||
|
|
||||
|
sub which_character_indexer { |
||||
|
|
||||
|
my ($alot,$commands) = @_; |
||||
|
my %commands = %$commands; |
||||
|
|
||||
|
foreach (@$alot) { |
||||
|
my %store_commands = %commands; |
||||
|
$argument = $_; |
||||
|
if ($commands->{"scripts"} || $commands->{"preinst"} || |
||||
|
$commands->{"postinst"} || $commands->{"prerm"} || |
||||
|
$commands->{"postrm"}) { |
||||
|
scripts(\%commands); |
||||
|
} |
||||
|
menu(\%commands) if $commands->{"menu"} || $commands->{"m"}; |
||||
|
copyright(\%commands) if $commands->{"copyright"}; |
||||
|
changelog(\%commands) if $commands->{"changelog"}; |
||||
|
if (the_character(\%commands) ne "ok") { |
||||
|
print "$argument\n"; |
||||
|
} |
||||
|
if (defined s_character(\%commands)) {} |
||||
|
shlibs(\%commands) if $commands->{"shlibs"}; |
||||
|
if ($commands->{"d"} && !$commands->{"c"}) { |
||||
|
require SWIM::File; |
||||
|
SWIM::File->import(qw(file)); |
||||
|
file(\%commands); |
||||
|
} |
||||
|
print "\n"; |
||||
|
%commands = %store_commands; |
||||
|
undef %store_commands; |
||||
|
} |
||||
|
|
||||
|
} # end sub which_character_indexer |
||||
|
|
||||
|
sub noT_indexer { |
||||
|
|
||||
|
|
||||
|
my ($alot,$commands) = @_; |
||||
|
my %commands = %$commands; |
||||
|
require SWIM::File; |
||||
|
SWIM::File->import(qw(file)); |
||||
|
|
||||
|
foreach (@$alot) { |
||||
|
$argument = $_; |
||||
|
if ($commands->{"scripts"} || $commands->{"preinst"} || |
||||
|
$commands->{"postinst"} || $commands->{"prerm"} || |
||||
|
$commands->{"postrm"}) { |
||||
|
scripts(\%commands); |
||||
|
} |
||||
|
menu(\%commands) if $commands->{"menu"} || $commands->{"m"}; |
||||
|
copyright(\%commands) if $commands->{"copyright"}; |
||||
|
changelog(\%commands) if $commands->{"changelog"}; |
||||
|
if (defined $argument) { |
||||
|
# should be o.k., almost everything has documentation |
||||
|
print "$argument\n"; |
||||
|
} |
||||
|
shlibs(\%commands) if $commands->{"shlibs"}; |
||||
|
file(\%commands); |
||||
|
if ($commands->{"d"} && !$commands->{"T"} && !which_character(\%commands)) { |
||||
|
print "\n"; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
} # end sub noT_indexer |
||||
|
|
||||
|
# different enough from noT_indexer, used when -c,-d,-l aren't called. |
||||
|
sub nonoT_indexer { |
||||
|
|
||||
|
my ($alot,$commands) = @_; |
||||
|
my %commands = %$commands; |
||||
|
|
||||
|
foreach (@$alot) { |
||||
|
$argument = $_; |
||||
|
if ($commands->{"scripts"} || $commands->{"preinst"} || |
||||
|
$commands->{"postinst"} || $commands->{"prerm"} || |
||||
|
$commands->{"postrm"}) { |
||||
|
scripts(\%commands); |
||||
|
} |
||||
|
menu(\%commands) if $commands->{"menu"} || $commands->{"m"}; |
||||
|
copyright(\%commands) if $commands->{"copyright"}; |
||||
|
changelog(\%commands) if $commands->{"changelog"}; |
||||
|
# package name will print out even if there is no script |
||||
|
# definitely useful here |
||||
|
singular(\%commands); |
||||
|
if ($commands->{"scripts"}) { |
||||
|
print "\n"; |
||||
|
} |
||||
|
shlibs(\%commands) if $commands->{"shlibs"}; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
} # end sub nonoT_indexer |
||||
|
|
||||
|
|
||||
|
# when -c is called with or without -l or -d. This sub got rather huge. |
||||
|
sub c_indexer { |
||||
|
|
||||
|
my ($alot,$commands) = @_; |
||||
|
my %commands = %$commands; |
||||
|
my $arg_save; |
||||
|
require SWIM::File; |
||||
|
SWIM::File->import(qw(file)); |
||||
|
|
||||
|
foreach (@$alot) { |
||||
|
$argument = $_; |
||||
|
if (conf(\%commands) ne 0) { |
||||
|
if ($commands->{"T"}) { |
||||
|
# covers first argument, but not the rest. |
||||
|
if ($commands->{"scripts"} || $commands->{"preinst"} || |
||||
|
$commands->{"postinst"} || $commands->{"prerm"} || |
||||
|
$commands->{"postrm"}) { |
||||
|
scripts(\%commands); |
||||
|
} |
||||
|
menu(\%commands) if $commands->{"menu"} || $commands->{"m"}; |
||||
|
copyright(\%commands) if $commands->{"copyright"}; |
||||
|
changelog(\%commands) if $commands->{"changelog"}; |
||||
|
print "$argument\n"; |
||||
|
character(\%commands); |
||||
|
shlibs(\%commands) if $commands->{"shlibs"}; |
||||
|
print conf(\%commands) if !$commands->{"md5sum"}; |
||||
|
file(\%commands); |
||||
|
#file(\%commands) if $commands->{"md5sum"}; |
||||
|
if (($commands->{"c"} && (!$commands->{"d"} || !$commands->{"l"}))) { |
||||
|
print "\n"; |
||||
|
} |
||||
|
$arg_save = $argument; |
||||
|
} # end "T" |
||||
|
|
||||
|
elsif (which_character(\%commands)) { |
||||
|
my %store_commands = %commands; |
||||
|
$argument = $_; |
||||
|
if ($commands->{"scripts"} || $commands->{"preinst"} || |
||||
|
$commands->{"postinst"} || $commands->{"prerm"} || |
||||
|
$commands->{"postrm"}) { |
||||
|
scripts(\%commands); |
||||
|
} |
||||
|
menu(\%commands) if $commands->{"menu"} || $commands->{"m"}; |
||||
|
copyright(\%commands) if $commands->{"copyright"}; |
||||
|
changelog(\%commands) if $commands->{"changelog"}; |
||||
|
if (the_character(\%commands) ne "ok") { |
||||
|
print "$argument\n"; |
||||
|
} |
||||
|
if (defined s_character(\%commands)) {} |
||||
|
shlibs(\%commands) if $commands->{"shlibs"}; |
||||
|
print conf(\%commands) if !$commands->{"md5sum"}; |
||||
|
file(\%commands); |
||||
|
#file(\%commands) if $commands->{"md5sum"}; |
||||
|
if (($commands->{"c"} && (!$commands->{"d"} || !$commands->{"l"}))) { |
||||
|
print "\n"; |
||||
|
} |
||||
|
%commands = %store_commands; |
||||
|
undef %store_commands; |
||||
|
$arg_save = $argument; |
||||
|
} |
||||
|
|
||||
|
# no Ts. |
||||
|
else { |
||||
|
if ($commands->{"scripts"} || $commands->{"preinst"} || |
||||
|
$commands->{"postinst"} || $commands->{"prerm"} || |
||||
|
$commands->{"postrm"}) { |
||||
|
scripts(\%commands); |
||||
|
} |
||||
|
menu(\%commands) if $commands->{"menu"} || $commands->{"m"}; |
||||
|
copyright(\%commands) if $commands->{"copyright"}; |
||||
|
changelog(\%commands) if $commands->{"changelog"}; |
||||
|
print "$argument\n"; |
||||
|
shlibs(\%commands) if $commands->{"shlibs"}; |
||||
|
print conf(\%commands) if !$commands->{"md5sum"}; |
||||
|
file(\%commands); |
||||
|
print "\n"; |
||||
|
} |
||||
|
$arg_save = $argument; |
||||
|
} # end if (conf(\%commands) |
||||
|
|
||||
|
# this spot here can determine whether or not -c overrides l&d |
||||
|
# in packages which don't have conf files. it's nicer to view |
||||
|
# everything. watch this..these are packages which don't have |
||||
|
# conf files |
||||
|
if ($commands->{"d"} || $commands->{"l"}) { |
||||
|
if (defined $arg_save) { |
||||
|
if ($argument ne $arg_save) { |
||||
|
#if (!defined $arg_save) { |
||||
|
if (conf(\%commands) ne 0) { |
||||
|
shlibs(\%commands) if $commands->{"shlibs"}; |
||||
|
file(\%commands); |
||||
|
print "\n"; |
||||
|
} |
||||
|
|
||||
|
# no conf files |
||||
|
elsif (conf(\%commands) eq 0) { |
||||
|
if ($commands->{"T"}) { |
||||
|
$argument = $_; |
||||
|
if ($commands->{"scripts"} || $commands->{"preinst"} || |
||||
|
$commands->{"postinst"} || $commands->{"prerm"} || |
||||
|
$commands->{"postrm"}) { |
||||
|
scripts(\%commands); |
||||
|
} |
||||
|
menu(\%commands) if $commands->{"menu"} || $commands->{"m"}; |
||||
|
copyright(\%commands) if $commands->{"copyright"}; |
||||
|
changelog(\%commands) if $commands->{"changelog"}; |
||||
|
print "$argument\n"; |
||||
|
character(\%commands); |
||||
|
shlibs(\%commands) if $commands->{"shlibs"}; |
||||
|
file(\%commands) if $commands->{"md5sum"}; |
||||
|
print "\n"; |
||||
|
} # end "T" |
||||
|
|
||||
|
elsif (which_character(\%commands)) { |
||||
|
my %store_commands = %commands; |
||||
|
$argument = $_; |
||||
|
if ($commands->{"scripts"} || $commands->{"preinst"} || |
||||
|
$commands->{"postinst"} || $commands->{"prerm"} || |
||||
|
$commands->{"postrm"}) { |
||||
|
scripts(\%commands); |
||||
|
} |
||||
|
menu(\%commands) if $commands->{"menu"} || $commands->{"m"}; |
||||
|
copyright(\%commands) if $commands->{"copyright"}; |
||||
|
changelog(\%commands) if $commands->{"changelog"}; |
||||
|
if (the_character(\%commands) ne "ok") { |
||||
|
print "$argument\n"; |
||||
|
} |
||||
|
if (defined s_character(\%commands)) {} |
||||
|
shlibs(\%commands) if $commands->{"shlibs"}; |
||||
|
%commands = %store_commands; |
||||
|
undef %store_commands; |
||||
|
file(\%commands); |
||||
|
print "\n"; |
||||
|
} |
||||
|
|
||||
|
# no Ts. |
||||
|
else { |
||||
|
if ($commands->{"scripts"} || $commands->{"preinst"} || |
||||
|
$commands->{"postinst"} || $commands->{"prerm"} || |
||||
|
$commands->{"postrm"}) { |
||||
|
scripts(\%commands); |
||||
|
} |
||||
|
menu(\%commands) if $commands->{"menu"} || $commands->{"m"}; |
||||
|
copyright(\%commands) if $commands->{"copyright"}; |
||||
|
changelog(\%commands) if $commands->{"changelog"}; |
||||
|
singular(\%commands); |
||||
|
if ($commands->{"scripts"}) { |
||||
|
print "\n"; |
||||
|
} |
||||
|
shlibs(\%commands) if $commands->{"shlibs"}; |
||||
|
file(\%commands); |
||||
|
print "\n"; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} # end if ($commands->{"d"} || |
||||
|
} # end foreach |
||||
|
|
||||
|
} # end sub c_indexer |
||||
|
|
||||
|
|
||||
|
# handles -qf by itself or with -l(-d)&-c or -d by itself, and -qa by itself |
||||
|
# or with -c with -d and/or -l ...essentially not -i. <file> is the |
||||
|
# argument And ofcourse -T or singular capabilities. |
||||
|
sub indexer { |
||||
|
|
||||
|
my ($commands) = @_; |
||||
|
my %commands = %$commands; |
||||
|
my @alot; |
||||
|
|
||||
|
|
||||
|
if (!$commands->{"n"}) { |
||||
|
ib(\%commands); |
||||
|
} |
||||
|
else { |
||||
|
my $return = nib(\%commands); |
||||
|
if (!defined $return && $commands->{"a"}) { |
||||
|
untie %ib; |
||||
|
nsb(\%commands); |
||||
|
$ib{"/."} = $nsb{"/."}; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
if (defined $argument) { |
||||
|
dir(\%commands); |
||||
|
fir(\%commands); |
||||
|
if ($ib{"$argument"}){ |
||||
|
my $package = $ib{"$argument"}; |
||||
|
$package =~ s/\s/\n/g; |
||||
|
@alot = split(/\s/, $package); |
||||
|
if (defined @alot) { |
||||
|
@PACKAGES = @alot; |
||||
|
} |
||||
|
if ($commands->{"z"} || $commands->{"ftp"}|| |
||||
|
$commands->{"remove"} || $commands->{"r"} || |
||||
|
$commands->{"purge"}) { |
||||
|
require SWIM::Safex; |
||||
|
SWIM::Safex->import(qw(safex)); |
||||
|
safex(\%commands); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
@alot = @PACKAGES; |
||||
|
if ($commands->{"total"} || $commands->{"t"}) { |
||||
|
# The whole reason for the complicated if/elsif/else routines |
||||
|
# below is to allow simultaneous printing of -c & -d|-l. Other |
||||
|
# options can just be included within. |
||||
|
|
||||
|
########### |
||||
|
# -D & -t # |
||||
|
########### |
||||
|
if ($commands->{"d"} && !$commands->{"c"}) { |
||||
|
if ($commands->{"T"}) { |
||||
|
T_indexer(\@alot,\%commands); |
||||
|
} |
||||
|
elsif (which_character(\%commands)) { |
||||
|
which_character_indexer(\@alot,\%commands); |
||||
|
} |
||||
|
# no -Ts. |
||||
|
noT_indexer(\@alot,\%commands); |
||||
|
} |
||||
|
|
||||
|
####################### |
||||
|
# -t BUT NOT -C,-D,-L # |
||||
|
####################### |
||||
|
elsif (!$commands->{"c"} && (!$commands->{"d"} || !$commands->{"l"})) { |
||||
|
if ($commands->{"T"}) { |
||||
|
T_indexer(\@alot,\%commands); |
||||
|
} |
||||
|
elsif (which_character(\%commands)) { |
||||
|
which_character_indexer(\@alot,\%commands); |
||||
|
} |
||||
|
# humm smail is missing mysteriously, like it never became part |
||||
|
# of /.., basically, fastswim isn't placing it in long.debian. |
||||
|
# no -Ts. |
||||
|
else { |
||||
|
nonoT_indexer(\@alot,\%commands); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
##################### |
||||
|
# -t -C &| -D || -L # |
||||
|
##################### |
||||
|
# conf stuf. Will only show stuff related to -a or -f with conf. |
||||
|
elsif (($commands->{"c"} && (!$commands->{"d"} || !$commands->{"l"})) || |
||||
|
($commands->{"c"} && ($commands->{"d"} || $commands->{"l"}))) { |
||||
|
c_indexer(\@alot,\%commands); |
||||
|
} # end elsif |
||||
|
} |
||||
|
|
||||
|
######################### |
||||
|
# > NUMBER FOR -t # |
||||
|
########################## |
||||
|
elsif ($#ARGV > $my_number) { |
||||
|
my $total = $#ARGV + 1; |
||||
|
print "use --total or -t to see all $total packages\n"; |
||||
|
exit; |
||||
|
} |
||||
|
elsif ($#alot > $my_number) { |
||||
|
my $total = $#alot + 1; |
||||
|
print "use --total or -t to see all $total packages\n"; |
||||
|
} |
||||
|
|
||||
|
# without -t |
||||
|
else { |
||||
|
|
||||
|
###### |
||||
|
# -D # |
||||
|
###### |
||||
|
if ($commands->{"d"} && !$commands->{"c"}) { |
||||
|
if ($commands->{"T"}) { |
||||
|
T_indexer(\@alot,\%commands); |
||||
|
} |
||||
|
elsif (which_character(\%commands)) { |
||||
|
which_character_indexer(\@alot,\%commands); |
||||
|
} |
||||
|
# the noties |
||||
|
noT_indexer(\@alot,\%commands); |
||||
|
} |
||||
|
|
||||
|
################ |
||||
|
# NOT -C,-D,-L # |
||||
|
################ |
||||
|
elsif (!$commands->{"c"} && (!$commands->{"d"} || !$commands->{"l"})) { |
||||
|
if ($commands->{"T"}) { |
||||
|
T_indexer(\@alot,\%commands); |
||||
|
} |
||||
|
elsif (which_character(\%commands)) { |
||||
|
which_character_indexer(\@alot,\%commands); |
||||
|
} |
||||
|
else { |
||||
|
nonoT_indexer(\@alot,\%commands); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
################## |
||||
|
# -C &| -D || -L # |
||||
|
################## |
||||
|
# conf stuf. Will only show stuff related to -a or -f with conf. |
||||
|
elsif (($commands->{"c"} && (!$commands->{"d"} || !$commands->{"l"})) || |
||||
|
($commands->{"c"} && ($commands->{"d"} || $commands->{"l"}))) { |
||||
|
c_indexer(\@alot,\%commands); |
||||
|
} |
||||
|
|
||||
|
} # without -t |
||||
|
} |
||||
|
else { |
||||
|
$argument =~ m,.*\/(.*$),; |
||||
|
if (defined $1) { |
||||
|
my $file = $1; |
||||
|
if (!$commands->{"n"} && -e "/usr/sbin/update-alternatives") { |
||||
|
my $it = "update-alternatives --display $1|"; |
||||
|
open (IT,"$it") or exit; |
||||
|
if (<IT> =~ /No alternatives/) { |
||||
|
print "file $file is not owned by any package\n"; |
||||
|
} |
||||
|
else { |
||||
|
my @LINES = <IT>; |
||||
|
print "For $argument ->\n"; |
||||
|
$LINES[0] =~ m,(/.*$),; $argument = $1; |
||||
|
print "@LINES\n"; indexer(\%commands); |
||||
|
} |
||||
|
} |
||||
|
else { |
||||
|
print "file $file is not owned by any package\n"; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
untie %ib; |
||||
|
|
||||
|
if (defined @alot) { |
||||
|
@PACKAGES = @alot; |
||||
|
} |
||||
|
if (!($commands->{"z"} || $commands->{"ftp"} || |
||||
|
$commands->{"remove"} || $commands->{"r"} || |
||||
|
$commands->{"purge"})) { |
||||
|
if ($commands->{"x"} || $commands->{"ftp"} || $commands->{"source"} || |
||||
|
$commands->{"source_only"} || $commands->{"remove"} || |
||||
|
$commands->{"r"} || $commands->{"purge"}) { |
||||
|
require SWIM::Safex; |
||||
|
SWIM::Safex->import(qw(safex)); |
||||
|
safex(\%commands); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
} # end sub indexer |
||||
|
|
||||
|
|
||||
|
1; |
@ -0,0 +1,586 @@ |
|||||
|
# Package administration and research tool for Debian |
||||
|
# Copyright (C) 1999-2000 Jonathan D. Rosenbaum |
||||
|
|
||||
|
# This program 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. |
||||
|
|
||||
|
# This program 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 this program; if not, write to the Free Software |
||||
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
||||
|
|
||||
|
|
||||
|
package SWIM::Info; |
||||
|
use strict; |
||||
|
use SWIM::Conf qw(:Info); |
||||
|
use SWIM::Global qw(:Info); |
||||
|
use SWIM::DB_Library qw(:Xyz); |
||||
|
use vars qw(@ISA @EXPORT); |
||||
|
use Exporter; |
||||
|
@ISA = qw(Exporter); |
||||
|
@EXPORT = qw(scripts copyright changelog menu conf shlibs); |
||||
|
|
||||
|
# scripts() copyright() changelog() menu() conf() shlibs() |
||||
|
# the text stuff taken out of info for the installed system, though the |
||||
|
# not-installed system in checked for, just in case. |
||||
|
|
||||
|
# This shows all the scripts identified with a package(s). In certain |
||||
|
# cases it is valuable to print a script without the name of the package, |
||||
|
# so if --scripts, -a, or -t isn't called, the pure script will be |
||||
|
# presented. |
||||
|
sub scripts { |
||||
|
|
||||
|
my ($commands) = @_; |
||||
|
my %commands = %$commands; |
||||
|
|
||||
|
my ($file, $preinst, $postinst, $prerm, |
||||
|
$postrm, $orig_argument); |
||||
|
|
||||
|
|
||||
|
if ($commands->{"n"}) { |
||||
|
print "swim: no scripts for not-installed, consider --diff\n"; exit; |
||||
|
} |
||||
|
|
||||
|
dbi(\%commands); |
||||
|
|
||||
|
if ($argument =~ /_/) { |
||||
|
$orig_argument = $argument; |
||||
|
my $check = $db{"$argument"}; |
||||
|
$argument =~ m,(^.*)_(.*$),; |
||||
|
if (defined $check) { |
||||
|
$argument = $1; |
||||
|
} |
||||
|
else {}; |
||||
|
} |
||||
|
untie %db; |
||||
|
|
||||
|
|
||||
|
# here we will print out whatever we find including the file name. |
||||
|
if ($commands->{"scripts"} && !($commands->{"preinst"} || |
||||
|
$commands->{"postinst"} || $commands->{"prerm"} || |
||||
|
$commands->{"postrm"})) { |
||||
|
if (defined "$parent$base/info/$argument.preinst") { |
||||
|
$preinst = "$parent$base/info/$argument.preinst"; |
||||
|
} |
||||
|
if (defined "$parent$base/info/$argument.postinst") { |
||||
|
$postinst = "$parent$base/info/$argument.postinst"; |
||||
|
} |
||||
|
if (defined "$parent$base/info/$argument.prerm") { |
||||
|
$prerm = "$parent$base/info/$argument.prerm"; |
||||
|
} |
||||
|
if (defined "$parent$base/info/$argument.postrm") { |
||||
|
$postrm = "$parent$base/info/$argument.postrm"; |
||||
|
} |
||||
|
|
||||
|
if (-e $preinst) { |
||||
|
print "#####$argument.preinst#####\n\n"; |
||||
|
open (LIST,"$preinst"); |
||||
|
while (<LIST>) { |
||||
|
print $_; |
||||
|
} |
||||
|
} |
||||
|
if (-e $postinst) { |
||||
|
print "#####$argument.postinst#####\n\n"; |
||||
|
open (LIST,"$postinst"); |
||||
|
while (<LIST>) { |
||||
|
print $_; |
||||
|
} |
||||
|
} |
||||
|
if (-e $prerm) { |
||||
|
open (LIST,"$prerm"); |
||||
|
print "#####$argument.prerm#####\n\n"; |
||||
|
while (<LIST>) { |
||||
|
print $_; |
||||
|
} |
||||
|
} |
||||
|
if (-e $postrm) { |
||||
|
open (LIST,"$postrm"); |
||||
|
print "#####$argument.postrm#####\n\n"; |
||||
|
while (<LIST>) { |
||||
|
print $_; |
||||
|
} |
||||
|
} |
||||
|
} # if scripts |
||||
|
|
||||
|
|
||||
|
# from here on we just print out the particular script(s) called |
||||
|
# literally with no filename, unless -a or -t is called. This is one |
||||
|
# situation in which -t has a use apart from the global default. A |
||||
|
|
||||
|
# title is printed out for singular scripts in this case. |
||||
|
|
||||
|
if ($commands->{"preinst"}) { |
||||
|
if (defined "$parent$base/info/$argument.preinst") { |
||||
|
$preinst = "$parent$base/info/$argument.preinst"; |
||||
|
} |
||||
|
if (-e $preinst) { |
||||
|
if ($commands->{"a"} || $commands->{"t"}) { |
||||
|
print "#####$argument.preinst#####\n\n"; |
||||
|
open (LIST,"$preinst"); |
||||
|
while (<LIST>) { |
||||
|
print $_; |
||||
|
} |
||||
|
} |
||||
|
else { |
||||
|
open (LIST,"$preinst"); |
||||
|
while (<LIST>) { |
||||
|
print $_; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
if ($commands->{"postinst"}) { |
||||
|
if (defined "$parent$base/info/$argument.postinst") { |
||||
|
$postinst = "$parent$base/info/$argument.postinst"; |
||||
|
} |
||||
|
if (-e $postinst) { |
||||
|
if ($commands->{"a"} || $commands->{"t"}) { |
||||
|
print "#####$argument.postinst#####\n\n"; |
||||
|
open (LIST,"$postinst"); |
||||
|
while (<LIST>) { |
||||
|
print $_; |
||||
|
} |
||||
|
} |
||||
|
else { |
||||
|
open (LIST,"$postinst"); |
||||
|
while (<LIST>) { |
||||
|
print $_; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
if ($commands->{"prerm"}) { |
||||
|
if (defined "$parent$base/info/$argument.prerm") { |
||||
|
$prerm = "$parent$base/info/$argument.prerm"; |
||||
|
} |
||||
|
if (-e $prerm) { |
||||
|
if ($commands->{"a"} || $commands->{"t"}) { |
||||
|
print "#####$argument.prerm#####\n\n"; |
||||
|
open (LIST,"$prerm"); |
||||
|
while (<LIST>) { |
||||
|
print $_; |
||||
|
} |
||||
|
} |
||||
|
else { |
||||
|
open (LIST,"$prerm"); |
||||
|
while (<LIST>) { |
||||
|
print $_; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
if ($commands->{"postrm"}) { |
||||
|
if (defined "$parent$base/info/$argument.postrm") { |
||||
|
$postrm = "$parent$base/info/$argument.postrm"; |
||||
|
} |
||||
|
if (-e $postrm) { |
||||
|
if ($commands->{"a"} || $commands->{"t"}) { |
||||
|
print "#####$argument.postrm#####\n\n"; |
||||
|
open (LIST,"$postrm"); |
||||
|
while (<LIST>) { |
||||
|
print $_; |
||||
|
} |
||||
|
} |
||||
|
else { |
||||
|
open (LIST,"$postrm"); |
||||
|
while (<LIST>) { |
||||
|
print $_; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
if (!$commands->{"i"}) { |
||||
|
if (defined $orig_argument) { |
||||
|
$argument = $orig_argument; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
} # end sub scripts |
||||
|
|
||||
|
# show the scripts for /usr/lib/menu |
||||
|
sub menu { |
||||
|
|
||||
|
my ($commands) = @_; |
||||
|
my %commands = %$commands; |
||||
|
|
||||
|
my $filelist; |
||||
|
my $orig_argument = $argument; |
||||
|
my %parent; |
||||
|
|
||||
|
if ($commands->{"n"}) { |
||||
|
print "swim: no menu for not-installed, consider --diff\n"; exit; |
||||
|
} |
||||
|
|
||||
|
dbi(\%commands); |
||||
|
|
||||
|
|
||||
|
if ($argument =~ /_/) { |
||||
|
$orig_argument = $argument; |
||||
|
my $check = $db{"$argument"}; |
||||
|
$argument =~ m,(^.*)_(.*$),; |
||||
|
if (defined $check) { |
||||
|
$argument = $1; |
||||
|
} |
||||
|
else {}; |
||||
|
} |
||||
|
untie %db; |
||||
|
|
||||
|
if (defined $argument) { |
||||
|
if (-e "$parent$base/info/$argument.list") { |
||||
|
$filelist = "$parent$base/info/$argument.list"; |
||||
|
} |
||||
|
if (defined $filelist) { |
||||
|
# basically, re-find file/package passed to previous sub |
||||
|
open(FINDMENU,"$filelist"); |
||||
|
while (<FINDMENU>) { |
||||
|
chomp; |
||||
|
if (m,^\/usr\/lib\/menu\/(.*[\w-\+\.]),) { |
||||
|
if (!-d) { |
||||
|
print "#####menu for $orig_argument($1)#####\n"; |
||||
|
open(MENU,"$_"); |
||||
|
while (<MENU>) { |
||||
|
print; |
||||
|
} |
||||
|
print "\n"; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
close(FINDMENU); |
||||
|
close(MENU); |
||||
|
} |
||||
|
} # defined |
||||
|
|
||||
|
if (!$commands->{"i"}) { |
||||
|
$argument = $orig_argument; |
||||
|
} |
||||
|
|
||||
|
} # end sub menu |
||||
|
|
||||
|
|
||||
|
# Show changelog, default zcat. This will show all the changelogs in |
||||
|
# the directory /usr/doc/package_name/, there are cases where there is |
||||
|
# a debian.changelog and one provided by the individual(s) working on the |
||||
|
# software, as well as a variety of other cases. |
||||
|
sub changelog { |
||||
|
|
||||
|
my ($commands) = @_; |
||||
|
my %commands = %$commands; |
||||
|
|
||||
|
my $file; |
||||
|
my $orig_argument = $argument; |
||||
|
|
||||
|
if ($commands->{"n"}) { |
||||
|
print "swim: no changelog for not-installed, consider --diff\n"; exit; |
||||
|
} |
||||
|
|
||||
|
dbi(\%commands); |
||||
|
|
||||
|
if ($argument =~ /_/) { |
||||
|
$orig_argument = $argument; |
||||
|
my $check = $db{"$argument"}; |
||||
|
$argument =~ m,(^.*)_(.*$),; |
||||
|
if (defined $check) { |
||||
|
$argument = $1; |
||||
|
} |
||||
|
else {}; |
||||
|
} |
||||
|
untie %db; |
||||
|
|
||||
|
|
||||
|
# Using swim -qadt | grep -i change it looks like all the files which |
||||
|
# have change in their name are changelogs when in /usr/doc/$argument, |
||||
|
# sometimes there are more above, but these are the most significant. |
||||
|
my @fsstnd; |
||||
|
if (-e "$parent/usr/doc/$argument" && |
||||
|
-d "$parent/usr/doc/$argument") { |
||||
|
my $directory = "$parent/usr/doc/$argument"; |
||||
|
opendir(CHANGE, "$directory") || die "I thought it existed"; |
||||
|
my @change = sort grep(/change/i, readdir(CHANGE)); |
||||
|
closedir(CHANGE); |
||||
|
foreach (@change) { |
||||
|
if (m,\.gz$,i) { |
||||
|
push(@fsstnd,$_); |
||||
|
print "#####$_ for $argument#####\n\n"; |
||||
|
open(ZCAT,"|$zcat") || die "swim: this option requires zcat"; |
||||
|
open(CHANGELOG, "$directory/$_"); |
||||
|
while (<CHANGELOG>) { |
||||
|
print ZCAT $_; |
||||
|
} |
||||
|
close(ZCAT); |
||||
|
close(CHANGELOG); |
||||
|
print "\n"; |
||||
|
} |
||||
|
elsif ($_ !~ m,html$|htm$|ps$|dvi$|sgml$|gs$,) { |
||||
|
push(@fsstnd,$_); |
||||
|
print "#####$_ for $argument#####\n\n"; |
||||
|
open(CHANGELOG, "$directory/$_"); |
||||
|
while (<CHANGELOG>) { |
||||
|
print "$_"; |
||||
|
} |
||||
|
close(CHANGELOG); |
||||
|
print "\n"; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
if (-e "$parent/usr/share/doc/$argument" && |
||||
|
-d "$parent/usr/share/doc/$argument") { |
||||
|
my $directory = "$parent/usr/share/doc/$argument"; |
||||
|
opendir(CHANGE, "$directory") || die "I thought it existed"; |
||||
|
my @change = sort grep(/change/i, readdir(CHANGE)); |
||||
|
closedir(CHANGE); |
||||
|
foreach (@change) { |
||||
|
if (m,\.gz$,i) { |
||||
|
my $cf = grep(m,^$_$,,@fsstnd); |
||||
|
if ($cf == 0 ) { |
||||
|
print "#####$_ for $argument#####\n\n"; |
||||
|
open(ZCAT,"|$zcat") || die "swim: this option requires zcat"; |
||||
|
open(CHANGELOG, "$directory/$_"); |
||||
|
while (<CHANGELOG>) { |
||||
|
print ZCAT $_; |
||||
|
} |
||||
|
close(ZCAT); |
||||
|
close(CHANGELOG); |
||||
|
print "\n"; |
||||
|
} |
||||
|
} |
||||
|
elsif ($_ !~ m,html$|htm$|ps$|dvi$|sgml$|gs$,) { |
||||
|
my $cf = grep(m,^$_$,,@fsstnd); |
||||
|
if ($cf == 0 ) { |
||||
|
print "#####$_ for $argument#####\n\n"; |
||||
|
open(CHANGELOG, "$directory/$_"); |
||||
|
while (<CHANGELOG>) { |
||||
|
print "$_"; |
||||
|
} |
||||
|
close(CHANGELOG); |
||||
|
print "\n"; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
if (!$commands->{"i"}) { |
||||
|
$argument = $orig_argument; |
||||
|
} |
||||
|
|
||||
|
} # end sub changelog |
||||
|
|
||||
|
# Show copyright, default zcat. This will show all the copyrights in |
||||
|
# the directory /usr/doc/package_name/. Rather than passing the |
||||
|
# greped argument to changelog(), this subroutine was created instead which |
||||
|
# keeps things sensible. |
||||
|
sub copyright { |
||||
|
|
||||
|
my $file; |
||||
|
my $orig_argument = $argument; |
||||
|
|
||||
|
my ($commands) = @_; |
||||
|
my %commands = %$commands; |
||||
|
|
||||
|
|
||||
|
if ($commands->{"n"}) { |
||||
|
print "swim: no copyright for not-installed, consider --diff\n"; exit; |
||||
|
} |
||||
|
|
||||
|
dbi(\%commands); |
||||
|
|
||||
|
|
||||
|
if ($argument =~ /_/) { |
||||
|
$orig_argument = $argument; |
||||
|
my $check = $db{"$argument"}; |
||||
|
$argument =~ m,(^.*)_(.*$),; |
||||
|
if (defined $check) { |
||||
|
$argument = $1; |
||||
|
} |
||||
|
else {}; |
||||
|
} |
||||
|
untie %db; |
||||
|
|
||||
|
|
||||
|
# Using swim -qadt | grep -i copy it looks like all the files which |
||||
|
# have copy in their name are generally copyrights when in |
||||
|
# /usr/doc/$argument, sometimes there are more above, but these are |
||||
|
# the most significant. |
||||
|
my @fsstnd; |
||||
|
if (-e "$parent/usr/doc/$argument" && |
||||
|
-d "$parent/usr/doc/$argument") { |
||||
|
my $directory = "$parent/usr/doc/$argument"; |
||||
|
opendir(CHANGE, "$directory") || die "I thought it existed"; |
||||
|
my @change = sort grep(/copy|license/i, readdir(CHANGE)); |
||||
|
closedir(CHANGE); |
||||
|
foreach (@change) { |
||||
|
if (defined $_) { |
||||
|
if (m,\.gz$,i) { |
||||
|
push(@fsstnd,$_); |
||||
|
print "#####$_ for $orig_argument#####\n\n"; |
||||
|
open(ZCAT,"|$zcat") || die "swim: this option requires zcat"; |
||||
|
open(COPYRIGHT, "$directory/$_"); |
||||
|
while (<COPYRIGHT>) { |
||||
|
print ZCAT $_; |
||||
|
} |
||||
|
# Sometimes these next two mysteriously open, and don't close |
||||
|
# even when no previous gz file was found, causing error output, |
||||
|
# but doesn't effect what's trying to be accomplished. Doesn't |
||||
|
# happen with changelog(). |
||||
|
close(ZCAT); |
||||
|
close(COPYRIGHT); |
||||
|
print "\n"; |
||||
|
} |
||||
|
elsif ($_ !~ m,html$|htm$|ps$|dvi$|sgml$|gs$,) { |
||||
|
push(@fsstnd,$_); |
||||
|
print "#####$_ for $orig_argument#####\n\n"; |
||||
|
open(COPYRIGHT, "$directory/$_"); |
||||
|
while (<COPYRIGHT>) { |
||||
|
print "$_"; |
||||
|
} |
||||
|
close(COPYRIGHT); |
||||
|
print "\n"; |
||||
|
} |
||||
|
} # if defined |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
if (-e "$parent/usr/share/doc/$argument" && |
||||
|
-d "$parent/usr/share/doc/$argument") { |
||||
|
my $directory = "$parent/usr/share/doc/$argument"; |
||||
|
opendir(CHANGE, "$directory") || die "I thought it existed"; |
||||
|
my @change = sort grep(/copy|license/i, readdir(CHANGE)); |
||||
|
closedir(CHANGE); |
||||
|
foreach (@change) { |
||||
|
if (defined $_) { |
||||
|
if (m,\.gz$,i) { |
||||
|
my $cf = grep(m,^$_$,,@fsstnd); |
||||
|
if ($cf == 0 ) { |
||||
|
print "#####$_ for $orig_argument#####\n\n"; |
||||
|
open(ZCAT,"|$zcat") || die "swim: this option requires zcat"; |
||||
|
open(COPYRIGHT, "$directory/$_"); |
||||
|
while (<COPYRIGHT>) { |
||||
|
print ZCAT $_; |
||||
|
} |
||||
|
# Sometimes these next two mysteriously open, and don't close |
||||
|
# even when no previous gz file was found, causing error output, |
||||
|
# but doesn't effect what's trying to be accomplished. Doesn't |
||||
|
# happen with changelog(). |
||||
|
close(ZCAT); |
||||
|
close(COPYRIGHT); |
||||
|
print "\n"; |
||||
|
} |
||||
|
} |
||||
|
elsif ($_ !~ m,html$|htm$|ps$|dvi$|sgml$|gs$,) { |
||||
|
my $cf = grep(m,^$_$,,@fsstnd); |
||||
|
if ($cf == 0 ) { |
||||
|
print "#####$_ for $orig_argument#####\n\n"; |
||||
|
open(COPYRIGHT, "$directory/$_"); |
||||
|
while (<COPYRIGHT>) { |
||||
|
print "$_"; |
||||
|
} |
||||
|
close(COPYRIGHT); |
||||
|
print "\n"; |
||||
|
} |
||||
|
} |
||||
|
} # if defined |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
if (!$commands->{"i"}) { |
||||
|
$argument = $orig_argument; |
||||
|
} |
||||
|
|
||||
|
} # end copyright |
||||
|
|
||||
|
# process the database for the configuration files |
||||
|
sub conf { |
||||
|
|
||||
|
my ($commands) = @_; |
||||
|
my %commands = %$commands; |
||||
|
|
||||
|
# added for -xyz, but not necessary |
||||
|
if (defined $argument) { |
||||
|
if ($argument !~ /_/) { |
||||
|
if (defined $db{$argument}) { |
||||
|
$argument = $db{$argument}; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
if (!$commands->{"n"}) { |
||||
|
dbi(\%commands); |
||||
|
} |
||||
|
else {} |
||||
|
if (defined $argument) { |
||||
|
my $conf = $argument . "CONF"; |
||||
|
if (defined $db{$conf}) { |
||||
|
return $db{$conf}; |
||||
|
} |
||||
|
else { return 0; } |
||||
|
} |
||||
|
untie %db; |
||||
|
} # end sub conf |
||||
|
|
||||
|
# shared libraries provided by the package |
||||
|
sub shlibs { |
||||
|
|
||||
|
my ($commands) = @_; |
||||
|
my %commands = %$commands; |
||||
|
|
||||
|
my $shlibs; |
||||
|
my $orig_argument; |
||||
|
|
||||
|
if ($commands->{"n"}) { |
||||
|
print "catswim: no shlibs for not-installed, consider --diff\n"; exit; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
dbi(\%commands); |
||||
|
|
||||
|
if (defined $argument) { |
||||
|
if ($argument =~ /_/) { |
||||
|
$orig_argument = $argument; |
||||
|
my $check; |
||||
|
if (defined $db{"$argument"}) { |
||||
|
$check = $db{"$argument"}; |
||||
|
} |
||||
|
$argument =~ m,(^.*)_(.*$),; |
||||
|
if (defined $check) { |
||||
|
$argument = $1; |
||||
|
} |
||||
|
else {} |
||||
|
} |
||||
|
else { |
||||
|
$orig_argument = $argument; |
||||
|
} |
||||
|
} |
||||
|
untie %db; |
||||
|
|
||||
|
if (defined $argument) { |
||||
|
if (-e "$parent$base/info/$argument.shlibs") { |
||||
|
$shlibs = "$parent$base/info/$argument.shlibs"; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
if (defined $shlibs) { |
||||
|
print "Shlibs:\n"; |
||||
|
open(SHLIBS,"$shlibs"); |
||||
|
while (<SHLIBS>) { |
||||
|
if ($_ !~ m,^\n$,) { |
||||
|
print; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
$argument = $orig_argument; |
||||
|
|
||||
|
} # end sub shlibs |
||||
|
|
||||
|
|
||||
|
1; |
@ -0,0 +1,144 @@ |
|||||
|
# Package administration and research tool for Debian |
||||
|
# Copyright (C) 1999-2000 Jonathan D. Rosenbaum |
||||
|
|
||||
|
# This program 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. |
||||
|
|
||||
|
# This program 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 this program; if not, write to the Free Software |
||||
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
||||
|
|
||||
|
|
||||
|
package SWIM::Library; |
||||
|
use strict; |
||||
|
use SWIM::Conf; |
||||
|
use SWIM::Global; |
||||
|
use vars qw(@ISA @EXPORT); |
||||
|
|
||||
|
use Exporter; |
||||
|
@ISA = qw(Exporter); |
||||
|
@EXPORT = qw(which_archdist finddb root compress_contents); |
||||
|
|
||||
|
|
||||
|
# functions which do not use DB_File which_archdist() finddb() root() |
||||
|
|
||||
|
# which archictecture and distribution does this database involve |
||||
|
sub which_archdist { |
||||
|
|
||||
|
my ($commands) = @_; |
||||
|
|
||||
|
my ($arch,$dist); |
||||
|
#if ($commands->{"initndb"} || $commands->{"rebuildndb"}) { |
||||
|
if ($commands->{"arch"}) { |
||||
|
$arch = "-" . $commands->{"arch"}; |
||||
|
} |
||||
|
else { |
||||
|
$arch = "-$architecture"; |
||||
|
} |
||||
|
|
||||
|
if ($commands->{"dists"}) { |
||||
|
$dist = "-" . $commands->{"dists"}; |
||||
|
} |
||||
|
else { |
||||
|
$dist = "-$distribution"; |
||||
|
} |
||||
|
return ($arch,$dist); |
||||
|
# } |
||||
|
|
||||
|
} # end sub which_archdist |
||||
|
|
||||
|
|
||||
|
# finding any database |
||||
|
sub finddb { |
||||
|
|
||||
|
my ($commands) = @_; |
||||
|
|
||||
|
my $fileplace; |
||||
|
|
||||
|
if (($commands->{"dbpath"} && $commands->{"root"}) || |
||||
|
($commands->{"dbpath"} && !$commands->{"root"}) || |
||||
|
(!$commands->{"dbpath"} && !$commands->{"root"})) { |
||||
|
$fileplace = "$parent$library"; |
||||
|
return $fileplace; |
||||
|
} |
||||
|
elsif (!$commands->{"dbpath"} && $commands->{"root"}) { |
||||
|
$fileplace = "$parent$base"; |
||||
|
return $fileplace; |
||||
|
} |
||||
|
|
||||
|
} # end sub finddb |
||||
|
|
||||
|
# This gives the option to be able to used -d & -l, but not -f, by only |
||||
|
# copying Contents over to contentsindex*.deb.gz. This the fast way. |
||||
|
sub compress_contents { |
||||
|
|
||||
|
my ($Contents,$commands) = @_; |
||||
|
my %commands = %$commands; |
||||
|
my $contentsdb = finddb(\%commands); |
||||
|
my($arch,$dist) = which_archdist(\%commands); |
||||
|
my $contentsindex = "$contentsdb/ncontentsindex$arch$dist.deb"; |
||||
|
my ($contentsindexgz, $mtime); |
||||
|
if (-e "$contentsdb/ncontentsindex$arch$dist.deb.gz") { |
||||
|
$contentsindexgz = "$contentsdb/ncontentsindex$arch$dist.deb.gz"; |
||||
|
$mtime = (stat("$contentsindexgz"))[9]; |
||||
|
} |
||||
|
else { |
||||
|
$contentsindexgz = "$contentsdb/ncontentsindex$arch$dist.deb.gz"; |
||||
|
} |
||||
|
|
||||
|
my $ex; |
||||
|
my $Contents_mtime = (stat("$Contents"))[9]; |
||||
|
my $BContents = $Contents; |
||||
|
$Contents = -B $Contents || $Contents =~ m,\.(gz|Z)$, ? |
||||
|
"$gzip -dc $Contents|" : "cat $Contents|"; |
||||
|
if (defined $mtime) { |
||||
|
if ($mtime == $Contents_mtime) { |
||||
|
print "Same Contents files, won't compress\n"; |
||||
|
exit if !$commands->{"ndb"}; |
||||
|
$ex = "stop"; |
||||
|
} |
||||
|
else { |
||||
|
unlink($contentsindexgz); |
||||
|
} |
||||
|
} |
||||
|
if (!defined $ex) { |
||||
|
print "Copying new Contents\n"; |
||||
|
#system $copy, $BContents, $contentsindexgz; |
||||
|
|
||||
|
# changed for >= 0.2.9 |
||||
|
# changed again >= 0.3.4 |
||||
|
open(CONTENTS, "$Contents") or die "where is it?\n"; |
||||
|
open(CONTENTSDB,">$contentsindex"); |
||||
|
while (<CONTENTS>) { |
||||
|
##if (/^FILE\s*LOCATION$/) { |
||||
|
##while (<CONTENTS>) { |
||||
|
s,^(\./)+,,; # filter for Debians altered dir structure |
||||
|
print CONTENTSDB $_; |
||||
|
##} |
||||
|
##} |
||||
|
} |
||||
|
print "Compressing Contents\n"; |
||||
|
# added -f just in case |
||||
|
system "$gzip", "-f", "-9", "$contentsindex"; |
||||
|
utime(time,$Contents_mtime,$contentsindexgz); |
||||
|
} |
||||
|
|
||||
|
} # end sub compress_contents |
||||
|
|
||||
|
# for / files |
||||
|
sub root { |
||||
|
|
||||
|
if ($argument eq "/") { |
||||
|
$argument = "/."; |
||||
|
} |
||||
|
} # end sub root |
||||
|
|
||||
|
|
||||
|
1; |
@ -0,0 +1,268 @@ |
|||||
|
# Package administration and research tool for Debian |
||||
|
# Copyright (C) 1999-2000 Jonathan D. Rosenbaum |
||||
|
|
||||
|
# This program 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. |
||||
|
|
||||
|
# This program 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 this program; if not, write to the Free Software |
||||
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
||||
|
|
||||
|
|
||||
|
package SWIM::MD; |
||||
|
use strict; |
||||
|
use SWIM::Conf qw(:Path $splt); |
||||
|
use SWIM::DB_Library qw(:Md); |
||||
|
use SWIM::Library; |
||||
|
use SWIM::Global; |
||||
|
use vars qw(@ISA @EXPORT %EXPORT_TAGS); |
||||
|
use Exporter; |
||||
|
@ISA = qw(Exporter); |
||||
|
@EXPORT = qw(process_md); |
||||
|
|
||||
|
# process_md used by both SWIM::DB_Init and SWIM::NDB_Init |
||||
|
|
||||
|
=pod |
||||
|
|
||||
|
Because many files and directories exist more than once, and it would be |
||||
|
kind of cool to go up to a directory /usr/bin or /usr/bin/ and do a |
||||
|
swim -qf and see all the packages that populate that directory... |
||||
|
multi-dimensional is the way to go. |
||||
|
|
||||
|
=cut |
||||
|
|
||||
|
sub process_md { |
||||
|
|
||||
|
print "File Database is being made\n"; |
||||
|
|
||||
|
my ($commands) = @_; |
||||
|
my %commands = %$commands; |
||||
|
my @ppackage; |
||||
|
my %md; |
||||
|
my @md; |
||||
|
my @mi; |
||||
|
my $thingy; |
||||
|
my @name; |
||||
|
my $count = 0; |
||||
|
my $count1 = 1; |
||||
|
|
||||
|
my($place) = finddb(\%commands); |
||||
|
|
||||
|
# Let's determine what architecture and distribution this person is |
||||
|
# interested in. |
||||
|
my ($arch, $dist, $not); |
||||
|
if ($commands->{"initndb"} || $commands->{"rebuildndb"}) { |
||||
|
($arch,$dist) = which_archdist(\%commands); |
||||
|
$not = "n"; |
||||
|
} |
||||
|
else { |
||||
|
$arch = ""; |
||||
|
$dist = ""; |
||||
|
$not = ""; |
||||
|
} |
||||
|
my $fileindex = $not . "fileindex"; |
||||
|
|
||||
|
|
||||
|
# Now we process the files made from the massive array, and create |
||||
|
# fileindex.deb or nfileindex.deb |
||||
|
# Let's just use split, and will allow for customized line adj. |
||||
|
# 25000 is the default |
||||
|
if ($commands->{"split_data"}) { |
||||
|
my $split = $commands->{"split_data"}; |
||||
|
system("$splt -l $split $tmp/big.debian $tmp/DEBIAN"); |
||||
|
} |
||||
|
else { |
||||
|
# Seems like a good default |
||||
|
system("$splt -l 25000 $tmp/big.debian $tmp/DEBIAN"); |
||||
|
} |
||||
|
@ppackage = <$tmp/DEBIAN*>; |
||||
|
# It's unlikely this file will ever get too massive. |
||||
|
push(@ppackage, "$tmp/long.debian"); |
||||
|
print " Create the database\n"; |
||||
|
foreach $thingy (@ppackage) { |
||||
|
open(PARTS, "$thingy"); |
||||
|
while (<PARTS>) { |
||||
|
my @c; |
||||
|
@md = split(/ -> /,$_); |
||||
|
if (defined($md[1])) { |
||||
|
chomp $md[0]; |
||||
|
chomp $md[1]; |
||||
|
@c = split(/\s/, $md[1]); |
||||
|
} |
||||
|
push(@mi,$md[0]); |
||||
|
push(@mi,$md[1]); |
||||
|
} # while |
||||
|
print " $thingy\n"; |
||||
|
print " wait a few seconds\n"; |
||||
|
my $zing; |
||||
|
if (($commands->{"dbpath"} && $commands->{"root"}) || |
||||
|
($commands->{"dbpath"} && !$commands->{"root"}) || |
||||
|
(!$commands->{"dbpath"} && !$commands->{"root"})) { |
||||
|
$zing = tie %md, 'DB_File',"$parent$library/$fileindex$arch$dist.deb" |
||||
|
or die "DB_File: $!"; |
||||
|
} |
||||
|
elsif (!$commands->{"dbpath"} && $commands->{"root"}) { |
||||
|
$zing = tie %md, 'DB_File',"$parent$base/$fileindex$arch$dist.deb" |
||||
|
or die "DB_File: $!"; |
||||
|
} |
||||
|
while ($count <= $#mi) { |
||||
|
$zing->put($mi[$count], $mi[$count1]); |
||||
|
$count = $count + 2; |
||||
|
$count1 = $count1 + 2; |
||||
|
} |
||||
|
undef $zing; |
||||
|
untie %md; |
||||
|
undef %md; |
||||
|
@mi = (); |
||||
|
@md = (); |
||||
|
$count = 0; |
||||
|
$count1 = 1; |
||||
|
close(PARTS); |
||||
|
} # end foreach |
||||
|
|
||||
|
# now we get to take into account deinstall:ok:config-files |
||||
|
# situations for an installed system. |
||||
|
if ($commands->{"initdb"} || $commands->{"rebuilddb"}) { |
||||
|
sb(\%$commands); ib(\%commands); my $yich; |
||||
|
foreach (values %sb) { |
||||
|
my $zit; my ($nit,$yit) = (split(/\s/,$_))[0,3]; |
||||
|
if ($yit eq "deinstall:ok:config-files" || |
||||
|
$yit eq "purge:ok:config-files") { |
||||
|
($zit = $nit) =~ s,\+,\\\+,; |
||||
|
if ($ib{"/."} !~ m,$zit,) { |
||||
|
if (!defined $yich) { |
||||
|
$yich = $nit; |
||||
|
} |
||||
|
else { |
||||
|
$yich = $yich . " $nit"; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
$ib{"/."} = $ib{"/."} . " $yich"; |
||||
|
} |
||||
|
|
||||
|
# after much experimentation it turns out that a flat text file |
||||
|
# is much faster for this particular application. This also |
||||
|
# creates the hash database reference for -db or -i. |
||||
|
my $searchindex = $not . "searchindex"; |
||||
|
open(FLATFILE, ">$place/$searchindex$arch$dist.deb"); |
||||
|
print "Create the powersearch flat database\n"; |
||||
|
foreach $thingy (@ppackage) { |
||||
|
if ($thingy ne "$tmp/long.debian") { |
||||
|
open(PARTS, "$thingy"); |
||||
|
while (<PARTS>) { |
||||
|
@md = split(/ -> /,$_); |
||||
|
if (defined($md[1])) { |
||||
|
chomp $md[0]; |
||||
|
} |
||||
|
push(@mi,$md[0]); |
||||
|
} # while |
||||
|
} |
||||
|
print " $thingy\n"; |
||||
|
print " wait a few seconds\n"; |
||||
|
while ($count <= $#mi) { |
||||
|
print FLATFILE "$mi[$count]\n"; |
||||
|
$count++; |
||||
|
} |
||||
|
$count = 0; |
||||
|
@mi = (); |
||||
|
@md = (); |
||||
|
close(PARTS); |
||||
|
} # end foreach |
||||
|
close(FLATFILE); |
||||
|
|
||||
|
# This creates the flatfile with the directories for --powersearch |
||||
|
# --dir, which is probably a rare match in most cases. This doesn't |
||||
|
# create a hash reference database for --db and -i because the only |
||||
|
# package which could benifit from this is base-files, but it has |
||||
|
# configuaration files, on the other hand RedHat has at least one |
||||
|
# package without directories or files, but this is Debian. |
||||
|
my $dirindex = $not . "dirindex"; |
||||
|
open(FLATFILE, ">$place/$dirindex$arch$dist.deb"); |
||||
|
print "Create the powersearch flat directory database\n"; |
||||
|
open(PARTS, "$ppackage[$#ppackage]"); |
||||
|
while (<PARTS>) { |
||||
|
@md = split(/ -> /,$_); |
||||
|
if (defined($md[1])) { |
||||
|
chomp $md[0]; |
||||
|
} |
||||
|
push(@mi,$md[0]); |
||||
|
} # while |
||||
|
print " $ppackage[$#ppackage]\n"; |
||||
|
while ($count <= $#mi) { |
||||
|
print FLATFILE "$mi[$count]\n"; |
||||
|
$count++; |
||||
|
} |
||||
|
$count = 0; |
||||
|
@mi = (); |
||||
|
@md = (); |
||||
|
close(PARTS); |
||||
|
close(FLATFILE); |
||||
|
|
||||
|
# compare nstatusindex*.deb to /. from nfileindex*.deb to find out if |
||||
|
# any of the packages in Packages weren't represented in the Contents |
||||
|
# file. This is different than the earlier report which shows packages |
||||
|
# which weren't in Packages but were in Contents. This list is kept, |
||||
|
# and used again in a future --ndb run to make the matches, if they |
||||
|
# exist. |
||||
|
if ($commands->{"initndb"} || $commands->{"rebuildndb"}) { |
||||
|
nsb(\%$commands); |
||||
|
nzing(\%commands); |
||||
|
my @fileindex = split(/\s/,$ib{"/."}); |
||||
|
my @statusindex = split(/\s/,$nsb{"/."}); |
||||
|
if ($#fileindex < $#statusindex) { |
||||
|
my $place = finddb(\%commands); |
||||
|
open(DIFF, ">$place/.packagesdiff$arch$dist.deb") |
||||
|
or warn "couldn't create diff file\n"; |
||||
|
my %uniques; |
||||
|
@uniques{@fileindex} = (); |
||||
|
foreach (@statusindex) { |
||||
|
# no sense putting non-US or experimental in here unless this |
||||
|
# is what is wanted. Only need to check for group non-us/* |
||||
|
if (!$commands->{"nue"}) { |
||||
|
my $name = (split(/_/,$_))[0]; |
||||
|
if (defined $nsb{$name}) { |
||||
|
next if (split(/\s/,$nsb{$name}))[1] =~ m,non-us,; |
||||
|
} |
||||
|
if ($dist eq "experimental") { |
||||
|
next; |
||||
|
} |
||||
|
} |
||||
|
elsif ($dist eq "experimental") { |
||||
|
if (!$commands->{"nue"}) { |
||||
|
my $name = (split(/_/,$_))[0]; |
||||
|
if (defined $nsb{$name}) { |
||||
|
next if (split(/\s/,$nsb{$name}))[1] =~ m,non-us,; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
print DIFF "$_\n" unless exists $uniques{$_}; |
||||
|
} |
||||
|
$zing->del("/."); |
||||
|
$zing->put("/.",$nsb{"/."}); |
||||
|
} |
||||
|
} # end if |
||||
|
|
||||
|
# Will unlink transfer.deb, big.debian, long.debian. |
||||
|
unlink(<$tmp/DEBIAN*>); |
||||
|
unlink("$tmp/transfer.deb"); |
||||
|
unlink("$tmp/big.debian"); |
||||
|
unlink("$tmp/long.debian"); |
||||
|
|
||||
|
|
||||
|
#!!! |
||||
|
print " over and out\n"; |
||||
|
print scalar(localtime), "\n"; |
||||
|
|
||||
|
} # end sub process_md |
||||
|
|
||||
|
|
||||
|
1; |
File diff suppressed because it is too large
@ -0,0 +1,251 @@ |
|||||
|
# Package administration and research tool for Debian |
||||
|
# Copyright (C) 1999-2000 Jonathan D. Rosenbaum |
||||
|
|
||||
|
# This program 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. |
||||
|
|
||||
|
# This program 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 this program; if not, write to the Free Software |
||||
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
||||
|
|
||||
|
package SWIM::NDB_File; |
||||
|
use strict; |
||||
|
use SWIM::DB_Library qw(ram_on); # nzing nsb |
||||
|
use SWIM::Library; |
||||
|
use SWIM::Global qw($argument); # %ib $zing %nsb |
||||
|
use SWIM::Conf qw($pwd $tmp); |
||||
|
use SWIM::Dir; |
||||
|
use SWIM::Ramdisk; |
||||
|
use vars qw(@ISA @EXPORT); |
||||
|
use Exporter; |
||||
|
@ISA = qw(Exporter); |
||||
|
@EXPORT = qw(noram ncontents_exist find_contents remove_add_nfile); |
||||
|
|
||||
|
# This program handles updating nfileindex-arch-dists.deb |
||||
|
|
||||
|
# This checks if the ramdisk is on, we will want to turn it off, if it is. |
||||
|
sub noram { |
||||
|
|
||||
|
my ($commands) = @_; |
||||
|
my %commands = %$commands; |
||||
|
my $ramdisk = ram_on(\%commands); |
||||
|
|
||||
|
if ($ramdisk eq "yes") { |
||||
|
my $what = "yes"; |
||||
|
$commands{"ramdiskoff"} = 1; |
||||
|
ramdisk(\%commands); |
||||
|
} # if ramdisk |
||||
|
|
||||
|
} # end sub nfile |
||||
|
|
||||
|
# This will set-up the argument for ncontents if it can be found. |
||||
|
sub ncontents_exist { |
||||
|
|
||||
|
my ($commands) = @_; |
||||
|
my %commands = %$commands; |
||||
|
my $contentsdb = finddb(\%commands); |
||||
|
my ($arch,$dist) = which_archdist(\%commands); |
||||
|
|
||||
|
|
||||
|
if (-e "$contentsdb/ncontentsindex$arch$dist.deb.gz") { |
||||
|
if (-e "$contentsdb/ndirindex$arch$dist.deb.gz") { |
||||
|
unlink("$contentsdb/ndirindex$arch$dist.deb.gz"); |
||||
|
} |
||||
|
if (-e "$contentsdb/nsearchindex$arch$dist.deb.gz") { |
||||
|
unlink("$contentsdb/nsearchindex$arch$dist.deb.gz"); |
||||
|
} |
||||
|
return " $contentsdb/ncontentsindex$arch$dist.deb.gz|"; |
||||
|
} |
||||
|
else { |
||||
|
return "no"; |
||||
|
} |
||||
|
|
||||
|
} # end sub ncontents_exist |
||||
|
|
||||
|
# Find where the new Contents is on the on the command line vs the old |
||||
|
# Contents database (when the FDB argument isn't used). |
||||
|
sub find_contents { |
||||
|
|
||||
|
my ($commands) = @_; |
||||
|
my %commands = %$commands; |
||||
|
|
||||
|
############ |
||||
|
# CONTENTS # |
||||
|
############ |
||||
|
# Figure out where Contents is |
||||
|
if ($commands->{"Contents"}) { |
||||
|
my ($Contents,$FDB); |
||||
|
for ($commands->{"Contents"}) { |
||||
|
|
||||
|
############### |
||||
|
# SITUATION 0 # |
||||
|
############### |
||||
|
# this doesn't work to well for anything less simple than ../../ |
||||
|
if (m,^\.\./|^\.\.$,) { |
||||
|
if ($_ !~ m,/[\w-+]+/[\.\$\^\+\?\*\[\]\w-]*$,) { |
||||
|
my $dd; tr/\/// ? ($dd = tr/\///) : ($dd = 1); |
||||
|
my @pwd = split(m,/,,$pwd); |
||||
|
s,\.\./,,g; |
||||
|
my $tpwd = ""; |
||||
|
for (1 .. $#pwd - $dd) { |
||||
|
$_ == 1 ? ($tpwd = "/$pwd[$_]") |
||||
|
: (x$tpwd = $tpwd . "/$pwd[$_]"); |
||||
|
} |
||||
|
$_ ne ".." ? ($Contents = "$tpwd/$_") : ($Contents = "$tpwd/"); |
||||
|
} |
||||
|
dir(\%commands); |
||||
|
fir(\%commands); |
||||
|
} |
||||
|
|
||||
|
############### |
||||
|
# SITUATION I # |
||||
|
############### |
||||
|
elsif ( m,\/,) { |
||||
|
$Contents = $_; |
||||
|
if ($Contents =~ m,^\.\/.*,) { |
||||
|
if ($pwd !~ m,^\/$,) { |
||||
|
$Contents =~ m,^\.([^\.].*$),; |
||||
|
$Contents = "$pwd$1"; |
||||
|
} |
||||
|
else { |
||||
|
$Contents =~ m,^\.([^\.].*$),; |
||||
|
$Contents = "$1"; |
||||
|
} |
||||
|
} |
||||
|
dir(\%commands); |
||||
|
fir(\%commands); |
||||
|
} |
||||
|
|
||||
|
################ |
||||
|
# SITUATION II # |
||||
|
################ |
||||
|
elsif ($pwd =~ m,^\/$,) { |
||||
|
$Contents = "/$_"; |
||||
|
dir(\%commands); |
||||
|
fir(\%commands); |
||||
|
} |
||||
|
|
||||
|
################# |
||||
|
# SITUATION III # |
||||
|
################# |
||||
|
else { |
||||
|
$Contents = "$pwd/$_"; |
||||
|
if ($Contents =~ m,\.$,) { |
||||
|
$Contents =~ m,(.*)\.$,; |
||||
|
$Contents = $1; |
||||
|
} |
||||
|
dir(\%commands); |
||||
|
fir(\%commands); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
return $Contents; |
||||
|
|
||||
|
} # if Contents |
||||
|
|
||||
|
} # end sub find_contents |
||||
|
|
||||
|
# figure out --df and remove from nfileindex-arch-dists.deb |
||||
|
sub remove_add_nfile { |
||||
|
|
||||
|
my ($argument,$Contents,$subject,$commands) = @_; |
||||
|
my %commands = %$commands; |
||||
|
#my $contentsdb = finddb(\%commands); |
||||
|
#my ($arch,$dist) = which_archdist(\%commands); |
||||
|
##nzing(\%commands); |
||||
|
|
||||
|
# the + solution |
||||
|
$argument =~ s,\+,\\\\+,g if $argument =~ m,\+,; |
||||
|
$Contents = "zgrep -E $argument\ $Contents"; |
||||
|
|
||||
|
my($dirfile,$package,@dirfile,%all,%again, |
||||
|
@package_match,@more_things,@file); |
||||
|
open(CONTENTSDB, "$Contents"); |
||||
|
while (<CONTENTSDB>) { |
||||
|
# changed for >= 0.2.9 |
||||
|
#if (/^FILE\s*LOCATION$/) { |
||||
|
#while (<CONTENTSDB>) { |
||||
|
######## |
||||
|
# --DF # |
||||
|
######## |
||||
|
$argument =~ s,\\\\+,\\\+,g if $argument =~ m,\+,; |
||||
|
if (m,$subject/$argument,) { |
||||
|
#if (m,\b$argument\b,) { |
||||
|
|
||||
|
###################### |
||||
|
# ENDS WITH / # |
||||
|
###################### |
||||
|
if (m,.*/\s+\w*,) { |
||||
|
($dirfile,$package) = split(/\s+/,$_,2); |
||||
|
if ($package !~ m,^[a-z0-9-]*/.*$|^[a-z0-9-]*/.*/.*$,) { |
||||
|
my @more_things = split(/\s+/,$package); |
||||
|
$package = $more_things[$#more_things]; |
||||
|
(my $backpackage = $package) =~ s,\+,\\+,g; |
||||
|
my @dirfile = split(/\s+$backpackage/,$_); |
||||
|
$dirfile = $dirfile[0]; |
||||
|
} |
||||
|
@dirfile = split(/\//,$dirfile); $dirfile =~ s,/$,,; |
||||
|
} |
||||
|
###################### |
||||
|
# DOESN'T END WITH / # |
||||
|
###################### |
||||
|
else { |
||||
|
($dirfile,$package) = split(/\s+/,$_,2); |
||||
|
if ($package !~ m,^[a-z0-9-]*/.*$|^[a-z0-9-]*/.*/.*$,) { |
||||
|
my @more_things = split(/\s+/,$package); |
||||
|
$package = $more_things[$#more_things]; |
||||
|
(my $backpackage = $package) =~ s,\+,\\+,g; |
||||
|
my @dirfile = split(/\s+$backpackage/,$_); |
||||
|
$dirfile = $dirfile[0]; |
||||
|
} |
||||
|
@dirfile = split(/\//,$dirfile); |
||||
|
} |
||||
|
########################### |
||||
|
# PROCESS INTO FILES/DIRS # |
||||
|
########################### |
||||
|
my ($count,$holder); |
||||
|
for ($count = 0; $count <= $#dirfile; $count++) { |
||||
|
if ($count == 0) { |
||||
|
$holder = "/$dirfile[$count]"; |
||||
|
my $again = "$dirfile[$count]"; |
||||
|
$again{$again}++; |
||||
|
#my $all = "/."; |
||||
|
#$all{$all}++; |
||||
|
#if ($all{$all} == 1) { |
||||
|
#print FILELIST "/.\n"; |
||||
|
#} |
||||
|
if ($again{$again} == 1) { |
||||
|
push(@file,"/$dirfile[$count]"); |
||||
|
#print FILELIST "/$dirfile[$count]\n"; |
||||
|
} |
||||
|
} |
||||
|
else { |
||||
|
$holder = $holder . "/$dirfile[$count]"; |
||||
|
my $again = "$holder"; |
||||
|
$again{$again}++; |
||||
|
if ($again{$again} == 1) { |
||||
|
push(@file,"$holder"); |
||||
|
#print FILELIST "$holder\n"; |
||||
|
} |
||||
|
} |
||||
|
} # end for |
||||
|
} |
||||
|
undef @package_match; |
||||
|
#} |
||||
|
#} |
||||
|
} # while |
||||
|
close(CONTENTSDB); |
||||
|
undef @more_things; undef @dirfile; undef %again; undef %all; |
||||
|
return @file; |
||||
|
|
||||
|
|
||||
|
} # end sub remove_nfile |
||||
|
|
||||
|
1; |
File diff suppressed because it is too large
@ -0,0 +1,97 @@ |
|||||
|
# Package administration and research tool for Debian |
||||
|
# Copyright (C) 1999-2000 Jonathan D. Rosenbaum |
||||
|
|
||||
|
# This program 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. |
||||
|
|
||||
|
# This program 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 this program; if not, write to the Free Software |
||||
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
||||
|
|
||||
|
|
||||
|
package SWIM::Pn_print; |
||||
|
use strict; |
||||
|
use SWIM::Global qw($argument); |
||||
|
use vars qw(@ISA @EXPORT); |
||||
|
use Exporter; |
||||
|
@ISA = qw(Exporter); |
||||
|
@EXPORT = qw(singular); |
||||
|
|
||||
|
|
||||
|
# There are times when it is good to print out the "package name_version" |
||||
|
# and there are times when it is unecessary. This sub tries to resolve |
||||
|
# these situations, basically it's printme() |
||||
|
sub singular { |
||||
|
|
||||
|
my ($commands) = @_; |
||||
|
my %commands = %$commands; |
||||
|
|
||||
|
# for files, dirs, or groups |
||||
|
if (($commands->{"f"} || $commands->{"dir"} || $commands->{"g"} || |
||||
|
$commands->{"q"}) && |
||||
|
!($commands->{"i"} || $commands->{"l"} || |
||||
|
$commands->{"df"} || $commands->{"d"} || $commands->{"c"} || |
||||
|
$commands->{"scripts"} || $commands->{"preinst"} || $commands->{"postinst"} || |
||||
|
$commands->{"prerm"} || $commands->{"postrm"} || $commands->{"T"} || |
||||
|
$commands->{"pre_depends"} || $commands->{"depends"} || |
||||
|
$commands->{"recommends"} || $commands->{"suggests"} || |
||||
|
$commands->{"provides"} || $commands->{"replaces"} || |
||||
|
$commands->{"conflicts"} || $commands->{"requires"} || |
||||
|
$commands->{"changelog"} || $commands->{"m"} || $commands->{"menu"} || |
||||
|
$commands->{"copyright"})) { |
||||
|
print "$argument\n"; |
||||
|
} |
||||
|
elsif (($commands->{"f"} || $commands->{"dir"} || $commands->{"g"} || |
||||
|
$commands->{"q"}) && |
||||
|
$commands {"c"} && !($commands->{"i"} || |
||||
|
$commands->{"df"} || $commands->{"d"} || $commands->{"l"} || |
||||
|
$commands->{"scripts"} || $commands->{"preinst"} || $commands->{"postinst"} || |
||||
|
$commands->{"prerm"} || $commands->{"postrm"} || $commands->{"T"} && |
||||
|
$commands->{"pre_depends"} || $commands->{"depends"} || |
||||
|
$commands->{"recommends"} || $commands->{"suggests"} || |
||||
|
$commands->{"provides"} || $commands->{"replaces"} || |
||||
|
$commands->{"conflicts"} || $commands->{"requires"} || |
||||
|
$commands->{"changelog"} || $commands->{"m"} || $commands->{"menu"} || |
||||
|
$commands->{"copyright"})) { |
||||
|
print "$argument\n"; |
||||
|
} |
||||
|
elsif (($commands->{"f"} || $commands->{"dir"} || $commands->{"g"} || |
||||
|
$commands->{"q"}) && |
||||
|
$commands {"c"} && $commands->{"d"} && |
||||
|
!($commands->{"i"} || $commands->{"df"} || $commands->{"l"} || |
||||
|
$commands->{"scripts"} || $commands->{"preinst"} || $commands->{"postinst"} || |
||||
|
$commands->{"prerm"} || $commands->{"postrm"} || $commands->{"T"} || |
||||
|
$commands->{"pre_depends"} || $commands->{"depends"} || |
||||
|
$commands->{"recommends"} || $commands->{"suggests"} || |
||||
|
$commands->{"provides"} || $commands->{"replaces"} || |
||||
|
$commands->{"conflicts"} || $commands->{"requires"} || |
||||
|
$commands->{"changelog"} || $commands->{"m"} || $commands->{"menu"} || |
||||
|
$commands->{"copyright"})) { |
||||
|
print "$argument\n"; |
||||
|
} |
||||
|
elsif (($commands->{"f"} || $commands->{"dir"} || $commands->{"g"} || |
||||
|
$commands->{"q"}) && |
||||
|
$commands {"c"} && ($commands->{"d"} || |
||||
|
$commands->{"l"}) && !($commands->{"i"} || $commands->{"df"} || |
||||
|
$commands->{"scripts"} || $commands->{"preinst"} || $commands->{"postinst"} || |
||||
|
$commands->{"prerm"} || $commands->{"postrm"} || $commands->{"T"} || |
||||
|
$commands->{"pre_depends"} || $commands->{"depends"} || |
||||
|
$commands->{"recommends"} || $commands->{"suggests"} || |
||||
|
$commands->{"provides"} || $commands->{"replaces"} || |
||||
|
$commands->{"conflicts"} || $commands->{"requires"} || |
||||
|
$commands->{"changelog"} || $commands->{"m"} || $commands->{"menu"} || |
||||
|
$commands->{"copyright"})) { |
||||
|
print "$argument\n"; |
||||
|
} |
||||
|
|
||||
|
} # end sub singular |
||||
|
|
||||
|
|
||||
|
1; |
@ -0,0 +1,951 @@ |
|||||
|
# Package administration and research tool for Debian |
||||
|
# Copyright (C) 1999-2000 Jonathan D. Rosenbaum |
||||
|
|
||||
|
# This program 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. |
||||
|
|
||||
|
# This program 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 this program; if not, write to the Free Software |
||||
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
||||
|
|
||||
|
|
||||
|
package SWIM::Qftp; |
||||
|
use strict; |
||||
|
use SWIM::Conf; |
||||
|
use SWIM::Global qw(@PACKAGES $argument %db); |
||||
|
use SWIM::DB_Library qw(:Xyz); |
||||
|
use SWIM::Deb qw(md5sumo); |
||||
|
use vars qw(@ISA @EXPORT); |
||||
|
use Net::FTP; |
||||
|
use SWIM::F; |
||||
|
use Exporter; |
||||
|
@ISA = qw(Exporter); |
||||
|
@EXPORT = qw(qftp); |
||||
|
|
||||
|
|
||||
|
=pod |
||||
|
|
||||
|
This is the ftp client when --ftp is called with -q, --search/--ps. The |
||||
|
downloaded packages are put in the Default directory (DF) in a directory |
||||
|
mirroring (in a way relative to the design of swim) the dists structure |
||||
|
which is standard with Debian. This is desirable if a person wants to mirror |
||||
|
parts of a remote ftp site above the |
||||
|
default_directory/default_root_directory/; this also makes it easy for a |
||||
|
person to make their own distribution if they want, and apt can be used to |
||||
|
install the packages at a later time by temporarily placing them in |
||||
|
/var/cache/apt/archives using --df2apt. Obviously, this is nicer than using |
||||
|
apt just to download the packages, but the --nz option (apt) is provided |
||||
|
just in case a person is too lazed to do the -T thing, then they can do the |
||||
|
--apt2df thingy to move the packages from /var/cache/apt/archives to the |
||||
|
appropriate place in the DF. Ofcourse, maybe the -T thing was what the |
||||
|
person didn't want to do, or maybe the person wants to do a combination of |
||||
|
both (like something in the -T apt doesn't care about), this would be an |
||||
|
instance where --ftp would be more useful. The configuration file presents |
||||
|
a way to set this up so that the directory particular to the local ftpd can |
||||
|
be integrated into the DF. The DF can be given any unique named |
||||
|
directories, and the permisions of the directories created above can also be |
||||
|
specified. Other options to control the DF will be provided, and -h will be |
||||
|
available for querying the database pertaining to the packages in the DF, |
||||
|
thereby allowing manipulation of the packages in the DF. The database will |
||||
|
be made from Packages databases updated whenever the DF is called. There |
||||
|
will be two types of Packages, one pertaining to the state of the local |
||||
|
system, and the other pertaining to the state of the real distribution. |
||||
|
--file, and --http will also be integrated with DF when they become |
||||
|
available. |
||||
|
|
||||
|
IMPORTANT: Support will only be provided for not-installed databases, use a |
||||
|
not-installed database which reflects the currently installed package you |
||||
|
want to download in binary or source code. This is due to the fact that swim |
||||
|
thinks in terms of distribution states, and your installed system may |
||||
|
represent a combination of these things. The md5sum is currently checked |
||||
|
for packages, but not for source, if the md5sum data exists (not a new |
||||
|
debian-revision, for instance) the package will be checked. Whether or not |
||||
|
the package is OK it will be placed in it's appropriate place if it |
||||
|
downloads correctly. If you get FAILED, examine the package and alert |
||||
|
the |
||||
|
community (download place, what's wrong with the package), then delete the |
||||
|
package. |
||||
|
|
||||
|
=cut |
||||
|
sub qftp { |
||||
|
|
||||
|
my ($arg,$commands) = @_; |
||||
|
my %commands = %$commands; |
||||
|
|
||||
|
|
||||
|
# Although the /dists/... could be found with -i, it's simpler |
||||
|
# just to use name_versionFILENAME instead. People shouldn't |
||||
|
# edit --stdin to combine different distributions when doing --ftp, |
||||
|
# (note: ofcourse apt-cache dumpavail could be used, and |
||||
|
# ncontentsindex could be put together from many dbs) |
||||
|
# since swim can only figure out what distribution is wanted |
||||
|
# from the default value or the one provided on the command line. |
||||
|
# The same is true of using apt. Whatever package is |
||||
|
# provided to --stdin is assumed to be of the specified distribution, |
||||
|
# anyways. |
||||
|
if (!$commands->{"n"}) { |
||||
|
dbi(\%commands); |
||||
|
@PACKAGES = map($db{$_},(@PACKAGES = split(/\s/,$arg))); |
||||
|
} |
||||
|
else { |
||||
|
ndb(\%commands); |
||||
|
@PACKAGES = map($db{$_},(@PACKAGES = split(/\s/,$arg))) |
||||
|
} |
||||
|
|
||||
|
|
||||
|
my @LOCATION; |
||||
|
for (0 .. $#PACKAGES) { |
||||
|
if (!defined $PACKAGES[$_]) { |
||||
|
print "swim: specified package(s) not found in database\n"; |
||||
|
exit; |
||||
|
} |
||||
|
} |
||||
|
if (defined $db{$PACKAGES[0] . "FN"}) { |
||||
|
@LOCATION = map($db{$_ . "FN"},@PACKAGES); |
||||
|
} |
||||
|
else { |
||||
|
print "swim: incorrect database was specified\n"; |
||||
|
exit; |
||||
|
} |
||||
|
|
||||
|
# might as well check for a temporary directory for downloads, if it |
||||
|
# doesn't exist create it. |
||||
|
mkdir("$default_directory/partial",$permission) |
||||
|
if !-d "$default_directory/partial"; |
||||
|
|
||||
|
# Check if there is a sources.list specified |
||||
|
if (-e "$swim_conf/swimz.list") { |
||||
|
undef @FTP; |
||||
|
open(SOURCES,"$swim_conf/swimz.list") |
||||
|
or warn "swim: could not find swimz.list\n"; |
||||
|
while (<SOURCES>) { |
||||
|
if ($_ !~ m,#.*|^\s+,) { |
||||
|
chomp; push(@FTP,$_); |
||||
|
} |
||||
|
} |
||||
|
if ($#FTP == -1) { |
||||
|
print "swim: no sites specified in swimz.list, quiting\n"; |
||||
|
exit; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
# let's make unique sites |
||||
|
my (%site,@sites,$site); |
||||
|
foreach $site (@FTP) { |
||||
|
my @parts = split(' ', $site); |
||||
|
$parts[1] =~ m,^ftp:/+( (?: (?!/). ) *)(.*),sx; |
||||
|
$site{$1}++; |
||||
|
push(@sites,"$1!$site") if $site{$1} == 1; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
foreach $site (@sites) { |
||||
|
|
||||
|
# will provide all kinds of options for ftp..like firewall |
||||
|
|
||||
|
my $uri; ($site, $uri) = split(/!/,$site); |
||||
|
my $ftp = Net::FTP->new($site, |
||||
|
Debug => $debug, |
||||
|
Timeout => $timeout, |
||||
|
Passive => $passive, |
||||
|
Firewall => $firewall, |
||||
|
Port => $port |
||||
|
); |
||||
|
|
||||
|
########### |
||||
|
# CONNECT # |
||||
|
########### |
||||
|
if (defined $ftp) { |
||||
|
my $connected = $ftp->code(); |
||||
|
if ($connected == 220) { |
||||
|
print "swim: connected to $site\n"; |
||||
|
} |
||||
|
} |
||||
|
else { |
||||
|
print "swim: could not find $site\n"; |
||||
|
next; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
######### |
||||
|
# LOGIN # |
||||
|
######### |
||||
|
$ftp->login("anonymous","swim\@the.netpedia.net"); |
||||
|
my $logged = $ftp->code(); |
||||
|
# we are logged, but what is the time difference. |
||||
|
if ($logged == 230 || $logged == 332) { |
||||
|
print "swim: logged in to $site\n"; |
||||
|
$ftp->binary; |
||||
|
} |
||||
|
else { |
||||
|
# 530 "not logged in" will have to test this |
||||
|
$ftp->code(); |
||||
|
print "swim: not logged in to $site\n"; |
||||
|
next; |
||||
|
} |
||||
|
|
||||
|
# find the base to the distribution |
||||
|
my @parts = split(' ', $uri); |
||||
|
$parts[1] =~ m,^ftp:/+( (?: (?!/). ) *)(.*),sx; |
||||
|
my $base = $2; |
||||
|
|
||||
|
# this finds the base, but it only needs to be found once, ofcourse |
||||
|
# a foreach is totally unecessary unless the site has weird symlinks. |
||||
|
my @tryme_again; my $base_count = 0; |
||||
|
foreach (@FTP) { |
||||
|
next if $base_count == 1; |
||||
|
|
||||
|
############ |
||||
|
# SETUP # |
||||
|
############ |
||||
|
LOCUS: foreach (@LOCATION) { |
||||
|
m,(.*)/(.*)$,; |
||||
|
my $uptopackage = $1; |
||||
|
my $packagename = $2; my $packagen = $2; |
||||
|
$packagename =~ s,\+,\\\+,g; |
||||
|
my ($source_drd,$drd); |
||||
|
# make directories with permissions if they don't already exist |
||||
|
# and also establish standardized (swimy) debian-non-US and the |
||||
|
# appropriate symlinks |
||||
|
# if a non-US file is requested. |
||||
|
if ($uptopackage !~ /non-US/) { |
||||
|
if (!-d "$default_directory/$default_root_directory/$uptopackage") { |
||||
|
my $place = "$default_directory/$default_root_directory"; |
||||
|
my @DP = split(m,/,,$uptopackage); |
||||
|
my $placement = "/"; |
||||
|
for (0 .. $#DP) { |
||||
|
$_ == 0 ? ($placement = "/$DP[$_]") |
||||
|
: ($placement = $placement . "/" . $DP[$_]); |
||||
|
mkdir("$place$placement",$permission); |
||||
|
# will fix this later |
||||
|
# or warn "swim: could not create dists directory\n"; |
||||
|
# Ofcourse there is even a better fix. |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
#################### |
||||
|
# ################ # |
||||
|
# # NON-US FILES # # |
||||
|
# ################ # |
||||
|
#################### |
||||
|
else { |
||||
|
(my $above_drd = $uptopackage) =~ s,dists,,; |
||||
|
$above_drd =~ s,non-US/,,; |
||||
|
$source_drd = (split(m,/,,$above_drd))[1]; |
||||
|
($drd = $default_root_directory) =~ s,/debian,,; |
||||
|
if (!-e "$default_directory$drd/debian-non-US$above_drd") { |
||||
|
my $place = "$default_directory"; |
||||
|
my $create = "$drd/debian-non-US$above_drd"; |
||||
|
my @DP = split(m,/,,$create); |
||||
|
my $placement = "/"; |
||||
|
for (0 .. $#DP) { |
||||
|
$_ == 0 ? ($placement = "/$DP[$_]") |
||||
|
: ($placement = $placement . "/" . $DP[$_]); |
||||
|
mkdir("$place$placement",$permission) |
||||
|
or warn "swim: could not create debian-non-US directory\n"; |
||||
|
} |
||||
|
if (!-d "$default_directory$drd/debian-non-US/$source_drd/source") { |
||||
|
my $place = "$default_directory"; |
||||
|
my $create = "$drd/debian-non-US/$source_drd/source"; |
||||
|
my @DP = split(m,/,,$create); |
||||
|
my $placement = "/"; |
||||
|
for (0 .. $#DP) { |
||||
|
$_ == 0 ? ($placement = "/$DP[$_]") |
||||
|
: ($placement = $placement . "/" . $DP[$_]); |
||||
|
mkdir("$place$placement",$permission) |
||||
|
or warn "swim: could not create debian-non-US directory\n"; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
$place = "$default_directory$drd/debian-non-US"; |
||||
|
my $disty = (split(m,/,))[1]; $create = "/dists/$disty"; |
||||
|
undef @DP; |
||||
|
@DP = split(m,/,,$create); |
||||
|
for (0 .. $#DP) { |
||||
|
$_ == 0 ? ($placement = "/$DP[$_]") |
||||
|
: ($placement = $placement . "/" . $DP[$_]); |
||||
|
mkdir("$place$placement",$permission) |
||||
|
or warn "swim: could not create debian-non-US directory\n"; |
||||
|
} |
||||
|
|
||||
|
# make the symlinks |
||||
|
chdir("$place$placement"); |
||||
|
symlink("../../$disty","non-US"); |
||||
|
symlink("../../$disty/source","source"); |
||||
|
|
||||
|
$place = "$default_directory$drd/debian"; $create = "/dists/$disty"; |
||||
|
undef @DP; |
||||
|
@DP = split(m,/,,$create); |
||||
|
for (0 .. $#DP) { |
||||
|
$_ == 0 ? ($placement = "/$DP[$_]") |
||||
|
: ($placement = $placement . "/" . $DP[$_]); |
||||
|
mkdir("$place$placement",$permission) |
||||
|
or warn "swim: could not create debian-non-US directory\n"; |
||||
|
} |
||||
|
chdir("$place$placement"); |
||||
|
|
||||
|
# make more symlinks |
||||
|
symlink |
||||
|
("../../../debian-non-US/dists/$disty/non-US","non-US"); |
||||
|
} # if non-US dir !-e |
||||
|
} # end non-us |
||||
|
|
||||
|
|
||||
|
####### |
||||
|
# GET # |
||||
|
####### |
||||
|
my $file; |
||||
|
($packagen = $packagename) =~ s,\\\+,\+,g; |
||||
|
my $localfile = |
||||
|
"$default_directory/partial/$packagen"; |
||||
|
my $home = |
||||
|
"$default_directory/$default_root_directory/$_"; |
||||
|
my $size = $ftp->size("$base/$_"); |
||||
|
my $rmtime = $ftp->mdtm("$base/$_"); |
||||
|
my $file_exist = $ftp->code(); |
||||
|
######################### |
||||
|
# CHECK DEBIAN-REVISION # |
||||
|
######################### |
||||
|
# the way this is set up, it is assumed that something exists for |
||||
|
# the -(debian-revision). |
||||
|
if ($file_exist == 550) { |
||||
|
print "swim: $packagen does not exist on the server\n"; |
||||
|
print "swim: checking to see if the debian-revision has changed\n"; |
||||
|
$packagename =~ m,^(.*)-[\dA-Za-z\.\+]+\.deb$,; |
||||
|
my $matcher = $1; |
||||
|
$_ =~ m,^(.*)/$matcher[-\da-zA-Z\.\+]+\.deb$,; |
||||
|
my $otherthing = $1; |
||||
|
my $REVISIONCHANGE = $ftp->ls("$base/$uptopackage"); |
||||
|
my $singfile; |
||||
|
foreach (@{$REVISIONCHANGE}) { |
||||
|
m,^.*/($matcher[-\dA-Za-z\.\+]+\.deb)$, |
||||
|
? ($singfile = $1) |
||||
|
: ($singfile = $_); |
||||
|
if ($singfile =~ /^$matcher/) { |
||||
|
$file = $singfile; |
||||
|
} |
||||
|
} |
||||
|
my $checkfile; |
||||
|
defined $file |
||||
|
? ($checkfile = $otherthing . "/$file") |
||||
|
: ($checkfile = "NOFILE"); |
||||
|
$size = $ftp->size("$base/$checkfile"); |
||||
|
$rmtime = $ftp->mdtm("$base/$checkfile"); |
||||
|
$file_exist = $ftp->code(); |
||||
|
print "swim: could not find $packagen debian-revision\n" |
||||
|
if $file_exist == 550; |
||||
|
push(@tryme_again,$_) if $file_exist == 550; |
||||
|
next if $file_exist == 550; |
||||
|
$localfile =~ s,$matcher[-\dA-Za-z\.\+]*\.deb$,$file,; |
||||
|
$home = |
||||
|
"$default_directory/$default_root_directory/$uptopackage/$file"; |
||||
|
$packagename = $file; $file = $otherthing . "/$file"; |
||||
|
} # END DEBIAN-REVISION |
||||
|
else {$file = $_; } |
||||
|
my ($lsize,$lmtime); |
||||
|
|
||||
|
|
||||
|
######################## |
||||
|
# SAME PACKAGE LOCALLY # |
||||
|
######################## |
||||
|
$packagename =~ m,(^[A-Za-z\d\+-\\+]*)_([\\+A-Za-z\d\+\.:]*) |
||||
|
[-]?[\dA-Za-z\.\+]*\.deb$,x; |
||||
|
my $spackage = $1; my $upstream_revision = $2; |
||||
|
$spackage =~ s,\+,\\\+,g; |
||||
|
if (-e $home) { |
||||
|
($lsize,$lmtime) = (stat($home))[7,9]; |
||||
|
} |
||||
|
# If the upstream-revision has changed and |
||||
|
# a local package with the same name exists, we want to delete it. |
||||
|
else { |
||||
|
opendir(DF,"$default_directory/$default_root_directory/$uptopackage"); |
||||
|
my $grepthing = "^" . $spackage . "_"; |
||||
|
#my $grepthing = $spackage . "_" . $upstream_revision; |
||||
|
foreach (sort grep(/$grepthing/, readdir(DF))) { |
||||
|
m,(.*)_([\dA-Za-z\+\.:]+)[-]?[\dA-Za-z\+\.]*\.deb$,; |
||||
|
my $lupstream_revision = $2; |
||||
|
if ($lupstream_revision eq $upstream_revision) { |
||||
|
print "swim: $_ with different debian-revision exists\n"; |
||||
|
$_ = ""; |
||||
|
|
||||
|
########## |
||||
|
# SOURCE # |
||||
|
########## |
||||
|
if ($commands->{"source"} || $commands->{"source_only"}) { |
||||
|
my (@SOURCE,$upstream_change); |
||||
|
my ($matcher,$local_source,$remote_source,$base) = |
||||
|
source_calc($base,$uptopackage,$packagename,$drd,$source_drd); |
||||
|
my $REVISIONCHANGE = $ftp->ls("$base/$remote_source"); |
||||
|
my $singfile; |
||||
|
foreach (@{$REVISIONCHANGE}) { |
||||
|
m,^.*/($matcher.*)$, |
||||
|
? ($singfile = $1) |
||||
|
: ($singfile = $_); |
||||
|
if ($singfile =~ /^$matcher/) { |
||||
|
$file = $singfile; |
||||
|
push(@SOURCE,"$base/$remote_source/$singfile"); |
||||
|
} |
||||
|
} |
||||
|
if (!defined @SOURCE) { |
||||
|
print "swim: checking for upstream-revsion change\n"; |
||||
|
($matcher) = (split(/_/,$matcher))[0]; |
||||
|
foreach (@{$REVISIONCHANGE}) { |
||||
|
m,^.*/($matcher.*)$, |
||||
|
? ($singfile = $1) |
||||
|
: ($singfile = $_); |
||||
|
if ($singfile =~ /^$matcher/) { |
||||
|
$file = $singfile; |
||||
|
push(@SOURCE,"$base/$remote_source/$singfile"); |
||||
|
} |
||||
|
} |
||||
|
$upstream_change = "yes" if defined @SOURCE; |
||||
|
} |
||||
|
foreach (@SOURCE) { |
||||
|
m,.*/(.*)$,; $packagename = $1; |
||||
|
$lmtime = (stat("$local_source/$packagename"))[9]; |
||||
|
-e "$local_source/$packagename" |
||||
|
? ($lmtime = (stat("$local_source/$packagename"))[9]) |
||||
|
: ($lmtime = -1); |
||||
|
$size = $ftp->size("$_"); |
||||
|
$rmtime = $ftp->mdtm("$_"); |
||||
|
$file_exist = $ftp->code(); |
||||
|
if ($lmtime != $rmtime) { |
||||
|
if (!$commands->{"diff"}) { |
||||
|
$localfile = "$default_directory/partial/$packagename"; |
||||
|
!defined $upstream_change |
||||
|
? print "swim: downloading $packagename ($size bytes)\n" |
||||
|
: print "swim: downloading upstream-revision $packagename ($size bytes)\n"; |
||||
|
get($ftp,"$_",$localfile); |
||||
|
my $complete = $ftp->code(); |
||||
|
$lsize = (stat($localfile))[7]; |
||||
|
if ($lsize == $size && $complete == 226 && |
||||
|
$lmtime != $rmtime) { |
||||
|
print "swim: successful retrieval of $packagename\n"; |
||||
|
rename("$localfile","$local_source/$packagename") |
||||
|
or system "$mv","$localfile","$local_source/$packagename"; |
||||
|
} |
||||
|
else { |
||||
|
print "swim: unsuccessful retrieval of $packagename\n"; |
||||
|
} |
||||
|
} |
||||
|
else { |
||||
|
if (m,diff\.gz,) { |
||||
|
$localfile = "$default_directory/partial/$packagename"; |
||||
|
!defined $upstream_change |
||||
|
? print "swim: downloading $packagename ($size bytes)\n" |
||||
|
: print "swim: downloading upstream-revision $packagename ($size bytes)\n"; |
||||
|
get($ftp,"$_",$localfile); |
||||
|
my $complete = $ftp->code(); |
||||
|
$lsize = (stat($localfile))[7]; |
||||
|
if ($lsize == $size && $complete == 226 && |
||||
|
$lmtime != $rmtime) { |
||||
|
print "swim: successful retrieval of $packagename\n"; |
||||
|
rename("$localfile","$local_source/$packagename") |
||||
|
or system "$mv","$localfile","$local_source/$packagename"; |
||||
|
} |
||||
|
else { |
||||
|
print "swim: unsuccessful retrieval of $packagename\n"; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
utime(time,$rmtime,"$local_source/$packagename"); |
||||
|
$_ = ""; |
||||
|
} |
||||
|
else { |
||||
|
print "swim: $packagename already exists\n" |
||||
|
} |
||||
|
} |
||||
|
} # source |
||||
|
next LOCUS; |
||||
|
} |
||||
|
elsif ($lupstream_revision ne $upstream_revision) { |
||||
|
if (!$commands->{"source_only"}) { |
||||
|
print "swim: replacing $_ with a different upstream-revision\n"; |
||||
|
unlink |
||||
|
("$default_directory/$default_root_directory/$uptopackage/$_"); |
||||
|
} |
||||
|
print "swim: $_ exists with a different upstream-revision\n"; |
||||
|
} |
||||
|
} |
||||
|
closedir(DF); |
||||
|
} |
||||
|
|
||||
|
################## |
||||
|
# EXISTS LOCALLY # |
||||
|
################## |
||||
|
# got here but localtime was greater. |
||||
|
if (defined $rmtime && defined $lmtime) { |
||||
|
# ofcourse if the file does exist locally and has the same name |
||||
|
# and version, and this exists, something strange is going on. |
||||
|
if ($lmtime < $rmtime) { |
||||
|
print "swim: downloading $packagen, strange......... |
||||
|
same upstream version exists in the same package locally\n"; |
||||
|
get($ftp,"$base/$file",$localfile); |
||||
|
my $complete = $ftp->code(); |
||||
|
$argument = $localfile; |
||||
|
$commands{"md5sum"} = 1; |
||||
|
md5sumo(\%commands) if $complete == 226; |
||||
|
($packagen = $packagename) =~ s,\\\+,\+,g; |
||||
|
print "swim: successful retrieval of $packagen\n" |
||||
|
if $complete == 226; |
||||
|
$_ = "" if $complete == 226; |
||||
|
utime(time,$rmtime,$localfile); |
||||
|
} |
||||
|
elsif ($lmtime == $rmtime) { |
||||
|
$_ = ""; |
||||
|
($packagen = $packagename) =~ s,\\\+,\+,g; |
||||
|
print "swim: $packagen already exists\n"; |
||||
|
########## |
||||
|
# SOURCE # |
||||
|
########## |
||||
|
if ($commands->{"source"} || $commands->{"source_only"}) { |
||||
|
my (@SOURCE,$upstream_change); |
||||
|
my ($matcher,$local_source,$remote_source,$base) = |
||||
|
source_calc($base,$uptopackage,$packagename,$drd,$source_drd); |
||||
|
my $REVISIONCHANGE = $ftp->ls("$base/$remote_source"); |
||||
|
my $singfile; |
||||
|
foreach (@{$REVISIONCHANGE}) { |
||||
|
m,^.*/($matcher.*)$, |
||||
|
? ($singfile = $1) |
||||
|
: ($singfile = $_); |
||||
|
if ($singfile =~ /^$matcher/) { |
||||
|
$file = $singfile; |
||||
|
push(@SOURCE,"$base/$remote_source/$singfile"); |
||||
|
} |
||||
|
} |
||||
|
if (!defined @SOURCE) { |
||||
|
print "swim: checking for upstream-revsion change\n"; |
||||
|
($matcher) = (split(/_/,$matcher))[0]; |
||||
|
foreach (@{$REVISIONCHANGE}) { |
||||
|
m,^.*/($matcher.*)$, |
||||
|
? ($singfile = $1) |
||||
|
: ($singfile = $_); |
||||
|
if ($singfile =~ /^$matcher/) { |
||||
|
$file = $singfile; |
||||
|
push(@SOURCE,"$base/$remote_source/$singfile"); |
||||
|
} |
||||
|
} |
||||
|
$upstream_change = "yes" if defined @SOURCE; |
||||
|
} |
||||
|
foreach (@SOURCE) { |
||||
|
m,.*/(.*)$,; $packagename = $1; |
||||
|
-e "$local_source/$packagename" |
||||
|
? ($lmtime = (stat("$local_source/$packagename"))[9]) |
||||
|
: ($lmtime = -1); |
||||
|
$size = $ftp->size("$_"); |
||||
|
$rmtime = $ftp->mdtm("$_"); |
||||
|
$file_exist = $ftp->code(); |
||||
|
if ($lmtime != $rmtime) { |
||||
|
if (!$commands->{"diff"}) { |
||||
|
$localfile = "$default_directory/partial/$packagename"; |
||||
|
!defined $upstream_change |
||||
|
? print "swim: downloading $packagename ($size bytes)\n" |
||||
|
: print "swim: downloading upstream-revision $packagename ($size bytes)\n"; |
||||
|
get($ftp,"$_",$localfile); |
||||
|
my $complete = $ftp->code(); |
||||
|
$lsize = (stat($localfile))[7]; |
||||
|
if ($lsize == $size && $complete == 226 && $lmtime != $rmtime) { |
||||
|
print "swim: successful retrieval of $packagename\n"; |
||||
|
rename("$localfile","$local_source/$packagename") |
||||
|
or system "$mv","$localfile","$local_source/$packagename"; |
||||
|
} |
||||
|
else { |
||||
|
print "swim: unsuccessful retrieval of $packagename\n"; |
||||
|
} |
||||
|
} |
||||
|
else { |
||||
|
if (m,diff\.gz,) { |
||||
|
$localfile = "$default_directory/partial/$packagename"; |
||||
|
!defined $upstream_change |
||||
|
? print "swim: downloading $packagename ($size bytes)\n" |
||||
|
: print "swim: downloading upstream-revision $packagename ($size bytes)\n"; |
||||
|
get($ftp,"$_",$localfile); |
||||
|
my $complete = $ftp->code(); |
||||
|
$lsize = (stat($localfile))[7]; |
||||
|
if ($lsize == $size && $complete == 226 && $lmtime != $rmtime) { |
||||
|
print "swim: successful retrieval of $packagename\n"; |
||||
|
rename("$localfile","$local_source/$packagename") |
||||
|
or system "$mv","$localfile","$local_source/$packagename"; |
||||
|
} |
||||
|
else { |
||||
|
print "swim: unsuccessful retrieval of $packagename\n"; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
utime(time,$rmtime,"$local_source/$packagename"); |
||||
|
$_ = ""; |
||||
|
} |
||||
|
else { |
||||
|
print "swim: $packagename already exists\n" |
||||
|
} |
||||
|
} |
||||
|
} # source |
||||
|
} |
||||
|
} |
||||
|
######################################################### |
||||
|
# DOESN'T EXIST LOCALLY OR DIFFERENT UPSTREAM-REVISION # |
||||
|
######################################################### |
||||
|
else { |
||||
|
######################## |
||||
|
# BINARY AND/OR SOURCE # |
||||
|
######################## |
||||
|
if (!$commands->{"source_only"}) { |
||||
|
print "swim: downloading $packagen ($size bytes)\n"; |
||||
|
my $upstream_change; |
||||
|
get($ftp,"$base/$file",$localfile); |
||||
|
my $complete = $ftp->code(); |
||||
|
$lsize = (stat($localfile))[7]; |
||||
|
if ($lsize == $size && $complete == 226) { |
||||
|
$argument = $localfile; |
||||
|
$commands{"md5sum"} = 1; md5sumo(\%commands); |
||||
|
($packagen = $packagename) =~ s,\\\+,\+,g; |
||||
|
print "swim: successful retrieval of $packagen\n"; |
||||
|
rename("$localfile","$home") |
||||
|
or system "$mv", "$localfile", "$home"; |
||||
|
utime(time,$rmtime,"$home"); |
||||
|
} |
||||
|
else { |
||||
|
print "swim: unsuccessful retrieval of $file\n"; |
||||
|
} |
||||
|
$_ = ""; |
||||
|
########## |
||||
|
# SOURCE # |
||||
|
########## |
||||
|
if ($commands->{"source"}) { |
||||
|
my (@SOURCE,$upstream_change); |
||||
|
my ($matcher,$local_source,$remote_source,$base) = |
||||
|
source_calc($base,$uptopackage,$packagename,$drd,$source_drd); |
||||
|
my $REVISIONCHANGE = $ftp->ls("$base/$remote_source"); |
||||
|
my $singfile; |
||||
|
foreach (@{$REVISIONCHANGE}) { |
||||
|
m,^.*/($matcher.*)$, |
||||
|
? ($singfile = $1) |
||||
|
: ($singfile = $_); |
||||
|
if ($singfile =~ /^$matcher/) { |
||||
|
$file = $singfile; |
||||
|
push(@SOURCE,"$base/$remote_source/$singfile"); |
||||
|
} |
||||
|
} |
||||
|
if (!defined @SOURCE) { |
||||
|
print "swim: checking for upstream-revsion change\n"; |
||||
|
($matcher) = (split(/_/,$matcher))[0]; |
||||
|
foreach (@{$REVISIONCHANGE}) { |
||||
|
m,^.*/($matcher.*)$, |
||||
|
? ($singfile = $1) |
||||
|
: ($singfile = $_); |
||||
|
if ($singfile =~ /^$matcher/) { |
||||
|
$file = $singfile; |
||||
|
push(@SOURCE,"$base/$remote_source/$singfile"); |
||||
|
} |
||||
|
} |
||||
|
$upstream_change = "yes" if defined @SOURCE; |
||||
|
} |
||||
|
foreach (@SOURCE) { |
||||
|
m,.*/(.*)$,; $packagename = $1; |
||||
|
-e "$local_source/$packagename" |
||||
|
? ($lmtime = (stat("$local_source/$packagename"))[9]) |
||||
|
: ($lmtime = -1); |
||||
|
$size = $ftp->size("$_"); |
||||
|
$rmtime = $ftp->mdtm("$_"); |
||||
|
$file_exist = $ftp->code(); |
||||
|
if ($lmtime != $rmtime) { |
||||
|
if (!$commands->{"diff"}) { |
||||
|
$localfile = "$default_directory/partial/$packagename"; |
||||
|
!defined $upstream_change |
||||
|
? print "swim: downloading $packagename ($size bytes)\n" |
||||
|
: print "swim: downloading upstream-revision $packagename ($size bytes)\n"; |
||||
|
get($ftp,"$_",$localfile); |
||||
|
my $complete = $ftp->code(); |
||||
|
$lsize = (stat($localfile))[7]; |
||||
|
if ($lsize == $size && $complete == 226 && $lmtime != $rmtime) { |
||||
|
print "swim: successful retrieval of $packagename\n"; |
||||
|
rename("$localfile","$local_source/$packagename") |
||||
|
or system "$mv","$localfile","$local_source/$packagename"; |
||||
|
} |
||||
|
else { |
||||
|
print "swim: unsuccessful retrieval of $packagename\n"; |
||||
|
} |
||||
|
} |
||||
|
else { |
||||
|
if (m,diff\.gz,) { |
||||
|
$localfile = "$default_directory/partial/$packagename"; |
||||
|
!defined $upstream_change |
||||
|
? print "swim: downloading $packagename ($size bytes)\n" |
||||
|
: print "swim: downloading upstream-revision $packagename ($size bytes)\n"; |
||||
|
get($ftp,"$_",$localfile); |
||||
|
my $complete = $ftp->code(); |
||||
|
$lsize = (stat($localfile))[7]; |
||||
|
if ($lsize == $size && $complete == 226 && $lmtime != $rmtime) { |
||||
|
print "swim: successful retrieval of $packagename\n"; |
||||
|
rename("$localfile","$local_source/$packagename") |
||||
|
or system "$mv","$localfile","$local_source/$packagename"; |
||||
|
} |
||||
|
else { |
||||
|
print "swim: unsuccessful retrieval of $packagename\n"; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
utime(time,$rmtime,"$local_source/$packagename"); |
||||
|
$_ = ""; |
||||
|
} |
||||
|
else { |
||||
|
print "swim: $packagename already exists\n" |
||||
|
} |
||||
|
} |
||||
|
} # source |
||||
|
} |
||||
|
############### |
||||
|
# SOURCE-ONLY # |
||||
|
############### |
||||
|
else { |
||||
|
my (@SOURCE,$upstream_change); |
||||
|
my ($matcher,$local_source,$remote_source,$base) = |
||||
|
source_calc($base,$uptopackage,$packagename,$drd,$source_drd); |
||||
|
my $REVISIONCHANGE = $ftp->ls("$base/$remote_source"); |
||||
|
my $singfile; |
||||
|
foreach (@{$REVISIONCHANGE}) { |
||||
|
m,^.*/($matcher.*)$, |
||||
|
? ($singfile = $1) |
||||
|
: ($singfile = $_); |
||||
|
if ($singfile =~ /^$matcher/) { |
||||
|
$file = $singfile; |
||||
|
push(@SOURCE,"$base/$remote_source/$singfile"); |
||||
|
} |
||||
|
} |
||||
|
if (!defined @SOURCE) { |
||||
|
print "swim: checking for upstream-revsion change\n"; |
||||
|
($matcher) = (split(/_/,$matcher))[0]; |
||||
|
foreach (@{$REVISIONCHANGE}) { |
||||
|
m,^.*/($matcher.*)$, |
||||
|
? ($singfile = $1) |
||||
|
: ($singfile = $_); |
||||
|
if ($singfile =~ /^$matcher/) { |
||||
|
$file = $singfile; |
||||
|
push(@SOURCE,"$base/$remote_source/$singfile"); |
||||
|
} |
||||
|
} |
||||
|
$upstream_change = "yes" if defined @SOURCE; |
||||
|
} |
||||
|
foreach (@SOURCE) { |
||||
|
m,.*/(.*)$,; $packagename = $1; |
||||
|
-e "$local_source/$packagename" |
||||
|
? ($lmtime = (stat("$local_source/$packagename"))[9]) |
||||
|
: ($lmtime = -1); |
||||
|
$size = $ftp->size("$_"); |
||||
|
$rmtime = $ftp->mdtm("$_"); |
||||
|
$file_exist = $ftp->code(); |
||||
|
if ($lmtime != $rmtime) { |
||||
|
if (!$commands->{"diff"}) { |
||||
|
$localfile = "$default_directory/partial/$packagename"; |
||||
|
!defined $upstream_change |
||||
|
? print "swim: downloading $packagename ($size bytes)\n" |
||||
|
: print "swim: downloading upstream-revision $packagename ($size bytes)\n"; |
||||
|
get($ftp,"$_",$localfile); |
||||
|
my $complete = $ftp->code(); |
||||
|
$lsize = (stat($localfile))[7]; |
||||
|
if ($lsize == $size && $complete == 226 && $lmtime != $rmtime) { |
||||
|
print "swim: successful retrieval of $packagename\n"; |
||||
|
rename("$localfile","$local_source/$packagename") |
||||
|
or system "$mv","$localfile","$local_source/$packagename"; |
||||
|
} |
||||
|
else { |
||||
|
print "swim: unsuccessful retrieval of $packagename\n"; |
||||
|
} |
||||
|
} |
||||
|
else { |
||||
|
if (m,diff\.gz,) { |
||||
|
$localfile = "$default_directory/partial/$packagename"; |
||||
|
!defined $upstream_change |
||||
|
? print "swim: downloading $packagename ($size bytes)\n" |
||||
|
: print "swim: downloading upstream-revision $packagename ($size bytes)\n"; |
||||
|
get($ftp,"$_",$localfile); |
||||
|
my $complete = $ftp->code(); |
||||
|
$lsize = (stat($localfile))[7]; |
||||
|
if ($lsize == $size && $complete == 226 && $lmtime != $rmtime) { |
||||
|
print "swim: successful retrieval of $packagename\n"; |
||||
|
rename("$localfile","$local_source/$packagename") |
||||
|
or system "$mv","$localfile","$local_source/$packagename"; |
||||
|
} |
||||
|
else { |
||||
|
print "swim: unsuccessful retrieval of $packagename\n"; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
utime(time,$rmtime,"$local_source/$packagename"); |
||||
|
$_ = ""; |
||||
|
} |
||||
|
else { |
||||
|
print "swim: $packagename already exists\n" |
||||
|
} |
||||
|
} |
||||
|
} # source-only |
||||
|
} |
||||
|
} |
||||
|
$base_count++; |
||||
|
} # foreach FTP |
||||
|
undef @LOCATION; |
||||
|
@LOCATION = @tryme_again; |
||||
|
$ftp->quit() if !defined @LOCATION; |
||||
|
my $good_bye = $ftp->code(); |
||||
|
print "swim: logged out\n" if $good_bye == 221; |
||||
|
undef @sites if !defined @LOCATION; |
||||
|
|
||||
|
} # foreach sites |
||||
|
untie %db; |
||||
|
|
||||
|
} # end sub qftp |
||||
|
|
||||
|
|
||||
|
# figure out the source stuff, make appropriate directories for sections |
||||
|
# which aren't non-US |
||||
|
sub source_calc { |
||||
|
|
||||
|
my($base,$uptopackage,$packagename,$drd,$source_drd) = @_; |
||||
|
|
||||
|
|
||||
|
# if source is empty in %db we can use the package name, need |
||||
|
# to watch for experimental |
||||
|
my ($remote_source,$local_source,@SOURCE); |
||||
|
# NON-US |
||||
|
if ($uptopackage =~ /non-US/) { |
||||
|
$local_source = |
||||
|
"$default_directory$drd/debian-non-US/$source_drd/source"; |
||||
|
$uptopackage =~ m,(.*)/.*$,; $remote_source = $1; |
||||
|
$remote_source = "$remote_source/source"; |
||||
|
# for safety's sake and because most sites don't have |
||||
|
# /pub/debian/dists/unstable/non-US/source except for a |
||||
|
# site made with swim, convert debian to debian-non-US and |
||||
|
# hope everything is standard. |
||||
|
if ($base !~ /debian-non-US/) { |
||||
|
$base =~ s/debian/debian-non-US/; |
||||
|
} |
||||
|
} |
||||
|
# EVERYTHING ELSE |
||||
|
else { |
||||
|
$uptopackage =~ m,(.*)/(.*)$,; |
||||
|
my $subject = $2; $1 =~ m,(.*)/.*$,; $local_source = $1; |
||||
|
#$remote_source =~ m,(.*)/.*$,; $remote_source = $1; |
||||
|
$remote_source = $local_source; |
||||
|
$local_source = "$remote_source/source/$subject"; |
||||
|
$remote_source = $local_source; |
||||
|
$local_source = |
||||
|
"$default_directory$default_root_directory/$local_source"; |
||||
|
} |
||||
|
|
||||
|
# exciting matcher realities..if it isn't non-US than the |
||||
|
# %db needs to be searched for anything found in Source:, |
||||
|
# if it is defined, then vola, herein this section lays the |
||||
|
# source, otherwise it's probably in the section which pertains |
||||
|
# to the package being queried..we hope. Epochs aren't used |
||||
|
# fortunately they aren't in package_versionFN, but they can |
||||
|
# be in the Source: area so they need to be removed. |
||||
|
$packagename =~ m,(^[A-Za-z\d\+-\\+]*_[\\+A-Za-z\d\+\.:]*) |
||||
|
[-]?[\dA-Za-z\.\+]*\.deb$,x; |
||||
|
|
||||
|
# everything, but revision |
||||
|
my $matcher = $1; |
||||
|
$matcher =~ m,^(.*)_(.*)$,; my $mat = $1; |
||||
|
if (defined $db{$mat}) { |
||||
|
$mat = $db{$mat}; $mat = $db{$mat}; |
||||
|
if ($mat =~ m,Installed-Size:\s\d+\s+Source:\s(.*),){ |
||||
|
$matcher = $1; |
||||
|
########################################## |
||||
|
# DIFFERENT VERSION AND DIFFERENT SOURCE # |
||||
|
########################################## |
||||
|
if ($matcher =~ m,[\(\)], ) { |
||||
|
$matcher =~ /:/ |
||||
|
? $matcher =~ m,^(.*) |
||||
|
\s\([\d]?[:]? |
||||
|
([A-Za-z0-9\+\.]+) |
||||
|
[-]?[\dA-Za-z\+\.]*\)$,x |
||||
|
: $matcher =~ m,^(.*) |
||||
|
\s\( |
||||
|
([A-Za-z0-9\+\.]+) |
||||
|
[-]?[\dA-Za-z\+\.]*\)$,x; |
||||
|
|
||||
|
my $mat2 = $1; my $mat2_ver = $2; |
||||
|
$matcher = $mat2 . "_" . $mat2_ver; |
||||
|
if (defined $db{$mat2}) { |
||||
|
$matcher = $mat2 . "_" . $mat2_ver; |
||||
|
# time to change the $remote_source and $local_source |
||||
|
if ($uptopackage !~ /non-US/) { |
||||
|
my $change = $db{$mat2}; |
||||
|
$change = $db{$change ."FN"}; |
||||
|
$change =~ m,(.*)/(.*)$,; |
||||
|
$uptopackage = $1; $uptopackage =~ m,(.*)/(.*)$,; |
||||
|
my $subject = $2; |
||||
|
$1 =~ m,(.*)/.*$,; $local_source = $1; |
||||
|
$local_source = "$local_source/source/$subject"; |
||||
|
$remote_source = $local_source; |
||||
|
$local_source = |
||||
|
"$default_directory$default_root_directory/$local_source"; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
##################################### |
||||
|
# SAME VERSION AND DIFFERENT SOURCE # |
||||
|
##################################### |
||||
|
else { |
||||
|
if (defined $db{$matcher}) { |
||||
|
# time to change the |
||||
|
# $remote_source and $local_source |
||||
|
if ($uptopackage !~ /non-US/) { |
||||
|
my $change = $db{$matcher}; |
||||
|
$change = $db{$change ."FN"}; |
||||
|
$change =~ m,(.*)/(.*)$,; |
||||
|
$uptopackage = $1; $uptopackage =~ m,(.*)/(.*)$,; |
||||
|
my $subject = $2; |
||||
|
$1 =~ m,(.*)/.*$,; $local_source = $1; |
||||
|
$local_source = "$local_source/source/$subject"; |
||||
|
$remote_source = $local_source; |
||||
|
$local_source = |
||||
|
"$default_directory$default_root_directory/$local_source"; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} # Source: found |
||||
|
} # should be defined |
||||
|
|
||||
|
|
||||
|
# time to make direcorties if $local_source isn't defined |
||||
|
# non-US already made, if source if already made, just the |
||||
|
# subject above needs to be made |
||||
|
if (!-e $local_source) { |
||||
|
my $place; |
||||
|
my @LS = split(m,/,,$local_source); |
||||
|
for (1 .. $#LS - 2) { |
||||
|
$_ == 1 ? ($place = "/$LS[$_]") |
||||
|
: ($place = $place . "/" . $LS[$_]); |
||||
|
} |
||||
|
my $create = "$LS[$#LS -1]/$LS[$#LS]"; |
||||
|
if (-d "$place/$LS[$#LS - 1]") { |
||||
|
mkdir("$place/$create",$permission) |
||||
|
or warn "swim: could not create source directory\n"; |
||||
|
} |
||||
|
else { |
||||
|
my @DP = split(m,/,,$create); |
||||
|
my $placement = "/"; |
||||
|
for (0 .. $#DP) { |
||||
|
$_ == 0 ? ($placement = "/$DP[$_]") |
||||
|
: ($placement = $placement . "/" . $DP[$_]); |
||||
|
mkdir("$place$placement",$permission) |
||||
|
or warn "swim: could not create source directory\n"; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
return($matcher,$local_source,$remote_source,$base); |
||||
|
|
||||
|
} # end source_calc |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
1; |
@ -0,0 +1,180 @@ |
|||||
|
# Package administration and research tool for Debian |
||||
|
# Copyright (C) 1999-2000 Jonathan D. Rosenbaum |
||||
|
|
||||
|
# This program 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. |
||||
|
|
||||
|
# This program 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 this program; if not, write to the Free Software |
||||
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
||||
|
|
||||
|
|
||||
|
package SWIM::Ramdisk; |
||||
|
use strict; |
||||
|
use SWIM::Conf; |
||||
|
use SWIM::Library; |
||||
|
use vars qw(@ISA @EXPORT); |
||||
|
|
||||
|
use Exporter; |
||||
|
@ISA = qw(Exporter); |
||||
|
@EXPORT = qw(ramdisk); |
||||
|
|
||||
|
|
||||
|
=pod |
||||
|
|
||||
|
make access a lot faster for contentsindex.deb.gz, alternatively |
||||
|
searchindex.deb & file/dirindex. Ramdisks don't work well for |
||||
|
everything like the creation of a database. The goal is to |
||||
|
automatically determine the size of the disk based on the files |
||||
|
put into it (which will all be compressed) This also has a residual |
||||
|
effect, so when the ramdisk is umounted stuff still stays in |
||||
|
the memory. |
||||
|
|
||||
|
=cut |
||||
|
|
||||
|
sub ramdisk { |
||||
|
|
||||
|
|
||||
|
my ($commands) = @_; |
||||
|
|
||||
|
# lot's of thing can be put into the ramdisk, ncontentsindex being the |
||||
|
# most important, but flat search files, too. --ramdiskon -n would be |
||||
|
# the most important application. |
||||
|
my $size = 0; |
||||
|
my (@storage,@files); |
||||
|
my $count = 0; |
||||
|
my %commands = %$commands; |
||||
|
my $where = finddb(\%commands); |
||||
|
my ($arch,$dist) = which_archdist(\%commands); |
||||
|
my $not = "n" if defined $arch; |
||||
|
$not = "" if !$commands->{"n"}; |
||||
|
$arch = "" if !$commands->{"n"}; |
||||
|
$dist = "" if !$commands->{"n"}; |
||||
|
my $contentsindex = "contentsindex"; |
||||
|
my $searchindex = "searchindex"; |
||||
|
my $dirindex = "dirindex"; |
||||
|
|
||||
|
if ($commands->{"ramdiskon"}) { |
||||
|
|
||||
|
my $rambo = "$cat /proc/mounts|"; |
||||
|
open(RAM, "$rambo"); |
||||
|
while (<RAM>) { |
||||
|
if (/ram/) { |
||||
|
my($device,$mount) = split(/\s/,$_,2); |
||||
|
if ($mount =~ /dramdisk/) { |
||||
|
print "swim: use --ramdiskoff\n"; |
||||
|
exit; |
||||
|
} |
||||
|
$storage[$count] = $device; |
||||
|
$count++; |
||||
|
} |
||||
|
} |
||||
|
close(RAM); |
||||
|
|
||||
|
if (-e "$where/$not$contentsindex$arch$dist.deb.gz" && |
||||
|
-B "$where/$not$contentsindex$arch$dist.deb.gz") { |
||||
|
$size = (stat("$where/$not$contentsindex$arch$dist.deb.gz"))[7]; |
||||
|
push(@files,"$where/$not$contentsindex$arch$dist.deb.gz"); |
||||
|
} |
||||
|
|
||||
|
if ($commands->{"searchfile"}) { |
||||
|
# stat caused some weirdisms based on the boolean logic |
||||
|
#if (-e "$where/$not$searchindex$arch$dist.deb" && |
||||
|
# -e "$where/$not$dirindex$arch$dist.deb") { |
||||
|
# compress the monsters |
||||
|
if (!-e "$where/$not$dirindex$arch$dist.deb.gz") { |
||||
|
print "swim: please wait while dirindex.deb is compressed\n"; |
||||
|
if (-e "$where/$not$dirindex$arch$dist.deb") { |
||||
|
system "$gzip -c9 $where/$not$dirindex$arch$dist.deb > $where/$not$dirindex$arch$dist.deb.gz"; |
||||
|
} |
||||
|
} |
||||
|
if (!-e "$where/$not$searchindex$arch$dist.deb.gz") { |
||||
|
print "swim: please wait while searchindex.deb is compressed\n"; |
||||
|
if (-e "$where/$not$searchindex$arch$dist.deb") { |
||||
|
system "$gzip -c9 $where/$not$searchindex$arch$dist.deb > $where/$not$searchindex$arch$dist.deb.gz"; |
||||
|
} |
||||
|
} |
||||
|
push(@files,"$where/$not$dirindex$arch$dist.deb.gz"); |
||||
|
push(@files,"$where/$not$searchindex$arch$dist.deb.gz"); |
||||
|
my $size1 = (stat("$where/$not$searchindex$arch$dist.deb.gz"))[7]; |
||||
|
my $size2 = (stat("$where/$not$dirindex$arch$dist.deb.gz"))[7]; |
||||
|
if (defined $size) { |
||||
|
$size = $size + $size1 + $size2; |
||||
|
} |
||||
|
else { |
||||
|
$size = $size1 + $size2; |
||||
|
} |
||||
|
#} |
||||
|
} |
||||
|
|
||||
|
# it will be assumed that ext2 is used, and hopefully there isn't a mount |
||||
|
# of the exact same name..hence dramdisk should be unusual |
||||
|
my $number; |
||||
|
if (defined @storage) { |
||||
|
@storage = sort {$a cmp $b} @storage; |
||||
|
$storage[$#storage] =~ s/\D//g; |
||||
|
$number = $storage[$#storage] + 1; |
||||
|
} |
||||
|
else { |
||||
|
$number = 0; |
||||
|
} |
||||
|
|
||||
|
# the size will be the sizes added together/1024 + (.15 of the total) |
||||
|
if (-e "$where/dramdisk") { |
||||
|
if (!-d "$where/dramdisk") { |
||||
|
print "swim: --ramdiskon requires dir dramdisk, but a file named dramdisk already exists\n"; |
||||
|
exit; |
||||
|
} |
||||
|
} |
||||
|
elsif (!-d "$where/dramdisk") { |
||||
|
mkdir("$where/dramdisk",0666); |
||||
|
} |
||||
|
|
||||
|
my $increase = $size * 0.15; |
||||
|
$size = $increase + $size; |
||||
|
$size = $size/1024; |
||||
|
$size = sprintf("%.f",$size); |
||||
|
if ($size > 0) { |
||||
|
system "$mke2fs", "-m0", "/dev/ram$number", "$size"; |
||||
|
system "$mount", "-t", "ext2", "/dev/ram$number", "$where/dramdisk"; |
||||
|
foreach (@files) { |
||||
|
system "$copy", "$_", "$where/dramdisk"; |
||||
|
} |
||||
|
} |
||||
|
} # if on |
||||
|
else { |
||||
|
|
||||
|
my $rambo = "$cat /proc/mounts|"; |
||||
|
open(RAM, "$rambo"); |
||||
|
while (<RAM>) { |
||||
|
if (/ram/) { |
||||
|
my($device,$mount) = split(/\s/,$_,2); |
||||
|
if ($mount =~ /dramdisk/) { |
||||
|
system "$umount", "$device"; |
||||
|
exit; |
||||
|
} |
||||
|
$storage[$count] = $device; |
||||
|
$count++; |
||||
|
} |
||||
|
} |
||||
|
close(RAM); |
||||
|
|
||||
|
|
||||
|
} # if off |
||||
|
|
||||
|
exit; |
||||
|
|
||||
|
} # end sub ramdisk |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
1; |
@ -0,0 +1,470 @@ |
|||||
|
# Package administration and research tool for Debian |
||||
|
# Copyright (C) 1999-2000 Jonathan D. Rosenbaum |
||||
|
|
||||
|
# This program 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. |
||||
|
|
||||
|
# This program 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 this program; if not, write to the Free Software |
||||
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
||||
|
|
||||
|
|
||||
|
package SWIM::Safex; |
||||
|
use strict; |
||||
|
use Term::ReadLine; |
||||
|
use SWIM::Conf qw($apt_get $dpkg $tmp $HISTORY); |
||||
|
use SWIM::Global qw(@PACKAGES $argument $aptor_group %db); |
||||
|
use SWIM::DB_Library qw(:Xyz); |
||||
|
use SWIM::Library; |
||||
|
use vars qw(@ISA @EXPORT %EXPORT_TAGS); |
||||
|
use Exporter; |
||||
|
@ISA = qw(Exporter); |
||||
|
@EXPORT = qw(safex); |
||||
|
|
||||
|
|
||||
|
# when x is called |
||||
|
sub safex { |
||||
|
|
||||
|
my ($commands) = @_; |
||||
|
my %commands = %$commands; |
||||
|
|
||||
|
if ($commands->{"x"} || $commands->{"ftp"} || $commands->{"source"} || |
||||
|
$commands->{"source_only"} || $commands->{"remove"} || $commands->{"r"} || |
||||
|
$commands->{"purge"}) { |
||||
|
|
||||
|
|
||||
|
if (!defined @PACKAGES) { |
||||
|
if ($commands->{"search"} || $commands->{"ps"} || $commands->{"research"} |
||||
|
|| $commands->{"refinesearch"}) { |
||||
|
@PACKAGES = "NOPACKAGES"; |
||||
|
} |
||||
|
else { |
||||
|
@PACKAGES = @ARGV; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
#print "PACKAGES @PACKAGES $argument\n"; |
||||
|
|
||||
|
my ($aptor,$arg); |
||||
|
if (defined $argument) { |
||||
|
if ($argument =~ /_/) { |
||||
|
$argument =~ m,(.*)_.*,; |
||||
|
$aptor = $1; |
||||
|
} |
||||
|
else { |
||||
|
if (($argument =~ m,/, && ($commands->{"y"} || $commands->{"z"} || |
||||
|
$commands->{"ftp"} || $commands->{"nz"})) || defined $aptor_group || |
||||
|
$commands->{"ftp"} || $commands->{"purge"} || $commands->{"remove"} || |
||||
|
$commands->{"r"}) { |
||||
|
if ($PACKAGES[$#PACKAGES] =~ /_/) { |
||||
|
$PACKAGES[$#PACKAGES] =~ m,(.*)_.*,; |
||||
|
$aptor = $1; |
||||
|
} |
||||
|
else { |
||||
|
$aptor = $PACKAGES[$#PACKAGES]; |
||||
|
} |
||||
|
} |
||||
|
else { |
||||
|
$aptor = $argument; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
else { |
||||
|
if ($commands->{"y"} || $commands->{"z"} || $commands->{"ftp"} || |
||||
|
$commands->{"nz"} || $commands->{"purge"} || $commands->{"remove"} || |
||||
|
$commands->{"r"}) { |
||||
|
if ($PACKAGES[$#PACKAGES] =~ /_/) { |
||||
|
$PACKAGES[$#PACKAGES] =~ m,(.*)_.*,; |
||||
|
$aptor = $1; |
||||
|
} |
||||
|
else { |
||||
|
$aptor = $PACKAGES[$#PACKAGES]; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
if ($PACKAGES[$#PACKAGES] =~ m,/,) { |
||||
|
$PACKAGES[$#PACKAGES] =~ m,.*/(.*)$,; |
||||
|
$arg = $1; |
||||
|
foreach (@PACKAGES) { |
||||
|
$_ =~ m,.*/(.*)$,; |
||||
|
shift @PACKAGES; |
||||
|
push(@PACKAGES,$1); |
||||
|
} |
||||
|
} |
||||
|
else { |
||||
|
if ($PACKAGES[$#PACKAGES] =~ /_/) { |
||||
|
$PACKAGES[$#PACKAGES] =~ m,(.*)_.*,; |
||||
|
$arg = $1; |
||||
|
foreach (0 .. $#PACKAGES) { |
||||
|
if ($PACKAGES[$_] =~ /_/) { |
||||
|
$PACKAGES[$_] =~ m,^(.*)_.*$,; |
||||
|
$PACKAGES[$_] = $1; |
||||
|
} |
||||
|
else { |
||||
|
$PACKAGES[$_] = $PACKAGES[$_]; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
else { |
||||
|
$arg = $PACKAGES[$#PACKAGES]; |
||||
|
foreach (0 .. $#PACKAGES) { |
||||
|
if ($PACKAGES[$_] =~ /_/) { |
||||
|
$PACKAGES[$_] =~ m,^(.*)_.*$,; |
||||
|
$PACKAGES[$_] = $1; |
||||
|
} |
||||
|
else { |
||||
|
$PACKAGES[$_] = $PACKAGES[$_]; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
$aptor = "DEFINEDONE" if !defined $aptor; |
||||
|
if (($aptor eq $arg) || ($commands->{"search"} || |
||||
|
$commands->{"ps"} || $commands->{"research"} || |
||||
|
$commands->{"refinesearch"} || $aptor eq "/.") && |
||||
|
$PACKAGES[0] ne "NOPACKAGES") { |
||||
|
xyz(\%commands); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
} |
||||
|
|
||||
|
|
||||
|
# swim provides a great interface to apt. The trick is to not actually |
||||
|
# run apt-get until all the arguments are stored in an array. This is |
||||
|
# done easily for xy and for for xyz which provides virtual installation |
||||
|
# and querying completion after --db && --ndb updates. Obviously, the |
||||
|
# package virtually installed needs to be the same architecture as the |
||||
|
# machine running, since this is how apt works, but the databases can be |
||||
|
# in any specified directory. This function also provides an interface for |
||||
|
# ftp, as well as dpkg's --remove & --purge. |
||||
|
sub xyz { |
||||
|
|
||||
|
my ($commands) = @_; |
||||
|
my %commands = %$commands; |
||||
|
|
||||
|
if (!$commands->{"ftp"}) { |
||||
|
if (!defined $apt_get) { |
||||
|
print "swim: configure swimrc\n"; |
||||
|
exit; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
# error correcting |
||||
|
if ($commands->{"ftp"} && ($commands->{"r"} || $commands->{"remove"} || |
||||
|
$commands->{"purge"})) { |
||||
|
print "swim: --ftp cannot be used with "; |
||||
|
print "-r " if defined $commands->{"r"}; |
||||
|
print "--remove " if defined $commands->{"remove"}; |
||||
|
print "--purge " if defined $commands->{"purge"}; |
||||
|
print "\n"; |
||||
|
exit; |
||||
|
} |
||||
|
if (($commands->{"r"} || $commands->{"remove"}) && $commands->{"purge"}) { |
||||
|
print "swim: "; |
||||
|
print "-r " if defined $commands->{"r"}; |
||||
|
print "--remove " if defined $commands->{"remove"}; |
||||
|
print "--purge " if defined $commands->{"purge"}; |
||||
|
print "cannot be used together\n"; |
||||
|
exit; |
||||
|
} |
||||
|
if (($commands->{"y"} || $commands->{"z"} || $commands->{"x"} || |
||||
|
$commands->{"nz"}) && ($commands->{"ftp"} || $commands->{"purge"})) { |
||||
|
print "swim: -"; |
||||
|
print "x" if $commands->{"x"}; |
||||
|
print "y" if $commands->{"y"}; |
||||
|
print "z" if $commands->{"z"}; |
||||
|
print " --nz" if $commands->{"nz"}; |
||||
|
print " cannot be used with "; |
||||
|
print "--purge " if defined $commands->{"purge"}; |
||||
|
print "--ftp " if defined $commands->{"ftp"}; |
||||
|
print "\n"; |
||||
|
exit; |
||||
|
} |
||||
|
if (($commands->{"source"} && $commands->{"source_only"})) { |
||||
|
print "swim: --source and --source_only cannot be used together\n"; |
||||
|
exit; |
||||
|
} |
||||
|
if (($commands->{"source"} || $commands->{"source_only"}) && |
||||
|
!$commands->{"ftp"}) { |
||||
|
print "swim: --"; |
||||
|
print "source" if $commands->{"source"}; |
||||
|
print "source_only" if $commands->{"source_only"}; |
||||
|
print " cannot be used without --ftp\n"; |
||||
|
exit; |
||||
|
} |
||||
|
if (($commands->{"y"} || $commands->{"z"} || $commands->{"nz"}) && |
||||
|
!$commands->{"x"}) { |
||||
|
print "swim: requires -x option\n"; |
||||
|
exit; |
||||
|
} |
||||
|
|
||||
|
if ($commands->{"x"}) { |
||||
|
# There's no sense in doing this if the wrong architecture is called. |
||||
|
if (defined $dpkg) { |
||||
|
system "$dpkg --print-installation-architecture > $tmp/arch.deb"; |
||||
|
open(ARCH, "$tmp/arch.deb") or warn "couldn't find arch\n"; |
||||
|
my @arch = <ARCH>; chomp $arch[0]; |
||||
|
my($arch,$dist) = which_archdist(\%commands); $arch =~ m,^-(.*),; |
||||
|
if ($1 ne $arch[0]) { |
||||
|
print "swim: apt uses the $arch[0] architecture\n"; |
||||
|
exit; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
############### |
||||
|
# SAFETY MODE # |
||||
|
############### |
||||
|
if ((($commands->{"x"} || ($commands->{"x"} && $commands->{"y"})) || |
||||
|
($commands->{"x"} && ($commands->{"r"} || $commands->{"remove"}) || |
||||
|
($commands->{"x"} && $commands->{"y"} && ($commands->{"r"} || |
||||
|
$commands->{"remove"})))) && |
||||
|
!($commands->{"z"} || $commands->{"nz"})) { |
||||
|
my $arg; |
||||
|
my $count = 0; |
||||
|
foreach (@PACKAGES) { |
||||
|
if ($count == 0) { |
||||
|
$arg = "$_"; |
||||
|
} |
||||
|
else { |
||||
|
$arg = $arg . " " . "$_"; |
||||
|
} |
||||
|
$count++; |
||||
|
} |
||||
|
######### |
||||
|
# STDIN # |
||||
|
######### |
||||
|
if ($commands->{"stdin"}) { |
||||
|
my $term = Term::ReadLine->new("Simple Shell"); |
||||
|
my @HISTORY = history(\%commands); |
||||
|
$term->addhistory(@HISTORY); |
||||
|
my @history; push(@history,"$arg"); |
||||
|
print "swim: type exit to finish --stdin\n"; |
||||
|
my $termcount = 0; |
||||
|
while ($termcount < 1 ) { |
||||
|
$_ = $term->readline('swim: ',"$arg"); |
||||
|
push (@history,$_); |
||||
|
$termcount++; |
||||
|
} do { $_ = $term->readline('swim: '); |
||||
|
push (@history,$_); |
||||
|
} while $_ ne "exit"; |
||||
|
$arg = $history[$#history - 1]; |
||||
|
if ($arg ne $HISTORY[$#HISTORY]) { |
||||
|
if ($arg =~ m,^[^\w],) { |
||||
|
$arg =~ s,^\s+(\w+),$1,; |
||||
|
} |
||||
|
history_print($arg,\%commands); |
||||
|
} |
||||
|
} |
||||
|
!($commands->{"r"} || $commands{"remove"}) ? |
||||
|
system "$apt_get install -qs $arg" : |
||||
|
system "$apt_get remove -qs $arg"; |
||||
|
} |
||||
|
##################### |
||||
|
# INSTALLATION MODE # |
||||
|
##################### |
||||
|
# provides optional --stdin to change packages to be installed |
||||
|
# from the command line |
||||
|
else { |
||||
|
my $arg; |
||||
|
my $count = 0; |
||||
|
foreach (@PACKAGES) { |
||||
|
if ($count == 0) { |
||||
|
$arg = "$_"; |
||||
|
} |
||||
|
else { |
||||
|
$arg = $arg . " " . "$_"; |
||||
|
} |
||||
|
$count++; |
||||
|
} |
||||
|
######### |
||||
|
# STDIN # |
||||
|
######### |
||||
|
if ($commands->{"stdin"}) { |
||||
|
my $term = Term::ReadLine->new("Simple Shell"); |
||||
|
my @HISTORY = history(\%commands); |
||||
|
$term->addhistory(@HISTORY); |
||||
|
my @history; push(@history,"$arg"); |
||||
|
print "swim: type exit to finish --stdin\n"; |
||||
|
my $termcount = 0; |
||||
|
while ($termcount < 1 ) { |
||||
|
$_ = $term->readline('swim: ',"$arg"); |
||||
|
push (@history,$_); |
||||
|
$termcount++; |
||||
|
} do { $_ = $term->readline('swim: '); |
||||
|
push (@history,$_); |
||||
|
} while $_ ne "exit"; |
||||
|
$arg = $history[$#history - 1]; |
||||
|
if ("$arg" ne "$HISTORY[$#HISTORY]") { |
||||
|
if ($arg =~ m,^[^\w],) { |
||||
|
$arg =~ s,^\s+(\w+),$1,; |
||||
|
} |
||||
|
history_print($arg,\%commands); |
||||
|
} |
||||
|
} |
||||
|
####### |
||||
|
# XYZ # |
||||
|
####### |
||||
|
if (!($commands->{"ftp"} || $commands->{"purge"})) { |
||||
|
if (!$commands->{"y"}) { |
||||
|
if (!$commands->{"nz"}) { |
||||
|
!($commands->{"r"} || $commands{"remove"}) ? |
||||
|
system "$apt_get install $arg" : |
||||
|
system "$apt_get remove $arg"; |
||||
|
} |
||||
|
else { |
||||
|
!($commands->{"r"} || $commands{"remove"}) ? |
||||
|
system "$apt_get -d install $arg" : |
||||
|
system "$apt_get remove $arg"; |
||||
|
} |
||||
|
} |
||||
|
else { |
||||
|
if (!$commands->{"nz"}) { |
||||
|
!($commands->{"r"} || $commands{"remove"}) ? |
||||
|
system "$apt_get install -y $arg" : |
||||
|
system "$apt_get remove -y $arg"; |
||||
|
} |
||||
|
else { |
||||
|
# not that the y does anything |
||||
|
!($commands->{"r"} || $commands{"remove"}) ? |
||||
|
system "$apt_get install -y -d $arg" : |
||||
|
system "$apt_get remove -y $arg"; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
####### |
||||
|
# FTP # |
||||
|
####### |
||||
|
elsif ($commands->{"ftp"}) { |
||||
|
require SWIM::Qftp; |
||||
|
SWIM::Qftp->import(qw(qftp)); |
||||
|
qftp($arg,\%commands); |
||||
|
} |
||||
|
|
||||
|
################## |
||||
|
# PURGE & REMOVE # |
||||
|
################## |
||||
|
elsif ($commands->{"purge"} || $commands->{"remove"} || $commands->{"r"}) { |
||||
|
purge($arg,\%commands); |
||||
|
} |
||||
|
|
||||
|
# this is a good time to return the versions, too, as well as |
||||
|
# including any NEW packages from --db and --ndb. We'll assume $arg |
||||
|
# from qftp will never be too large |
||||
|
if (!$commands->{"n"}) { |
||||
|
dbi(\%commands); |
||||
|
@PACKAGES = map($db{$_},(@PACKAGES = split(/\s/,$arg))); |
||||
|
} |
||||
|
else { |
||||
|
ndb(\%commands); |
||||
|
@PACKAGES = map($db{$_},(@PACKAGES = split(/\s/,$arg))); |
||||
|
} |
||||
|
untie %db; |
||||
|
} |
||||
|
|
||||
|
} # end sub xyz |
||||
|
|
||||
|
|
||||
|
# Remove (keep configuration files) or purge everything for each package. |
||||
|
sub purge { |
||||
|
|
||||
|
my ($arg,$commands) = @_; |
||||
|
|
||||
|
if (!$commands->{"n"}) { |
||||
|
if ($commands->{"purge"}) { |
||||
|
system "$dpkg --purge $arg"; |
||||
|
|
||||
|
} |
||||
|
elsif ($commands->{"remove"} || $commands->{"r"}) { |
||||
|
system "$dpkg -r $arg"; |
||||
|
} |
||||
|
} |
||||
|
else { |
||||
|
print "swim: "; |
||||
|
print "-r " if defined $commands->{"r"}; |
||||
|
print "--remove " if defined $commands->{"remove"}; |
||||
|
print "--purge " if defined $commands->{"purge"}; |
||||
|
print "can only be used with installed packages\n"; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
} # end sub purge |
||||
|
|
||||
|
|
||||
|
# find the history file and return proper output |
||||
|
sub history { |
||||
|
|
||||
|
my($commands) = @_; |
||||
|
my %commands = %$commands; |
||||
|
|
||||
|
my($arch,$dist) = which_archdist(\%commands); |
||||
|
my($place) = finddb(\%commands); |
||||
|
my $swim_history; |
||||
|
if ($commands->{"n"}) { |
||||
|
$swim_history = "$place/.nswim$arch$dist" . "_history"; |
||||
|
} |
||||
|
else { |
||||
|
$swim_history = "$place/.swim" . "_history"; |
||||
|
} |
||||
|
open(HISTORY,"$swim_history") or exit; |
||||
|
my (@HISTORY,$line); |
||||
|
while (<HISTORY>) { |
||||
|
chomp; |
||||
|
foreach (split(/\s/,$_)) { |
||||
|
if (!defined $line) { |
||||
|
$line = (split(/_/,$_))[0]; |
||||
|
} |
||||
|
else { |
||||
|
$line = $line . " " . (split(/_/,$_))[0]; |
||||
|
} |
||||
|
} |
||||
|
push(@HISTORY,$line); undef $line; |
||||
|
} |
||||
|
|
||||
|
return @HISTORY; |
||||
|
|
||||
|
} # end sub history |
||||
|
|
||||
|
# append history if it has changed |
||||
|
sub history_print { |
||||
|
|
||||
|
my($arg,$commands) = @_; |
||||
|
my %commands = %$commands; |
||||
|
my($arch,$dist) = which_archdist(\%commands); |
||||
|
my($place) = finddb(\%commands); |
||||
|
my $swim_history; |
||||
|
if ($commands->{"n"}) { |
||||
|
$swim_history = "$place/.nswim$arch$dist" . "_history"; |
||||
|
} |
||||
|
else { |
||||
|
$swim_history = "$place/.swim" . "_history"; |
||||
|
} |
||||
|
open(HISTORY,"$swim_history") or exit; |
||||
|
my @HISTORY = <HISTORY>; |
||||
|
close(HISTORY); |
||||
|
if ($#HISTORY < $HISTORY - 1) { |
||||
|
push(@HISTORY,"$arg\n"); |
||||
|
} |
||||
|
else { |
||||
|
shift(@HISTORY); |
||||
|
push(@HISTORY,"$arg\n"); |
||||
|
} |
||||
|
open(HISTORY,">$swim_history") or exit; |
||||
|
print HISTORY @HISTORY; |
||||
|
|
||||
|
|
||||
|
} # end sub history_print |
||||
|
|
||||
|
1; |
@ -0,0 +1,850 @@ |
|||||
|
# Package administration and research tool for Debian |
||||
|
# Copyright (C) 1999-2000 Jonathan D. Rosenbaum |
||||
|
|
||||
|
# This program 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. |
||||
|
|
||||
|
# This program 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 this program; if not, write to the Free Software |
||||
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
||||
|
|
||||
|
|
||||
|
package SWIM::Search; |
||||
|
use vars qw(@ISA @EXPORT); |
||||
|
use strict; |
||||
|
use SWIM::Global; |
||||
|
use SWIM::Conf; |
||||
|
use SWIM::DB_Library qw(:Search); |
||||
|
use SWIM::Library; |
||||
|
use Exporter; |
||||
|
@ISA = qw(Exporter); |
||||
|
@EXPORT = qw(search); |
||||
|
|
||||
|
|
||||
|
# search() and searchdf() = mm --search, --ps --refinesearch --research |
||||
|
|
||||
|
=pod |
||||
|
|
||||
|
This searches for keyword(s) amongst the descriptions, and then |
||||
|
shows the packages which match, a little more sophisticated than |
||||
|
swim -qait | grep <keyword>, besides you can use perl regexping |
||||
|
notation when you do your search. By default the description is |
||||
|
automatically presented, but a list of package names which match is kept |
||||
|
which can then be queried using -S in the normal fashion, until the |
||||
|
next search. |
||||
|
|
||||
|
=cut |
||||
|
|
||||
|
sub search { |
||||
|
|
||||
|
my ($search_mem,$commands,$num,$argv) = @_; |
||||
|
|
||||
|
$argument = "/."; |
||||
|
my %commands = %$commands; |
||||
|
|
||||
|
my %morethanone; |
||||
|
my $keyword = $commands->{"search"}; |
||||
|
if ($commands->{"search"}) { |
||||
|
$keyword = $commands->{"search"}; |
||||
|
} |
||||
|
elsif ($commands->{"research"}) { |
||||
|
$keyword = $commands->{"research"}; |
||||
|
} |
||||
|
elsif ($commands->{"refinesearch"}) { |
||||
|
$keyword = $commands->{"refinesearch"}; |
||||
|
} |
||||
|
elsif ($commands->{"powersearch"} || $commands->{"ps"}) { |
||||
|
if ($commands->{"powersearch"}) { |
||||
|
$keyword = $commands->{"powersearch"}; |
||||
|
} |
||||
|
if ($commands->{"ps"}) { |
||||
|
$keyword = $commands->{"ps"}; |
||||
|
} |
||||
|
} |
||||
|
my $count = 0; |
||||
|
|
||||
|
my ($search_file, $search_dir); |
||||
|
if (!$commands->{"n"}) { |
||||
|
ib(\%commands); |
||||
|
dbi(\%commands); |
||||
|
if ($commands->{"ps"} || $commands->{"powersearch"}) { |
||||
|
($search_file,$search_dir) = searchdf(\%commands); |
||||
|
if (-B $search_file && -B $search_dir) { |
||||
|
$search_file = "$gzip -dc $search_file|"; |
||||
|
$search_dir = "$gzip -dc $search_dir|"; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
##### |
||||
|
# N # |
||||
|
##### |
||||
|
else { |
||||
|
my $return = nib(\%commands); |
||||
|
if (!defined $return) { |
||||
|
untie %ib; |
||||
|
nsb(\%commands); |
||||
|
$ib{"/."} = $nsb{"/."}; |
||||
|
} |
||||
|
ndb(\%commands); |
||||
|
if ($commands->{"ps"} || $commands->{"powersearch"}) { |
||||
|
($search_file,$search_dir) = searchdf(\%commands); |
||||
|
if (!-e $search_file || !-e $search_dir) { |
||||
|
delete $commands{"ps"} if defined $commands->{"ps"}; |
||||
|
delete $commands{"powersearch"} if defined $commands->{"powersearch"}; |
||||
|
} |
||||
|
if (-B $search_file && -B $search_dir) { |
||||
|
$search_file = "$gzip -dc $search_file|"; |
||||
|
$search_dir = "$gzip -dc $search_dir|"; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
########## |
||||
|
# # |
||||
|
# SEARCH # |
||||
|
# # |
||||
|
########## |
||||
|
# Here starts --search & optionally -g |
||||
|
my ($line,@HISTORY); |
||||
|
if ($commands->{"search"}) { |
||||
|
my @stuff; |
||||
|
if ($commands->{"g"}) { |
||||
|
# check for some errors |
||||
|
if ($commands->{"a"} || $commands->{"f"} || $commands->{"dir"}) { |
||||
|
print "swim: one type of query/verify may be performed at a time\n"; |
||||
|
exit; |
||||
|
} |
||||
|
# extract the packages related to the group. |
||||
|
if (!$commands->{"n"}) { |
||||
|
gb(\%commands); |
||||
|
} |
||||
|
else { |
||||
|
ngb(\%commands) |
||||
|
} |
||||
|
if ($#ARGV != -1) { |
||||
|
foreach (@ARGV) { |
||||
|
$argument = $_; |
||||
|
if (defined $gb{$argument}) { |
||||
|
@stuff = split(/\s/, $gb{$argument}); |
||||
|
} |
||||
|
else { |
||||
|
print "group $argument does not contain any packages\n"; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
else { |
||||
|
print "swim: no arguments given for query\n"; |
||||
|
} |
||||
|
untie %gb; |
||||
|
} # if ($commands->{"g"}) |
||||
|
|
||||
|
# not yet for -g |
||||
|
if ($commands->{"search"} && !$commands->{"g"}) { |
||||
|
if (defined $argument) { |
||||
|
if ($ib{"$argument"}){ |
||||
|
foreach (split(/\s/, $ib{"$argument"})) { |
||||
|
if ($keyword =~ /\/i$/) { |
||||
|
$keyword =~ m,(.*)\/i$,; |
||||
|
if (defined $db{$_}) { |
||||
|
if ($db{$_} =~ /$1/i) { |
||||
|
print "$db{$_}\n" if !$commands->{"no"}; |
||||
|
push(@PACKAGES,$_); |
||||
|
if (!defined $line) { |
||||
|
$line = (split(/_/,$_))[0]; |
||||
|
} |
||||
|
else { |
||||
|
$line = $line . " " . (split(/_/,$_))[0]; |
||||
|
} |
||||
|
$count++; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
elsif ($keyword =~ /\/m$/) { |
||||
|
$keyword =~ m,(.*)\/m$,; |
||||
|
if (defined $db{$_}) { |
||||
|
if ($db{$_} =~ /$1/m ) { |
||||
|
print "$db{$_}\n" if !$commands->{"no"}; |
||||
|
push(@PACKAGES,$_); |
||||
|
if (!defined $line) { |
||||
|
$line = (split(/_/,$_))[0]; |
||||
|
} |
||||
|
else { |
||||
|
$line = $line . " " . (split(/_/,$_))[0]; |
||||
|
} |
||||
|
$count++; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
elsif ($keyword =~ /\/.[im]$/) { |
||||
|
$keyword =~ m,(.*)\/.[im]$,; |
||||
|
if (defined $db{$_}) { |
||||
|
if ($db{$_} =~ /$1/im ) { |
||||
|
print "$db{$_}\n" if !$commands->{"no"}; |
||||
|
push(@PACKAGES,$_); |
||||
|
if (!defined $line) { |
||||
|
$line = (split(/_/,$_))[0]; |
||||
|
} |
||||
|
else { |
||||
|
$line = $line . " " . (split(/_/,$_))[0]; |
||||
|
} |
||||
|
$count++; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
else { |
||||
|
if (defined $db{$_}) { |
||||
|
if ($db{$_} =~ /$keyword/) { |
||||
|
print "$db{$_}\n" if !$commands->{"no"}; |
||||
|
push(@PACKAGES,$_); |
||||
|
if (!defined $line) { |
||||
|
$line = (split(/_/,$_))[0]; |
||||
|
} |
||||
|
else { |
||||
|
$line = $line . " " . (split(/_/,$_))[0]; |
||||
|
} |
||||
|
$count++; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
print "swim: found $count package(s)\n"; |
||||
|
#exit; |
||||
|
} |
||||
|
if (!defined $line) { |
||||
|
$line = ""; |
||||
|
} |
||||
|
else { |
||||
|
$line = "$line\n"; |
||||
|
} |
||||
|
history($line,$search_mem); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
# ok -g |
||||
|
elsif ($commands->{"search"} && $commands->{"g"}) { |
||||
|
if (defined @stuff) { |
||||
|
#unlink("$search_mem"); |
||||
|
foreach (@stuff) { |
||||
|
$argument = $_; |
||||
|
version(\%commands); |
||||
|
# if we just did a group search we don't want to append it to |
||||
|
# the .search.deb file. |
||||
|
if ($keyword =~ /\/i$/) { |
||||
|
$keyword =~ m,(.*)\/i$,; |
||||
|
if (defined $db{$_}) { |
||||
|
if ($db{$argument} =~ /$1/i) { |
||||
|
print "$db{$argument}\n" if !$commands->{"no"}; |
||||
|
push(@PACKAGES,$argument); |
||||
|
if (!defined $line) { |
||||
|
$line = (split(/_/,$_))[0]; |
||||
|
} |
||||
|
else { |
||||
|
$line = $line . " " . (split(/_/,$_))[0]; |
||||
|
} |
||||
|
$count++; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
elsif ($keyword =~ /\/m$/) { |
||||
|
$keyword =~ m,(.*)\/m$,; |
||||
|
if (defined $db{$_}) { |
||||
|
if ($db{$argument} =~ /$1/m ) { |
||||
|
print "$db{$argument}\n" if !$commands->{"no"}; |
||||
|
push(@PACKAGES,$argument); |
||||
|
if (!defined $line) { |
||||
|
$line = (split(/_/,$_))[0]; |
||||
|
} |
||||
|
else { |
||||
|
$line = $line . " " . (split(/_/,$_))[0]; |
||||
|
} |
||||
|
$count++; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
elsif ($keyword =~ /\/.[im]$/) { |
||||
|
$keyword =~ m,(.*)\/.[im]$,; |
||||
|
if (defined $db{$_}) { |
||||
|
if ($db{$argument} =~ /$1/im ) { |
||||
|
print "$db{$argument}\n" if !$commands->{"no"}; |
||||
|
push(@PACKAGES,$argument); |
||||
|
if (!defined $line) { |
||||
|
$line = (split(/_/,$_))[0]; |
||||
|
} |
||||
|
else { |
||||
|
$line = $line . " " . (split(/_/,$_))[0]; |
||||
|
} |
||||
|
$count++; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
else { |
||||
|
if (defined $db{$_}) { |
||||
|
if ($db{$argument} =~ /$keyword/) { |
||||
|
print "$db{$argument}\n" if !$commands->{"no"}; |
||||
|
push(@PACKAGES,$argument); |
||||
|
if (!defined $line) { |
||||
|
$line = (split(/_/,$_))[0]; |
||||
|
} |
||||
|
else { |
||||
|
$line = $line . " " . (split(/_/,$_))[0]; |
||||
|
} |
||||
|
$count++; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
print "swim: found $count package(s)\n"; |
||||
|
if (!defined $line) { |
||||
|
$line = ""; |
||||
|
} |
||||
|
else { |
||||
|
$line = "$line\n"; |
||||
|
} |
||||
|
history($line,$search_mem); |
||||
|
} |
||||
|
} |
||||
|
exit if !($commands->{"stdin"} || $commands->{"x"} || $commands->{"y"} || |
||||
|
$commands->{"z"} || $commands->{"ftp"}); |
||||
|
} |
||||
|
|
||||
|
############################# |
||||
|
# # |
||||
|
# RESEARCH || REFINESEARCH # |
||||
|
# # |
||||
|
############################# |
||||
|
# research time or refining time |
||||
|
if ($commands->{"research"} || $commands{"refinesearch"}) { |
||||
|
if ($commands->{"g"}) { |
||||
|
print "swim: use -g only with a new search\n"; |
||||
|
exit; |
||||
|
} |
||||
|
foreach (@$argv) { |
||||
|
if ($keyword =~ /\/i$/) { |
||||
|
$keyword =~ m,(.*)\/i$,; |
||||
|
if (defined $db{$_}) { |
||||
|
if ($db{$db{$_}} =~ /$1/i) { |
||||
|
print "$db{$db{$_}}\n" if !$commands->{"no"}; |
||||
|
push(@PACKAGES,$_); |
||||
|
if (!defined $line) { |
||||
|
$line = (split(/_/,$_))[0]; |
||||
|
} |
||||
|
else { |
||||
|
$line = $line . " " . (split(/_/,$_))[0]; |
||||
|
} |
||||
|
$count++; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
elsif ($keyword =~ /\/m$/) { |
||||
|
$keyword =~ m,(.*)\/m$,; |
||||
|
if (defined $db{$_}) { |
||||
|
if ($db{$db{$_}} =~ /$1/m ) { |
||||
|
print "$db{$db{$_}}\n" if !$commands->{"no"}; |
||||
|
push(@PACKAGES,$_); |
||||
|
if (!defined $line) { |
||||
|
$line = (split(/_/,$_))[0]; |
||||
|
} |
||||
|
else { |
||||
|
$line = $line . " " . (split(/_/,$_))[0]; |
||||
|
} |
||||
|
$count++; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
elsif ($keyword =~ /\/.[im]$/) { |
||||
|
$keyword =~ m,(.*)\/.[im]$,; |
||||
|
if (defined $db{$_}) { |
||||
|
if ($db{$db{$_}} =~ /$1/im ) { |
||||
|
print "$db{$db{$_}}\n" if !$commands->{"no"}; |
||||
|
push(@PACKAGES,$_); |
||||
|
if (!defined $line) { |
||||
|
$line = (split(/_/,$_))[0]; |
||||
|
} |
||||
|
else { |
||||
|
$line = $line . " " . (split(/_/,$_))[0]; |
||||
|
} |
||||
|
$count++; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
else { |
||||
|
if (defined $db{$_}) { |
||||
|
if ($db{$db{$_}} =~ /$keyword/) { |
||||
|
print "$db{$db{$_}}\n" if !$commands->{"no"}; |
||||
|
push(@PACKAGES,$_); |
||||
|
if (!defined $line) { |
||||
|
$line = (split(/_/,$_))[0]; |
||||
|
} |
||||
|
else { |
||||
|
$line = $line . " " . (split(/_/,$_))[0]; |
||||
|
} |
||||
|
$count++; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
print "swim: found $count package(s)\n"; |
||||
|
if (!defined $line) { |
||||
|
$line = ""; |
||||
|
} |
||||
|
else { |
||||
|
$line = "$line\n"; |
||||
|
} |
||||
|
# refine the search |
||||
|
if ($commands->{"refinesearch"}) { |
||||
|
open(HISTORY, "$search_mem") || exit; |
||||
|
my @HISTORY = reverse <HISTORY>; |
||||
|
close(HISTORY); |
||||
|
$HISTORY[$num - 1] = $line; |
||||
|
open(HISTORY, ">$search_mem") || exit; |
||||
|
print HISTORY reverse @HISTORY; |
||||
|
close(HISTORY); |
||||
|
} |
||||
|
exit if !($commands->{"stdin"} || $commands->{"x"} || |
||||
|
$commands->{"y"} || $commands->{"z"} || $commands->{"ftp"}); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
################ |
||||
|
# # |
||||
|
# POWERSEARCH # |
||||
|
# # |
||||
|
################ |
||||
|
# powersearch with no -g option since this searchs all files. |
||||
|
if (($commands->{"powersearch"} || $commands->{"ps"}) && !$commands->{"g"}) { |
||||
|
open(FLATFILE, "$search_file"); |
||||
|
while (<FLATFILE>) { |
||||
|
chomp $_; |
||||
|
if ($keyword =~ /\/i$/) { |
||||
|
$keyword =~ m,(.*)\/i$,; |
||||
|
if ($_ =~ /$1/i) { |
||||
|
if (defined $ib{$_}) { |
||||
|
$morethanone{$ib{$_}}++; |
||||
|
if ($morethanone{$ib{$_}} == 1) { |
||||
|
print "$db{$ib{$_}}\n" if !$commands->{"no"}; |
||||
|
push(@PACKAGES,$ib{$_}); |
||||
|
if (!defined $line) { |
||||
|
$line = (split(/_/,$ib{$_}))[0]; |
||||
|
} |
||||
|
else { |
||||
|
$line = $line . " " . (split(/_/,$ib{$_}))[0]; |
||||
|
} |
||||
|
$count++; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
elsif ($keyword =~ /\/m$/) { |
||||
|
$keyword =~ m,(.*)\/m$,; |
||||
|
if ($_ =~ /$1/m ) { |
||||
|
if (defined $ib{$_}) { |
||||
|
$morethanone{$ib{$_}}++; |
||||
|
if ($morethanone{$ib{$_}} == 1) { |
||||
|
print "$db{$ib{$_}}\n" if !$commands->{"no"}; |
||||
|
push(@PACKAGES,$ib{$_}); |
||||
|
if (!defined $line) { |
||||
|
$line = (split(/_/,$ib{$_}))[0]; |
||||
|
} |
||||
|
else { |
||||
|
$line = $line . " " . (split(/_/,$ib{$_}))[0]; |
||||
|
} |
||||
|
$count++; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
elsif ($keyword =~ /\/.[im]$/) { |
||||
|
$keyword =~ m,(.*)\/.[im]$,; |
||||
|
if ($_ =~ /$1/im ) { |
||||
|
if (defined $ib{$_}) { |
||||
|
$morethanone{$ib{$_}}++; |
||||
|
if ($morethanone{$ib{$_}} == 1) { |
||||
|
print "$db{$ib{$_}}\n" if !$commands->{"no"}; |
||||
|
push(@PACKAGES,$ib{$_}); |
||||
|
if (!defined $line) { |
||||
|
$line = (split(/_/,$ib{$_}))[0]; |
||||
|
} |
||||
|
else { |
||||
|
$line = $line . " " . (split(/_/,$ib{$_}))[0]; |
||||
|
} |
||||
|
$count++; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
else { |
||||
|
if ($_ =~ /$keyword/) { |
||||
|
if (defined $ib{$_}) { |
||||
|
$morethanone{$ib{$_}}++; |
||||
|
if ($morethanone{$ib{$_}} == 1) { |
||||
|
# ofcourse this won't work if a dir filters through. |
||||
|
# hummm. |
||||
|
#print "HUMM DIR $_ ", $ib{$_}, "\n"; |
||||
|
print "$db{$ib{$_}}\n" if !$commands->{"no"}; |
||||
|
push(@PACKAGES,$ib{$_}); |
||||
|
if (!defined $line) { |
||||
|
$line = (split(/_/,$ib{$_}))[0]; |
||||
|
} |
||||
|
else { |
||||
|
$line = $line . " " . (split(/_/,$ib{$_}))[0]; |
||||
|
} |
||||
|
$count++; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} # while (<FLATFILE>) |
||||
|
close(FLATFILE); |
||||
|
|
||||
|
####### |
||||
|
# DIR # |
||||
|
####### |
||||
|
# Somebody wants to do a rare --dir search, but this is done by default |
||||
|
# for the n* because often enough more than one package shares one |
||||
|
# file. |
||||
|
if ($commands->{"dir"} || $commands{"n"}) { |
||||
|
open(FLATFILE, "$search_dir"); |
||||
|
while (<FLATFILE>) { |
||||
|
chomp $_; |
||||
|
if ($keyword =~ /\/i$/) { |
||||
|
$keyword =~ m,(.*)\/i$,; |
||||
|
if ($_ =~ /$1/i) { |
||||
|
if (defined $ib{$_}) { |
||||
|
$morethanone{$ib{$_}}++; |
||||
|
if ($morethanone{$ib{$_}} == 1) { |
||||
|
my @dir = split(/\s/,$ib{$_}); |
||||
|
foreach (@dir) { |
||||
|
$morethanone{$_}++; |
||||
|
if (defined $morethanone{$_}) { |
||||
|
if ($morethanone{$_} == 1) { |
||||
|
print "$db{$_}\n" if !$commands->{"no"}; |
||||
|
push(@PACKAGES,$_); |
||||
|
if (!defined $line) { |
||||
|
$line = (split(/_/,$_))[0]; |
||||
|
} |
||||
|
else { |
||||
|
$line = $line . " " . (split(/_/,$_))[0]; |
||||
|
} |
||||
|
$count++; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
elsif ($keyword =~ /\/m$/) { |
||||
|
$keyword =~ m,(.*)\/m$,; |
||||
|
if ($_ =~ /$1/m ) { |
||||
|
if (defined $ib{$_}) { |
||||
|
$morethanone{$ib{$_}}++; |
||||
|
if ($morethanone{$ib{$_}} == 1) { |
||||
|
my @dir = split(/\s/,$ib{$_}); |
||||
|
foreach (@dir) { |
||||
|
$morethanone{$_}++; |
||||
|
if (defined $morethanone{$_}) { |
||||
|
if ($morethanone{$_} == 1) { |
||||
|
print "$db{$_}\n" if !$commands->{"no"}; |
||||
|
push(@PACKAGES,$_); |
||||
|
if (!defined $line) { |
||||
|
$line = (split(/_/,$_))[0]; |
||||
|
} |
||||
|
else { |
||||
|
$line = $line . " " . (split(/_/,$_))[0]; |
||||
|
} |
||||
|
$count++; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
elsif ($keyword =~ /\/.[im]$/) { |
||||
|
$keyword =~ m,(.*)\/.[im]$,; |
||||
|
if ($_ =~ /$1/im ) { |
||||
|
if (defined $ib{$_}) { |
||||
|
$morethanone{$ib{$_}}++; |
||||
|
if ($morethanone{$ib{$_}} == 1) { |
||||
|
my @dir = split(/\s/,$ib{$_}); |
||||
|
foreach (@dir) { |
||||
|
$morethanone{$_}++; |
||||
|
if (defined $morethanone{$_}) { |
||||
|
if ($morethanone{$_} == 1) { |
||||
|
print "$db{$_}\n" if !$commands->{"no"}; |
||||
|
push(@PACKAGES,$_); |
||||
|
if (!defined $line) { |
||||
|
$line = (split(/_/,$_))[0]; |
||||
|
} |
||||
|
else { |
||||
|
$line = $line . " " . (split(/_/,$_))[0]; |
||||
|
} |
||||
|
$count++; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
else { |
||||
|
if ($_ =~ /$keyword/) { |
||||
|
if (defined $ib{$_}) { |
||||
|
#my @dir = split(/\s/,$ib{$_}); |
||||
|
#foreach (@dir) { |
||||
|
$morethanone{$ib{$_}}++; |
||||
|
if ($morethanone{$ib{$_}} == 1) { |
||||
|
my @dir = split(/\s/,$ib{$_}); |
||||
|
foreach (@dir) { |
||||
|
$morethanone{$_}++; |
||||
|
if (defined $morethanone{$_}) { |
||||
|
if ($morethanone{$_} == 1) { |
||||
|
print "$db{$_}\n" if !$commands->{"no"}; |
||||
|
push(@PACKAGES,$_); |
||||
|
if (!defined $line) { |
||||
|
$line = (split(/_/,$_))[0]; |
||||
|
} |
||||
|
else { |
||||
|
$line = $line . " " . (split(/_/,$_))[0]; |
||||
|
} |
||||
|
$count++; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} # while (<FLATFILE>) |
||||
|
close(FLATFILE); |
||||
|
} |
||||
|
|
||||
|
################# |
||||
|
# NORMAL SEARCH # |
||||
|
################# |
||||
|
# now we can do a normal search for the powersearch |
||||
|
if (defined $argument) { |
||||
|
if ($ib{"$argument"}){ |
||||
|
foreach (split(/\s/, $ib{$argument})) { |
||||
|
if ($keyword =~ /\/i$/) { |
||||
|
$morethanone{$_}++; |
||||
|
if ($morethanone{$_} == 1) { |
||||
|
$keyword =~ m,(.*)\/i$,; |
||||
|
if (defined $db{$_}) { |
||||
|
if ($db{$_} =~ /$1/i) { |
||||
|
print "$db{$_}\n" if !$commands->{"no"}; |
||||
|
push(@PACKAGES,$_); |
||||
|
if (!defined $line) { |
||||
|
$line = (split(/_/,$_))[0]; |
||||
|
} |
||||
|
else { |
||||
|
$line = $line . " " . (split(/_/,$_))[0]; |
||||
|
} |
||||
|
$count++; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
elsif ($keyword =~ /\/m$/) { |
||||
|
$morethanone{$_}++; |
||||
|
if ($morethanone{$_} == 1) { |
||||
|
$keyword =~ m,(.*)\/m$,; |
||||
|
if (defined $db{$_}) { |
||||
|
if ($db{$_} =~ /$1/m ) { |
||||
|
print "$db{$_}\n" if !$commands->{"no"}; |
||||
|
push(@PACKAGES,$_); |
||||
|
if (!defined $line) { |
||||
|
$line = (split(/_/,$_))[0]; |
||||
|
} |
||||
|
else { |
||||
|
$line = $line . " " . (split(/_/,$_))[0]; |
||||
|
} |
||||
|
$count++; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
elsif ($keyword =~ /\/.[im]$/) { |
||||
|
$morethanone{$_}++; |
||||
|
if ($morethanone{$_} == 1) { |
||||
|
$keyword =~ m,(.*)\/.[im]$,; |
||||
|
if (defined $db{$_}) { |
||||
|
if ($db{$_} =~ /$1/im ) { |
||||
|
print "$db{$_}\n" if !$commands->{"no"}; |
||||
|
push(@PACKAGES,$_); |
||||
|
if (!defined $line) { |
||||
|
$line = (split(/_/,$_))[0]; |
||||
|
} |
||||
|
else { |
||||
|
$line = $line . " " . (split(/_/,$_))[0]; |
||||
|
} |
||||
|
$count++; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
else { |
||||
|
$morethanone{$_}++; |
||||
|
if ($morethanone{$_} == 1) { |
||||
|
if (defined $db{$_}) { |
||||
|
if ($db{$_} =~ /$keyword/) { |
||||
|
print "$db{$_}\n" if !$commands->{"no"}; |
||||
|
push(@PACKAGES,$_); |
||||
|
if (!defined $line) { |
||||
|
$line = (split(/_/,$_))[0]; |
||||
|
} |
||||
|
else { |
||||
|
$line = $line . " " . (split(/_/,$_))[0]; |
||||
|
} |
||||
|
$count++; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
print "swim: found $count package(s)\n"; |
||||
|
if (!defined $line) { |
||||
|
$line = ""; |
||||
|
} |
||||
|
else { |
||||
|
$line = "$line\n"; |
||||
|
} |
||||
|
history($line,$search_mem); |
||||
|
#exit if !($commands->{"stdin"} || $commands->{"x"} || |
||||
|
# $commands->{"y"} || $commands->{"z"} || $commands->{"ftp"}); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
untie %ib; |
||||
|
untie %db; |
||||
|
|
||||
|
|
||||
|
} # end sub search |
||||
|
|
||||
|
# for finding the search flatfiles |
||||
|
sub searchdf { |
||||
|
|
||||
|
my ($commands) = @_; |
||||
|
|
||||
|
my($sfile,$sdir); |
||||
|
if (!$commands->{"n"}) { |
||||
|
my ($ramdisk) = ram_on(); |
||||
|
if ($ramdisk eq 1) { |
||||
|
if (($commands->{"dbpath"} && $commands->{"root"}) || |
||||
|
($commands->{"dbpath"} && !$commands->{"root"}) || |
||||
|
(!$commands->{"dbpath"} && !$commands->{"root"})) { |
||||
|
$sfile = "$parent$library/searchindex.deb"; |
||||
|
$sdir = "$parent$library/dirindex.deb"; |
||||
|
return ($sfile,$sdir); |
||||
|
} |
||||
|
elsif (!$commands->{"dbpath"} && $commands->{"root"}) { |
||||
|
$sfile = "$parent$base/searchindex.deb"; |
||||
|
$sdir = "$parent$base/dirindex.deb"; |
||||
|
return ($sfile,$sdir); |
||||
|
} |
||||
|
} |
||||
|
elsif ($ramdisk eq "yes") { |
||||
|
if (($commands->{"dbpath"} && $commands->{"root"}) || |
||||
|
($commands->{"dbpath"} && !$commands->{"root"}) || |
||||
|
(!$commands->{"dbpath"} && !$commands->{"root"})) { |
||||
|
$sfile = "$parent$library/dramdisk/searchindex.deb.gz"; |
||||
|
$sdir = "$parent$library/dramdisk/dirindex.deb.gz"; |
||||
|
if (!-e $sdir && !-e $sfile) { |
||||
|
print "swim: found wrong database(s), use --ramdiskoff\n"; |
||||
|
exit; |
||||
|
} |
||||
|
return ($sfile,$sdir); |
||||
|
} |
||||
|
elsif (!$commands->{"dbpath"} && $commands->{"root"}) { |
||||
|
$sfile = "$parent$base/dramdisk/searchindex.deb.gz"; |
||||
|
$sdir = "$parent$base/dramdisk/dirindex.deb.gz"; |
||||
|
if (!-e $sdir && !-e $sfile) { |
||||
|
print "swim: found wrong database(s), use --ramdiskoff\n"; |
||||
|
exit; |
||||
|
} |
||||
|
return ($sfile,$sdir); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
else { |
||||
|
my ($ramdisk) = ram_on(); |
||||
|
my($arch,$dist) = which_archdist(\%commands); |
||||
|
if ($ramdisk eq 1) { |
||||
|
if (($commands->{"dbpath"} && $commands->{"root"}) || |
||||
|
($commands->{"dbpath"} && !$commands->{"root"}) || |
||||
|
(!$commands->{"dbpath"} && !$commands->{"root"})) { |
||||
|
$sfile = "$parent$library/nsearchindex$arch$dist.deb"; |
||||
|
$sdir = "$parent$library/ndirindex$arch$dist.deb"; |
||||
|
return ($sfile,$sdir); |
||||
|
} |
||||
|
elsif (!$commands->{"dbpath"} && $commands->{"root"}) { |
||||
|
$sfile = "$parent$base/nsearchindex$arch$dist.deb"; |
||||
|
$sdir = "$parent$base/ndirindex$arch$dist.deb"; |
||||
|
return ($sfile,$sdir); |
||||
|
} |
||||
|
} |
||||
|
elsif ($ramdisk eq "yes") { |
||||
|
if (($commands->{"dbpath"} && $commands->{"root"}) || |
||||
|
($commands->{"dbpath"} && !$commands->{"root"}) || |
||||
|
(!$commands->{"dbpath"} && !$commands->{"root"})) { |
||||
|
$sfile = "$parent$library/dramdisk/nsearchindex$arch$dist.deb.gz"; |
||||
|
$sdir = "$parent$library/dramdisk/ndirindex$arch$dist.deb.gz"; |
||||
|
if (!-e $sdir && !-e $sfile) { |
||||
|
print "swim: found wrong database(s), use --ramdiskoff\n"; |
||||
|
exit; |
||||
|
} |
||||
|
return ($sfile,$sdir); |
||||
|
} |
||||
|
elsif (!$commands->{"dbpath"} && $commands->{"root"}) { |
||||
|
$sfile = "$parent$base/dramdisk/nsearchindex$arch$dist.deb.gz"; |
||||
|
$sdir = "$parent$base/dramdisk/ndirindex$arch$dist.deb.gz"; |
||||
|
if (!-e $sdir && !-e $sfile) { |
||||
|
print "swim: found wrong database(s), use --ramdiskoff\n"; |
||||
|
exit; |
||||
|
} |
||||
|
return ($sfile,$sdir); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
} # end sub searchdf |
||||
|
|
||||
|
# print the search out to the right spot on the HISTORY |
||||
|
# this is just shift and push |
||||
|
sub history { |
||||
|
|
||||
|
my($line,$file) = @_; |
||||
|
my @HISTORY; |
||||
|
|
||||
|
if (-e "$file") { |
||||
|
open(HISTORY,"$file"); |
||||
|
@HISTORY = <HISTORY>; |
||||
|
close(HISTORY); |
||||
|
if ($#HISTORY < $HISTORY - 1) { |
||||
|
push(@HISTORY,$line); |
||||
|
} |
||||
|
else { |
||||
|
shift(@HISTORY); |
||||
|
push(@HISTORY,$line); |
||||
|
} |
||||
|
} |
||||
|
else { |
||||
|
@HISTORY = $line; |
||||
|
} |
||||
|
|
||||
|
open(HISTORY,">$file") or exit; |
||||
|
print HISTORY @HISTORY; |
||||
|
close(HISTORY); |
||||
|
|
||||
|
} # end sub history |
||||
|
|
||||
|
|
||||
|
1; |
File diff suppressed because it is too large
File diff suppressed because it is too large
@ -0,0 +1,49 @@ |
|||||
|
<html><head> |
||||
|
<title>swim - PREPARING YOUR INSTALLATION FOR APT |
||||
|
</title> |
||||
|
<link rev=made href="mailto:mttrader@access.mountain.net"> |
||||
|
</head><body> |
||||
|
<h1> |
||||
|
swim - chapter 8<br> |
||||
|
PREPARING YOUR INSTALLATION FOR APT |
||||
|
|
||||
|
</h1> |
||||
|
|
||||
|
<pre>usage: swim --audit |
||||
|
swim --status |
||||
|
swim -C</pre> |
||||
|
<P> |
||||
|
|
||||
|
If you are using <strong>apt</strong> with <strong>swim</strong>, and this |
||||
|
is the first time you are using it with your installation, check your live |
||||
|
installation with this major mode. This is a call to <strong>dpkg -C |
||||
|
(--audit)</strong>, and will show any packages which are not properly |
||||
|
configured or installed. If you get any output, make corrections. The goal |
||||
|
is to get absolutely no output whatsoever because it is under these |
||||
|
conditions that apt will work properly. See the <A href="ch-query.html#s-vrrm">REMOVING AN INSTALLED PACKAGE - VIRTUAL OPTIONS |
||||
|
, section 9.8</A> with |
||||
|
<strong>-q</strong> to remove the offending packages. You may have to |
||||
|
remove the package by hand under unusual situations like when it is not |
||||
|
just dependencies (see <code>-T</code>) between packages keeping the package |
||||
|
from being removed perhaps due to a broken script (see |
||||
|
<code>--scripts</code>). In an extreme case you could manually remove the |
||||
|
entry for this package from the <em>/var/lib/dpkg/status</em> database, |
||||
|
and hunt down and remove all the files associated with the package with |
||||
|
<strong>swim's -l</strong> option. When you are done if you still want |
||||
|
some of the packages you removed, use <strong>apt</strong> to reinstall |
||||
|
them with <strong>swim's -xyz</strong> option. Also, <strong>apt</strong> |
||||
|
provides its own built-in method to clean up your system, and will provide |
||||
|
instructions, but you still may have to do some of the cleaning yourself |
||||
|
as discussed above. |
||||
|
|
||||
|
<hr> |
||||
|
swim |
||||
|
- <A href="index.html#copyright"> |
||||
|
Copyright © 1999 Jonathan D. Rosenbaum |
||||
|
</A> |
||||
|
<br> |
||||
|
<A href="index.html#toc">Contents</A>; <A href="ch-query.html">next</A>; <A href="ch-notinstalled.html">back</A>. |
||||
|
<br> |
||||
|
<address>15 June 1999<br> |
||||
|
Jonathan D. Rosenbaum<A href="mailto:mttrader@access.mountain.net">mttrader@access.mountain.net</A></address> |
||||
|
</body></html> |
@ -0,0 +1,158 @@ |
|||||
|
<html><head> |
||||
|
<title>swim - COMMAND LINE OPTION SYNTAX |
||||
|
</title> |
||||
|
<link rev=made href="mailto:mttrader@access.mountain.net"> |
||||
|
</head><body> |
||||
|
<h1> |
||||
|
swim - chapter 2<br> |
||||
|
COMMAND LINE OPTION SYNTAX |
||||
|
|
||||
|
</h1> |
||||
|
When you press ``<strong>swim</strong> |
||||
|
<<strong>enter</strong>>`` you will see a listing of command line |
||||
|
options in a particular syntax. This is to help you understand under what |
||||
|
context to use the options. When you enter the options on the command |
||||
|
line, the brackets, parentheses, braces, diamonds, and question marks are |
||||
|
not actually used. |
||||
|
<P> |
||||
|
|
||||
|
|
||||
|
<strong>Major Mode Option</strong> |
||||
|
<P> |
||||
|
|
||||
|
All command line options for <strong>swim</strong> always start with a |
||||
|
<strong>major mode option</strong>, except for ``swim <enter>`` |
||||
|
which will show the whole listing of options. A major mode option is |
||||
|
surrounded in braces <strong>{ major mode option }</strong>. In the case |
||||
|
of {--search} there are the alternative major mode options |
||||
|
{--refinesearch} and {--research}, but because --search needs to be used |
||||
|
first before either of these two options, --refinesearch and --research |
||||
|
are surrounded in parentheses (). |
||||
|
<P> |
||||
|
|
||||
|
Note: Through the other chapters of this manual <strong>{}</strong> is |
||||
|
assumed for the <strong>major modes</strong> in the |
||||
|
<strong>usage:</strong> section shown at the beginning of every chapter. |
||||
|
<P> |
||||
|
|
||||
|
Let's take a closer look at this situation: |
||||
|
|
||||
|
<P> |
||||
|
|
||||
|
<code>{--search ? (--research || --refinesearch)<pattern(s)>}</code> |
||||
|
<P> |
||||
|
`<strong>||</strong>' or `<strong>|</strong>' are used to indicate |
||||
|
`<strong>or</strong>', `<strong>?</strong>' indicates |
||||
|
`<strong>optional</strong>', <diamond> indicates an |
||||
|
<strong>argument</strong> (a required argument - see Arguments below), |
||||
|
(parenthesis) means `if used, must be used after the |
||||
|
previous required option was used'. Note: for readability |
||||
|
<code>--research</code> and -<code>-refinesearch</code> are not surrounded in |
||||
|
<code>{}</code>. |
||||
|
<P> |
||||
|
|
||||
|
<strong>Normal Options</strong> |
||||
|
<P> |
||||
|
|
||||
|
Options to the major mode options are enclosed in brackets <strong>[ |
||||
|
option to major mode ]</strong>. <code>swim [-n]</code> |
||||
|
<<code>enter</code>> (assume enter from here on out), for instance, |
||||
|
will show all the command line options without using the pager. The pager |
||||
|
which swim uses can be set in <em>swimrc</em> (see <em>swimrc(8)</em>). |
||||
|
``<code>swim {--help} [-n]</code>'' will provide brief explanations of all of |
||||
|
swim's options without using the pager. In this case the major mode option |
||||
|
<strong>{--help}</strong>, and the option <strong>[-n]</strong> were used. |
||||
|
<P> |
||||
|
|
||||
|
<strong>Dashes</strong> |
||||
|
<P> |
||||
|
|
||||
|
Options which have a single dash can be combined with other single dashed |
||||
|
options <strong>(-qaint)</strong>. Double dashed options need to be |
||||
|
entered by themselves <strong>(--help --nopager)</strong>, many double |
||||
|
dashed options have an alternative single dash option <strong>(-n for |
||||
|
--nopager)</strong>. The meaning of options is related to the major |
||||
|
mode they are being used with. <strong>[-n]</strong> means no pager |
||||
|
when called with <strong>{--help}</strong>, but it's a reference to the |
||||
|
not-installed databases when used with <strong>{-q --query}</strong>, |
||||
|
fortunately most options do not have double meanings. |
||||
|
<P> |
||||
|
|
||||
|
<strong>Arguments</strong> |
||||
|
<P> |
||||
|
|
||||
|
Many options require an argument. Arguments are enclose in diamonds < |
||||
|
<strong>argument</strong> >. An argument to an option may also be |
||||
|
optional in which case a question mark ``<strong>?</strong>'' will be |
||||
|
placed between the option and the argument. <strong>[-l ? |
||||
|
<[--df]>]</strong> illustrates such a situation. |
||||
|
<strong>[-l]</strong> shows a file listings, and optionally the option |
||||
|
<strong>[--df]</strong> can be use with <strong>[-l]</strong> to show an |
||||
|
expanded listing. |
||||
|
<P> |
||||
|
|
||||
|
<strong>[--dbpath</strong> <<strong>dir>]</strong> requires an |
||||
|
argument, this time the argument would not be another option, but rather |
||||
|
it is a directory. |
||||
|
<P> |
||||
|
|
||||
|
Rule: When an option is an argument to another option it can be written |
||||
|
anywhere, but when a non-option is an argument |
||||
|
<<strong>dir</strong>> <strong>(notice no brackets)</strong> it has |
||||
|
to be placed directly after the option. Sometimes, there may be |
||||
|
alternative arguments divided with ``<strong>|</strong>''. |
||||
|
<<strong>argument1|argument2</strong>> means use argument1 or |
||||
|
argument2, but not both. |
||||
|
<P> |
||||
|
|
||||
|
Based on what we now know, let's compare this situation to the |
||||
|
<strong>{--search}</strong> situation shown above: |
||||
|
<P> |
||||
|
|
||||
|
<code>[--ftp ? --source | --source_only ? <[--diff]>]</code> |
||||
|
<P> |
||||
|
|
||||
|
|
||||
|
In this case <strong>--source</strong> or alternatively |
||||
|
<strong>--source_only</strong> can be optionally used along with |
||||
|
<strong>--ftp</strong> because they aren't in parentheses |
||||
|
<strong>()</strong> (also notice: | was used instead of ||, but means the |
||||
|
same thing ``or''). <strong>--diff</strong> can optionally be provided as |
||||
|
an argument to either <strong>--source</strong> or |
||||
|
<strong>--source_only</strong>. For readability --source and --source_only |
||||
|
weren't enclosed in brackets. |
||||
|
<P> |
||||
|
|
||||
|
<strong>Global Arguments</strong> |
||||
|
<P> |
||||
|
|
||||
|
A <strong>global argument</strong> can be typed anywhere on the command |
||||
|
line, and can be an option or text. If global arguments |
||||
|
exist they are placed last after the list of normal |
||||
|
options that can be used with a major mode |
||||
|
option. |
||||
|
<P> |
||||
|
|
||||
|
[targets | -S] and [targets|APT|DF] are |
||||
|
examples. {-q}, {--initndb}, and |
||||
|
{--rebuildndb} all use global arguments. |
||||
|
<P> |
||||
|
|
||||
|
<strong>Minor Mode Options</strong> |
||||
|
<P> |
||||
|
|
||||
|
{-q --query} will generally use zero or more |
||||
|
minor mode options [-afpgn --dir], with |
||||
|
one exception (see <A href="ch-query.html">QUERYING THE INSTALLED AND NOT-INSTALLED DATABASES |
||||
|
, chapter 9</A>). |
||||
|
<hr> |
||||
|
swim |
||||
|
- <A href="index.html#copyright"> |
||||
|
Copyright © 1999 Jonathan D. Rosenbaum |
||||
|
</A> |
||||
|
<br> |
||||
|
<A href="index.html#toc">Contents</A>; <A href="ch-version.html">next</A>; <A href="ch-description.html">back</A>. |
||||
|
<br> |
||||
|
<address>15 June 1999<br> |
||||
|
Jonathan D. Rosenbaum<A href="mailto:mttrader@access.mountain.net">mttrader@access.mountain.net</A></address> |
||||
|
</body></html> |
@ -0,0 +1,32 @@ |
|||||
|
<html><head> |
||||
|
<title>swim - DESCRIPTION |
||||
|
</title> |
||||
|
<link rev=made href="mailto:mttrader@access.mountain.net"> |
||||
|
</head><body> |
||||
|
<h1> |
||||
|
swim - chapter 1<br> |
||||
|
DESCRIPTION |
||||
|
|
||||
|
</h1> |
||||
|
|
||||
|
|
||||
|
<strong>swim</strong> is a powerful <em>package administration</em> |
||||
|
and <em>research tool</em> for both an <em>installed Debian |
||||
|
distribution</em>, and/or <em>not-installed virtual Debian |
||||
|
distribution(s)</em> allowing querying of software packages with a variety |
||||
|
of package information options, and powerful searches. Virtual options |
||||
|
which include ftp, installation, and package removal capabilities can be |
||||
|
seamlessly combined with querying or searches. <strong>swim</strong> can |
||||
|
be used on computer systems which either have, or do not have a Debian |
||||
|
distribution installed. |
||||
|
<hr> |
||||
|
swim |
||||
|
- <A href="index.html#copyright"> |
||||
|
Copyright © 1999 Jonathan D. Rosenbaum |
||||
|
</A> |
||||
|
<br> |
||||
|
<A href="index.html#toc">Contents</A>; <A href="ch-commandline.html">next</A>. |
||||
|
<br> |
||||
|
<address>15 June 1999<br> |
||||
|
Jonathan D. Rosenbaum<A href="mailto:mttrader@access.mountain.net">mttrader@access.mountain.net</A></address> |
||||
|
</body></html> |
@ -0,0 +1,37 @@ |
|||||
|
<html><head> |
||||
|
<title>swim - HISTORY |
||||
|
</title> |
||||
|
<link rev=made href="mailto:mttrader@access.mountain.net"> |
||||
|
</head><body> |
||||
|
<h1> |
||||
|
swim - chapter 4<br> |
||||
|
HISTORY |
||||
|
|
||||
|
</h1> |
||||
|
|
||||
|
<pre> |
||||
|
usage: swim --history |
||||
|
swim -h |
||||
|
|
||||
|
options: [--arch <architecture>] [--dists <distribution>] |
||||
|
[--n] [--dbpath <dir>] [--root <dir>] |
||||
|
</pre> |
||||
|
<P> |
||||
|
|
||||
|
This shows a shell-like history of searches and the most recent --stdin |
||||
|
edit. History is numbered with the most recent action being 1, and the |
||||
|
earlier actions being of a higher number until the maximum amount of lines |
||||
|
set in the HISTORY variable in <code>swimrc(5)</code>. A separate history is |
||||
|
kept for each architecture-distribution. |
||||
|
|
||||
|
<hr> |
||||
|
swim |
||||
|
- <A href="index.html#copyright"> |
||||
|
Copyright © 1999 Jonathan D. Rosenbaum |
||||
|
</A> |
||||
|
<br> |
||||
|
<A href="index.html#toc">Contents</A>; <A href="ch-makinginst.html">next</A>; <A href="ch-version.html">back</A>. |
||||
|
<br> |
||||
|
<address>15 June 1999<br> |
||||
|
Jonathan D. Rosenbaum<A href="mailto:mttrader@access.mountain.net">mttrader@access.mountain.net</A></address> |
||||
|
</body></html> |
@ -0,0 +1,330 @@ |
|||||
|
<html><head> |
||||
|
<title>swim - IMPORTANT DEBIAN DATABASES FOR NOT-INSTALLED |
||||
|
DATABASES |
||||
|
</title> |
||||
|
<link rev=made href="mailto:mttrader@access.mountain.net"> |
||||
|
</head><body> |
||||
|
<h1> |
||||
|
swim - chapter 6<br> |
||||
|
IMPORTANT DEBIAN DATABASES FOR NOT-INSTALLED |
||||
|
DATABASES |
||||
|
|
||||
|
</h1> |
||||
|
<hr> |
||||
|
<h2><A name="s-downimportant"> |
||||
|
6.1 A. downloading the important databases with --ftp. |
||||
|
|
||||
|
</A></h2> |
||||
|
|
||||
|
<pre>usage: swim --ftp |
||||
|
|
||||
|
options: --Contents <DF|directory> |
||||
|
--Packages <DF|directory> |
||||
|
[--dists <distribution>] [--arch <architecture>] |
||||
|
[--onec] [--Release_only]</pre> |
||||
|
<hr> |
||||
|
<h2><A name="s6.2"> |
||||
|
6.2 OVERVIEW |
||||
|
|
||||
|
</A></h2> |
||||
|
<strong>swim</strong> provides a method so that all information about |
||||
|
an existing Debian distribution is quickly accessible through databases. |
||||
|
Debian already provides flat file databases for all its distributions. One |
||||
|
database called ``<em>Contents-(architecture)</em>'' provides a complete |
||||
|
listing of all the files associated with each package, the other much more |
||||
|
important database called ``<em>Packages</em>'' provides everything from |
||||
|
the Package's description, to all the dependencies for that package. The |
||||
|
Packages database is a crucial database for other important Debian |
||||
|
administrative tools like <strong>dpkg</strong> and <strong>apt</strong>. |
||||
|
<hr> |
||||
|
<h2><A name="s-dd"> |
||||
|
6.3 DISTRIBUTION DEFINED |
||||
|
|
||||
|
</A></h2> |
||||
|
Debian Distributions choose a name which reflect the development state of |
||||
|
that distribution. The distribution named ``<em>unstable</em>'' is where |
||||
|
the majority of the development processing occurs, after <em>unstable</em> |
||||
|
has reached a certain level of maturity, it's copied over to a new |
||||
|
distribution called ``<em>frozen</em>'' which is tested extensively before |
||||
|
becoming the new ``<em>stable</em>'' distribution. The <em>frozen |
||||
|
distribution</em> retains the <em>Release version number</em> of the |
||||
|
<em>unstable distribution</em>, and the <em>unstable distribution</em> |
||||
|
receives a new <em>Release version number</em>. Eventually, |
||||
|
<em>frozen</em> becomes <em>stable</em>, and at this point both |
||||
|
<em>frozen</em>, and the older <em>stable distribution</em> are removed. |
||||
|
Code names are associated with the <em>Release Version number</em> given |
||||
|
for each of the distributions. This is much better for mirroring Debian |
||||
|
sites. |
||||
|
|
||||
|
<P> |
||||
|
|
||||
|
<strong>swim</strong> was designed to ignore these code names, and instead |
||||
|
shows the user the <em>Release version number</em> associated with the |
||||
|
distribution. Swim users must always use the real distribution name, or |
||||
|
swim will not work properly. This is a nice feature because it allows user |
||||
|
to make decisions related to the management of their databases, and makes |
||||
|
research much more easier. |
||||
|
|
||||
|
<P> |
||||
|
|
||||
|
The other Debian distribution which swim recognizes is |
||||
|
<em>experimental</em>. This distribution <em>does not have any Release |
||||
|
version number</em>, and contains packages which are considered risky |
||||
|
because of their development level. |
||||
|
|
||||
|
|
||||
|
<P> |
||||
|
<hr> |
||||
|
<h2><A name="s6.4"> |
||||
|
6.4 SECTIONS |
||||
|
|
||||
|
</A></h2> |
||||
|
Each Debian distribution has sections related to the relationship of |
||||
|
each of the packages to the <em>Debian's Policy Manual</em>. In |
||||
|
``<em>main</em>'' there are packages which have a correct relationship |
||||
|
with these Policies. Packages in ``<em>contrib</em>'' comply with the |
||||
|
<em>DFSG</em> (<em>Debian Free Software Guidelines</em> found in the |
||||
|
<em>Debian Policy Manual</em>) but have various limitations like requiring |
||||
|
a package which is found in non-free, or is not in the Debian archive. |
||||
|
Packages in ``<em>non-free</em>'' do not comply with the <em>DFSG</em> but |
||||
|
are electronically distributable across international borders. The |
||||
|
``<em>non-us</em>'' section is found outside of the United States and |
||||
|
exists for packages which have export restrictions. |
||||
|
|
||||
|
|
||||
|
<P> |
||||
|
<hr> |
||||
|
<h2><A name="s6.5"> |
||||
|
6.5 ARCHITECTURES |
||||
|
|
||||
|
</A></h2> |
||||
|
Distributions also have architecture specific sections since not all |
||||
|
packages compiled for one architecture can run on all other |
||||
|
archictectures, however, there are a large percentage of packages which do |
||||
|
run on all architectures. The architectures are <em>alpha</em>, |
||||
|
<em>arm</em>, <em>i386</em>, <em>m68k</em>, <em>powerpc</em>, |
||||
|
<em>sparc</em>, and more recently <em>hurd-i386</em> which represents |
||||
|
packages for the hurd GNU kernel for the i386 architecture. |
||||
|
|
||||
|
<P> |
||||
|
<hr> |
||||
|
<h2><A name="s6.6"> |
||||
|
6.6 SWIMZ.LIST |
||||
|
|
||||
|
</A></h2> |
||||
|
<strong>--ftp</strong> uses a file called <em>swimz.list</em> which |
||||
|
has the same type of format (see format below) as the |
||||
|
<em>sources.list(5)</em> which <strong>apt</strong> uses. There are some |
||||
|
differences. The <strong>first difference</strong> mentioned above (see |
||||
|
<A href="#s-dd">DISTRIBUTION DEFINED |
||||
|
, section 6.3</A>) requires that the distribution names never should be the |
||||
|
code names for the <em>Release version</em>. <strong>Secondly</strong>, |
||||
|
<strong>apt</strong> only retrieves databases specific to one |
||||
|
archictecture, normally the one you are running <strong>apt</strong> on. |
||||
|
With <strong>swim</strong> though you can fetch databases for any, or |
||||
|
every architecture by adding the architecture to ``deb'' with a hyphen |
||||
|
(deb-hurd-i386). If deb has no architecture appended it is assumed that |
||||
|
the architecture you want is the same as the system you are running |
||||
|
<strong>swim</strong> on. <strong>Thirdly</strong>, at this time |
||||
|
<strong>swim</strong> only supports the ftp method. |
||||
|
<strong>Fourthly</strong>, you can change <em>swimz.list</em> as often as |
||||
|
you want without worrying about databases being removed so that that the |
||||
|
<em>swimz.list</em> and the downloaded databases match. This would occur |
||||
|
with <strong>apt's</strong> <em>sources.list(5)</em> if you removed a |
||||
|
site. <strong>Fifthly</strong>, databases are kept in a compressed state. |
||||
|
<strong>Sixthly</strong> because the list is used for both Contents and |
||||
|
Packages, more flexibility is provided by only allowing the default |
||||
|
distribution/archictecture or distribution/architecture provided on the |
||||
|
commandline to be downloaded. |
||||
|
<P> |
||||
|
|
||||
|
|
||||
|
For <strong>apt</strong> users: If you are using <strong>apt</strong>, and |
||||
|
<strong>swim</strong> together it is a good strategy to use the real |
||||
|
distribution name in the <em>sources list(8)</em>, and to have an exact |
||||
|
copy of the <em>sources.list(5)</em> ftp sites in the <em>swimz.list</em>. |
||||
|
Packages databases specific to the architecture <strong>apt</strong> is |
||||
|
using can be retrieved using <strong>swim --apt --update</strong> (this |
||||
|
also will keep track of the Release version), and then |
||||
|
<strong>swim</strong> can be used to fetch the architecture specific |
||||
|
<em>Contents database</em> as shown below. It should also be of interest |
||||
|
to note that Packages downloaded by either swim or apt can be used |
||||
|
interchangeably by using 'cp -a' and 'gzip -d' or 'gzip -9'. |
||||
|
<P> |
||||
|
|
||||
|
Here is a brief outline of the format required by <em>swimz.list</em>. |
||||
|
|
||||
|
<P> |
||||
|
|
||||
|
<strong>deb uri distribution [section ... ]</strong> |
||||
|
<P> |
||||
|
|
||||
|
<strong>deb</strong> - represents a standard Debian distribution. And is |
||||
|
simply written as deb or with the architecture appended |
||||
|
(<strong>deb</strong> or <strong>deb-alpha</strong>). |
||||
|
|
||||
|
<P> |
||||
|
|
||||
|
<strong>uri</strong> - Universal Resource Identifier is exactly how you |
||||
|
would enter an address into a web browser. This address is the base of a |
||||
|
Debian distribution, generally this is right before the directory called |
||||
|
``<em>dists</em>''. So if <em>dists</em> is found in |
||||
|
<em>/stuff/pub/debian/dists</em>, and the site is |
||||
|
<strong>somewhere.com</strong> then the uri would be |
||||
|
<em>ftp://somewhere.com/stuff/pub/debian</em>. |
||||
|
<P> |
||||
|
|
||||
|
<strong>distribution</strong> - This can be <em>unstable</em>, |
||||
|
<em>frozen</em>, <em>stable</em>, <em>experimental</em>. Distribution can |
||||
|
also be a path which must end with a slash like |
||||
|
<em>unstable/binary-i386/</em>. This is used when there is no section as |
||||
|
in the experimental distribution or in sites which do not have symlinks to |
||||
|
the non-us section. No section would be mentioned in this situation. |
||||
|
<P> |
||||
|
<strong>section</strong> - <em>main</em>, <em>contrib</em>, |
||||
|
<em>non-free</em>, <em>non-US</em> (write it this way). |
||||
|
|
||||
|
<P> |
||||
|
<hr> |
||||
|
<h2><A name="s6.7"> |
||||
|
6.7 SWIMZ.LIST EXAMPLES |
||||
|
|
||||
|
</A></h2> |
||||
|
Examples (each on one line): |
||||
|
|
||||
|
<P> |
||||
|
|
||||
|
<strong>deb-alpha ftp://somewhere.com/stuff/pub/debian unstable main contrib non-US</strong> |
||||
|
<P> |
||||
|
|
||||
|
This will fetch the alpha databases from somewhere.com for the unstable |
||||
|
distribution for the main, contrib and non-US sections. |
||||
|
|
||||
|
<P> |
||||
|
|
||||
|
Note: In these next two examples you can not append any architecture to deb |
||||
|
with a hyphen. |
||||
|
<P> |
||||
|
|
||||
|
<strong>deb ftp://somewhere.com/stuff/pub/debian project/experimental/</strong> |
||||
|
|
||||
|
<P> |
||||
|
|
||||
|
This will fetch the experimental database, but there is not a |
||||
|
Contents-(architecture) database for this distribution. Notice that it ends |
||||
|
with a slash. |
||||
|
|
||||
|
<P> |
||||
|
|
||||
|
<strong>deb ftp://somewhere.com/stuff/pub/debian-non-US stable/binary-i386/</strong> |
||||
|
<P> |
||||
|
|
||||
|
This will fetch the i386 databases for the stable distribution for non-us, |
||||
|
|
||||
|
<hr> |
||||
|
<h2><A name="s-ftp"> |
||||
|
6.8 FTP OR APT? |
||||
|
|
||||
|
</A></h2> |
||||
|
How you use major mode <strong>--ftp</strong> depends on your goals. |
||||
|
Even if you are using <strong>apt</strong>, you may be interested in |
||||
|
keeping tabs on different architectures. In this case you would have to |
||||
|
download the <em>Packages databases</em> specific to these architectures. |
||||
|
If you are only interested in the architecture which <strong>apt</strong> |
||||
|
is interested in, then you only need to use <strong>--ftp</strong> to |
||||
|
fetch the <em>Contents database(s)</em>. But, because it isn't a |
||||
|
requirement to set up a virtual filesystem, you are not required to fetch |
||||
|
the Contents database. The <strong>advantages</strong> of fetching the |
||||
|
Contents database is determined by the method you choose to make the |
||||
|
database (see <A href="ch-notinstalled.html">MAKING NOT-INSTALLED DATABASES |
||||
|
, chapter 7</A>). These advantages include the |
||||
|
ability to <em>view a listing of the files and directories</em> associated |
||||
|
with a package, the ability to <em>query files and directories</em> to |
||||
|
find out which packages relate to them, and the ability to perform a |
||||
|
<em>powersearch</em> on all the files and directories to find the |
||||
|
associated packages. |
||||
|
<P> |
||||
|
<hr> |
||||
|
<h2><A name="s6.9"> |
||||
|
6.9 OPTIONS |
||||
|
|
||||
|
</A></h2> |
||||
|
<strong>Remember:</strong> If you want to download a different |
||||
|
distribution/architecture other than the default specified in your |
||||
|
configuration file, you must specify this on the commandline. |
||||
|
<P> |
||||
|
<strong>--Packages</strong> determines where you want the Packages |
||||
|
database as well as the Release data put when they are downloaded. The |
||||
|
<strong>DF argument</strong> implies that the databases will be put in |
||||
|
your default directory (see <code>swimrc(5)).</code> These databases can later |
||||
|
be located by the major modes <strong>--initndb and --rebuildndb</strong> |
||||
|
just by using <strong>DF</strong> as an argument. Alternatively, these |
||||
|
databases can be put in any directory you choose by providing a |
||||
|
<strong>directory as an argument</strong>. |
||||
|
<P> |
||||
|
|
||||
|
<strong>--Contents</strong> determines where you want the |
||||
|
<em>Content-(architecture)</em> <code>database(s)</code> put. (see |
||||
|
--Packages). |
||||
|
<P> |
||||
|
|
||||
|
<strong>--onec</strong> will download only one Contents-arch per |
||||
|
distribution/architecture specified on the commandline or by default. |
||||
|
<P> |
||||
|
|
||||
|
<strong>--Release_only</strong> will download only the Release data for |
||||
|
the <em>swimz.list</em> or particular <em>Package(s)</em> mentioned on the |
||||
|
command line. |
||||
|
<P> |
||||
|
|
||||
|
<strong>--dists</strong> will only find the distribution which corresponds |
||||
|
to the argument provided this option. |
||||
|
<P> |
||||
|
|
||||
|
<strong>--arch</strong> will only find the architecture which corresponds |
||||
|
to the argument provided this option. The different architecture needs to |
||||
|
be specified in swimz.list with a hyphen and the architecture appended to |
||||
|
deb (deb-(arch)). |
||||
|
<hr> |
||||
|
<h2><A name="s6.10"> |
||||
|
6.10 B. downloading the important databases with apt, and maintenance |
||||
|
options. |
||||
|
|
||||
|
</A></h2> |
||||
|
usage: <strong>swim --apt</strong> |
||||
|
<P> |
||||
|
|
||||
|
options: <strong>[--update] [--clean] [--autoclean] [--check]</strong> |
||||
|
|
||||
|
<P> |
||||
|
|
||||
|
Please read <A href="#s-downimportant">A. downloading the important databases with --ftp. |
||||
|
, section 6.1</A> for more information. |
||||
|
<P> |
||||
|
|
||||
|
<strong>--update</strong> calls <strong>apt</strong> to download the |
||||
|
Packages databases. |
||||
|
<P> |
||||
|
|
||||
|
<strong>--clean</strong> is a call to an <strong>apt</strong> option to |
||||
|
remove any packages stored in <strong>apt's</strong> storage area for |
||||
|
downloaded packages. The default for this storage area is |
||||
|
<em>/var/cache/apt/arhives</em> |
||||
|
<P> |
||||
|
|
||||
|
<strong>--autoclean</strong> will only clean out packages which are not |
||||
|
found in apt's cache. |
||||
|
<P> |
||||
|
|
||||
|
<strong>--check</strong> tests and updates apt's cache. |
||||
|
<hr> |
||||
|
swim |
||||
|
- <A href="index.html#copyright"> |
||||
|
Copyright © 1999 Jonathan D. Rosenbaum |
||||
|
</A> |
||||
|
<br> |
||||
|
<A href="index.html#toc">Contents</A>; <A href="ch-notinstalled.html">next</A>; <A href="ch-makinginst.html">back</A>. |
||||
|
<br> |
||||
|
<address>15 June 1999<br> |
||||
|
Jonathan D. Rosenbaum<A href="mailto:mttrader@access.mountain.net">mttrader@access.mountain.net</A></address> |
||||
|
</body></html> |
@ -0,0 +1,180 @@ |
|||||
|
<html><head> |
||||
|
<title>swim - MAKING INSTALLED SYSTEM DATABASES |
||||
|
</title> |
||||
|
<link rev=made href="mailto:mttrader@access.mountain.net"> |
||||
|
</head><body> |
||||
|
<h1> |
||||
|
swim - chapter 5<br> |
||||
|
MAKING INSTALLED SYSTEM DATABASES |
||||
|
|
||||
|
</h1> |
||||
|
|
||||
|
<hr> |
||||
|
<h2><A name="s-initdb"> |
||||
|
5.1 Initial database making, and Rebuilding for an |
||||
|
Installed system. |
||||
|
|
||||
|
</A></h2> |
||||
|
|
||||
|
<pre> |
||||
|
usage: swim --initdb |
||||
|
swim --rebuilddb |
||||
|
|
||||
|
options: [--dbpath <dir>] [--root <dir>] [--lowmem] |
||||
|
[--split_data <lines>] |
||||
|
|
||||
|
</pre> |
||||
|
<P> |
||||
|
|
||||
|
An <em>installed Debian distribution</em> is one in which packages are |
||||
|
installed using <strong>dpkg</strong> or some front-end to |
||||
|
<strong>dpkg</strong> like <strong>apt</strong> or |
||||
|
<strong>dselect</strong>; <strong>swim</strong> supports installation |
||||
|
through <strong>apt</strong>. These major modes are for a computer with an |
||||
|
<em>installed Debian distribution</em> and make the databases which allow |
||||
|
querying and searching capabilities for the installed distribution. |
||||
|
<P> |
||||
|
|
||||
|
<strong>--initdb</strong> is run when the databases do not exist yet, |
||||
|
<strong>--rebuilddb</strong> is run if the databases have become corrupt, |
||||
|
or you want to rebuild the databases instead of updating them. |
||||
|
|
||||
|
<P> |
||||
|
|
||||
|
<strong>--dbpath</strong> can be specified as an alternative location for |
||||
|
where the databases will be made. The default location is |
||||
|
``<em>/var/lib/dpkg</em>''. An argument like ``<em>/otherstuff</em>'' |
||||
|
could be provided, and then the databases would be made here instead. |
||||
|
|
||||
|
<P> |
||||
|
|
||||
|
<strong>--root</strong> allows a database to be made for a Debian distribution installed on a |
||||
|
different partition. If the distribution is mounted on |
||||
|
<em>/New_Debian</em>, ``<em>/New_Debian</em>'' would be the argument to root. The databases would be made for the |
||||
|
Debian distribution installed on the ``<em>/New_Debian</em>'' partition. |
||||
|
|
||||
|
<P> |
||||
|
|
||||
|
<strong>--dbpath</strong> and <strong>--root</strong> can be used |
||||
|
together. Given the previous two examples, the databases would be made on |
||||
|
``<em>/New_Debian/otherstuff</em>'', assuming |
||||
|
``<em>/New_Debian/otherstuff</em>'' actually existed. |
||||
|
|
||||
|
<P> |
||||
|
|
||||
|
<strong>--lowmem</strong> uses a method which uses a small amount of |
||||
|
memory to make the databases. By default <strong>--initdb</strong> and |
||||
|
<strong>--rebuilddb</strong> use a method which fully takes advantage of |
||||
|
memory, this is a good thing, because it means the databases are made in a |
||||
|
quicker manner. On a computer with a K6-200 CPU, 64MB of memory, and 1500 |
||||
|
installed packages, the databases can be made in 4.5 minutes using the |
||||
|
default method, and 11 minutes using the low memory method. The high |
||||
|
memory method is the default because in general the size of a distribution |
||||
|
is related to how much resources a computer has, and probably a large |
||||
|
installation is unusual. If you get an ``out of memory'' when you use the |
||||
|
default method, or if your system is overloaded to begin with, the |
||||
|
<strong>--lowmem method</strong> is the prefered way. |
||||
|
|
||||
|
<P> |
||||
|
|
||||
|
<strong>--split_data</strong> determines the size of the files in the |
||||
|
temporary directory used to contruct the database. The default is 25000 |
||||
|
lines per file. If you are using the <strong>--lowmem method</strong> you |
||||
|
may want to provide a different argument to <strong>--split_data</strong>, |
||||
|
like ``<strong>--split_data 10000</strong>''. This is a subject of |
||||
|
experimentation. |
||||
|
<P> |
||||
|
<hr> |
||||
|
<h2><A name="s5.2"> |
||||
|
5.2 UPDATING |
||||
|
|
||||
|
</A></h2> |
||||
|
usage: <strong>swim --db</strong> |
||||
|
|
||||
|
|
||||
|
|
||||
|
<P> |
||||
|
|
||||
|
options: <strong>[--dbpath</strong> <<strong>dir</strong>><strong>] |
||||
|
[--root</strong> <<strong>dir</strong>><strong>] [--check]</strong> |
||||
|
|
||||
|
<P> |
||||
|
|
||||
|
<strong>--db</strong> allows you to update the databases by hand when |
||||
|
packages have been removed, added, or changed. swim will automatically run |
||||
|
<strong>--db</strong> under certain conditions. |
||||
|
<P> |
||||
|
<strong>--check</strong> prints out the changes to STDERR, and the |
||||
|
total to STDOUT without proceeding with the update. |
||||
|
<P> |
||||
|
|
||||
|
See <A href="#s-initdb">Initial database making, and Rebuilding for an |
||||
|
Installed system. |
||||
|
, section 5.1</A> for options <strong>--dbpath</strong> and |
||||
|
<strong>--root</strong>. |
||||
|
|
||||
|
<P> |
||||
|
<hr> |
||||
|
<h2><A name="s-searchy"> |
||||
|
5.3 REBUILDING THE SEARCH |
||||
|
|
||||
|
|
||||
|
</A></h2> |
||||
|
|
||||
|
usage: <strong>swim --rebuildflatdb</strong> |
||||
|
|
||||
|
|
||||
|
|
||||
|
<P> |
||||
|
|
||||
|
options: <strong>[--dbpath</strong> <<strong>dir</strong>><strong>] |
||||
|
[--root</strong> <<strong>dir</strong>><strong>]</strong> |
||||
|
|
||||
|
<P> |
||||
|
|
||||
|
swim makes the flat databases <em>searchindex.deb</em> and |
||||
|
<em>dirindex.deb</em> for doing <em>powersearches</em>. Instead of |
||||
|
rebuilding these databases everytime <strong>--db</strong> is run, new |
||||
|
information is just appended to these databases, and old information is |
||||
|
kept. Generally, this is not a problem because only files and directories |
||||
|
which the other databases actually know something about will be refered |
||||
|
to. But in a situation where a file has changed into a directory, the |
||||
|
<em>powersearch</em> may not work properly, because the old file name |
||||
|
remains in <em>searchindex.deb</em>, and the new directory name is now in |
||||
|
<em>dirindex.deb</em> directory. In general, it takes a lot of changes to |
||||
|
the installed system before it is really becomes necessary to rebuild the |
||||
|
flat databases. This process takes less than a minute on a K6-200 with |
||||
|
1500 packages. |
||||
|
|
||||
|
<P> |
||||
|
|
||||
|
See <A href="#s-initdb">Initial database making, and Rebuilding for an |
||||
|
Installed system. |
||||
|
, section 5.1</A> for options <strong>--dbpath</strong> and |
||||
|
<strong>--root</strong>. |
||||
|
<hr> |
||||
|
<h2><A name="s5.4"> |
||||
|
5.4 FILES |
||||
|
|
||||
|
</A></h2> |
||||
|
|
||||
|
Databases which are made: |
||||
|
<P> |
||||
|
|
||||
|
<pre> packages.deb |
||||
|
fileindex.deb |
||||
|
statusindex.deb |
||||
|
groupindex.deb |
||||
|
searchindex.deb |
||||
|
dirindex.deb</pre> |
||||
|
<hr> |
||||
|
swim |
||||
|
- <A href="index.html#copyright"> |
||||
|
Copyright © 1999 Jonathan D. Rosenbaum |
||||
|
</A> |
||||
|
<br> |
||||
|
<A href="index.html#toc">Contents</A>; <A href="ch-important.html">next</A>; <A href="ch-history.html">back</A>. |
||||
|
<br> |
||||
|
<address>15 June 1999<br> |
||||
|
Jonathan D. Rosenbaum<A href="mailto:mttrader@access.mountain.net">mttrader@access.mountain.net</A></address> |
||||
|
</body></html> |
@ -0,0 +1,230 @@ |
|||||
|
<html><head> |
||||
|
<title>swim - MAKING NOT-INSTALLED DATABASES |
||||
|
</title> |
||||
|
<link rev=made href="mailto:mttrader@access.mountain.net"> |
||||
|
</head><body> |
||||
|
<h1> |
||||
|
swim - chapter 7<br> |
||||
|
MAKING NOT-INSTALLED DATABASES |
||||
|
|
||||
|
</h1> |
||||
|
|
||||
|
<pre> |
||||
|
usage: swim --initndb |
||||
|
swim --ndb |
||||
|
swim --rebuildndb |
||||
|
|
||||
|
options: [--Contents <target|FDBtarget|DF|FDBDF>] |
||||
|
[--main] [--contrib] [--non-free] [--non-us] |
||||
|
[--arch <architecture>] [--dists <distribution>] |
||||
|
[--dbpath <dir>] [--root <dir>] [--alt] |
||||
|
[--split_data <lines>] [-v] [--cron] |
||||
|
[targets|APT|DF] |
||||
|
</pre> |
||||
|
<P> |
||||
|
<hr> |
||||
|
<h2><A name="s7.1"> |
||||
|
7.1 OVERVIEW |
||||
|
|
||||
|
</A></h2> |
||||
|
The <strong>not-installed database</strong> provides swim with many capabilities like the searching, and querying of |
||||
|
packages which do not actually exist on the live filesystem, as well as the |
||||
|
ability to seamlessly install packages while searching or quering, or the |
||||
|
ability to fetch the packages source code. The <em>virtual filesystem</em> is optional, but it is highly recommended. These two major mode options set |
||||
|
up these databases, after determining the level of interaction which you |
||||
|
want. |
||||
|
<P> |
||||
|
|
||||
|
Whenever <strong>swim</strong> makes databases it thinks only in terms of |
||||
|
one distribution and one architecture. This keeps things logical. |
||||
|
<strong>swim</strong> does have the ability to take Packages files with |
||||
|
multiple architectures, and distributions, and to extract information for |
||||
|
one distribution and one archictecture to make its databases. This could |
||||
|
provide interesting information from dumps from <strong>apt</strong> |
||||
|
(<code>apt-cache dumpavail</code>). |
||||
|
<P> |
||||
|
|
||||
|
<strong>--initndb</strong> creates the initial not-installed databases for |
||||
|
a particular architecture and distribution, and |
||||
|
<strong>--rebuildndb</strong> remakes the not-installed databases for that |
||||
|
same architecure and distribution. If not otherwise specified |
||||
|
<strong>swim</strong> <em>will use the values</em> it finds in |
||||
|
<em>swimrc</em> to determine what architecture and distribution you want |
||||
|
to use to make <strong>swim's</strong> databases. Otherwise... |
||||
|
|
||||
|
<hr> |
||||
|
<h2><A name="s7.2"> |
||||
|
7.2 OPTIONS |
||||
|
|
||||
|
</A></h2> |
||||
|
<strong>--arch</strong> allows an argument to override the |
||||
|
<strong>architecture</strong> found in <em>swimrc</em>. |
||||
|
|
||||
|
<P> |
||||
|
|
||||
|
<strong>--dists</strong> allows an argument to override the |
||||
|
<strong>distribution</strong> found in <em>swimrc</em>. |
||||
|
<P> |
||||
|
|
||||
|
<strong>--alt</strong> is used for a distribution with a Debian archival |
||||
|
structure, but which has a different name. This allows for alternative |
||||
|
distributions. |
||||
|
<P> |
||||
|
|
||||
|
When <strong>APT</strong> or <strong>DF</strong> are provided as arguments |
||||
|
(see below), by default the <em>Packages</em> which pertain to the |
||||
|
sections found in <em>swimrc</em> will be shown. If you only want certain |
||||
|
sections you may specify them on the command line. If you are not using |
||||
|
<strong>APT</strong> or <strong>DF</strong>, it is a good idea to make |
||||
|
sure that either the sections found in <em>swimrc</em> or the sections you |
||||
|
put on the command line match the <em>Packages</em> you a targetting |
||||
|
because this is much more effecient. |
||||
|
<P> |
||||
|
|
||||
|
<strong>--main</strong> will override the sections found in |
||||
|
<em>swimrc</em>, and will use this section. |
||||
|
<P> |
||||
|
|
||||
|
<strong>--contrib</strong> will override the sections found in |
||||
|
<em>swimrc</em>, and will use this section |
||||
|
<P> |
||||
|
|
||||
|
<strong>--non-free</strong> will override the sections found in |
||||
|
<em>swimrc</em>, and will use this section |
||||
|
<P> |
||||
|
|
||||
|
<strong>--non-us</strong> will override the sections found in |
||||
|
<em>swimrc</em>, and will use this section |
||||
|
<P> |
||||
|
|
||||
|
Global arguments <strong>targets|APT|DF</strong> must be used with either |
||||
|
of these two major modes to find the <em>Packages</em> databases. targets |
||||
|
can be a full path to one or a set of <em>Packages</em>. |
||||
|
<strong>APT</strong> will use the <em>Packages</em> found in |
||||
|
<em>/var/state/apt/lists</em>, and <strong>DF</strong> will use the |
||||
|
Packages found in the default directory for <strong>swim</strong> (see |
||||
|
<code>--ftp</code>). If you use either <strong>APT</strong> or |
||||
|
<strong>DF</strong> you will be given an <strong>interface</strong> which |
||||
|
allows you to choose one <em>Packages</em> database for each section you |
||||
|
would like to use from the various sites. This <strong>interface</strong> |
||||
|
shows the <strong>site</strong>, <strong>date</strong>, |
||||
|
<strong>size</strong> and <strong>Release version</strong> for each |
||||
|
<em>Packages</em>. |
||||
|
<P> |
||||
|
|
||||
|
<strong>--cron</strong> allows you to override the |
||||
|
<strong>interface</strong> produced when <strong>APT</strong> or |
||||
|
<strong>DF</strong> is provided as an argument. This is useful if you want |
||||
|
to automate the database making process. <strong>--cron</strong> will |
||||
|
choose the newest <code>database(s),</code> if cron notices that the Release |
||||
|
version has changed, cron will not proceed, but will provide a warning |
||||
|
instead. This allows you to make the appropriate changes and choices. |
||||
|
<P> |
||||
|
|
||||
|
<strong>--Contents</strong> can be give one of four arguments: |
||||
|
<P> |
||||
|
|
||||
|
<strong>1).</strong> If you have a <em>Contents-(architecture)</em> |
||||
|
database in a target location you know about you may provide a path to the |
||||
|
location. The <em>Contents</em> database can be compressed. |
||||
|
<P> |
||||
|
|
||||
|
<strong>2).</strong> If you prepend the path with the letters |
||||
|
<strong>FDB</strong> (meaning flat database) when the databases for swim |
||||
|
are made, instead of using the Contents database to make: |
||||
|
|
||||
|
<pre> |
||||
|
nfileindex-arch-dists.deb |
||||
|
nsearchindex-arch-dists.deb |
||||
|
ndirindex-arch-dists.deb</pre> |
||||
|
<P> |
||||
|
|
||||
|
Only the <em>ncontentsindex-arch-dists.deb.gz</em> database will be made |
||||
|
which allows the ability to view file/dir listing for not-installed |
||||
|
packages, but does not provide the virtual file system or powersearch |
||||
|
capabilities which the other databases would have provided. |
||||
|
<P> |
||||
|
|
||||
|
<strong>3).</strong> The argument <strong>DF</strong> may be used if you |
||||
|
have used <strong>--ftp</strong> with the <strong>DF</strong> argument to |
||||
|
the option <strong>--Contents</strong> (see <code>--ftp</code>). In this case |
||||
|
it is assumed you are also using global arguments <strong>DF</strong> or |
||||
|
<strong>APT</strong> for the Packages databases. This will give you an |
||||
|
<strong>interface</strong> (if --cron isn't used) allowing you to choose |
||||
|
one <em>Contents</em> database for the particular distribution you want to |
||||
|
make the databases for. |
||||
|
<P> |
||||
|
|
||||
|
<strong>4).</strong> <strong>FDB</strong> does the same exact thing with |
||||
|
<strong>DF</strong> as it does with the before mentioned |
||||
|
<strong>FDBtarget</strong>, and provides the <strong>interface</strong>. |
||||
|
<P> |
||||
|
|
||||
|
<strong>-v</strong> will only work if you have dpkg installed. It allows |
||||
|
swim to verify <strong>swim's</strong> own built-in version comparison |
||||
|
function with <strong>dpkg's version comparison function</strong>. This is |
||||
|
good for debugging purposes, and produces a report called |
||||
|
<em>.version_compare</em> in the same location that |
||||
|
<strong>swim's</strong> databases are made. |
||||
|
<P> |
||||
|
|
||||
|
<strong>--split_data</strong> is only advantageous if |
||||
|
<strong>--Contents</strong> is being used. See <strong>--initdb</strong> |
||||
|
for more information about the <strong>--split_data</strong> option. |
||||
|
<P> |
||||
|
|
||||
|
See <A href="ch-makinginst.html#s-initdb">Initial database making, and Rebuilding for an |
||||
|
Installed system. |
||||
|
, section 5.1</A> for options <code>--dbpath</code> and <code>--root</code>. |
||||
|
<hr> |
||||
|
<h2><A name="s7.3"> |
||||
|
7.3 UPDATING |
||||
|
|
||||
|
</A></h2> |
||||
|
|
||||
|
<code>--ndb</code> has the same options as --initndb and --rebuildndb except |
||||
|
for --split_data. It also has a new option <code>--nue</code> which will |
||||
|
never have to be used unless the experimental distribution or non-us |
||||
|
section are found in Contents (which presently isn't the case). |
||||
|
<code>--check</code> prints out the changes to STDERR, and the total to STDOUT |
||||
|
without proceeding with the update. <code>--status_only</code> can be used |
||||
|
after a new package has been installed to update the status, after which |
||||
|
-qni and -qi will correlate properly. |
||||
|
<hr> |
||||
|
<h2><A name="s7.4"> |
||||
|
7.4 REBUILDING THE SEARCH |
||||
|
|
||||
|
</A></h2> |
||||
|
<code>--rebuildflatndb</code> serves the same purpose as --rebuildflatdb. See |
||||
|
<A href="ch-makinginst.html#s-searchy">REBUILDING THE SEARCH |
||||
|
|
||||
|
, section 5.3</A> |
||||
|
<hr> |
||||
|
<h2><A name="s7.5"> |
||||
|
7.5 FILES |
||||
|
|
||||
|
</A></h2> |
||||
|
Databases and reports which are made (arch = architecture dists = |
||||
|
distribution): |
||||
|
<P> |
||||
|
|
||||
|
<pre> |
||||
|
npackages-arch-dists.deb |
||||
|
nfileindex-arch-dists.deb requires <--Contents> |
||||
|
nstatusindex-arch-dists.deb |
||||
|
ngroupindex-arch-dists.deb |
||||
|
nsearchindex-arch-dists.deb |
||||
|
ndirindex-arch-dists.deb |
||||
|
.packagesdiff-arch-dists.deb requires <--Contents></pre> |
||||
|
<P> |
||||
|
<hr> |
||||
|
swim |
||||
|
- <A href="index.html#copyright"> |
||||
|
Copyright © 1999 Jonathan D. Rosenbaum |
||||
|
</A> |
||||
|
<br> |
||||
|
<A href="index.html#toc">Contents</A>; <A href="ch-aptprep.html">next</A>; <A href="ch-important.html">back</A>. |
||||
|
<br> |
||||
|
<address>15 June 1999<br> |
||||
|
Jonathan D. Rosenbaum<A href="mailto:mttrader@access.mountain.net">mttrader@access.mountain.net</A></address> |
||||
|
</body></html> |
@ -0,0 +1,672 @@ |
|||||
|
<html><head> |
||||
|
<title>swim - QUERYING THE INSTALLED AND NOT-INSTALLED DATABASES |
||||
|
</title> |
||||
|
<link rev=made href="mailto:mttrader@access.mountain.net"> |
||||
|
</head><body> |
||||
|
<h1> |
||||
|
swim - chapter 9<br> |
||||
|
QUERYING THE INSTALLED AND NOT-INSTALLED DATABASES |
||||
|
|
||||
|
</h1> |
||||
|
<pre>usage: swim -q [-fpgn --dir] [targets | -S] |
||||
|
swim --query [-fpgn --dir] [targets | -S] |
||||
|
swim -qa || swim --query -a </pre> |
||||
|
<P> |
||||
|
|
||||
|
<pre>options: [--total -t] [-i] [-l ? <[--df]>] [-d] [-c] |
||||
|
[--scripts] [--preinst] [--postinst] [--prerm] |
||||
|
[--postrm] [-v] [--dbpath <dir>] [--menu -m] |
||||
|
[--shlibs] [-T] [--pre_depends] [--depends] |
||||
|
[--recommends] [--suggests] [--conflicts] |
||||
|
[--replaces] [--provides] [--md5sum] [--root <dir>] |
||||
|
[--copyright] [--changelog] [--allgroups] |
||||
|
[--arch <architecture>] [--dists <distribution>] |
||||
|
[--ftp ? --source | --source_only ? <[--diff]>] |
||||
|
[--stdin] [--extract] <ALL|archive|PWD!archive>] |
||||
|
[-xyrz --remove ? <[--nz]>] [--purge] [--apt2df] |
||||
|
[--df2apt] </pre><P> |
||||
|
|
||||
|
global arguments: <strong>[targets | -S ? <\d{1,}>]</strong> |
||||
|
<P> |
||||
|
|
||||
|
Quering almost always involves using <strong>-q or --query</strong> with |
||||
|
zero or one or a combination of the <strong>minor mode options</strong> |
||||
|
(package specification options), and one or more (only one for |
||||
|
<code>-g</code>) targets specific to the minor mode, or the results of a |
||||
|
search (<code>-S</code>). [<code>-S</code> can be provided a numerical argument |
||||
|
pertaining to the past history.] This can be combined with one or more |
||||
|
options. The one exception is ``<strong>swim -q --allgroups</strong>''. |
||||
|
|
||||
|
<P> |
||||
|
|
||||
|
<strong>--query or -q</strong> can be used by itself or with |
||||
|
<strong>-n</strong> to query known package names or package names with |
||||
|
versions. ``<strong>swim -q test1 test2_0.3-1</strong>'' would produce the |
||||
|
output: |
||||
|
|
||||
|
<P> |
||||
|
|
||||
|
<pre>test1_1.0-2 |
||||
|
test2_0.3-1</pre> |
||||
|
<hr> |
||||
|
<h2><A name="s-mm"> |
||||
|
9.1 MINOR MODES |
||||
|
|
||||
|
</A></h2> |
||||
|
<strong>-n</strong> is the minor mode option to access the |
||||
|
<em>not-installed system</em>, it can be combined with the minor mode |
||||
|
options <strong>-a</strong>, <strong>-g</strong>, <strong>-f</strong>, or |
||||
|
it can be used by itself. |
||||
|
|
||||
|
<P> |
||||
|
|
||||
|
<strong>-a</strong> allows <em>every package</em> on an installed or |
||||
|
not-installed (<strong>-n</strong>) system to be queried. ``<strong>swim |
||||
|
-qan</strong>'' will show all the package names with versions for the |
||||
|
not-installed system |
||||
|
|
||||
|
<P> |
||||
|
|
||||
|
<strong>-f</strong> allows <em>files or directories</em> to be queried, |
||||
|
when used without any options the package name with version is shown. |
||||
|
<strong>--dir</strong> will only query directories, this is useful if you |
||||
|
are not sure whether what you are quering is a directory or a file. When a |
||||
|
directory is queried, swim shows all packages which exist below the |
||||
|
queried directory. ``<strong>swim -qf /</strong>'' is exactly the same as |
||||
|
``<strong>swim -qa</strong>''. Hint: ``<strong>swim -qf .</strong>'' and |
||||
|
``<strong>swim -qf *</strong>'' are quite different, the first shows all |
||||
|
packages which exist below the current directory, and the second will show |
||||
|
the package which each file in the current directory comes from. |
||||
|
<P> |
||||
|
|
||||
|
<strong>-g</strong> will query a <em>group</em> (also called a section, |
||||
|
see <A href="#s-section">SECTION AND PRIORITY |
||||
|
, subsection 9.5.3</A>)) of packages. Groups represent subjects which |
||||
|
packages with similiar characteristics are catagorized by. To view all the |
||||
|
groups found in an installed or not-installed system use ``<strong>swim -q |
||||
|
--allgroups</strong>'' or ``<strong>swim -qn --allgroups</strong>''. |
||||
|
``<strong>swim -qg hamradio</strong>'' or ``<strong>swim -qng |
||||
|
hamradio</strong>'' shows all the package names for the hamradio group. |
||||
|
<P> |
||||
|
|
||||
|
<strong>-p</strong> is used to query a <em>Debian package</em>, these |
||||
|
packages are distinguished by their ``deb'' ending, but swim can |
||||
|
tell whether a file is a debian package even without the ending. Called |
||||
|
without any options the package name with version will be shown. |
||||
|
<hr> |
||||
|
<h2><A name="s-specdata"> |
||||
|
9.2 SPECIFYING THE DATABASES TO USE |
||||
|
|
||||
|
</A></h2> |
||||
|
<strong>--dists</strong> will use the databases for the argument |
||||
|
given, otherwise the databases pertaining to the value found in swimrc |
||||
|
will be used. |
||||
|
|
||||
|
<P> |
||||
|
|
||||
|
<strong>--arch</strong> will use the databases for the argument given, |
||||
|
otherwise the databases pertaining to the value found in swimrc will be |
||||
|
used. |
||||
|
|
||||
|
<P> |
||||
|
|
||||
|
Example: <strong>swim -qat --arch hurd-i386 --dists unstable</strong> |
||||
|
|
||||
|
<P> |
||||
|
|
||||
|
Assuming these databases exist this will show all packages and their |
||||
|
versions for the unstable distribution and architecture hurd-i386 even if |
||||
|
the values in <em>swimrc</em> are i386 and stable. |
||||
|
|
||||
|
<P> |
||||
|
|
||||
|
see <A href="ch-important.html#s-downimportant">A. downloading the important databases with --ftp. |
||||
|
, section 6.1</A> and <A href="ch-notinstalled.html">MAKING NOT-INSTALLED DATABASES |
||||
|
, chapter 7</A> for more |
||||
|
information about the databases. |
||||
|
|
||||
|
<hr> |
||||
|
<h2><A name="s9.3"> |
||||
|
9.3 OPTIONS |
||||
|
|
||||
|
</A></h2> |
||||
|
<strong>--total or -t</strong> are <em>used to override the output |
||||
|
suppressor</em>. The output suppressor will not show output if a certain |
||||
|
number of packages is exceeded, instead it will show the number of |
||||
|
packages you are querying. This is useful for two reasons, first, knowing |
||||
|
the number of packages you are quering can be very informative, second, it |
||||
|
gives you a chance to add to the command line a pipe to a pager, ex: |
||||
|
``<strong>swim -qat | less</strong>''. You can set the number that the |
||||
|
output suppressor works at as high or low as you want in the |
||||
|
<em>swimrc(8)</em> file. By design the <strong>-t</strong> option will |
||||
|
have to be used if the <strong>-i</strong> option is used and more than |
||||
|
one package is being queried. This option can also be used to alter the |
||||
|
output of the various script options (--scripts, --preinst, --postinst, |
||||
|
--prerm, and --postrm). |
||||
|
|
||||
|
<P> |
||||
|
|
||||
|
<strong>-i</strong> provides <em>information</em> about each package being |
||||
|
queried. The format differs slightly for the installed packages versus the |
||||
|
not-installed packages. see <A href="#s-format">FORMAT |
||||
|
, section 9.5</A>: |
||||
|
|
||||
|
<P> |
||||
|
|
||||
|
<strong>-l</strong> provides a listing of the files associated with a |
||||
|
package. If the option <strong>--df</strong> is provided as an argument, |
||||
|
all the directories associated with package will be shown. It is important |
||||
|
to remember that many packages provide directories which become important |
||||
|
to them after they are installed, so the option <strong>--df</strong> |
||||
|
often provides necessary information which <strong>-l</strong> called by |
||||
|
itself would have not. |
||||
|
|
||||
|
<P> |
||||
|
|
||||
|
<strong>-d</strong> shows the documentation which the package provides |
||||
|
found in <em>/usr/doc/*</em>, <em>/usr/man/*</em>, <em>/usr/info/*</em>. |
||||
|
Other documentation which the package may provide in a non-standard |
||||
|
location will not be shown. <strong>-d</strong> takes precedence over |
||||
|
<strong>-l</strong>, so if <strong>-l</strong> is used on the command line |
||||
|
with <strong>-d</strong>, only the output for <strong>-d</strong> will be |
||||
|
shown. |
||||
|
|
||||
|
<P> |
||||
|
|
||||
|
<strong>-v</strong> is a special option which works only with the minor |
||||
|
mode <strong>-p</strong>. It can be used with <strong>-l</strong>, |
||||
|
<strong>--df</strong>, <strong>-d</strong>, to show the packages files |
||||
|
and/or directories in long format (<code>ls - |
||||
|
l</code>). |
||||
|
|
||||
|
<P> |
||||
|
|
||||
|
<strong>-c</strong> will show the configuration files packages use. If the |
||||
|
package does not have a configuration file then nothing will be shown. The |
||||
|
output will show the file and its path indented one space with the |
||||
|
<strong>MD5 checksum</strong>. This will not work with |
||||
|
<strong>-n</strong>. |
||||
|
|
||||
|
<P> |
||||
|
|
||||
|
<strong>--scripts</strong> shows all scripts associated with a package |
||||
|
with the name of the script presented before each script in this way |
||||
|
<strong>#####scriptname######</strong>. If the scripts are called |
||||
|
individually by using the script options <strong>--preinst</strong>, |
||||
|
<strong>--postinst</strong>, <strong>--prerm</strong>, or |
||||
|
<strong>--postrm</strong> no title is shown, this is nice for writing to a |
||||
|
file. If <strong>-t</strong> is used with the individual script options a |
||||
|
title will be shown, this makes sense because normally only individual |
||||
|
packages would be queried to write a script to a file, and |
||||
|
<strong>-t</strong> wouldn't be used in this situation. Scripts are the |
||||
|
soul of Debianized packages allowing packages to be installed, configured, |
||||
|
and removed seamlessly and cleanly under all kinds of conditions. These |
||||
|
options do no work with <strong>-n</strong>. |
||||
|
|
||||
|
<P> |
||||
|
|
||||
|
<strong>--menu or -m</strong> is used to view menufiles which belong to |
||||
|
various packages. If the package does not have a menufile nothing will be |
||||
|
shown. This option can be useful in troubleshooting a menu entry which |
||||
|
does not seem to work, or in finding out where the menu entry is. |
||||
|
<em>Joost Witteveen's Debian menu system</em> is a centralized program |
||||
|
which interacts with all kinds of menus. <em>Please read the |
||||
|
documentation</em> ``<strong>swim -qd menu</strong>'' which comes with the |
||||
|
menu package to find out more. This will not work with |
||||
|
<strong>-n</strong>. |
||||
|
|
||||
|
<P> |
||||
|
|
||||
|
<strong>--shlibs</strong> shows a list of shared libraries certain |
||||
|
packages supply. The <em>Debian Packaging Manual</em> (packaging-manual) |
||||
|
provides detailed information about the format of a shlibs file. This will |
||||
|
not work with <strong>-n</strong>. |
||||
|
<P> |
||||
|
|
||||
|
<strong>--md5sum</strong> checks <strong>MD5 checksums</strong>. It can be |
||||
|
used with <strong>-l</strong>, <strong>-d</strong>, <strong>-c</strong>, |
||||
|
or <strong>-p</strong>. If there are checksums available the md5sum result |
||||
|
will be either <strong>OK</strong>, <strong>FAILED</strong>, or |
||||
|
<strong>MISSING</strong>. <strong>MISSING</strong> means that although a |
||||
|
checksum exists, the file can not be found. The result is put after the |
||||
|
file and its path and the <strong>MD5 checksum</strong> or the package |
||||
|
name and version and the <strong>MD5 checksum</strong>. |
||||
|
|
||||
|
<P> |
||||
|
|
||||
|
<strong>--copyright</strong> does a case insensitive search for copy or |
||||
|
license in the <em>/usr/doc/packagename</em> directory. This should show |
||||
|
how the package relates to <em>Debian's Policy Manual</em>. |
||||
|
|
||||
|
<P> |
||||
|
|
||||
|
<strong>--changelog</strong> searches for any files in |
||||
|
<em>/usr/doc/packagename</em> which look like changelogs. Debian packages |
||||
|
always have a <em>Maintainer's</em> changelog for the package. There may |
||||
|
be a separate changelog kept by the author of the program. |
||||
|
<hr> |
||||
|
<h2><A name="s9.4"> |
||||
|
9.4 PACKAGE RELATIONSHIPS |
||||
|
|
||||
|
</A></h2> |
||||
|
|
||||
|
<strong>-T</strong> shows all the package relationships of packages. |
||||
|
Individual package relationships can be viewed using |
||||
|
<strong>--pre_depends</strong>, <strong>--depends</strong>, |
||||
|
<strong>--recommends</strong>, <strong>--suggests</strong>, |
||||
|
<strong>--replaces</strong>, <strong>--conflicts</strong> or |
||||
|
<strong>--provides</strong>. Package relationships are the spirit of |
||||
|
Debian packages, here is a quick overview briefly reiterating what can be |
||||
|
found in the <em>Debian Packaging Manual</em>. <em>Package |
||||
|
Maintainers</em> set these relationships in control file fields of the |
||||
|
same name. |
||||
|
<P> |
||||
|
|
||||
|
<strong>Dependencies</strong> |
||||
|
|
||||
|
<em>Pre-depends</em> - means that the pre-depended package or packages |
||||
|
must be installed before the queried package can be installed. Most |
||||
|
packages which have pre-dependencies are usually essential and required |
||||
|
packages. |
||||
|
|
||||
|
<P> |
||||
|
|
||||
|
<em>Depends</em> - declares an absolute dependency to another package or |
||||
|
packages either <em>real or virtual</em>. The queried package cannot |
||||
|
function without this other package. |
||||
|
|
||||
|
<P> |
||||
|
|
||||
|
<em>Recommends</em> - declares a strong, but not absolute dependency to |
||||
|
another package or packages either <em>real or virtual</em>. You would |
||||
|
usually find the recommended package together with the queried package in |
||||
|
a normal installation. |
||||
|
|
||||
|
<P> |
||||
|
|
||||
|
<em>Suggests</em> - can be one or more packages either <em>real or |
||||
|
virtual</em> which would be useful to the queried package, but are not |
||||
|
necessary. |
||||
|
|
||||
|
|
||||
|
<strong>Alternative Packages</strong> |
||||
|
<P> |
||||
|
|
||||
|
<em>Conflicts</em> - is a package or packages either <em>real or |
||||
|
virtual</em> which would cause problems with the queried package, and |
||||
|
would not be allowed to be installed while the queried package was |
||||
|
installed. |
||||
|
<P> |
||||
|
|
||||
|
<strong>Overwriting files and Replacing Packages</strong> |
||||
|
<P> |
||||
|
|
||||
|
<em>Replaces</em> - allows the queried package to replace another package |
||||
|
or packages by overwriting their files, after which the previous package |
||||
|
would be considered to have disappeared. Essentially this allows the |
||||
|
queried package to take over the package or packages. In a situation where |
||||
|
there was a Conflict between the queried package and these packages this |
||||
|
field would help determine which packages should be removed. |
||||
|
<P> |
||||
|
|
||||
|
<strong>Virtual Packages</strong> |
||||
|
<P> |
||||
|
|
||||
|
<em>Provides</em> - declares a virtual package which may be mentioned in |
||||
|
<em>Depends</em>, <em>Recommends</em>, <em>Suggests</em>, or |
||||
|
<em>Conflicts</em>. <em>Virtual packages</em> allow one or more packages |
||||
|
to share the same name of another package, which means if the queried |
||||
|
package has a reference to a virtual package in one of the before |
||||
|
mentioned package relationship fields, then whatever packages provide the |
||||
|
virtual package are also being listed. |
||||
|
<hr> |
||||
|
<h2><A name="s-format"> |
||||
|
9.5 FORMAT |
||||
|
|
||||
|
</A></h2> |
||||
|
|
||||
|
<strong>1). Installed system</strong> |
||||
|
|
||||
|
<P> |
||||
|
|
||||
|
<pre> Package: name Status: hold ok installed |
||||
|
Version: 1.1-1 Essential: no |
||||
|
Section: namers Priority: extra |
||||
|
Installed-Size: 10 Source: generatename (2.0-1) |
||||
|
Maintainer: name <name@name.org> |
||||
|
Description: hostname maker |
||||
|
A nice way to figure out a hostname nobody |
||||
|
else has.</pre> |
||||
|
<P> |
||||
|
|
||||
|
<strong>2) Not-installed system</strong> |
||||
|
|
||||
|
|
||||
|
|
||||
|
<P> |
||||
|
|
||||
|
<pre> Package: name Status: r> hold ok installed (1.1-1) |
||||
|
Version: 1.1-2 Essential: no |
||||
|
Section: names Priority: extra |
||||
|
Installed-Size: 11 Source: generatename (2.0-1) |
||||
|
Size: 43000 Architecture: i386 |
||||
|
Distribution: experimental |
||||
|
Maintainer: name <name@name.org> |
||||
|
Description: hostname maker |
||||
|
A nice way to figure out a hostname nobody |
||||
|
else has.</pre> |
||||
|
<P> |
||||
|
|
||||
|
There are several things to point out. The difference between the two |
||||
|
outputs relates to the addition of the Distribution, Size, and |
||||
|
Architecture fields for the not-installed query. Installed-Size is how |
||||
|
many kilobytes the package will occupy when it is unpacked, whereas Size |
||||
|
is the size in bytes of the package. |
||||
|
<hr> |
||||
|
<h3><A name="s9.5.1"> |
||||
|
9.5.1 STATUS FIELD |
||||
|
|
||||
|
</A></h3> |
||||
|
|
||||
|
|
||||
|
The Status field provides the installation status of the package, this |
||||
|
holds true for the not-installed query as well. In a sense, the |
||||
|
not-installed database isn't always not-installed. If the not-installed |
||||
|
package is actually already installed, and the version numbers are exactly |
||||
|
the same, then the status will be the same for either query. If the |
||||
|
not-installed package is not installed then the status will be |
||||
|
``not-installed''. In cases where the not-installed package is already |
||||
|
installed, swim uses it's comparison function to figure out whether it is |
||||
|
a newer of older package which is installed. In the above example, swim |
||||
|
realizes the same package is installed, and only the debian-revision has |
||||
|
changed, hence the only difference is that the revision number is greater |
||||
|
``r>'' for the not-installed package. When only the debian-revision has |
||||
|
changed it can safely be assumed that the author (creator, programmer) of |
||||
|
the same program has not made any changes to the same program, but the |
||||
|
Debian maintainer has made a change to an aspect of the package like a |
||||
|
change in the script the package uses to properly install. You may have |
||||
|
also noticed that the status field shows the version number of the |
||||
|
installed package enclosed in parenthesis. |
||||
|
<hr> |
||||
|
<h3><A name="s9.5.2"> |
||||
|
9.5.2 SOURCE FIELD |
||||
|
|
||||
|
</A></h3> |
||||
|
|
||||
|
The Source field is present in these examples, but the Source field will |
||||
|
not always be present for packages. In cases where the name of the source |
||||
|
package is the same as the the name found in the Package field, and the |
||||
|
version number of the source package is also the same as found in the |
||||
|
Version field, then there will be no Source field. In the above examples |
||||
|
there is a Source field. In this case name was probably one of many |
||||
|
packages generated from the source package called generatename. In this |
||||
|
particular example generatename also has its own unique version number |
||||
|
2.0-1 enclosed in parentheses, if no version number had been mentioned |
||||
|
then the source package would have the same version number as found in the |
||||
|
Version field. |
||||
|
<hr> |
||||
|
<h3><A name="s-section"> |
||||
|
9.5.3 SECTION AND PRIORITY |
||||
|
|
||||
|
</A></h3> |
||||
|
|
||||
|
Section shows the subject which a package is categorized with (see |
||||
|
<code>-g</code>). Priority shows how important the package is to have |
||||
|
installed. In the case of the not-installed databases the information for |
||||
|
these fields is almost always available from the Packages databases, but |
||||
|
this is not always the case for Debian packages. For packages which do no |
||||
|
provide this information swim will do its best to fill in the blanks from |
||||
|
information found in the installed and not-installed databases. If proper |
||||
|
information can not be found it will be indicated as ``unavailable'' or |
||||
|
``unknown.'' Unavailable would indicate that information about the package |
||||
|
exists, but it is from a different version (includes debian-revision), and |
||||
|
no information exists for this version. Unknown means no similiar package |
||||
|
exists, and there is absolutely no information about this package in the |
||||
|
databases. |
||||
|
<P> |
||||
|
|
||||
|
When a Debian package is queried using the <strong>-p</strong> |
||||
|
option you will get output like the first example shows, the status field |
||||
|
is also calculated. |
||||
|
<hr> |
||||
|
<h2><A name="s-vrftp"> |
||||
|
9.6 FTP - VIRTUAL OPTIONS |
||||
|
|
||||
|
</A></h2> |
||||
|
|
||||
|
For ftp capabilities swim uses the <em>swimz.list</em> to determine which |
||||
|
sites it will check for the requested packages. The first site which fills |
||||
|
the request will be used, otherwise <strong>swim</strong> will go through |
||||
|
all the sites avoiding repeats, and if no sites can fill the request, |
||||
|
<strong>swim</strong> will either quit or proceed on to check for another |
||||
|
request. |
||||
|
<P> |
||||
|
|
||||
|
<strong>--ftp</strong> allows the queried package, its source package, or |
||||
|
just the source package diff to be downloaded while being queried. This is |
||||
|
refered to as virtual downloading because the quering and the downloading |
||||
|
are seamless as though the package already exists locally. This has to be |
||||
|
used with the option <strong>-n</strong> because packages which which are |
||||
|
not part of the not-installed database are considered to already have been |
||||
|
downloaded. Packages which are already installed can be downloaded or |
||||
|
their source retrieved by setting up a database which corresponds to these |
||||
|
packages; if the installed packages belong to the stable distribution, |
||||
|
set-up the not-installed stable databases. |
||||
|
<P> |
||||
|
|
||||
|
Packages or source code are placed in an area below the default directory |
||||
|
mirroring the remote directory they were downloaded from after their size |
||||
|
and modification times are checked for correct values. This area is called |
||||
|
the <strong>DF</strong> directory, and although this directory mirrors |
||||
|
remote directories, it is not an exact mirror, but specific to the |
||||
|
requirements of swim because code names for Release versions are not taken |
||||
|
into account. For real mirroring capabilities there exist many excellent |
||||
|
programs. If a package has a <strong>MD5 checksum</strong>, |
||||
|
<strong>--md5sum</strong> will automatically be run and the value shown. |
||||
|
Regardless of whether or not the md5sum check is <strong>OK</strong> or |
||||
|
not, the package will still be put in the <strong>DF</strong> directory to |
||||
|
allow the package to be looked at, so watch the output from |
||||
|
<strong>--ftp</strong> to check for <strong>FAILED md5sums</strong>. |
||||
|
|
||||
|
<P> |
||||
|
|
||||
|
Packages or source code packages will not be downloaded again if they are |
||||
|
found in the <strong>DF</strong> directory unless their |
||||
|
<em>upstream-version</em> has changed in the not-installed database, if |
||||
|
the packages are not in the DF directory and the remote |
||||
|
<em>upstream-version</em> is different than the not-installed |
||||
|
<em>upstream-version</em> then the packages will not be downloaded until |
||||
|
the not-installed database is updated or rebuilt to reflect the version |
||||
|
change. Changes in the package's <em>upstream-version</em> indicates that |
||||
|
the <code>author(s)</code> of the program have made changes to the computer |
||||
|
code for the program contained in the package or the source code package. |
||||
|
On the other hand, swim will check for a <em>debian-revision</em> change |
||||
|
at the remote site if the package can not immediately be found. If the |
||||
|
package's <em>debian-revision</em> has changed and the package does not |
||||
|
exist locally in the <strong>DF</strong> directory, it will be downloaded. |
||||
|
This is a nice feature, especially for the unstable distribution, because |
||||
|
it tends to extend the time needed before the not-installed database has |
||||
|
to be updated or rebuilt to match the changes at remote sites. |
||||
|
|
||||
|
<P> |
||||
|
|
||||
|
<strong>--source</strong> is used with <strong>--ftp</strong> to download |
||||
|
the source code package. <strong>--source_only</strong> will download the |
||||
|
source code package without the deb package. <em>Source packages consist |
||||
|
of three files</em>. The <em>source control file</em> which ends in |
||||
|
``dsc'', the <em>original source archive</em> which is a compressed tar |
||||
|
file, and the <em>unified context diff</em> showing the changes necessary |
||||
|
to make the original source into Debian source. The diff can be downloaded |
||||
|
by itself if <strong>--diff</strong> is provided as an argument to |
||||
|
<strong>--source or --source_only</strong>. |
||||
|
|
||||
|
<P> |
||||
|
|
||||
|
For <strong>apt</strong> users: <strong>apt</strong> allows packages to be |
||||
|
downloaded, but if more than one package is required for the package |
||||
|
relationships to be proper, <strong>apt</strong> will download all these |
||||
|
packages. <strong>--ftp</strong> allows specific packages to be |
||||
|
downloaded, packages from other architectures, and source packages to be |
||||
|
downloaded, here lies the advantage of this option over using <strong>-xyz |
||||
|
--nz</strong> (see below). If a particular package has been dowloaded into |
||||
|
the <strong>DF</strong> directory and it is needed by <strong>apt</strong> |
||||
|
for installation, simply copy or move the package from the |
||||
|
<strong>DF</strong> directory to <em>/var/cache/apt/archives</em> before |
||||
|
running <strong>apt</strong>, and the package will not be downloaded by |
||||
|
<strong>apt</strong> again; future versions of <strong>swim</strong> will |
||||
|
have an option to automatically accomplish this (see <code>--df2apt</code>). |
||||
|
<hr> |
||||
|
<h2><A name="s-vrapt"> |
||||
|
9.7 APT - VIRTUAL OPTIONS |
||||
|
|
||||
|
</A></h2> |
||||
|
|
||||
|
apt-get(8) is a nice package relationship checker from the |
||||
|
<strong>apt</strong> package which figures out what needs to be done to |
||||
|
properly install a package or packages when one or more package names are |
||||
|
provided to it. <strong>apt-get</strong> will get all packages which are |
||||
|
needed using a variety of methods, and then <strong>apt-get</strong> |
||||
|
interacts with <strong>dpkg</strong> in a way which allows for a |
||||
|
successful installation. |
||||
|
|
||||
|
<P> |
||||
|
|
||||
|
<strong>-xyrz, --remove, and --nz</strong> can be used if |
||||
|
<strong>apt-get</strong> from the <strong>apt</strong> package is |
||||
|
installed. These options allow for what is refered to as virtual |
||||
|
installation/removal. It is prudent to always test what will happen by |
||||
|
using the <strong>-x</strong> option alone before actually proceeding with |
||||
|
the installation with the <strong>-z</strong> option. <strong>-x</strong> |
||||
|
will actually simulate what would happen in an installation, showing which |
||||
|
and how many packages will be changed, which and how many new packages |
||||
|
will need to be installed, which and how many packages will need to be |
||||
|
removed, any conflicts, and what needs to be configured. |
||||
|
<strong>-y</strong> will automatically answer yes to any prompts |
||||
|
<strong>apt-get</strong> may produce allowing <strong>apt-get</strong> to |
||||
|
run non-interactively. <strong>-z</strong> as mentioned before actually |
||||
|
proceeds with the installation using <strong>dpkg</strong> after the |
||||
|
<strong>apt-get</strong> gets the packages. You can append a minus sign |
||||
|
to a package name to cause it to be removed. <strong>--nz</strong> when |
||||
|
used as an optional argument with <strong>-xz or -xyz</strong> will only |
||||
|
download the packages into <em>/var/cache/apt/archives</em> or into |
||||
|
whatever directory you configured for holding archives for |
||||
|
<strong>apt</strong>. |
||||
|
<P> |
||||
|
|
||||
|
<strong>IMPORTANT</strong>: <strong>apt</strong> makes it so easy to make |
||||
|
changes to your installation that it is highly recommended to do your |
||||
|
research with swim first. This can be done by checking package |
||||
|
relationships, file/dir listings, comparing the not-installed package to |
||||
|
an installed package if such exists, checking <strong>--md5sum</strong> |
||||
|
and <strong>-c</strong> for the installed package, and checking the Source |
||||
|
field by running a <strong>--search</strong> (see <A href="ch-search.html">SEARCHING |
||||
|
, chapter 11</A>) to |
||||
|
check to see how the source package has been split into binary packages |
||||
|
for the not-installed package versus an installed package if such exists. |
||||
|
Ofcourse, there are many other things you could look at, and you can |
||||
|
always do your research after the fact. Presently <strong>--db</strong> is |
||||
|
run only by hand, so you can check the old state after an installation if |
||||
|
you have not already run <strong>--db</strong>, yourself. |
||||
|
<hr> |
||||
|
<h2><A name="s-vrrm"> |
||||
|
9.8 REMOVING AN INSTALLED PACKAGE - VIRTUAL OPTIONS |
||||
|
|
||||
|
</A></h2> |
||||
|
|
||||
|
<strong>--purge</strong> uses <strong>dpkg</strong> to remove an installed |
||||
|
package or packages and the configuration files as shown with |
||||
|
``<strong>swim -qc packagename</strong>''. |
||||
|
<P> |
||||
|
|
||||
|
<strong>-r or --remove</strong> removes an installed package or packages |
||||
|
with <strong>apt</strong>, but not the configuration files as shown with |
||||
|
``<strong>swim -qc packagename</strong>''. You may also append a plus |
||||
|
sign to a package name to cause it to be installed. This option is used |
||||
|
with -x or -x(y)z. |
||||
|
<hr> |
||||
|
<h2><A name="s9.9"> |
||||
|
9.9 STDIN - VIRTUAL OPTIONS |
||||
|
|
||||
|
</A></h2> |
||||
|
|
||||
|
<strong>--stdin</strong> works with either <strong>--ftp</strong>, |
||||
|
<strong>-x</strong>, <strong>-xyz</strong>, <strong>-xz</strong>, |
||||
|
<strong>--purge</strong>, <strong>-r</strong>, or |
||||
|
<strong>--remove</strong>. |
||||
|
<P> |
||||
|
|
||||
|
<strong>--stdin</strong> provides the <em>readline capabilities</em> |
||||
|
commonly found in shells allowing you to edit what is on the command line. |
||||
|
You can edit the command line, press enter and then recall the history, |
||||
|
and make more changes, or <em>type in exit to process the changed or |
||||
|
unchanged command line</em>. To find out more about what readline commands |
||||
|
your shell supports please read the man pages which apply to your shell. |
||||
|
Information for the bash shell can be found in <code>bash(1)</code> under the |
||||
|
title ``<strong>Readline Command Names</strong>''. |
||||
|
<P> |
||||
|
|
||||
|
Example: ``<strong>swim -qgnx --stdin hamradio</strong>'' will list all |
||||
|
the packages from the not-installed hamradio group on the command line, |
||||
|
this list can be edited then submitted to <strong>apt-get</strong> for a |
||||
|
simulated installation. Another instance of <strong>swim</strong> can be |
||||
|
run at the same time, perhaps ``<strong>swim -qinTg hamradio</strong>'' to |
||||
|
help in making editing decisions for <strong>--stdin</strong>. |
||||
|
<hr> |
||||
|
<h2><A name="s9.10"> |
||||
|
9.10 PACKAGE MANIPULATION - VIRTUAL OPTIONS |
||||
|
|
||||
|
</A></h2> |
||||
|
|
||||
|
<strong>--extract</strong> only works with the <strong>minor mode |
||||
|
-p</strong> to extract parts or all of a Debian package. If the |
||||
|
<strong>argument ALL</strong> is provided then <em>everything found in the |
||||
|
package will be extracted</em> below the current directory in the exact |
||||
|
directories found in the package. A particular <em>file may be extracted |
||||
|
in its exact location</em> below the current directory by <em>entering the |
||||
|
exact path for the file</em> as shown by ``<strong>swim -qpl</strong>'' or |
||||
|
``<strong>swim -qpd</strong>'' as the argument. Alternativily, a <em>file |
||||
|
may be extracted in the current directory</em> regardless of its proper |
||||
|
location by <em>prepending PWD\! before the path</em> shown by |
||||
|
``<strong>swim -qpl</strong>'' or ``<strong>swim -qpd</strong>''. Notice |
||||
|
the backslash before the exclamation point, this is because shells |
||||
|
consider ! a special character, so it has to be backslashed so that the |
||||
|
shell knows that it is not such a special character. Example: |
||||
|
``<strong>swim -qpi --extract PWD\!usr/bin/name --scripts |
||||
|
name_1.1-2.deb</strong>'' will extract the binary name in the current |
||||
|
directory from the name package, show information for the name package, |
||||
|
and show any scripts for the name package. |
||||
|
<hr> |
||||
|
<h2><A name="s-dblocus"> |
||||
|
9.11 DATABASE LOCATIONS |
||||
|
|
||||
|
</A></h2> |
||||
|
|
||||
|
<strong>--dbpath</strong> can be specified as an alternative location for |
||||
|
where the databases would be found. The default location is |
||||
|
``<em>/var/lib/dpkg</em>''. An argument like ``<em>/otherstuff</em>'' can |
||||
|
be provided, and then the databases would be found here instead. |
||||
|
|
||||
|
<P> |
||||
|
|
||||
|
<strong>--root</strong> allows a database to be found for a Debian |
||||
|
distribution installed on a different partition. If the distribution is |
||||
|
mounted on <em>/New_Debian</em>, ``<em>/New_Debian</em>'' would be the |
||||
|
argument to root. The databases would be found for the Debian distribution |
||||
|
installed on the ``<em>/New_Debian</em>'' partition. |
||||
|
<P> |
||||
|
|
||||
|
<strong>--dbpath and --root</strong> can be used together. Given the |
||||
|
previous two examples, the databases would be found on |
||||
|
``<em>/New_Debian/otherstuff</em>'', assuming |
||||
|
``<em>/New_Debian/otherstuff</em>'' actually existed. |
||||
|
<hr> |
||||
|
swim |
||||
|
- <A href="index.html#copyright"> |
||||
|
Copyright © 1999 Jonathan D. Rosenbaum |
||||
|
</A> |
||||
|
<br> |
||||
|
<A href="index.html#toc">Contents</A>; <A href="ch10.html">next</A>; <A href="ch-aptprep.html">back</A>. |
||||
|
<br> |
||||
|
<address>15 June 1999<br> |
||||
|
Jonathan D. Rosenbaum<A href="mailto:mttrader@access.mountain.net">mttrader@access.mountain.net</A></address> |
||||
|
</body></html> |
@ -0,0 +1,82 @@ |
|||||
|
<html><head> |
||||
|
<title>swim - RAMDISK |
||||
|
</title> |
||||
|
<link rev=made href="mailto:mttrader@access.mountain.net"> |
||||
|
</head><body> |
||||
|
<h1> |
||||
|
swim - chapter 12<br> |
||||
|
RAMDISK |
||||
|
|
||||
|
</h1> |
||||
|
|
||||
|
<pre>usage: swim --ramdiskon |
||||
|
swim --ramdiskoff |
||||
|
|
||||
|
options: [-n] [--searchfile] [--arch <architecture>] |
||||
|
[--dists <distribution>] [--dbpath] [--root] |
||||
|
|
||||
|
no options for --ramdiskoff |
||||
|
</pre> |
||||
|
<P> |
||||
|
<hr> |
||||
|
<h2><A name="s12.1"> |
||||
|
12.1 OVERVIEW |
||||
|
|
||||
|
</A></h2> |
||||
|
|
||||
|
A ramdisk can be mounted below the default path or the specified path for |
||||
|
the databases in the dramdisk directory. The ramdisk is used to speed up |
||||
|
powersearchs and/or file/dir listings for packages from the not-installed |
||||
|
system. Also, this is useful if a computer system is heavily loaded with |
||||
|
other processes using the memory, and the ramdisk tends to persist even |
||||
|
after being unmounted. Modern kernels usually are built with support for |
||||
|
ramdisks. If these options do not work the kernel will need to be compiled |
||||
|
to support ramdisks by answering yes to RAM disk support. Perhaps the best |
||||
|
<em>README</em> showing how to configure and compile a kernel comes with |
||||
|
the <em>kernel sources</em> in the main directory. |
||||
|
<P> |
||||
|
|
||||
|
<strong>--ramdiskon</strong> allows a ramdisk to be created and mounted. |
||||
|
If called with <strong>-n</strong> (not-installed databases) |
||||
|
<em>ncontents-arch-dists.deb.gz</em> will automatically be written to the |
||||
|
mounted ramdisk. This provides faster file/dir listing capabilities when |
||||
|
using <strong>-l</strong>, <strong>--df</strong>, or <strong>-d</strong> |
||||
|
when querying the not-installed system. Faster powersearch capabilities |
||||
|
are available through the option <strong>--searchfile</strong>. If the |
||||
|
search databases are not already compressed, they will now be compressed, |
||||
|
this usually only needs to be done once or until the databases are updated |
||||
|
or rebuilt again. The search databases will then be written to the mounted |
||||
|
ramdisk. An installed system only writes the search databases to the |
||||
|
mounted ramdisk, so always use --searchfile when specifying installed |
||||
|
system databases. |
||||
|
<P> |
||||
|
|
||||
|
<strong>--ramdiskoff</strong> is used to unmount the ramdisk. The |
||||
|
not-installed databases and the installed databases can not be |
||||
|
simultaneously provided by a mounted ramdisk, use |
||||
|
<strong>--ramdiskoff</strong> first, then <strong>--ramdiskon</strong> to |
||||
|
install the other databases of choice. This also pertains to different |
||||
|
distributions and/or architectures. |
||||
|
<P> |
||||
|
|
||||
|
|
||||
|
See the section ``<A href="ch-query.html#s-specdata">SPECIFYING THE DATABASES TO USE |
||||
|
, section 9.2</A>'' for |
||||
|
options <strong>--arch</strong>, <strong>-dists</strong>. |
||||
|
<P> |
||||
|
|
||||
|
See the section ``<A href="ch-query.html#s-dblocus">DATABASE LOCATIONS |
||||
|
, section 9.11</A>'' for options |
||||
|
<strong>--dbpath</strong> and <strong>--root</strong>. |
||||
|
|
||||
|
<hr> |
||||
|
swim |
||||
|
- <A href="index.html#copyright"> |
||||
|
Copyright © 1999 Jonathan D. Rosenbaum |
||||
|
</A> |
||||
|
<br> |
||||
|
<A href="index.html#toc">Contents</A>; <A href="ch13.html">next</A>; <A href="ch-search.html">back</A>. |
||||
|
<br> |
||||
|
<address>15 June 1999<br> |
||||
|
Jonathan D. Rosenbaum<A href="mailto:mttrader@access.mountain.net">mttrader@access.mountain.net</A></address> |
||||
|
</body></html> |
@ -0,0 +1,191 @@ |
|||||
|
<html><head> |
||||
|
<title>swim - SEARCHING |
||||
|
</title> |
||||
|
<link rev=made href="mailto:mttrader@access.mountain.net"> |
||||
|
</head><body> |
||||
|
<h1> |
||||
|
swim - chapter 11<br> |
||||
|
SEARCHING |
||||
|
|
||||
|
</h1> |
||||
|
|
||||
|
<pre>usage: swim --search ? (--research || --refinesearch) <pattern(s)> |
||||
|
swim --powersearch ? (--research || --refinesearch) <pattern(s)> |
||||
|
swim --ps ? (--research || --refinesearch) <pattern(s)> |
||||
|
|
||||
|
options: [-g] [-n] [--dbpath <dir>] [--root <dir>] [--no] |
||||
|
[--arch <architecture>] [--dists <distribution> |
||||
|
[--ftp ? --source | --source_only <[--diff]>] |
||||
|
[-xyrz --remove ? <[--nz]>] [--stdin] [--apt2df] |
||||
|
[--no] [--df2apt] [--purge] [<\d{1,}>] |
||||
|
|
||||
|
[--dir] and no [-g]for --powersearch or --ps |
||||
|
</pre> |
||||
|
|
||||
|
<P> |
||||
|
<hr> |
||||
|
<h2><A name="s11.1"> |
||||
|
11.1 OVERVIEW |
||||
|
|
||||
|
</A></h2> |
||||
|
|
||||
|
|
||||
|
<strong>swim</strong> provides two major types of searches. A search with |
||||
|
<strong>--search</strong> <em>searches package information</em> (see <A href="ch-query.html#s-format">FORMAT |
||||
|
, section 9.5</A>), and a search with <strong>--powersearch or --ps</strong> |
||||
|
<em>searches package information, and all files and/or directories |
||||
|
associated with each package</em>. |
||||
|
<P> |
||||
|
|
||||
|
The results of either of these searches can be <em>narrowed down</em> by |
||||
|
running a test search with <strong>--research</strong> (this step can be |
||||
|
skipped) and/or setting the results in stone with |
||||
|
<strong>--refinesearch</strong>. <strong>--search</strong> can be |
||||
|
<em>narrowed down</em> initially by specifying a particular |
||||
|
<em>group</em>, and <strong>--powersearch</strong> can be |
||||
|
<em>expanded</em> initially by specifying that <em>directories</em> be |
||||
|
searched as well as files. Both searches can <em>use the same virtual |
||||
|
options</em> which the major mode <strong>-q or --query</strong> use. |
||||
|
Generally, it is preferable to run a search, and then to provide the |
||||
|
results of a search (<strong>using -S</strong>) as an argument to |
||||
|
<strong>-q or --query</strong>; this allows the results of a search to be |
||||
|
queried. Every time a search is run the results are appended to the |
||||
|
history, past searches can be refined or researched by providing the |
||||
|
numerical argument pertaining to the history. \d{1,} is simply Perl |
||||
|
notation meaning a number with one of more digits. |
||||
|
|
||||
|
<P> |
||||
|
|
||||
|
<em>Perl regexps</em> (see <code>perlre(1p))</code> can be used to define the |
||||
|
pattern (string) provided as an argument to a search. Do not surround a |
||||
|
pattern in slashes, a slash is only used after all patterns and before the |
||||
|
<em>modifiers i and/or m</em> (swim supports these two modifiers). To |
||||
|
search for more than one pattern, patterns are separated with <em>bars |
||||
|
(|)</em>. Patterns may include <em>quatifiers, and metacharacters</em>, |
||||
|
also found in <code>egrep(1).</code> |
||||
|
<P> |
||||
|
|
||||
|
If a search finds any packages which match the search, the package |
||||
|
information will be displayed as the package is found. The package will |
||||
|
only be shown once regardless of how many times it is found while the |
||||
|
search progresses. When the search is over the number of packages found is |
||||
|
shown. |
||||
|
<P> |
||||
|
|
||||
|
<strong>--search</strong> provides a search of package information. This |
||||
|
is similiar to grepping ``<strong>swim -qait</strong>'' or ``<strong>swim |
||||
|
-qaint</strong>'', but it is significantly faster. A search can be |
||||
|
performed on a particular group by using <strong>-g</strong> with a group |
||||
|
as an argument |
||||
|
<P> |
||||
|
|
||||
|
<strong>--powersearch</strong> is somewhat similiar to ``<strong>dpkg |
||||
|
--search</strong>'' which searches all files and directories on an |
||||
|
installed system, but it combines <strong>--search</strong> with the file |
||||
|
and/or directory search, and can also be performed on a not-installed |
||||
|
system. A <em>powersearch</em> is significantly faster than the search |
||||
|
which <strong>dpkg</strong> provides (even more so when ``<code>swim |
||||
|
--ramdiskon --searchfile</code>'' is used) and even more importantly |
||||
|
provides a logical output of the search (like ``<code>swim -qi |
||||
|
packagename</code>''). By default a search of all directories is not |
||||
|
performed because usually this is redundant except in rare cases. To |
||||
|
enable a search of all directories use the <strong>--dir</strong> option. |
||||
|
<hr> |
||||
|
<h2><A name="s11.2"> |
||||
|
11.2 NARROWING A PREVIOUS SEARCH |
||||
|
|
||||
|
</A></h2> |
||||
|
|
||||
|
<strong>--research</strong> allows the results of a previous search to be |
||||
|
researched without making the new results permanent. |
||||
|
<P> |
||||
|
|
||||
|
<strong>--refinesearch</strong> allows the results of a previous search to |
||||
|
be researched while making the |
||||
|
new results permanent. |
||||
|
<P> |
||||
|
|
||||
|
<strong>\d{1,}</strong> is a numerical argument to refine or research a |
||||
|
past search from the history. |
||||
|
<hr> |
||||
|
<h2><A name="s11.3"> |
||||
|
11.3 MINOR MODES |
||||
|
|
||||
|
</A></h2> |
||||
|
|
||||
|
<strong>-n</strong> allows the not-installed databases to be searched. |
||||
|
These databases will not exist if the not-installed databases were made |
||||
|
with the FDB argument (see <code>--initndb</code>). |
||||
|
<P> |
||||
|
|
||||
|
<strong>-g</strong> (see -g above and <A href="ch-query.html#s-mm">MINOR MODES |
||||
|
, section 9.1</A>). |
||||
|
<hr> |
||||
|
<h2><A name="s11.4"> |
||||
|
11.4 OTHER OPTIONS |
||||
|
|
||||
|
</A></h2> |
||||
|
|
||||
|
<strong>--no</strong> prevents normal output from a search, but does show |
||||
|
how many packages were found. |
||||
|
<P> |
||||
|
|
||||
|
See the section ``<A href="ch-query.html#s-specdata">SPECIFYING THE DATABASES TO USE |
||||
|
, section 9.2</A>'' for options |
||||
|
<strong>--arch</strong>, <strong>-dists</strong>. |
||||
|
<P> |
||||
|
|
||||
|
See the section ``<A href="ch-query.html#s-vrftp">FTP - VIRTUAL OPTIONS |
||||
|
, section 9.6</A>'' for |
||||
|
<strong>--ftp</strong>, <strong>--source</strong>, |
||||
|
<strong>--source_only</strong>, <strong>--diff</strong>, |
||||
|
<P> |
||||
|
|
||||
|
See the section ``<A href="ch-query.html#s-vrapt">APT - VIRTUAL OPTIONS |
||||
|
, section 9.7</A>'' for |
||||
|
<strong>-xyz</strong>, <strong>--nz</strong>, <strong>--stdin</strong>, |
||||
|
<P> |
||||
|
|
||||
|
See the section ``<A href="ch-query.html#s-vrrm">REMOVING AN INSTALLED PACKAGE - VIRTUAL OPTIONS |
||||
|
, section 9.8</A>'' for |
||||
|
<strong>--purge</strong>, <strong>--remove</strong>, <strong>-r</strong>. |
||||
|
|
||||
|
<P> |
||||
|
|
||||
|
See the section ``<A href="ch-query.html#s-dblocus">DATABASE LOCATIONS |
||||
|
, section 9.11</A>'' for options |
||||
|
<strong>--dbpath</strong> and <strong>--root</strong>. |
||||
|
|
||||
|
<hr> |
||||
|
<h2><A name="s11.5"> |
||||
|
11.5 EXAMPLES |
||||
|
|
||||
|
</A></h2> |
||||
|
|
||||
|
<strong>swim -gn hamradio --search "radio network/i" --dbpath |
||||
|
/test --arch alpha</strong> |
||||
|
<P> |
||||
|
|
||||
|
will search the alpha architecture not-installed system databases in the |
||||
|
/test directory for all package information from the hamradio group using |
||||
|
the case insensitive pattern ``radio network''. |
||||
|
<P> |
||||
|
|
||||
|
<strong>swim --powersearch dpkg -xn</strong> |
||||
|
<P> |
||||
|
|
||||
|
will search the not-installed system databases for all package information |
||||
|
and all files using the case sensitive pattern dpkg, after which apt-get |
||||
|
will run a simulation of what would happen if it got and installed these |
||||
|
packages. |
||||
|
<hr> |
||||
|
swim |
||||
|
- <A href="index.html#copyright"> |
||||
|
Copyright © 1999 Jonathan D. Rosenbaum |
||||
|
</A> |
||||
|
<br> |
||||
|
<A href="index.html#toc">Contents</A>; <A href="ch-ramdisk.html">next</A>; <A href="ch10.html">back</A>. |
||||
|
<br> |
||||
|
<address>15 June 1999<br> |
||||
|
Jonathan D. Rosenbaum<A href="mailto:mttrader@access.mountain.net">mttrader@access.mountain.net</A></address> |
||||
|
</body></html> |
@ -0,0 +1,23 @@ |
|||||
|
<html><head> |
||||
|
<title>swim - SEE ALSO |
||||
|
</title> |
||||
|
<link rev=made href="mailto:mttrader@access.mountain.net"> |
||||
|
</head><body> |
||||
|
<h1> |
||||
|
swim - chapter 14<br> |
||||
|
SEE ALSO |
||||
|
|
||||
|
</h1> |
||||
|
|
||||
|
<code>swimrc(5),</code> apt-get(8), sources.list(5), <code>dpkg(8)</code> |
||||
|
<hr> |
||||
|
swim |
||||
|
- <A href="index.html#copyright"> |
||||
|
Copyright © 1999 Jonathan D. Rosenbaum |
||||
|
</A> |
||||
|
<br> |
||||
|
<A href="index.html#toc">Contents</A>; <A href="ch15.html">next</A>; <A href="ch13.html">back</A>. |
||||
|
<br> |
||||
|
<address>15 June 1999<br> |
||||
|
Jonathan D. Rosenbaum<A href="mailto:mttrader@access.mountain.net">mttrader@access.mountain.net</A></address> |
||||
|
</body></html> |
@ -0,0 +1,26 @@ |
|||||
|
<html><head> |
||||
|
<title>swim - VERSION |
||||
|
</title> |
||||
|
<link rev=made href="mailto:mttrader@access.mountain.net"> |
||||
|
</head><body> |
||||
|
<h1> |
||||
|
swim - chapter 3<br> |
||||
|
VERSION |
||||
|
|
||||
|
</h1> |
||||
|
usage: <strong>swim --version</strong> |
||||
|
<P> |
||||
|
|
||||
|
This shows the version for the swim program. |
||||
|
|
||||
|
<hr> |
||||
|
swim |
||||
|
- <A href="index.html#copyright"> |
||||
|
Copyright © 1999 Jonathan D. Rosenbaum |
||||
|
</A> |
||||
|
<br> |
||||
|
<A href="index.html#toc">Contents</A>; <A href="ch-history.html">next</A>; <A href="ch-commandline.html">back</A>. |
||||
|
<br> |
||||
|
<address>15 June 1999<br> |
||||
|
Jonathan D. Rosenbaum<A href="mailto:mttrader@access.mountain.net">mttrader@access.mountain.net</A></address> |
||||
|
</body></html> |
@ -0,0 +1,64 @@ |
|||||
|
<html><head> |
||||
|
<title>swim - UPGRADING WITH APT |
||||
|
</title> |
||||
|
<link rev=made href="mailto:mttrader@access.mountain.net"> |
||||
|
</head><body> |
||||
|
<h1> |
||||
|
swim - chapter 10<br> |
||||
|
UPGRADING WITH APT |
||||
|
|
||||
|
</h1> |
||||
|
|
||||
|
usage: <strong>swim --apt</strong> |
||||
|
<P> |
||||
|
|
||||
|
options: <strong>[-xyz] [--upgrade] [--dist_upgrade]</strong> |
||||
|
<P> |
||||
|
|
||||
|
<strong>apt-get</strong> provides powerful methods to change an |
||||
|
installion. When these methods are called using <strong>--apt</strong>, |
||||
|
<strong>swim</strong> will not allow you to proceed until you are |
||||
|
absolutely sure this is what you want to do. Before using these methods do |
||||
|
a ``<strong>swim --apt --update</strong>'' so that |
||||
|
<strong>apt-get</strong> knows the newest versions of available packages. |
||||
|
This major mode requires a combination of <strong>-x</strong>, |
||||
|
<strong>-xz</strong> or <strong>-xyz</strong> to be used along with either |
||||
|
<strong>--upgrade</strong> or <strong>--dist_upgrade</strong>. |
||||
|
<strong>-x</strong> used alone will simulate what would happen if |
||||
|
<strong>-xz or -xyz</strong> were used (also see <code>-xyz</code> above). |
||||
|
|
||||
|
<P> |
||||
|
|
||||
|
<strong>--upgrade</strong> is somewhat similiar to doing ``<strong>swim |
||||
|
-qatxz</strong>'' except that it is a more intelligent method because |
||||
|
<strong>apt</strong> does some behind the scene calculations in regards to |
||||
|
package relationships, in fact the ``<strong>swim -qatxz</strong>'' |
||||
|
approach will provide totally different results, or maybe these were the |
||||
|
results you really wanted. ``<strong>swim --apt --upgrade -xz</strong>'' |
||||
|
is the prefered, proper, and built-in way provided by |
||||
|
<strong>apt-get</strong> to install the newest versions for all packages |
||||
|
installed on your system. This method will not install any newer versions |
||||
|
of packages which would change the install status of other packages. Note: |
||||
|
It is not recommended to combine the query option <strong>-a</strong> with |
||||
|
<strong>-xz or -xyz</strong>, but combining the query option |
||||
|
<strong>-a</strong> just with <strong>-x</strong> can be educational. |
||||
|
|
||||
|
<P> |
||||
|
|
||||
|
<strong>--dist_upgrade</strong> combines an <strong>--upgrade</strong> |
||||
|
with the installation of packages which are not installed. This method |
||||
|
carefully examines dependencies, and resolves conflicts, and given these |
||||
|
factors it will upgrade the most important packages before considering the |
||||
|
installation of less important packages. Less important packages will be |
||||
|
installed only if there are not any conflicts. |
||||
|
<hr> |
||||
|
swim |
||||
|
- <A href="index.html#copyright"> |
||||
|
Copyright © 1999 Jonathan D. Rosenbaum |
||||
|
</A> |
||||
|
<br> |
||||
|
<A href="index.html#toc">Contents</A>; <A href="ch-search.html">next</A>; <A href="ch-query.html">back</A>. |
||||
|
<br> |
||||
|
<address>15 June 1999<br> |
||||
|
Jonathan D. Rosenbaum<A href="mailto:mttrader@access.mountain.net">mttrader@access.mountain.net</A></address> |
||||
|
</body></html> |
@ -0,0 +1,29 @@ |
|||||
|
<html><head> |
||||
|
<title>swim - FILES |
||||
|
</title> |
||||
|
<link rev=made href="mailto:mttrader@access.mountain.net"> |
||||
|
</head><body> |
||||
|
<h1> |
||||
|
swim - chapter 12<br> |
||||
|
FILES |
||||
|
|
||||
|
</h1> |
||||
|
|
||||
|
Configuration files: |
||||
|
<P> |
||||
|
|
||||
|
<pre> |
||||
|
swimz.list |
||||
|
swimrc |
||||
|
</pre> |
||||
|
<hr> |
||||
|
swim |
||||
|
- <A href="index.html#copyright"> |
||||
|
Copyright © 1999 Jonathan D. Rosenbaum |
||||
|
</A> |
||||
|
<br> |
||||
|
<A href="index.html#toc">Contents</A>; <A href="ch-seealso.html">next</A>; <A href="ch-ramdisk.html">back</A>. |
||||
|
<br> |
||||
|
<address>12 March 1999<br> |
||||
|
Jonathan D. Rosenbaum<A href="mailto:mttrader@access.mountain.net">mttrader@access.mountain.net</A></address> |
||||
|
</body></html> |
@ -0,0 +1,29 @@ |
|||||
|
<html><head> |
||||
|
<title>swim - FILES |
||||
|
</title> |
||||
|
<link rev=made href="mailto:mttrader@access.mountain.net"> |
||||
|
</head><body> |
||||
|
<h1> |
||||
|
swim - chapter 13<br> |
||||
|
FILES |
||||
|
|
||||
|
</h1> |
||||
|
|
||||
|
Configuration files: |
||||
|
<P> |
||||
|
|
||||
|
<pre> |
||||
|
swimz.list |
||||
|
swimrc |
||||
|
</pre> |
||||
|
<hr> |
||||
|
swim |
||||
|
- <A href="index.html#copyright"> |
||||
|
Copyright © 1999 Jonathan D. Rosenbaum |
||||
|
</A> |
||||
|
<br> |
||||
|
<A href="index.html#toc">Contents</A>; <A href="ch-seealso.html">next</A>; <A href="ch-ramdisk.html">back</A>. |
||||
|
<br> |
||||
|
<address>15 June 1999<br> |
||||
|
Jonathan D. Rosenbaum<A href="mailto:mttrader@access.mountain.net">mttrader@access.mountain.net</A></address> |
||||
|
</body></html> |
@ -0,0 +1,20 @@ |
|||||
|
<html><head> |
||||
|
<title>swim - BUGS</title> |
||||
|
<link rev=made href="mailto:mttrader@access.mountain.net"> |
||||
|
</head><body> |
||||
|
<h1> |
||||
|
swim - chapter 15<br> |
||||
|
BUGS |
||||
|
</h1> |
||||
|
Send directly to mttrader@access.mountain.net. |
||||
|
<hr> |
||||
|
swim |
||||
|
- <A href="index.html#copyright"> |
||||
|
Copyright © 1999 Jonathan D. Rosenbaum |
||||
|
</A> |
||||
|
<br> |
||||
|
<A href="index.html#toc">Contents</A>; <A href="ch-seealso.html">back</A>. |
||||
|
<br> |
||||
|
<address>15 June 1999<br> |
||||
|
Jonathan D. Rosenbaum<A href="mailto:mttrader@access.mountain.net">mttrader@access.mountain.net</A></address> |
||||
|
</body></html> |
@ -0,0 +1,64 @@ |
|||||
|
<html><head> |
||||
|
<title>swim - UPGRADING WITH APT |
||||
|
</title> |
||||
|
<link rev=made href="mailto:mttrader@access.mountain.net"> |
||||
|
</head><body> |
||||
|
<h1> |
||||
|
swim - chapter 9<br> |
||||
|
UPGRADING WITH APT |
||||
|
|
||||
|
</h1> |
||||
|
|
||||
|
usage: <strong>swim --apt</strong> |
||||
|
<P> |
||||
|
|
||||
|
options: <strong>[-xyz] [--upgrade] [--dist_upgrade]</strong> |
||||
|
<P> |
||||
|
|
||||
|
<strong>apt-get</strong> provides powerful methods to change an |
||||
|
installion. When these methods are called using <strong>--apt</strong>, |
||||
|
<strong>swim</strong> will not allow you to proceed until you are |
||||
|
absolutely sure this is what you want to do. Before using these methods do |
||||
|
a ``<strong>swim --apt --update</strong>'' so that |
||||
|
<strong>apt-get</strong> knows the newest versions of available packages. |
||||
|
This major mode requires a combination of <strong>-x</strong>, |
||||
|
<strong>-xz</strong> or <strong>-xyz</strong> to be used along with either |
||||
|
<strong>--upgrade</strong> or <strong>--dist_upgrade</strong>. |
||||
|
<strong>-x</strong> used alone will simulate what would happen if |
||||
|
<strong>-xz or -xyz</strong> were used (also see <code>-xyz</code> above). |
||||
|
|
||||
|
<P> |
||||
|
|
||||
|
<strong>--upgrade</strong> is somewhat similiar to doing ``<strong>swim |
||||
|
-qatxz</strong>'' except that it is a more intelligent method because |
||||
|
<strong>apt</strong> does some behind the scene calculations in regards to |
||||
|
package relationships, in fact the ``<strong>swim -qatxz</strong>'' |
||||
|
approach will provide totally different results, or maybe these were the |
||||
|
results you really wanted. ``<strong>swim --apt --upgrade -xz</strong>'' |
||||
|
is the prefered, proper, and built-in way provided by |
||||
|
<strong>apt-get</strong> to install the newest versions for all packages |
||||
|
installed on your system. This method will not install any newer versions |
||||
|
of packages which would change the install status of other packages. Note: |
||||
|
It is not recommended to combine the query option <strong>-a</strong> with |
||||
|
<strong>-xz or -xyz</strong>, but combining the query option |
||||
|
<strong>-a</strong> just with <strong>-x</strong> can be educational. |
||||
|
|
||||
|
<P> |
||||
|
|
||||
|
<strong>--dist_upgrade</strong> combines an <strong>--upgrade</strong> |
||||
|
with the installation of packages which are not installed. This method |
||||
|
carefully examines dependencies, and resolves conflicts, and given these |
||||
|
factors it will upgrade the most important packages before considering the |
||||
|
installation of less important packages. Less important packages will be |
||||
|
installed only if there are not any conflicts. |
||||
|
<hr> |
||||
|
swim |
||||
|
- <A href="index.html#copyright"> |
||||
|
Copyright © 1999 Jonathan D. Rosenbaum |
||||
|
</A> |
||||
|
<br> |
||||
|
<A href="index.html#toc">Contents</A>; <A href="ch-search.html">next</A>; <A href="ch-query.html">back</A>. |
||||
|
<br> |
||||
|
<address>12 March 1999<br> |
||||
|
Jonathan D. Rosenbaum<A href="mailto:mttrader@access.mountain.net">mttrader@access.mountain.net</A></address> |
||||
|
</body></html> |
@ -0,0 +1,162 @@ |
|||||
|
<html><head> |
||||
|
<title>swim</title> |
||||
|
<link rev=made href="mailto:mttrader@access.mountain.net"> |
||||
|
</head><body> |
||||
|
<h1>swim</h1> |
||||
|
|
||||
|
<h2><A name="toc"> |
||||
|
0.1 Table of contents |
||||
|
</A></h2> |
||||
|
<ul> |
||||
|
<li><A href="ch-description.html">1 DESCRIPTION |
||||
|
</A> |
||||
|
<li><A href="ch-commandline.html">2 COMMAND LINE OPTION SYNTAX |
||||
|
</A> |
||||
|
<li><A href="ch-version.html">3 VERSION |
||||
|
</A> |
||||
|
<li><A href="ch-history.html">4 HISTORY |
||||
|
</A> |
||||
|
<li><A href="ch-makinginst.html">5 MAKING INSTALLED SYSTEM DATABASES |
||||
|
</A> |
||||
|
<ul> |
||||
|
<li><A href="ch-makinginst.html#s-initdb">5.1</A> Initial database making, and Rebuilding for an |
||||
|
Installed system. |
||||
|
|
||||
|
<li><A href="ch-makinginst.html#s5.2">5.2</A> UPDATING |
||||
|
|
||||
|
<li><A href="ch-makinginst.html#s-searchy">5.3</A> REBUILDING THE SEARCH |
||||
|
|
||||
|
|
||||
|
<li><A href="ch-makinginst.html#s5.4">5.4</A> FILES |
||||
|
|
||||
|
</ul> |
||||
|
<li><A href="ch-important.html">6 IMPORTANT DEBIAN DATABASES FOR NOT-INSTALLED |
||||
|
DATABASES |
||||
|
</A> |
||||
|
<ul> |
||||
|
<li><A href="ch-important.html#s-downimportant">6.1</A> A. downloading the important databases with --ftp. |
||||
|
|
||||
|
<li><A href="ch-important.html#s6.2">6.2</A> OVERVIEW |
||||
|
|
||||
|
<li><A href="ch-important.html#s-dd">6.3</A> DISTRIBUTION DEFINED |
||||
|
|
||||
|
<li><A href="ch-important.html#s6.4">6.4</A> SECTIONS |
||||
|
|
||||
|
<li><A href="ch-important.html#s6.5">6.5</A> ARCHITECTURES |
||||
|
|
||||
|
<li><A href="ch-important.html#s6.6">6.6</A> SWIMZ.LIST |
||||
|
|
||||
|
<li><A href="ch-important.html#s6.7">6.7</A> SWIMZ.LIST EXAMPLES |
||||
|
|
||||
|
<li><A href="ch-important.html#s-ftp">6.8</A> FTP OR APT? |
||||
|
|
||||
|
<li><A href="ch-important.html#s6.9">6.9</A> OPTIONS |
||||
|
|
||||
|
<li><A href="ch-important.html#s6.10">6.10</A> B. downloading the important databases with apt, and maintenance |
||||
|
options. |
||||
|
|
||||
|
</ul> |
||||
|
<li><A href="ch-notinstalled.html">7 MAKING NOT-INSTALLED DATABASES |
||||
|
</A> |
||||
|
<ul> |
||||
|
<li><A href="ch-notinstalled.html#s7.1">7.1</A> OVERVIEW |
||||
|
|
||||
|
<li><A href="ch-notinstalled.html#s7.2">7.2</A> OPTIONS |
||||
|
|
||||
|
<li><A href="ch-notinstalled.html#s7.3">7.3</A> UPDATING |
||||
|
|
||||
|
<li><A href="ch-notinstalled.html#s7.4">7.4</A> REBUILDING THE SEARCH |
||||
|
|
||||
|
<li><A href="ch-notinstalled.html#s7.5">7.5</A> FILES |
||||
|
|
||||
|
</ul> |
||||
|
<li><A href="ch-aptprep.html">8 PREPARING YOUR INSTALLATION FOR APT |
||||
|
</A> |
||||
|
<li><A href="ch-query.html">9 QUERYING THE INSTALLED AND NOT-INSTALLED DATABASES |
||||
|
</A> |
||||
|
<ul> |
||||
|
<li><A href="ch-query.html#s-mm">9.1</A> MINOR MODES |
||||
|
|
||||
|
<li><A href="ch-query.html#s-specdata">9.2</A> SPECIFYING THE DATABASES TO USE |
||||
|
|
||||
|
<li><A href="ch-query.html#s9.3">9.3</A> OPTIONS |
||||
|
|
||||
|
<li><A href="ch-query.html#s9.4">9.4</A> PACKAGE RELATIONSHIPS |
||||
|
|
||||
|
<li><A href="ch-query.html#s-format">9.5</A> FORMAT |
||||
|
|
||||
|
<li><A href="ch-query.html#s-vrftp">9.6</A> FTP - VIRTUAL OPTIONS |
||||
|
|
||||
|
<li><A href="ch-query.html#s-vrapt">9.7</A> APT - VIRTUAL OPTIONS |
||||
|
|
||||
|
<li><A href="ch-query.html#s-vrrm">9.8</A> REMOVING AN INSTALLED PACKAGE - VIRTUAL OPTIONS |
||||
|
|
||||
|
<li><A href="ch-query.html#s9.9">9.9</A> STDIN - VIRTUAL OPTIONS |
||||
|
|
||||
|
<li><A href="ch-query.html#s9.10">9.10</A> PACKAGE MANIPULATION - VIRTUAL OPTIONS |
||||
|
|
||||
|
<li><A href="ch-query.html#s-dblocus">9.11</A> DATABASE LOCATIONS |
||||
|
|
||||
|
</ul> |
||||
|
<li><A href="ch10.html">10 UPGRADING WITH APT |
||||
|
</A> |
||||
|
<li><A href="ch-search.html">11 SEARCHING |
||||
|
</A> |
||||
|
<ul> |
||||
|
<li><A href="ch-search.html#s11.1">11.1</A> OVERVIEW |
||||
|
|
||||
|
<li><A href="ch-search.html#s11.2">11.2</A> NARROWING A PREVIOUS SEARCH |
||||
|
|
||||
|
<li><A href="ch-search.html#s11.3">11.3</A> MINOR MODES |
||||
|
|
||||
|
<li><A href="ch-search.html#s11.4">11.4</A> OTHER OPTIONS |
||||
|
|
||||
|
<li><A href="ch-search.html#s11.5">11.5</A> EXAMPLES |
||||
|
|
||||
|
</ul> |
||||
|
<li><A href="ch-ramdisk.html">12 RAMDISK |
||||
|
</A> |
||||
|
<ul> |
||||
|
<li><A href="ch-ramdisk.html#s12.1">12.1</A> OVERVIEW |
||||
|
|
||||
|
</ul> |
||||
|
<li><A href="ch13.html">13 FILES |
||||
|
</A> |
||||
|
<li><A href="ch-seealso.html">14 SEE ALSO |
||||
|
</A> |
||||
|
<li><A href="ch15.html">15 BUGS</A> |
||||
|
</ul> |
||||
|
<hr><h2><A name="copyright">0.2 Copyright</A></h2> |
||||
|
|
||||
|
Copyright © 1999 Jonathan D. Rosenbaum |
||||
|
<P> |
||||
|
|
||||
|
SWIM, including this manual, is free software; you |
||||
|
may 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, or (at your option) any later |
||||
|
version. |
||||
|
<P> |
||||
|
|
||||
|
This is distributed in the hope that it will be useful, but |
||||
|
<em>without any warranty</em>; without even the implied |
||||
|
warranty of merchantability or fitness for a particular |
||||
|
purpose. See the GNU General Public License for more |
||||
|
details. |
||||
|
<P> |
||||
|
|
||||
|
You should have received a copy of the GNU General Public |
||||
|
License with the <kbd>swim</kbd> source as the file |
||||
|
<code>COPYING</code>. If not, write to the Free Software |
||||
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
||||
|
<hr> |
||||
|
swim |
||||
|
- <A href="#copyright"> |
||||
|
Copyright © 1999 Jonathan D. Rosenbaum |
||||
|
</A> |
||||
|
<br> |
||||
|
<A href="#toc">Contents</A>. |
||||
|
<br> |
||||
|
<address>15 June 1999<br> |
||||
|
Jonathan D. Rosenbaum<A href="mailto:mttrader@access.mountain.net">mttrader@access.mountain.net</A></address> |
||||
|
</body></html> |
File diff suppressed because it is too large
File diff suppressed because it is too large
File diff suppressed because it is too large
@ -0,0 +1,755 @@ |
|||||
|
<html> |
||||
|
<head><title>swim by example</title></head> |
||||
|
<body text="#000000" bgcolor="#FFFFe0" link="#0000EF" vlink="#51188E" |
||||
|
alink="#FF0000"> |
||||
|
</p> |
||||
|
|
||||
|
<br> |
||||
|
<h2 align=center>The Swift, Wise, and Intuitive package Manager.</h2> |
||||
|
<br> |
||||
|
<p> |
||||
|
We run a search for case-insensitive matches for the word "quake." |
||||
|
Because we don't know how many matches the search will find, the |
||||
|
descriptions of all packages found are supressed with "--no." Note: "-n" |
||||
|
pertains to the not-installed (uninstalled) distribution. |
||||
|
|
||||
|
<pre> |
||||
|
linuxalive:/home/swim/SWIMANIA$ swim -n --search quake/i --no |
||||
|
swim: found 17 package(s) |
||||
|
</pre> |
||||
|
|
||||
|
<p>swim keeps a history for all searches. |
||||
|
|
||||
|
<pre> |
||||
|
linuxalive:/home/swim/SWIMANIA$ swim -hn |
||||
|
5 dpsclient-demos dgs dgs-dev freefont gs-aladdin gs-aladdin-manual |
||||
|
gs-aladdin-manual-de gsfonts-other xpacman abc2ps efax ghostview gnome-gv |
||||
|
gs gsfonts gsfonts-x11 gv hatman libroxen-tex pacman ppd-gs pstotext |
||||
|
python-imaging svgalib1-altdev svgalibg1-dev tex4ht type1inst yorick |
||||
|
4 lsof-2.2 |
||||
|
3 libwine-dev |
||||
|
2 libwine libwine-dev libwings-dev |
||||
|
1 gtkpak pak qstat quake-lib quake2 quake2-bin quake2-ctf quake2-dm |
||||
|
xqf quake-3dfx quake-ggi quake-gl quake-lib-stub quake-sdl quake-server |
||||
|
quake-svga quake-x11 |
||||
|
</pre> |
||||
|
|
||||
|
<p> |
||||
|
We can access any part of the history which we want. The first command looks at the |
||||
|
information pertaining to the package. The second command shows a listing of the packages |
||||
|
found for "quake." Note: When no numbers are specified for "-S", the number 1 is assumed. |
||||
|
|
||||
|
<pre> |
||||
|
linuxalive:/home/swim/SWIMANIA$ swim -qnSi 3 |
||||
|
Package: libwine-dev Status: install ok installed |
||||
|
Version: 0.0.20000109-1 Essential: no |
||||
|
Section: otherosfs Priority: optional |
||||
|
Installed-Size: 3680 Source: wine |
||||
|
Size: 729818 Architecture: i386 |
||||
|
Distribution: unstable |
||||
|
Maintainer: Andrew D. Lenharth <andrewl@debian.org> |
||||
|
Description: Windows Emulator (Development files) |
||||
|
This is an ALPHA release of Wine, the MS-Windows emulator. This is |
||||
|
still a developers release and many applications may still not work. |
||||
|
. |
||||
|
This package consists of the C header files. |
||||
|
. |
||||
|
Wine is often updated. |
||||
|
|
||||
|
linuxalive:/home/swim/SWIMANIA$ swim -qnS |
||||
|
gtkpak_0.2-1 |
||||
|
pak_0.2-1 |
||||
|
qstat_2.3e-1 |
||||
|
quake-lib_1.06-9 |
||||
|
quake2_3.20-5 |
||||
|
quake2-bin_3.20-1 |
||||
|
quake2-ctf_1.50-1 |
||||
|
quake2-dm_3.13-1 |
||||
|
xqf_0.8.99-1 |
||||
|
quake-3dfx_0.0.9-1 |
||||
|
quake-ggi_0.0.9-1 |
||||
|
quake-gl_0.0.9-1 |
||||
|
quake-lib-stub_1.9-1 |
||||
|
quake-sdl_0.0.9-1 |
||||
|
quake-server_0.0.9-1 |
||||
|
quake-svga_0.0.9-1 |
||||
|
quake-x11_0.0.9-1 |
||||
|
</pre> |
||||
|
|
||||
|
<p> |
||||
|
After looking at the descriptions for the packages found through the "quake" search we decide |
||||
|
to narrow down the search to "tools." Notes: We could have done this for any part of the |
||||
|
history by specifying a number. "--research" will not write the changes to the history, |
||||
|
"--refinesearch" will write the changes to the history. The qstat package is installed, but |
||||
|
there is a newer version. |
||||
|
|
||||
|
<pre> |
||||
|
linuxalive:/home/swim/SWIMANIA$ swim -n --research tool |
||||
|
Package: gtkpak Status: not-installed |
||||
|
Version: 0.2-1 Essential: no |
||||
|
Section: games Priority: optional |
||||
|
Installed-Size: 105 Source: pak |
||||
|
Size: 32182 Architecture: i386 |
||||
|
Distribution: unstable |
||||
|
Maintainer: Joseph Carter <knghtbrd@debian.org> |
||||
|
Description: GTK program for manipulating pak archives |
||||
|
gtkpak is a nifty GTK tool for manipulating the pak archives used by Quake, |
||||
|
Quake 2, and QuakeWorld. It can view, extract, create, and append pak |
||||
|
archives. pak contains basic command-line utilities that can do much of |
||||
|
what gtkpak does without X or GTK, but gtkpak is easier to work with by |
||||
|
far. Installing both won't hurt anything. |
||||
|
|
||||
|
Package: pak Status: not-installed |
||||
|
Version: 0.2-1 Essential: no |
||||
|
Section: games Priority: optional |
||||
|
Installed-Size: 110 |
||||
|
Size: 37412 Architecture: i386 |
||||
|
Distribution: unstable |
||||
|
Maintainer: Joseph Carter <knghtbrd@debian.org> |
||||
|
Description: command-line tools for pak archives |
||||
|
This package contains pakx and pakc, a couple of tools for working with the |
||||
|
pak archives used by Quake, Quake 2, and QuakeWorld. pakc can create and |
||||
|
add files to archives, pakx can list and extract files from them. gtkpak |
||||
|
is a bit fancier but then again it requires X and GTK. |
||||
|
|
||||
|
Package: qstat Status: > hold ok installed (2.0b-1) |
||||
|
Version: 2.3e-1 Essential: no |
||||
|
Section: games Priority: optional |
||||
|
Installed-Size: 236 |
||||
|
Size: 68652 Architecture: i386 |
||||
|
Distribution: unstable |
||||
|
Maintainer: Michael Alan Dorman <mdorman@debian.org> |
||||
|
Description: Command-line tool for querying quake (and other) servers |
||||
|
Qstat provides a simple interface for querying servers for a number |
||||
|
of games, including but not limited to quake, quakeworld, quake2, |
||||
|
quake3arena, unreal tournament, kingpin and others. |
||||
|
|
||||
|
swim: found 3 package(s) |
||||
|
linuxalive:/home/swim/SWIMANIA$ swim -n --refinesearch tool --no |
||||
|
swim: found 3 package(s) |
||||
|
</pre> |
||||
|
|
||||
|
<p>This is what 1 now looks like in the history: |
||||
|
<pre> |
||||
|
1 gtkpak pak qstat |
||||
|
</pre> |
||||
|
|
||||
|
<p>If apt is installed it is possible to find out how other packages will |
||||
|
be installed. |
||||
|
|
||||
|
<pre> |
||||
|
linuxalive:/home/swim/SWIMANIA$ swim -qxnS |
||||
|
gtkpak_0.2-1 |
||||
|
pak_0.2-1 |
||||
|
qstat_2.3e-1 |
||||
|
Reading Package Lists... |
||||
|
Building Dependency Tree... |
||||
|
The following packages will be REMOVED: |
||||
|
xqf |
||||
|
The following NEW packages will be installed: |
||||
|
gtkpak pak |
||||
|
The following held packages will be changed: |
||||
|
qstat xqf |
||||
|
1 packages upgraded, 2 newly installed, 1 to remove and 1065 not upgraded. |
||||
|
Inst gtkpak |
||||
|
Remv xqf |
||||
|
Inst qstat |
||||
|
Inst pak |
||||
|
Conf gtkpak |
||||
|
Conf qstat |
||||
|
Conf pak |
||||
|
</pre> |
||||
|
|
||||
|
<p> |
||||
|
Oh no, xqf is going to be removed! Let's make sure that this isn't a |
||||
|
package we want removed, but since we noticed a newer version of this |
||||
|
package is included in the unstable distribution, let's find out what's |
||||
|
going on here! |
||||
|
|
||||
|
<pre> |
||||
|
linuxalive:/home/swim/SWIMANIA$ swim -qnxi xqf |
||||
|
Package: xqf Status: > hold ok installed (0.5-1) |
||||
|
Version: 0.8.99-1 Essential: no |
||||
|
Section: games Priority: optional |
||||
|
Installed-Size: 182 |
||||
|
Size: 80426 Architecture: i386 |
||||
|
Distribution: unstable |
||||
|
Maintainer: Michael Alan Dorman <mdorman@debian.org> |
||||
|
Description: X-based Quake Server Browser |
||||
|
XQF allows one to browse and choose quake servers to play on. |
||||
|
Reading Package Lists... |
||||
|
Building Dependency Tree... |
||||
|
Some packages could not be installed. This may mean that you have |
||||
|
requested an impossible situation or if you are using the unstable |
||||
|
distribution that some required packages have not yet been created |
||||
|
or been moved out of Incoming. |
||||
|
|
||||
|
Since you only requested a single operation it is extremely likely that |
||||
|
the package is simply not installable and a bug report against |
||||
|
that package should be filed. |
||||
|
The following information may help to resolve the situation: |
||||
|
|
||||
|
Sorry, but the following packages have unmet dependencies: |
||||
|
xqf: Conflicts: qstat (< 2.1z-2.1a-0.1) but 2.0b-1 is to be installed |
||||
|
E: Sorry, broken packages |
||||
|
linuxalive:/home/swim/SWIMANIA$ swim -qnT qstat |
||||
|
qstat_2.3e-1 |
||||
|
Depends: libc6 (>= 2.1.2) |
||||
|
Conflicts: xqf (<< 0.9.2-1) |
||||
|
</pre> |
||||
|
|
||||
|
<p> As seen above, the reason why xqf has to be removed is due to a |
||||
|
dependency in qstat which the packager (Michael Alan Dorman |
||||
|
<mdorman@debian.org>) will have to resolve by uploading a newer version of |
||||
|
xqf to the distribution. Sometimes necessary packages are still in |
||||
|
Debian's Incoming directory at the ftp site, and not in the distribution, |
||||
|
so we may want to check there first. If this isn't the case we will send |
||||
|
a bug report to Debian's Bug Tracking System pointing out that there needs |
||||
|
to be a newer version of xqf. In the meantime we have decided that we |
||||
|
only want gtkpak and pak. We will use swim's editing capabilities to take |
||||
|
gstat off the list. Notes: Another possibility for the bug shown above |
||||
|
is that apt's cache needs to be updated to reflect the changes in Debain's |
||||
|
distribution by using "swim --apt --update." When the history is edited |
||||
|
with "--stdin" the history makes a new entry reflecting the change. The |
||||
|
full history is accessible from "--stdin." Anybody can send a bug to |
||||
|
Debian's Bug Tracking System. |
||||
|
|
||||
|
<pre> |
||||
|
linuxalive:/home/swim/SWIMANIA$ swim -qxznS --stdin |
||||
|
swim: type exit to finish --stdin |
||||
|
swim: gtkpak pak |
||||
|
swim: exit |
||||
|
Reading Package Lists... Done |
||||
|
Building Dependency Tree... Done |
||||
|
The following NEW packages will be installed: |
||||
|
gtkpak pak |
||||
|
0 packages upgraded, 2 newly installed, 0 to remove and 1067 not upgraded. |
||||
|
Need to get 69.6kB of archives. After unpacking 220kB will be used. |
||||
|
Get:1 ftp://ftp.debian.org unstable/main gtkpak 0.2-1 [32.2kB] |
||||
|
Get:2 ftp://ftp.debian.org unstable/main pak 0.2-1 [37.4kB] |
||||
|
Fetched 69.6kB in 1m15s (922B/s) |
||||
|
Selecting previously deselected package gtkpak. |
||||
|
(Reading database ... 106015 files and directories currently installed.) |
||||
|
Unpacking gtkpak (from .../archives/gtkpak_0.2-1_i386.deb) ... |
||||
|
Selecting previously deselected package pak. |
||||
|
Unpacking pak (from .../archives/pak_0.2-1_i386.deb) ... |
||||
|
Setting up gtkpak (0.2-1) ... |
||||
|
|
||||
|
Setting up pak (0.2-1) ... |
||||
|
gtkpak_0.2-1 |
||||
|
pak_0.2-1 |
||||
|
</pre> |
||||
|
|
||||
|
<p> |
||||
|
If we don't have apt we can still download these packages, and their sources. Here is another |
||||
|
way to do the same thing we did above without using apt. Notes: This time we saved some |
||||
|
typing by doing "--stdin" with "--research." We specified "--source" with "--ftp" to get the |
||||
|
sources as well as the packages, or we could have just gotten the sources by themselves by |
||||
|
specifying "--source_only" with "--ftp." Changes made while in "--stdin" are written to the |
||||
|
history. |
||||
|
|
||||
|
<pre> |
||||
|
linuxalive:/home/swim/SWIMANIA$ swim -n --search quake/i --no |
||||
|
swim: found 17 package(s) |
||||
|
linuxalive:/home/swim/SWIMANIA$ swim -n --research tool --no --stdin --ftp --source |
||||
|
swim: found 3 package(s) |
||||
|
swim: type exit to finish --stdin |
||||
|
swim: gtkpak pak |
||||
|
swim: exit |
||||
|
swim: connected to ftp.debian.org |
||||
|
swim: logged in to ftp.debian.org |
||||
|
swim: downloading gtkpak_0.2-1.deb (32182 bytes) |
||||
|
gtkpak_0.2-1 49823b28c9599dbf94e290e28e695bc2 OK |
||||
|
swim: successful retrieval of gtkpak_0.2-1.deb |
||||
|
swim: downloading pak_0.2-1.diff.gz (2623 bytes) |
||||
|
swim: successful retrieval of pak_0.2-1.diff.gz |
||||
|
swim: downloading pak_0.2-1.dsc (825 bytes) |
||||
|
swim: successful retrieval of pak_0.2-1.dsc |
||||
|
swim: downloading pak_0.2.orig.tar.gz (26972 bytes) |
||||
|
swim: successful retrieval of pak_0.2.orig.tar.gz |
||||
|
swim: downloading pak_0.2-1.deb (37412 bytes) |
||||
|
pak_0.2-1 55842f97f80c5c37415a93a7f0709171 OK |
||||
|
swim: successful retrieval of pak_0.2-1.deb |
||||
|
swim: pak_0.2-1.diff.gz already exists |
||||
|
swim: pak_0.2-1.dsc already exists |
||||
|
swim: pak_0.2.orig.tar.gz already exists |
||||
|
swim: logged out |
||||
|
</pre> |
||||
|
|
||||
|
<p> |
||||
|
We notice that the sources only had to be downloaded once. Looking at the packages' |
||||
|
information we notice both packages share the same sources as indicated in the "Source" field. |
||||
|
The field is absent for the pak package because the source name is exactly the same as the |
||||
|
package's name, but for the gtkpak package this isn't the case, so the "Source" field is |
||||
|
present. |
||||
|
|
||||
|
<p> |
||||
|
We can find the packages and the sources in their proper location on our local archive mirror. |
||||
|
|
||||
|
<pre> |
||||
|
linuxalive:/home/swim/SWIMANIA$ ls ~/.swim/pub/debian/dists/unstable/main/source/games |
||||
|
pak_0.2-1.diff.gz pak_0.2-1.dsc pak_0.2.orig.tar.gz |
||||
|
linuxalive:/home/swim/SWIMANIA$ ls ~/.swim/pub/debian/dists/unstable/main/binary-i386/games/ |
||||
|
gtkpak_0.2-1.deb pak_0.2-1.deb |
||||
|
</pre> |
||||
|
|
||||
|
<p> |
||||
|
We can go examine the packages. It is useful to check out the changelog and the copyright. |
||||
|
This is the initial release for this program. Note: "-v" will show the files in long format |
||||
|
(ls -l), "--df" show the directories as well as the files. |
||||
|
|
||||
|
<pre> |
||||
|
linuxalive:/home/swim/SWIMANIA$ cd ~/.swim/pub/debian/dists/unstable/main/binary-i386/games/ |
||||
|
linuxalive:~/.swim/pub/debian/dists/unstable/main/binary-i386/games$ swim -qpl --copyright --changelog gtkpak_0.2-1.deb |
||||
|
#####copyright for gtkpak_0.2-1.deb##### |
||||
|
|
||||
|
taken from the README: |
||||
|
|
||||
|
(c) Michael Vance, 1999 |
||||
|
briareos@lokigames.com |
||||
|
mkv102@psu.edu |
||||
|
|
||||
|
0. Intro |
||||
|
|
||||
|
gtkpak is a PAK file viewer for Gtk+. What are PAK files? A PAK file is used |
||||
|
in id software games such as Quake and Quake 2, and their spin-offs. Just |
||||
|
imagine collapsing an entire directory scheme into a big wad of files, and |
||||
|
there you have a PAK file. |
||||
|
|
||||
|
The three binaries are built around the interface provided in pakfile.h, |
||||
|
which is a C++ class that allows access to the contents of a PAKFile, including |
||||
|
searching and extracting from an already existing PAK file, to add files and |
||||
|
then writing a new PAK file. The three binaries are then just front-ends |
||||
|
to this functionality, in one way or another. |
||||
|
|
||||
|
While it's tempting to make the classes provided in pakfile.h into a shared |
||||
|
library, it's probably unnecessary. But it does make one tingly, eh? |
||||
|
|
||||
|
And all this is GPL'ed, of course. See the file COPYING for license details. |
||||
|
|
||||
|
|
||||
|
#####changelog.Debian.gz for gtkpak_0.2-1.deb##### |
||||
|
|
||||
|
pak (0.2-1) unstable; urgency=low |
||||
|
|
||||
|
* Initial Release. |
||||
|
|
||||
|
-- Joseph Carter <knghtbrd@debian.org> Thu, 8 Jul 1999 17:35:38 -0700 |
||||
|
|
||||
|
Local variables: |
||||
|
mode: debian-changelog |
||||
|
End: |
||||
|
|
||||
|
usr/bin/gtkpak |
||||
|
usr/share/man/man6/gtkpak.6.gz |
||||
|
usr/doc/gtkpak/README |
||||
|
usr/doc/gtkpak/copyright |
||||
|
usr/doc/gtkpak/examples/pak0.pak |
||||
|
usr/doc/gtkpak/changelog.Debian.gz |
||||
|
usr/lib/menu/gtkpak |
||||
|
</pre> |
||||
|
|
||||
|
<p>Let's see if there is a menu entry, and check the MD5 checksum. |
||||
|
|
||||
|
<pre> |
||||
|
linuxalive:~/.swim/pub/debian/dists/unstable/main/binary-i386/games$ swim -qpm gtkpak_0.2-1.deb --md5sum |
||||
|
#####menu for gtkpak_0.2-1.deb(gtkpak)##### |
||||
|
?package(gtkpak):needs=X11 section=Games/Adventure\ |
||||
|
title="GtkPak" hints=Quake command="/usr/bin/gtkpak" |
||||
|
|
||||
|
gtkpak_0.2-1 49823b28c9599dbf94e290e28e695bc2 OK |
||||
|
</pre> |
||||
|
|
||||
|
<p>It would be interesting to look at the man page for gtkpak. |
||||
|
|
||||
|
<pre> |
||||
|
linuxalive:~/.swim/pub/debian/dists/unstable/main/binary-i386/games$ swim -qpd gtkpak_0.2-1.deb |
||||
|
gtkpak_0.2-1 |
||||
|
|
||||
|
usr/share/man/man6/gtkpak.6.gz |
||||
|
usr/doc/gtkpak/README |
||||
|
usr/doc/gtkpak/copyright |
||||
|
usr/doc/gtkpak/examples/pak0.pak |
||||
|
usr/doc/gtkpak/changelog.Debian.gz |
||||
|
|
||||
|
linuxalive:~/.swim/pub/debian/dists/unstable/main/binary-i386/games$ swim -qp gtkpak_0.2-1.deb --extract PWD\!usr/share/man/man6/gtkpak.6.gz |
||||
|
gtkpak_0.2-1 |
||||
|
|
||||
|
|
||||
|
swim: gtkpak.6.gz has been extracted |
||||
|
linuxalive:~/.swim/pub/debian/dists/unstable/main/binary-i386/games$ ls |
||||
|
gtkpak.6.gz gtkpak_0.2-1.deb pak_0.2-1.deb |
||||
|
linuxalive:~/.swim/pub/debian/dists/unstable/main/binary-i386/games$ zcat gtkpak.6.gz | nroff -man | less |
||||
|
"man page for gtkpak will be visible" |
||||
|
</pre> |
||||
|
|
||||
|
<p> |
||||
|
We could also extract the whole archive onto our system. Note: First, we checked to make |
||||
|
sure we wouldn't copy over any files from other installed packages. |
||||
|
|
||||
|
<pre> |
||||
|
linuxalive:~/.swim/pub/debian/dists/unstable/main/binary-i386/games/test$ cd / |
||||
|
linuxalive:/$ swim -qp ~/.swim/pub/debian/dists/unstable/main/binary-i386/games/gtkpak_0.2-1.deb --extract ALL |
||||
|
gtkpak_0.2-1 |
||||
|
|
||||
|
|
||||
|
swim: gtkpak_0.2-1.deb has been extracted |
||||
|
</pre> |
||||
|
|
||||
|
<p> |
||||
|
If we have installed the packages with apt, we can check to see what kind of changes have been |
||||
|
made to our system. |
||||
|
|
||||
|
<pre> |
||||
|
linuxalive:/home/swim/SWIMANIA$ swim --db --check |
||||
|
checking for new, changed, and removed packages |
||||
|
NEW gtkpak |
||||
|
NEW pak |
||||
|
|
||||
|
TOTAL |
||||
|
----- |
||||
|
NEW 2 |
||||
|
GONE 0 |
||||
|
CHANGED 0 |
||||
|
CHANGED STATUS 0 |
||||
|
</pre> |
||||
|
|
||||
|
<p>At this point the database for our installation hasn't been updated. |
||||
|
|
||||
|
<pre> |
||||
|
linuxalive:/home/swim/SWIMANIA$ swim -q pak |
||||
|
package pak is not installed |
||||
|
linuxalive:/home/swim/SWIMANIA$ |
||||
|
|
||||
|
To update the database we will issue "--db" without "--check." |
||||
|
|
||||
|
linuxalive:/home/swim/SWIMANIA$ swim --db |
||||
|
checking for new, changed, and removed packages |
||||
|
NEW gtkpak |
||||
|
NEW pak |
||||
|
|
||||
|
TOTAL |
||||
|
----- |
||||
|
NEW 2 |
||||
|
GONE 0 |
||||
|
CHANGED 0 |
||||
|
CHANGED STATUS 0 |
||||
|
|
||||
|
|
||||
|
N|C|CS 2 |
||||
|
#2 N|C pak.list |
||||
|
linuxalive:/home/swim/SWIMANIA$ swim -q pak |
||||
|
pak_0.2-1 |
||||
|
</pre> |
||||
|
|
||||
|
<p> |
||||
|
We can check to see if the uninstalled distribution had any changes. Notes: The results below |
||||
|
indicate the changes found in the new Package databases that have been downloaded by updating |
||||
|
apt; if we don't have apt then swim's major mode "--ftp" can be used with "DF." With "--ndb" |
||||
|
use APT to indicate apt sources, or DF to indicate Package databases gotten directly through |
||||
|
swim's "--ftp". If we originally made the uninstalled distribution with an uninstalled |
||||
|
filesystem by using "--Contents DF" then to update the uninstalled distribution "--Contents |
||||
|
DF" should be used again; this isn't necessary when running a check. To rebuild |
||||
|
(--rebuildndb), update (--ndb), or check a distribution other than the default one, use |
||||
|
"--dists stable", "--dists frozen" or "--dists unstable." The newest Packages can |
||||
|
automatically be picked by using "--cron." |
||||
|
|
||||
|
<p> |
||||
|
A little blurb: Although not Debian approved or sanctioned, we find the unstable distribution |
||||
|
acceptably stable in relation to certain well-known commercial distributions despite |
||||
|
infrequent packaging bugs like the one shown in the xqf example above. The Debian |
||||
|
distribution adheres to a self-imposed level of quality found in no other distribution in the |
||||
|
world. Usually, unstable undergoes many changes so there isn't a time advantage over updating |
||||
|
DF versus rebuilding DF, but this process is easier on system resources. On the other hand, |
||||
|
updating FDBDF (no uninstalled filesystem) is faster. |
||||
|
|
||||
|
|
||||
|
<pre> |
||||
|
linuxalive:/home/swim/SWIMANIA$ swim --apt --update; swim --ftp --Contents DF --onec; |
||||
|
"output not shown" |
||||
|
linuxalive:/home/swim/SWIMANIA$ swim --ndb --check APT 2> changes-today |
||||
|
### Site Date Size (bytes) Release |
||||
|
|
||||
|
CONTRIB |
||||
|
1 ftp.debian.org Mon Jan 17 17:57:57 2000 112774 2.2 |
||||
|
|
||||
|
NON-FREE |
||||
|
1 ftp.debian.org Sun Jan 16 17:26:23 2000 279821 2.2 |
||||
|
|
||||
|
MAIN |
||||
|
1 ftp.debian.org Mon Jan 17 17:57:12 2000 3048732 2.2 |
||||
|
|
||||
|
swim: for CONTRIB, which ### do you want?: 1 |
||||
|
swim: for NON-FREE, which ### do you want?: 1 |
||||
|
swim: for MAIN, which ### do you want?: 1 |
||||
|
checking for new, changed, and removed packages |
||||
|
|
||||
|
TOTAL |
||||
|
----- |
||||
|
NEW 12 |
||||
|
GONE 16 |
||||
|
CHANGED 54 |
||||
|
CHANGED REVISION 162 |
||||
|
</pre> |
||||
|
|
||||
|
<p> |
||||
|
We can view all the changes because we stored them in a file. We can use swim to look at all |
||||
|
the changed packages except for the new ones which will be visible once we rebuild or update. |
||||
|
By looking at this file we are provided a view of the inner workings of Debian development. |
||||
|
|
||||
|
<pre> |
||||
|
linuxalive:/home/swim/SWIMANIA$ cat changed-today | less |
||||
|
CHANGED-REVISION gnujsp |
||||
|
CHANGED iraf |
||||
|
CHANGED iraf-common |
||||
|
CHANGED iraf-ibin |
||||
|
CHANGED iraf-noaobin |
||||
|
CHANGED-REVISION jserv |
||||
|
CHANGED-REVISION mailcrypt |
||||
|
CHANGED plugger |
||||
|
CHANGED-REVISION sarien |
||||
|
NEW webrt |
||||
|
"part of output not shown" |
||||
|
GONE tinytable-zope |
||||
|
GONE tip |
||||
|
</pre> |
||||
|
|
||||
|
<p> We decide to update with "--ndb" rather than to rebuild with |
||||
|
"--rebuildndb." |
||||
|
|
||||
|
<pre> |
||||
|
linuxalive:/home/swim/SWIMANIA$ swim --ndb APT --Contents DF --cron 2> changed-today |
||||
|
checking for new, changed, and removed packages |
||||
|
|
||||
|
TOTAL |
||||
|
----- |
||||
|
NEW 12 |
||||
|
GONE 16 |
||||
|
CHANGED 54 |
||||
|
CHANGED REVISION 162 |
||||
|
G|C|CR 232 |
||||
|
#232 VIRTUAL G|C|CR zicq.list |
||||
|
Copying new Contents |
||||
|
Compressing Contents |
||||
|
N|C|CR 228 |
||||
|
#228 VIRTUAL N|C|CR zicq.list |
||||
|
#22 NO-C zope-siteaccess.list |
||||
|
Appending search databases |
||||
|
Updating status |
||||
|
|
||||
|
Sun Jan 23 14:59:04 2000 to Sun Jan 23 16:39:23 2000 |
||||
|
</pre> |
||||
|
|
||||
|
<p> |
||||
|
We were wondering whether it was time to update gv, but we found out that there was only a |
||||
|
debian-revision change "r>" which means that the source code hasn't changed. There is no need |
||||
|
to update right now. |
||||
|
|
||||
|
<pre> |
||||
|
linuxalive:/usr/lib/perl5/SWIM$ which gv |
||||
|
/usr/X11R6/bin/gv |
||||
|
linuxalive:/usr/lib/perl5/SWIM$ cd /usr/X11R6/bin |
||||
|
linuxalive:/usr/X11R6/bin$ swim -qf gv |
||||
|
gv_1:3.5.8-7 |
||||
|
linuxalive:/usr/X11R6/bin$ swim -qfni gv |
||||
|
Package: gv Status: r> hold ok installed (1:3.5.8-7) |
||||
|
Version: 1:3.5.8-15 Essential: no |
||||
|
Section: text Priority: optional |
||||
|
Installed-Size: 477 |
||||
|
Size: 224778 Architecture: i386 |
||||
|
Distribution: unstable |
||||
|
Maintainer: Marco Pistore <pistore@debian.org> |
||||
|
Description: A PostScript and PDF viewer for X using 3d Athena Widgets |
||||
|
`gv' is a comfortable viewer of PostScript and PDF files for the X |
||||
|
Window System. |
||||
|
. |
||||
|
It uses the `ghostscript' PostScript(tm) interpreter and is based |
||||
|
on the classic X front-end for `gs', `ghostview'. It is more |
||||
|
comfortable and more powerful than `ghostview'. |
||||
|
. |
||||
|
Some features as e.g. PDF files or anti-aliasing are only supported |
||||
|
if a recent ghostscript (4.0 or later) is installed. With |
||||
|
anti-aliasing turned on, the text is very crisp and readable, with no |
||||
|
`stepping' on the slants at all. |
||||
|
</pre> |
||||
|
|
||||
|
<p> |
||||
|
While we were in this directory we decided to do a little research. It is interesting to note |
||||
|
that for the installed system there are 14 files which don't belong to any packages. There |
||||
|
could be a variety of reasons for this (maybe we are slobs); this is good stuff to know. |
||||
|
Notes: To see the total list just add "-t" to the existing command-line options. There is a |
||||
|
big difference in using "." and "*", "." is the same as saying "./" but it only lists the |
||||
|
same package once, whereas "*" would look at all the files in the immediate directory and if |
||||
|
two files belong to the same package, that package will be shown twice for each file, it also |
||||
|
reports if a file doesn't belong to a package. |
||||
|
|
||||
|
<pre> |
||||
|
linuxalive:/usr/X11R6/bin$ swim -qf . |
||||
|
use --total or -t to see all 202 packages |
||||
|
linuxalive:/usr/X11R6/bin$ swim -qfn . |
||||
|
use --total or -t to see all 420 packages |
||||
|
linuxalive:/usr/X11R6/bin$ swim -qft * | grep "not owned" | wc -l |
||||
|
14 |
||||
|
linuxalive:/usr/X11R6/bin$ swim -qfnt * | grep "not owned" | wc -l |
||||
|
162 |
||||
|
</pre> |
||||
|
|
||||
|
<p> |
||||
|
We notice a file in the lib directory, and we wonder what it belongs to. |
||||
|
|
||||
|
<pre> |
||||
|
linuxalive:/lib$ swim -qf libthread_db-1.0.so --shlibs |
||||
|
libc6_2.1.2-11 |
||||
|
Shlibs: |
||||
|
ld-linux 2 libc6 (>= 2.1.2) |
||||
|
libBrokenLocale 1 libc6 (>= 2.1.2) |
||||
|
.. everything not shown .. |
||||
|
libthread_db 1 libc6 (>= 2.1.2) |
||||
|
libutil 1 libc6 (>= 2.1.2) |
||||
|
</pre> |
||||
|
|
||||
|
<p> |
||||
|
We want to find out what dependencies apt has. |
||||
|
|
||||
|
<pre> |
||||
|
linuxalive:/lib$ swim -qfnT /usr/bin/apt-get |
||||
|
apt_0.3.16 |
||||
|
Depends: libc6, libc6 (>= 2.1), libc6 (>= 2.1.2), libstdc++2.10 |
||||
|
Suggests: dpkg-dev |
||||
|
Provides: libapt-pkg2.6 |
||||
|
Replaces: deity, libapt-pkg-doc (<< 0.3.7), libapt-pkg-dev (<< 0.3.7) |
||||
|
Conflicts: deity |
||||
|
</pre> |
||||
|
|
||||
|
<p> |
||||
|
We need a header file called w32skrnl.h. We are in luck it's already on our system. Notes: |
||||
|
We could have done "locate w32skrnl.h" and then done a "swim -qf", but we haven't updated our |
||||
|
locatedb in months. The package installation will be tested by apt if it exists. |
||||
|
|
||||
|
<pre> |
||||
|
linuxalive:/usr/include/wine$ swim -xn --ps w32skrnl\.h |
||||
|
Package: libwine-dev Status: install ok installed |
||||
|
Version: 0.0.20000109-1 Essential: no |
||||
|
Section: otherosfs Priority: optional |
||||
|
Installed-Size: 3680 Source: wine |
||||
|
Size: 729818 Architecture: i386 |
||||
|
Distribution: unstable |
||||
|
Maintainer: Andrew D. Lenharth <andrewl@debian.org> |
||||
|
Description: Windows Emulator (Development files) |
||||
|
This is an ALPHA release of Wine, the MS-Windows emulator. This is |
||||
|
still a developers release and many applications may still not work. |
||||
|
. |
||||
|
This package consists of the C header files. |
||||
|
. |
||||
|
Wine is often updated. |
||||
|
|
||||
|
swim: found 1 package(s) |
||||
|
Reading Package Lists... |
||||
|
Building Dependency Tree... |
||||
|
Sorry, libwine-dev is already the newest version |
||||
|
0 packages upgraded, 0 newly installed, 0 to remove and 1067 not upgraded. |
||||
|
</pre> |
||||
|
|
||||
|
<p> |
||||
|
Sometimes it is nice to know the total of what we have installed. |
||||
|
|
||||
|
<pre> |
||||
|
linuxalive:/usr/X11R6/bin$ swim -qa |
||||
|
use --total or -t to see all 1449 packages |
||||
|
linuxalive:/usr/X11R6/bin$ swim -qf / |
||||
|
use --total or -t to see all 1449 packages |
||||
|
linuxalive:/home/swim/SWIMANIA$ swim -qan |
||||
|
use --total or -t to see all 4525 packages |
||||
|
</pre> |
||||
|
|
||||
|
<p> |
||||
|
We can check the MD5 checksum for all the configuation files on the system. Notes: MD5 |
||||
|
checksum can be performed on "-l", "-d", "-c", or "-p." This can only be performed on the |
||||
|
installed system. |
||||
|
|
||||
|
<pre> |
||||
|
linuxalive:/home/swim/SWIMANIA$ swim -qact --md5sum |
||||
|
a2ps_4.10.2-4 |
||||
|
/etc/a2ps.cfg eb909349a1bb2d1f4b4adc7ab1f75e56 OK |
||||
|
|
||||
|
acct_6.3.2-4 |
||||
|
/etc/cron.daily/acct d5e16c7f601c3a43d88fc8ede714c6e2 OK |
||||
|
/etc/cron.monthly/acct 9ca2c358e430f94c9ae00a1ce54e6e96 OK |
||||
|
/etc/init.d/acct 2f978d8517077c77e3262d7a6096fe2f OK |
||||
|
|
||||
|
autolog_0.34-5 |
||||
|
/etc/autolog.conf b6ae10782ce13c45cbe72f9308b4caa1 OK |
||||
|
/etc/cron.d/autolog 805d268ea44c645299defc1c14495282 MISSING |
||||
|
|
||||
|
cfengine_1.4.9-2 |
||||
|
/etc/cfengine/cfengine.conf fd79d9462e92f88aa6c563f39e3e10d5 OK |
||||
|
/etc/cron.daily/cfengine ac6a42f3be907b50e52834ae9d41fdbd FAILED |
||||
|
/etc/cron.weekly/cfengine fbdd90ecf2e68a4ced6a6abbffd32f62 OK |
||||
|
"rest of output not shown" |
||||
|
</pre> |
||||
|
|
||||
|
<p>We check to see what groups exist. |
||||
|
|
||||
|
<pre> |
||||
|
linuxalive:/usr/lib/perl5/SWIM$ swim -q --allgroups |
||||
|
"output not shown" |
||||
|
linuxalive:/usr/lib/perl5/SWIM$ swim -qn --allgroups |
||||
|
admin base comm |
||||
|
contrib/admin contrib/devel contrib/doc |
||||
|
contrib/games contrib/graphics contrib/interpreters |
||||
|
contrib/libs contrib/mail contrib/math |
||||
|
contrib/misc contrib/net contrib/news |
||||
|
"rest of output not shown" |
||||
|
</pre> |
||||
|
|
||||
|
<p> |
||||
|
We happen to be hamradio enthusiasts. Let's see what packages exist in the hamradio group. |
||||
|
|
||||
|
<pre> |
||||
|
linuxalive:/usr/lib/perl5/SWIM$ swim -qng hamradio |
||||
|
acfax_981011-3 |
||||
|
ax25-apps_0.0.4-1 |
||||
|
ax25-tools_0.0.5-1 |
||||
|
colrconv_0.99.2-4 |
||||
|
dgipip_0.1-2 |
||||
|
gc_1.07-3 |
||||
|
hamsoft_0.1.1-1 |
||||
|
"rest of the output not shown" |
||||
|
</pre> |
||||
|
|
||||
|
<p> |
||||
|
We edit the hamradio group package list with "--stdin." Notes: "--stdin" needs to be |
||||
|
called with either "--ftp", "-x", "-xyz", "-xz", "--purge", "-r", or "--remove" to work. This |
||||
|
is a readline interface. If we are in emacs mode (see man bash) here are some commands we can |
||||
|
use to make the process easier. |
||||
|
|
||||
|
<p> |
||||
|
Note: The key bindings may be different on your system. |
||||
|
<br>Ctrl-a = move to the beginning of the line |
||||
|
<br>Ctrl-e = move to the end of the line |
||||
|
<br>Ctrl-w = erase (kill) one word backward |
||||
|
<br>Esc-d = kill one word forward |
||||
|
<br>Esc-b = move one word backward |
||||
|
<br>Esc-f = move one word forward |
||||
|
<br>Ctrl-k = kill forward to the end of the line |
||||
|
<br>Ctrl-y = retrieve (yank) last item killed |
||||
|
<br>Ctrl-r = search backward |
||||
|
<br>Esc-< = move to the beginning of the history |
||||
|
<br>Esc-> = move to the end of the history |
||||
|
|
||||
|
<pre> |
||||
|
linuxalive:/usr/lib/perl5/SWIM$ swim -qng hamradio --stdin --ftp |
||||
|
swim: type exit to finish --stdin |
||||
|
swim: acfax ax25-apps ax25-tools colrconv dgipip gc hamsoft icom jiffy jiffy-per |
||||
|
l-tk libax25 libax25-dev logconv morse nec node p10cfgd pileup predict rspfd sccw twclock twcw |
||||
|
twlog unixcw wwl wxd xconvers xnecview z8530-utils z8530-utils2 |
||||
|
</pre> |
||||
|
|
||||
|
<p> |
||||
|
We are finding new ways to swim everyday; we often solve problems in minutes which used |
||||
|
to take an hour or more to solve. If you find a novel use for swim, please tell us, and we |
||||
|
will add it to these examples. |
||||
|
|
||||
|
</body> |
||||
|
</html> |
||||
|
|
@ -0,0 +1,29 @@ |
|||||
|
# Read QUICKSTART in /usr/doc/swim for important information and to |
||||
|
# quickly prepare the swimrc, then read the swimrc(5) manpage for more |
||||
|
# enlightenment and configuration options like "Do you want to use apt?", |
||||
|
# "How about non-us?". |
||||
|
|
||||
|
# Which do you have on your system? Pick dpkg if Debian, ar if non-Debian. |
||||
|
#$package_tool = "/usr/bin/dpkg"; |
||||
|
#$package_tool = "/usr/bin/ar"; |
||||
|
|
||||
|
# Do you have apt installed? |
||||
|
#$apt = "yes"; |
||||
|
|
||||
|
# Pick one. |
||||
|
#$architecture = "alpha"; |
||||
|
#$architecture = "arm"; |
||||
|
#$architecture = "hurd-i386"; |
||||
|
#$architecture = "i386"; |
||||
|
#$architecture = "m68k"; |
||||
|
#$architecture = "powerpc"; |
||||
|
#$architecture = "sparc"; |
||||
|
|
||||
|
# Which distribution? Pick one. |
||||
|
#$distribution = "stable"; |
||||
|
#$distribution = "unstable"; |
||||
|
#$distribution = "frozen"; |
||||
|
|
||||
|
# Remove sections after qw that you do not want. Use non-US for non-us. |
||||
|
#@user_defined_section = qw(main contrib non-free); |
||||
|
|
@ -0,0 +1,402 @@ |
|||||
|
.rn '' }` |
||||
|
''' $RCSfile$$Revision$$Date$ |
||||
|
''' |
||||
|
''' $Log$ |
||||
|
''' |
||||
|
.de Sh |
||||
|
.br |
||||
|
.if t .Sp |
||||
|
.ne 5 |
||||
|
.PP |
||||
|
\fB\\$1\fR |
||||
|
.PP |
||||
|
.. |
||||
|
.de Sp |
||||
|
.if t .sp .5v |
||||
|
.if n .sp |
||||
|
.. |
||||
|
.de Ip |
||||
|
.br |
||||
|
.ie \\n(.$>=3 .ne \\$3 |
||||
|
.el .ne 3 |
||||
|
.IP "\\$1" \\$2 |
||||
|
.. |
||||
|
.de Vb |
||||
|
.ft CW |
||||
|
.nf |
||||
|
.ne \\$1 |
||||
|
.. |
||||
|
.de Ve |
||||
|
.ft R |
||||
|
|
||||
|
.fi |
||||
|
.. |
||||
|
''' |
||||
|
''' |
||||
|
''' Set up \*(-- to give an unbreakable dash; |
||||
|
''' string Tr holds user defined translation string. |
||||
|
''' Bell System Logo is used as a dummy character. |
||||
|
''' |
||||
|
.tr \(*W-|\(bv\*(Tr |
||||
|
.ie n \{\ |
||||
|
.ds -- \(*W- |
||||
|
.ds PI pi |
||||
|
.if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch |
||||
|
.if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch |
||||
|
.ds L" "" |
||||
|
.ds R" "" |
||||
|
''' \*(M", \*(S", \*(N" and \*(T" are the equivalent of |
||||
|
''' \*(L" and \*(R", except that they are used on ".xx" lines, |
||||
|
''' such as .IP and .SH, which do another additional levels of |
||||
|
''' double-quote interpretation |
||||
|
.ds M" """ |
||||
|
.ds S" """ |
||||
|
.ds N" """"" |
||||
|
.ds T" """"" |
||||
|
.ds L' ' |
||||
|
.ds R' ' |
||||
|
.ds M' ' |
||||
|
.ds S' ' |
||||
|
.ds N' ' |
||||
|
.ds T' ' |
||||
|
'br\} |
||||
|
.el\{\ |
||||
|
.ds -- \(em\| |
||||
|
.tr \*(Tr |
||||
|
.ds L" `` |
||||
|
.ds R" '' |
||||
|
.ds M" `` |
||||
|
.ds S" '' |
||||
|
.ds N" `` |
||||
|
.ds T" '' |
||||
|
.ds L' ` |
||||
|
.ds R' ' |
||||
|
.ds M' ` |
||||
|
.ds S' ' |
||||
|
.ds N' ` |
||||
|
.ds T' ' |
||||
|
.ds PI \(*p |
||||
|
'br\} |
||||
|
.\" If the F register is turned on, we'll generate |
||||
|
.\" index entries out stderr for the following things: |
||||
|
.\" TH Title |
||||
|
.\" SH Header |
||||
|
.\" Sh Subsection |
||||
|
.\" Ip Item |
||||
|
.\" X<> Xref (embedded |
||||
|
.\" Of course, you have to process the output yourself |
||||
|
.\" in some meaninful fashion. |
||||
|
.if \nF \{ |
||||
|
.de IX |
||||
|
.tm Index:\\$1\t\\n%\t"\\$2" |
||||
|
.. |
||||
|
.nr % 0 |
||||
|
.rr F |
||||
|
.\} |
||||
|
.TH swimrc 5 " " "27/May/99" " " |
||||
|
.UC |
||||
|
.if n .hy 0 |
||||
|
.if n .na |
||||
|
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' |
||||
|
.de CQ \" put $1 in typewriter font |
||||
|
.ft CW |
||||
|
'if n "\c |
||||
|
'if t \\&\\$1\c |
||||
|
'if n \\&\\$1\c |
||||
|
'if n \&" |
||||
|
\\&\\$2 \\$3 \\$4 \\$5 \\$6 \\$7 |
||||
|
'.ft R |
||||
|
.. |
||||
|
.\" @(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2 |
||||
|
. \" AM - accent mark definitions |
||||
|
.bd B 3 |
||||
|
. \" fudge factors for nroff and troff |
||||
|
.if n \{\ |
||||
|
. ds #H 0 |
||||
|
. ds #V .8m |
||||
|
. ds #F .3m |
||||
|
. ds #[ \f1 |
||||
|
. ds #] \fP |
||||
|
.\} |
||||
|
.if t \{\ |
||||
|
. ds #H ((1u-(\\\\n(.fu%2u))*.13m) |
||||
|
. ds #V .6m |
||||
|
. ds #F 0 |
||||
|
. ds #[ \& |
||||
|
. ds #] \& |
||||
|
.\} |
||||
|
. \" simple accents for nroff and troff |
||||
|
.if n \{\ |
||||
|
. ds ' \& |
||||
|
. ds ` \& |
||||
|
. ds ^ \& |
||||
|
. ds , \& |
||||
|
. ds ~ ~ |
||||
|
. ds ? ? |
||||
|
. ds ! ! |
||||
|
. ds / |
||||
|
. ds q |
||||
|
.\} |
||||
|
.if t \{\ |
||||
|
. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" |
||||
|
. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' |
||||
|
. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' |
||||
|
. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' |
||||
|
. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' |
||||
|
. ds ? \s-2c\h'-\w'c'u*7/10'\u\h'\*(#H'\zi\d\s+2\h'\w'c'u*8/10' |
||||
|
. ds ! \s-2\(or\s+2\h'-\w'\(or'u'\v'-.8m'.\v'.8m' |
||||
|
. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' |
||||
|
. ds q o\h'-\w'o'u*8/10'\s-4\v'.4m'\z\(*i\v'-.4m'\s+4\h'\w'o'u*8/10' |
||||
|
.\} |
||||
|
. \" troff and (daisy-wheel) nroff accents |
||||
|
.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' |
||||
|
.ds 8 \h'\*(#H'\(*b\h'-\*(#H' |
||||
|
.ds v \\k:\h'-(\\n(.wu*9/10-\*(#H)'\v'-\*(#V'\*(#[\s-4v\s0\v'\*(#V'\h'|\\n:u'\*(#] |
||||
|
.ds _ \\k:\h'-(\\n(.wu*9/10-\*(#H+(\*(#F*2/3))'\v'-.4m'\z\(hy\v'.4m'\h'|\\n:u' |
||||
|
.ds . \\k:\h'-(\\n(.wu*8/10)'\v'\*(#V*4/10'\z.\v'-\*(#V*4/10'\h'|\\n:u' |
||||
|
.ds 3 \*(#[\v'.2m'\s-2\&3\s0\v'-.2m'\*(#] |
||||
|
.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] |
||||
|
.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' |
||||
|
.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' |
||||
|
.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] |
||||
|
.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] |
||||
|
.ds ae a\h'-(\w'a'u*4/10)'e |
||||
|
.ds Ae A\h'-(\w'A'u*4/10)'E |
||||
|
.ds oe o\h'-(\w'o'u*4/10)'e |
||||
|
.ds Oe O\h'-(\w'O'u*4/10)'E |
||||
|
. \" corrections for vroff |
||||
|
.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' |
||||
|
.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' |
||||
|
. \" for low resolution devices (crt and lpr) |
||||
|
.if \n(.H>23 .if \n(.V>19 \ |
||||
|
\{\ |
||||
|
. ds : e |
||||
|
. ds 8 ss |
||||
|
. ds v \h'-1'\o'\(aa\(ga' |
||||
|
. ds _ \h'-1'^ |
||||
|
. ds . \h'-1'. |
||||
|
. ds 3 3 |
||||
|
. ds o a |
||||
|
. ds d- d\h'-1'\(ga |
||||
|
. ds D- D\h'-1'\(hy |
||||
|
. ds th \o'bp' |
||||
|
. ds Th \o'LP' |
||||
|
. ds ae ae |
||||
|
. ds Ae AE |
||||
|
. ds oe oe |
||||
|
. ds Oe OE |
||||
|
.\} |
||||
|
.rm #[ #] #H #V #F C |
||||
|
.SH "NAME" |
||||
|
swimrc \- swim configuration file |
||||
|
.SH "DESCRIPTION" |
||||
|
\fBswimrc\fR is the configuartion file for swim allowing many default values |
||||
|
to be set so that they do not have to be mentioned on the command line. |
||||
|
Swimrc interacts directly with Perl allowing a wide variety of variables |
||||
|
found in \fBSWIW::Conf\fR to be altered. |
||||
|
.SH "USAGE" |
||||
|
Values for variable can be altered for \fBswim\fR by assigning different |
||||
|
values enclosed in quotes or quoted whitespace (\fIqw()\fR), and ended with a |
||||
|
semi-colon. |
||||
|
.PP |
||||
|
.Vb 2 |
||||
|
\& $variable = "value"; |
||||
|
\& $variable = "qw(value1 value2 ..)"; |
||||
|
.Ve |
||||
|
.SH "VARIABLES" |
||||
|
This is a list of variables with explanations. The default values for |
||||
|
\fBswim\fR are shown. |
||||
|
.Sh "\s-1OUTPUT\s0 \s-1VARIABLE\s0 " |
||||
|
$my_number can be changed to how many lines you would like \*(L"swim \-qf <>\*(R" |
||||
|
to print out, before the program asks for \f(CW-t\fR or \f(CW--total\fR. Exception: |
||||
|
If \f(CW-i\fR is used in the query and there is more than one package then the |
||||
|
total will be presented. |
||||
|
.PP |
||||
|
Hint: \f(CW-t\fR can be used with all the various \f(CW--scripts\fR family members |
||||
|
to view the title of the script file regardless of this variable setting, |
||||
|
and if \f(CW-t\fR has to be used, the titles will be displayed, which makes |
||||
|
sense. |
||||
|
.PP |
||||
|
\fB$my_number = 23;\fR |
||||
|
.Sh "\s-1HISTORY\s0" |
||||
|
This is a shell-like history kept in relation to searches and the most |
||||
|
recent edit when \f(CW--stdin\fR is used. |
||||
|
.PP |
||||
|
\fB$\s-1HISTORY\s0 = 10;\fR |
||||
|
.Sh "\s-1AR\s0 or \s-1DPKG\s0?" |
||||
|
Debian packages are ar archives. If you are using a Debian Distribution |
||||
|
assign \*(L"dpkg\*(R" to \f(CW$package_tool\fR, otherwise assign \*(L"ar\*(R" to \f(CW$package_tool\fR. |
||||
|
.PP |
||||
|
\fB$package_tool = \*(L"/usr/bin/ar\*(R";\fR |
||||
|
.Sh "\s-1APT\s0" |
||||
|
\fBSwim\fR does not assign a value for apt. To use \f(CW--apt\fR and \f(CW-xyz\fR |
||||
|
assign \f(CW$apt\fR the value \*(L"yes\*(R". |
||||
|
.PP |
||||
|
Example: \fB$apt = \*(L"yes\*(R";\fR |
||||
|
.Sh "\s-1PAGER\s0" |
||||
|
less is a nice pager, unless you like more! Pager is used for \f(CW--help\fR |
||||
|
and \fBswim\fR called without any options. There is an option \f(CW--nopager\fR or |
||||
|
\f(CW-n\fR. more comes from the required package util-linux, whereas less |
||||
|
comes from a standard package called less. Values: \*(L"less\*(R", \*(L"more\*(R", or |
||||
|
\*(L"most\*(R" or... |
||||
|
.PP |
||||
|
\fB$\s-1ENV\s0{\s-1PAGER\s0} = \*(L"less\*(R";\fR |
||||
|
.Sh "\s-1NOT\s0\-\s-1INSTALLED\s0 \s-1VARIABLES\s0 " |
||||
|
Assign values for \f(CW$architecture\fR and/or \f(CW$distribution\fR to avoid having to |
||||
|
use \f(CW--arch\fR and \f(CW--dists\fR everytime the not-installed databases are |
||||
|
accessed with \f(CW-n\fR or made or altered. |
||||
|
.PP |
||||
|
Architectures are always being added so check with Debian to find a list. |
||||
|
There is \fIalpha, arm, hurd-i386 (alternative kernel to linux), i386, |
||||
|
m68k, powerpc, sparc\fR. Just use the arch found after the hyphen in the |
||||
|
Contents-(arch) file. |
||||
|
.PP |
||||
|
\fB$architecture = \*(L"i386\*(R";\fR |
||||
|
.PP |
||||
|
The distribution can be either \fIstable, unstable, frozen, or experimental |
||||
|
(rare)\fR. These represent the state of development that the packages are |
||||
|
under. The unstable distribution can have lot's of changes within a very |
||||
|
short time period, and frozen may or may not be available. |
||||
|
.PP |
||||
|
\fB$distribution = \*(L"unstable\*(R";\fR |
||||
|
.PP |
||||
|
Distributions are divided into sections. These sections were called |
||||
|
distributions in the version 2.4.1.0 packaging manual, because they were |
||||
|
at one time separate distributions, but this has since changed. |
||||
|
.PP |
||||
|
You can determine which of the sections \fImain, non-free, contrib or |
||||
|
non-\s-1US\s0\fR to pull out of the Contents file if you don't want to use |
||||
|
\f(CW--main\fR, \f(CW--contrib\fR, \f(CW--non-free\fR, and \f(CW--non-us\fR to selectively |
||||
|
pick the sections. |
||||
|
.PP |
||||
|
For efficiency, you should choose the sections which you will be pulling |
||||
|
out of the Packages \fIfile\fR\|(s) being targetted. |
||||
|
.PP |
||||
|
Rule: Use \*(L"non-\s-1US\s0\*(R" not \*(L"non-us\*(R". |
||||
|
.PP |
||||
|
\fB@user_defined_section = qw(main contrib non-free non-\s-1US\s0);\fR |
||||
|
.Sh "\s-1DF\s0 \s-1LOCATION\s0" |
||||
|
A little philosophy: \fBswim\fR was developed for maximum versatility, so |
||||
|
whether you are just interested in researching, and keeping tabs on the |
||||
|
newest packages, or maintaining a Debian virtual distribution on a |
||||
|
non-Debian distribution, or you are a using \fBswim\fR for distribution |
||||
|
development, \fBswim\fR provides a way. |
||||
|
.PP |
||||
|
The next two variables determine the location of the \s-1DF\s0 (default |
||||
|
directory/file system) |
||||
|
.PP |
||||
|
The default directory keeps track of Contents and/or Packages databases |
||||
|
retrieved with --ftp. The Contents and Packages databases and Release |
||||
|
file are give names specific to the distribution and architectures they |
||||
|
represent using the naming convention found in apt's sources directory. |
||||
|
You also have the freedom not to use the default directory, in which case |
||||
|
swim will still do the renaming and keeping track of the mtime, but you |
||||
|
will have to remember where you put the files. |
||||
|
.PP |
||||
|
\fB$default_directory = \*(L'/root/.swim\*(R';\fR |
||||
|
.PP |
||||
|
The default root directory (\s-1DRD\s0) is the key to easy management of binary |
||||
|
packages, source, dsc, and diff files received from --ftp, and provides an |
||||
|
easy way to put together a personalized distribution. This directory can |
||||
|
be a real ftp site on your computer, or put wherever else you are |
||||
|
allowed to have directories. The \s-1DRD\s0 is always placed below the value |
||||
|
assigned to \f(CW$default_directory\fR. According to the previous assignment to |
||||
|
\f(CW$default_directory\fR, if the \s-1DRD\s0 is \*(L"/pub/a/debian\*(R" then the full path |
||||
|
would be \*(L"/root/.swim/pub/a/debian\*(R". |
||||
|
.PP |
||||
|
Example: When a package is downloaded it will be placed in |
||||
|
dists/distribution/section/architecture/subject below the \s-1DRD\s0. |
||||
|
.PP |
||||
|
Rule: debian must be the final directory before dists, this is because |
||||
|
other distributions are placed alongside debian, like debian-non-\s-1US\s0 or |
||||
|
personal (specialized distribution). |
||||
|
.PP |
||||
|
\fB$default_root_directory = \*(L'/pub/debian\*(R';\fR |
||||
|
.PP |
||||
|
Because you may be using a real ftp site, this variable allows you to |
||||
|
determine what permissions \fBswim\fR will assign for directories it creates |
||||
|
below the \s-1DRD\s0. |
||||
|
.PP |
||||
|
\fB$permission = \*(L'0755\*(R';\fR |
||||
|
.Sh "\s-1TEMPORARY\s0 \s-1DIRECTORY\s0" |
||||
|
If you want to set an alternative directory for the temporary files |
||||
|
created when the databases are made, change here. You may want to make |
||||
|
\f(CW$tmp\fR a \s-1RAM\s0 disk. See package loadlin for initrd documentation and an |
||||
|
explanation for making such a disk. There is also documentation in |
||||
|
/usr/src/kernel-source.version/Documentation. Whether this will speed |
||||
|
things up is a subject of experimentation. |
||||
|
.PP |
||||
|
\fB$tmp = \*(L"/tmp\*(R";\fR |
||||
|
.Sh "\s-1FTP\s0" |
||||
|
You can alter the Firewall, Port, Timeout, Debug and Passive |
||||
|
characteristics of the ftp client as defined in \fINet::\s-1FTP\s0\fR\|(3pm) by providing |
||||
|
arguments to these variables. All variables but \f(CW$timeout\fR are set to untrue |
||||
|
by default. |
||||
|
.PP |
||||
|
.Vb 5 |
||||
|
\& $firewall = 0; (FTP firewall machine name) |
||||
|
\& $port = 0; (defaults to 23) |
||||
|
\& $timeout = 120; (120 seconds) |
||||
|
\& $debug = 0; (1 will turn on STDERR) |
||||
|
\& $passive = 0; (1 will enable) |
||||
|
.Ve |
||||
|
.SH "OTHER VARIABLES" |
||||
|
see SWIM::Conf |
||||
|
.SH "FILES" |
||||
|
.PP |
||||
|
.Vb 2 |
||||
|
\& /etc/swim/swimrc |
||||
|
\& ~/.swim/swimrc |
||||
|
.Ve |
||||
|
.SH "SEE ALSO" |
||||
|
\fIswim\fR\|(8), \fINet::FTP\fR\|(3pm) |
||||
|
.SH "BUGS" |
||||
|
Send directly to mttrader@access.mountain.net. |
||||
|
.SH "AUTHOR" |
||||
|
Jonathan D. Rosenbaum <mttrader@access.mountain.net> |
||||
|
.SH "COPYRIGHT" |
||||
|
Copyright (c) 1999 Jonathan Rosenbaum. All rights reserved. This program |
||||
|
is free software; you can redistribute it and/or modify it under the GPL. |
||||
|
|
||||
|
.rn }` '' |
||||
|
.IX Title "swimrc 5" |
||||
|
.IX Name "swimrc - swim configuration file" |
||||
|
|
||||
|
.IX Header "NAME" |
||||
|
|
||||
|
.IX Header "DESCRIPTION" |
||||
|
|
||||
|
.IX Header "USAGE" |
||||
|
|
||||
|
.IX Header "VARIABLES" |
||||
|
|
||||
|
.IX Subsection "\s-1OUTPUT\s0 \s-1VARIABLE\s0 " |
||||
|
|
||||
|
.IX Subsection "\s-1HISTORY\s0" |
||||
|
|
||||
|
.IX Subsection "\s-1AR\s0 or \s-1DPKG\s0?" |
||||
|
|
||||
|
.IX Subsection "\s-1APT\s0" |
||||
|
|
||||
|
.IX Subsection "\s-1PAGER\s0" |
||||
|
|
||||
|
.IX Subsection "\s-1NOT\s0\-\s-1INSTALLED\s0 \s-1VARIABLES\s0 " |
||||
|
|
||||
|
.IX Subsection "\s-1DF\s0 \s-1LOCATION\s0" |
||||
|
|
||||
|
.IX Subsection "\s-1TEMPORARY\s0 \s-1DIRECTORY\s0" |
||||
|
|
||||
|
.IX Subsection "\s-1FTP\s0" |
||||
|
|
||||
|
.IX Header "OTHER VARIABLES" |
||||
|
|
||||
|
.IX Header "FILES" |
||||
|
|
||||
|
.IX Header "SEE ALSO" |
||||
|
|
||||
|
.IX Header "BUGS" |
||||
|
|
||||
|
.IX Header "AUTHOR" |
||||
|
|
||||
|
.IX Header "COPYRIGHT" |
||||
|
|
@ -0,0 +1,26 @@ |
|||||
|
<html><head> |
||||
|
<title>swimrc - swim configuration file - DESCRIPTION |
||||
|
</title> |
||||
|
<link rev=made href="mailto:mttrader@access.mountain.net"> |
||||
|
</head><body> |
||||
|
<h1> |
||||
|
swimrc - swim configuration file - chapter 1<br> |
||||
|
DESCRIPTION |
||||
|
|
||||
|
</h1> |
||||
|
|
||||
|
<kbd>swimrc</kbd> is the configuartion file for swim allowing many |
||||
|
default values to be set so that they do not have to be mentioned on the |
||||
|
command line. Swimrc interacts directly with Perl allowing a wide variety |
||||
|
of variables found in <kbd>SWIW::Conf</kbd> to be altered. |
||||
|
<hr> |
||||
|
swimrc - swim configuration file |
||||
|
- <A href="index.html#copyright"> |
||||
|
Copyright © 1999 Jonathan D. Rosenbaum |
||||
|
</A> |
||||
|
<br> |
||||
|
<A href="index.html#toc">Contents</A>; <A href="ch-usage.html">next</A>. |
||||
|
<br> |
||||
|
<address>27 May 1999<br> |
||||
|
Jonathan D. Rosenbaum<A href="mailto:mttrader@access.mountain.net">mttrader@access.mountain.net</A></address> |
||||
|
</body></html> |
@ -0,0 +1,26 @@ |
|||||
|
<html><head> |
||||
|
<title>swimrc - swim configuration file - FILES |
||||
|
</title> |
||||
|
<link rev=made href="mailto:mttrader@access.mountain.net"> |
||||
|
</head><body> |
||||
|
<h1> |
||||
|
swimrc - swim configuration file - chapter 5<br> |
||||
|
FILES |
||||
|
|
||||
|
</h1> |
||||
|
|
||||
|
<code> /etc/swim/swimrc</code><P> |
||||
|
|
||||
|
<code>~/.swim/swimrc</code> |
||||
|
|
||||
|
<hr> |
||||
|
swimrc - swim configuration file |
||||
|
- <A href="index.html#copyright"> |
||||
|
Copyright © 1999 Jonathan D. Rosenbaum |
||||
|
</A> |
||||
|
<br> |
||||
|
<A href="index.html#toc">Contents</A>; <A href="ch6.html">next</A>; <A href="ch-othervars.html">back</A>. |
||||
|
<br> |
||||
|
<address>27 May 1999<br> |
||||
|
Jonathan D. Rosenbaum<A href="mailto:mttrader@access.mountain.net">mttrader@access.mountain.net</A></address> |
||||
|
</body></html> |
@ -0,0 +1,23 @@ |
|||||
|
<html><head> |
||||
|
<title>swimrc - swim configuration file - OTHER VARIABLES |
||||
|
</title> |
||||
|
<link rev=made href="mailto:mttrader@access.mountain.net"> |
||||
|
</head><body> |
||||
|
<h1> |
||||
|
swimrc - swim configuration file - chapter 4<br> |
||||
|
OTHER VARIABLES |
||||
|
|
||||
|
</h1> |
||||
|
|
||||
|
see SWIM::Conf |
||||
|
<hr> |
||||
|
swimrc - swim configuration file |
||||
|
- <A href="index.html#copyright"> |
||||
|
Copyright © 1999 Jonathan D. Rosenbaum |
||||
|
</A> |
||||
|
<br> |
||||
|
<A href="index.html#toc">Contents</A>; <A href="ch-files.html">next</A>; <A href="ch-variables.html">back</A>. |
||||
|
<br> |
||||
|
<address>27 May 1999<br> |
||||
|
Jonathan D. Rosenbaum<A href="mailto:mttrader@access.mountain.net">mttrader@access.mountain.net</A></address> |
||||
|
</body></html> |
@ -0,0 +1,35 @@ |
|||||
|
<html><head> |
||||
|
<title>swimrc - swim configuration file - RESTRICTIONS |
||||
|
</title> |
||||
|
<link rev=made href="mailto:mttrader@access.mountain.net"> |
||||
|
</head><body> |
||||
|
<h1> |
||||
|
swimrc - swim configuration file - chapter 6<br> |
||||
|
RESTRICTIONS |
||||
|
|
||||
|
</h1> |
||||
|
|
||||
|
Strange Situations: If the same package happens to exist in two different |
||||
|
sections, <em>main and non-us</em> for example, and you make the |
||||
|
databases, you will still be able to find this package in the non-us |
||||
|
group, but its section and locations will be the one which main recognizes |
||||
|
assuming that you use the order in the example below. |
||||
|
|
||||
|
<P> |
||||
|
|
||||
|
|
||||
|
Example: You just want to pull out main and contrib every time you run |
||||
|
<code>--initndb</code>, <code>--rebuildndb</code>, or <code>--ndb</code>. |
||||
|
<P> |
||||
|
<code>@user_defined_section</code> = <code>``qw(main contrib non-US)'';</code> |
||||
|
<hr> |
||||
|
swimrc - swim configuration file |
||||
|
- <A href="index.html#copyright"> |
||||
|
Copyright © 1999 Jonathan D. Rosenbaum |
||||
|
</A> |
||||
|
<br> |
||||
|
<A href="index.html#toc">Contents</A>; <A href="ch-files.html">back</A>. |
||||
|
<br> |
||||
|
<address>14 May 1999<br> |
||||
|
Jonathan D. Rosenbaum<A href="mailto:mttrader@access.mountain.net">mttrader@access.mountain.net</A></address> |
||||
|
</body></html> |
@ -0,0 +1,29 @@ |
|||||
|
<html><head> |
||||
|
<title>swimrc - swim configuration file - USAGE |
||||
|
</title> |
||||
|
<link rev=made href="mailto:mttrader@access.mountain.net"> |
||||
|
</head><body> |
||||
|
<h1> |
||||
|
swimrc - swim configuration file - chapter 2<br> |
||||
|
USAGE |
||||
|
|
||||
|
</h1> |
||||
|
Values for variable can be altered for <strong>swim</strong> by assigning |
||||
|
different values enclosed in quotes or quoted whitespace (qw()), and ending |
||||
|
with a semi-colon. <P> |
||||
|
|
||||
|
<code> $variable = ``value'';</code><P> |
||||
|
<code>$variable = ``(value1 value2 ..)'';</code> |
||||
|
<P> |
||||
|
<P> |
||||
|
<hr> |
||||
|
swimrc - swim configuration file |
||||
|
- <A href="index.html#copyright"> |
||||
|
Copyright © 1999 Jonathan D. Rosenbaum |
||||
|
</A> |
||||
|
<br> |
||||
|
<A href="index.html#toc">Contents</A>; <A href="ch-variables.html">next</A>; <A href="ch-description.html">back</A>. |
||||
|
<br> |
||||
|
<address>27 May 1999<br> |
||||
|
Jonathan D. Rosenbaum<A href="mailto:mttrader@access.mountain.net">mttrader@access.mountain.net</A></address> |
||||
|
</body></html> |
@ -0,0 +1,284 @@ |
|||||
|
<html><head> |
||||
|
<title>swimrc - swim configuration file - VARIABLES |
||||
|
</title> |
||||
|
<link rev=made href="mailto:mttrader@access.mountain.net"> |
||||
|
</head><body> |
||||
|
<h1> |
||||
|
swimrc - swim configuration file - chapter 3<br> |
||||
|
VARIABLES |
||||
|
|
||||
|
</h1> |
||||
|
This is a list of variables with explanations. The default values for |
||||
|
<strong>swim</strong> are shown. |
||||
|
|
||||
|
|
||||
|
<hr> |
||||
|
<h2><A name="s3.1"> |
||||
|
3.1 OUTPUT VARIABLE |
||||
|
|
||||
|
</A></h2> |
||||
|
<code>$my_number</code> can be changed to how many lines you would like |
||||
|
``swim -qf <>'' to print out, before the program asks for |
||||
|
<code>-t</code> or <code>--total</code>. Exception: If <code>-i</code> is |
||||
|
used in the query and there is more than one package then the total will |
||||
|
be presented. |
||||
|
|
||||
|
<P> |
||||
|
|
||||
|
Hint: <code>-t</code> can be used with all the various |
||||
|
<code>--scripts</code> family members to view the title of the script file |
||||
|
regardless of this variable setting, and if <code>-t</code> has to be |
||||
|
used, the titles will be displayed, which makes sense. |
||||
|
|
||||
|
<P> |
||||
|
|
||||
|
<strong>$my_number = 23;</strong> |
||||
|
|
||||
|
<hr> |
||||
|
<h2><A name="s3.2"> |
||||
|
3.2 HISTORY |
||||
|
|
||||
|
</A></h2> |
||||
|
|
||||
|
This is a shell-like history kept in relation to searches and the most |
||||
|
recent edit when <code>--stdin</code> is used. |
||||
|
<P> |
||||
|
|
||||
|
<strong>$HISTORY = 10;</strong> |
||||
|
|
||||
|
<hr> |
||||
|
<h2><A name="s3.3"> |
||||
|
3.3 AR or DPKG? |
||||
|
|
||||
|
</A></h2> |
||||
|
|
||||
|
Debian packages are ar archives. If you are using a Debian Distribution |
||||
|
assign ``dpkg'' to $package_tool, otherwise assign ``ar'' to |
||||
|
$package_tool. |
||||
|
<P> |
||||
|
|
||||
|
<strong>$package_tool = "/usr/bin/ar";</strong> |
||||
|
<hr> |
||||
|
<h2><A name="s3.4"> |
||||
|
3.4 APT |
||||
|
|
||||
|
</A></h2> |
||||
|
|
||||
|
<strong>Swim</strong> does not assign a value for apt. To use |
||||
|
<code>--apt</code> and <code>-xyz</code> assign <code>$apt</code> the |
||||
|
value ``yes''. |
||||
|
|
||||
|
<P> |
||||
|
|
||||
|
|
||||
|
Example: <strong>$apt = "yes";</strong> |
||||
|
<hr> |
||||
|
<h2><A name="s3.5"> |
||||
|
3.5 PAGER |
||||
|
|
||||
|
</A></h2> |
||||
|
|
||||
|
|
||||
|
<strong>less</strong> is a nice pager, unless you like |
||||
|
<strong>more</strong>! Pager is used for <code>--help</code> and |
||||
|
<strong>swim</strong> called without any options. There is an option |
||||
|
<code>--nopager</code> or <code>-n</code>. <strong>more</strong> comes from the |
||||
|
required package util-linux, whereas <strong>less</strong> comes from a |
||||
|
standard package called less. Values: ``less'', ``more'', or ``most'' |
||||
|
or... |
||||
|
|
||||
|
<P> |
||||
|
|
||||
|
|
||||
|
<strong>$ENV{PAGER} = "less";</strong> |
||||
|
<hr> |
||||
|
<h2><A name="s3.6"> |
||||
|
3.6 NOT-INSTALLED VARIABLES |
||||
|
|
||||
|
</A></h2> |
||||
|
|
||||
|
Assign values for <code>$architecture</code> and/or |
||||
|
<code>$distribution</code> to avoid having to use <code>--arch</code> and |
||||
|
<code>--dists</code> everytime the not-installed databases are accessed |
||||
|
with <code>-n</code> or made or altered. |
||||
|
|
||||
|
<P> |
||||
|
|
||||
|
|
||||
|
Architectures are always being added so check with Debian to find a list. |
||||
|
There is <em>alpha, arm, hurd-i386 (alternative kernel to linux), i386, |
||||
|
m68k, powerpc, sparc</em>. Just use the arch found after the hyphen in the |
||||
|
Contents-(arch) file. |
||||
|
|
||||
|
<P> |
||||
|
|
||||
|
|
||||
|
<strong>$architecture = "i386";</strong> |
||||
|
<P> |
||||
|
|
||||
|
|
||||
|
The distribution can be either <em>stable, unstable, frozen, or |
||||
|
experimental (rare)</em>. These represent the state of development that |
||||
|
the packages are under. The unstable distribution can have lot's of |
||||
|
changes within a very short time period, and frozen may or may not be |
||||
|
available. |
||||
|
|
||||
|
<P> |
||||
|
|
||||
|
|
||||
|
<strong>$distribution = "unstable";</strong> |
||||
|
<P> |
||||
|
|
||||
|
|
||||
|
Distributions are divided into sections. These sections were called |
||||
|
distributions in the version 2.4.1.0 packaging manual, because they were |
||||
|
at |
||||
|
one time separate distributions, but this has since changed. |
||||
|
|
||||
|
<P> |
||||
|
|
||||
|
|
||||
|
You can determine which of the sections <em>main, non-free, contrib or |
||||
|
non-US</em> to pull out of the Contents file if you don't want to use |
||||
|
<code>--main</code>, <code>--contrib</code>, <code>--non-free</code>, and |
||||
|
<code>--non-us</code> to selectively pick the sections. |
||||
|
|
||||
|
<P> |
||||
|
|
||||
|
|
||||
|
For efficiency, you should choose the sections which you will be pulling |
||||
|
out of the Packages <code>file(s)</code> being targetted. |
||||
|
|
||||
|
<P> |
||||
|
|
||||
|
|
||||
|
Rule: Use ``non-US'' not ``non-us''. |
||||
|
|
||||
|
<P> |
||||
|
|
||||
|
|
||||
|
<strong>@user_defined_section = qw(main contrib non-free non-US);</strong> |
||||
|
|
||||
|
<hr> |
||||
|
<h2><A name="s3.7"> |
||||
|
3.7 DF LOCATION |
||||
|
|
||||
|
</A></h2> |
||||
|
|
||||
|
A little philosophy: <strong>swim</strong> was developed for maximum |
||||
|
versatility, so whether you are just interested in researching, and |
||||
|
keeping tabs on the newest packages, or maintaining a Debian virtual |
||||
|
distribution on a non-Debian distribution, or you are a using |
||||
|
<strong>swim</strong> for distribution development, <strong>swim</strong> |
||||
|
provides a way. |
||||
|
|
||||
|
<P> |
||||
|
|
||||
|
|
||||
|
The next two variables determine the location of the DF (default |
||||
|
directory/file system) |
||||
|
|
||||
|
<P> |
||||
|
|
||||
|
|
||||
|
The default directory keeps track of Contents and/or Packages databases |
||||
|
retrieved with --ftp. The Contents and Packages databases and Release file |
||||
|
are give names specific to the distribution and architectures they |
||||
|
represent using the naming convention found in apt's sources directory. |
||||
|
You also have the freedom not to use the default directory, in which case |
||||
|
swim |
||||
|
|
||||
|
will still do the renaming and keeping track of the mtime, but you will |
||||
|
have to remember where you put the files. |
||||
|
|
||||
|
<P> |
||||
|
|
||||
|
|
||||
|
<strong>$default_directory = '/root/.swim';</strong> |
||||
|
|
||||
|
|
||||
|
|
||||
|
<P> |
||||
|
|
||||
|
|
||||
|
The default root directory (DRD) is the key to easy management of binary |
||||
|
packages, source, dsc, and diff files received from --ftp, and provides an |
||||
|
easy way to put together a personalized distribution. This directory can |
||||
|
be |
||||
|
a real ftp site on your computer, or put wherever else you are allowed to |
||||
|
have directories. The DRD is always placed below the value assigned to |
||||
|
$default_directory. According to the previous assignment to |
||||
|
$default_directory, if the DRD is ``/pub/a/debian'' then the full path |
||||
|
would be ``/root/.swim/pub/a/debian''. |
||||
|
<P> |
||||
|
|
||||
|
|
||||
|
Example: When a package is downloaded it will be placed in |
||||
|
dists/distribution/section/architecture/subject below the DRD. |
||||
|
|
||||
|
<P> |
||||
|
|
||||
|
|
||||
|
Rule: debian must be the final directory before dists, this is because |
||||
|
other distributions are placed alongside debian, like debian-non-US or |
||||
|
personal (specialized distribution). |
||||
|
|
||||
|
<P> |
||||
|
|
||||
|
|
||||
|
<strong>$default_root_directory = '/pub/debian';</strong> |
||||
|
<P> |
||||
|
|
||||
|
|
||||
|
Because you may be using a real ftp site, this variable allows you to |
||||
|
determine what permissions <strong>swim</strong> will assign for |
||||
|
directories it |
||||
|
creates below the DRD. |
||||
|
|
||||
|
<P> |
||||
|
|
||||
|
|
||||
|
<strong>$permission = '0755';</strong> |
||||
|
|
||||
|
<hr> |
||||
|
<h2><A name="s3.8"> |
||||
|
3.8 TEMPORARY DIRECTORY |
||||
|
|
||||
|
</A></h2> |
||||
|
If you want to set an alternative directory for the temporary files |
||||
|
created when the databases are made, change here. You may want to make |
||||
|
<code>$tmp</code> a RAM disk. See package loadlin for initrd documentation and |
||||
|
an explanation for making such a disk. There is also documentation in |
||||
|
/usr/src/kernel-source.version/Documentation. Whether this will speed |
||||
|
things up is a subject of experimentation. |
||||
|
<P> |
||||
|
|
||||
|
|
||||
|
<strong>$tmp = "/tmp";</strong> |
||||
|
<hr> |
||||
|
<h2><A name="s3.9"> |
||||
|
3.9 FTP |
||||
|
|
||||
|
</A></h2> |
||||
|
|
||||
|
You can alter the Firewall, Port, Timeout, Debug and Passive |
||||
|
characteristics of the ftp client as defined in Net::FTP(3pm) by providing |
||||
|
arguments to these variables. All variables but $timeout are set to untrue |
||||
|
by default. |
||||
|
|
||||
|
<pre> $firewall = 0; (FTP firewall machine name) |
||||
|
$port = 0; (defaults to 23) |
||||
|
$timeout = 120; (120 seconds) |
||||
|
$debug = 0; (1 will turn on STDERR) |
||||
|
$passive = 0; (1 will enable)</pre> |
||||
|
<hr> |
||||
|
swimrc - swim configuration file |
||||
|
- <A href="index.html#copyright"> |
||||
|
Copyright © 1999 Jonathan D. Rosenbaum |
||||
|
</A> |
||||
|
<br> |
||||
|
<A href="index.html#toc">Contents</A>; <A href="ch-othervars.html">next</A>; <A href="ch-usage.html">back</A>. |
||||
|
<br> |
||||
|
<address>27 May 1999<br> |
||||
|
Jonathan D. Rosenbaum<A href="mailto:mttrader@access.mountain.net">mttrader@access.mountain.net</A></address> |
||||
|
</body></html> |
@ -0,0 +1,20 @@ |
|||||
|
<html><head> |
||||
|
<title>swimrc - swim configuration file - BUGS</title> |
||||
|
<link rev=made href="mailto:mttrader@access.mountain.net"> |
||||
|
</head><body> |
||||
|
<h1> |
||||
|
swimrc - swim configuration file - chapter 6<br> |
||||
|
BUGS |
||||
|
</h1> |
||||
|
Send directly to mttrader@access.mountain.net. |
||||
|
<hr> |
||||
|
swimrc - swim configuration file |
||||
|
- <A href="index.html#copyright"> |
||||
|
Copyright © 1999 Jonathan D. Rosenbaum |
||||
|
</A> |
||||
|
<br> |
||||
|
<A href="index.html#toc">Contents</A>; <A href="ch-files.html">back</A>. |
||||
|
<br> |
||||
|
<address>27 May 1999<br> |
||||
|
Jonathan D. Rosenbaum<A href="mailto:mttrader@access.mountain.net">mttrader@access.mountain.net</A></address> |
||||
|
</body></html> |
@ -0,0 +1,76 @@ |
|||||
|
<html><head> |
||||
|
<title>swimrc - swim configuration file</title> |
||||
|
<link rev=made href="mailto:mttrader@access.mountain.net"> |
||||
|
</head><body> |
||||
|
<h1>swimrc - swim configuration file</h1> |
||||
|
|
||||
|
<h2><A name="toc"> |
||||
|
0.1 Table of contents |
||||
|
</A></h2> |
||||
|
<ul> |
||||
|
<li><A href="ch-description.html">1 DESCRIPTION |
||||
|
</A> |
||||
|
<li><A href="ch-usage.html">2 USAGE |
||||
|
</A> |
||||
|
<li><A href="ch-variables.html">3 VARIABLES |
||||
|
</A> |
||||
|
<ul> |
||||
|
<li><A href="ch-variables.html#s3.1">3.1</A> OUTPUT VARIABLE |
||||
|
|
||||
|
<li><A href="ch-variables.html#s3.2">3.2</A> HISTORY |
||||
|
|
||||
|
<li><A href="ch-variables.html#s3.3">3.3</A> AR or DPKG? |
||||
|
|
||||
|
<li><A href="ch-variables.html#s3.4">3.4</A> APT |
||||
|
|
||||
|
<li><A href="ch-variables.html#s3.5">3.5</A> PAGER |
||||
|
|
||||
|
<li><A href="ch-variables.html#s3.6">3.6</A> NOT-INSTALLED VARIABLES |
||||
|
|
||||
|
<li><A href="ch-variables.html#s3.7">3.7</A> DF LOCATION |
||||
|
|
||||
|
<li><A href="ch-variables.html#s3.8">3.8</A> TEMPORARY DIRECTORY |
||||
|
|
||||
|
<li><A href="ch-variables.html#s3.9">3.9</A> FTP |
||||
|
|
||||
|
</ul> |
||||
|
<li><A href="ch-othervars.html">4 OTHER VARIABLES |
||||
|
</A> |
||||
|
<li><A href="ch-files.html">5 FILES |
||||
|
</A> |
||||
|
<li><A href="ch6.html">6 BUGS</A> |
||||
|
</ul> |
||||
|
<hr><h2><A name="copyright">0.2 Copyright</A></h2> |
||||
|
|
||||
|
Copyright © 1999 Jonathan D. Rosenbaum |
||||
|
<P> |
||||
|
|
||||
|
SWIM, including this manual, is free software; you |
||||
|
may 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, or (at your option) any later |
||||
|
version. |
||||
|
<P> |
||||
|
|
||||
|
This is distributed in the hope that it will be useful, but |
||||
|
<em>without any warranty</em>; without even the implied |
||||
|
warranty of merchantability or fitness for a particular |
||||
|
purpose. See the GNU General Public License for more |
||||
|
details. |
||||
|
<P> |
||||
|
|
||||
|
You should have received a copy of the GNU General Public |
||||
|
License with the <kbd>swim</kbd> source as the file |
||||
|
<code>COPYING</code>. If not, write to the Free Software |
||||
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
||||
|
<hr> |
||||
|
swimrc - swim configuration file |
||||
|
- <A href="#copyright"> |
||||
|
Copyright © 1999 Jonathan D. Rosenbaum |
||||
|
</A> |
||||
|
<br> |
||||
|
<A href="#toc">Contents</A>. |
||||
|
<br> |
||||
|
<address>27 May 1999<br> |
||||
|
Jonathan D. Rosenbaum<A href="mailto:mttrader@access.mountain.net">mttrader@access.mountain.net</A></address> |
||||
|
</body></html> |
@ -0,0 +1,354 @@ |
|||||
|
<!doctype debiandoc system> |
||||
|
|
||||
|
<debiandoc> |
||||
|
|
||||
|
<book> |
||||
|
|
||||
|
<titlepag> |
||||
|
|
||||
|
<title>swimrc - swim configuration file</title> |
||||
|
|
||||
|
<author> |
||||
|
<name>Jonathan D. Rosenbaum</name> |
||||
|
<email>mttrader@access.mountain.net</email> |
||||
|
</author> |
||||
|
|
||||
|
<version><date></version> |
||||
|
|
||||
|
<copyright> |
||||
|
|
||||
|
<copyrightsummary> |
||||
|
Copyright © 1999 Jonathan D. Rosenbaum |
||||
|
</copyrightsummary> |
||||
|
|
||||
|
<p> |
||||
|
SWIM, including this manual, is free software; you |
||||
|
may 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, or (at your option) any later |
||||
|
version. |
||||
|
</p> |
||||
|
|
||||
|
<p> |
||||
|
This is distributed in the hope that it will be useful, but |
||||
|
<em>without any warranty</em>; without even the implied |
||||
|
warranty of merchantability or fitness for a particular |
||||
|
purpose. See the GNU General Public License for more |
||||
|
details. |
||||
|
</p> |
||||
|
|
||||
|
<p> |
||||
|
You should have received a copy of the GNU General Public |
||||
|
License with the <prgn>swim</prgn> source as the file |
||||
|
<tt>COPYING</tt>. If not, write to the Free Software |
||||
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
||||
|
</p> |
||||
|
|
||||
|
</copyright> |
||||
|
|
||||
|
</titlepag> |
||||
|
|
||||
|
<toc sect> |
||||
|
|
||||
|
<chapt id="description">DESCRIPTION |
||||
|
|
||||
|
<p> |
||||
|
|
||||
|
<prgn>swimrc</prgn> is the configuartion file for swim allowing many |
||||
|
default values to be set so that they do not have to be mentioned on the |
||||
|
command line. Swimrc interacts directly with Perl allowing a wide variety |
||||
|
of variables found in <prgn>SWIW::Conf</prgn> to be altered. |
||||
|
|
||||
|
<chapt id="usage">USAGE |
||||
|
|
||||
|
<p> |
||||
|
Values for variable can be altered for <STRONG>swim</STRONG> by assigning |
||||
|
different values enclosed in quotes or quoted whitespace (qw()), and ending |
||||
|
with a semi-colon. |
||||
|
<P> |
||||
|
|
||||
|
<tt> $variable = ``value'';</tt> |
||||
|
<p> |
||||
|
<tt>$variable = ``(value1 value2 ..)'';</tt> |
||||
|
|
||||
|
<P> |
||||
|
|
||||
|
<P> |
||||
|
<chapt id="variables">VARIABLES |
||||
|
|
||||
|
<p> |
||||
|
This is a list of variables with explanations. The default values for |
||||
|
<STRONG>swim</STRONG> are shown. |
||||
|
|
||||
|
|
||||
|
|
||||
|
<sect>OUTPUT VARIABLE |
||||
|
|
||||
|
<p> |
||||
|
<tt>$my_number</tt> can be changed to how many lines you would like |
||||
|
``swim -qf <>'' to print out, before the program asks for |
||||
|
<tt>-t</tt> or <tt>--total</tt>. Exception: If <tt>-i</tt> is |
||||
|
used in the query and there is more than one package then the total will |
||||
|
be presented. |
||||
|
|
||||
|
|
||||
|
<P> |
||||
|
|
||||
|
Hint: <tt>-t</tt> can be used with all the various |
||||
|
<tt>--scripts</tt> family members to view the title of the script file |
||||
|
regardless of this variable setting, and if <tt>-t</tt> has to be |
||||
|
used, the titles will be displayed, which makes sense. |
||||
|
|
||||
|
|
||||
|
<P> |
||||
|
|
||||
|
<strong>$my_number = 23;</strong> |
||||
|
|
||||
|
|
||||
|
<sect>HISTORY |
||||
|
|
||||
|
<p> |
||||
|
|
||||
|
This is a shell-like history kept in relation to searches and the most |
||||
|
recent edit when <tt>--stdin</tt> is used. |
||||
|
|
||||
|
<P> |
||||
|
|
||||
|
<strong>$HISTORY = 10;</strong> |
||||
|
|
||||
|
|
||||
|
<sect>AR or DPKG? |
||||
|
|
||||
|
<p> |
||||
|
Debian packages are ar archives. If you are using a Debian Distribution |
||||
|
assign ``dpkg'' to $package_tool, otherwise assign ``ar'' to |
||||
|
$package_tool. |
||||
|
|
||||
|
<p> |
||||
|
<STRONG>$package_tool = "/usr/bin/ar";</STRONG> |
||||
|
|
||||
|
<sect>APT |
||||
|
|
||||
|
<p> |
||||
|
<STRONG>Swim</STRONG> does not assign a value for apt. To use |
||||
|
<tt>--apt</tt> and <tt>-xyz</tt> assign <tt>$apt</tt> the |
||||
|
value ``yes''. |
||||
|
|
||||
|
|
||||
|
<P> |
||||
|
|
||||
|
Example: <STRONG>$apt = "yes";</STRONG> |
||||
|
|
||||
|
<sect>PAGER |
||||
|
|
||||
|
<p> |
||||
|
|
||||
|
<strong>less</strong> is a nice pager, unless you like |
||||
|
<strong>more</strong>! Pager is used for <tt>--help</tt> and |
||||
|
<STRONG>swim</STRONG> called without any options. There is an option |
||||
|
<tt>--nopager</tt> or <tt>-n</tt>. <strong>more</strong> comes from the |
||||
|
required package util-linux, whereas <strong>less</strong> comes from a |
||||
|
standard package called less. Values: ``less'', ``more'', or ``most'' |
||||
|
or... |
||||
|
|
||||
|
|
||||
|
<P> |
||||
|
|
||||
|
<STRONG>$ENV{PAGER} = "less";</STRONG> |
||||
|
|
||||
|
<sect>NOT-INSTALLED VARIABLES |
||||
|
|
||||
|
<p> |
||||
|
Assign values for <tt>$architecture</tt> and/or |
||||
|
<tt>$distribution</tt> to avoid having to use <tt>--arch</tt> and |
||||
|
<tt>--dists</tt> everytime the not-installed databases are accessed |
||||
|
with <tt>-n</tt> or made or altered. |
||||
|
|
||||
|
|
||||
|
<P> |
||||
|
|
||||
|
Architectures are always being added so check with Debian to find a list. |
||||
|
There is <EM>alpha, arm, hurd-i386 (alternative kernel to linux), i386, |
||||
|
m68k, powerpc, sparc</EM>. Just use the arch found after the hyphen in the |
||||
|
Contents-(arch) file. |
||||
|
|
||||
|
|
||||
|
<P> |
||||
|
|
||||
|
<STRONG>$architecture = "i386";</STRONG> |
||||
|
|
||||
|
<P> |
||||
|
|
||||
|
The distribution can be either <EM>stable, unstable, frozen, or |
||||
|
experimental (rare)</EM>. These represent the state of development that |
||||
|
the packages are under. The unstable distribution can have lot's of |
||||
|
changes within a very short time period, and frozen may or may not be |
||||
|
available. |
||||
|
|
||||
|
|
||||
|
<P> |
||||
|
|
||||
|
<STRONG>$distribution = "unstable";</STRONG> |
||||
|
|
||||
|
<P> |
||||
|
|
||||
|
Distributions are divided into sections. These sections were called |
||||
|
distributions in the version 2.4.1.0 packaging manual, because they were |
||||
|
at |
||||
|
one time separate distributions, but this has since changed. |
||||
|
|
||||
|
|
||||
|
<P> |
||||
|
|
||||
|
You can determine which of the sections <EM>main, non-free, contrib or |
||||
|
non-US</EM> to pull out of the Contents file if you don't want to use |
||||
|
<tt>--main</tt>, <tt>--contrib</tt>, <tt>--non-free</tt>, and |
||||
|
<tt>--non-us</tt> to selectively pick the sections. |
||||
|
|
||||
|
|
||||
|
<P> |
||||
|
|
||||
|
For efficiency, you should choose the sections which you will be pulling |
||||
|
out of the Packages <tt>file(s)</tt> being targetted. |
||||
|
|
||||
|
|
||||
|
<P> |
||||
|
|
||||
|
|
||||
|
Rule: Use ``non-US'' not ``non-us''. |
||||
|
|
||||
|
|
||||
|
<p> |
||||
|
|
||||
|
<STRONG>@user_defined_section = qw(main contrib non-free non-US);</STRONG> |
||||
|
|
||||
|
|
||||
|
<sect>DF LOCATION |
||||
|
|
||||
|
<p> |
||||
|
A little philosophy: <STRONG>swim</STRONG> was developed for maximum |
||||
|
versatility, so whether you are just interested in researching, and |
||||
|
keeping tabs on the newest packages, or maintaining a Debian virtual |
||||
|
distribution on a non-Debian distribution, or you are a using |
||||
|
<STRONG>swim</STRONG> for distribution development, <STRONG>swim</STRONG> |
||||
|
provides a way. |
||||
|
|
||||
|
|
||||
|
<P> |
||||
|
|
||||
|
The next two variables determine the location of the DF (default |
||||
|
directory/file system) |
||||
|
|
||||
|
|
||||
|
<P> |
||||
|
|
||||
|
The default directory keeps track of Contents and/or Packages databases |
||||
|
retrieved with --ftp. The Contents and Packages databases and Release file |
||||
|
are give names specific to the distribution and architectures they |
||||
|
represent using the naming convention found in apt's sources directory. |
||||
|
You also have the freedom not to use the default directory, in which case |
||||
|
swim |
||||
|
|
||||
|
will still do the renaming and keeping track of the mtime, but you will |
||||
|
have to remember where you put the files. |
||||
|
|
||||
|
|
||||
|
<P> |
||||
|
|
||||
|
<STRONG>$default_directory = '/root/.swim';</STRONG> |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
<P> |
||||
|
|
||||
|
The default root directory (DRD) is the key to easy management of binary |
||||
|
packages, source, dsc, and diff files received from --ftp, and provides an |
||||
|
easy way to put together a personalized distribution. This directory can |
||||
|
be |
||||
|
a real ftp site on your computer, or put wherever else you are allowed to |
||||
|
have directories. The DRD is always placed below the value assigned to |
||||
|
$default_directory. According to the previous assignment to |
||||
|
$default_directory, if the DRD is ``/pub/a/debian'' then the full path |
||||
|
would be ``/root/.swim/pub/a/debian''. |
||||
|
|
||||
|
<P> |
||||
|
|
||||
|
Example: When a package is downloaded it will be placed in |
||||
|
dists/distribution/section/architecture/subject below the DRD. |
||||
|
|
||||
|
|
||||
|
<P> |
||||
|
|
||||
|
Rule: debian must be the final directory before dists, this is because |
||||
|
other distributions are placed alongside debian, like debian-non-US or |
||||
|
personal (specialized distribution). |
||||
|
|
||||
|
|
||||
|
<P> |
||||
|
|
||||
|
<STRONG>$default_root_directory = '/pub/debian';</STRONG> |
||||
|
|
||||
|
<P> |
||||
|
|
||||
|
Because you may be using a real ftp site, this variable allows you to |
||||
|
determine what permissions <STRONG>swim</STRONG> will assign for |
||||
|
directories it |
||||
|
creates below the DRD. |
||||
|
|
||||
|
|
||||
|
<P> |
||||
|
|
||||
|
<STRONG>$permission = '0755';</STRONG> |
||||
|
|
||||
|
|
||||
|
<sect>TEMPORARY DIRECTORY |
||||
|
|
||||
|
<p> |
||||
|
If you want to set an alternative directory for the temporary files |
||||
|
created when the databases are made, change here. You may want to make |
||||
|
<tt>$tmp</tt> a RAM disk. See package loadlin for initrd documentation and |
||||
|
an explanation for making such a disk. There is also documentation in |
||||
|
/usr/src/kernel-source.version/Documentation. Whether this will speed |
||||
|
things up is a subject of experimentation. |
||||
|
|
||||
|
<p> |
||||
|
|
||||
|
<STRONG>$tmp = "/tmp";</STRONG> |
||||
|
|
||||
|
<sect>FTP |
||||
|
|
||||
|
<p> |
||||
|
|
||||
|
You can alter the Firewall, Port, Timeout, Debug and Passive |
||||
|
characteristics of the ftp client as defined in Net::FTP(3pm) by providing |
||||
|
arguments to these variables. All variables but $timeout are set to untrue |
||||
|
by default. |
||||
|
|
||||
|
<example> |
||||
|
$firewall = 0; (FTP firewall machine name) |
||||
|
$port = 0; (defaults to 23) |
||||
|
$timeout = 120; (120 seconds) |
||||
|
$debug = 0; (1 will turn on STDERR) |
||||
|
$passive = 0; (1 will enable) |
||||
|
</example> |
||||
|
|
||||
|
<chapt id="othervars">OTHER VARIABLES |
||||
|
|
||||
|
<p> |
||||
|
see SWIM::Conf |
||||
|
|
||||
|
<chapt id="files">FILES |
||||
|
|
||||
|
<p> |
||||
|
<tt> /etc/swim/swimrc</tt> |
||||
|
<p> |
||||
|
<tt>~/.swim/swimrc</tt> |
||||
|
|
||||
|
|
||||
|
<chapt>BUGS |
||||
|
<p>Send directly to mttrader@access.mountain.net. |
||||
|
|
||||
|
</book> |
||||
|
|
||||
|
</debiandoc> |
@ -0,0 +1,294 @@ |
|||||
|
|
||||
|
swimrc - swim configuration file |
||||
|
-------------------------------- |
||||
|
Jonathan D. Rosenbaum<mttrader@access.mountain.net> |
||||
|
27 May 1999 |
||||
|
|
||||
|
0.1 Contents |
||||
|
------------ |
||||
|
|
||||
|
1. DESCRIPTION |
||||
|
|
||||
|
2. USAGE |
||||
|
|
||||
|
3. VARIABLES |
||||
|
3.1. OUTPUT VARIABLE |
||||
|
3.2. HISTORY |
||||
|
3.3. AR or DPKG? |
||||
|
3.4. APT |
||||
|
3.5. PAGER |
||||
|
3.6. NOT-INSTALLED VARIABLES |
||||
|
3.7. DF LOCATION |
||||
|
3.8. TEMPORARY DIRECTORY |
||||
|
3.9. FTP |
||||
|
|
||||
|
4. OTHER VARIABLES |
||||
|
|
||||
|
5. FILES |
||||
|
|
||||
|
6. BUGS |
||||
|
|
||||
|
0.2 Copyright Notice |
||||
|
-------------------- |
||||
|
|
||||
|
Copyright © 1999 Jonathan D. Rosenbaum |
||||
|
|
||||
|
SWIM, including this manual, is free software; you may 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, or (at |
||||
|
your option) any later version. |
||||
|
|
||||
|
This 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 with |
||||
|
the swim source as the file `COPYING'. If not, write to the Free |
||||
|
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
||||
|
|
||||
|
|
||||
|
------------------------------------------------------------------------------- |
||||
|
|
||||
|
|
||||
|
1. DESCRIPTION |
||||
|
--------------- |
||||
|
|
||||
|
swimrc is the configuartion file for swim allowing many default values |
||||
|
to be set so that they do not have to be mentioned on the command |
||||
|
line. Swimrc interacts directly with Perl allowing a wide variety of |
||||
|
variables found in SWIW::Conf to be altered. |
||||
|
|
||||
|
|
||||
|
------------------------------------------------------------------------------- |
||||
|
|
||||
|
|
||||
|
2. USAGE |
||||
|
--------- |
||||
|
|
||||
|
Values for variable can be altered for *swim* by assigning different |
||||
|
values enclosed in quotes or quoted whitespace (qw()), and ending with |
||||
|
a semi-colon. |
||||
|
|
||||
|
` $variable = ``value'';' |
||||
|
|
||||
|
`$variable = ``(value1 value2 ..)'';' |
||||
|
|
||||
|
|
||||
|
|
||||
|
------------------------------------------------------------------------------- |
||||
|
|
||||
|
|
||||
|
3. VARIABLES |
||||
|
------------- |
||||
|
|
||||
|
This is a list of variables with explanations. The default values for |
||||
|
*swim* are shown. |
||||
|
|
||||
|
|
||||
|
3.1. OUTPUT VARIABLE |
||||
|
--------------------- |
||||
|
|
||||
|
`$my_number' can be changed to how many lines you would like ``swim |
||||
|
-qf <>'' to print out, before the program asks for `-t' or `--total'. |
||||
|
Exception: If `-i' is used in the query and there is more than one |
||||
|
package then the total will be presented. |
||||
|
|
||||
|
Hint: `-t' can be used with all the various `--scripts' family members |
||||
|
to view the title of the script file regardless of this variable |
||||
|
setting, and if `-t' has to be used, the titles will be displayed, |
||||
|
which makes sense. |
||||
|
|
||||
|
*$my_number = 23;* |
||||
|
|
||||
|
|
||||
|
3.2. HISTORY |
||||
|
------------- |
||||
|
|
||||
|
This is a shell-like history kept in relation to searches and the most |
||||
|
recent edit when `--stdin' is used. |
||||
|
|
||||
|
*$HISTORY = 10;* |
||||
|
|
||||
|
|
||||
|
3.3. AR or DPKG? |
||||
|
----------------- |
||||
|
|
||||
|
Debian packages are ar archives. If you are using a Debian |
||||
|
Distribution assign ``dpkg'' to $package_tool, otherwise assign ``ar'' |
||||
|
to $package_tool. |
||||
|
|
||||
|
*$package_tool = "/usr/bin/ar";* |
||||
|
|
||||
|
|
||||
|
3.4. APT |
||||
|
--------- |
||||
|
|
||||
|
*Swim* does not assign a value for apt. To use `--apt' and `-xyz' |
||||
|
assign `$apt' the value ``yes''. |
||||
|
|
||||
|
Example: *$apt = "yes";* |
||||
|
|
||||
|
|
||||
|
3.5. PAGER |
||||
|
----------- |
||||
|
|
||||
|
*less* is a nice pager, unless you like *more*! Pager is used for |
||||
|
`--help' and *swim* called without any options. There is an option |
||||
|
`--nopager' or `-n'. *more* comes from the required package |
||||
|
util-linux, whereas *less* comes from a standard package called less. |
||||
|
Values: ``less'', ``more'', or ``most'' or... |
||||
|
|
||||
|
*$ENV{PAGER} = "less";* |
||||
|
|
||||
|
|
||||
|
3.6. NOT-INSTALLED VARIABLES |
||||
|
----------------------------- |
||||
|
|
||||
|
Assign values for `$architecture' and/or `$distribution' to avoid |
||||
|
having to use `--arch' and `--dists' everytime the not-installed |
||||
|
databases are accessed with `-n' or made or altered. |
||||
|
|
||||
|
Architectures are always being added so check with Debian to find a |
||||
|
list. There is *alpha, arm, hurd-i386 (alternative kernel to linux), |
||||
|
i386, m68k, powerpc, sparc*. Just use the arch found after the hyphen |
||||
|
in the Contents-(arch) file. |
||||
|
|
||||
|
*$architecture = "i386";* |
||||
|
|
||||
|
The distribution can be either *stable, unstable, frozen, or |
||||
|
experimental (rare)*. These represent the state of development that |
||||
|
the packages are under. The unstable distribution can have lot's of |
||||
|
changes within a very short time period, and frozen may or may not be |
||||
|
available. |
||||
|
|
||||
|
*$distribution = "unstable";* |
||||
|
|
||||
|
Distributions are divided into sections. These sections were called |
||||
|
distributions in the version 2.4.1.0 packaging manual, because they |
||||
|
were at one time separate distributions, but this has since changed. |
||||
|
|
||||
|
You can determine which of the sections *main, non-free, contrib or |
||||
|
non-US* to pull out of the Contents file if you don't want to use |
||||
|
`--main', `--contrib', `--non-free', and `--non-us' to selectively |
||||
|
pick the sections. |
||||
|
|
||||
|
For efficiency, you should choose the sections which you will be |
||||
|
pulling out of the Packages `file(s)' being targetted. |
||||
|
|
||||
|
Rule: Use ``non-US'' not ``non-us''. |
||||
|
|
||||
|
*@user_defined_section = qw(main contrib non-free non-US);* |
||||
|
|
||||
|
|
||||
|
3.7. DF LOCATION |
||||
|
----------------- |
||||
|
|
||||
|
A little philosophy: *swim* was developed for maximum versatility, so |
||||
|
whether you are just interested in researching, and keeping tabs on |
||||
|
the newest packages, or maintaining a Debian virtual distribution on a |
||||
|
non-Debian distribution, or you are a using *swim* for distribution |
||||
|
development, *swim* provides a way. |
||||
|
|
||||
|
The next two variables determine the location of the DF (default |
||||
|
directory/file system) |
||||
|
|
||||
|
The default directory keeps track of Contents and/or Packages |
||||
|
databases retrieved with --ftp. The Contents and Packages databases |
||||
|
and Release file are give names specific to the distribution and |
||||
|
architectures they represent using the naming convention found in |
||||
|
apt's sources directory. You also have the freedom not to use the |
||||
|
default directory, in which case swim will still do the renaming and |
||||
|
keeping track of the mtime, but you will have to remember where you |
||||
|
put the files. |
||||
|
|
||||
|
*$default_directory = '/root/.swim';* |
||||
|
|
||||
|
The default root directory (DRD) is the key to easy management of |
||||
|
binary packages, source, dsc, and diff files received from --ftp, and |
||||
|
provides an easy way to put together a personalized distribution. This |
||||
|
directory can be a real ftp site on your computer, or put wherever |
||||
|
else you are allowed to have directories. The DRD is always placed |
||||
|
below the value assigned to $default_directory. According to the |
||||
|
previous assignment to $default_directory, if the DRD is |
||||
|
``/pub/a/debian'' then the full path would be |
||||
|
``/root/.swim/pub/a/debian''. |
||||
|
|
||||
|
Example: When a package is downloaded it will be placed in |
||||
|
dists/distribution/section/architecture/subject below the DRD. |
||||
|
|
||||
|
Rule: debian must be the final directory before dists, this is because |
||||
|
other distributions are placed alongside debian, like debian-non-US or |
||||
|
personal (specialized distribution). |
||||
|
|
||||
|
*$default_root_directory = '/pub/debian';* |
||||
|
|
||||
|
Because you may be using a real ftp site, this variable allows you to |
||||
|
determine what permissions *swim* will assign for directories it |
||||
|
creates below the DRD. |
||||
|
|
||||
|
*$permission = '0755';* |
||||
|
|
||||
|
|
||||
|
3.8. TEMPORARY DIRECTORY |
||||
|
------------------------- |
||||
|
|
||||
|
If you want to set an alternative directory for the temporary files |
||||
|
created when the databases are made, change here. You may want to make |
||||
|
`$tmp' a RAM disk. See package loadlin for initrd documentation and an |
||||
|
explanation for making such a disk. There is also documentation in |
||||
|
/usr/src/kernel-source.version/Documentation. Whether this will speed |
||||
|
things up is a subject of experimentation. |
||||
|
|
||||
|
*$tmp = "/tmp";* |
||||
|
|
||||
|
|
||||
|
3.9. FTP |
||||
|
--------- |
||||
|
|
||||
|
You can alter the Firewall, Port, Timeout, Debug and Passive |
||||
|
characteristics of the ftp client as defined in Net::FTP(3pm) by |
||||
|
providing arguments to these variables. All variables but $timeout are |
||||
|
set to untrue by default. |
||||
|
$firewall = 0; (FTP firewall machine name) |
||||
|
$port = 0; (defaults to 23) |
||||
|
$timeout = 120; (120 seconds) |
||||
|
$debug = 0; (1 will turn on STDERR) |
||||
|
$passive = 0; (1 will enable) |
||||
|
|
||||
|
|
||||
|
------------------------------------------------------------------------------- |
||||
|
|
||||
|
|
||||
|
4. OTHER VARIABLES |
||||
|
------------------- |
||||
|
|
||||
|
see SWIM::Conf |
||||
|
|
||||
|
|
||||
|
------------------------------------------------------------------------------- |
||||
|
|
||||
|
|
||||
|
5. FILES |
||||
|
--------- |
||||
|
|
||||
|
` /etc/swim/swimrc' |
||||
|
|
||||
|
`~/.swim/swimrc' |
||||
|
|
||||
|
|
||||
|
------------------------------------------------------------------------------- |
||||
|
|
||||
|
|
||||
|
6. BUGS |
||||
|
------- |
||||
|
|
||||
|
Send directly to mttrader@access.mountain.net. |
||||
|
|
||||
|
|
||||
|
------------------------------------------------------------------------------- |
||||
|
|
||||
|
|
||||
|
swimrc - swim configuration file |
||||
|
Jonathan D. Rosenbaum<mttrader@access.mountain.net> 27 May 1999 |
||||
|
|
@ -0,0 +1,11 @@ |
|||||
|
# Read QUICKSTART for a quick start, and check out the SWIMZ.LIST |
||||
|
# section in swim(8) for much more information. This list is read |
||||
|
# sequentially, so earlier entries are read before later entries |
||||
|
# |
||||
|
# Debian users: Unlike apt which only downloads Packages, swim reads this |
||||
|
# list based on the specified or default distribution/architecture to |
||||
|
# make handling the downloading of both the Contents and Packages files |
||||
|
# easier. Look at the Cron example in /usr/doc/swim/examples. |
||||
|
# |
||||
|
# deb ftp://ftp.debian.org/pub/debian unstable contrib non-free main |
||||
|
# deb ftp://ftp.debian.org/pub/debian stable contrib non-free main |
Loading…
Reference in new issue