introduce svn-typical layout

git-svn-id: https://crux.nu/svn/tools/prt-get/trunk@9 0b5ae1c7-2405-0410-a7fc-ba219f786e1e
This commit is contained in:
Johannes Winkelmann 2005-11-09 21:43:05 +00:00
commit d8c1e157ab
67 changed files with 18406 additions and 0 deletions

1
AUTHORS Normal file
View File

@ -0,0 +1 @@
Johannes Winkelmann, jw@tks6.net

18
CREDITS Normal file
View File

@ -0,0 +1,18 @@
Thanks go to the following persons for valuable feedback/bug reports:
* Olle Gustafsson
* Daniel Mueller
* Juergen Daubert
* Mike Toggweiler
* Robert McMeekin
* Michael Ablassmeier
* Roger Kislig
* Sven Dahl
* Matt Housh
* Christoph Winkelmann
* Han Boetes
The following persons have contributed patches to prt-get's source code:
* Logan Ingalls
Not to forget debian for the inspiration for a *-get tool and the those
on the crux mailing list writing about their ideas and needs.

373
ChangeLog Normal file
View File

@ -0,0 +1,373 @@
* 0.5.11 29.05.2005 Johannes Winkelmann
- add --path to 'ls'
- initial regex support
- replace `uname -r` and `date +...` in version strings
- add 'useregex' config key and --regex command line argument
- Add --full to fsearch
- use regex in fsearch if requested
- add leading slash to fsearch result
- support both `` and $()
- support date patterns like '+%Y'
- add aliases and deplist to dist-tarball
- support multiple shell patterns in version
* 0.5.10 21.04.2005 Johannes Winkelmann
- fix bugs #3735, #3836
- implement --ignore=<port1>,<port2> feature
- fix --path for list, search
- add --path for depends
- enable logfile and depfile in default prt-get.conf
* 0.5.9 06.12.2005 Johannes Winkelmann
- add alias support
- use absolut pathes for commands (pkgmk et al)
- add -v switch to 'info' to show the readme
- fix 'keephigher' in default prt-get.conf
- add deptree to 'help'
- remove some debug test
- prettify error message when packages are not found
- change 'bash' to 'sh' in process.cpp
- use 'Pkgfile' as default file for cat and edit if no second argument given
* 0.5.8 31.10.2004 Johannes Winkelmann
- re-enable version parseing; use --prefer-higher to make prt-get use
it
- implement shortcuts to frequentily used pkgmk/pkgadd options
- make -f do 'pkgadd -f'
- add new versioncomparator class
- implement 'alpha' < 'beta' < 'gamma' < 'delta'
* 0.5.7 16.07.2004 Johannes Winkelmann
- add the --install-root argument to allow installation to a different root
- add the --rargs switch to pass options to pkgmk in "prt-get remove"
- add 'removecommand' configuration key
- add 'runscriptcommand' configuration key
- improve config parsing: options can now be in front of command
* 0.5.6 06.01.2004 Johannes Winkelmann
- add four new command line arguments:
--no-std-config Don't parse default configuration file
--config-prepend=<string> Prepend <string> to configuration
--config-append=<string> Append <string> to configuration
--config-set=<string> Set configuration data, overriding config file
- add new command: dumpconfig
- respect 'cachefile' setting in configuration (did anyone ever use this??)
- add 'runscripts' configuration variable to (equivalent to --install-scripts)
- dump readme and runscripts configuration in dumpConfig()
- add 'makecommand' and 'addcommand' to config file to make prt-get use
another command than pkgmk and pkgadd
* 0.5.5p1 23.03.2004 Johannes Winkelmann
- Let Pkgfile's dependencies take precedence over deplist
* 0.5.5 05.03.2004 Johannes Winkelmann
- Add new configuration option: depfile
- add way to use external dependency file
- Add some missing headers for compilation with gcc 2.95
- update bash completion for isinst
- add deptree command (--all for all deps)
* 0.5.4p2 17.11.2003 Johannes Winkelmann
- fix bug in "at least X arguments" after getting several complaints
* 0.5.4p1 30.10.2003 Johannes Winkelmann
- fix message when called without argument
- Fix duplicate prtdir ignoring error (when using filters)
* 0.5.4 04.10.2003 Johannes Winkelmann
- introduce symbolic return values
- code: introduce generic argument number checks
- (re)introduce depinst command
- fix problem with prt-get fsearch: symlink'ed files are found as well
- print output while logging (Patch from Logan)
- redirect output of InstallTransaction::installPackage to log file
- add %v (version) and %r (release) patterns to the log file name
- fix typo in man page: %d in printf used for desc and deps
- check for pre-install and post-install
- store in cache (-> cache version update)
- show in prt-get info
- enable in prt-get printf, using %E (prE) and %O (pOst)
* 0.5.3p2 29.09.2003 Johannes Winkelmann
- Fix little bug in prt-get printf: don't print out empty lines (even if
there's a newline char)
* 0.5.3p1 25.09.2003 Johannes Winkelmann
- Adapt new patch naming
- Be more clever when calling prt-get diff with a filter
* 0.5.3 01.09.2003 Johannes Winkelmann
- Add 'remove' feature
- implement pre/post install execution
- prt-get diff doesn't display locked; use --all if you want them
- Fix bug in repository initialization when pkgdirs were specified twice
* 0.5.2 not used ;-)
* 0.5.1a 08.08.2003 Johannes Winkelmann
- Fix for gcc 3.3
* 0.5.1 09.07.2003 Johannes Winkelmann
- use PKGMK_PACKAGE_DIR
* 0.5.0 22.06.2003 Johannes Winkelmann
- update to fit new CLC project
(pre3)
- made bash completion work with ls, cat and edit
(pre2)
- sort ls output
(pre1)
- introduced new commands: ls, cat, edit
- fixed an empty error message in argparser
* 0.4.4c 08.05.2003 Johannes Winkelmann
- Fixed an ugly bug: no error messages shown when logging enabled
* 0.4.4b 08.05.2003 Johannes Winkelmann
- Change mode of created directories from 0711 to 0755
* 0.4.4a 05.05.2003 Johannes Winkelmann
- Change $PKGDEST to $PACKAGE_DIR
* 0.4.4 01.05.2003 Johannes Winkelmann
- add support for PKGDEST
- add lock/unlock and listlocked commands
- better parsing of arguments
- small update of the argument parser
* Reimported after disk crash; 07.04.2003
* 0.4.3 18.02.2003 Johannes Winkelmann
- fixed bug in dependent: it split the list wrongly
- new command: fsearch: search for file names in ports tree
- speed fix in Package: don't load() in name() and path()
- cosmetical changes to the help screen
* 0.4.2a 06.02.2003 Johannes Winkelmann
- fixed bug in dependent: it looked just for a substring, so pkgconfig whould
also be a match for 'dependent gconf', as it contains gconf...
* 0.4.2 06.02.2003 Johannes Winkelmann
- Fixed a segfault when no pkg database file available
* 0.4.1 20.01.2003 Johannes Winkelmann
- added small speed fix to printDiff
- added missing include in configuration.cpp
- enable clc ports by default
- added misc dir to DIST
* 0.4.0pre2 14.01.2003 Johannes Winkelmann
- fixed segfault when no m_currentTransaction
* 0.4.0pre2 13.01.2003 Johannes Winkelmann
- fixed --listall -> --all switch on help page
- completed SignalDispatcher
- made PrtGet a SubClass of SignalHandler
- feedback on Ctrl-C
- fixed performance problems by not copying lists
* 0.4.0pre1 13.01.2003 Johannes Winkelmann
- update man page
* 0.4.0alpha4 13.01.2003 Johannes Winkelmann
- removed find command
- list can have a wildcard filter
- renamed --listall switch to --all for dependent
- implemented wildcards for listinst
* 0.4.0alpha3 13.01.2003 Johannes Winkelmann
- added --listall switch for dependent; don't show only installed ports
- corrected help once more
- added LockFile class
- added check for Pkgfile in Port directory
- added expandWildcard*() methods
- enabled wildcards for diff
- implemented 'current' command
* 0.4.0alpha2 05.01.2003 Johannes Winkelmann
- added --filter="..." option used in printf
- added sysup command (refactoring required)
- updated help output
- added signal dispatcher
- new cache file format (newline separated)
- cache file versioning
- support for maintainer and packager in info and printf
- support for hasReadme in printf
- fixed bug in Pkgfile parser (whitespaces before version, name and rev)
- better format for prt-get help
* 0.4.0alpha1 04.01.2003 Johannes Winkelmann
- added find command (searching using wildcards),
- Repository::getMatchingPackages() (wildcard match)
- added data object for package
* 0.3.5c 28.12.2002 Johannes Winkelmann
- fixed bug: pkgadd was called even if pkgmk failed... there since 0.3.4
* 0.3.5b 28.12.2002 Johannes Winkelmann
- fixed bug in writeCache()
* 0.3.5a 23.12.2002 Johannes Winkelmann
- dependent -> help page
* 0.3.5 04.12.2002 Johannes Winkelmann
- added readme command
- info shows whether there is a README file
- added readme info to cache file (-> new format)
- added (README) to install/update output
- fixed a memory leak
- introduced configuration object
- exchanged result printing order ("Packages already installed" before
"Packages installed now"
- added dependent command: show which packages depend on argument
- corrected ugly copy and paste errors in "<command> takes only one arg..."
- added misc/prt-edit (not installed)
- new manual format, not included anymore
* 0.3.4c 02.12.2002 Johannes Winkelmann
- corrected typo in manual
- added logging options to default prt-get.conf
- added --sort option for printf
* 0.3.4b 02.12.2002 Johannes Winkelmann
- printf replaces \t and \n
- small change in StringHelper::replaceAll()
- listinst -vv prints description
- listinst documentation update
- --log doc update
- cleanups (using StringHelper::replaceAll())
- add bash completion file
* 0.3.4a 30.11.2002 Johannes Winkelmann
- small change in printf (%i expands to "diff")
* 0.3.4 10.11.2002 Johannes Winkelmann
- implemented new printf function
- corrected usage output (removed "," characters)
- added StringHelper::replaceAll(..)
- log feature
- added %p in logfile
* 0.3.3 27.08.2002 Johannes Winkelmann
- implemented a returnValue() method in PrtGet
- prt-get isinst no longer returns "... is not installed" to be more
consistent with "pkginfo -i|grep ...", but returns 1 when a package is not
installed (1 = general error).
- allow dependencies to be commented out when starting with #. THINK ABOUT
THIS SOME MORE
* 0.3.2 15.07.2002 Johannes Winkelmann
- changed example prt-get.conf again
- added another example to the manual
- added doxygen api documentation
- various code cleanups
- output fix for prt-get diff (title not printed if no difference)
- added tests for process and stringhelper class
- added _very_ simple version checking in prt-get diff
- return values on errors (=1)
- no output for prt-get isinst if package not installed (to be consistent with
pkginfo)
- gcc 3.2 fixes
* 0.3.1a 15.07.2002 Johannes Winkelmann
- changed example prt-get.conf to meet the new format...
* 0.3.1 13.07.2002 Johannes Winkelmann
- Fixed some conditions where Valgrind reported errors
* 0.3.1pre2 10.07.2002 Johannes Winkelmann
- Fixed another bug in the process execution
- proper implementation of process execution :-)
- improved StringHelper::split()
* 0.3.1pre1 08.07.2002 Johannes Winkelmann
- listinst
- new config file format (can use alternate location for cache)
- removed depinst skeletion
* 0.3.0 05.07.2002 Johannes Winkelmann
- added cache feature
- moved string functions to stringhelper
- Makefile.am includes code to create a symlink from prt-get to prt-cache
- If prt-get is called as prt-cache, it uses the caching all the time
- added man page for prt-cache
- added package filter functionality in prt-get-conf
- added man page for prt-get.conf
- comments are removed in prt-get.conf
- added check whether cache is outdated (config file changed after cache
generated)
- added check for 'prt-get diff <packagelist>' that the packages listed
are really installed
- added path command
- print errors to stderr
- always exit( -1 ) on error
* 0.3.0pre2 03.07.2002 Johannes Winkelmann
- Fixed bug when release or version had a comment on the same line
* 0.3.0pre1 02.07.2002 Johannes Winkelman
- Changed format of TODO, so others can understand it as well :-)
- added version command
* 0.2.9 01.07.2002 Johannes Winkelmann
- If files are rejected during update, prt-get no longer says "update failed"
- implemented dsearch feature (to search descriptions)
- Fixed a bug in prt-get depends (empty listing instead of warning when
invalid package given)
* 0.2.8 30.06.2002 Johannes Winkelmann
- moved to autoconf/automake
* 0.2.7 28.06.2002 Johannes Winkelmann
- added a man page
- adjusted message of install/update
decided to go up to .7, as I made some errors in the release of .6
* 0.2.6 28.06.2002 Johannes Winkelmann
- added --test switch: doing no installation, just prints out the result
- added quickdiff feature, printing out a list of installed packages to be
updated: use it for prt-get update `prt-get quickdiff`
* 0.2.5 28.06.2002 Johannes Winkelmann
- removed depinst feature (maybe reimplemented soon)
- it is now possible to pass a list of arguments to
prt-get install
prt-get depends/quickdep
- implemented -v and -vv in prt-get list
- implemented -v for prt-get search (show description as well)
- lazy initialization of repository -> speed improvement
- removed --args switch, added --margs and --aargs switches for pkgmk and
pkgadd respectively
* 0.2.4 24.06.2002 Johannes Winkelmann
- fixed segfault when having cyclic dependecies
* 0.2.3 24.06.2002 Johannes Winkelmann
- added --config=<conffile> option
- added prt-get update feature
- added prt-get quickdep feature
- added prt-get diff feature
* 0.2.2 24.06.2002 Johannes Winkelmann
- Fixed segfault in depends
* 0.2.1 23.06.2002 Johannes Winkelmann
- added config file /etc/prt-get.conf
* 0.2 22.06.2002 Johannes Winkelmann
- C++ port
* 0.1.1 22.06.2002 Johannes Winkelmann
- moved install to InstallTransaction
* 0.1 21.06.2002 Johannes Winkelmann
- First release

8
FAQ Normal file
View File

@ -0,0 +1,8 @@
Q: Why are there no wildcards for install/update/grpinst
A: Because you don't want it (dependencies)
Q: Why is there no prt-get depinst?
A:
Q: Why is there no GUI or shared lib for/of prt-get?
A:

6
INSTALL Normal file
View File

@ -0,0 +1,6 @@
Installing prt-get
------------------
Installing prt-get is just a matter of
./configure
make
make install

279
LICENSE Normal file
View File

@ -0,0 +1,279 @@
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.

7
Makefile.am Normal file
View File

@ -0,0 +1,7 @@
AUTOMAKE_OPTIONS = foreign
MAINTAINERCLEANFILES = aclocal.m4 config.h.in configure Makefile.in stamp-h.in
SUBDIRS = src doc misc
EXTRA_DIST = CREDITS FAQ LICENSE

580
Makefile.in Normal file
View File

@ -0,0 +1,580 @@
# Makefile.in generated by automake 1.9.5 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = .
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
subdir = .
DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in $(srcdir)/config.h.in \
$(top_srcdir)/configure AUTHORS ChangeLog INSTALL TODO depcomp \
install-sh missing mkinstalldirs
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
configure.lineno configure.status.lineno
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = config.h
CONFIG_CLEAN_FILES =
SOURCES =
DIST_SOURCES =
RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
html-recursive info-recursive install-data-recursive \
install-exec-recursive install-info-recursive \
install-recursive installcheck-recursive installdirs-recursive \
pdf-recursive ps-recursive uninstall-info-recursive \
uninstall-recursive
ETAGS = etags
CTAGS = ctags
DIST_SUBDIRS = $(SUBDIRS)
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
distdir = $(PACKAGE)-$(VERSION)
top_distdir = $(distdir)
am__remove_distdir = \
{ test ! -d $(distdir) \
|| { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \
&& rm -fr $(distdir); }; }
DIST_ARCHIVES = $(distdir).tar.gz
GZIP_ENV = --best
distuninstallcheck_listfiles = find . -type f -print
distcleancheck_listfiles = find . -type f -print
ACLOCAL = @ACLOCAL@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build_alias = @build_alias@
datadir = @datadir@
exec_prefix = @exec_prefix@
host_alias = @host_alias@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
AUTOMAKE_OPTIONS = foreign
MAINTAINERCLEANFILES = aclocal.m4 config.h.in configure Makefile.in stamp-h.in
SUBDIRS = src doc misc
EXTRA_DIST = CREDITS FAQ LICENSE
all: config.h
$(MAKE) $(AM_MAKEFLAGS) all-recursive
.SUFFIXES:
am--refresh:
@:
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
echo ' cd $(srcdir) && $(AUTOMAKE) --foreign '; \
cd $(srcdir) && $(AUTOMAKE) --foreign \
&& exit 0; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \
cd $(top_srcdir) && \
$(AUTOMAKE) --foreign Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
echo ' $(SHELL) ./config.status'; \
$(SHELL) ./config.status;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
$(SHELL) ./config.status --recheck
$(top_srcdir)/configure: $(am__configure_deps)
cd $(srcdir) && $(AUTOCONF)
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
config.h: stamp-h1
@if test ! -f $@; then \
rm -f stamp-h1; \
$(MAKE) stamp-h1; \
else :; fi
stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
@rm -f stamp-h1
cd $(top_builddir) && $(SHELL) ./config.status config.h
$(srcdir)/config.h.in: $(am__configure_deps)
cd $(top_srcdir) && $(AUTOHEADER)
rm -f stamp-h1
touch $@
distclean-hdr:
-rm -f config.h stamp-h1
uninstall-info-am:
# This directory's subdirectories are mostly independent; you can cd
# into them and run `make' without going through this Makefile.
# To change the values of `make' variables: instead of editing Makefiles,
# (1) if the variable is set in `config.status', edit `config.status'
# (which will cause the Makefiles to be regenerated when you run `make');
# (2) otherwise, pass the desired values on the `make' command line.
$(RECURSIVE_TARGETS):
@failcom='exit 1'; \
for f in x $$MAKEFLAGS; do \
case $$f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
dot_seen=no; \
target=`echo $@ | sed s/-recursive//`; \
list='$(SUBDIRS)'; for subdir in $$list; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
dot_seen=yes; \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| eval $$failcom; \
done; \
if test "$$dot_seen" = "no"; then \
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
fi; test -z "$$fail"
mostlyclean-recursive clean-recursive distclean-recursive \
maintainer-clean-recursive:
@failcom='exit 1'; \
for f in x $$MAKEFLAGS; do \
case $$f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
dot_seen=no; \
case "$@" in \
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
*) list='$(SUBDIRS)' ;; \
esac; \
rev=''; for subdir in $$list; do \
if test "$$subdir" = "."; then :; else \
rev="$$subdir $$rev"; \
fi; \
done; \
rev="$$rev ."; \
target=`echo $@ | sed s/-recursive//`; \
for subdir in $$rev; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| eval $$failcom; \
done && test -z "$$fail"
tags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
done
ctags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
done
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
include_option=--etags-include; \
empty_fix=.; \
else \
include_option=--include; \
empty_fix=; \
fi; \
list='$(SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test ! -f $$subdir/TAGS || \
tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
fi; \
done; \
list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique; \
fi
ctags: CTAGS
CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$tags $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& cd $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
$(am__remove_distdir)
mkdir $(distdir)
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
case $$file in \
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
dir="/$$dir"; \
$(mkdir_p) "$(distdir)$$dir"; \
else \
dir=''; \
fi; \
if test -d $$d/$$file; then \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test -d "$(distdir)/$$subdir" \
|| $(mkdir_p) "$(distdir)/$$subdir" \
|| exit 1; \
distdir=`$(am__cd) $(distdir) && pwd`; \
top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
(cd $$subdir && \
$(MAKE) $(AM_MAKEFLAGS) \
top_distdir="$$top_distdir" \
distdir="$$distdir/$$subdir" \
distdir) \
|| exit 1; \
fi; \
done
-find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
! -type d ! -perm -400 -exec chmod a+r {} \; -o \
! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \
|| chmod -R a+r $(distdir)
dist-gzip: distdir
tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
$(am__remove_distdir)
dist-bzip2: distdir
tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2
$(am__remove_distdir)
dist-tarZ: distdir
tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
$(am__remove_distdir)
dist-shar: distdir
shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
$(am__remove_distdir)
dist-zip: distdir
-rm -f $(distdir).zip
zip -rq $(distdir).zip $(distdir)
$(am__remove_distdir)
dist dist-all: distdir
tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
$(am__remove_distdir)
# This target untars the dist file and tries a VPATH configuration. Then
# it guarantees that the distribution is self-contained by making another
# tarfile.
distcheck: dist
case '$(DIST_ARCHIVES)' in \
*.tar.gz*) \
GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\
*.tar.bz2*) \
bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\
*.tar.Z*) \
uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
*.shar.gz*) \
GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\
*.zip*) \
unzip $(distdir).zip ;;\
esac
chmod -R a-w $(distdir); chmod a+w $(distdir)
mkdir $(distdir)/_build
mkdir $(distdir)/_inst
chmod a-w $(distdir)
dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
&& dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
&& cd $(distdir)/_build \
&& ../configure --srcdir=.. --prefix="$$dc_install_base" \
$(DISTCHECK_CONFIGURE_FLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) dvi \
&& $(MAKE) $(AM_MAKEFLAGS) check \
&& $(MAKE) $(AM_MAKEFLAGS) install \
&& $(MAKE) $(AM_MAKEFLAGS) installcheck \
&& $(MAKE) $(AM_MAKEFLAGS) uninstall \
&& $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
distuninstallcheck \
&& chmod -R a-w "$$dc_install_base" \
&& ({ \
(cd ../.. && umask 077 && mkdir "$$dc_destdir") \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
} || { rm -rf "$$dc_destdir"; exit 1; }) \
&& rm -rf "$$dc_destdir" \
&& $(MAKE) $(AM_MAKEFLAGS) dist \
&& rm -rf $(DIST_ARCHIVES) \
&& $(MAKE) $(AM_MAKEFLAGS) distcleancheck
$(am__remove_distdir)
@(echo "$(distdir) archives ready for distribution: "; \
list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
sed -e '1{h;s/./=/g;p;x;}' -e '$${p;x;}'
distuninstallcheck:
@cd $(distuninstallcheck_dir) \
&& test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
|| { echo "ERROR: files left after uninstall:" ; \
if test -n "$(DESTDIR)"; then \
echo " (check DESTDIR support)"; \
fi ; \
$(distuninstallcheck_listfiles) ; \
exit 1; } >&2
distcleancheck: distclean
@if test '$(srcdir)' = . ; then \
echo "ERROR: distcleancheck can only run from a VPATH build" ; \
exit 1 ; \
fi
@test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
|| { echo "ERROR: files left in build directory after distclean:" ; \
$(distcleancheck_listfiles) ; \
exit 1; } >&2
check-am: all-am
check: check-recursive
all-am: Makefile config.h
installdirs: installdirs-recursive
installdirs-am:
install: install-recursive
install-exec: install-exec-recursive
install-data: install-data-recursive
uninstall: uninstall-recursive
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-recursive
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
-test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
clean: clean-recursive
clean-am: clean-generic mostlyclean-am
distclean: distclean-recursive
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
-rm -f Makefile
distclean-am: clean-am distclean-generic distclean-hdr distclean-tags
dvi: dvi-recursive
dvi-am:
html: html-recursive
info: info-recursive
info-am:
install-data-am:
install-exec-am:
install-info: install-info-recursive
install-man:
installcheck-am:
maintainer-clean: maintainer-clean-recursive
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
-rm -rf $(top_srcdir)/autom4te.cache
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-recursive
mostlyclean-am: mostlyclean-generic
pdf: pdf-recursive
pdf-am:
ps: ps-recursive
ps-am:
uninstall-am: uninstall-info-am
uninstall-info: uninstall-info-recursive
.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am am--refresh check \
check-am clean clean-generic clean-recursive ctags \
ctags-recursive dist dist-all dist-bzip2 dist-gzip dist-shar \
dist-tarZ dist-zip distcheck distclean distclean-generic \
distclean-hdr distclean-recursive distclean-tags \
distcleancheck distdir distuninstallcheck dvi dvi-am html \
html-am info info-am install install-am install-data \
install-data-am install-exec install-exec-am install-info \
install-info-am install-man install-strip installcheck \
installcheck-am installdirs installdirs-am maintainer-clean \
maintainer-clean-generic maintainer-clean-recursive \
mostlyclean mostlyclean-generic mostlyclean-recursive pdf \
pdf-am ps ps-am tags tags-recursive uninstall uninstall-am \
uninstall-info-am
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

39
README Normal file
View File

@ -0,0 +1,39 @@
PRT-GET OVERVIEW:
(Johannes Winkelmann, jw@tks6.net)
Description:
------------
prt-get is a utility which is meant to be used with the pkgutils and
ports from crux (http://crux.nu). It offers some simplification over
pure pkgmk, but might hide some interesting details about the install
process.
Installing:
-----------
Just install the crux port from
- http://www.hta-bi.bfh.ch/~winkj/files/crux/prt-get.prt.gz
prt-get has to know where to look for ports. You can specify those in
/etc/prt-get.conf, one directory per line. Note that the order
matters, when the same port is in multiple direcories
(e.g. /usr/ports/contrib/mutt and /usr/ports/local/mutt), the one
found _first_ will be used.
Feel free to contact me in case of problems (jw@tks6.net)
more information
----------------
See the man pages for prt-get(8), prt-get.conf(5) and prt-cache for more
information. There is also a user manual in the doc directory (as a
tex file). This document should also be available as PDF from
http://www.hta-bi.bfh.ch/~winkj/files/crux/manual.pdf
"it must be user error" (thinkgeek)
-----------------------------------
port directories may only contain ports, or else prt-get can fail (which
means that nothing is installed, your system takes no harm). The reason
for this is because the additional checking slows down the application
too much

123
TODO Normal file
View File

@ -0,0 +1,123 @@
- add support to "prefer higher" for certain packages ?
next release:
- configuration override/extend
[20:01] <cptn> --config-add="prtdir /tmp" even
[20:01] <cptn> --config-set="logfile /tmp/%n.log"
[20:14] <cptn> prt-get --config-set="prtdir /tmp" \
--config-add="prtdir /usr"
[20:14] <cptn> the 'set' would delete the config file's prtdir settings
Don't bail out if no prt-get.conf is found if the user specified
--config-* options
enum KindOfConfig {ADD, SET}
argparser: user addConfig(string, KindOfConfig);
config: go through additional configuration options; add and/or replace
1.0.0
- sysup
- allow injecting of new (uninstalled) dependencies
- allow to prohibit recompilation of packages when a dependency failed
to be updated in this sysup run
- better reports (installed/failed/not even tried to install)
[ ] message log for prt-get messages ?
[ ] timestamps for the log file
[ ] --quiet mode; suppress output of pkgmk and pkgadd
[ ] prt-get diff stats: "100 Packages with differences"
---------------------------
later
- parallel download (mt)
- download only
- group support
- Actions/Commands
- Help per command
- Dynamic command binding
- Make InstallTransaction a real install transaction:
- rollback pre-install if package building failed
- needs heavy refactoring to be easier to understand/maintain
- Test mode: global (is duplicated right now)
- remove should be in a transaction as well
- remove transaction
- install transaction
- etc.
- Transaction handler
- better examples for man page
- reorder message to avoid losing the important bits when installing
_lots_ of packages; maybe also think about forgeting not so
important things like packages installed before etc
[ ] prt-get rm and cd
[ ] cache file class, help class
[ ] interrupt handler (ctrl-c) kill pkgmk/pkgadd, delete lock files, say
"prt-get: action cancelled"; warn when cancel during download ->
STATE variable, separate download and build.
[ ] lock files for log, cache (lock file class)
[ ] move command name out of execTransaction (would be wrong for e.g.
sysup)
SHORT TERM
------------
* Answer FAQs
* create a fileExists(), createDir() etc helper class
* questions
- should the install/update result include the version/release?
* cosmetic
- move all output messages to prtget.cpp (away from main.cpp)
- remove "using namespace std" from header file
* test
- add asserts
* functional
- check exit messages (strings). always add 'prt-get'
* refactor
- check operations in prtget.cpp for common code
- make InstallTransaction more modular (download/build/install)
LONG TERM
------------------------------
* remove quickdiff
* move find command into list --filter="..." ???
* symbolic exit codes
* new commands:
* questions:
- should there be a install/update mixed to mode, to install and update,
which ever method is needed?
- namespace prtget ?
- remove the path:package1, package2 filter functionality from the
config file again. This could be done by creating another ports
directories an creation symlinks there to. Could improve performance
- might people like ansi colors?
* new features
- list shadow packages (dup) for arguments
* - rebuild all ports using dependency information
LONG LONG TERM
--------------
- parallel download for installing/updating multiple packages (at least
download of 2nd package while building first)

862
aclocal.m4 vendored Normal file
View File

@ -0,0 +1,862 @@
# generated automatically by aclocal 1.9.5 -*- Autoconf -*-
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
# 2005 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
# Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# AM_AUTOMAKE_VERSION(VERSION)
# ----------------------------
# Automake X.Y traces this macro to ensure aclocal.m4 has been
# generated from the m4 files accompanying Automake X.Y.
AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version="1.9"])
# AM_SET_CURRENT_AUTOMAKE_VERSION
# -------------------------------
# Call AM_AUTOMAKE_VERSION so it can be traced.
# This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
[AM_AUTOMAKE_VERSION([1.9.5])])
# AM_AUX_DIR_EXPAND -*- Autoconf -*-
# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to
# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
#
# Of course, Automake must honor this variable whenever it calls a
# tool from the auxiliary directory. The problem is that $srcdir (and
# therefore $ac_aux_dir as well) can be either absolute or relative,
# depending on how configure is run. This is pretty annoying, since
# it makes $ac_aux_dir quite unusable in subdirectories: in the top
# source directory, any form will work fine, but in subdirectories a
# relative path needs to be adjusted first.
#
# $ac_aux_dir/missing
# fails when called from a subdirectory if $ac_aux_dir is relative
# $top_srcdir/$ac_aux_dir/missing
# fails if $ac_aux_dir is absolute,
# fails when called from a subdirectory in a VPATH build with
# a relative $ac_aux_dir
#
# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
# are both prefixed by $srcdir. In an in-source build this is usually
# harmless because $srcdir is `.', but things will broke when you
# start a VPATH build or use an absolute $srcdir.
#
# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
# iff we strip the leading $srcdir from $ac_aux_dir. That would be:
# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
# and then we would define $MISSING as
# MISSING="\${SHELL} $am_aux_dir/missing"
# This will work as long as MISSING is not called from configure, because
# unfortunately $(top_srcdir) has no meaning in configure.
# However there are other variables, like CC, which are often used in
# configure, and could therefore not use this "fixed" $ac_aux_dir.
#
# Another solution, used here, is to always expand $ac_aux_dir to an
# absolute PATH. The drawback is that using absolute paths prevent a
# configured tree to be moved without reconfiguration.
AC_DEFUN([AM_AUX_DIR_EXPAND],
[dnl Rely on autoconf to set up CDPATH properly.
AC_PREREQ([2.50])dnl
# expand $ac_aux_dir to an absolute path
am_aux_dir=`cd $ac_aux_dir && pwd`
])
# AM_CONDITIONAL -*- Autoconf -*-
# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005
# Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 7
# AM_CONDITIONAL(NAME, SHELL-CONDITION)
# -------------------------------------
# Define a conditional.
AC_DEFUN([AM_CONDITIONAL],
[AC_PREREQ(2.52)dnl
ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])],
[$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
AC_SUBST([$1_TRUE])
AC_SUBST([$1_FALSE])
if $2; then
$1_TRUE=
$1_FALSE='#'
else
$1_TRUE='#'
$1_FALSE=
fi
AC_CONFIG_COMMANDS_PRE(
[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
AC_MSG_ERROR([[conditional "$1" was never defined.
Usually this means the macro was only invoked conditionally.]])
fi])])
# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
# Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 8
# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
# written in clear, in which case automake, when reading aclocal.m4,
# will think it sees a *use*, and therefore will trigger all it's
# C support machinery. Also note that it means that autoscan, seeing
# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
# _AM_DEPENDENCIES(NAME)
# ----------------------
# See how the compiler implements dependency checking.
# NAME is "CC", "CXX", "GCJ", or "OBJC".
# We try a few techniques and use that to set a single cache variable.
#
# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
# dependency, and given that the user is not expected to run this macro,
# just rely on AC_PROG_CC.
AC_DEFUN([_AM_DEPENDENCIES],
[AC_REQUIRE([AM_SET_DEPDIR])dnl
AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
AC_REQUIRE([AM_MAKE_INCLUDE])dnl
AC_REQUIRE([AM_DEP_TRACK])dnl
ifelse([$1], CC, [depcc="$CC" am_compiler_list=],
[$1], CXX, [depcc="$CXX" am_compiler_list=],
[$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
[$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'],
[depcc="$$1" am_compiler_list=])
AC_CACHE_CHECK([dependency style of $depcc],
[am_cv_$1_dependencies_compiler_type],
[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
# We make a subdir and do the tests there. Otherwise we can end up
# making bogus files that we don't know about and never remove. For
# instance it was reported that on HP-UX the gcc test will end up
# making a dummy file named `D' -- because `-MD' means `put the output
# in D'.
mkdir conftest.dir
# Copy depcomp to subdir because otherwise we won't find it if we're
# using a relative directory.
cp "$am_depcomp" conftest.dir
cd conftest.dir
# We will build objects and dependencies in a subdirectory because
# it helps to detect inapplicable dependency modes. For instance
# both Tru64's cc and ICC support -MD to output dependencies as a
# side effect of compilation, but ICC will put the dependencies in
# the current directory while Tru64 will put them in the object
# directory.
mkdir sub
am_cv_$1_dependencies_compiler_type=none
if test "$am_compiler_list" = ""; then
am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
fi
for depmode in $am_compiler_list; do
# Setup a source with many dependencies, because some compilers
# like to wrap large dependency lists on column 80 (with \), and
# we should not choose a depcomp mode which is confused by this.
#
# We need to recreate these files for each test, as the compiler may
# overwrite some of them when testing with obscure command lines.
# This happens at least with the AIX C compiler.
: > sub/conftest.c
for i in 1 2 3 4 5 6; do
echo '#include "conftst'$i'.h"' >> sub/conftest.c
# Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
# Solaris 8's {/usr,}/bin/sh.
touch sub/conftst$i.h
done
echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
case $depmode in
nosideeffect)
# after this tag, mechanisms are not by side-effect, so they'll
# only be used when explicitly requested
if test "x$enable_dependency_tracking" = xyes; then
continue
else
break
fi
;;
none) break ;;
esac
# We check with `-c' and `-o' for the sake of the "dashmstdout"
# mode. It turns out that the SunPro C++ compiler does not properly
# handle `-M -o', and we need to detect this.
if depmode=$depmode \
source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
$SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
>/dev/null 2>conftest.err &&
grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
${MAKE-make} -s -f confmf > /dev/null 2>&1; then
# icc doesn't choke on unknown options, it will just issue warnings
# or remarks (even with -Werror). So we grep stderr for any message
# that says an option was ignored or not supported.
# When given -MP, icc 7.0 and 7.1 complain thusly:
# icc: Command line warning: ignoring option '-M'; no argument required
# The diagnosis changed in icc 8.0:
# icc: Command line remark: option '-MP' not supported
if (grep 'ignoring option' conftest.err ||
grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
am_cv_$1_dependencies_compiler_type=$depmode
break
fi
fi
done
cd ..
rm -rf conftest.dir
else
am_cv_$1_dependencies_compiler_type=none
fi
])
AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
AM_CONDITIONAL([am__fastdep$1], [
test "x$enable_dependency_tracking" != xno \
&& test "$am_cv_$1_dependencies_compiler_type" = gcc3])
])
# AM_SET_DEPDIR
# -------------
# Choose a directory name for dependency files.
# This macro is AC_REQUIREd in _AM_DEPENDENCIES
AC_DEFUN([AM_SET_DEPDIR],
[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
])
# AM_DEP_TRACK
# ------------
AC_DEFUN([AM_DEP_TRACK],
[AC_ARG_ENABLE(dependency-tracking,
[ --disable-dependency-tracking speeds up one-time build
--enable-dependency-tracking do not reject slow dependency extractors])
if test "x$enable_dependency_tracking" != xno; then
am_depcomp="$ac_aux_dir/depcomp"
AMDEPBACKSLASH='\'
fi
AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
AC_SUBST([AMDEPBACKSLASH])
])
# Generate code to set up dependency tracking. -*- Autoconf -*-
# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
# Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
#serial 3
# _AM_OUTPUT_DEPENDENCY_COMMANDS
# ------------------------------
AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
[for mf in $CONFIG_FILES; do
# Strip MF so we end up with the name of the file.
mf=`echo "$mf" | sed -e 's/:.*$//'`
# Check whether this is an Automake generated Makefile or not.
# We used to match only the files named `Makefile.in', but
# some people rename them; so instead we look at the file content.
# Grep'ing the first line is not enough: some people post-process
# each Makefile.in and add a new line on top of each file to say so.
# So let's grep whole file.
if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then
dirpart=`AS_DIRNAME("$mf")`
else
continue
fi
# Extract the definition of DEPDIR, am__include, and am__quote
# from the Makefile without running `make'.
DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
test -z "$DEPDIR" && continue
am__include=`sed -n 's/^am__include = //p' < "$mf"`
test -z "am__include" && continue
am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
# When using ansi2knr, U may be empty or an underscore; expand it
U=`sed -n 's/^U = //p' < "$mf"`
# Find all dependency output files, they are included files with
# $(DEPDIR) in their names. We invoke sed twice because it is the
# simplest approach to changing $(DEPDIR) to its actual value in the
# expansion.
for file in `sed -n "
s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
# Make sure the directory exists.
test -f "$dirpart/$file" && continue
fdir=`AS_DIRNAME(["$file"])`
AS_MKDIR_P([$dirpart/$fdir])
# echo "creating $dirpart/$file"
echo '# dummy' > "$dirpart/$file"
done
done
])# _AM_OUTPUT_DEPENDENCY_COMMANDS
# AM_OUTPUT_DEPENDENCY_COMMANDS
# -----------------------------
# This macro should only be invoked once -- use via AC_REQUIRE.
#
# This code is only required when automatic dependency tracking
# is enabled. FIXME. This creates each `.P' file that we will
# need in order to bootstrap the dependency handling code.
AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
[AC_CONFIG_COMMANDS([depfiles],
[test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
[AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
])
# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005
# Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 8
# AM_CONFIG_HEADER is obsolete. It has been replaced by AC_CONFIG_HEADERS.
AU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)])
# Do all the work for Automake. -*- Autoconf -*-
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
# Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 12
# This macro actually does too much. Some checks are only needed if
# your package does certain things. But this isn't really a big deal.
# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
# AM_INIT_AUTOMAKE([OPTIONS])
# -----------------------------------------------
# The call with PACKAGE and VERSION arguments is the old style
# call (pre autoconf-2.50), which is being phased out. PACKAGE
# and VERSION should now be passed to AC_INIT and removed from
# the call to AM_INIT_AUTOMAKE.
# We support both call styles for the transition. After
# the next Automake release, Autoconf can make the AC_INIT
# arguments mandatory, and then we can depend on a new Autoconf
# release and drop the old call support.
AC_DEFUN([AM_INIT_AUTOMAKE],
[AC_PREREQ([2.58])dnl
dnl Autoconf wants to disallow AM_ names. We explicitly allow
dnl the ones we care about.
m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
AC_REQUIRE([AC_PROG_INSTALL])dnl
# test to see if srcdir already configured
if test "`cd $srcdir && pwd`" != "`pwd`" &&
test -f $srcdir/config.status; then
AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
fi
# test whether we have cygpath
if test -z "$CYGPATH_W"; then
if (cygpath --version) >/dev/null 2>/dev/null; then
CYGPATH_W='cygpath -w'
else
CYGPATH_W=echo
fi
fi
AC_SUBST([CYGPATH_W])
# Define the identity of the package.
dnl Distinguish between old-style and new-style calls.
m4_ifval([$2],
[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
AC_SUBST([PACKAGE], [$1])dnl
AC_SUBST([VERSION], [$2])],
[_AM_SET_OPTIONS([$1])dnl
AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
_AM_IF_OPTION([no-define],,
[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
# Some tools Automake needs.
AC_REQUIRE([AM_SANITY_CHECK])dnl
AC_REQUIRE([AC_ARG_PROGRAM])dnl
AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
AM_MISSING_PROG(AUTOCONF, autoconf)
AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
AM_MISSING_PROG(AUTOHEADER, autoheader)
AM_MISSING_PROG(MAKEINFO, makeinfo)
AM_PROG_INSTALL_SH
AM_PROG_INSTALL_STRIP
AC_REQUIRE([AM_PROG_MKDIR_P])dnl
# We need awk for the "check" target. The system "awk" is bad on
# some platforms.
AC_REQUIRE([AC_PROG_AWK])dnl
AC_REQUIRE([AC_PROG_MAKE_SET])dnl
AC_REQUIRE([AM_SET_LEADING_DOT])dnl
_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
[_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
[_AM_PROG_TAR([v7])])])
_AM_IF_OPTION([no-dependencies],,
[AC_PROVIDE_IFELSE([AC_PROG_CC],
[_AM_DEPENDENCIES(CC)],
[define([AC_PROG_CC],
defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
AC_PROVIDE_IFELSE([AC_PROG_CXX],
[_AM_DEPENDENCIES(CXX)],
[define([AC_PROG_CXX],
defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
])
])
# When config.status generates a header, we must update the stamp-h file.
# This file resides in the same directory as the config header
# that is generated. The stamp files are numbered to have different names.
# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
# loop where config.status creates the headers, so we can generate
# our stamp files there.
AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
[# Compute $1's index in $config_headers.
_am_stamp_count=1
for _am_header in $config_headers :; do
case $_am_header in
$1 | $1:* )
break ;;
* )
_am_stamp_count=`expr $_am_stamp_count + 1` ;;
esac
done
echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count])
# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# AM_PROG_INSTALL_SH
# ------------------
# Define $install_sh.
AC_DEFUN([AM_PROG_INSTALL_SH],
[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
install_sh=${install_sh-"$am_aux_dir/install-sh"}
AC_SUBST(install_sh)])
# Copyright (C) 2003, 2005 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 2
# Check whether the underlying file-system supports filenames
# with a leading dot. For instance MS-DOS doesn't.
AC_DEFUN([AM_SET_LEADING_DOT],
[rm -rf .tst 2>/dev/null
mkdir .tst 2>/dev/null
if test -d .tst; then
am__leading_dot=.
else
am__leading_dot=_
fi
rmdir .tst 2>/dev/null
AC_SUBST([am__leading_dot])])
# Check to see how 'make' treats includes. -*- Autoconf -*-
# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 3
# AM_MAKE_INCLUDE()
# -----------------
# Check to see how make treats includes.
AC_DEFUN([AM_MAKE_INCLUDE],
[am_make=${MAKE-make}
cat > confinc << 'END'
am__doit:
@echo done
.PHONY: am__doit
END
# If we don't find an include directive, just comment out the code.
AC_MSG_CHECKING([for style of include used by $am_make])
am__include="#"
am__quote=
_am_result=none
# First try GNU make style include.
echo "include confinc" > confmf
# We grep out `Entering directory' and `Leaving directory'
# messages which can occur if `w' ends up in MAKEFLAGS.
# In particular we don't look at `^make:' because GNU make might
# be invoked under some other name (usually "gmake"), in which
# case it prints its new name instead of `make'.
if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then
am__include=include
am__quote=
_am_result=GNU
fi
# Now try BSD make style include.
if test "$am__include" = "#"; then
echo '.include "confinc"' > confmf
if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
am__include=.include
am__quote="\""
_am_result=BSD
fi
fi
AC_SUBST([am__include])
AC_SUBST([am__quote])
AC_MSG_RESULT([$_am_result])
rm -f confinc confmf
])
# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*-
# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2005
# Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 4
# AM_MISSING_PROG(NAME, PROGRAM)
# ------------------------------
AC_DEFUN([AM_MISSING_PROG],
[AC_REQUIRE([AM_MISSING_HAS_RUN])
$1=${$1-"${am_missing_run}$2"}
AC_SUBST($1)])
# AM_MISSING_HAS_RUN
# ------------------
# Define MISSING if not defined so far and test if it supports --run.
# If it does, set am_missing_run to use it, otherwise, to nothing.
AC_DEFUN([AM_MISSING_HAS_RUN],
[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
# Use eval to expand $SHELL
if eval "$MISSING --run true"; then
am_missing_run="$MISSING --run "
else
am_missing_run=
AC_MSG_WARN([`missing' script is too old or missing])
fi
])
# Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# AM_PROG_MKDIR_P
# ---------------
# Check whether `mkdir -p' is supported, fallback to mkinstalldirs otherwise.
#
# Automake 1.8 used `mkdir -m 0755 -p --' to ensure that directories
# created by `make install' are always world readable, even if the
# installer happens to have an overly restrictive umask (e.g. 077).
# This was a mistake. There are at least two reasons why we must not
# use `-m 0755':
# - it causes special bits like SGID to be ignored,
# - it may be too restrictive (some setups expect 775 directories).
#
# Do not use -m 0755 and let people choose whatever they expect by
# setting umask.
#
# We cannot accept any implementation of `mkdir' that recognizes `-p'.
# Some implementations (such as Solaris 8's) are not thread-safe: if a
# parallel make tries to run `mkdir -p a/b' and `mkdir -p a/c'
# concurrently, both version can detect that a/ is missing, but only
# one can create it and the other will error out. Consequently we
# restrict ourselves to GNU make (using the --version option ensures
# this.)
AC_DEFUN([AM_PROG_MKDIR_P],
[if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
# We used to keeping the `.' as first argument, in order to
# allow $(mkdir_p) to be used without argument. As in
# $(mkdir_p) $(somedir)
# where $(somedir) is conditionally defined. However this is wrong
# for two reasons:
# 1. if the package is installed by a user who cannot write `.'
# make install will fail,
# 2. the above comment should most certainly read
# $(mkdir_p) $(DESTDIR)$(somedir)
# so it does not work when $(somedir) is undefined and
# $(DESTDIR) is not.
# To support the latter case, we have to write
# test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir),
# so the `.' trick is pointless.
mkdir_p='mkdir -p --'
else
# On NextStep and OpenStep, the `mkdir' command does not
# recognize any option. It will interpret all options as
# directories to create, and then abort because `.' already
# exists.
for d in ./-p ./--version;
do
test -d $d && rmdir $d
done
# $(mkinstalldirs) is defined by Automake if mkinstalldirs exists.
if test -f "$ac_aux_dir/mkinstalldirs"; then
mkdir_p='$(mkinstalldirs)'
else
mkdir_p='$(install_sh) -d'
fi
fi
AC_SUBST([mkdir_p])])
# Helper functions for option handling. -*- Autoconf -*-
# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 3
# _AM_MANGLE_OPTION(NAME)
# -----------------------
AC_DEFUN([_AM_MANGLE_OPTION],
[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
# _AM_SET_OPTION(NAME)
# ------------------------------
# Set option NAME. Presently that only means defining a flag for this option.
AC_DEFUN([_AM_SET_OPTION],
[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
# _AM_SET_OPTIONS(OPTIONS)
# ----------------------------------
# OPTIONS is a space-separated list of Automake options.
AC_DEFUN([_AM_SET_OPTIONS],
[AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
# -------------------------------------------
# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
AC_DEFUN([_AM_IF_OPTION],
[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
# Check to make sure that the build environment is sane. -*- Autoconf -*-
# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005
# Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 4
# AM_SANITY_CHECK
# ---------------
AC_DEFUN([AM_SANITY_CHECK],
[AC_MSG_CHECKING([whether build environment is sane])
# Just in case
sleep 1
echo timestamp > conftest.file
# Do `set' in a subshell so we don't clobber the current shell's
# arguments. Must try -L first in case configure is actually a
# symlink; some systems play weird games with the mod time of symlinks
# (eg FreeBSD returns the mod time of the symlink's containing
# directory).
if (
set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
if test "$[*]" = "X"; then
# -L didn't work.
set X `ls -t $srcdir/configure conftest.file`
fi
rm -f conftest.file
if test "$[*]" != "X $srcdir/configure conftest.file" \
&& test "$[*]" != "X conftest.file $srcdir/configure"; then
# If neither matched, then we have a broken ls. This can happen
# if, for instance, CONFIG_SHELL is bash and it inherits a
# broken ls alias from the environment. This has actually
# happened. Such a system could not be considered "sane".
AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
alias in your environment])
fi
test "$[2]" = conftest.file
)
then
# Ok.
:
else
AC_MSG_ERROR([newly created file is older than distributed files!
Check your system clock])
fi
AC_MSG_RESULT(yes)])
# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# AM_PROG_INSTALL_STRIP
# ---------------------
# One issue with vendor `install' (even GNU) is that you can't
# specify the program used to strip binaries. This is especially
# annoying in cross-compiling environments, where the build's strip
# is unlikely to handle the host's binaries.
# Fortunately install-sh will honor a STRIPPROG variable, so we
# always use install-sh in `make install-strip', and initialize
# STRIPPROG with the value of the STRIP variable (set by the user).
AC_DEFUN([AM_PROG_INSTALL_STRIP],
[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
# Installed binaries are usually stripped using `strip' when the user
# run `make install-strip'. However `strip' might not be the right
# tool to use in cross-compilation environments, therefore Automake
# will honor the `STRIP' environment variable to overrule this program.
dnl Don't test for $cross_compiling = yes, because it might be `maybe'.
if test "$cross_compiling" != no; then
AC_CHECK_TOOL([STRIP], [strip], :)
fi
INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s"
AC_SUBST([INSTALL_STRIP_PROGRAM])])
# Check how to create a tarball. -*- Autoconf -*-
# Copyright (C) 2004, 2005 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 2
# _AM_PROG_TAR(FORMAT)
# --------------------
# Check how to create a tarball in format FORMAT.
# FORMAT should be one of `v7', `ustar', or `pax'.
#
# Substitute a variable $(am__tar) that is a command
# writing to stdout a FORMAT-tarball containing the directory
# $tardir.
# tardir=directory && $(am__tar) > result.tar
#
# Substitute a variable $(am__untar) that extract such
# a tarball read from stdin.
# $(am__untar) < result.tar
AC_DEFUN([_AM_PROG_TAR],
[# Always define AMTAR for backward compatibility.
AM_MISSING_PROG([AMTAR], [tar])
m4_if([$1], [v7],
[am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
[m4_case([$1], [ustar],, [pax],,
[m4_fatal([Unknown tar format])])
AC_MSG_CHECKING([how to create a $1 tar archive])
# Loop over all known methods to create a tar archive until one works.
_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
_am_tools=${am_cv_prog_tar_$1-$_am_tools}
# Do not fold the above two line into one, because Tru64 sh and
# Solaris sh will not grok spaces in the rhs of `-'.
for _am_tool in $_am_tools
do
case $_am_tool in
gnutar)
for _am_tar in tar gnutar gtar;
do
AM_RUN_LOG([$_am_tar --version]) && break
done
am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
am__untar="$_am_tar -xf -"
;;
plaintar)
# Must skip GNU tar: if it does not support --format= it doesn't create
# ustar tarball either.
(tar --version) >/dev/null 2>&1 && continue
am__tar='tar chf - "$$tardir"'
am__tar_='tar chf - "$tardir"'
am__untar='tar xf -'
;;
pax)
am__tar='pax -L -x $1 -w "$$tardir"'
am__tar_='pax -L -x $1 -w "$tardir"'
am__untar='pax -r'
;;
cpio)
am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
am__untar='cpio -i -H $1 -d'
;;
none)
am__tar=false
am__tar_=false
am__untar=false
;;
esac
# If the value was cached, stop now. We just wanted to have am__tar
# and am__untar set.
test -n "${am_cv_prog_tar_$1}" && break
# tar/untar a dummy directory, and stop if the command works
rm -rf conftest.dir
mkdir conftest.dir
echo GrepMe > conftest.dir/file
AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
rm -rf conftest.dir
if test -s conftest.tar; then
AM_RUN_LOG([$am__untar <conftest.tar])
grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
fi
done
rm -rf conftest.dir
AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
AC_MSG_RESULT([$am_cv_prog_tar_$1])])
AC_SUBST([am__tar])
AC_SUBST([am__untar])
]) # _AM_PROG_TAR

87
config.h.in Normal file
View File

@ -0,0 +1,87 @@
/* config.h.in. Generated from configure.in by autoheader. */
/* Define to 1 if you have the <dirent.h> header file. */
#undef HAVE_DIRENT_H
/* Define to 1 if you have the <fcntl.h> header file. */
#undef HAVE_FCNTL_H
/* Define to 1 if you have the <fnmatch.h> header file. */
#undef HAVE_FNMATCH_H
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */
#undef HAVE_NDIR_H
/* Define to 1 if you have the <regex.h> header file. */
#undef HAVE_REGEX_H
/* Define to 1 if you have the <signal.h> header file. */
#undef HAVE_SIGNAL_H
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
/* Define to 1 if you have the <stdio.h> header file. */
#undef HAVE_STDIO_H
/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
/* Define to 1 if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H
/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H
/* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'.
*/
#undef HAVE_SYS_DIR_H
/* Define to 1 if you have the <sys/ndir.h> header file, and it defines `DIR'.
*/
#undef HAVE_SYS_NDIR_H
/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
/* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Define to 1 if you have the <\> header file. */
#undef HAVE__
/* Name of package */
#undef PACKAGE
/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT
/* Define to the full name of this package. */
#undef PACKAGE_NAME
/* Define to the full name and version of this package. */
#undef PACKAGE_STRING
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
/* Define to the version of this package. */
#undef PACKAGE_VERSION
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Version number of package */
#undef VERSION
/* Define to empty if `const' does not conform to ANSI C. */
#undef const

5917
configure vendored Executable file

File diff suppressed because it is too large Load Diff

42
configure.in Normal file
View File

@ -0,0 +1,42 @@
# Process this file with autoconf to produce a configure script.
AC_INIT
AC_CONFIG_SRCDIR([src/prtget.cpp])
AM_INIT_AUTOMAKE(prt-get,0.5.11)
dnl Determine default prefix
test x$prefix = "xNONE" && prefix="$ac_default_prefix"
# Checks for programs.
AC_PROG_CXX
AC_PROG_CC
AC_PROG_INSTALL
AC_PREFIX_DEFAULT(/usr)
# Checks for libraries.
# Checks for header files.
AC_HEADER_DIRENT
AC_CHECK_HEADERS(unistd.h stdio.h sys/types.h sys/stat.h fnmatch.h \
dirent.h fcntl.h signal.h regex.h)
CFLAGS="$CFLAGS $X_CFLAGS"
CXXFLAGS="$CXXFLAGS $X_CFLAGS"
LIBS="$LIBS $X_LIBS"
LDFLAGS="$LDFLAGS $LIBS $X_PRE_LIBS"
# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
# I hate you autotools
sysconfdir="/etc"
localstatedir="/var"
# Checks for library functions.
AM_CONFIG_HEADER(config.h)
AC_CONFIG_FILES([Makefile
src/Makefile
doc/Makefile
misc/Makefile])
AC_OUTPUT

423
depcomp Executable file
View File

@ -0,0 +1,423 @@
#! /bin/sh
# depcomp - compile a program generating dependencies as side-effects
# Copyright 1999, 2000 Free Software Foundation, Inc.
# 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, 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.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
if test -z "$depmode" || test -z "$source" || test -z "$object"; then
echo "depcomp: Variables source, object and depmode must be set" 1>&2
exit 1
fi
# `libtool' can also be set to `yes' or `no'.
if test -z "$depfile"; then
base=`echo "$object" | sed -e 's,^.*/,,' -e 's,\.\([^.]*\)$,.P\1,'`
dir=`echo "$object" | sed 's,/.*$,/,'`
if test "$dir" = "$object"; then
dir=
fi
# FIXME: should be _deps on DOS.
depfile="$dir.deps/$base"
fi
tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
rm -f "$tmpdepfile"
# Some modes work just like other modes, but use different flags. We
# parameterize here, but still list the modes in the big case below,
# to make depend.m4 easier to write. Note that we *cannot* use a case
# here, because this file can only contain one case statement.
if test "$depmode" = hp; then
# HP compiler uses -M and no extra arg.
gccflag=-M
depmode=gcc
fi
if test "$depmode" = dashXmstdout; then
# This is just like dashmstdout with a different argument.
dashmflag=-xM
depmode=dashmstdout
fi
case "$depmode" in
gcc3)
## gcc 3 implements dependency tracking that does exactly what
## we want. Yay! Note: for some reason libtool 1.4 doesn't like
## it if -MD -MP comes after the -MF stuff. Hmm.
"$@" -MT "$object" -MD -MP -MF "$tmpdepfile"
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
mv "$tmpdepfile" "$depfile"
;;
gcc)
## There are various ways to get dependency output from gcc. Here's
## why we pick this rather obscure method:
## - Don't want to use -MD because we'd like the dependencies to end
## up in a subdir. Having to rename by hand is ugly.
## (We might end up doing this anyway to support other compilers.)
## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
## -MM, not -M (despite what the docs say).
## - Using -M directly means running the compiler twice (even worse
## than renaming).
if test -z "$gccflag"; then
gccflag=-MD,
fi
"$@" -Wp,"$gccflag$tmpdepfile"
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
echo "$object : \\" > "$depfile"
alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
## The second -e expression handles DOS-style file names with drive letters.
sed -e 's/^[^:]*: / /' \
-e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
## This next piece of magic avoids the `deleted header file' problem.
## The problem is that when a header file which appears in a .P file
## is deleted, the dependency causes make to die (because there is
## typically no way to rebuild the header). We avoid this by adding
## dummy dependencies for each header file. Too bad gcc doesn't do
## this for us directly.
tr ' ' '
' < "$tmpdepfile" |
## Some versions of gcc put a space before the `:'. On the theory
## that the space means something, we add a space to the output as
## well.
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
hp)
# This case exists only to let depend.m4 do its work. It works by
# looking at the text of this script. This case will never be run,
# since it is checked for above.
exit 1
;;
sgi)
if test "$libtool" = yes; then
"$@" "-Wp,-MDupdate,$tmpdepfile"
else
"$@" -MDupdate "$tmpdepfile"
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
echo "$object : \\" > "$depfile"
# Clip off the initial element (the dependent). Don't try to be
# clever and replace this with sed code, as IRIX sed won't handle
# lines with more than a fixed number of characters (4096 in
# IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
# the IRIX cc adds comments like `#:fec' to the end of the
# dependency line.
tr ' ' '
' < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
tr '
' ' ' >> $depfile
echo >> $depfile
# The second pass generates a dummy entry for each header file.
tr ' ' '
' < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
>> $depfile
else
# The sourcefile does not contain any dependencies, so just
# store a dummy comment line, to avoid errors with the Makefile
# "include basename.Plo" scheme.
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
aix)
# The C for AIX Compiler uses -M and outputs the dependencies
# in a .u file. This file always lives in the current directory.
# Also, the AIX compiler puts `$object:' at the start of each line;
# $object doesn't have directory information.
stripped=`echo "$object" | sed -e 's,^.*/,,' -e 's/\(.*\)\..*$/\1/'`
tmpdepfile="$stripped.u"
outname="$stripped.o"
if test "$libtool" = yes; then
"$@" -Wc,-M
else
"$@" -M
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
if test -f "$tmpdepfile"; then
# Each line is of the form `foo.o: dependent.h'.
# Do two passes, one to just change these to
# `$object: dependent.h' and one to simply `dependent.h:'.
sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile"
sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile"
else
# The sourcefile does not contain any dependencies, so just
# store a dummy comment line, to avoid errors with the Makefile
# "include basename.Plo" scheme.
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
tru64)
# The Tru64 compiler uses -MD to generate dependencies as a side
# effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
# At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
# dependencies in `foo.d' instead, so we check for that too.
# Subdirectories are respected.
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
test "x$dir" = "x$object" && dir=
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
if test "$libtool" = yes; then
tmpdepfile1="$dir.libs/$base.lo.d"
tmpdepfile2="$dir.libs/$base.d"
"$@" -Wc,-MD
else
tmpdepfile1="$dir$base.o.d"
tmpdepfile2="$dir$base.d"
"$@" -MD
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile1" "$tmpdepfile2"
exit $stat
fi
if test -f "$tmpdepfile1"; then
tmpdepfile="$tmpdepfile1"
else
tmpdepfile="$tmpdepfile2"
fi
if test -f "$tmpdepfile"; then
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
# That's a space and a tab in the [].
sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
else
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
#nosideeffect)
# This comment above is used by automake to tell side-effect
# dependency tracking mechanisms from slower ones.
dashmstdout)
# Important note: in order to support this mode, a compiler *must*
# always write the proprocessed file to stdout, regardless of -o.
"$@" || exit $?
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test $1 != '--mode=compile'; do
shift
done
shift
fi
# Remove `-o $object'. We will use -o /dev/null later,
# however we can't do the remplacement now because
# `-o $object' might simply not be used
IFS=" "
for arg
do
case $arg in
-o)
shift
;;
$object)
shift
;;
*)
set fnord "$@" "$arg"
shift # fnord
shift # $arg
;;
esac
done
test -z "$dashmflag" && dashmflag=-M
"$@" -o /dev/null $dashmflag | sed 's:^[^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile"
rm -f "$depfile"
cat < "$tmpdepfile" > "$depfile"
tr ' ' '
' < "$tmpdepfile" | \
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
dashXmstdout)
# This case only exists to satisfy depend.m4. It is never actually
# run, as this mode is specially recognized in the preamble.
exit 1
;;
makedepend)
"$@" || exit $?
# X makedepend
shift
cleared=no
for arg in "$@"; do
case $cleared in
no)
set ""; shift
cleared=yes ;;
esac
case "$arg" in
-D*|-I*)
set fnord "$@" "$arg"; shift ;;
-*)
;;
*)
set fnord "$@" "$arg"; shift ;;
esac
done
obj_suffix="`echo $object | sed 's/^.*\././'`"
touch "$tmpdepfile"
${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
rm -f "$depfile"
cat < "$tmpdepfile" > "$depfile"
sed '1,2d' "$tmpdepfile" | tr ' ' '
' | \
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile" "$tmpdepfile".bak
;;
cpp)
# Important note: in order to support this mode, a compiler *must*
# always write the proprocessed file to stdout.
"$@" || exit $?
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test $1 != '--mode=compile'; do
shift
done
shift
fi
# Remove `-o $object'.
IFS=" "
for arg
do
case $arg in
-o)
shift
;;
$object)
shift
;;
*)
set fnord "$@" "$arg"
shift # fnord
shift # $arg
;;
esac
done
"$@" -E |
sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
sed '$ s: \\$::' > "$tmpdepfile"
rm -f "$depfile"
echo "$object : \\" > "$depfile"
cat < "$tmpdepfile" >> "$depfile"
sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
msvisualcpp)
# Important note: in order to support this mode, a compiler *must*
# always write the proprocessed file to stdout, regardless of -o,
# because we must use -o when running libtool.
"$@" || exit $?
IFS=" "
for arg
do
case "$arg" in
"-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
set fnord "$@"
shift
shift
;;
*)
set fnord "$@" "$arg"
shift
shift
;;
esac
done
"$@" -E |
sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
rm -f "$depfile"
echo "$object : \\" > "$depfile"
. "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"
echo " " >> "$depfile"
. "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
rm -f "$tmpdepfile"
;;
none)
exec "$@"
;;
*)
echo "Unknown depmode $depmode" 1>&2
exit 1
;;
esac
exit 0

10
doc/Makefile.am Normal file
View File

@ -0,0 +1,10 @@
man_MANS = prt-get.8 prt-cache.8 prt-get.conf.5
clean-local:
rm -rf *.log *.aux *.toc *.dvi *.idx *.pdf api
apidoc:
doxygen
EXTRA_DIST = $(man_MANS) coding

386
doc/Makefile.in Normal file
View File

@ -0,0 +1,386 @@
# Makefile.in generated by automake 1.9.5 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ..
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
subdir = doc
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
SOURCES =
DIST_SOURCES =
man5dir = $(mandir)/man5
am__installdirs = "$(DESTDIR)$(man5dir)" "$(DESTDIR)$(man8dir)"
man8dir = $(mandir)/man8
NROFF = nroff
MANS = $(man_MANS)
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build_alias = @build_alias@
datadir = @datadir@
exec_prefix = @exec_prefix@
host_alias = @host_alias@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
man_MANS = prt-get.8 prt-cache.8 prt-get.conf.5
EXTRA_DIST = $(man_MANS) coding
all: all-am
.SUFFIXES:
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
&& exit 0; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu doc/Makefile'; \
cd $(top_srcdir) && \
$(AUTOMAKE) --gnu doc/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
uninstall-info-am:
install-man5: $(man5_MANS) $(man_MANS)
@$(NORMAL_INSTALL)
test -z "$(man5dir)" || $(mkdir_p) "$(DESTDIR)$(man5dir)"
@list='$(man5_MANS) $(dist_man5_MANS) $(nodist_man5_MANS)'; \
l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
for i in $$l2; do \
case "$$i" in \
*.5*) list="$$list $$i" ;; \
esac; \
done; \
for i in $$list; do \
if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
else file=$$i; fi; \
ext=`echo $$i | sed -e 's/^.*\\.//'`; \
case "$$ext" in \
5*) ;; \
*) ext='5' ;; \
esac; \
inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
inst=`echo $$inst | sed -e 's/^.*\///'`; \
inst=`echo $$inst | sed '$(transform)'`.$$ext; \
echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man5dir)/$$inst'"; \
$(INSTALL_DATA) "$$file" "$(DESTDIR)$(man5dir)/$$inst"; \
done
uninstall-man5:
@$(NORMAL_UNINSTALL)
@list='$(man5_MANS) $(dist_man5_MANS) $(nodist_man5_MANS)'; \
l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
for i in $$l2; do \
case "$$i" in \
*.5*) list="$$list $$i" ;; \
esac; \
done; \
for i in $$list; do \
ext=`echo $$i | sed -e 's/^.*\\.//'`; \
case "$$ext" in \
5*) ;; \
*) ext='5' ;; \
esac; \
inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
inst=`echo $$inst | sed -e 's/^.*\///'`; \
inst=`echo $$inst | sed '$(transform)'`.$$ext; \
echo " rm -f '$(DESTDIR)$(man5dir)/$$inst'"; \
rm -f "$(DESTDIR)$(man5dir)/$$inst"; \
done
install-man8: $(man8_MANS) $(man_MANS)
@$(NORMAL_INSTALL)
test -z "$(man8dir)" || $(mkdir_p) "$(DESTDIR)$(man8dir)"
@list='$(man8_MANS) $(dist_man8_MANS) $(nodist_man8_MANS)'; \
l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
for i in $$l2; do \
case "$$i" in \
*.8*) list="$$list $$i" ;; \
esac; \
done; \
for i in $$list; do \
if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
else file=$$i; fi; \
ext=`echo $$i | sed -e 's/^.*\\.//'`; \
case "$$ext" in \
8*) ;; \
*) ext='8' ;; \
esac; \
inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
inst=`echo $$inst | sed -e 's/^.*\///'`; \
inst=`echo $$inst | sed '$(transform)'`.$$ext; \
echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man8dir)/$$inst'"; \
$(INSTALL_DATA) "$$file" "$(DESTDIR)$(man8dir)/$$inst"; \
done
uninstall-man8:
@$(NORMAL_UNINSTALL)
@list='$(man8_MANS) $(dist_man8_MANS) $(nodist_man8_MANS)'; \
l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
for i in $$l2; do \
case "$$i" in \
*.8*) list="$$list $$i" ;; \
esac; \
done; \
for i in $$list; do \
ext=`echo $$i | sed -e 's/^.*\\.//'`; \
case "$$ext" in \
8*) ;; \
*) ext='8' ;; \
esac; \
inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
inst=`echo $$inst | sed -e 's/^.*\///'`; \
inst=`echo $$inst | sed '$(transform)'`.$$ext; \
echo " rm -f '$(DESTDIR)$(man8dir)/$$inst'"; \
rm -f "$(DESTDIR)$(man8dir)/$$inst"; \
done
tags: TAGS
TAGS:
ctags: CTAGS
CTAGS:
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
case $$file in \
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
dir="/$$dir"; \
$(mkdir_p) "$(distdir)$$dir"; \
else \
dir=''; \
fi; \
if test -d $$d/$$file; then \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile $(MANS)
installdirs:
for dir in "$(DESTDIR)$(man5dir)" "$(DESTDIR)$(man8dir)"; do \
test -z "$$dir" || $(mkdir_p) "$$dir"; \
done
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-generic clean-local mostlyclean-am
distclean: distclean-am
-rm -f Makefile
distclean-am: clean-am distclean-generic
dvi: dvi-am
dvi-am:
html: html-am
info: info-am
info-am:
install-data-am: install-man
install-exec-am:
install-info: install-info-am
install-man: install-man5 install-man8
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-generic
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-info-am uninstall-man
uninstall-man: uninstall-man5 uninstall-man8
.PHONY: all all-am check check-am clean clean-generic clean-local \
distclean distclean-generic distdir dvi dvi-am html html-am \
info info-am install install-am install-data install-data-am \
install-exec install-exec-am install-info install-info-am \
install-man install-man5 install-man8 install-strip \
installcheck installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-generic pdf \
pdf-am ps ps-am uninstall uninstall-am uninstall-info-am \
uninstall-man uninstall-man5 uninstall-man8
clean-local:
rm -rf *.log *.aux *.toc *.dvi *.idx *.pdf api
apidoc:
doxygen
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

4
doc/coding Normal file
View File

@ -0,0 +1,4 @@
Documentation:
- /*! */-style
- types in .h
- methods in .cpp

56
doc/prt-cache.8 Normal file
View File

@ -0,0 +1,56 @@
.\" man page for prt-cache
.\" Johannes Winkelmann, jw@tks6.net
.PU
.TH prt-cache 8
.SH "NAME"
.LP
prt\-cache \- call prt\-get using a cache file as a data source
.SH "SYNOPSIS"
.B prt\-cache command [options] <arguments>
.br
.SH "DESCRIPTION"
prt\-cache is a synonym for
.B prt\-get --cache.
It's perfectly the same as calling prt\-get --cache, just shorter. See
.B man prt-get(8)
for details on how to use prt-get
.PP
Even though there are almost restrictions on using prt-cache over prt-get,
it's mostly recommended for the following commands:
.B search, dsearch, list, info, depends, quickdep, diff, quickdiff
and
.B info.
It won't work for the
.B dup
command.
.PP
Using
.B prt-cache isinst
is not recommended (really not!)
.PP
Note that if the cache is not up to date (and there's a newer port in the
ports tree),
.B prt-cache install
and
.B prt-cache update
will use the version from the ports tree anyway, so there's no real
risk.
.PP
If you're using prt-cache, make sure to regenerate the cache by calling
.B prt-get cache
each time you make changes to the ports tree!
.PP
To create a cache, just invoke
.B prt-get cache.
Make sure you have the right permissions to do this
.SH "AUTHORS"
Johannes Winkelmann <jw@tks6.net>
.SH "SEE ALSO"
prt-get(8), pkgmk(8) pkgadd(8), ports(8)

538
doc/prt-get.8 Normal file
View File

@ -0,0 +1,538 @@
.\" man page for prt-get
.\" Johannes Winkelmann, jw@tks6.net
.\"
.\" my first man page, so forgive me for the errors :-)
.\"
.\" .PU
.TH "prt-get" "8" "" "" ""
.SH "NAME"
.LP
prt\-get \- an advanced package management tool to be used with
pkgutils from CRUX (see http://www.crux.nu)
.SH "SYNOPSIS"
.B prt\-get command [options] <arguments>
.br
.SH "DESCRIPTION"
prt\-get is a package management tool which provides additional
functionality to crux' package management system. It works with the
local ports tree and is therefore fully compatible with ports(8) and
pkgmk(8)/pkgadd(8). It offers the following features:
.PP
.TP
\ \ \ \(bu
abstract ports installation/update from file system
.TP
\ \ \ \(bu
install/update a list of packages with one command
.TP
\ \ \ \(bu
list dependencies for a list of packages
.TP
\ \ \ \(bu
show information about ports
.TP
\ \ \ \(bu
search within the ports
.PP
What prt\-get basically does is installing and upgrading packages, using
pkgmk and pkgadd. Additionally, you don't have be in the port's
directory to call prt\-get. prt\-get will search for the respective port
itself in a list of directories specified in /etc/prt\-get.conf. This
allows you to just install or update a package, without caring where
it actually is located on your file system.
.PP
prt\-get also offers some features like searching ports by name,
showing information about ports (without installing them of course)
and can list the dependencies listed in the Pkgfile, and provide a
complete dependency list for a port. Note that dependencies are no
requirement for crux packages and therefore not always accurate. There's
a possiblity to use an external dependency map to get dependency
listings for ports which don't provide them in their Pkgfile.
.PP
prt\-get has a test mode so you can see what effect an install/update
operation would have. Use the \-\-test switch for this (see also:
OPTIONS)
.SH "RETURN VALUE"
prt\-get returns 0 on success and a non-zero value otherwise (exact
value -> meaning mapping to be determined...)
.SH "COMMANDS"
prt\-get uses so called commands, which always have to be the first
non-option argument passed. This is very similar to
.B cvs(1).
[command] can be one of the following:
.TP
.B install [\-\-margs] [\-\-aargs] [\-\-log] <package1> [<package2> ...]
install all packages in the listed order. Note that you can do this
from any directory
.TP
.B depinst [\-\-margs] [\-\-aargs] [\-\-log] <package1> [<package2> ...]
install all packages in the listed order including their dependencies.
Note that outdated packages won't be updated.
.TP
.B grpinst [\-\-margs] [\-\-aargs] [\-\-log] <package1> [<package2> ...]
install all packages in the listed order, but stop if installation of
one package fails. This can be used to install packages where package2
depends on package1
.TP
.B update [\-\-margs] [\-\-aargs] [\-\-log] <package1> [<package2> ...]
update all packages listed in this order
.TP
.B remove <package1> [<package2> ...]
remove packages listed in this order
.TP
.B sysup [\-\-nodeps]
Update all installed packages which are outdated. Sorts by dependencies
if specified. If you don't want prt-get to resolve the dependencies, use
the --nodeps switch. Also see the
.B lock
and
.B unlock
commands to keep the currently installed versions, even if there are
changes in the ports tree. If you want to update only diffs which have
a lower version installed than the one in the ports tree, use the
--prefer-higher option.
.TP
.B lock <package1> [<package2>...]
Do not update these packages in a
.B sysup
operation
.TP
.B unlock <package1> [<package2>...]
Remove lock from these packages
.TP
.B listlocked [-v|-vv]
List names of packages which are locked. As always,
.B -v
will additionally show the version, and
.B -vv
also includes the description from the Pkgfile. Note that the
.B -vv
switch will slow down the operation remarkably.
.TP
.B diff [--all] [<package1> <package2> ...]
show differences between installed packages and ports in the ports
tree. If arguments are given, shows only differences for these
packages, otherwise all differences are shown. It's also possible to use
shell like
.B wildcards
for the diff command. Make sure you escape where needed. Locked
packages are only displayed if you use the --all switch. If you want
to see only diffs which have a lower version installed than the one in
the ports tree, use the --prefer-higher option.
.TP
.B quickdiff
prints a simple list of packages which have a different version in the
ports tree than what is installed. This is meant as an input for
.B prt\-get update,
so you can update all ports on your system with one simple command. If you want
to see only diffs which have a lower version installed than the one in
the ports tree, use the --prefer-higher option.
.TP
.B search [\-v|\-vv] [--path] [--regex]<expr>
Search the ports tree for
.B expr
in their name
.TP
.B dsearch [\-v|\-vv] [--path] [--regex]<expr>
Search the ports tree for
.B expr
in both name and description. The search in the description is not case
sensitive. Note that this requires prt\-get to read every Pkgfile, which
makes it rather slow; if you like this, consider using the cache
functionality, so you only have to spend this time once after updating
the ports tree has been updated.
.TP
.B fsearch [--full] [--regex] <pattern>
Search the ports tree for
.B pattern
as file name in their footprint. When called without '--full', strips
the directories from the file names before matching; this behaviour
will change in prt-get 0.6, where full path search will be
default. Pattern can be a shell-like wildcard pattern (e.g prt-get
fsearch "*.h") or regexps.
.TP
.B info <port>
Print available info for a port
.TP
.B path <port>
Print the path of a port
.TP
.B readme <port>
Print the port's README file if it exists
.TP
.B depends <package1> [<package2> ...]
print a recursive list of dependencies to install the packages passed
as argument. It shows a list with ports which are found, plus a list
of ports which are missing
.TP
.B quickdep <package1> [<package2> ...]
print a simple list of recursive dependencies for all the ports passed
as argument in a simple format to be used by
.B prt\-get install
to make an install including dependencies
.B Does not display dependencies which are not in the ports tree
.TP
.B dependent <package>
print a list of package which depend on
.B package.
Only list direct dependencies. Usually shows dependent packages which
are installed. To see all dependencies, add the --all switch
.TP
.B deptree <package>
print a tree of the dependencies of the package
.B package.
Subtrees already shown are marked with '-->' to save some space, in
order to show them all, add the --all switch
.TP
.B dup
List ports which can be found in multiple directories configured in
.B /etc/prt.get.conf
.TP
.B list [\-v|\-vv] [filter] [--path] [--regex]
List ports available in the ports tree. It's basically the same as
.B ports \-l
but looks in all directories specified in
.B /etc/prt\-get.conf.
It's also possible to use
shell like
.B wildcards
for the list command. Make sure you escape where needed
.TP
.B printf <format string1> [\-\-sort=<format string2>] [\-\-filter=<filter>]
Print formated port list format string can contain variables, which
are replaced like this:
.TP
\ \ \ \(bu
%n \-> name
.TP
\ \ \ \(bu
%p \-> path
.TP
\ \ \ \(bu
%v \-> version
.TP
\ \ \ \(bu
%r \-> release
.TP
\ \ \ \(bu
%d \-> description
.TP
\ \ \ \(bu
%e \-> dependencies
.TP
\ \ \ \(bu
%u \-> URL
.TP
\ \ \ \(bu
%P -> Packager
.TP
\ \ \ \(bu
%M -> Maintainer
.TP
\ \ \ \(bu
%R -> Readme ("yes"/"no")
.TP
\ \ \ \(bu
%E -> pre-install script ("yes"/"no")
.TP
\ \ \ \(bu
%O -> post-install script ("yes"/"no")
.TP
\ \ \ \(bu
%l -> is locked ("yes"/"no")
.TP
\ \ \ \(bu
%i \-> "no" if not installed, "yes" if it's installed and
up to date and "diff" if it's installed and a new version is in the
ports tree.
Use "\\n" and "\\t" to format your output (no additional format specified
suported). The optional format string2 can contain the same variables
as format string1 and is used to sort the output. You can specify a
.B wildcard filter
to filter by package name.
.TP
.B listinst [\-v|\-vv] [filter] [--regex]
List installed ports. It's basically the same as
.B pkginfo \-i,
but omits version when called without verbose (\-v, \-vv) switch. Plus
it is notably faster in my tests. \-v adds version information, \-vv
adds version and description.
.B Warning:
\-vv will slow down the process because it requires prt\-get to scan
both the ports database and the ports tree.
It's also possible to use shell like
.B wildcards
for the listinst command. Make sure you escape where needed
.TP
.B isinst <package>
Check whether a package is installed. The same as
.B pkginfo \-i|grep ^package
.TP
.TP
.B current <package>
Prints out the version of the currently installed package
.TP
.B ls [--path] <package>
Prints out a listing of the port's directory
.TP
.B cat <package> [<file>]
Prints out the file to stdout. If <file> is not specified, 'Pkgfile' is used
.TP
.B edit <package> <file>
Edit the file using the editor specified in the $EDITOR environment variable.
If <file> is not specified, 'Pkgfile' is used
.TP
.B help
Shows a help screen
.TP
.B dumpconfig
Dump the configuration to the current terminal
.TP
.B version
Shows the current version of prt\-get
.TP
.B cache
create a cache file from the ports tree to be used by prt\-get using the
\-\-cache option. Remember to run prt\-get cache each time you update the
ports tree
.SH "OPTIONS"
.TP
.B -f, -i
Force install; Implies 'pkgadd -f'; same as --aargs=-f
.TP
.B -fr
Force rebuild, Implies 'pkgmk -f'; same as --margs=-f
.TP
.B -um
Update md5sum, implies 'pkgmk -um'; same as --margs=-um
.TP
.B -im
Ignore md5sum, implies 'pkgmk -im'; same as --margs=-im
.TP
.B -uf
Update footprint, implies 'pkgmk -uf'; same as --margs=-uf
.TP
.B -if
Ignore footprint, implies 'pkgmk -if'; same as --margs=-if
.TP
.B -ns
No stripping, implies 'pkgmk -ns'; same as --margs=-ns
.TP
.B -kw
Keep working directory, implies 'pkgmk -kw'; same as --margs=-kw
.TP
.B --ignore=<package1,package2,...>
Don't install those packages, even if they're listed as dependency
.TP
.B \-\-cache
Use cache file for this command
.TP
.B \-\-test
Dry run, don't actually install anything, mostly interesting for
.B prt\-get install, prt\-get grpinst, prt\-get update, prt\-get sysup
.TP
.B \-\-pre-install
Execute pre-install script if it's there
.TP
.B \-\-post-install
Execute post-install script if it's there
.TP
.B \-\-install-scripts
Execute pre-install and post-install script if they're there
.TP
.B \-\-no-std-config
Don't parse the default configuration file
.TP
.B \-\-config-prepend=<string>
Prepend <string> to configuration
.TP
.B \-\-config-append=<string>
Append <string> to configuration
.TP
.B \-\-config-set=<string>
Set <string> in configuration, overriding configuration file
.TP
.B \-v, \-vv
verbose and more verbose, relevant for
.B prt\-get search, prt\-get list
verbose shows version of a port, more verbose shows version and
description (if available)
.B \-\-path
Show path info; used in 'search', 'dsearch', 'list' and 'depends'
.B \-\-regex
Interpret filter and search pattern as regular expression
.TP
.B \-\-margs="...", e.g. \-\-margs="\-im"
arguments to be passed to pkgmk, relevant for
.B prt\-get install, prt\-get grpinst, prt\-get update
note that \-d is already passed to pkgmk anyway
.TP
.B \-\-aargs="...", e.g. \-\-aargs="\-f"
arguments to be passed to pkgadd, relevant for
.B prt\-get install, prt\-get grpinst, prt\-get update
.TP
.B \-\-rargs="..."
arguments to be passed to pkgrm; currently not used, implemented for
future uses and consistency reasons
.TP
.B \-\-prefer-higher, -ph
Make prt-get parse the version strings and prefer the higher version,
even if the one found in the ports tree is lower. Will influence diff,
quickdiff and sysup.
.TP
.B \-\-strict-diff, -sd
Override the 'preferhigher' configuration option
.TP
.B \-\-config=<file>
Use alternative configuration file to read ports directories from
.TP
.B \-\-install-root=<dir>
Use <dir> as root directory for your installation; allows to install to
a different directory than '/'. In daily usage, this option is not
required; helpful if you're developing an independent installation.
.TP
.B \-\-log
Write build output to log file
.SH "CONFIGURATION"
.TP
See man prt\-get.conf(5)
.SH "EXAMPLES"
.TP
.B prt\-get install irssi
download, build and install irssi, with one simple command
.TP
.B prt\-get install indent mplayer
install indent and mplayer
.TP
.B prt\-get update openssh
update your current version of openssh :\-)
.TP
.B prt\-get info kdelibs
show info about kdelibs
.TP
.B prt\-get search icq
Search all ports containing 'icq' in their name
.TP
.B prt\-get grpinst \-\-test `prt\-get quickdep kdenetwork`
Show what would happen if you installed all packages needed for
kdenetwork (test mode). Remove \-\-test to install kdenetwork and all
it's dependencies. Remember that grpinst stops installing when one
installing of one package fails
.TP
.B prt\-get update `prt\-get quickdiff`
Update all packages where a different version is in the ports tree
.SH "AUTHORS"
Johannes Winkelmann <jw@tks6.net>
.SH "SEE ALSO"
prt\-get.conf(5), prt\-cache(8), pkgmk(8) pkgadd(8), ports(8)

157
doc/prt-get.conf.5 Normal file
View File

@ -0,0 +1,157 @@
.\" man page for prt-get.conf
.\" Johannes Winkelmann, jw@tks6.net
.PU
.TH prt-get.conf 5
.SH "NAME"
.LP
prt-get.conf - Configuration file for prt-get
.SH "DESCRIPTION"
This file, by default
.IR /etc/prt-get.conf ,
is read by prt-get and prt-cache (see prt-get(8) and prt-cache(8))
.LP
It might look like this:
.IP
.nf
###
# prt-get.conf
# root directories
prtdir /usr/ports/base
prtdir /usr/ports/opt
prtdir /usr/ports/contrib
prtdir /usr/ports/unofficial
# use mutt and yafc from local build directory
prtdir /home/jw/build:mutt, yafc
# change default location of cache file
cachefile /tmp/port-cache
# write a log file
writelog enabled
logmode append
logfile /tmp/log/%n.log
# show compact readme information
readme compact
# execute pre- and post-installs scripts (default no)
runscripts yes
# don't prefer higher versions (default no)
preferhigher yes
# use regexps for searching (default no)
useregex yes
.fi
.LP
There are a few values to be configured: the location where to look
for the ports, the location of the cache file, some log options and
how to notify the user about README files.
If you don't specify the
cache file, the default location is
.B /var/lib/pkg/prt-get.conf
.LP
Every line can contain one configuration option. The format of the lines
is
.B <key> <value>.
The valid keys are
.B prtdir
and
.B cachefile.
The value for
.B prtdir
is a directory, the value for
.B cachefile
is a file to be used as cache
.nf
<portname1>:<dependency1> <dependency2>
<portname2>:<dependency1>
.B runscripts
if set to yes, execute pre- and post-install scripts
.B preferhigher
if set to yes, prt-get will parse version strings and prefer the
higher one, even if the one found in the ports tree is lower. Will
influence diff, quickdiff and sysup
.B useregex
if set to yes, prt-get will interpret search and filter patterns in
list, listinst, printf, search, dsearch and fsearch as regular
expressions. This will be the default in prt-get 0.6.
.LP
.B makecommand
.B addcommand
.B removecommand
.B runscriptcommand
can be used to use an alternate command instead of 'pkgmk' for the
makecommand,'pkgadd' for the addcommand, 'pkgrm' for the
removecommand and 'sh' for the command which is used to run the pre- and
post-install scripts. These are expert options which shouldn't be used
in general; when used the wrong way, they can completely break prt-get's
original functionality.
.LP
The log options are
.B writelog
which can be set to 'enabled' or 'disabled'
.B logmode
which can be set to 'append' or 'overwrite'
.B logfile
which represent the file path. All occurances of %n in logfile are
replaced with the port name and all occurances of %p are
replaced with the port's path, e.g. for port gcc in base, %p would be
.B /usr/base
and %n
.B gcc.
This allows you to have separate log files per port.
.LP
If the readme option is set to something different than 'disabled',
prt-get will notify the user if she/he installs a port with a README
file. The option to configure this is called
.B readme
which can be set to 'verbose' (print separate information about README
files), 'compact' (integrate in result output) or 'disabled' (no information about README files). See
.B prt-get(8)
and especially the readme command how to read those README files using
prt-get
.LP
The order of the prtdir options is important, as if a port is in multiple
directories, prt-get will use the one found first (directories listed
first have precedence)
.LP
If you want to restrict the ports used from one prtdir, you can
append a comma separated list of ports to be used after the path,
using a colon (':') character to separate the two components
.B path:package1, package2,...
Note that this slows down prt-get a lot if you list a lot of packages.
If you become aware of speed problems due to this, create a separate
ports directory instead and use symlinks for the ports you want to use
.LP
You can write comments after a '#' character. If you have '#'
characters in you pathes, there's no way to escape them (as there is no
way to escape ':' characters). Complain to the author if this is a
problem :-)
.SH "AUTHORS"
Johannes Winkelmann <jw@tks6.net>
.SH "SEE ALSO"
prt-get(8), pkgmk(8) pkgadd(8), ports(8)

276
install-sh Executable file
View File

@ -0,0 +1,276 @@
#!/bin/sh
#
# install - install a program, script, or datafile
# This comes from X11R5 (mit/util/scripts/install.sh).
#
# Copyright 1991 by the Massachusetts Institute of Technology
#
# Permission to use, copy, modify, distribute, and sell this software and its
# documentation for any purpose is hereby granted without fee, provided that
# the above copyright notice appear in all copies and that both that
# copyright notice and this permission notice appear in supporting
# documentation, and that the name of M.I.T. not be used in advertising or
# publicity pertaining to distribution of the software without specific,
# written prior permission. M.I.T. makes no representations about the
# suitability of this software for any purpose. It is provided "as is"
# without express or implied warranty.
#
# Calling this script install-sh is preferred over install.sh, to prevent
# `make' implicit rules from creating a file called install from it
# when there is no Makefile.
#
# This script is compatible with the BSD install script, but was written
# from scratch. It can only install one file at a time, a restriction
# shared with many OS's install programs.
# set DOITPROG to echo to test this script
# Don't use :- since 4.3BSD and earlier shells don't like it.
doit="${DOITPROG-}"
# put in absolute paths if you don't have them in your path; or use env. vars.
mvprog="${MVPROG-mv}"
cpprog="${CPPROG-cp}"
chmodprog="${CHMODPROG-chmod}"
chownprog="${CHOWNPROG-chown}"
chgrpprog="${CHGRPPROG-chgrp}"
stripprog="${STRIPPROG-strip}"
rmprog="${RMPROG-rm}"
mkdirprog="${MKDIRPROG-mkdir}"
transformbasename=""
transform_arg=""
instcmd="$mvprog"
chmodcmd="$chmodprog 0755"
chowncmd=""
chgrpcmd=""
stripcmd=""
rmcmd="$rmprog -f"
mvcmd="$mvprog"
src=""
dst=""
dir_arg=""
while [ x"$1" != x ]; do
case $1 in
-c) instcmd=$cpprog
shift
continue;;
-d) dir_arg=true
shift
continue;;
-m) chmodcmd="$chmodprog $2"
shift
shift
continue;;
-o) chowncmd="$chownprog $2"
shift
shift
continue;;
-g) chgrpcmd="$chgrpprog $2"
shift
shift
continue;;
-s) stripcmd=$stripprog
shift
continue;;
-t=*) transformarg=`echo $1 | sed 's/-t=//'`
shift
continue;;
-b=*) transformbasename=`echo $1 | sed 's/-b=//'`
shift
continue;;
*) if [ x"$src" = x ]
then
src=$1
else
# this colon is to work around a 386BSD /bin/sh bug
:
dst=$1
fi
shift
continue;;
esac
done
if [ x"$src" = x ]
then
echo "$0: no input file specified" >&2
exit 1
else
:
fi
if [ x"$dir_arg" != x ]; then
dst=$src
src=""
if [ -d "$dst" ]; then
instcmd=:
chmodcmd=""
else
instcmd=$mkdirprog
fi
else
# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
# might cause directories to be created, which would be especially bad
# if $src (and thus $dsttmp) contains '*'.
if [ -f "$src" ] || [ -d "$src" ]
then
:
else
echo "$0: $src does not exist" >&2
exit 1
fi
if [ x"$dst" = x ]
then
echo "$0: no destination specified" >&2
exit 1
else
:
fi
# If destination is a directory, append the input filename; if your system
# does not like double slashes in filenames, you may need to add some logic
if [ -d "$dst" ]
then
dst=$dst/`basename "$src"`
else
:
fi
fi
## this sed command emulates the dirname command
dstdir=`echo "$dst" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
# Make sure that the destination directory exists.
# this part is taken from Noah Friedman's mkinstalldirs script
# Skip lots of stat calls in the usual case.
if [ ! -d "$dstdir" ]; then
defaultIFS='
'
IFS="${IFS-$defaultIFS}"
oIFS=$IFS
# Some sh's can't handle IFS=/ for some reason.
IFS='%'
set - `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'`
IFS=$oIFS
pathcomp=''
while [ $# -ne 0 ] ; do
pathcomp=$pathcomp$1
shift
if [ ! -d "$pathcomp" ] ;
then
$mkdirprog "$pathcomp"
else
:
fi
pathcomp=$pathcomp/
done
fi
if [ x"$dir_arg" != x ]
then
$doit $instcmd "$dst" &&
if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dst"; else : ; fi &&
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dst"; else : ; fi &&
if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dst"; else : ; fi &&
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dst"; else : ; fi
else
# If we're going to rename the final executable, determine the name now.
if [ x"$transformarg" = x ]
then
dstfile=`basename "$dst"`
else
dstfile=`basename "$dst" $transformbasename |
sed $transformarg`$transformbasename
fi
# don't allow the sed command to completely eliminate the filename
if [ x"$dstfile" = x ]
then
dstfile=`basename "$dst"`
else
:
fi
# Make a couple of temp file names in the proper directory.
dsttmp=$dstdir/#inst.$$#
rmtmp=$dstdir/#rm.$$#
# Trap to clean up temp files at exit.
trap 'status=$?; rm -f "$dsttmp" "$rmtmp" && exit $status' 0
trap '(exit $?); exit' 1 2 13 15
# Move or copy the file name to the temp name
$doit $instcmd "$src" "$dsttmp" &&
# and set any options; do chmod last to preserve setuid bits
# If any of these fail, we abort the whole thing. If we want to
# ignore errors from any of these, just make sure not to ignore
# errors from the above "$doit $instcmd $src $dsttmp" command.
if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dsttmp"; else :;fi &&
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dsttmp"; else :;fi &&
if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dsttmp"; else :;fi &&
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dsttmp"; else :;fi &&
# Now remove or move aside any old file at destination location. We try this
# two ways since rm can't unlink itself on some systems and the destination
# file might be busy for other reasons. In this case, the final cleanup
# might fail but the new file should still install successfully.
{
if [ -f "$dstdir/$dstfile" ]
then
$doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null ||
$doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null ||
{
echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2
(exit 1); exit
}
else
:
fi
} &&
# Now rename the file to the real destination.
$doit $mvcmd "$dsttmp" "$dstdir/$dstfile"
fi &&
# The final little trick to "correctly" pass the exit status to the exit trap.
{
(exit 0); exit
}

16
misc/Makefile.am Normal file
View File

@ -0,0 +1,16 @@
EXTRA_DIST = prt-get_complete prt-get.aliases prt-get.deplist prt-get.conf
sysconf_DATA = prt-get.conf
install-data-local:
$(INSTALL) -D -m 644 $(srcdir)/prt-get.deplist \
$(DESTDIR)$(localstatedir)/lib/pkg/prt-get.deplist
$(INSTALL) -D -m 644 $(srcdir)/prt-get.aliases \
$(DESTDIR)$(localstatedir)/lib/pkg/prt-get.aliases
# $(INSTALL) -D -m 644 $(srcdir)/prt-get.conf \
# $(DESTDIR)$(sysconfdir)/prt-get.conf
uninstall-local:
rm $(DESTDIR)$(localstatedir)/lib/pkg/prt-get.deplist
rm $(DESTDIR)$(localstatedir)/lib/pkg/prt-get.aliases
# rm $(DESTDIR)$(sysconfigdir)/etc/prt-get.conf

323
misc/Makefile.in Normal file
View File

@ -0,0 +1,323 @@
# Makefile.in generated by automake 1.9.5 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ..
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
subdir = misc
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
SOURCES =
DIST_SOURCES =
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
*) f=$$p;; \
esac;
am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
am__installdirs = "$(DESTDIR)$(sysconfdir)"
sysconfDATA_INSTALL = $(INSTALL_DATA)
DATA = $(sysconf_DATA)
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build_alias = @build_alias@
datadir = @datadir@
exec_prefix = @exec_prefix@
host_alias = @host_alias@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
EXTRA_DIST = prt-get_complete prt-get.aliases prt-get.deplist prt-get.conf
sysconf_DATA = prt-get.conf
all: all-am
.SUFFIXES:
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
&& exit 0; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu misc/Makefile'; \
cd $(top_srcdir) && \
$(AUTOMAKE) --gnu misc/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
uninstall-info-am:
install-sysconfDATA: $(sysconf_DATA)
@$(NORMAL_INSTALL)
test -z "$(sysconfdir)" || $(mkdir_p) "$(DESTDIR)$(sysconfdir)"
@list='$(sysconf_DATA)'; for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
f=$(am__strip_dir) \
echo " $(sysconfDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(sysconfdir)/$$f'"; \
$(sysconfDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(sysconfdir)/$$f"; \
done
uninstall-sysconfDATA:
@$(NORMAL_UNINSTALL)
@list='$(sysconf_DATA)'; for p in $$list; do \
f=$(am__strip_dir) \
echo " rm -f '$(DESTDIR)$(sysconfdir)/$$f'"; \
rm -f "$(DESTDIR)$(sysconfdir)/$$f"; \
done
tags: TAGS
TAGS:
ctags: CTAGS
CTAGS:
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
case $$file in \
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
dir="/$$dir"; \
$(mkdir_p) "$(distdir)$$dir"; \
else \
dir=''; \
fi; \
if test -d $$d/$$file; then \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile $(DATA)
installdirs:
for dir in "$(DESTDIR)$(sysconfdir)"; do \
test -z "$$dir" || $(mkdir_p) "$$dir"; \
done
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-generic mostlyclean-am
distclean: distclean-am
-rm -f Makefile
distclean-am: clean-am distclean-generic
dvi: dvi-am
dvi-am:
html: html-am
info: info-am
info-am:
install-data-am: install-data-local
install-exec-am: install-sysconfDATA
install-info: install-info-am
install-man:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-generic
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-info-am uninstall-local uninstall-sysconfDATA
.PHONY: all all-am check check-am clean clean-generic distclean \
distclean-generic distdir dvi dvi-am html html-am info info-am \
install install-am install-data install-data-am \
install-data-local install-exec install-exec-am install-info \
install-info-am install-man install-strip install-sysconfDATA \
installcheck installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-generic pdf \
pdf-am ps ps-am uninstall uninstall-am uninstall-info-am \
uninstall-local uninstall-sysconfDATA
install-data-local:
$(INSTALL) -D -m 644 $(srcdir)/prt-get.deplist \
$(DESTDIR)$(localstatedir)/lib/pkg/prt-get.deplist
$(INSTALL) -D -m 644 $(srcdir)/prt-get.aliases \
$(DESTDIR)$(localstatedir)/lib/pkg/prt-get.aliases
# $(INSTALL) -D -m 644 $(srcdir)/prt-get.conf \
# $(DESTDIR)$(sysconfdir)/prt-get.conf
uninstall-local:
rm $(DESTDIR)$(localstatedir)/lib/pkg/prt-get.deplist
rm $(DESTDIR)$(localstatedir)/lib/pkg/prt-get.aliases
# rm $(DESTDIR)$(sysconfigdir)/etc/prt-get.conf
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

6
misc/prt-get.aliases Normal file
View File

@ -0,0 +1,6 @@
j2sdk: j2re
lesstif: openmotif
postfix: sendmail
exim: sendmail
qmail: sendmail
masqmail: sendmail

42
misc/prt-get.conf Normal file
View File

@ -0,0 +1,42 @@
###
### prt-get conf
###
prtdir /usr/ports/base
prtdir /usr/ports/opt
### clc ports
prtdir /usr/ports/contrib
### use mypackage form local directory
# prtdir /home/packages/build:mypackage
### use alternate cache file (default: /var/lib/pkg/prt-get.cache
# cachefile /mnt/nfs/cache
### log options:
# writelog enabled # (enabled|disabled)
# logmode overwrite # (append|overwrite)
logfile /var/log/pkgbuild/%n.log
# path, %p=path to port dir, %n=port name
# %v=version, %r=release
### print README information:
# readme verbose # (verbose|compact|disabled)
### run pre- and post-installs scripts; yes is equivalent to the
### --install-scripts option
# runscripts no # (no|yes)
### alternative commands
# makecommand pkgmk
# addcommand pkgadd
# removecommand pkgrm
# runscriptcommand sh
### prefer higher versions in sysup / diff
# preferhigher no # (yes|no)
### use regexp search
# useregex no # (yes|no)

28
misc/prt-get.deplist Normal file
View File

@ -0,0 +1,28 @@
# dependencies for opt ports, 16 May 2004, Jürgen Daubert
atk : glib
audiofile : pkgconfig
cvs : openssl
emacs : x11 libtiff
esound : audiofile
fetchmail : openssl
firefox : gtk libidl
fontconfig : freetype expat pkgconfig
glib : gettext pkgconfig
gtk : atk pango libtiff
libidl : glib
libogg : pkgconfig
libpng : pkgconfig
libtiff : libjpeg
libvorbis : libogg
openssh : openssl
pango : glib x11
pine : openssl
ppp : openssl
webfs : openssl
windowmaker : x11 libtiff libungif
xchat : gtk openssl
x11 : fontconfig libpng
zip : unzip
# End of file

98
misc/prt-get_complete Normal file
View File

@ -0,0 +1,98 @@
# prt-get(8), prt-cache(8) completion by Johannes Winkelmann, jw@tks6.net
# problems: options ending on = should not add a space afterwards
#
# 07.07.2002: use prt-get listinst (from 0.3.1pre1) instead of pkginfo
# 06.07.2002: first version
_prt-get()
{
local cur prev
COMPREPLY=()
cur=${COMP_WORDS[COMP_CWORD]}
prev=${COMP_WORDS[COMP_CWORD-1]}
if [ $COMP_CWORD -eq 1 ]; then
COMPREPLY=( $( compgen -W ' \
install depinst update grpinst help \
version readme list info path \
search dsearch fsearch printf cache \
dependent sysup current lock unlock \
listlocked diff quickdiff depends quickdep \
dup isinst cat ls edit deptree \
remove listinst' $cur ))
fi
if [ $COMP_CWORD '>' 1 ]; then
if [[ "$cur" != -* ]]; then
case ${COMP_WORDS[1]} in
"install" | "depinst" | "grpinst" | "path" | "dependent" | \
"depends" | "quickdep" | "info" | "readme" | \
"ls" | "isinst" | "deptree" )
if [ -f /var/lib/pkg/prt-get.cache ]; then
plist=`prt-cache list`
if [ ! "$plist" == "" ]; then
COMPREPLY=( $( compgen -W '$plist' $cur ) )
fi
fi
;;
"cat" | "edit" )
if [ $COMP_CWORD '>' 2 ]; then
plist=`prt-get ls ${COMP_WORDS[2]}`
COMPREPLY=( $( compgen -W '$plist' $cur ) )
else
if [ -f /var/lib/pkg/prt-get.cache ]; then
plist=`prt-cache list`
if [ ! "$plist" == "" ]; then
COMPREPLY=( $( compgen -W '$plist' $cur ) )
fi
fi
fi
;;
"current"|"lock"|"remove")
plist=`prt-get listinst`
COMPREPLY=( $( compgen -W '$plist' $cur ) )
;;
"update")
plist=`prt-get quickdiff`
COMPREPLY=( $( compgen -W '$plist' $cur ) )
;;
"unlock")
plist=`prt-get listlocked`
COMPREPLY=( $( compgen -W '$plist' $cur ) )
;;
esac
else
case ${COMP_WORDS[1]} in
"install" | "update" | "groupinst")
COMPREPLY=( $( compgen -W '--config= --cache \
--pre-install \
--post-install \
--install-scripts \
--log --test \
--config \
--config-append= \
--config-prepend= \
--config-set= \
--aargs= --margs= \
--rargs= \
--install-root=' \
-- $cur ) )
;;
"list" | "search" | "dsearch" )
COMPREPLY=( $( compgen -W '-v -vv --cache \
--config=' -- $cur ) )
;;
*)
COMPREPLY=( $( compgen -W '--cache --log --test --config=' \
-- $cur ) )
;;
esac
fi
fi
return 0
}
complete -F _prt-get -o default prt-get
complete -F _prt-get -o default prt-cache

336
missing Executable file
View File

@ -0,0 +1,336 @@
#! /bin/sh
# Common stub for a few missing GNU programs while installing.
# Copyright (C) 1996, 1997, 1999, 2000, 2002 Free Software Foundation, Inc.
# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
# 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, 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.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
if test $# -eq 0; then
echo 1>&2 "Try \`$0 --help' for more information"
exit 1
fi
run=:
# In the cases where this matters, `missing' is being run in the
# srcdir already.
if test -f configure.ac; then
configure_ac=configure.ac
else
configure_ac=configure.in
fi
case "$1" in
--run)
# Try to run requested program, and just exit if it succeeds.
run=
shift
"$@" && exit 0
;;
esac
# If it does not exist, or fails to run (possibly an outdated version),
# try to emulate it.
case "$1" in
-h|--h|--he|--hel|--help)
echo "\
$0 [OPTION]... PROGRAM [ARGUMENT]...
Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
error status if there is no known handling for PROGRAM.
Options:
-h, --help display this help and exit
-v, --version output version information and exit
--run try to run the given command, and emulate it if it fails
Supported PROGRAM values:
aclocal touch file \`aclocal.m4'
autoconf touch file \`configure'
autoheader touch file \`config.h.in'
automake touch all \`Makefile.in' files
bison create \`y.tab.[ch]', if possible, from existing .[ch]
flex create \`lex.yy.c', if possible, from existing .c
help2man touch the output file
lex create \`lex.yy.c', if possible, from existing .c
makeinfo touch the output file
tar try tar, gnutar, gtar, then tar without non-portable flags
yacc create \`y.tab.[ch]', if possible, from existing .[ch]"
;;
-v|--v|--ve|--ver|--vers|--versi|--versio|--version)
echo "missing 0.4 - GNU automake"
;;
-*)
echo 1>&2 "$0: Unknown \`$1' option"
echo 1>&2 "Try \`$0 --help' for more information"
exit 1
;;
aclocal*)
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
# We have it, but it failed.
exit 1
fi
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
you modified \`acinclude.m4' or \`${configure_ac}'. You might want
to install the \`Automake' and \`Perl' packages. Grab them from
any GNU archive site."
touch aclocal.m4
;;
autoconf)
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
# We have it, but it failed.
exit 1
fi
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
you modified \`${configure_ac}'. You might want to install the
\`Autoconf' and \`GNU m4' packages. Grab them from any GNU
archive site."
touch configure
;;
autoheader)
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
# We have it, but it failed.
exit 1
fi
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
you modified \`acconfig.h' or \`${configure_ac}'. You might want
to install the \`Autoconf' and \`GNU m4' packages. Grab them
from any GNU archive site."
files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
test -z "$files" && files="config.h"
touch_files=
for f in $files; do
case "$f" in
*:*) touch_files="$touch_files "`echo "$f" |
sed -e 's/^[^:]*://' -e 's/:.*//'`;;
*) touch_files="$touch_files $f.in";;
esac
done
touch $touch_files
;;
automake*)
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
# We have it, but it failed.
exit 1
fi
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
You might want to install the \`Automake' and \`Perl' packages.
Grab them from any GNU archive site."
find . -type f -name Makefile.am -print |
sed 's/\.am$/.in/' |
while read f; do touch "$f"; done
;;
autom4te)
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
# We have it, but it failed.
exit 1
fi
echo 1>&2 "\
WARNING: \`$1' is needed, and you do not seem to have it handy on your
system. You might have modified some files without having the
proper tools for further handling them.
You can get \`$1Help2man' as part of \`Autoconf' from any GNU
archive site."
file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'`
test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'`
if test -f "$file"; then
touch $file
else
test -z "$file" || exec >$file
echo "#! /bin/sh"
echo "# Created by GNU Automake missing as a replacement of"
echo "# $ $@"
echo "exit 0"
chmod +x $file
exit 1
fi
;;
bison|yacc)
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
you modified a \`.y' file. You may need the \`Bison' package
in order for those modifications to take effect. You can get
\`Bison' from any GNU archive site."
rm -f y.tab.c y.tab.h
if [ $# -ne 1 ]; then
eval LASTARG="\${$#}"
case "$LASTARG" in
*.y)
SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
if [ -f "$SRCFILE" ]; then
cp "$SRCFILE" y.tab.c
fi
SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
if [ -f "$SRCFILE" ]; then
cp "$SRCFILE" y.tab.h
fi
;;
esac
fi
if [ ! -f y.tab.h ]; then
echo >y.tab.h
fi
if [ ! -f y.tab.c ]; then
echo 'main() { return 0; }' >y.tab.c
fi
;;
lex|flex)
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
you modified a \`.l' file. You may need the \`Flex' package
in order for those modifications to take effect. You can get
\`Flex' from any GNU archive site."
rm -f lex.yy.c
if [ $# -ne 1 ]; then
eval LASTARG="\${$#}"
case "$LASTARG" in
*.l)
SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
if [ -f "$SRCFILE" ]; then
cp "$SRCFILE" lex.yy.c
fi
;;
esac
fi
if [ ! -f lex.yy.c ]; then
echo 'main() { return 0; }' >lex.yy.c
fi
;;
help2man)
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
# We have it, but it failed.
exit 1
fi
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
you modified a dependency of a manual page. You may need the
\`Help2man' package in order for those modifications to take
effect. You can get \`Help2man' from any GNU archive site."
file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
if test -z "$file"; then
file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'`
fi
if [ -f "$file" ]; then
touch $file
else
test -z "$file" || exec >$file
echo ".ab help2man is required to generate this page"
exit 1
fi
;;
makeinfo)
if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then
# We have makeinfo, but it failed.
exit 1
fi
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
you modified a \`.texi' or \`.texinfo' file, or any other file
indirectly affecting the aspect of the manual. The spurious
call might also be the consequence of using a buggy \`make' (AIX,
DU, IRIX). You might want to install the \`Texinfo' package or
the \`GNU make' package. Grab either from any GNU archive site."
file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
if test -z "$file"; then
file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file`
fi
touch $file
;;
tar)
shift
if test -n "$run"; then
echo 1>&2 "ERROR: \`tar' requires --run"
exit 1
fi
# We have already tried tar in the generic part.
# Look for gnutar/gtar before invocation to avoid ugly error
# messages.
if (gnutar --version > /dev/null 2>&1); then
gnutar "$@" && exit 0
fi
if (gtar --version > /dev/null 2>&1); then
gtar "$@" && exit 0
fi
firstarg="$1"
if shift; then
case "$firstarg" in
*o*)
firstarg=`echo "$firstarg" | sed s/o//`
tar "$firstarg" "$@" && exit 0
;;
esac
case "$firstarg" in
*h*)
firstarg=`echo "$firstarg" | sed s/h//`
tar "$firstarg" "$@" && exit 0
;;
esac
fi
echo 1>&2 "\
WARNING: I can't seem to be able to run \`tar' with the given arguments.
You may want to install GNU tar or Free paxutils, or check the
command line arguments."
exit 1
;;
*)
echo 1>&2 "\
WARNING: \`$1' is needed, and you do not seem to have it handy on your
system. You might have modified some files without having the
proper tools for further handling them. Check the \`README' file,
it often tells you about the needed prerequirements for installing
this package. You may also peek at any GNU archive site, in case
some other package would contain this missing \`$1' program."
exit 1
;;
esac
exit 0

111
mkinstalldirs Executable file
View File

@ -0,0 +1,111 @@
#! /bin/sh
# mkinstalldirs --- make directory hierarchy
# Author: Noah Friedman <friedman@prep.ai.mit.edu>
# Created: 1993-05-16
# Public domain
errstatus=0
dirmode=""
usage="\
Usage: mkinstalldirs [-h] [--help] [-m mode] dir ..."
# process command line arguments
while test $# -gt 0 ; do
case $1 in
-h | --help | --h*) # -h for help
echo "$usage" 1>&2
exit 0
;;
-m) # -m PERM arg
shift
test $# -eq 0 && { echo "$usage" 1>&2; exit 1; }
dirmode=$1
shift
;;
--) # stop option processing
shift
break
;;
-*) # unknown option
echo "$usage" 1>&2
exit 1
;;
*) # first non-opt arg
break
;;
esac
done
for file
do
if test -d "$file"; then
shift
else
break
fi
done
case $# in
0) exit 0 ;;
esac
case $dirmode in
'')
if mkdir -p -- . 2>/dev/null; then
echo "mkdir -p -- $*"
exec mkdir -p -- "$@"
fi
;;
*)
if mkdir -m "$dirmode" -p -- . 2>/dev/null; then
echo "mkdir -m $dirmode -p -- $*"
exec mkdir -m "$dirmode" -p -- "$@"
fi
;;
esac
for file
do
set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
shift
pathcomp=
for d
do
pathcomp="$pathcomp$d"
case $pathcomp in
-*) pathcomp=./$pathcomp ;;
esac
if test ! -d "$pathcomp"; then
echo "mkdir $pathcomp"
mkdir "$pathcomp" || lasterr=$?
if test ! -d "$pathcomp"; then
errstatus=$lasterr
else
if test ! -z "$dirmode"; then
echo "chmod $dirmode $pathcomp"
lasterr=""
chmod "$dirmode" "$pathcomp" || lasterr=$?
if test ! -z "$lasterr"; then
errstatus=$lasterr
fi
fi
fi
fi
pathcomp="$pathcomp/"
done
done
exit $errstatus
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# End:
# mkinstalldirs ends here

29
src/Makefile.am Normal file
View File

@ -0,0 +1,29 @@
# Makefile.am for prt-get by Johannes Winkelmann
install-exec-local: install-binPROGRAMS
(cd $(DESTDIR)$(bindir); ln -sf prt-get prt-cache)
bin_PROGRAMS=prt-get
prt_get_SOURCES= argparser.cpp argparser.h\
depresolver.cpp depresolver.h \
installtransaction.cpp installtransaction.h \
main.cpp \
package.cpp package.h \
pkgdb.cpp pkgdb.h \
prtget.cpp prtget.h \
repository.cpp repository.h \
stringhelper.cpp stringhelper.h \
process.cpp process.h \
configuration.cpp configuration.h \
signaldispatcher.cpp signaldispatcher.h \
lockfile.cpp lockfile.h \
file.cpp file.h \
locker.cpp locker.h \
versioncomparator.cpp versioncomparator.h \
datafileparser.cpp datafileparser.h \
pg_regex.cpp pg_regex.h
AM_CPPFLAGS = -DSYSCONFDIR=\"$(sysconfdir)\" \
-DLOCALSTATEDIR=\"$(localstatedir)\"

452
src/Makefile.in Normal file
View File

@ -0,0 +1,452 @@
# Makefile.in generated by automake 1.9.5 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
# Makefile.am for prt-get by Johannes Winkelmann
SOURCES = $(prt_get_SOURCES)
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ..
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
bin_PROGRAMS = prt-get$(EXEEXT)
subdir = src
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
am__installdirs = "$(DESTDIR)$(bindir)"
binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
PROGRAMS = $(bin_PROGRAMS)
am_prt_get_OBJECTS = argparser.$(OBJEXT) depresolver.$(OBJEXT) \
installtransaction.$(OBJEXT) main.$(OBJEXT) package.$(OBJEXT) \
pkgdb.$(OBJEXT) prtget.$(OBJEXT) repository.$(OBJEXT) \
stringhelper.$(OBJEXT) process.$(OBJEXT) \
configuration.$(OBJEXT) signaldispatcher.$(OBJEXT) \
lockfile.$(OBJEXT) file.$(OBJEXT) locker.$(OBJEXT) \
versioncomparator.$(OBJEXT) datafileparser.$(OBJEXT) \
pg_regex.$(OBJEXT)
prt_get_OBJECTS = $(am_prt_get_OBJECTS)
prt_get_LDADD = $(LDADD)
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
CXXLD = $(CXX)
CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
-o $@
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
SOURCES = $(prt_get_SOURCES)
DIST_SOURCES = $(prt_get_SOURCES)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build_alias = @build_alias@
datadir = @datadir@
exec_prefix = @exec_prefix@
host_alias = @host_alias@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
prt_get_SOURCES = argparser.cpp argparser.h\
depresolver.cpp depresolver.h \
installtransaction.cpp installtransaction.h \
main.cpp \
package.cpp package.h \
pkgdb.cpp pkgdb.h \
prtget.cpp prtget.h \
repository.cpp repository.h \
stringhelper.cpp stringhelper.h \
process.cpp process.h \
configuration.cpp configuration.h \
signaldispatcher.cpp signaldispatcher.h \
lockfile.cpp lockfile.h \
file.cpp file.h \
locker.cpp locker.h \
versioncomparator.cpp versioncomparator.h \
datafileparser.cpp datafileparser.h \
pg_regex.cpp pg_regex.h
AM_CPPFLAGS = -DSYSCONFDIR=\"$(sysconfdir)\" \
-DLOCALSTATEDIR=\"$(localstatedir)\"
all: all-am
.SUFFIXES:
.SUFFIXES: .cpp .o .obj
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
&& exit 0; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile'; \
cd $(top_srcdir) && \
$(AUTOMAKE) --gnu src/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
install-binPROGRAMS: $(bin_PROGRAMS)
@$(NORMAL_INSTALL)
test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)"
@list='$(bin_PROGRAMS)'; for p in $$list; do \
p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
if test -f $$p \
; then \
f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
$(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
else :; fi; \
done
uninstall-binPROGRAMS:
@$(NORMAL_UNINSTALL)
@list='$(bin_PROGRAMS)'; for p in $$list; do \
f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
rm -f "$(DESTDIR)$(bindir)/$$f"; \
done
clean-binPROGRAMS:
-test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
prt-get$(EXEEXT): $(prt_get_OBJECTS) $(prt_get_DEPENDENCIES)
@rm -f prt-get$(EXEEXT)
$(CXXLINK) $(prt_get_LDFLAGS) $(prt_get_OBJECTS) $(prt_get_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/argparser.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/configuration.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/datafileparser.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/depresolver.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/file.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/installtransaction.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/locker.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lockfile.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/package.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pg_regex.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pkgdb.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/process.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/prtget.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/repository.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/signaldispatcher.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stringhelper.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/versioncomparator.Po@am__quote@
.cpp.o:
@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $<
.cpp.obj:
@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
uninstall-info-am:
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$tags $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& cd $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
case $$file in \
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
dir="/$$dir"; \
$(mkdir_p) "$(distdir)$$dir"; \
else \
dir=''; \
fi; \
if test -d $$d/$$file; then \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile $(PROGRAMS)
installdirs:
for dir in "$(DESTDIR)$(bindir)"; do \
test -z "$$dir" || $(mkdir_p) "$$dir"; \
done
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-binPROGRAMS clean-generic mostlyclean-am
distclean: distclean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-tags
dvi: dvi-am
dvi-am:
html: html-am
info: info-am
info-am:
install-data-am:
install-exec-am: install-binPROGRAMS install-exec-local
install-info: install-info-am
install-man:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-compile mostlyclean-generic
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-binPROGRAMS uninstall-info-am
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
clean-generic ctags distclean distclean-compile \
distclean-generic distclean-tags distdir dvi dvi-am html \
html-am info info-am install install-am install-binPROGRAMS \
install-data install-data-am install-exec install-exec-am \
install-exec-local install-info install-info-am install-man \
install-strip installcheck installcheck-am installdirs \
maintainer-clean maintainer-clean-generic mostlyclean \
mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \
tags uninstall uninstall-am uninstall-binPROGRAMS \
uninstall-info-am
install-exec-local: install-binPROGRAMS
(cd $(DESTDIR)$(bindir); ln -sf prt-get prt-cache)
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

445
src/argparser.cpp Normal file
View File

@ -0,0 +1,445 @@
////////////////////////////////////////////////////////////////////////
// FILE: argparser.cpp
// AUTHOR: Johannes Winkelmann, jw@tks6.net
// COPYRIGHT: (c) 2002 by Johannes Winkelmann
// ---------------------------------------------------------------------
// 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.
////////////////////////////////////////////////////////////////////////
using namespace std;
#include "argparser.h"
/*!
Construct a ArgParser object
\param argc argument count
\param argv argument vector
*/
ArgParser::ArgParser( int argc, char** argv )
: m_isCommandGiven( false ),
m_isForced( false ),
m_isTest( false ),
m_isAlternateConfigGiven( false ),
m_useCache( false ),
m_calledAsPrtCache( false ),
m_alternateConfigFile( "" ),
m_pkgmkArgs( "" ),
m_pkgaddArgs( "" ),
m_pkgrmArgs( "" ),
m_installRoot( "" ),
m_ignore( "" ),
m_argc( argc ),
m_argv( argv ),
m_verbose( 0 ),
m_writeLog( false ),
m_hasFilter( false ),
m_noStdConfig( false ),
m_nodeps( false ),
m_all( false ),
m_printPath( false ),
m_execPreInstall( false ),
m_execPostInstall( false ),
m_preferHigher( false ),
m_strictDiff( false ),
m_useRegex(false),
m_fullPath(false)
{
}
/*!
\return true if an alternate configuration file is given
*/
bool ArgParser::isAlternateConfigGiven() const
{
return m_isAlternateConfigGiven;
}
/*!
\return true if a command is given
*/
bool ArgParser::isCommandGiven() const
{
return m_isCommandGiven;
}
/*!
\return a list of arguments not processed by ArgParser
*/
const list<char*>& ArgParser::otherArgs() const
{
return m_otherArgs;
}
/*!
\return what command was given
*/
ArgParser::Type ArgParser::commandType() const
{
return m_commandType;
}
/*!
\return addtional arguments to pkgmk
*/
const string& ArgParser::pkgmkArgs() const
{
return m_pkgmkArgs;
}
/*!
\return addtional arguments to pkgadd
*/
const string& ArgParser::pkgaddArgs() const
{
return m_pkgaddArgs;
}
/*!
\return the name of the alternative configuration file
*/
const string& ArgParser::alternateConfigFile() const
{
return m_alternateConfigFile;
}
/*!
parse the arguments
\return true on success
*/
bool ArgParser::parse()
{
const int commandCount = 34;
string commands[commandCount] = { "list", "search", "dsearch",
"info",
"depends", "install", "depinst",
"help", "isinst", "dup", "update",
"quickdep", "diff", "quickdiff",
"grpinst", "version", "cache",
"path", "listinst", "printf", "readme",
"dependent", "sysup", "current",
"fsearch", "lock", "unlock",
"listlocked", "cat", "ls", "edit",
"remove", "deptree", "dumpconfig" };
Type commandID[commandCount] = { LIST, SEARCH, DSEARCH, INFO,
DEPENDS, INSTALL, DEPINST,
HELP, ISINST, DUP, UPDATE,
QUICKDEP, DIFF, QUICKDIFF,
GRPINST, SHOW_VERSION, CREATE_CACHE,
PATH, LISTINST, PRINTF, README,
DEPENDENT, SYSUP, CURRENT,
FSEARCH, LOCK, UNLOCK, LISTLOCKED,
CAT, LS, EDIT, REMOVE, DEPTREE,
DUMPCONFIG };
if ( m_argc < 2 ) {
return false;
}
// if called from a symlink ending on prt-cache, use cached
// access
string app = m_argv[0];
string::size_type pos = app.rfind( "/" );
if ( pos != string::npos ) {
app = app.substr( pos );
}
if ( app.find( "prt-cache" ) != string::npos ) {
m_useCache = true;
m_calledAsPrtCache = true;
}
for ( int i = 1; i < m_argc; ++i ) {
if ( m_argv[i][0] == '-' ) {
string s = m_argv[i];
if ( s == "-v" ) {
m_verbose += 1;
} else if ( s == "-vv" ) {
m_verbose += 2;
} else if ( s == "--force" ) {
m_isForced = true;
} else if ( s == "--test" ) {
m_isTest = true;
} else if ( s == "--cache" ) {
m_useCache = true;
} else if ( s == "--nodeps" ) {
m_nodeps = true;
} else if ( s == "--all" ) {
m_all = true;
} else if ( s == "--path" ) {
m_printPath = true;
} else if ( s == "--log" ) {
m_writeLog = true;
} else if ( s == "--pre-install" ) {
m_execPreInstall = true;
} else if ( s == "--post-install" ) {
m_execPostInstall = true;
} else if ( s == "--install-scripts" ) {
m_execPreInstall = true;
m_execPostInstall = true;
} else if ( s == "--no-std-config" ) {
m_noStdConfig = true;
} else if ( s == "--prefer-higher" || s == "-ph" ) {
m_preferHigher = true;
} else if ( s == "--strict-diff" || s == "-sd" ) {
m_strictDiff = true;
} else if ( s == "--regex" ) {
m_useRegex = true;
} else if ( s == "--full" ) {
m_fullPath = true;
} else if ( s == "-f" ) {
m_pkgaddArgs += " " + s;
} else if ( s == "-fr" ) {
m_pkgmkArgs += " -f";
} else if ( s == "-if" ) {
m_pkgmkArgs += " " + s;
} else if ( s == "-uf" ) {
m_pkgmkArgs += " " + s;
} else if ( s == "-im" ) {
m_pkgmkArgs += " " + s;
} else if ( s == "-um" ) {
m_pkgmkArgs += " " + s;
} else if ( s == "-kw" ) {
m_pkgmkArgs += " " + s;
} else if ( s == "-ns" ) {
m_pkgmkArgs += " " + s;
} else if ( s == "-fi" ) {
m_pkgaddArgs += " -f";
}
// substrings
else if ( s.substr( 0, 8 ) == "--margs=" ) {
m_pkgmkArgs += " " + s.substr( 8 );
} else if ( s.substr( 0, 8 ) == "--aargs=" ) {
m_pkgaddArgs += " " + s.substr( 8 );
} else if ( s.substr( 0, 8 ) == "--rargs=" ) {
m_pkgrmArgs = s.substr( 8 );
} else if ( s.substr( 0, 7 ) == "--sort=" ) {
m_sortArgs = s.substr( 7 );
} else if ( s.substr( 0, 9 ) == "--filter=" ) {
m_filter = s.substr( 9 );
m_hasFilter = true;
} else if ( s.substr( 0, 9 ) == "--config=" ) {
m_alternateConfigFile = s.substr( 9 );
m_isAlternateConfigGiven = true;
} else if ( s.substr( 0, 16 ) == "--config-append=" ) {
m_configData.push_back(make_pair(m_argv[i]+16,
CONFIG_APPEND ) );
} else if ( s.substr( 0, 17 ) == "--config-prepend=" ) {
m_configData.push_back(make_pair(m_argv[i]+17,
CONFIG_PREPEND ) );
} else if ( s.substr( 0, 13 ) == "--config-set=" ) {
m_configData.push_back(make_pair(m_argv[i]+13, CONFIG_SET ) );
} else if ( s.substr( 0, 15 ) == "--install-root=" ) {
m_installRoot = s.substr(15);
} else if ( s.substr( 0, 9 ) == "--ignore=" ) {
m_ignore = s.substr(9);
} else {
m_unknownOption = s;
return false;
}
} else {
if (!m_isCommandGiven) {
string s = m_argv[i];
m_commandName = s;
for ( int i = 0; i < commandCount; ++i ) {
if ( s == commands[i] ) {
m_isCommandGiven = true;
m_commandType = commandID[i];
break;
}
}
// first argument must be command
if ( !m_isCommandGiven ) {
return false;
}
} else {
m_otherArgs.push_back( m_argv[i] );
}
}
}
return m_isCommandGiven;
}
/*!
\return true whether --force has been specified
*/
bool ArgParser::isForced() const
{
return m_isForced;
}
/*!
\return true whether --test has been specified
*/
bool ArgParser::isTest() const
{
return m_isTest;
}
/*!
\return the level of verbose: -v -> 1, -vv -> 2
*/
int ArgParser::verbose() const
{
return m_verbose;
}
/*!
\return whether --cache has been specified
*/
bool ArgParser::useCache() const
{
return m_useCache;
}
/*!
\return whether prt-get was called as 'prt-cache' or not
*/
bool ArgParser::wasCalledAsPrtCached() const
{
return m_calledAsPrtCache;
}
/*!
\return whether prt-get should write to a log file or not
*/
bool ArgParser::writeLog() const
{
return m_writeLog;
}
/*!
\return the --sort="..." string
*/
const string& ArgParser::sortArgs() const
{
return m_sortArgs;
}
/*!
\return whether there was a --filter argument
*/
bool ArgParser::hasFilter() const
{
return m_hasFilter;
}
/*!
\return whether there was a --no-std-config argument
*/
bool ArgParser::noStdConfig() const
{
return m_noStdConfig;
}
/*!
\return the --filter="..." string
*/
const string& ArgParser::filter() const
{
return m_filter;
}
/*!
\return whether there was a --nodeps argument
*/
bool ArgParser::nodeps() const
{
return m_nodeps;
}
/*!
\return whether there was a --all argument
*/
bool ArgParser::all() const
{
return m_all;
}
bool ArgParser::printPath() const
{
return m_printPath;
}
const string& ArgParser::commandName() const
{
return m_commandName;
}
const string& ArgParser::unknownOption() const
{
return m_unknownOption;
}
bool ArgParser::execPreInstall() const
{
return m_execPreInstall;
}
bool ArgParser::execPostInstall() const
{
return m_execPostInstall;
}
const list< pair<char*, ArgParser::ConfigArgType> >
ArgParser::configData() const
{
return m_configData;
}
const string& ArgParser::installRoot() const
{
return m_installRoot;
}
const string& ArgParser::pkgrmArgs() const
{
return m_pkgrmArgs;
}
bool ArgParser::preferHigher() const
{
return m_preferHigher;
}
bool ArgParser::strictDiff() const
{
return m_strictDiff;
}
bool ArgParser::useRegex() const
{
return m_useRegex;
}
bool ArgParser::fullPath() const
{
return m_fullPath;
}
const string& ArgParser::ignore() const
{
return m_ignore;
}

133
src/argparser.h Normal file
View File

@ -0,0 +1,133 @@
////////////////////////////////////////////////////////////////////////
// FILE: argparser.h
// AUTHOR: Johannes Winkelmann, jw@tks6.net
// COPYRIGHT: (c) 2002 by Johannes Winkelmann
// ---------------------------------------------------------------------
// 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.
////////////////////////////////////////////////////////////////////////
#ifndef _ARGPARSER_H_
#define _ARGPARSER_H_
#include <list>
#include <string>
using namespace std;
/*!
\class ArgParser
\brief Argument Parser
This is the argument parser for prt-get.
*/
class ArgParser
{
public:
ArgParser( int argc, char** argv );
bool parse();
/*! Command type */
enum Type { HELP, LIST, SEARCH, DSEARCH, INSTALL, DEPINST,
INFO, DEPENDS, ISINST, DUP, UPDATE,
QUICKDEP, DIFF, GRPINST, GRPUPDATE,
QUICKDIFF, SHOW_VERSION, CREATE_CACHE, PATH,
LISTINST, PRINTF, README, DEPENDENT, SYSUP,
CURRENT, FSEARCH, LOCK, UNLOCK, LISTLOCKED,
CAT, LS, EDIT, REMOVE,
DEPTREE, DUMPCONFIG };
bool isCommandGiven() const;
bool isForced() const;
bool isTest() const;
bool isAlternateConfigGiven() const;
bool useCache() const;
bool wasCalledAsPrtCached() const;
bool writeLog() const;
bool hasFilter() const;
bool noStdConfig() const;
bool nodeps() const;
bool all() const;
bool printPath() const;
bool execPreInstall() const;
bool execPostInstall() const;
bool preferHigher() const;
bool strictDiff() const;
bool useRegex() const;
bool fullPath() const;
const string& alternateConfigFile() const;
const string& pkgmkArgs() const;
const string& pkgaddArgs() const;
const string& pkgrmArgs() const;
const string& sortArgs() const;
const string& filter() const;
const string& installRoot() const;
const string& ignore() const;
Type commandType() const;
const string& commandName() const;
const string& unknownOption() const;
const list<char*>& otherArgs() const;
int verbose() const;
enum ConfigArgType { CONFIG_SET, CONFIG_APPEND, CONFIG_PREPEND };
const list< pair<char*, ConfigArgType> > configData() const;
private:
bool m_isCommandGiven;
bool m_isForced;
bool m_isTest;
bool m_isAlternateConfigGiven;
bool m_useCache;
bool m_calledAsPrtCache;
bool m_hasFilter;
bool m_noStdConfig;
bool m_writeLog;
bool m_nodeps;
bool m_all;
bool m_printPath;
bool m_execPreInstall;
bool m_execPostInstall;
bool m_preferHigher;
bool m_strictDiff;
bool m_useRegex;
bool m_fullPath;
string m_alternateConfigFile;
string m_pkgmkArgs;
string m_pkgaddArgs;
string m_pkgrmArgs;
string m_sortArgs;
string m_filter;
string m_commandName;
string m_unknownOption;
string m_installRoot;
string m_ignore;
Type m_commandType;
int m_argc;
char** m_argv;
int m_verbose;
list<char*> m_otherArgs;
list< pair<char*, ConfigArgType> > m_configData;
};
#endif /* _ARGPARSER_H_ */

225
src/configuration.cpp Normal file
View File

@ -0,0 +1,225 @@
////////////////////////////////////////////////////////////////////////
// FILE: configuration.cpp
// AUTHOR: Johannes Winkelmann, jw@tks6.net
// COPYRIGHT: (c) 2002 by Johannes Winkelmann
// ---------------------------------------------------------------------
// 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.
////////////////////////////////////////////////////////////////////////
#include <iostream>
#include <cstdio>
#include <dirent.h>
#include "configuration.h"
#include "stringhelper.h"
#include "argparser.h"
using namespace std;
using namespace StringHelper;
Configuration::Configuration( const std::string& configFile,
const ArgParser* parser )
: m_configFile( configFile ),
m_parser( parser ),
m_writeLog( false ),
m_appendLog( false ),
m_logFilePattern( "" ),
m_cacheFile( "" ),
m_readmeMode( VERBOSE_README ),
m_runScripts( false ),
m_preferHigher( false ),
m_useRegex( false ),
m_makeCommand( "" ), m_addCommand( "" ),
m_removeCommand( "" ), m_runscriptCommand( "" )
{
}
bool Configuration::parse()
{
FILE* fp = fopen( m_configFile.c_str(), "r" );
if ( !fp ) {
return false;
}
const int length = BUFSIZ;
char input[length];
string s;
while ( fgets( input, length, fp ) ) {
s = input;
s = getValueBefore( s, '#' );
s = stripWhiteSpace( s );
parseLine(s);
}
fclose( fp );
// command line arguments override config:
if ( m_parser->writeLog() ) {
m_writeLog = true;
}
return true;
}
bool Configuration::writeLog() const
{
return m_writeLog;
}
bool Configuration::appendLog() const
{
return m_appendLog;
}
string Configuration::logFilePattern() const
{
return m_logFilePattern;
}
const list< pair<string, string> >& Configuration::rootList() const
{
return m_rootList;
}
Configuration::ReadmeMode Configuration::readmeMode() const
{
return m_readmeMode;
}
std::string Configuration::cacheFile() const
{
return m_cacheFile;
}
void Configuration::addConfig(const string& line,
bool configSet,
bool configPrepend)
{
if (configSet && startwith_nocase( line, "prtdir" )) {
m_rootList.clear();
}
parseLine(line, configPrepend);
}
/*!
parse a line and set the configuration data accordingly; if \a
prepend is set, prepend the data for configuration options which are lists
*/
void Configuration::parseLine(const string& line, bool prepend)
{
string s = line;
if ( s.empty() ) {
return;
}
if ( startwith_nocase( s, "prtdir" ) ) {
s = stripWhiteSpace( s.replace( 0, 6, "" ) );
string path = stripWhiteSpace( getValueBefore( s, ':' ) );
string packages = getValue( s, ':' );
DIR* dir = opendir( path.c_str() );
if ( dir ) {
closedir( dir );
if (prepend) {
m_rootList.push_front( make_pair( path, packages ) );
} else {
m_rootList.push_back( make_pair( path, packages ) );
}
} else {
cerr << "[Config error: can't access " << path
<< "]" << endl;
}
} else if ( startwith_nocase( s, "cachefile" ) ) {
s = stripWhiteSpace( s.replace( 0, 9, "" ) );
m_cacheFile = s;
} else if ( startwith_nocase( s, "writelog" ) ) {
s = stripWhiteSpace( s.replace( 0, 8, "" ) );
if ( s == "enabled" ) {
// it's already set to false, so we can just enable it.
// like this, the command line switch works as well
m_writeLog = true;
}
} else if ( startwith_nocase( s, "logfile" ) ) {
s = stripWhiteSpace( s.replace( 0, 7, "" ) );
m_logFilePattern = s;
} else if ( startwith_nocase( s, "logmode" ) ) {
s = stripWhiteSpace( s.replace( 0, 7, "" ) );
if ( s == "append" ) {
m_appendLog = true;
}
} else if ( startwith_nocase( s, "readme" ) ) {
s = stripWhiteSpace( s.replace( 0, 6, "" ) );
if ( s == "compact" ) {
m_readmeMode = COMPACT_README;
} else if ( s == "disabled" ) {
m_readmeMode = NO_README;
}
} else if ( startwith_nocase( s, "runscripts" ) ) {
s = stripWhiteSpace( s.replace( 0, 10, "" ) );
if ( s == "yes" ) {
m_runScripts = true;
}
} else if ( startwith_nocase( s, "preferhigher" ) ) {
s = stripWhiteSpace( s.replace( 0, 12, "" ) );
if ( s == "yes" ) {
m_preferHigher = true;
}
} else if ( startwith_nocase( s, "useregex" ) ) {
s = stripWhiteSpace( s.replace( 0, 8, "" ) );
if ( s == "yes" ) {
m_useRegex = true;
}
} else if ( startwith_nocase( s, "makecommand" ) ) {
m_makeCommand = stripWhiteSpace( s.replace( 0, 11, "" ) );
} else if ( startwith_nocase( s, "addcommand" ) ) {
m_addCommand = stripWhiteSpace( s.replace( 0, 10, "" ) );
} else if ( startwith_nocase( s, "removecommand" ) ) {
m_removeCommand = stripWhiteSpace( s.replace( 0, 13, "" ) );
} else if ( startwith_nocase( s, "runscriptcommand" ) ) {
m_runscriptCommand = stripWhiteSpace( s.replace( 0, 16, "" ) );
}
}
bool Configuration::runScripts() const
{
return m_runScripts;
}
std::string Configuration::makeCommand() const
{
return m_makeCommand;
}
std::string Configuration::addCommand() const
{
return m_addCommand;
}
std::string Configuration::removeCommand() const
{
return m_removeCommand;
}
std::string Configuration::runscriptCommand() const
{
return m_runscriptCommand;
}
bool Configuration::preferHigher() const
{
return m_preferHigher;
}
bool Configuration::useRegex() const
{
return m_useRegex;
}

83
src/configuration.h Normal file
View File

@ -0,0 +1,83 @@
////////////////////////////////////////////////////////////////////////
// FILE: configuration.h
// AUTHOR: Johannes Winkelmann, jw@tks6.net
// COPYRIGHT: (c) 2002 by Johannes Winkelmann
// ---------------------------------------------------------------------
// 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.
////////////////////////////////////////////////////////////////////////
#ifndef _CONFIGURATION_H_
#define _CONFIGURATION_H_
#include <string>
#include <list>
#include <utility>
class ArgParser;
/*!
Configuration file class
*/
class Configuration
{
public:
Configuration( const std::string& configFile, const ArgParser* parser );
bool parse();
bool writeLog() const;
bool appendLog() const;
std::string logFilePattern() const;
const std::list< std::pair<std::string, std::string> >& rootList() const;
enum ReadmeMode { VERBOSE_README, COMPACT_README, NO_README };
ReadmeMode readmeMode() const;
std::string cacheFile() const;
bool runScripts() const;
bool preferHigher() const;
bool useRegex() const;
void addConfig(const std::string& line,
bool configSet,
bool configPrepend);
std::string makeCommand() const;
std::string addCommand() const;
std::string removeCommand() const;
std::string runscriptCommand() const;
private:
std::string m_configFile;
const ArgParser* m_parser;
// config data
std::string m_cacheFile;
std::list< std::pair<std::string, std::string> > m_rootList;
std::string m_logFilePattern;
bool m_writeLog;
bool m_appendLog;
ReadmeMode m_readmeMode;
bool m_runScripts;
bool m_preferHigher;
bool m_useRegex;
std::string m_makeCommand;
std::string m_addCommand;
std::string m_removeCommand;
std::string m_runscriptCommand;
void parseLine(const std::string& line, bool prepend=false);
};
#endif /* _CONFIGURATION_H_ */

50
src/datafileparser.cpp Normal file
View File

@ -0,0 +1,50 @@
////////////////////////////////////////////////////////////////////////
// FILE: datafileparser.cpp
// AUTHOR: Johannes Winkelmann, jw@tks6.net
// COPYRIGHT: (c) 2002 by Johannes Winkelmann
// ---------------------------------------------------------------------
// 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.
////////////////////////////////////////////////////////////////////////
#include <cstdio>
#include "datafileparser.h"
#include "stringhelper.h"
using namespace std;
using namespace StringHelper;
bool DataFileParser::parse(const string& fileName,
map<string, string>& target)
{
FILE* fd = fopen(fileName.c_str(), "r");
char buffer[512];
string input;
if (!fd) {
return false;
}
while (fgets(buffer, 512, fd)) {
input = buffer;
input = stripWhiteSpace(input);
if (input.length() > 0 && input[0] != '#') {
string::size_type pos = input.find(":");
if (pos != string::npos) {
string name = stripWhiteSpace(input.substr(0, pos));
string deps = stripWhiteSpace(input.substr(pos+1));
deps = StringHelper::replaceAll(deps, " ", " ");
deps = StringHelper::replaceAll(deps, " ", ",");
deps = StringHelper::replaceAll(deps, ",,", ",");
target[name] = deps;
}
}
}
fclose(fd);
return true;
}

29
src/datafileparser.h Normal file
View File

@ -0,0 +1,29 @@
////////////////////////////////////////////////////////////////////////
// FILE: datafileparser.h
// AUTHOR: Johannes Winkelmann, jw@tks6.net
// COPYRIGHT: (c) 2004 by Johannes Winkelmann
// ---------------------------------------------------------------------
// 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.
////////////////////////////////////////////////////////////////////////
#ifndef _DATAFILEPARSER_H_
#define _DATAFILEPARSER_H_
#include <map>
#include <string>
/**
* Parser for files of the format
* key : value1,value2
*/
class DataFileParser
{
public:
static bool parse(const std::string& fileName,
std::map<std::string, std::string>& target);
};
#endif /* _DATAFILEPARSER_H_ */

102
src/depresolver.cpp Normal file
View File

@ -0,0 +1,102 @@
////////////////////////////////////////////////////////////////////////
// FILE: depresolver.cpp
// AUTHOR: Johannes Winkelmann, jw@tks6.net
// COPYRIGHT: (c) 2002 by Johannes Winkelmann
// ---------------------------------------------------------------------
// 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.
////////////////////////////////////////////////////////////////////////
#include <map>
#include <cassert>
using namespace std;
#include "depresolver.h"
/*!
add a dependency
\param first the package with dependency
\param second the pacakge which \a first depends on
*/
void DepResolver::addDependency( int first, int second )
{
m_dependencies.push_back( Pair( first, second ) );
}
/*!
resolve the dependencies
\param result a list which will be filled with resulting indexes in
the correct order
\return true on success, false otherwise (cyclic dependencies)
*/
bool DepResolver::resolve( list<int>& result )
{
return topSort( result );
}
/*!
sort the dependencies
*/
bool DepResolver::topSort( list<int>& result )
{
map<int, int > numPreds; // elt -> number of predecessors
map<int, list<int> > successors; // elt -> number of successors
list<Pair>::iterator it = m_dependencies.begin();
for ( ; it != m_dependencies.end(); ++it ) {
// make sure every elt is a key in numpreds
if ( numPreds.find( it->first ) == numPreds.end() ) {
numPreds[it->first] = 0;
}
if ( numPreds.find( it->second ) == numPreds.end() ) {
numPreds[it->second] = 0;
}
// if they're the same, there's no real dependence
if ( it->first == it->second ) {
continue;
}
// since first < second, second gains a pred
numPreds[it->second] = numPreds[it->second] + 1;
// ... and first gains a succ
successors[it->first].push_back( it->second );
}
// suck up everything without a predecessor
result.clear();
map<int, int>::iterator mit = numPreds.begin();
for ( ; mit != numPreds.end(); ++mit ) {
if ( mit->second == 0 ) {
result.push_back( mit->first );
}
}
// for everything in answer, knock down the pred count on
// its successors; note that answer grows *in* the loop
list<int>::iterator lit = result.begin();
for ( ; lit != result.end(); ++lit ) {
assert( numPreds[*lit] == 0 );
numPreds.erase( *lit );
if ( successors.find( *lit ) != successors.end() ) {
list<int>::iterator succIt = successors[*lit].begin();
for ( ; succIt != successors[*lit].end(); ++succIt ) {
numPreds[*succIt] = numPreds[*succIt] - 1;
if ( numPreds[*succIt] == 0 ) {
result.push_back( *succIt );
}
}
successors.erase( *lit );
}
}
return numPreds.size() == 0;
}

43
src/depresolver.h Normal file
View File

@ -0,0 +1,43 @@
////////////////////////////////////////////////////////////////////////
// FILE: depresolver.h
// AUTHOR: Johannes Winkelmann, jw@tks6.net
// COPYRIGHT: (c) 2002 by Johannes Winkelmann
// ---------------------------------------------------------------------
// 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.
////////////////////////////////////////////////////////////////////////
#ifndef _DEPRESOLVER_H_
#define _DEPRESOLVER_H_
#include <list>
using namespace std;
/*!
\class DepResolver
\brief a dependency resolver
A dependency resolver
*/
class DepResolver
{
public:
void addDependency( int, int );
bool resolve( list<int>& result );
private:
/*! simple int pair, so we don't have to use std::pair */
struct Pair {
Pair( int f, int s ) : first( f ), second( s ) {}
int first;
int second;
};
bool topSort( list<int>& result );
list<Pair> m_dependencies;
};
#endif /* _DEPRESOLVER_H_ */

92
src/file.cpp Normal file
View File

@ -0,0 +1,92 @@
////////////////////////////////////////////////////////////////////////
// FILE: file.cpp
// AUTHOR: Johannes Winkelmann, jw@tks6.net
// COPYRIGHT: (c) 2002 by Johannes Winkelmann
// ---------------------------------------------------------------------
// 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.
////////////////////////////////////////////////////////////////////////
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <cstdio>
#include <fnmatch.h>
#include <libgen.h>
using namespace std;
#include "stringhelper.h"
#include "pg_regex.h"
namespace File
{
bool fileExists( const string& fileName )
{
struct stat result;
return stat( fileName.c_str(), &result ) == 0;
}
bool grep( const string& fileName,
const string& pattern,
list<string>& result,
bool fullPath,
bool useRegex)
{
FILE* fp;
fp = fopen( fileName.c_str(), "r" );
if ( !fp ) {
return false;
}
const int length = BUFSIZ;
char input[length];
char* p;
char* end;
string line;
string entry;
RegEx re(pattern);
while ( fgets( input, length, fp ) ) {
p = strtok( input, "\t" );
p = strtok( NULL, "\t" );
p = strtok( NULL, "\t" );
if ( p ) {
// prepend slash to string
p--;
p[0] = '/';
entry = p;
end = strstr(p, "->");
if (end) {
*end = '\0';
}
p[strlen(p)-1] = '\0'; // strip newline
char* name = p;
if (!fullPath) {
name = basename(p);
}
if (useRegex) {
if (re.match(name)) {
result.push_back(StringHelper::stripWhiteSpace(entry));
}
} else {
if ( fnmatch(pattern.c_str(), name, FNM_CASEFOLD) == 0 ) {
result.push_back( StringHelper::stripWhiteSpace(entry) );
}
}
}
}
fclose( fp );
return true;
}
}

30
src/file.h Normal file
View File

@ -0,0 +1,30 @@
////////////////////////////////////////////////////////////////////////
// FILE: file.h
// AUTHOR: Johannes Winkelmann, jw@tks6.net
// COPYRIGHT: (c) 2002 by Johannes Winkelmann
// ---------------------------------------------------------------------
// 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.
////////////////////////////////////////////////////////////////////////
#ifndef _FILE_H_
#define _FILE_H_
#include <list>
#include <string>
namespace File
{
bool fileExists( const std::string& fileName );
bool grep( const std::string& fileName,
const std::string& pattern,
std::list<string>& result,
bool fullPath,
bool useRegex);
}
#endif /* _FILE_H_ */

539
src/installtransaction.cpp Normal file
View File

@ -0,0 +1,539 @@
////////////////////////////////////////////////////////////////////////
// FILE: installtransaction.cpp
// AUTHOR: Johannes Winkelmann, jw@tks6.net
// COPYRIGHT: (c) 2002 by Johannes Winkelmann
// ---------------------------------------------------------------------
// 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.
////////////////////////////////////////////////////////////////////////
#include <unistd.h>
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <list>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
using namespace std;
#include "installtransaction.h"
#include "repository.h"
#include "pkgdb.h"
#include "stringhelper.h"
#include "argparser.h"
#include "process.h"
#include "configuration.h"
#ifdef USE_LOCKING
#include "lockfile.h"
#endif
using namespace StringHelper;
const string InstallTransaction::PKGMK_DEFAULT_COMMAND = "/usr/bin/pkgmk";
const string InstallTransaction::PKGADD_DEFAULT_COMMAND = "/usr/bin/pkgadd";
const string InstallTransaction::PKGRM_DEFAULT_COMMAND = "/usr/bin/pkgrm";
/*!
Create a nice InstallTransaction
\param names a list of port names to be installed
\param repo the repository to look for packages
\param pkgDB the pkgDB with already installed packages
*/
InstallTransaction::InstallTransaction( const list<char*>& names,
const Repository* repo,
PkgDB* pkgDB,
const Configuration* config )
: m_repo( repo ),
m_pkgDB( pkgDB ),
m_depCalced( false ),
m_config( config )
{
list<char*>::const_iterator it = names.begin();
for ( ; it != names.end(); ++it ) {
m_packages.push_back( make_pair( *it, m_repo->getPackage( *it ) ) );
}
}
/*!
Create a nice InstallTransaction
\param names a list of port names to be installed
\param repo the repository to look for packages
\param pkgDB the pkgDB with already installed packages
*/
InstallTransaction::InstallTransaction( const list<string>& names,
const Repository* repo,
PkgDB* pkgDB,
const Configuration* config )
: m_repo( repo ),
m_pkgDB( pkgDB ),
m_depCalced( false ),
m_config( config )
{
list<string>::const_iterator it = names.begin();
for ( ; it != names.end(); ++it ) {
m_packages.push_back( make_pair( *it, m_repo->getPackage( *it ) ) );
}
}
/*!
\return packages where building/installation failed
*/
const list< pair<string, InstallTransaction::InstallInfo> >&
InstallTransaction::installError() const
{
return m_installErrors;
}
/*!
install (commit) a transaction
\param parser the argument parser
\param update whether this is an update operation
\param group whether this is a group transaction (stops transaction on error)
\return returns an InstallResult telling whether installation worked
*/
InstallTransaction::InstallResult
InstallTransaction::install( const ArgParser* parser,
bool update, bool group )
{
if ( m_packages.empty() ) {
return NO_PACKAGE_GIVEN;
}
list<string> ignoredPackages;
StringHelper::split(parser->ignore(), ',', ignoredPackages);
list< pair<string, const Package*> >::iterator it = m_packages.begin();
for ( ; it != m_packages.end(); ++it ) {
const Package* package = it->second;
if (find(ignoredPackages.begin(),
ignoredPackages.end(),
it->first) != ignoredPackages.end() ) {
m_ignoredPackages.push_back(it->first);
continue;
}
if ( package == NULL ) {
m_missingPackages.push_back( make_pair( it->first, string("") ) );
if ( group ) {
return PACKAGE_NOT_FOUND;
}
continue;
}
// consider aliases here, but don't show them specifically
if ( !update && m_pkgDB->isInstalled( package->name(), true ) ) {
// ignore
m_alreadyInstalledPackages.push_back( package->name() );
continue;
}
InstallTransaction::InstallResult result;
InstallInfo info( package->hasReadme() );
if ( parser->isTest() ||
(result = installPackage( package, parser, update, info )) == SUCCESS) {
m_installedPackages.push_back( make_pair( package->name(), info));
} else {
// log failures are critical
if ( result == LOG_DIR_FAILURE ||
result == LOG_FILE_FAILURE ||
result == NO_LOG_FILE ||
result == CANT_LOCK_LOG_FILE ||
// or pkgdest
result == PKGDEST_ERROR ) {
return result;
}
m_installErrors.push_back( make_pair(package->name(), info) );
if ( group ) {
return PKGMK_FAILURE;
}
}
}
return SUCCESS;
}
/*!
Install a single package
\param package the package to be installed
\param parser the argument parser to be used
\param update whether this is an update transaction
\param info store pre and post install information
*/
InstallTransaction::InstallResult
InstallTransaction::installPackage( const Package* package,
const ArgParser* parser,
bool update,
InstallTransaction::InstallInfo& info )
const
{
InstallTransaction::InstallResult result = SUCCESS;
#ifdef USE_LOCKING
LockFile lockFile;
#endif
int fdlog = -1;
if ( m_config->writeLog() ) {
string logFile = m_config->logFilePattern();
if ( logFile == "" ) {
return NO_LOG_FILE;
}
StringHelper::replaceAll( logFile, "%n", package->name() );
StringHelper::replaceAll( logFile, "%p", package->path() );
StringHelper::replaceAll( logFile, "%v", package->version() );
StringHelper::replaceAll( logFile, "%r", package->release() );
#ifdef USE_LOCKING
lockFile.setFile( logFile );
if ( !lockFile.lockWrite() ) {
cout << "here" << logFile << endl;
return CANT_LOCK_LOG_FILE;
}
#endif
size_t pos = logFile.find_last_of( "/" );
if ( pos != string::npos ) {
if ( !Repository::createOutputDir( logFile.substr( 0, pos ) ) ) {
return LOG_DIR_FAILURE;
}
}
if ( !m_config->appendLog() ) {
unlink( logFile.c_str() );
}
fdlog = open( logFile.c_str(),
O_APPEND | O_WRONLY | O_CREAT, 0666 );
if ( fdlog == -1 ) {
return LOG_FILE_FAILURE;
}
}
string pkgdir = package->path() + "/" + package->name();
chdir( pkgdir.c_str() );
string runscriptCommand = "sh";
if (m_config->runscriptCommand() != "") {
runscriptCommand = m_config->runscriptCommand();
}
// -- pre-install
struct stat statData;
if ((parser->execPreInstall() || m_config->runScripts()) &&
stat((pkgdir + "/" + "pre-install").c_str(), &statData) == 0) {
Process preProc( runscriptCommand,
pkgdir + "/" + "pre-install",
fdlog );
if (preProc.executeShell()) {
info.preState = FAILED;
} else {
info.preState = EXEC_SUCCESS;
}
}
// -- build
string cmd = PKGMK_DEFAULT_COMMAND;
if (m_config->makeCommand() != "") {
cmd = m_config->makeCommand();
}
string args = "-d " + parser->pkgmkArgs();
Process makeProc( cmd, args, fdlog );
if ( makeProc.executeShell() ) {
result = PKGMK_FAILURE;
} else {
// -- update
string pkgdest = getPkgDest();
if ( pkgdest != "" ) {
// TODO: don't manipulate pkgdir
pkgdir = pkgdest;
string message = "Using PKGMK_PACKAGE_DIR: " + pkgdir;
cout << message << endl;
if ( m_config->writeLog() ) {
write( fdlog, message.c_str(), message.length() );
write( fdlog, "\n", 1 );
}
}
// the following chdir is a noop if usePkgDest() returns false
if ( chdir( pkgdir.c_str() ) != 0 ) {
result = PKGDEST_ERROR;
} else {
cmd = PKGADD_DEFAULT_COMMAND;
if (m_config->addCommand() != "") {
cmd = m_config->addCommand();
}
args = "";
if (parser->installRoot() != "") {
args = "-r " + parser->installRoot() + " ";
}
if ( update ) {
args += "-u ";
}
if ( !parser->pkgaddArgs().empty() ) {
args += parser->pkgaddArgs() + " ";
}
args +=
package->name() + "#" +
package->version() + "-" +
package->release() + ".pkg.tar.gz";
string commandName = "prt-get";
if ( parser->wasCalledAsPrtCached() ) {
commandName = "prt-cache";
}
string message = commandName + ": " + cmd + " " + args;
cout << message << endl;
if ( m_config->writeLog() ) {
write( fdlog, message.c_str(), message.length() );
write( fdlog, "\n", 1 );
}
Process installProc( cmd, args, fdlog );
if ( installProc.executeShell() ) {
result = PKGADD_FAILURE;
} else {
// exec post install
if ((parser->execPostInstall() || m_config->runScripts() ) &&
stat((package->path() + "/" + package->name() +
"/" + "post-install").c_str(), &statData)
== 0) {
// Work around the pkgdir variable change
Process postProc( runscriptCommand,
package->path() + "/" + package->name()+
"/" + "post-install",
fdlog );
if (postProc.executeShell()) {
info.postState = FAILED;
} else {
info.postState = EXEC_SUCCESS;
}
}
}
}
}
if ( m_config->writeLog() ) {
#ifdef USE_LOCKING
lockFile.unlock();
#endif
// Close logfile
close ( fdlog );
}
return result;
}
/*!
Calculate dependencies for this transaction
\return true on success
*/
bool InstallTransaction::calculateDependencies()
{
if ( m_depCalced ) {
return true;
}
m_depCalced = true;
if ( m_packages.empty() ) {
return false;
}
list< pair<string, const Package*> >::const_iterator it =
m_packages.begin();
for ( ; it != m_packages.end(); ++it ) {
const Package* package = it->second;
if ( package ) {
checkDependecies( package );
}
}
list<int> indexList;
if ( ! m_resolver.resolve( indexList ) ) {
m_depCalced = false;
return false;
}
list<int>::iterator lit = indexList.begin();
for ( ; lit != indexList.end(); ++lit ) {
m_depNameList.push_back( m_depList[*lit] );
}
return true;
}
/*!
recursive method to calculate dependencies
\param package package for which we want to calculate dependencies
\param depends index if the package \a package depends on (-1 for none)
*/
void InstallTransaction::checkDependecies( const Package* package,
int depends )
{
int index = -1;
bool newPackage = true;
for ( unsigned int i = 0; i < m_depList.size(); ++i ){
if ( m_depList[i] == package->name() ) {
index = i;
newPackage = false;
break;
}
}
if ( index == -1 ) {
index = m_depList.size();
m_depList.push_back( package->name() );
}
if ( depends != -1 ) {
m_resolver.addDependency( index, depends );
} else {
// this just adds index to the dependency resolver
m_resolver.addDependency( index, index );
}
if ( newPackage ) {
if ( !package->dependencies().empty() ) {
list<string> deps;
split( package->dependencies(), ',', deps );
list<string>::iterator it = deps.begin();
for ( ; it != deps.end(); ++it ) {
string dep = *it;
if ( !dep.empty() ) {
string::size_type pos = dep.find_last_of( '/' );
if ( pos != string::npos && (pos+1) < dep.length() ) {
dep = dep.substr( pos + 1 );
}
const Package* p = m_repo->getPackage( dep );
if ( p ) {
checkDependecies( p, index );
} else {
m_missingPackages.
push_back( make_pair( dep, package->name() ) );
}
}
}
}
}
}
/*!
This method returns a list of packages which should be installed to
meet the requirements for the packages to be installed. Includes
the packages to be installed. The packages are in the correct order,
packages to be installed first come first :-)
\return a list of packages required for the transaction
*/
const list<string>& InstallTransaction::dependencies() const
{
return m_depNameList;
}
/*!
This method returns a list of packages which could not be installed
because they could not be found in the ports tree. The return value is
a pair, \a pair.first is package name and \a pair.second is the package
requiring \a pair.first.
\return packages missing in the ports tree
*/
const list< pair<string, string> >& InstallTransaction::missing() const
{
return m_missingPackages;
}
/*!
\return packages which were requested to be installed but are already
installed
*/
const list<string>& InstallTransaction::alreadyInstalledPackages() const
{
return m_alreadyInstalledPackages;
}
/*!
\return the packages which were installed in this transaction
*/
const list< pair<string, InstallTransaction::InstallInfo> >&
InstallTransaction::installedPackages() const
{
return m_installedPackages;
}
/*!
calculate dependendencies for this package
*/
InstallTransaction::InstallResult
InstallTransaction::calcDependencies( )
{
if ( m_packages.empty() ) {
return NO_PACKAGE_GIVEN;
}
bool validPackages = false;
list< pair<string, const Package*> >::iterator it = m_packages.begin();
for ( ; it != m_packages.end(); ++it ) {
if ( it->second ) {
validPackages = true;
} else {
// Note: moved here from calculateDependencies
m_missingPackages.push_back( make_pair( it->first, string("") ) );
}
}
if ( !validPackages ) {
return PACKAGE_NOT_FOUND;
}
if ( !calculateDependencies() ) {
return CYCLIC_DEPEND;
}
return SUCCESS;
}
string InstallTransaction::getPkgDest()
{
string pkgdest = "";
FILE* p = popen( ". /etc/pkgmk.conf && echo $PKGMK_PACKAGE_DIR", "r" );
if ( p ) {
char line[256];
fgets( line, 256, p );
pkgdest = line;
pkgdest = StringHelper::stripWhiteSpace( pkgdest );
pclose( p );
}
return pkgdest;
}
const list<string>& InstallTransaction::ignoredPackages() const
{
return m_ignoredPackages;
}

142
src/installtransaction.h Normal file
View File

@ -0,0 +1,142 @@
////////////////////////////////////////////////////////////////////////
// FILE: installtransaction.h
// AUTHOR: Johannes Winkelmann, jw@tks6.net
// COPYRIGHT: (c) 2002 by Johannes Winkelmann
// ---------------------------------------------------------------------
// 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.
////////////////////////////////////////////////////////////////////////
#ifndef _INSTALLTRANSACTION_H_
#define _INSTALLTRANSACTION_H_
#include <string>
#include <list>
#include <map>
#include <vector>
#include <utility>
using namespace std;
#include "depresolver.h"
class Repository;
class PkgDB;
class Package;
class ArgParser;
class Configuration;
/*!
\class InstallTransaction
\brief Transaction for installing/updating a list of packages
*/
class InstallTransaction
{
public:
InstallTransaction( const list<char*>& names,
const Repository* repo,
PkgDB* pkgDB,
const Configuration* config );
InstallTransaction( const list<string>& names,
const Repository* repo,
PkgDB* pkgDB,
const Configuration* config );
static const std::string PKGMK_DEFAULT_COMMAND;
static const std::string PKGADD_DEFAULT_COMMAND;
static const std::string PKGRM_DEFAULT_COMMAND;
/*! Result of an installation */
enum InstallResult {
SUCCESS, /*!< yeah, success */
NO_PACKAGE_GIVEN, /*!< no package give to install */
PACKAGE_NOT_FOUND, /*!< package not found */
PKGMK_EXEC_ERROR, /*!< can't execute pkgmk */
PKGMK_FAILURE, /*!< error while pkgmk */
PKGADD_EXEC_ERROR, /*!< can't execute pkgadd */
PKGDEST_ERROR, /*!< can't change to PKGDEST */
PKGADD_FAILURE, /*!< error while pkgadd */
CYCLIC_DEPEND, /*!< cyclic dependencies found */
LOG_DIR_FAILURE, /*!< couldn't create log directory */
LOG_FILE_FAILURE, /*!< couldn't create log file */
NO_LOG_FILE, /*!< no log file specified */
CANT_LOCK_LOG_FILE /*!< can't create lock for log file */
};
enum State {
EXEC_SUCCESS,
FAILED,
NONEXISTENT
};
struct InstallInfo {
InstallInfo(bool hasReadme_) {
hasReadme = hasReadme_;
preState = NONEXISTENT;
postState = NONEXISTENT;
}
State preState;
State postState;
bool hasReadme;
};
InstallResult install( const ArgParser* parser,
bool update,
bool group );
InstallResult calcDependencies();
const list< pair<string, InstallInfo> >& installedPackages() const;
const list<string>& alreadyInstalledPackages() const;
const list<string>& ignoredPackages() const;
const list<string>& dependencies() const;
const list< pair<string,string> >& missing() const;
const list< pair<string, InstallInfo> >& installError() const;
private:
bool calculateDependencies();
void checkDependecies( const Package* package, int depends=-1 );
InstallResult installPackage( const Package* package,
const ArgParser* parser,
bool update,
InstallInfo& info ) const;
static string getPkgDest();
PkgDB* m_pkgDB;
DepResolver m_resolver;
const Repository* m_repo;
// packages to be installed
list< pair<string, const Package*> > m_packages;
// boolean used to implement lazy initialization
bool m_depCalced;
// packages< pair<name, hasReadme> > installed by this transaction
list< pair<string, InstallInfo> > m_installedPackages;
// packages which were requested to be installed which where already
list<string> m_alreadyInstalledPackages;
// packages which are required by the transaction, but ignored by
// the user
list<string> m_ignoredPackages;
list<string> m_depNameList;
vector<string> m_depList;
// packages requested to be installed not found in the ports tree
list< pair<string, string> > m_missingPackages;
// packages where build/installed failed
list< pair<string, InstallInfo> > m_installErrors;
/// prt-get itself
const Configuration* m_config;
};
#endif /* _INSTALLTRANSACTION_H_ */

110
src/locker.cpp Normal file
View File

@ -0,0 +1,110 @@
////////////////////////////////////////////////////////////////////////
// FILE: locker.cpp
// AUTHOR: Johannes Winkelmann, jw@tks6.net
// COPYRIGHT: (c) 2002 by Johannes Winkelmann
// ---------------------------------------------------------------------
// 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.
////////////////////////////////////////////////////////////////////////
#include <cstdio>
#include <cstring>
#include <algorithm>
#include "locker.h"
#include "repository.h"
const string Locker::LOCKER_FILE_PATH = "/var/lib/pkg/";
const string Locker::LOCKER_FILE = "prt-get.locker";
Locker::Locker()
: m_openFailed( false )
{
string fName = LOCKER_FILE_PATH + LOCKER_FILE;
FILE* fp = fopen( fName.c_str(), "r" );
if ( fp ) {
char input[512];
while ( fgets( input, 512, fp ) ) {
if ( input[strlen( input )-1] == '\n' ) {
input[strlen( input )-1] = '\0';
}
if ( strlen( input ) > 0 ) {
m_packages.push_back( input );
}
}
fclose( fp );
} else {
m_openFailed = true;
}
}
bool Locker::store()
{
if ( !Repository::createOutputDir(LOCKER_FILE_PATH) ) {
return false;
}
string fName = LOCKER_FILE_PATH + LOCKER_FILE;
FILE* fp = fopen( fName.c_str(), "w" );
if ( fp ) {
vector<string>::iterator it = m_packages.begin();
for ( ; it != m_packages.end(); ++it ) {
fprintf( fp, "%s\n", it->c_str() );
}
fclose( fp );
return true;
}
return false;
}
/*!
\return true locking worked, false if already locked
*/
bool Locker::lock( const string& package )
{
if ( isLocked( package ) ) {
// already locked
return false;
}
m_packages.push_back( package );
return true;
}
/*!
\return true if it could be unlocked, false if it wasn't locked
*/
bool Locker::unlock( const string& package )
{
vector<string>::iterator it = find( m_packages.begin(), m_packages.end(),
package );
if ( it != m_packages.end() ) {
m_packages.erase( it );
return true;
}
return false;
}
bool Locker::isLocked( const string& package ) const
{
if ( find( m_packages.begin(), m_packages.end(), package ) !=
m_packages.end() ) {
return true;
}
return false;
}
const vector<string>& Locker::lockedPackages() const
{
return m_packages;
}
bool Locker::openFailed() const
{
return m_openFailed;
}

51
src/locker.h Normal file
View File

@ -0,0 +1,51 @@
////////////////////////////////////////////////////////////////////////
// FILE: locker.h
// AUTHOR: Johannes Winkelmann, jw@tks6.net
// COPYRIGHT: (c) 2002 by Johannes Winkelmann
// ---------------------------------------------------------------------
// 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.
////////////////////////////////////////////////////////////////////////
#ifndef _LOCKER_H_
#define _LOCKER_H_
#include <string>
#include <vector>
using namespace std;
/**
* prt-get can place packages in the locker, which are then not updated
* anymore.
* Locked packages are:
* - marked in prt-get diff
* - not shown in prt-get quickdiff
* - not updated in prt-get sysup
*/
class Locker
{
public:
Locker();
bool store();
bool lock( const string& package );
bool unlock( const string& package );
bool isLocked( const string& package ) const;
const vector<string>& lockedPackages() const;
bool openFailed() const;
private:
vector<string> m_packages;
static const string LOCKER_FILE;
static const string LOCKER_FILE_PATH;
bool m_openFailed;
};
#endif /* _LOCKER_H_ */

150
src/lockfile.cpp Normal file
View File

@ -0,0 +1,150 @@
////////////////////////////////////////////////////////////////////////
// FILE: lockfile.cpp
// AUTHOR: Johannes Winkelmann, jw@tks6.net
// COPYRIGHT: (c) 2002 by Johannes Winkelmann
// ---------------------------------------------------------------------
// 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.
////////////////////////////////////////////////////////////////////////
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <cstdio>
#include "lockfile.h"
using namespace std;
string LockFile::LOCK_SUFFIX = ".lock";
string LockFile::WRITE_LOCK_STRING = "write_lock";
string LockFile::READ_LOCK_STRING = "read_lock";
string LockFile::READ_WRITE_LOCK_STRING = "read_write_lock";
/*!
\brief a file locking class
*/
LockFile::LockFile()
: m_readLock( false ),
m_writeLock( false )
{
}
bool LockFile::lockRead()
{
if ( m_readLock ) {
// we already lock it, so it's a good lock
return true;
}
if ( m_writeLock ) {
// can't lock for read and write separatedly
return false;
}
struct stat buf;
if ( stat( m_fileName.c_str(), &buf) == 0 ) {
FILE* fp = fopen( m_fileName.c_str(), "w" );
if ( fp ) {
// file did not exist, could be created
m_writeLock = true;
fprintf( fp, "%s", READ_LOCK_STRING.c_str() );
fclose( fp );
return true;
}
} else {
// file exists, but it could be a read lock
// TODO: allow locking, increment lock count
}
// couldn't lock
return false;
}
/*!
lock the file
\return true if we have a lock
*/
bool LockFile::lockWrite()
{
if ( m_writeLock ) {
// we already lock it, so it's a good lock
return true;
}
if ( m_readLock ) {
// can't lock for read and write separatedly
return false;
}
struct stat buf;
if ( stat( m_fileName.c_str(), &buf) == -1 ) {
// file can not be stat'ed
FILE* fp = fopen( m_fileName.c_str(), "w" );
if ( fp ) {
// file did not exist, could be created
m_writeLock = true;
fprintf( fp, "%s", WRITE_LOCK_STRING.c_str() );
fclose( fp );
return true;
}
}
// couldn't lock
return false;
}
bool LockFile::lockReadWrite()
{
if ( m_readWriteLock ) {
// we already lock it, so it's a good lock
return true;
}
if ( m_writeLock || m_readLock ) {
// can't lock for read and write separatedly
return false;
}
struct stat buf;
if ( stat( m_fileName.c_str(), &buf) == 0 ) {
FILE* fp = fopen( m_fileName.c_str(), "w" );
if ( fp ) {
// file did not exist, could be created
m_writeLock = true;
fprintf( fp, "%s", READ_WRITE_LOCK_STRING.c_str() );
fclose( fp );
return true;
}
}
// couldn't lock
return false;
}
bool LockFile::unlock()
{
if ( m_readLock || m_writeLock || m_readWriteLock ) {
// TODO: check whether lock count is 0
if ( unlink( m_fileName.c_str() ) == 0 ) {
m_readLock = m_writeLock = m_readWriteLock = false;
return true;
}
}
return false;
}
void LockFile::setFile( const string& fileName )
{
m_fileName = fileName + LOCK_SUFFIX;
}

45
src/lockfile.h Normal file
View File

@ -0,0 +1,45 @@
////////////////////////////////////////////////////////////////////////
// FILE: lockfile.h
// AUTHOR: Johannes Winkelmann, jw@tks6.net
// COPYRIGHT: (c) 2002 by Johannes Winkelmann
// ---------------------------------------------------------------------
// 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.
////////////////////////////////////////////////////////////////////////
#ifndef _LOCKFILE_H_
#define _LOCKFILE_H_
#include <string>
class LockFile
{
public:
LockFile();
bool lockRead();
bool lockWrite();
bool lockReadWrite();
bool unlock();
void setFile( const std::string& fileName );
private:
std::string m_fileName;
bool m_readLock;
bool m_writeLock;
bool m_readWriteLock;
static std::string LOCK_SUFFIX;
static std::string WRITE_LOCK_STRING;
static std::string READ_LOCK_STRING;
static std::string READ_WRITE_LOCK_STRING;
};
#endif /* _LOCKFILE_H_ */

170
src/main.cpp Normal file
View File

@ -0,0 +1,170 @@
////////////////////////////////////////////////////////////////////////
// FILE: main.cpp
// AUTHOR: Johannes Winkelmann, jw@tks6.net
// COPYRIGHT: (c) 2002 by Johannes Winkelmann
// ---------------------------------------------------------------------
// 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.
////////////////////////////////////////////////////////////////////////
#include <signal.h>
#include <iostream>
using namespace std;
#include "argparser.h"
#include "prtget.h"
#include "signaldispatcher.h"
int main( int argc, char** argv )
{
ArgParser argParser( argc, argv );
if ( !argParser.parse() ) {
if (argParser.unknownOption().size() > 0){
cerr << "prt-get: Unknown option: " << argParser.unknownOption()
<< endl;
} else if ( !argParser.isCommandGiven() ) {
if (argParser.commandName() != "") {
cerr << "prt-get: Unknown command '"
<< argParser.commandName() << "'. "
<< "try prt-get help for more information" << endl;
} else {
cerr << "prt-get: no command given. "
<< "try prt-get help for more information" << endl;
}
}
exit( -1 );
}
if ( argParser.verbose() > 2 ) {
cerr << "prt-get: can't specify both -v and -vv. " << endl;
exit( -1 );
}
PrtGet prtGet( &argParser );
signal( SIGHUP, SignalDispatcher::dispatch );
signal( SIGINT, SignalDispatcher::dispatch );
signal( SIGQUIT, SignalDispatcher::dispatch );
signal( SIGILL, SignalDispatcher::dispatch );
SignalDispatcher::instance()->registerHandler( &prtGet, SIGINT );
SignalDispatcher::instance()->registerHandler( &prtGet, SIGHUP );
SignalDispatcher::instance()->registerHandler( &prtGet, SIGQUIT );
SignalDispatcher::instance()->registerHandler( &prtGet, SIGILL );
ArgParser::Type command = argParser.commandType();
switch ( command )
{
case ArgParser::HELP:
prtGet.printUsage();
break;
case ArgParser::SHOW_VERSION:
prtGet.printVersion();
break;
case ArgParser::LIST:
prtGet.listPackages();
break;
case ArgParser::DUP:
prtGet.listShadowed();
break;
case ArgParser::SEARCH:
prtGet.searchPackages();
break;
case ArgParser::DSEARCH:
prtGet.searchPackages( true );
break;
case ArgParser::INFO:
prtGet.printInfo();
break;
case ArgParser::ISINST:
prtGet.isInstalled();
break;
case ArgParser::INSTALL:
prtGet.install();
break;
case ArgParser::DEPINST:
prtGet.install(false, true, true);
break;
case ArgParser::GRPINST:
prtGet.install( false, true );
break;
case ArgParser::DEPENDS:
prtGet.printDepends();
break;
case ArgParser::QUICKDEP:
prtGet.printDepends( true );
break;
case ArgParser::UPDATE:
prtGet.install( true );
break;
case ArgParser::DIFF:
prtGet.printDiff();
break;
case ArgParser::QUICKDIFF:
prtGet.printQuickDiff();
break;
case ArgParser::CREATE_CACHE:
prtGet.createCache();
break;
case ArgParser::PATH:
prtGet.printPath();
break;
case ArgParser::LISTINST:
prtGet.listInstalled();
break;
case ArgParser::PRINTF:
prtGet.printf();
break;
case ArgParser::README:
prtGet.readme();
break;
case ArgParser::DEPENDENT:
prtGet.printDependendent();
break;
case ArgParser::SYSUP:
prtGet.sysup();
break;
case ArgParser::CURRENT:
prtGet.current();
break;
case ArgParser::FSEARCH:
prtGet.fsearch();
break;
case ArgParser::LOCK:
prtGet.setLock( true );
break;
case ArgParser::UNLOCK:
prtGet.setLock( false );
break;
case ArgParser::LISTLOCKED:
prtGet.listLocked();
break;
case ArgParser::CAT:
prtGet.cat();
break;
case ArgParser::LS:
prtGet.ls();
break;
case ArgParser::EDIT:
prtGet.edit();
break;
case ArgParser::REMOVE:
prtGet.remove();
break;
case ArgParser::DEPTREE:
prtGet.printDependTree();
break;
case ArgParser::DUMPCONFIG:
prtGet.dumpConfig();
break;
default:
cerr << "unknown command" << endl;
break;
}
return prtGet.returnValue();
}

333
src/package.cpp Normal file
View File

@ -0,0 +1,333 @@
////////////////////////////////////////////////////////////////////////
// FILE: package.cpp
// AUTHOR: Johannes Winkelmann, jw@tks6.net
// COPYRIGHT: (c) 2002 by Johannes Winkelmann
// ---------------------------------------------------------------------
// 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.
////////////////////////////////////////////////////////////////////////
#include <iostream>
#include <cstdio>
#include <sys/stat.h>
#include <sys/utsname.h>
using namespace std;
#include "package.h"
#include "stringhelper.h"
using namespace StringHelper;
/*!
Create a package, which is not yet fully initialized, This is interesting
in combination with the lazy initialization
*/
Package::Package( const string& name,
const string& path )
: m_loaded( false )
{
m_data = new PackageData( name, path );
}
/*!
Create a fully initialized package. Most interesting when created from a
cache file
*/
Package::Package( const string& name,
const string& path,
const string& version,
const string& release,
const string& description,
const string& dependencies,
const string& url,
const string& packager,
const string& maintainer,
const string& hasReadme,
const string& hasPreInstall,
const string& hasPostInstall)
: m_loaded( true )
{
m_data = new PackageData( name, path, version, release,
description, dependencies, url,
packager, maintainer, hasReadme,
hasPreInstall, hasPostInstall );
}
Package::~Package()
{
delete m_data;
}
/*! \return the name of this package */
const string& Package::name() const
{
return m_data->name;
}
/*! \return the path to this package */
const string& Package::path() const
{
return m_data->path;
}
/*! \return the version of this package */
const string& Package::version() const
{
load();
return m_data->version;
}
/*! \return the release number of this package */
const string& Package::release() const
{
load();
return m_data->release;
}
/*! \return the description field of this package */
const string& Package::description() const
{
load();
return m_data->description;
}
/*! \return the dependency line of this package */
const string& Package::dependencies() const
{
load();
return m_data->depends;
}
/*! \return the url of this package */
const string& Package::url() const
{
load();
return m_data->url;
}
/*! \return the packager of this package */
const string& Package::packager() const
{
load();
return m_data->packager;
}
/*! \return the maintainer of this package */
const string& Package::maintainer() const
{
load();
return m_data->maintainer;
}
/*! \return whether or not this package has a readme file */
const bool Package::hasReadme() const
{
load();
return m_data->hasReadme;
}
const bool Package::hasPreInstall() const
{
return m_data->hasPreInstall;
}
const bool Package::hasPostInstall() const
{
return m_data->hasPostInstall;
}
/*!
load from Pkgfile
*/
void Package::load() const
{
if ( m_loaded ) {
return;
}
m_loaded = true;
string fileName = m_data->path + "/" + m_data->name + "/Pkgfile";
// c IO is about four times faster then fstream :-(
FILE* fp = fopen( fileName.c_str(), "r" );
if ( fp == NULL ) {
return;
}
const int length = BUFSIZ;
char input[length];
string line;
time_t timeNow;
time(&timeNow);
struct utsname unameBuf;
if (uname(&unameBuf) != 0) {
unameBuf.release[0] = '\0';
}
while ( fgets( input, length, fp ) ) {
line = stripWhiteSpace( input );
if ( line.substr( 0, 8 ) == "version=" ) {
m_data->version = getValueBefore( getValue( line, '=' ), '#' );
m_data->version = stripWhiteSpace( m_data->version );
expandShellCommands(m_data->version, timeNow, unameBuf);
} else if ( line.substr( 0, 8 ) == "release=" ) {
m_data->release = getValueBefore( getValue( line, '=' ), '#' );
m_data->release = stripWhiteSpace( m_data->release );
} else if ( line[0] == '#' ) {
while ( !line.empty() &&
( line[0] == '#' || line[0] == ' ' || line[0] == '\t' ) ) {
line = line.substr( 1 );
}
string::size_type pos = line.find( ':' );
if ( pos != string::npos ) {
if ( startwith_nocase( line, "desc" ) ) {
m_data->description =
stripWhiteSpace( getValue( line, ':' ) );
} else if ( startwith_nocase( line, "pack" ) ) {
m_data->packager =
stripWhiteSpace( getValue( line, ':' ) );
} else if ( startwith_nocase( line, "maint" ) ) {
m_data->maintainer =
stripWhiteSpace( getValue( line, ':' ) );
} else if ( startwith_nocase( line, "url" ) ) {
m_data->url = stripWhiteSpace( getValue( line, ':' ) );
} else if ( startwith_nocase( line, "dep" ) ) {
string depends = stripWhiteSpace( getValue( line, ':' ) );
StringHelper::replaceAll( depends, " ", "," );
StringHelper::replaceAll( depends, ",,", "," );
// TODO: decide which one to use
#if 0
// remove commented out packages
list<string> deps = StringHelper::split( depends, ',' );
list<string>::iterator it = deps.begin();
for ( ; it != deps.end(); ++it ) {
if ( (*it)[0] == '#' ) {
cerr << "Commented dep: " << *it << endl;
} else {
if ( it != deps.begin() ) {
m_data->depends += ",";
}
m_data->depends += *it;
}
}
#else
m_data->depends = depends;
#endif
}
}
}
}
fclose( fp );
string file = m_data->path + "/" + m_data->name + "/README";
struct stat buf;
if ( stat( file.c_str(), &buf ) != -1) {
m_data->hasReadme = true;
}
file = m_data->path + "/" + m_data->name + "/pre-install";
if ( stat( file.c_str(), &buf ) != -1) {
m_data->hasPreInstall = true;
}
file = m_data->path + "/" + m_data->name + "/post-install";
if ( stat( file.c_str(), &buf ) != -1) {
m_data->hasPostInstall = true;
}
}
void Package::setDependencies( const std::string& dependencies )
{
m_data->depends = dependencies;
}
PackageData::PackageData( const string& name_,
const string& path_,
const string& version_,
const string& release_,
const string& description_,
const string& dependencies_,
const string& url_,
const string& packager_,
const string& maintainer_,
const string& hasReadme_,
const string& hasPreInstall_,
const string& hasPostInstall_ )
: name( name_ ),
path( path_ ),
version( version_ ),
release( release_ ),
description( description_ ),
depends( dependencies_ ),
url( url_ ),
packager( packager_ ),
maintainer( maintainer_ )
{
hasReadme = ( stripWhiteSpace( hasReadme_ ) == "yes" );
hasPreInstall = ( stripWhiteSpace( hasPreInstall_ ) == "yes" );
hasPostInstall = ( stripWhiteSpace( hasPostInstall_ ) == "yes" );
}
void Package::expandShellCommands(std::string& input,
const time_t& timeNow,
const struct utsname unameBuf)
{
// TODO: consider dropping either of the tagsets, depending on feedback
static const int TAG_COUNT = 2;
string startTag[TAG_COUNT] = { "`", "$(" };
string endTag[TAG_COUNT] = { "`", ")" };
for (int i = 0; i < TAG_COUNT; ++i) {
string::size_type pos;
while ((pos = input.find(startTag[i])) != string::npos) {
if (unameBuf.release) {
input = replaceAll(input,
startTag[i] + "uname -r" + endTag[i],
unameBuf.release);
}
pos = input.find(startTag[i] + "date");
if (pos != string::npos) {
// NOTE: currently only works for one date pattern
string::size_type startpos, endpos;
endpos = input.find(endTag[i], pos+1);
startpos = input.find('+', pos+1);
string format = input.substr(startpos+1, endpos-startpos-1);
// support date '+...' and date "+..."
int len = format.length();
if (format[len-1] == '\'' || format[len-1] == '"') {
format = format.substr(0, len-1);
}
char timeBuf[32];
strftime(timeBuf, 32, format.c_str(), localtime(&timeNow));
input = input.substr(0, pos) + timeBuf +
input.substr(endpos+1);
}
}
}
}

104
src/package.h Normal file
View File

@ -0,0 +1,104 @@
////////////////////////////////////////////////////////////////////////
// FILE: package.h
// AUTHOR: Johannes Winkelmann, jw@tks6.net
// COPYRIGHT: (c) 2002 by Johannes Winkelmann
// ---------------------------------------------------------------------
// 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.
////////////////////////////////////////////////////////////////////////
#ifndef _PACKAGE_H_
#define _PACKAGE_H_
#include <string>
struct PackageData;
/*!
\class Package
\brief representation of a package
Representation of a package from the crux ports tree
*/
class Package
{
public:
Package( const std::string& name,
const std::string& path );
Package( const std::string& name,
const std::string& path,
const std::string& version,
const std::string& release,
const std::string& description,
const std::string& dependencies,
const std::string& url,
const std::string& packager,
const std::string& maintainer,
const std::string& hasReadme,
const std::string& hasPreInstall,
const std::string& hasPostInstall );
~Package();
const std::string& name() const;
const std::string& path() const;
const std::string& version() const;
const std::string& release() const;
const std::string& description() const;
const std::string& dependencies() const;
const std::string& url() const;
const std::string& packager() const;
const std::string& maintainer() const;
const bool hasReadme() const;
const bool hasPreInstall() const;
const bool hasPostInstall() const;
void setDependencies( const std::string& dependencies );
private:
void load() const;
static void expandShellCommands(std::string& input,
const time_t& timeNow,
const struct utsname unameBuf);
mutable PackageData* m_data;
mutable bool m_loaded;
};
struct PackageData
{
PackageData( const std::string& name_,
const std::string& path_,
const std::string& version_="",
const std::string& release_="",
const std::string& description_="",
const std::string& dependencies_="",
const std::string& url_="",
const std::string& packager="",
const std::string& maintainer="",
const std::string& hasReadme_="",
const std::string& hasPreInstall_="",
const std::string& hasPostInstall_="");
std::string name;
std::string path;
std::string version;
std::string release;
std::string description;
std::string depends;
std::string url;
std::string packager;
std::string maintainer;
bool hasReadme;
bool hasPreInstall;
bool hasPostInstall;
};
#endif /* _PACKAGE_H_ */

52
src/pg_regex.cpp Normal file
View File

@ -0,0 +1,52 @@
////////////////////////////////////////////////////////////////////////
// FILE: pg_regex.cpp
// AUTHOR: Johannes Winkelmann, jw@tks6.net
// COPYRIGHT: (c) 2005 by Johannes Winkelmann
// ---------------------------------------------------------------------
// 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.
////////////////////////////////////////////////////////////////////////
#include <string>
using namespace std;
#include "pg_regex.h"
RegEx::RegEx(const string& pattern, bool caseSensitive)
{
int additionalFlags = 0;
if (!caseSensitive) {
additionalFlags |= REG_ICASE;
}
m_validPattern =
regcomp(&m_pattern,
pattern.c_str(),
REG_EXTENDED|REG_NOSUB|additionalFlags) == 0;
}
RegEx::~RegEx()
{
regfree(&m_pattern);
}
bool RegEx::match(const string& input)
{
if (!m_validPattern) {
return false;
}
bool success = (regexec(&m_pattern, input.c_str(), 0, 0, 0) == 0);
return success;
}
bool RegEx::match(const string& pattern,
const string& input,
bool caseSensitive)
{
RegEx re(pattern, caseSensitive);
return re.match(input);
}

39
src/pg_regex.h Normal file
View File

@ -0,0 +1,39 @@
////////////////////////////////////////////////////////////////////////
// FILE: regex.h
// AUTHOR: Johannes Winkelmann, jw@tks6.net
// COPYRIGHT: (c) 2005 by Johannes Winkelmann
// ---------------------------------------------------------------------
// 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.
////////////////////////////////////////////////////////////////////////
#ifndef _REGEX_H_
#define _REGEX_H_
#include <sys/types.h>
#include <regex.h>
#include <string>
class RegEx
{
public:
RegEx(const std::string& pattern, bool caseSensitive=false);
~RegEx();
bool match(const std::string& input);
static bool match(const std::string& pattern,
const std::string& input,
bool caseSensitive=false);
private:
regex_t m_pattern;
bool m_validPattern;
};
#endif /* _REGEX_H_ */

238
src/pkgdb.cpp Normal file
View File

@ -0,0 +1,238 @@
////////////////////////////////////////////////////////////////////////
// FILE: pkgdb.cpp
// AUTHOR: Johannes Winkelmann, jw@tks6.net
// COPYRIGHT: (c) 2002 by Johannes Winkelmann
// ---------------------------------------------------------------------
// 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.
////////////////////////////////////////////////////////////////////////
#include <algorithm>
#include <fstream>
#include <map>
#include <iostream>
using namespace std;
#include <cstring>
#include <cstdio>
#include <fnmatch.h>
#include "pkgdb.h"
#include "datafileparser.h"
#include "stringhelper.h"
#include "pg_regex.h"
const string PkgDB::PKGDB = "/var/lib/pkg/db";
const string PkgDB::ALIAS_STORE = LOCALSTATEDIR"/lib/pkg/prt-get.aliases";
/*!
Create a PkgDB object
*/
PkgDB::PkgDB( const string& installRoot )
: m_isLoaded( false ),
m_installRoot( installRoot )
{
}
/*!
Check whether a package is installed
\param name the name of the package to check
\param isAlias whether a package is installed as alias
\param aliasOriginalName the original name of an aliased package
\return whether package \a name is installed
*/
bool PkgDB::isInstalled( const string& name,
bool useAlias,
bool* isAlias,
string* aliasOrignalName ) const
{
if ( !load() ) {
return false;
}
bool installed = m_packages.find( name ) != m_packages.end();
if (!installed && useAlias) {
string provider;
installed = aliasExistsFor(name, provider);
if (isAlias) {
*isAlias = installed;
if (installed && aliasOrignalName) {
*aliasOrignalName = provider;
}
}
}
return installed;
}
bool PkgDB::aliasExistsFor(const string& name, string& providerName) const
{
// when used the first time, split alias names
if (m_splitAliases.size() < m_aliases.size()) {
map<string, string>::iterator it = m_aliases.begin();
for (; it != m_aliases.end(); ++it) {
StringHelper::split(it->second, ',',
m_splitAliases[it->first]);
}
}
map<string, vector<string> >::iterator it = m_splitAliases.begin();
for (; it != m_splitAliases.end(); ++it) {
if (find(it->second.begin(), it->second.end(), name) !=
it->second.end()) {
providerName = it->first;
return true;
}
}
return false;
}
/*!
load the package db
*/
bool PkgDB::load() const
{
if ( m_isLoaded ) {
return true;
}
#if 0
// check this one out to see a really slow IO library :-(
ifstream db( PKGDB );
string line;
bool emptyLine = true;
while ( db.good() ) {
getline( db, line );
if ( emptyLine ) {
if ( !line.empty() ) {
m_packages.push_back( line );
}
emptyLine = false;
}
if ( line == "" ) {
emptyLine = true;
}
}
db.close();
#endif
std::map<std::string, std::string> aliases;
DataFileParser::parse(ALIAS_STORE, aliases);
const int length = 256;
char line[length];
bool emptyLine = true;
bool nameRead = false;
string name;
string pkgdb = "";
if (m_installRoot != "") {
pkgdb = m_installRoot;
}
pkgdb += PKGDB;
FILE* fp = fopen( pkgdb.c_str(), "r" );
if ( fp ) {
while ( fgets( line, length, fp ) ) {
if ( emptyLine ) {
line[strlen(line)-1] = '\0';
name = line;
emptyLine = false;
nameRead = true;
} else if ( nameRead ) {
line[strlen(line)-1] = '\0';
m_packages[ name ] = line;
nameRead = false;
if (aliases.find(name) != aliases.end()) {
m_aliases[name] = aliases[name];
}
}
if ( line[0] == '\n' ) {
emptyLine = true;
}
}
} else {
return false;
}
m_isLoaded = true;
fclose( fp );
return true;
}
/*!
return a map of installed packages, where the key is the package name and
the value is the version/release string
\return a map of installed packages (key=name, value=version/release)
*/
const map<string, string>& PkgDB::installedPackages()
{
load();
return m_packages;
}
/*!
\return a package's version and release or an empty string if not found
*/
string PkgDB::getPackageVersion( const string& name ) const
{
if ( !load() ) {
return "";
}
map<string, string>::const_iterator it = m_packages.find( name );
if ( it == m_packages.end() ) {
return "";
}
return it->second;
}
/*!
Search packages for a match of \a pattern in name. The name can
contain shell wildcards.
\param pattern the pattern to be found
\return a list of matching packages
*/
void PkgDB::getMatchingPackages( const string& pattern,
map<string,string>& target,
bool useRegex ) const
{
if ( !load() ) {
return;
}
RegEx re(pattern);
map<string, string>::const_iterator it = m_packages.begin();
if (useRegex) {
for ( ; it != m_packages.end(); ++it ) {
if (re.match(it->first)) {
target[it->first] = it->second;
}
}
} else {
for ( ; it != m_packages.end(); ++it ) {
// I assume fnmatch will be quite fast for "match all" (*), so
// I didn't add a boolean to check for this explicitely
if ( fnmatch( pattern.c_str(), it->first.c_str(), 0 ) == 0 ) {
target[it->first] = it->second;
}
}
}
}

60
src/pkgdb.h Normal file
View File

@ -0,0 +1,60 @@
////////////////////////////////////////////////////////////////////////
// FILE: pkgdb.h
// AUTHOR: Johannes Winkelmann, jw@tks6.net
// COPYRIGHT: (c) 2002 by Johannes Winkelmann
// ---------------------------------------------------------------------
// 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.
////////////////////////////////////////////////////////////////////////
#ifndef _PKGDB_H_
#define _PKGDB_H_
#include <map>
#include <utility>
#include <vector>
#include <string>
/*!
\class PkgDB
\brief database of installed packages
A representation of crux' package database of installed packages
*/
class PkgDB
{
public:
PkgDB( const std::string& installRoot = "" );
bool isInstalled( const std::string& name,
bool useAlias = false,
bool* isAlias = 0,
string* aliasOrignalName = 0 ) const;
std::string getPackageVersion( const std::string& name ) const;
const std::map<std::string, std::string>& installedPackages();
void getMatchingPackages( const std::string& pattern,
map<std::string,std::string>& target,
bool useRegex ) const;
static const std::string ALIAS_STORE;
private:
bool load() const;
bool aliasExistsFor(const string& name, string& provider) const;
mutable bool m_isLoaded;
mutable std::map<std::string, std::string> m_packages;
mutable std::map<std::string, std::string> m_aliases;
mutable std::map<std::string, std::vector<std::string> > m_splitAliases;
std::string m_installRoot;
static const std::string PKGDB;
};
#endif /* _PKGDB_H_ */

229
src/process.cpp Normal file
View File

@ -0,0 +1,229 @@
////////////////////////////////////////////////////////////////////////
// FILE: process.cpp
// AUTHORS: Johannes Winkelmann, jw@tks6.net
// Output redirection by Logan Ingalls, log@plutor.org
// COPYRIGHT: (c) 2002 by Johannes Winkelmann
// ---------------------------------------------------------------------
// 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.
////////////////////////////////////////////////////////////////////////
#include <list>
using namespace std;
#include <unistd.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/stat.h>
#include <cassert>
#include <cstddef>
#include <cstdlib>
#include <cstdio>
#include "process.h"
#include "stringhelper.h"
using namespace StringHelper;
/*!
create a process
\param app the application to execute
\param arguments the arguments to be passed to \a app
\param fdlog file descriptor to a log file
*/
Process::Process( const string& app, const string& arguments, int fdlog )
: m_app( app ), m_arguments( arguments ), m_fdlog( fdlog )
{
}
/*!
execute the process
\return the exit status of the application
*/
int Process::execute()
{
list<string> args;
split( m_arguments, ' ', args, 0, false );
const int argc = 1 + args.size() + 1; // app, args, NULL
char** argv = new char*[argc];
list<string>::iterator it = args.begin();
int i = 0;
argv[i] = const_cast<char*>( m_app.c_str() );
for ( ; it != args.end(); ++it ) {
++i;
argv[i] = const_cast<char*>( it->c_str() );
}
++i;
assert( i+1 == argc );
argv[i] = NULL;
int status = 0;
if ( m_fdlog > 0 ) {
status = execLog(argc, argv);
} else {
status = exec(argc, argv);
}
delete [] argv;
return status;
}
int Process::execLog(const int argc, char** argv)
{
int status = 0;
int fdpipe[2];
pipe( fdpipe );
pid_t pid = fork();
if ( pid == 0 ) {
// child process
close( fdpipe[0] );
dup2( fdpipe[1], 1 );
dup2( fdpipe[1], 2 );
execv( m_app.c_str(), argv );
_exit( EXIT_FAILURE );
} else if ( pid < 0 ) {
// fork failed
status = -1;
} else {
// parent process
close( fdpipe[1] );
char readbuf[1024];
int bytes, wpval;
while ( (wpval = waitpid ( pid, &status, WNOHANG )) == 0 ) {
while ( (bytes=read(fdpipe[0], readbuf, sizeof(readbuf)-1)) > 0 ) {
readbuf[bytes] = 0;
printf("%s", readbuf);
fflush(stdout);
fflush(stderr);
write( m_fdlog, readbuf, bytes );
}
}
if ( wpval != pid ) {
status = -1;
}
}
return status;
}
int Process::exec(const int argc, char** argv)
{
int status = 0;
pid_t pid = fork();
if ( pid == 0 ) {
// child process
execv( m_app.c_str(), argv );
_exit( EXIT_FAILURE );
} else if ( pid < 0 ) {
// fork failed
status = -1;
} else {
// parent process
if ( waitpid ( pid, &status, 0 ) != pid ) {
status = -1;
}
}
return status;
}
/*!
execute the process using the shell
\return the exit status of the application
\todo make shell exchangable
*/
int Process::executeShell()
{
// TODO: make shell exchangable
static const char SHELL[] = "/bin/sh";
int status = 0;
if ( m_fdlog > 0 ) {
status = execShellLog(SHELL);
} else {
status = execShell(SHELL);
}
return status;
}
int Process::execShellLog(const char* SHELL)
{
int status = 0;
int fdpipe[2];
pipe( fdpipe );
pid_t pid = fork();
if ( pid == 0 ) {
// child process
close( fdpipe[0] );
dup2( fdpipe[1], 1 );
dup2( fdpipe[1], 2 );
execl( SHELL, SHELL, "-c", (m_app + " " + m_arguments).c_str(), NULL );
_exit( EXIT_FAILURE );
} else if ( pid < 0 ) {
// fork failed
status = -1;
} else {
// parent process
close( fdpipe[1] );
char readbuf[1024];
int bytes, wpval;
while ( (wpval = waitpid ( pid, &status, WNOHANG )) == 0 ) {
while ( (bytes=read(fdpipe[0], readbuf, sizeof(readbuf)-1)) > 0 ) {
readbuf[bytes] = 0;
printf("%s", readbuf);
fflush(stdout);
fflush(stderr);
write( m_fdlog, readbuf, bytes );
}
}
if ( wpval != pid ) {
status = -1;
}
}
return status;
}
int Process::execShell(const char* SHELL)
{
int status = 0;
pid_t pid = fork();
if ( pid == 0 ) {
execl( SHELL, SHELL, "-c", (m_app + " " + m_arguments).c_str(), NULL );
_exit( EXIT_FAILURE );
} else if ( pid < 0 ) {
// fork failed
status = -1;
} else {
// parent process
if ( waitpid ( pid, &status, 0 ) != pid ) {
status = -1;
}
}
return status;
}

46
src/process.h Normal file
View File

@ -0,0 +1,46 @@
////////////////////////////////////////////////////////////////////////
// FILE: process.h
// AUTHORS: Johannes Winkelmann, jw@tks6.net
// Output redirection by Logan Ingalls, log@plutor.org
// COPYRIGHT: (c) 2002 by Johannes Winkelmann
// ---------------------------------------------------------------------
// 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.
////////////////////////////////////////////////////////////////////////
#ifndef _PROCESS_H_
#define _PROCESS_H_
#include <string>
using namespace std;
/*!
\class Process
\brief Process execution class
A class to execute processes
*/
class Process
{
public:
Process( const string& app, const string& arguments, int fdlog=0 );
int execute();
int executeShell();
private:
int exec(const int argc, char** argv);
int execLog(const int argc, char** argv);
int execShell(const char* shell);
int execShellLog(const char* shell);
string m_app;
string m_arguments;
int m_fdlog;
};
#endif /* _PROCESS_H_ */

1939
src/prtget.cpp Normal file

File diff suppressed because it is too large Load Diff

148
src/prtget.h Normal file
View File

@ -0,0 +1,148 @@
////////////////////////////////////////////////////////////////////////
// FILE: prtget.h
// AUTHOR: Johannes Winkelmann, jw@tks6.net
// COPYRIGHT: (c) 2002 by Johannes Winkelmann
// ---------------------------------------------------------------------
// 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.
////////////////////////////////////////////////////////////////////////
#ifndef _PRTGET_H_
#define _PRTGET_H_
class Repository;
class ArgParser;
class Configuration;
#include <list>
#include <utility>
#include <string>
using namespace std;
#include "pkgdb.h"
#include "signaldispatcher.h"
#include "locker.h"
#include "installtransaction.h"
/*!
\class PrtGet
\brief Main class
This is prt-get's main class, controlling all the commands
*/
class PrtGet
: public SignalHandler
{
public:
enum PGReturnStates {
PG_GENERAL_ERROR = -1,
PG_OK = 0,
PG_ARG_ERROR,
PG_INSTALL_ERROR,
PG_PARTIAL_INSTALL_ERROR
};
PrtGet( const ArgParser* parser );
~PrtGet();
void printVersion();
void printUsage();
void listPackages();
void listShadowed();
void listInstalled();
void searchPackages( bool searchDesc=false );
void printInfo();
void isInstalled();
void readme();
void install( bool update=false,
bool group=false,
bool dependencies=false );
void sysup();
void current();
void printDepends( bool simpleListing=false );
void printDependTree();
void printDependendent();
void printDiff();
void printQuickDiff();
void createCache();
void printPath();
void printf();
void cat();
void ls();
void edit();
void remove();
void setLock( bool lock );
void listLocked();
void fsearch();
void dumpConfig();
bool greaterThan( const string& v1, const string& v2 );
int returnValue() const;
SignalHandler::HandlerResult handleSignal( int signal );
protected:
void printDepsLevel(int indent, const Package* package);
void executeTransaction( InstallTransaction& transaction,
bool update, bool group );
void evaluateResult( InstallTransaction& transaction,
bool update,
bool interrupted=false );
void reportPrePost(const InstallTransaction::InstallInfo& info);
void readConfig();
void initRepo( bool listDuplicate=false );
void expandWildcardsPkgDB( const list<char*>& in,
map<string, string>& target );
void expandWildcardsRepo( const list<char*>& in,
list<string>& target );
void warnPackageNotFound(InstallTransaction& transaction);
Repository* m_repo;
PkgDB* m_pkgDB;
Configuration* m_config;
InstallTransaction* m_currentTransaction;
Locker m_locker;
const ArgParser* m_parser;
string m_appName;
string m_cacheFile;
int m_returnValue;
bool m_useRegex;
/*! Name of default configuration file */
static const string CONF_FILE;
/*! Name of default cache file */
static const string DEFAULT_CACHE_FILE;
void assertMinArgCount(int count);
void assertMaxArgCount(int count);
void assertExactArgCount(int count);
void argCountFailure(int count, const string& specifier);
};
#endif /* _PRTGET_H_ */

447
src/repository.cpp Normal file
View File

@ -0,0 +1,447 @@
////////////////////////////////////////////////////////////////////////
// FILE: repository.cpp
// AUTHOR: Johannes Winkelmann, jw@tks6.net
// COPYRIGHT: (c) 2002 by Johannes Winkelmann
// ---------------------------------------------------------------------
// 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.
////////////////////////////////////////////////////////////////////////
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
#include <sys/types.h>
#include <sys/stat.h>
#include <dirent.h>
#include <unistd.h>
#include <fnmatch.h>
#include "datafileparser.h"
#include "repository.h"
#include "stringhelper.h"
#include "pg_regex.h"
using namespace StringHelper;
const string Repository::CACHE_VERSION = "V5";
const string Repository::EXTERNAL_DEPENDENCY_FILE =
LOCALSTATEDIR"/lib/pkg/prt-get.deplist";
/*!
Create a repository
*/
Repository::Repository(bool useRegex)
: m_useRegex(useRegex)
{
}
/*!
Destroy a repository
*/
Repository::~Repository()
{
map<string, Package*>::const_iterator it = m_packageMap.begin();
for ( ; it != m_packageMap.end(); ++it ) {
delete it->second;
}
}
/*!
\return a map of available packages
*/
const map<string, Package*>& Repository::packages() const
{
return m_packageMap;
}
/*!
Returns a map of duplicate packages in the repository. The key is the name
of the package, the value a pair where \a first the shadowed port and
\a second is the port which preceeds over \a first
\return a map of duplicate packages in the repository
*/
const map<string, pair<string, string> >& Repository::shadowedPackages() const
{
return m_shadowedPackages;
}
void Repository::parseDependencyList()
{
map<string, string> depMap;
if (DataFileParser::parse(EXTERNAL_DEPENDENCY_FILE, depMap)) {
addDependencies(depMap);
}
}
/*!
\param name the package name to be returned
\return a Package pointer for a package name or 0 if not found
*/
const Package* Repository::getPackage( const string& name ) const
{
map<string, Package*>::const_iterator it = m_packageMap.find( name );
if ( it == m_packageMap.end() ) {
return 0;
}
return it->second;
}
/*!
Search packages for a match of \a pattern in name, and description of
\a searchDesc is true.
\note Name searches can often done without opening the Pkgfiles, but not
description search. Therefore, the later is much slower
\param pattern the pattern to be found
\param searchDesc whether descriptions should be searched as well
\return a list of matching packages
*/
void Repository::searchMatchingPackages( const string& pattern,
list<Package*>& target,
bool searchDesc ) const
// note: searchDesc true will read _every_ Pkgfile
{
map<string, Package*>::const_iterator it = m_packageMap.begin();
if (m_useRegex) {
RegEx re(pattern);
for ( ; it != m_packageMap.end(); ++it ) {
if (re.match(it->first)) {
target.push_back( it->second );
} else if ( searchDesc ) {
if ( re.match(it->second->description())) {
target.push_back( it->second );
}
}
}
} else {
for ( ; it != m_packageMap.end(); ++it ) {
if ( it->first.find( pattern ) != string::npos ) {
target.push_back( it->second );
} else if (searchDesc ) {
string s = toLowerCase( it->second->description() );
if ( s.find( toLowerCase( pattern ) ) != string::npos ) {
target.push_back( it->second );
}
}
}
}
}
/*!
init repository by reading the directories passed. Doesn't search
recursively, so if you want /dir and /dir/subdir checked, you have to
specify both
\param rootList a list of directories to look for ports in
\param listDuplicate whether duplicates should registered (slower)
*/
void Repository::initFromFS( const list< pair<string, string> >& rootList,
bool listDuplicate )
{
list< pair<string, string> >::const_iterator it = rootList.begin();
DIR* d;
struct dirent* de;
string name;
std::map<string, bool> alreadyChecked;
for ( ; it != rootList.end(); ++it ) {
string path = it->first;
string pkgInput = stripWhiteSpace( it->second );
if ( alreadyChecked[path] ) {
continue;
}
bool filter = false;
if ( pkgInput.length() > 0 ) {
filter = true;
// create a proper input string
while ( pkgInput.find( " " ) != string::npos ) {
pkgInput = pkgInput.replace( pkgInput.find(" "), 1, "," );
}
while ( pkgInput.find( "\t" ) != string::npos ) {
pkgInput = pkgInput.replace( pkgInput.find("\t"), 1, "," );
}
while ( pkgInput.find( ",," ) != string::npos ) {
pkgInput = pkgInput.replace( pkgInput.find(",,"), 2, "," );
}
}
if (!filter) {
alreadyChecked[path] = true;
}
list<string> packages;
split( pkgInput, ',', packages );
// TODO: think about whether it would be faster (more
// efficient) to put all packages into a map, and the iterate
// over the list of allowed packages and copy them
// over. depending in the efficiency of find(), this might be
// faster
d = opendir( path.c_str() );
while ( ( de = readdir( d ) ) != NULL ) {
name = de->d_name;
// TODO: review this
struct stat buf;
if ( stat( (path + "/" + name + "/Pkgfile").c_str(), &buf )
!= 0 ) {
// no Pkgfile -> no port
continue;
}
if ( filter && find( packages.begin(),
packages.end(), name ) == packages.end() ) {
// not found -> ignore this port
continue;
}
if ( name != "." && name != ".." ) {
map<string, Package*>::iterator hidden;
hidden = m_packageMap.find( name );
Package* p = new Package( name, path );
if ( p ) {
if ( hidden == m_packageMap.end() ) {
// no such package found, add
m_packageMap[name] = p;
} else if ( listDuplicate ) {
Package* old = hidden->second;
string ps = p->path() + "/" + p->name() +
"-" + p->version();
string os = old->path() + "/" + old->name() +
"-" + old->version();
m_shadowedPackages[name] = make_pair( ps, os );
}
}
}
}
closedir( d );
}
parseDependencyList();
}
/*!
Init from a cache file
\param cacheFile the name of the cache file to be parser
\return true on success, false indicates file opening problems
*/
Repository::CacheReadResult
Repository::initFromCache( const string& cacheFile )
{
FILE* fp = fopen( cacheFile.c_str(), "r" );
if ( !fp ) {
return ACCESS_ERR;
}
const int length = BUFSIZ;
char input[length];
string line;
// read version
if ( fgets( input, length, fp ) ) {
line = stripWhiteSpace( input );
if ( line != CACHE_VERSION ) {
return FORMAT_ERR;
}
}
// FIELDS:
// name, path, version, release,
// description, dependencies, url,
// packager, maintainer, hasReadme;
// hasPreInstall, hasPostInstall
const int fieldCount = 12;
string fields[fieldCount];
int fieldPos = 0;
while ( fgets( input, length, fp ) ) {
line = StringHelper::stripWhiteSpace( input );
fields[fieldPos] = line;
++fieldPos;
if ( fieldPos == fieldCount ) {
fieldPos = 0;
Package* p = new Package( fields[0], fields[1],
fields[2], fields[3],
fields[4], fields[5], fields[6],
fields[7], fields[8], fields[9],
fields[10], fields[11]);
m_packageMap[p->name()] = p;
fgets( input, length, fp ); // read empty line
}
}
fclose( fp );
parseDependencyList();
return READ_OK;
}
/*!
Store repository data in a cache file
\param cacheFile the file where the data is stored
\return whether the operation was successfully
*/
Repository::WriteResult Repository::writeCache( const string& cacheFile )
{
string path = cacheFile;
string::size_type pos = cacheFile.rfind( '/' );
if ( pos != string::npos ) {
path = path.erase( pos );
}
if ( !createOutputDir( path ) ) {
return DIR_ERR;
}
FILE* fp = fopen( cacheFile.c_str(), "w" );
if ( !fp ) {
return FILE_ERR;
}
map<string, Package*>::const_iterator it = m_packageMap.begin();
char yesStr[] = "yes";
char noStr[] = "no";
char* hasReadme;
char* hasPreInstall;
char* hasPostInstall;
// write version
fprintf( fp, "%s\n", CACHE_VERSION.c_str() );
for ( ; it != m_packageMap.end(); ++it ) {
const Package* p = it->second;
// TODO: encode
hasReadme = noStr;
if ( p->hasReadme() ) {
hasReadme = yesStr;
}
hasPreInstall = noStr;
if ( p->hasPreInstall() ) {
hasPreInstall = yesStr;
}
hasPostInstall = noStr;
if ( p->hasPostInstall() ) {
hasPostInstall = yesStr;
}
fprintf( fp, "%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n\n",
p->name().c_str(),
p->path().c_str(),
p->version().c_str(),
p->release().c_str(),
p->description().c_str(),
p->dependencies().c_str(),
p->url().c_str(),
p->packager().c_str(),
p->maintainer().c_str(),
hasReadme, hasPreInstall, hasPostInstall );
}
fclose( fp );
return SUCCESS;
}
/*!
create all components of \path which don't exist
\param path the path to be created
\return true on success. false indicates permission problems
*/
bool Repository::createOutputDir( const string& path )
{
list<string> dirs;
split( path, '/', dirs, 1 );
string tmpPath;
for ( list<string>::iterator it = dirs.begin(); it != dirs.end(); ++it ) {
tmpPath += *it + "/";
DIR* d;
if ( ( d = opendir( tmpPath.c_str() ) ) == NULL ) {
// doesn't exist
if ( mkdir( tmpPath.c_str(), 0755 ) == -1 ) {
cout << "- can't create output directory " << tmpPath
<< endl;
return false;
}
} else {
closedir( d );
}
}
return true;
}
/*!
Search packages for a match of \a pattern in name. The name can
contain shell wildcards.
\param pattern the pattern to be found
\return a list of matching packages
*/
void Repository::getMatchingPackages( const string& pattern,
list<Package*>& target ) const
{
map<string, Package*>::const_iterator it = m_packageMap.begin();
RegEx re(pattern);
if (m_useRegex) {
for ( ; it != m_packageMap.end(); ++it ) {
if (re.match(it->first)) {
target.push_back( it->second );
}
}
} else {
for ( ; it != m_packageMap.end(); ++it ) {
// I assume fnmatch will be quite fast for "match all" (*), so
// I didn't add a boolean to check for this explicitely
if ( fnmatch( pattern.c_str(), it->first.c_str(), 0 ) == 0 ) {
target.push_back( it->second );
}
}
}
}
void Repository::addDependencies( std::map<string, string>& deps )
{
map<string, string>::iterator it = deps.begin();
for ( ; it != deps.end(); ++it ) {
map<string, Package*>::const_iterator pit =
m_packageMap.find( it->first );
if ( pit != m_packageMap.end() ) {
Package* p = pit->second;
if (p->dependencies().length() == 0) {
// only use if no dependencies in Pkgfile
p->setDependencies(it->second);
}
}
}
}

81
src/repository.h Normal file
View File

@ -0,0 +1,81 @@
////////////////////////////////////////////////////////////////////////
// FILE: repository.h
// AUTHOR: Johannes Winkelmann, jw@tks6.net
// COPYRIGHT: (c) 2002 by Johannes Winkelmann
// ---------------------------------------------------------------------
// 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.
////////////////////////////////////////////////////////////////////////
#ifndef _REPOSITORY_H_
#define _REPOSITORY_H_
#include <string>
#include <list>
#include <map>
#include <utility>
using namespace std;
#include "package.h"
/*!
\class Repository
\brief Repository of available ports
The repository is an abstraction of the available ports in the ports tree
*/
class Repository
{
public:
Repository(bool useRegex);
~Repository();
const Package* getPackage( const string& name ) const;
const map<string, Package*>& packages() const;
const map<string, pair<string, string> >& shadowedPackages() const;
void searchMatchingPackages( const string& pattern,
list<Package*>& target,
bool searchDesc ) const;
void getMatchingPackages( const string& pattern,
list<Package*>& target ) const;
void initFromFS( const list< pair<string, string> >& rootList,
bool listDuplicate );
/*! Result of a cache write operation */
enum CacheReadResult {
ACCESS_ERR, /*!< Error creating/accessing the file */
FORMAT_ERR, /*!< bad/old format */
READ_OK /*!< Success */
};
CacheReadResult initFromCache( const string& cacheFile );
/*! Result of a cache write operation */
enum WriteResult {
DIR_ERR, /*!< Error creating/accessing the directory */
FILE_ERR, /*!< Error creating/accessing the file */
SUCCESS /*!< Success */
};
WriteResult writeCache( const string& cacheFile );
static bool createOutputDir( const string& path );
void addDependencies( std::map<string, string>& deps );
static const std::string EXTERNAL_DEPENDENCY_FILE;
private:
static const std::string CACHE_VERSION;
bool m_useRegex;
void parseDependencyList();
map<string, pair<string, string> > m_shadowedPackages;
map<string, Package*> m_packageMap;
};
#endif /* _REPOSITORY_H_ */

54
src/signaldispatcher.cpp Normal file
View File

@ -0,0 +1,54 @@
////////////////////////////////////////////////////////////////////////
// FILE: signaldispatcher.cpp
// AUTHOR: Johannes Winkelmann, jw@tks6.net
// COPYRIGHT: (c) 2002 by Johannes Winkelmann
// ---------------------------------------------------------------------
// 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.
////////////////////////////////////////////////////////////////////////
#include <iostream>
using namespace std;
#include "signaldispatcher.h"
SignalDispatcher* SignalDispatcher::m_instance = 0;
SignalDispatcher::SignalDispatcher()
{
}
SignalDispatcher* SignalDispatcher::instance()
{
if ( m_instance == 0 ) {
m_instance = new SignalDispatcher();
}
return m_instance;
}
void SignalDispatcher::dispatch( int signalNumber )
{
map<int, SignalHandler*>::iterator it =
SignalDispatcher::instance()->m_signalHandlers.find( signalNumber );
if ( it != SignalDispatcher::instance()->m_signalHandlers.end() ) {
it->second->handleSignal( signalNumber );
} else {
cerr << "prt-get: caught signal " << signalNumber << endl;
}
exit( signalNumber );
}
void SignalDispatcher::registerHandler( SignalHandler* handler,
int signalNumber )
{
m_signalHandlers[signalNumber] = handler;
}
void SignalDispatcher::unregisterHandler( int signalNumber )
{
m_signalHandlers.erase( signalNumber );
}

58
src/signaldispatcher.h Normal file
View File

@ -0,0 +1,58 @@
////////////////////////////////////////////////////////////////////////
// FILE: signaldispatcher.h
// AUTHOR: Johannes Winkelmann, jw@tks6.net
// COPYRIGHT: (c) 2002 by Johannes Winkelmann
// ---------------------------------------------------------------------
// 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.
////////////////////////////////////////////////////////////////////////
#ifndef _SIGNALDISPATCHER_H_
#define _SIGNALDISPATCHER_H_
#include <map>
/*!
signal handler for the SignalDispatcher class. Implement this class to
receive signals
\brief SignalHandler for SignalDispatcher
*/
class SignalHandler
{
public:
/*! Result of a handlSignal() call */
enum HandlerResult {
SIGNAL_NOT_HANDLED, /*!< not handled */
EXIT, /*!< signal handled, exit now */
CONTINUE /*!< signal handled, don't exit */
};
virtual HandlerResult handleSignal( int signalNumber ) = 0;
};
/*!
dispatches signals. Singleton, use the instance() method to access
the instance of this class. Register your SignalHandler to handle signals
\brief Dispatch unix signals
*/
class SignalDispatcher
{
public:
static SignalDispatcher* instance();
static void dispatch( int signalNumber );
void registerHandler( SignalHandler* handler, int signalNumber );
void unregisterHandler( int signalNumber );
protected:
SignalDispatcher();
private:
static SignalDispatcher* m_instance;
std::map<int, SignalHandler*> m_signalHandlers;
};
#endif /* _SIGNALDISPATCHER_H_ */

148
src/stringhelper.cpp Normal file
View File

@ -0,0 +1,148 @@
////////////////////////////////////////////////////////////////////////
// FILE: stringhelper.cpp
// AUTHOR: Johannes Winkelmann, jw@tks6.net
// COPYRIGHT: (c) 2002 by Johannes Winkelmann
// ---------------------------------------------------------------------
// 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.
////////////////////////////////////////////////////////////////////////
#include "stringhelper.h"
#include <cctype>
using namespace std;
namespace StringHelper
{
/*!
\param s the string to be searched
\param del the delimiter char
\return the value after the first occurance of \a del
*/
string getValue( const string& s, char del )
{
string::size_type pos = s.find( del );
if ( pos != string::npos && pos+1 < s.length() ) {
return s.substr( pos + 1 );
}
return "";
}
/*!
\param s the string to be searched
\param del the delimiter char
\return the value before the first occurance of \a del
*/
string getValueBefore( const string& s, char del )
{
string::size_type pos = s.find( del );
if ( pos != string::npos ) {
return s.substr( 0, pos );
}
return s;
}
/*!
strip whitespace in the beginning and end of string \a s
\return a stripped string
*/
string stripWhiteSpace( const string& s )
{
if ( s.empty() ) {
return s;
}
int pos = 0;
string line = s;
string::size_type len = line.length();
while ( pos < len && isspace( line[pos] ) ) {
++pos;
}
line.erase( 0, pos );
pos = line.length()-1;
while ( pos > -1 && isspace( line[pos] ) ) {
--pos;
}
if ( pos != -1 ) {
line.erase( pos+1 );
}
return line;
}
/*!
make sure s1 starts with s2
*/
bool startwith_nocase( const string& s1, const string& s2 )
{
string::const_iterator p1 = s1.begin();
string::const_iterator p2 = s2.begin();
while ( p1 != s1.end() && p2 != s2.end() ) {
if ( toupper( *p1 ) != toupper( *p2 ) ) {
return false;
}
++p1;
++p2;
}
if ( p1 == s1.end() && p2 != s2.end() ) {
return false;
}
return true;
}
/*!
Convert a string into a lowercase representation
\param s the string to be converted
\return a lowercase representation of \a s
*/
string toLowerCase( const string& s )
{
string result = "";
for ( string::size_type i = 0; i < s.length(); ++i ) {
result += tolower( s[i] );
}
return result;
}
/*!
Convert a string into a uppercase representation
\param s the string to be converted
\return a uppercase representation of \a s
*/
string toUpperCase( const string& s )
{
string result = "";
for ( string::size_type i = 0; i < s.length(); ++i ) {
result += toupper( s[i] );
}
return result;
}
/*!
replace all occurances of \a oldString in \a in with \a newString
*/
string replaceAll( string& in,
const string& oldString,
const string& newString )
{
size_t pos;
while ( (pos = in.find( oldString )) != string::npos ) {
in =
in.replace( pos, oldString.length(), newString );
}
return in;
}
}; // Namespace

80
src/stringhelper.h Normal file
View File

@ -0,0 +1,80 @@
////////////////////////////////////////////////////////////////////////
// FILE: stringhelper.h
// AUTHOR: Johannes Winkelmann, jw@tks6.net
// COPYRIGHT: (c) 2002 by Johannes Winkelmann
// ---------------------------------------------------------------------
// 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.
////////////////////////////////////////////////////////////////////////
#ifndef _STRINGHELPER_H_
#define _STRINGHELPER_H_
#include <list>
#include <string>
using namespace std;
/*!
\brief A generic place with string functions
*/
namespace StringHelper
{
template <class T>
void split( const string& s, char del,
T& target,
int startPos=0, bool useEmpty=true );
string stripWhiteSpace( const string& s );
bool startwith_nocase( const string& s1, const string& s2 );
string getValue( const string& s, char del );
string getValueBefore( const string& s, char del );
string toLowerCase( const string& s );
string toUpperCase( const string& s );
string replaceAll( string& in,
const string& oldString,
const string& newString );
/*!
split a string into parts
\param s string to be split
\param del delimter
\param startPos position to start at
\param useEmpty include empty (whitespace only9 results in the result
\return a list of string
*/
template <class T>
void split( const string& s, char del,
T& target,
int startPos, bool useEmpty )
{
string line = s;
string::size_type pos;
int offset = startPos;
while ( ( pos = line.find( del, offset ) ) != string::npos ) {
offset = 0;
string val = line.substr( 0, pos );
if ( useEmpty || !stripWhiteSpace( val ).empty() ) {
target.push_back( val );
}
line.erase( 0, pos+1 );
}
if ( line.length() > 0 ) {
target.push_back( line );
}
}
};
#endif /* _STRINGHELPER_H_ */

250
src/versioncomparator.cpp Normal file
View File

@ -0,0 +1,250 @@
////////////////////////////////////////////////////////////////////////
// FILE: versioncomparator.cpp
// AUTHOR: Johannes Winkelmann, jw@tks6.net
// COPYRIGHT: (c) 2004 by Johannes Winkelmann
// ---------------------------------------------------------------------
// 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.
////////////////////////////////////////////////////////////////////////
// Get a test application with the following command:
// g++ -o vcomp -DTEST stringhelper.cpp versioncomparator.cpp
#include <string>
#include <cctype>
#include <vector>
#include <iostream>
using namespace std;
#include "stringhelper.h"
using namespace StringHelper;
#include "versioncomparator.h"
namespace VersionComparator
{
// this is a one day hack; I'll refactor that to be nicer, clearer and
// hopefully faster. It should work pretty well though
COMP_RESULT compareVersions(const string& v1, const string& v2)
{
vector<string> blocks1;
vector<string> blocks2;
tokenizeIntoBlocks(v1, blocks1);
tokenizeIntoBlocks(v2, blocks2);
int blockLen = normalizeVectors(blocks1, blocks2);
for (int i = 0; i < blockLen; ++i) {
vector<string> tokens1;
vector<string> tokens2;
split(blocks1[i], '.', tokens1);
split(blocks2[i], '.', tokens2);
int tokLen = normalizeVectors(tokens1, tokens2);
for (int j = 0; j < tokLen; ++j) {
if (tokens1[j] == tokens2[j]) {
continue;
}
char* error1 = 0;
char* error2 = 0;
error1 = 0;
error2 = 0;
long vl1 = strtol(tokens1[j].c_str(), &error1, 10);
long vl2 = strtol(tokens2[j].c_str(), &error2, 10);
if (*error1 != 0 || *error2 != 0) {
// subtokenize
vector<string> subtokens1;
vector<string> subtokens2;
tokenizeMixed(tokens1[j], subtokens1);
tokenizeMixed(tokens2[j], subtokens2);
int subTokLen = normalizeVectors(subtokens1, subtokens2);
for (int k = 0; k < subTokLen; ++k) {
if (isdigit(subtokens1[k][0])) {
long sl1 = strtol(subtokens1[k].c_str(), &error1, 10);
long sl2 = strtol(subtokens2[k].c_str(), &error2, 10);
if (sl1 < sl2) {
return LESS;
} else if (sl1 > sl2) {
return GREATER;
}
} else {
// pure string tokens
if (subtokens1[k][1] == 0 && subtokens2[k][1] == 0) {
if (subtokens1[k][0] < subtokens2[k][0]) {
return LESS;
} else if (subtokens1[k][0] > subtokens2[k][0]) {
return GREATER;
}
} else {
// smart guessing...
// leaving out 'test', 'pre' and 'rc'
static const string versions =
"alpha beta gamma delta";
string::size_type pos1 =
versions.find(subtokens1[k]);
string::size_type pos2 =
versions.find(subtokens2[k]);
if (pos1 != string::npos && pos2 != string::npos) {
if (pos1 < pos2) {
return LESS;
} else if (pos1 > pos2) {
return GREATER;
}
}
}
if (subtokens1[k] != subtokens2[k]) {
return UNDEFINED;
}
}
}
} else if (vl1 < vl2) {
return LESS;
} else if (vl1 > vl2) {
return GREATER;
}
}
}
return EQUAL;
}
int normalizeVectors(vector<string>& v1, vector<string>& v2)
{
int length = max(v1.size(), v2.size());
while (v1.size() < length) {
v1.push_back("-1");
}
while (v2.size() < length) {
v2.push_back("-1");
}
return length;
}
void tokenizeMixed(const string& s, vector<string>& tokens)
{
vector<bool> digitMask;
for (int i = 0; i < s.length(); ++i) {
digitMask.push_back(isdigit(s[i]));
}
bool state = digitMask[0];
string tok;
tok = s[0];
for (int i = 1; i < digitMask.size(); ++i) {
if (digitMask[i] != state) {
tokens.push_back(tok);
tok = s[i];
state = digitMask[i];
} else {
tok += s[i];
}
}
if (tok.length() > 0) {
tokens.push_back(tok);
}
}
/*
find last - (for release) -> version, release
subdivide version in blocks, where a block is separated by any of
the following: [-_]
-> list of blocks, e.g.
. 1.4.2-pre1-2 -> [ (1.4.2) (-pre1) (2) ]
. 1.4.2pre1-1 -> [ (1.4.2pre1) (-1) ]
. 1_2_2pre2-2 -> [ (1) (2) (2pre2) (2)
*/
void tokenizeIntoBlocks(const string& version, vector<string>& blocks)
{
string v = version;
v = replaceAll(v, "-", "_");
split(v, '_', blocks);
}
}
void check(const string& v1, const string& v2,
VersionComparator::COMP_RESULT expected, bool compare=true)
{
VersionComparator::COMP_RESULT result =
VersionComparator::compareVersions(v1, v2);
if (compare) {
cout << ((result == expected) ? "OK " : "FAIL ");
}
cout << v1 << " ";
switch (result)
{
case VersionComparator::LESS:
cout << "<";
break;
case VersionComparator::GREATER:
cout << ">";
break;
case VersionComparator::EQUAL:
cout << "=";
break;
case VersionComparator::UNDEFINED:
cout << "?";
break;
}
cout << " " << v2 << endl;
}
#ifdef TEST
int main(int argc, char** argv)
{
using namespace VersionComparator;
if (argc < 3) {
check("1", "2", LESS);
check("1.1", "1.2", LESS);
check("1.1pre1", "1.1pre2", LESS);
check("1.1pre1", "1.2pre1", LESS);
check("1.1-pre1", "1.1-pre2", LESS);
check("1.1_2", "1.1.2", LESS);
check("1.1", "1.1", EQUAL);
check("1.0PR1", "1.0PR1", EQUAL);
check("1.0PR1", "1.0PR2", LESS);
check("1.0PR1", "1.0RC1", UNDEFINED);
check("1.2.3-2", "1.2.3-1", GREATER);
check("1.0.0", "0.9", GREATER);
check("1.4.2_3-1", "1.4.3-2", LESS);
check("1.4.2_3-1", "1.4.2_3-2", LESS);
check("1.4.2_3-1", "1.4.2_1-1", GREATER);
check("1.4.2-alpha2", "1.4.2-beta1", LESS);
check("1.4.2a-2", "1.4.2a-3", LESS);
check("1.4.2a-2", "1.4.2b-2", LESS);
check("1.4.2aa-2", "1.4.2bb-2", UNDEFINED);
check("1.4.2a1-2", "1.4.2a2-2", LESS);
check("1.4.2b1-2", "1.4.2a2-2", GREATER);
check("1.4.2beta3", "1.4.2alpha2", GREATER);
} else {
check(argv[1], argv[2], UNDEFINED, false);
}
}
#endif

28
src/versioncomparator.h Normal file
View File

@ -0,0 +1,28 @@
////////////////////////////////////////////////////////////////////////
// FILE: versioncomparator.h
// AUTHOR: Johannes Winkelmann, jw@tks6.net
// COPYRIGHT: (c) 2004 by Johannes Winkelmann
// ---------------------------------------------------------------------
// 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.
////////////////////////////////////////////////////////////////////////
#ifndef _VERSIONCOMP_H_
#define _VERSIONCOMP_H_
namespace VersionComparator
{
enum COMP_RESULT { LESS, GREATER, EQUAL, UNDEFINED };
COMP_RESULT compareVersions(const string& v1, const string& v2) ;
void tokenizeIntoBlocks(const string& version, vector<string>& blocks);
int normalizeVectors(vector<string>& v1, vector<string>& v2);
void tokenizeMixed(const string& s, vector<string>& tokens);
}
#endif /* _VERSIONCOMP_H_ */