Compare commits
16 Commits
mixed-upin
...
softdeps
| Author | SHA1 | Date | |
|---|---|---|---|
| 2ec067cddb | |||
| c662852caf | |||
| 19a3ba19ad | |||
| 4e0421bc32 | |||
| ffe29e224e | |||
| 487060e496 | |||
| 92474ea81d | |||
| 482c8efb58 | |||
| eeaea8ee89 | |||
| 7175591b00 | |||
| 8f71c4fe8b | |||
| e504cf66d3 | |||
| 211fe43fd9 | |||
| d9a0d39b60 | |||
| 21f2e52314 | |||
| b3404ff38e |
38
ChangeLog
38
ChangeLog
@@ -1,39 +1,15 @@
|
||||
* 31.08.2023 John McQuah
|
||||
- allow deletion of build log when a package is removed (feature requested
|
||||
by samsep10l)
|
||||
- man-page updates
|
||||
- demonstrate how to troubleshoot a failed depinst due to omitted softdeps
|
||||
- discuss the rmlog_on_uninst feature
|
||||
- allow prt-get to remove build log when uninstalling a package (feature
|
||||
requested by samsep10l)
|
||||
|
||||
* 29.05.2023 John McQuah
|
||||
- eliminate code duplication in printDepTree
|
||||
- respect the user's choice of --install-root when running pre- and
|
||||
* 31.03.2023 John McQuah
|
||||
- respect the user's choice of --install-root when running pre- or
|
||||
post-install scripts
|
||||
- update man-page with an example of core-only sysup
|
||||
- switch from autotools to meson
|
||||
|
||||
* 19.03.2023 John McQuah
|
||||
- switch between install and update on a port-by-port basis, whichever is needed
|
||||
- allow dependency injection during sysup (controllable via --nodeps)
|
||||
- check whether a built package already exists before calling pkgmk
|
||||
- consolidate printDependent and printDepTree
|
||||
- consolidate sysup, printQuickDiff, and printDiff
|
||||
- let the argParser recognize some synonyms for old commands
|
||||
- assign meanings to --nodeps and --depsort for other subroutines
|
||||
|
||||
* 10.03.2023 John McQuah
|
||||
- make it possible for the dependency resolver to consider optionals
|
||||
|
||||
* 27.02.2022 Alexandr Savca, Tim Biermann
|
||||
- fix segfault in prt-cache
|
||||
|
||||
* 5.19.5 16.10.2020 Matt Housh, Juergen Daubert
|
||||
- add a regex fix for listinst
|
||||
- move aliases file to /etc
|
||||
|
||||
* 5.19.2 01.03.2019 James Buren
|
||||
- fix misc compiler warnings
|
||||
- fix FS#1646, caused by wrong use of close() instead of fclose()
|
||||
- make it possible to consider optional dependencies when updating
|
||||
- bump version of the cache file format, to warn users about the
|
||||
'Packager' field being replaced by 'Optional'
|
||||
|
||||
* 5.16 26.06.2008 Johannes Winkelmann
|
||||
- don't loop forever when version= contains unsupported $() tokens
|
||||
|
||||
8
FAQ
Normal file
8
FAQ
Normal 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:
|
||||
2
INSTALL
2
INSTALL
@@ -1,7 +1,7 @@
|
||||
Installing prt-get
|
||||
------------------
|
||||
Installing prt-get is just a matter of
|
||||
|
||||
Installing prt-get is just a matter of
|
||||
meson setup bld --prefix=/usr
|
||||
cd bld && meson compile
|
||||
meson install
|
||||
|
||||
15
README
15
README
@@ -9,7 +9,6 @@ ports from crux (http://crux.nu). It offers some simplification over
|
||||
pure pkgmk, but might hide some interesting details about the install
|
||||
process.
|
||||
|
||||
|
||||
Installing:
|
||||
-----------
|
||||
Download an iso of the latest CRUX release for a precompiled package.
|
||||
@@ -24,20 +23,18 @@ found _first_ will be used.
|
||||
Feel free to file a bug report on the Gitea issue tracker:
|
||||
https://git.crux.nu:82/farkuhar/prt-get/issues/
|
||||
|
||||
|
||||
More information:
|
||||
-----------------
|
||||
See the man pages for prt-get(8), prt-get.conf(5) and prt-cache(8) for more
|
||||
more information
|
||||
----------------
|
||||
See the man pages for prt-get(8), prt-get.conf(5) and prt-cache for more
|
||||
information. The CRUX homepage also offers a (somewhat dated) User Manual
|
||||
and Quick Start guide:
|
||||
https://crux.nu/doc/prt-get%20-%20User%20Manual.html
|
||||
https://crux.nu/doc/prt-get%20-%20Quick%20start.html
|
||||
|
||||
|
||||
"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 suffers no harm). The reason
|
||||
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.
|
||||
too much
|
||||
|
||||
2
TODO
2
TODO
@@ -1,5 +1,5 @@
|
||||
- add --rebuild-set to dependent
|
||||
- allow dependency injection for sysup (done), with previews (?)
|
||||
- allow dependency injection for sysup, with previews
|
||||
- prefer toolchain (patch in trac)
|
||||
- logging: check for non-root owned symlinks
|
||||
- logging: reject relative logfile names
|
||||
|
||||
92
doc/FS1843.md
Normal file
92
doc/FS1843.md
Normal file
@@ -0,0 +1,92 @@
|
||||
# Flyspray 1843 notes
|
||||
## Was: Re: Please make the output of prt-get --test more common
|
||||
|
||||
teodor observed that prt-get --test gives two different styles of output.
|
||||
The output style was found to be affected by the number of packages requested
|
||||
on the command line (one versus many), and by whether dependency resolution
|
||||
was toggled (install versus depinst).
|
||||
|
||||
In the case when one package was requested for installation, an early check
|
||||
of /var/lib/pkg/db for the existence of a previous installation would alert the
|
||||
user to the malformed command. No such check of /var/lib/pkg/db was
|
||||
being performed for multiple packages passed on the command line (FS#1910), and
|
||||
so the program continued all the way through executeTransaction() and
|
||||
evaluateResult(), which produced the more verbose output that teodor noted.
|
||||
|
||||
A similar discrepancy could be observed when requesting an **update** of **one**
|
||||
package that was not previously installed, versus an update of **multiple**
|
||||
packages among which there are some not yet installed. You would have seen a
|
||||
terse warning in the first case, and a more verbose output in the second case.
|
||||
|
||||
The softdeps branch in this code base is now more consistent in performing the
|
||||
scan of /var/lib/pkg/db, no matter how many packages are passed as argument.
|
||||
But the mixed-upinst branch collapses the distinction between install and
|
||||
update, always bringing up to date all the ports passed as argument (and their
|
||||
dependencies, unless --nodeps is given), so it can postpone the scan of
|
||||
/var/lib/pkg/db until the step of customizing pkgadd flags for each target.
|
||||
Hence there is no corresponding code in the mixed-upinst branch to solve FS#1910
|
||||
by exiting early with an error message.
|
||||
|
||||
teodor's second observation is more interesting. During dependency resolution,
|
||||
the invalid arguments (ports not found in the active repos) were silently being
|
||||
dropped, rather than being kept in memory for a post-transaction report. If
|
||||
**all** ports passed to a ``depinst`` command are nowhere among the active
|
||||
repositories, then the empty set is what gets used for executeTransaction(),
|
||||
with the predictable result "no package specified for install". Why did we see
|
||||
a different result when running ``install``? Because the calculateDependencies()
|
||||
method was never called, and so executeTransaction() received the entire list
|
||||
of nowhere-to-be-found ports! Iterating through this list of nonexistent ports
|
||||
would populate the missingPackages list, which would then be displayed nicely
|
||||
during the post-transaction summary. This side-effect of toggling dependency
|
||||
resolution could be observed in both the softdeps and the mixed-upinst branch,
|
||||
prior to the commits of 2023-09-15.
|
||||
|
||||
Although we do populate a missingPackages list during calculateDependencies(),
|
||||
the contents of this list were not being included in the post-transaction
|
||||
summary. As the code was originally conceived, executeTransaction() would get
|
||||
a filtered list, with missing packages omitted. This side-effect of ``depinst``
|
||||
violates the principle of least surprise, because users like teodor might
|
||||
justifiably expect toggling dependency resolution to generate a superset of
|
||||
**their argument list** @ARGV, not just a superset of the valid ports in @ARGV.
|
||||
To be more faithful to the principle of least surprise, the softdeps branch now
|
||||
propagates into executeTransaction() even the ports that are not in the repos,
|
||||
so that the post-transaction summary can display them. The mixed-upinst branch
|
||||
does the same, but because it merges ``install`` and ``update``, any requested
|
||||
targets that are already installed and up-to-date will appear in the
|
||||
post-transaction summary under the header "Packages already installed before
|
||||
this run (ignored)".
|
||||
|
||||
With dependency resolution enabled, the list of "Packages already installed
|
||||
before this run (ignored)" often fills up the entire height of a terminal.
|
||||
If we implemented teodor's suggestion and united the list of
|
||||
"Packages not found" with this list --- already often big enough on its own ---
|
||||
then readability of the post-transaction summary would suffer.
|
||||
Two separate lists would offer greater readability in most cases, both for
|
||||
the human eye and for a shell script.
|
||||
|
||||
teodor's proposed heading for a united list, "The following ports were
|
||||
not found/already installed:", did inspire a new way for the softdeps branch
|
||||
to handle FS#1910. All arguments to ``install`` and ``depinst`` will be tested
|
||||
against /var/lib/pkg/db to ensure that they're not already installed, and if
|
||||
all the tests fail then the user is immediately alerted to the malformed
|
||||
command. This preliminary check is simply jw's original design, but extended
|
||||
from one port to many. However, if any of the requested ports is not yet
|
||||
installed, we can go ahead with initRepo() and attempt a less ambitious
|
||||
transaction (limited to a subset of the user's argument list). The program
|
||||
will reach evaluateTransaction() and display what succeeded, as well as what
|
||||
was wrong with the original command.
|
||||
|
||||
The softdeps branch has no corresponding leniency in handling an ``update``
|
||||
command, because the typical scenario for using that command is after
|
||||
running ``prt-get diff``, at which point the user can be expected to know
|
||||
what's on their system and to pass as arguments only the names of packages
|
||||
already installed. So the early exit behaviour of my previous solution to
|
||||
FS#1910 is retained for the ``update`` command. But it's easy to imagine a
|
||||
user passing invalid targets to an ``install`` command, in the absence of
|
||||
any cues from running ``prt-get listinst | grep -E
|
||||
(package1|package2|...|packageN)``, and to handle that possibility it
|
||||
makes sense to parse leniently the arguments passed to ``install``. Users
|
||||
then obtain on the first try, most of what they intended, while also getting
|
||||
an informative list of already-installed packages in the post-transaction report.
|
||||
If they really intended to force the rebuild of those already-installed
|
||||
packages, they can issue a revised command after the first command succeeds.
|
||||
@@ -1,110 +0,0 @@
|
||||
# Followup on installing i3 with the softdeps-aware fork of prt-get
|
||||
## (Was: Re: [prt-get nicetohave](https://lists.crux.nu/pipermail/crux/2023-August/007375.html))
|
||||
## 2023-08-25
|
||||
|
||||
The "Optional" metadata field stirred up some controversy when first
|
||||
proposed. At the time, it was preferred to write Pkgfiles whose build()
|
||||
functions contain no branching logic to customize the build for the host
|
||||
machine. Maintainers would even try to suppress the branching logic hidden
|
||||
inside the autotools ./configure script using command-line switches to
|
||||
hard-code the desired defaults [1]. Peer pressure eventually wore away at
|
||||
the resistance to this new metadata field, so it is now in widespread use
|
||||
despite there being no official mandate for contributors to test their ports
|
||||
under all possible configurations. Whenever a port can adapt to a variety of
|
||||
use-cases, maintainers try to document that versatility in the "Optional"
|
||||
field. But our package management tools remain unable to use that data! At
|
||||
present, it requires a human reading the Pkgfile, for the data in the "Optional"
|
||||
field to affect the order in which ports are built. Thankfully, sorting with
|
||||
optional dependencies taken into account is now possible in prt-get itself,
|
||||
either with the
|
||||
[softdeps](https://git.crux.nu:82/farkuhar/prt-get/src/branch/softdeps) or the
|
||||
[mixed-upinst](https://git.crux.nu:82/farkuhar/prt-get/src/branch/mixed-upinst)
|
||||
branch of the fork by farkuhar.
|
||||
|
||||
Respecting the limitations of a prt-get that only knows about hard dependencies
|
||||
would entail following the old practice and hard-coding the configure options
|
||||
in each port. This example of letting our tools dictate how we work (rather
|
||||
than updating the tools to fit a new workflow) would encourage a portdb more
|
||||
like the AUR, with a seemingly endless variety of dups that all have
|
||||
their own particular combination of configure options. Thankfully the
|
||||
unwieldiness of this prospect was enough to deter maintainers from clinging to
|
||||
an outmoded interpretation of KISS [3], and they adopted the new norm of
|
||||
"fluid Pkgfiles" (FS#1576) even as prt-get remained unable to incorporate this
|
||||
fluidity in its operations.
|
||||
|
||||
As recently as November 2021, users of CRUX could still have noticed a remnant
|
||||
of the historical preference for non-fluid Pkgfiles, illustrated by the
|
||||
coexisting pair harfbuzz and harfbuzz-icu. These ports differed from each other
|
||||
only in the configuration option that enables linking to icu. A port that
|
||||
depends on the icu-linked harfbuzz would list harfbuzz-icu among its
|
||||
dependencies, while a port that did not require such linking would only
|
||||
list harfbuzz.
|
||||
|
||||
Such dups in the portdb, all using the same upstream tarball, inevitably
|
||||
have overlapping footprints, and it becomes impossible to avoid filesystem
|
||||
collisions if a user running `prt-get depinst foo` triggers an attempt to
|
||||
pkgadd a variant of an already-installed port. Once the set of installed
|
||||
ports is sufficiently diverse, maintaining prt-get.aliases so as to avoid
|
||||
such collisions becomes an impossible task.
|
||||
|
||||
Nix (and GoboLinux even earlier) solves the overlapping footprint problem
|
||||
by giving each package its own separate directory in the filesystem. This
|
||||
solution arguably fits quite well with the historical CRUX preference for
|
||||
rigid Pkgfiles, offering a one-to-one correspondence between a repository
|
||||
of non-fluid ports, and the filesystem where built packages are unpacked.
|
||||
But CRUX was reluctant to impose an additional layer of complexity on top
|
||||
of the Filesystem Hierarchy Standard, and so the Nix and GoboLinux solution
|
||||
never gained serious consideration in the CRUX community.
|
||||
|
||||
As the last vestige of a historical preference for non-fluid ports,
|
||||
harfbuzz and harfbuzz-icu persisted alongside each other until surprisingly
|
||||
recently, only getting merged into one fluid port with commit
|
||||
b2e30dbf8c96e03f4fe4b39b1e5ffbecd8372787. This merge allowed users to
|
||||
simplify prt-get.aliases, removing `harfbuzz-icu: harfbuzz` (if they had
|
||||
ever added such an entry to avoid filesystem collisions).
|
||||
|
||||
Equipping prt-get with softdeps awareness is just letting our tools evolve
|
||||
to match the trend toward fluid Pkgfiles. If the new prt-get capabilities
|
||||
are deemed to violate the CRUX Mantra [2], then the same criticism can be
|
||||
leveled against fluid Pkgfiles. Such criticisms were in fact expressed
|
||||
(by Anton most stridently, and by Tilman and Juergen in a gentler tone)
|
||||
during the discussions of USE flags and "prt-get nicetohave" [3,4]. But the
|
||||
resistance to fluid Pkgfiles has diminished over the years, to such an extent
|
||||
that nobody has seriously proposed crafting the dependency graph so that
|
||||
`prt-get depinst i3` is impossible to fail [5], say by making i3 depend on a
|
||||
duplicate port libxkbcommon-x11 (which would differ from libxkbcommon only by
|
||||
hard-coding the meson option "-D enable-x11" and by listing xkeyboard-config
|
||||
as a hard dependency --- similar to how harfbuzz-icu differed from harfbuzz).
|
||||
|
||||
A duplicate port of libxkbcommon is indeed a KISS solution, with prt-get in its
|
||||
present state. That nobody bothered to propose such a dup is a clear indication
|
||||
that we are not going back to non-fluid Pkgfiles anytime soon. So either our
|
||||
Pkgfiles have irrevocably become "just a bit" more complex (and therefore no
|
||||
longer "simple"), or they are in fact the simplest way to accommodate the modern
|
||||
software landscape. In the latter case, a KISS objection to the corresponding
|
||||
logic in prt-get is hypocritical. In the former case, it could be argued that two
|
||||
wrongs do not make a right, and the trend away from KISS Pkgfiles does not
|
||||
justify making prt-get "just a bit" more complex. But then we would have an
|
||||
awkward mismatch between the capabilities of prt-get, and the ports that it
|
||||
has to handle. This mismatch is only a slight annoyance at present (the
|
||||
experienced users that make up the CRUX target audience can usually diagnose
|
||||
the problem themselves if they encounter a build failure like [5]), but before the
|
||||
software landscape becomes even more convoluted and such build failures harder
|
||||
to avoid, we should have the discussion on adding new logic to prt-get.
|
||||
|
||||
[1] It should be noted that the autotools ./configure script (or its
|
||||
meson or cmake counterpart) might not actually expose all compile-time
|
||||
options via command-line switches. Hence some testing of the host
|
||||
environment is unavoidable, unless the port maintainer performs substantial
|
||||
downstream patching of the source tree.
|
||||
|
||||
[2] We do not want to prepare for all necessities and build a complex system
|
||||
which in 90% of all cases is overkill ... making something "just a bit"
|
||||
more complex is not "simple" anymore. (https://crux.nu/Main/Mantra)
|
||||
|
||||
[3] https://lists.crux.nu/pipermail/crux-devel/2006-August/001912.html
|
||||
|
||||
[4] https://lists.crux.nu/pipermail/crux-devel/2008-May/003366.html
|
||||
|
||||
[5] The possibility of this command failing was first noted by jaeger in
|
||||
https://libera.irclog.whitequark.org/crux/2023-08-21 (16:36)
|
||||
@@ -1,291 +0,0 @@
|
||||
Thanks to hestia and jaeger for inspiring this hacking session (2023-08-22).
|
||||
(Update 2023-08-25): see i3-softdeps.md in this directory for more
|
||||
discussion on the merits of adding new prt-get features.
|
||||
|
||||
In light of the recent changes to libxkbcommon, jaeger made the observation
|
||||
that `prt-get depinst i3` on a core-only system hits an error, as
|
||||
libxkbcommon will be built without x11 support. To establish a reference point
|
||||
for subsequent experiments, here is the list of targets that would be selected
|
||||
by the latest official release of prt-get (5.19.6), in response to the
|
||||
recommended way of installing a desired port.
|
||||
|
||||
All commands were performed on a pkg-cleaned installation of CRUX 3.7, leaving
|
||||
the ports at whatever outdated version they had when this particular system was
|
||||
last in daily use.
|
||||
|
||||
In[0]: prt-get depinst --test i3
|
||||
Out[0]:
|
||||
*** prt-get: test mode
|
||||
|
||||
-- Packages installed
|
||||
fribidi
|
||||
xorg-util-macros
|
||||
xorg-libpixman
|
||||
libev
|
||||
libpng
|
||||
libxml2
|
||||
xorg-xtrans
|
||||
libxkbcommon
|
||||
libxslt
|
||||
xorg-xcb-proto
|
||||
yajl
|
||||
xorg-xorgproto
|
||||
freetype
|
||||
glib
|
||||
xorg-libice
|
||||
xorg-libxau
|
||||
xorg-libxdmcp
|
||||
fontconfig
|
||||
gobject-introspection
|
||||
xorg-libsm
|
||||
xorg-libxcb
|
||||
xorg-libx11
|
||||
xorg-xcb-util
|
||||
xorg-xcb-util-renderutil
|
||||
xorg-xcb-util-keysyms
|
||||
xorg-xcb-util-wm
|
||||
xorg-libxext
|
||||
xorg-libxrender
|
||||
xorg-libxt
|
||||
xorg-libxkbfile
|
||||
xorg-xcb-util-image
|
||||
xorg-xcb-util-xrm
|
||||
cairo
|
||||
startup-notification
|
||||
xorg-xkbcomp
|
||||
xorg-xcb-util-cursor
|
||||
harfbuzz
|
||||
xkeyboard-config
|
||||
xorg-libxft
|
||||
pango
|
||||
i3
|
||||
|
||||
-- installed packages with README files:
|
||||
fontconfig
|
||||
|
||||
prt-get: installed successfully
|
||||
|
||||
*** prt-get: test mode end
|
||||
|
||||
As seen in the output above, at the time of building libxkbcommon, there are
|
||||
only 7 non-core ports installed, none of which is xkeyboard-config,
|
||||
so the flag '-D enable-x11=false' gets passed to the meson setup command for
|
||||
libxkbcommon. Thus the necessary linking to x11 libs does not happen, and i3
|
||||
cannot compile successfully.
|
||||
|
||||
Suppose we try to fix this omission in the most natural way: append
|
||||
xkeyboard-config at the end of i3's dependency list.
|
||||
|
||||
sed -i '/^# Depends on/s/$/ xkeyboard-config/' /usr/ports/opt/i3/Pkgfile
|
||||
|
||||
Even this change is not enough! prt-get is not aware of the optional
|
||||
dependency relationship between libxkbcommon and xkeyboard-config, and so
|
||||
cannot insist that libxkbcommon comes later in the list of targets. jw
|
||||
came to a similar conclusion 15 years ago (footnote 1).
|
||||
|
||||
Let's see whether farkuhar's softdeps-aware fork can do any better on this
|
||||
task. The naive approach, prt-get depinst --softdeps i3, still doesn't work
|
||||
because it will not automagically make two passes through the dependency tree
|
||||
(the first pass to assemble a minimal installation set, and the second pass to
|
||||
insert edges in the digraph based on optional dependency relationships among
|
||||
the targets found). Instead, you have to manually ask for two traversals of the
|
||||
dependency tree using a command substitution.
|
||||
|
||||
In[1]: prt-get isinst $(prt-get quickdep i3) | awk '/not installed/ {print $2}' \
|
||||
| xargs prt-get depinst --test --softdeps
|
||||
|
||||
(Note that it's also necessary to filter out the already-installed ports before
|
||||
passing the quickdep output to `prt-get depinst` because this branch still
|
||||
makes a distinction between install and update transactions.)
|
||||
|
||||
Out[1]:
|
||||
*** prt-get: test mode
|
||||
|
||||
-- Packages installed
|
||||
fribidi
|
||||
xorg-util-macros
|
||||
xorg-libpixman
|
||||
libev
|
||||
xorg-xtrans
|
||||
libpng
|
||||
libxml2
|
||||
fontconfig
|
||||
libxslt
|
||||
xorg-xcb-proto
|
||||
yajl
|
||||
xorg-xorgproto
|
||||
glib [post: deferred]
|
||||
xorg-libxau
|
||||
xorg-libxdmcp
|
||||
xorg-libice
|
||||
xorg-libxcb
|
||||
xorg-libsm
|
||||
xorg-libx11
|
||||
xorg-xcb-util
|
||||
xorg-xcb-util-renderutil
|
||||
xorg-xcb-util-keysyms
|
||||
xorg-xcb-util-wm
|
||||
xorg-libxkbfile
|
||||
xorg-libxext
|
||||
xorg-libxrender
|
||||
xorg-libxt
|
||||
xorg-xcb-util-image
|
||||
xorg-xcb-util-xrm
|
||||
xorg-xkbcomp
|
||||
cairo
|
||||
startup-notification
|
||||
xorg-xcb-util-cursor
|
||||
xkeyboard-config
|
||||
gobject-introspection
|
||||
libxkbcommon
|
||||
harfbuzz
|
||||
freetype
|
||||
xorg-libxft
|
||||
pango
|
||||
i3
|
||||
|
||||
-- installed packages with README files:
|
||||
/usr/ports/opt/fontconfig
|
||||
|
||||
prt-get: installed successfully
|
||||
|
||||
*** prt-get: test mode end
|
||||
|
||||
|
||||
This output looks more likely to succeed. Note that libxkbcommon would be built
|
||||
AFTER its optional dependency xkeyboard-config, because when xkeyboard-config
|
||||
appears among the depinst targets, that dependency relationship gets
|
||||
incorporated into the sorting algorithm.
|
||||
|
||||
|
||||
The mixed-upinst branch of farkuhar's prt-get goes further. Not only do you
|
||||
get the feature of respecting optional dependencies, you can also do the
|
||||
command substitution without the awk filter, and the appropriate mode
|
||||
(install or update) will be selected for each target.
|
||||
|
||||
In[2]: prt-get depinst --softdeps --test $(prt-get quickdep i3)
|
||||
|
||||
Out[2]:
|
||||
*** prt-get: test mode
|
||||
|
||||
-- Successful packages
|
||||
fribidi
|
||||
xz
|
||||
zlib
|
||||
ncurses
|
||||
expat
|
||||
libffi
|
||||
libnghttp2
|
||||
openssl
|
||||
libuv
|
||||
lzlib
|
||||
rhash
|
||||
xorg-util-macros
|
||||
libpcre2
|
||||
xorg-libpixman
|
||||
libev
|
||||
libpng
|
||||
elfutils
|
||||
libxml2
|
||||
readline
|
||||
fontconfig
|
||||
xorg-xtrans
|
||||
file
|
||||
curl
|
||||
libxslt
|
||||
sqlite3
|
||||
libarchive
|
||||
util-linux
|
||||
python3
|
||||
cmake
|
||||
python3-setuptools
|
||||
xorg-xcb-proto
|
||||
yajl
|
||||
meson
|
||||
xorg-xorgproto
|
||||
glib [post: deferred]
|
||||
xorg-libxau
|
||||
xorg-libxdmcp
|
||||
xorg-libice
|
||||
xorg-libxcb
|
||||
xorg-libsm
|
||||
xorg-libx11
|
||||
xorg-xcb-util
|
||||
xorg-xcb-util-renderutil
|
||||
xorg-xcb-util-keysyms
|
||||
xorg-xcb-util-wm
|
||||
xorg-libxkbfile
|
||||
xorg-libxext
|
||||
xorg-libxrender
|
||||
xorg-libxt
|
||||
xorg-xcb-util-image
|
||||
xorg-xcb-util-xrm
|
||||
xorg-xkbcomp
|
||||
cairo
|
||||
startup-notification
|
||||
xorg-xcb-util-cursor
|
||||
xkeyboard-config
|
||||
gobject-introspection
|
||||
libxkbcommon
|
||||
harfbuzz
|
||||
freetype
|
||||
xorg-libxft
|
||||
pango
|
||||
i3
|
||||
|
||||
-- Successful packages with README files:
|
||||
fontconfig
|
||||
|
||||
prt-get: install successful.
|
||||
|
||||
*** prt-get: test mode end
|
||||
|
||||
The output of the last command reveals why we recommend performing a sysup
|
||||
before installing new ports. Because dependencies in core are not listed unless
|
||||
they are dynamically linked in, some of the out-of-date core ports on my test
|
||||
system would get updated later, possibly leading to breakage (e.g, if the
|
||||
desired port is relying on a new or backward-incompatible feature in one of
|
||||
the foundational pieces of the toolchain).
|
||||
|
||||
Footnotes:
|
||||
1. https://lists.crux.nu/pipermail/crux-devel/2008-May/003375.html
|
||||
|
||||
2. The more intuitive version of the above commands, `prt-get depinst
|
||||
--test --softdeps i3`, currently does NOT consider the dependency
|
||||
relationship "libxkbcommon optionally depends on xkeyboard-config", because
|
||||
the latter port is neither currently installed, nor listed explicitly as an
|
||||
install target. This safeguard is meant to allow the operation to proceed
|
||||
after a SINGLE pass through the deptree, without pulling in ALL the ports
|
||||
listed as "Optional:" . In future we might consider letting the more
|
||||
intuitive command automatically make TWO passes through the deptree:
|
||||
first to pick up all the hard dependencies, and then to insert edges in the
|
||||
digraph that encode the optional dependencies among these targets. But such
|
||||
"automagic side-effects" (two traversals versus one) are typically frowned
|
||||
upon in CRUX, so for now we are happy to employ the command substitution
|
||||
$(prt-get quickdep i3) thereby communicating to prt-get our intention for
|
||||
two traversals of the deptree.
|
||||
|
||||
|
||||
3. The result of trial 2 would be identical to that of
|
||||
`prt-get install --softdeps $(prt-get quickdep i3)` using the
|
||||
mixed-upinst branch, because 'install' on this branch behaves the same
|
||||
as 'depinst'. In https://lists.crux.nu/pipermail/crux/2008-June/001784.html
|
||||
jw describes this change as "prt-get no more silently assumes that the user
|
||||
didn't want a particular dependency".
|
||||
farkuhar's mixed-upinst branch still gives you the option to override this
|
||||
dependency-resolution-by-default; you just have to enter 'install --nodeps'
|
||||
instead of simply 'install'.
|
||||
|
||||
|
||||
4. Some maintainers prefer to do a filesystem check to determine whether a
|
||||
needed dependency was linked to one of its optional libraries, and then
|
||||
exit early with a message alerting the user to rebuild one of the packages
|
||||
in the dependency tree. See contrib/libreoffice for an example. This
|
||||
preference is arguably more aligned with CRUX's stance against excessively
|
||||
"holding the user's hand". The softdeps feature is not intended to supplant
|
||||
the user's thinking, but rather to give convenient access to a more versatile
|
||||
topological sorting algorithm than the one coded in the official prt-get. The
|
||||
toposort algorithm used in the above experiments remains true to the style
|
||||
of jw's original code, but you can see another working implementation in
|
||||
farkuhar's Perl rewrite
|
||||
https://git.sdf.org/jmq/Documentation/src/branch/master/scripts/prt-auf .
|
||||
396
doc/prt-get.8
396
doc/prt-get.8
@@ -14,7 +14,7 @@ pkgutils from CRUX (see http://www.crux.nu)
|
||||
.B prt\-get command [options] <arguments>
|
||||
.br
|
||||
.SH "DESCRIPTION"
|
||||
prt-get is a package management tool which provides additional
|
||||
prt\-get is a package management tool which provides additional
|
||||
functionality to the CRUX package management system. It works with the
|
||||
local ports tree and is therefore fully compatible with ports(8) and
|
||||
pkgmk(8)/pkgadd(8)/pkgrm(8). It offers the following features:
|
||||
@@ -42,16 +42,16 @@ search within the ports
|
||||
|
||||
.PP
|
||||
|
||||
What prt-get basically does is build, install/upgrade, and remove packages,
|
||||
using pkgmk, pkgadd, and pkgrm. 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
|
||||
What prt\-get basically does is build, install/upgrade, and remove packages, using
|
||||
pkgmk, pkgadd, and pkgrm. 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 lets you search for ports by name,
|
||||
prt\-get also lets you search for ports by name,
|
||||
find information about ports (without installing them of course),
|
||||
or print the dependencies of a port (as a space- or newline-separated list,
|
||||
or a formatted tree). Note that dependencies are no
|
||||
@@ -59,91 +59,109 @@ requirement for crux packages and therefore not always accurate.
|
||||
|
||||
.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 (more details in
|
||||
prt\-get has a test mode so you can see what effect an install/update
|
||||
operation would have. Use the \-\-test switch for this (more details in
|
||||
the \fBOPTIONS\fP section below).
|
||||
|
||||
.SH "RETURN VALUE"
|
||||
prt-get returns 0 on success and a non-zero value otherwise (exact
|
||||
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
|
||||
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] [\-\-nodeps] [\-\-softdeps] <package1> [<package2> ...]
|
||||
Install or update the packages given on the command line. Note that you can do
|
||||
this from any directory. Pass the --nodeps flag to prevent \fBprt\-get\fP from
|
||||
resolving dependencies and injecting any needed packages into the list of targets.
|
||||
Pass the --softdeps flag if you want the dependency resolver to also consider
|
||||
the "Optional" relationships among the packages given on the command line.
|
||||
.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] [\-\-softdeps] <package1> [<package2> ...]
|
||||
Basically a synonym for install (without the --nodeps flag).
|
||||
Install all packages given on the command line, including their dependencies.
|
||||
Note that already-installed packages will be left at their current version,
|
||||
even if out of date. prt\-get depinst behaves this way because all of its
|
||||
child pkgadd processes will \fBlack\fP the \-u flag, which is needed when
|
||||
updating an already-installed package.
|
||||
|
||||
Passing the --softdeps flag tells \fBprt-get\fP to consider also the optional
|
||||
dependencies when sorting. The --softdeps flag does NOT affect the
|
||||
calculation of the minimal set of packages needed to satisfy the
|
||||
transaction; only hard dependencies are used when constructing this set. But
|
||||
if there are any optional dependency relationships among the ports in the
|
||||
resulting set, they will be respected when prt-get determines the sequence
|
||||
in which to build.
|
||||
|
||||
.TP
|
||||
.B update [\-\-margs] [\-\-aargs] [\-\-log] [\-\-softdeps] <package1> [<package2> ...]
|
||||
Basically a synonym for install. Earlier versions of \fBprt\-get\fP did not
|
||||
adjust the \fBpkgadd(8)\fP arguments on a package-by-package basis, but
|
||||
applied "install mode" or "update mode" to the entire transaction. This
|
||||
version of \fBprt\-get\fP interprets the install command less rigidly, and tries
|
||||
to sync all affected ports with their repository versions unless instructed
|
||||
otherwise (using \fBprt\-get lock\fP, the --prefer-higher option, or the
|
||||
prt-get.aliases file).
|
||||
.B update [\-\-margs] [\-\-aargs] [\-\-log] <package1> [<package2> ...]
|
||||
Update all packages listed in this order. Note: if the latest version of a
|
||||
package has acquired dependencies that were not needed by the
|
||||
currently-installed version and are not present on the system, the update
|
||||
command will not attempt to resolve this omission. prt-get update behaves
|
||||
this way because pkgadd invocations inherit the flag -u for every package in
|
||||
the transaction, causing an error if the package is not already installed.
|
||||
You can follow the CRUX mailing list or the IRC channels to stay informed of
|
||||
the situations where an update will require manual intervention, or filter
|
||||
the output of
|
||||
.B prt\-get quickdep $(prt\-get quickdiff)
|
||||
through \fBprt\-get isinst\fP to get a list of packages suitable for an
|
||||
\fBinstall\fP or \fBupdate\fP command.
|
||||
See the \fBEXAMPLES\fP section below for details.
|
||||
|
||||
.TP
|
||||
.B remove <package1> [<package2> ...]
|
||||
Remove packages listed in this order
|
||||
|
||||
.TP
|
||||
.B sysup [\-\-softdeps] [\-\-nodeps] [\-\-prefer\-higher] [\-\-strict\-diff]
|
||||
.B sysup [\-\-softdeps] [\-\-nodeps]
|
||||
Update all installed packages which are outdated. Sorts by hard dependencies
|
||||
by default. Passing the --softdeps switch tells \fBprt\-get\fP to also consider
|
||||
optional dependencies when sorting. Passing the --nodeps switch tells prt-get
|
||||
not to sort by dependencies at all.
|
||||
|
||||
.B Note:
|
||||
If a port has acquired new dependencies since its last successful build,
|
||||
those new dependencies \fIwill\fP be injected into the transaction. An elegant
|
||||
description of this new behaviour is "prt-get no more silently assumes that
|
||||
the user didn't want a particular dependency" [1]. You can still disable the
|
||||
automatic dependency injection by passing the --nodeps switch. Other
|
||||
ways to fine-tune the selection of ports that are included in a \fBsysup\fP are the
|
||||
commands \fBlock\fP and \fBunlock\fP, the prt-get.aliases file, and the
|
||||
mutually exclusive switches --prefer-higher, --strict-diff (documented below).
|
||||
|
||||
[1] https://lists.crux.nu/pipermail/crux/2008-June/001784.html
|
||||
not to sort by dependencies at all, for approximately the same effect as
|
||||
.B prt\-get update $(prt\-get quickdiff).
|
||||
As with an \fBupdate\fP command, the child \fBpkgadd\fP processes will
|
||||
inherit the \-u flag, so if a port has acquired new dependencies since
|
||||
its last successful build, those new dependencies will be omitted from
|
||||
the transaction (unless they happen to be installed for some other reason and
|
||||
are also in need of an update). See the \fBEXAMPLES\fP section for a way to
|
||||
automate the resolution of such omissions. 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>...]
|
||||
Exclude these packages from being updated in a
|
||||
Do not update these packages in a
|
||||
.B sysup
|
||||
operation.
|
||||
operation
|
||||
|
||||
.TP
|
||||
.B unlock <package1> [<package2>...]
|
||||
Remove lock from these packages
|
||||
|
||||
.TP
|
||||
.B listlocked [\-v|\-vv]
|
||||
.B listlocked [-v|-vv]
|
||||
List names of packages which are locked. As always,
|
||||
.B \-v
|
||||
.B -v
|
||||
will additionally show the version, and
|
||||
.B \-vv
|
||||
.B -vv
|
||||
also includes the description from the Pkgfile. Note that the
|
||||
.B \-vv
|
||||
.B -vv
|
||||
switch will slow down the operation remarkably.
|
||||
|
||||
.TP
|
||||
.B diff [\-\-all] [\-\-prefer\-higher] [<package1> <package2> ...]
|
||||
Show differences between installed packages and ports in the ports
|
||||
tree. Package names passed as argument will truncate the output to
|
||||
show only those packages. It's also possible to use shell-like
|
||||
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
|
||||
@@ -151,14 +169,20 @@ 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 [\-\-prefer\-higher]
|
||||
.B quickdiff
|
||||
Print a simple list of packages which have a different version in the
|
||||
ports tree than what is installed. The output is sorted alphabetically,
|
||||
but you can generate a (larger) list sorted by dependencies using
|
||||
.B prt\-get quickdep $(prt\-get quickdiff).
|
||||
Note that the resulting list is usually a mix of installed and
|
||||
not-installed packages, so it must be filtered by
|
||||
.B prt\-get isinst
|
||||
before being passed as argument to prt\-get install or prt\-get update. See the
|
||||
.B EXAMPLES
|
||||
section below.
|
||||
|
||||
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.
|
||||
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>
|
||||
@@ -171,19 +195,20 @@ in their name
|
||||
Search the ports tree (both name and description) for the pattern
|
||||
.B expr
|
||||
(which can be a shell-like wildcard pattern or a regexp). 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 searching
|
||||
by description, consider using the cache functionality, so you only have to
|
||||
read every Pkgfile when the ports tree is updated.
|
||||
the description is not case sensitive. Note that this requires prt\-get
|
||||
to read every Pkgfile, which makes it rather slow. If you like searching by
|
||||
description, consider using the cache functionality, so you only have to
|
||||
read all the Pkgfiles after each update of the ports tree.
|
||||
|
||||
.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. Pattern can be a
|
||||
shell-like wildcard pattern (e.g. prt-get fsearch "*.h") or a regular
|
||||
expression (e.g. prt-get fsearch --regex 'liblz(o2|ma).*')
|
||||
the directories from the file names before matching.
|
||||
Pattern can be a shell-like wildcard pattern (e.g. prt-get fsearch "*.h")
|
||||
or a regular expression (e.g. prt-get fsearch --regex 'liblz(o2|ma).*')
|
||||
|
||||
|
||||
.TP
|
||||
.B info <port>
|
||||
@@ -199,22 +224,22 @@ Print the port's README file if it exists; if set, uses $PAGER
|
||||
|
||||
.TP
|
||||
.B depends [\-\-softdeps] <package1> [<package2> ...]
|
||||
Print a recursive list of dependencies needed to install the packages passed
|
||||
as argument. It shows a list of the dependencies that were found in the
|
||||
ports tree, plus a list of the dependencies that could not be found. Pass
|
||||
the --softdeps flag if you want the sorting algorithm to consider
|
||||
Print a recursive list of dependencies needed to install the packages
|
||||
passed as argument. It shows a list of the dependencies that were found in
|
||||
the ports tree, plus a list of the dependencies that could not be found.
|
||||
Pass the --softdeps flag if you want the sorting algorithm to consider
|
||||
optional dependencies too.
|
||||
|
||||
.TP
|
||||
.B quickdep [\-\-softdeps] <package1> [<package2> ...]
|
||||
Same output as \fBdepends\fP, but separated by spaces rather than newlines, and
|
||||
stripped of any dependencies that could not be found in the ports tree.
|
||||
Useful in case the list of dependencies is too large to fit on one screen, or
|
||||
if you don't want to filter out manually the ports that are invalid targets for
|
||||
installation. For example, instead of
|
||||
Same output as \fBdepends\fP, but separated by spaces rather than newlines,
|
||||
and stripped of any dependencies that could not be found in the ports tree.
|
||||
Useful in case the list of dependencies is too large to fit on one screen,
|
||||
or if you don't want to filter out manually the ports that are invalid
|
||||
targets for installation. For example, instead of
|
||||
.B prt\-get depinst xorg-server
|
||||
you might micromanage the process as follows:
|
||||
.B for i in $(prt\-get quickdep xorg-server); do prt\-get install \-fr \-\-nodeps $i; done
|
||||
.B for i in $(prt\-get quickdep xorg-server); do if prt\-get isinst $i 2>/dev/null; then prt\-get update \-fr $i; else prt\-get install $i; fi; done
|
||||
which ensures that the latest version of each dependency is built.
|
||||
|
||||
Note: It might be useful to run
|
||||
@@ -226,29 +251,30 @@ for successful builds.
|
||||
.B deptree [\-\-softdeps] <package>
|
||||
Print a tree of the dependencies of the package
|
||||
.B <package>.
|
||||
Pass the --softdeps flag to also show the installed packages that might have been
|
||||
eagerly linked when
|
||||
Pass the --softdeps flag to also show the installed packages that might
|
||||
have been eagerly linked, if they were present when
|
||||
.B <package>
|
||||
or its dependencies were compiled.
|
||||
(or its dependencies) were built.
|
||||
Subtrees already shown are marked with '-->' to save some space. In
|
||||
order to show them all, add the --all switch.
|
||||
|
||||
.SH ""
|
||||
|
||||
.TP
|
||||
.B dependent [\-\-recursive] [\-\-softdeps] [\-\-all] <package>
|
||||
.B dependent [\-\-recursive] [\-\-softdeps] [\-\-all] [\-\-tree] <package>
|
||||
Print a list of ports whose "Depends on:" line contains
|
||||
.B <package>
|
||||
(or its dependents, if --recursive is passed). Use the --softdeps flag to also
|
||||
search the "Optional:" lines for \fB<package>\fP .
|
||||
(or its dependents, if --recursive was passed). Use the --softdeps flag to
|
||||
also search the "Optional:" lines for \fB<package>\fP.
|
||||
|
||||
By default, output is restricted to ports that are installed. To see all the
|
||||
dependencies, add the --all switch. Use --tree to get a nicely indented list.
|
||||
By default, output is restricted to ports that are installed. To see all
|
||||
the dependencies, use the --all switch. Use --tree to get a nicely indented
|
||||
list.
|
||||
|
||||
.TP
|
||||
.B dup [\-v] [format]
|
||||
.B dup [-v] [format]
|
||||
List ports which can be found in multiple directories configured in
|
||||
\fB/etc/prt\-get.conf\fP.
|
||||
.B /etc/prt-get.conf
|
||||
Use the \fB\-v\fP switch to see a verbose report, which will show for each
|
||||
dup the port that takes precedence, and the port that is hidden (including
|
||||
full path and version info). The verbose switch is basically an alias for a
|
||||
@@ -265,19 +291,19 @@ symbols will be replaced as follows.
|
||||
|
||||
.TP
|
||||
\ \ \ \(bu
|
||||
%p1 -> full path (including name) to port taking precedence
|
||||
%p1 -> Full path (including name) to port taking precedence
|
||||
|
||||
.TP
|
||||
\ \ \ \(bu
|
||||
%p2 -> full path (including name) to port being hidden
|
||||
%p2 -> Full path (including name) to port being hidden
|
||||
|
||||
.TP
|
||||
\ \ \ \(bu
|
||||
%v1 -> version of port taking precedence
|
||||
%v1 -> Version of port taking precedence
|
||||
|
||||
.TP
|
||||
\ \ \ \(bu
|
||||
%v2 -> version of port being hidden
|
||||
%v2 -> Version of port being hidden
|
||||
|
||||
.TP
|
||||
\ \ \ \(bu
|
||||
@@ -307,7 +333,7 @@ for the list command. Make sure you escape where needed
|
||||
|
||||
.TP
|
||||
.B printf <format string1> [\-\-sort=<format string2>] [\-\-filter=<filter>]
|
||||
Print formatted port list. Format string can contain variables, which
|
||||
Print formatted port list format string can contain variables, which
|
||||
are replaced like this:
|
||||
.TP
|
||||
\ \ \ \(bu
|
||||
@@ -343,11 +369,11 @@ are replaced like this:
|
||||
|
||||
.TP
|
||||
\ \ \ \(bu
|
||||
%M -> maintainer
|
||||
%M -> Maintainer
|
||||
|
||||
.TP
|
||||
\ \ \ \(bu
|
||||
%R -> readme ("yes"/"no")
|
||||
%R -> Readme ("yes"/"no")
|
||||
|
||||
.TP
|
||||
\ \ \ \(bu
|
||||
@@ -367,8 +393,8 @@ are replaced like this:
|
||||
up to date and "diff" if it's installed and a new version is in the
|
||||
ports tree.
|
||||
|
||||
Use "\en" and "\et" to format your output (no additional format codes
|
||||
supported). The optional format string2 can contain the same variables
|
||||
Use "\\n" and "\\t" to format your output (no additional format symbols
|
||||
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.
|
||||
@@ -399,8 +425,8 @@ Output appears alphabetically separated by newlines, making it suitable for
|
||||
process substitution as shown in the
|
||||
.B EXAMPLES
|
||||
section below. Note that some core ports might be runtime
|
||||
dependencies despite their absence in the "Depends on:" line;
|
||||
see \fBPkgfile(5)\fP for an explanation of this practice.
|
||||
dependencies despite their absence in the "Depends on:" line; see \fBPkgfile(5)\fP
|
||||
for an explanation of this practice.
|
||||
|
||||
.TP
|
||||
.B isinst <package1> [<package2> ...]
|
||||
@@ -413,24 +439,28 @@ but does not print the version information. This command has a return value of
|
||||
greater than 0.
|
||||
|
||||
.TP
|
||||
.B current <package1> [<package2> ...]
|
||||
Shows the currently-installed version of <package>, or a message
|
||||
that <package> is not installed.
|
||||
.B current <package>
|
||||
Show the currently-installed version of <package>, or a message
|
||||
that <package> is not installed. Unlike
|
||||
.B prt\-get isinst package1 package2,
|
||||
this command does \fBnot\fP accept more than one package as argument. Use
|
||||
.B pkginfo \-i| grep \-E '^(package1|package2|...)'
|
||||
to work around this limitation.
|
||||
|
||||
.TP
|
||||
.B ls [\-\-path] <package>
|
||||
Print out a listing of the port's directory
|
||||
List the contents of the port's directory
|
||||
|
||||
.TP
|
||||
.B cat <package> [<file>]
|
||||
Print to stdout (or $PAGER, if set) the contents of <file> in the port's
|
||||
directory. If <file> is not specified, 'Pkgfile' is used.
|
||||
Print the file to stdout. If <file> is not specified, 'Pkgfile' is used. If set, uses $PAGER.
|
||||
|
||||
.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
|
||||
Show a help screen
|
||||
@@ -465,6 +495,14 @@ Force install; Implies 'pkgadd -f'; same as --aargs=-f
|
||||
.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 \-us
|
||||
Update signature, implies 'pkgmk -us'; same as --margs=-us
|
||||
@@ -507,15 +545,10 @@ future uses and consistency reasons
|
||||
.B \-\-ignore=<package1,package2,...>
|
||||
Don't install these packages, even if they're listed as dependencies
|
||||
|
||||
.TP
|
||||
.B \-\-nodeps
|
||||
Leave the list of requested packages as-is, without sorting by dependencies
|
||||
or injecting missing dependencies.
|
||||
|
||||
.TP
|
||||
.B \-\-softdeps
|
||||
Consider optional dependencies when determining the order in which to build
|
||||
the packages passed as arguments (in \fBinstall\fP or \fBsysup\fP operations).
|
||||
the packages passed as arguments (in a \fBdepinst\fP or \fBsysup\fP operation).
|
||||
Also affects the output of \fBdeptree\fP, \fBdependent\fP, and \fBlistorphans\fP.
|
||||
|
||||
.TP
|
||||
@@ -524,20 +557,20 @@ Use cache file for this command
|
||||
|
||||
.TP
|
||||
.B \-\-test
|
||||
Dry run, don't actually install anything. Mostly interesting for
|
||||
Dry run, don't actually install anything, mostly interesting for
|
||||
.B prt\-get install, prt\-get update, prt\-get sysup
|
||||
|
||||
.TP
|
||||
.B \-\-pre\-install
|
||||
.B \-\-pre-install
|
||||
Execute pre-install script if it's there
|
||||
|
||||
.TP
|
||||
.B \-\-post\-install
|
||||
.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.
|
||||
.B \-\-install-scripts
|
||||
Execute pre-install and post-install script if they're there
|
||||
|
||||
The options --pre-install, --post-install, and --install-scripts offer a
|
||||
convenient way to temporarily override the prt-get.conf directive 'runscripts
|
||||
@@ -548,17 +581,18 @@ no\(dq, or point prt-get to an alternative configuration file using
|
||||
--config=<file>. (see below for the documentation of these options)
|
||||
|
||||
.TP
|
||||
.B \-\-install\-root=<dir>
|
||||
.B \-\-install-root=<dir>
|
||||
Use <dir> as root directory for your installation; allows you to install
|
||||
the requested packages onto a different directory than '/'. In daily usage,
|
||||
this option is not required; it's primarily interesting if you're developing
|
||||
an independent installation.
|
||||
|
||||
Pre- and post-install scripts will not be executed if the requested
|
||||
root directory lacks a copy of the ports tree. So if you're maintaining an
|
||||
installation mounted somewhere different than '/', it's not enough to put
|
||||
the line 'runscripts yes' in your prt-get.conf; you also have to ensure that the
|
||||
pre- and post-install scripts can be found in the same location relative to <dir>.
|
||||
Pre- and post-install scripts will not be executed if the target root directory
|
||||
lacks a copy of the ports tree. So if you're maintaining an installation on a
|
||||
volume mounted somewhere other than '/', it's not enough to have the
|
||||
line 'runscripts yes' in your prt-get.conf; you also have to ensure that
|
||||
the pre- and post-install scripts can be found in the same location
|
||||
relative to <dir>.
|
||||
|
||||
The setting for --install-root determines which package database is used for
|
||||
reading/writing (so <dir>/var/lib/pkg/db must exist), and where the pkg.tar.?z
|
||||
@@ -577,15 +611,15 @@ unpacks it into <dir>.
|
||||
When setting --install-root=<dir>, install or update commands might behave
|
||||
unexpectedly if <dir>/etc/pkgadd.conf exists and is different from
|
||||
/etc/pkgadd.conf . In order to preserve the \fBpkgadd.conf(5)\fP settings from
|
||||
host system, append the option --aargs='-c /etc/pkgadd.conf' to your \fBprt\-get
|
||||
install\fP command, or just copy the desired directives into
|
||||
the host system, append the option --aargs='-c /etc/pkgadd.conf' to your
|
||||
\fBprt-get install\fP command, or just copy the desired directives into
|
||||
<dir>/etc/pkgadd.conf .
|
||||
|
||||
.TP
|
||||
.B \-\-log
|
||||
Write build output to log file. Basically a convenient alias for
|
||||
\fB\-\-config\-set=\(dqwritelog enabled\(dq\fP. Note that there is no similar
|
||||
alias allowing you to temporarily override the configuration directive
|
||||
alias allowing you to temporarily override the one configuration directive
|
||||
\(dqwritelog enabled\(dq; you have to resort to \fB\-\-config\-set=\(dqwritelog
|
||||
disabled\(dq\fP if that is your intention.
|
||||
|
||||
@@ -617,9 +651,8 @@ transactions as well.
|
||||
|
||||
.TP
|
||||
.B \-v, \-vv
|
||||
(verbosity level) Show version of a port (-v), or show both version
|
||||
and description (-vv). Passing more than one of these options is equivalent
|
||||
to -vv.
|
||||
(verbosity level) Show version of a port (\-v), or show both version
|
||||
and description (\-vv). Passing more than one of these options is equivalent to \-vv.
|
||||
|
||||
.TP
|
||||
.B \-\-path
|
||||
@@ -644,49 +677,29 @@ Override the 'preferhigher' configuration option. Equivalent to
|
||||
|
||||
.SH "CONFIGURATION"
|
||||
.TP
|
||||
See man prt-get.conf(5)
|
||||
See man prt\-get.conf(5)
|
||||
|
||||
.SH "EXAMPLES"
|
||||
.TP
|
||||
.B prt\-get install irssi
|
||||
Download, build and install irssi (and any of its missing dependencies), with
|
||||
one simple command
|
||||
Download, build and install irssi, with one simple command
|
||||
|
||||
.TP
|
||||
.B prt\-get install --nodeps jasper
|
||||
Install jasper, without trying to resolve dependencies.
|
||||
|
||||
.TP
|
||||
.B prt\-get update --softdeps webkitgtk
|
||||
Get the latest version of webkitgtk, rebuilding any of its outdated dependencies
|
||||
(hard and soft) in the optimal order.
|
||||
.B prt\-get install paper yasm
|
||||
Install paper and yasm. Abort with an informative error message if either
|
||||
package is already installed, allowing you to issue a revised command.
|
||||
|
||||
.TP
|
||||
.B prt\-get update -fr openssh
|
||||
Update your current version of openssh, forcing a rebuild even if no version
|
||||
difference is detected.
|
||||
Useful if there was a major soversion change in one of its dependencies,
|
||||
and \fBrevdep openssh\fP indicates a broken package. :-)
|
||||
.B prt\-get update \-fr openssh
|
||||
Update your current version of openssh, forcing a rebuild even if no version difference is detected.
|
||||
Useful if there was a major version change in one of its dependencies, and \fBrevdep openssh\fP
|
||||
indicates a broken package. :\-)
|
||||
|
||||
.TP
|
||||
.B MISSLIBS=$(revdep \-vvv mpv | awk \-v FS=: '/(missing library)/ {print $3}'); [ \-n \(dq${MISSLIBS[@]}\(dq ] && for i in ${MISSLIBS[@]}; do prt\-get fsearch $i; done
|
||||
(adapted from a script by ppetrov^) Check for the presence of the runtime libraries needed by mpv.
|
||||
If any are absent, search the footprints to determine which ports provide the missing libraries.
|
||||
|
||||
.TP
|
||||
.B prt\-get isinst $(ls /usr/pkgmk/packages/*.tar.gz | sed 's/.*\e///; s/#.*//;') | awk '/not installed/ { print $2 }'
|
||||
Determine whether there are any packages (in a shared output directory) that
|
||||
have since been uninstalled, or were never installed after a successful run
|
||||
of \fBpkgmk\fP.
|
||||
|
||||
.TP
|
||||
.B prt\-get printf '%i:%p:%n\en' | awk \-v FS=: '/^diff:\e/usr\e/ports\e/core/ { print $3 }' | xargs prt\-get update
|
||||
Basically a \fBsysup\fP operation, but restricted to the core collection.
|
||||
Because core ports are often omitted from the dependency line if they aren't
|
||||
dynamically linked in, the \fBsysup\fP sorting algorithm might not put them
|
||||
at the front of the queue. Run this command before a regular \fBsysup\fP in
|
||||
order to ensure that core ports are updated first.
|
||||
|
||||
.TP
|
||||
.B prt\-get isinst $(prt\-get info ffmpeg | awk \-v FS=: '/^Optional/ {gsub(/,/,\(dq \(dq,$2); print $2}') | awk \-v FS=\(dq \(dq '/not installed/ {print $2}'
|
||||
Show all the optional dependencies of ffmpeg that are not currently installed.
|
||||
@@ -700,17 +713,16 @@ spend any resources on ffmpeg until all of its optional dependencies are in
|
||||
place.
|
||||
|
||||
.TP
|
||||
.B prt\-get isinst $(if grep \-qE '^ffmpeg:' /etc/prt\-get.softdeps 2>/dev/null; then grep \-E '^ffmpeg:' /etc/prt\-get.softdeps | cut \-d: \-f2 | tr ',' ' '; else prt-get info ffmpeg | awk \-v FS=: '/^Optional/ {gsub(/,/,\(dq \(dq,$2); print $2}'; fi) | awk \-v FS=\(dq \(dq '/not installed/ {print $2}' | xargs prt\-get depinst \-\-group \-\-softdeps ffmpeg
|
||||
.B prt\-get isinst $(if grep \-qE '^ffmpeg:' /etc/prt\-get.softdeps 2>/dev/null; then grep \-E '^ffmpeg:' /etc/prt\-get.softdeps | cut \-d: \-f2 | tr ',' ' '; else prt\-get info ffmpeg | awk \-v FS=: '/^Optional/ {gsub(/,/,\(dq \(dq,$2); print $2}'; fi) | awk \-v FS=\(dq \(dq '/not installed/ {print $2}' | xargs prt\-get depinst \-\-group \-\-softdeps ffmpeg
|
||||
Extension of the above (addressing a use case envisioned by ivandi). The
|
||||
user can create the file /etc/prt-get.softdeps containing a line like
|
||||
.B ffmpeg: x264 x265
|
||||
and then the above command will perform a depinst --group operation to
|
||||
ensure that at least x264 and x265 (but not necessarily any of the other
|
||||
optional dependencies) are present before trying to build ffmpeg. In the
|
||||
absence of such a .softdeps config, the operation reverts to the behaviour
|
||||
of the preceding example (maximal feature set). Implementing Gentoo USE
|
||||
flags with such an awkward one-liner might draw criticism from advocates of
|
||||
the KISS principle.
|
||||
and then the above command will perform a depinst --group operation to ensure that
|
||||
at least x264 and x265 (but not necessarily any of the other optional
|
||||
dependencies) are present before trying to build ffmpeg. In the absence of such
|
||||
a .softdeps config, the operation reverts to the behaviour of the preceding
|
||||
example (maximal feature set). Implementing Gentoo USE flags with such an
|
||||
awkward one-liner might draw criticism from advocates of the KISS principle.
|
||||
|
||||
.TP
|
||||
.B prt\-get search \-\-regex '^(m|n|p)c.*'
|
||||
@@ -721,29 +733,32 @@ Return a list of all ports whose names start with "mc", "nc", or "pc"
|
||||
Return a list of all ports having "irc" in their name or description
|
||||
|
||||
.TP
|
||||
.B comm -13 <(ls /usr/ports/core) <(prt-get listorphans)
|
||||
.B prt\-get fsearch \-\-full \(dq/usr/etc/*\(dq | awk '/^Found in/ { $0=gensub(/Found in .*\e/(.+):/,\(dq\e\e1\(dq,\(dqg\(dq); print;}'
|
||||
Return a list of all ports that store their configs in /usr/etc. Omit the
|
||||
pipe to awk if you also want a detailed list of the files that matched.
|
||||
|
||||
.TP
|
||||
.B comm \-13 <(ls /usr/ports/core) <(prt\-get listorphans)
|
||||
(based on comments from Romster and jue) Filter out the core ports from the list of orphans, in
|
||||
shells (like bash) that support process substitution
|
||||
|
||||
.TP
|
||||
.B comm -13 <(cat ~/.keepers <(ls /usr/ports/core) | sort) <(prt\-get listorphans) | xargs prt\-get remove
|
||||
.B comm \-13 <(cat ~/.keepers <(ls /usr/ports/core) | sort) <(prt\-get listorphans) | xargs prt\-get remove
|
||||
(system-hosing extension of the above) A one-liner inspired by \fBpkg\-clean\fP
|
||||
and \fBpkgfoster\fP, but without the safeguard of interactivity.
|
||||
\fBDo not try this on a mission-critical system.\fP
|
||||
and \fBpkgfoster\fP, but without the safeguard of interactivity. \fBDo not try this on a
|
||||
mission-critical system.\fP
|
||||
|
||||
.TP
|
||||
.B prt\-get isinst $(prt\-get quickdep $(prt\-get quickdiff)) | awk '/not installed/ {print $2}'
|
||||
(adapted from a comment by Fun) After updating your ports tree, print out a
|
||||
list of dependencies that were not needed the last time you built your
|
||||
currently-installed ports, but are needed now by the newer versions of
|
||||
these ports. The output of this command is sorted by dependencies, therefore
|
||||
(adapted from a comment by Fun) After updating your ports tree, print out a list of dependencies
|
||||
that were not needed the last time you built your currently-installed ports, but are needed now by
|
||||
the newer versions of these ports. The output of this command is sorted by dependencies, therefore
|
||||
suitable for piping to \fBxargs prt\-get install\fP.
|
||||
|
||||
.TP
|
||||
.B comm \-13 <(prt\-get depends firefox\-bin |tail \-n +2 |sort) <(prt\-get depends firefox |tail \-n +2 |sort)
|
||||
Find the build-time dependencies of firefox. Runtime dependencies would
|
||||
also appear in the list generated by the first process substitution, and
|
||||
\fBcomm \-13\fP will suppress what the two lists have in common.
|
||||
.TP
|
||||
.B prt\-get isinst $(prt\-get quickdep $(prt\-get quickdiff)) | awk '/is installed/ {print $2}'
|
||||
Same as above, but only print the dependencies that are already installed. The output of this
|
||||
command is suitable for piping to \fBxargs prt\-get update\fP.
|
||||
|
||||
.TP
|
||||
.B prt\-get isinst $(prt\-get quickdep i3) | awk '/not installed/ { print $2 }' | xargs prt\-get depinst \-\-softdeps \-\-test
|
||||
@@ -754,20 +769,16 @@ awk filter in the middle is needed to prevent the command from failing with the
|
||||
error message "already installed".
|
||||
|
||||
.TP
|
||||
.B prt\-get printf \(dq%p\et%u\en\(dq | grep myrepo | cut \-f 2
|
||||
Print the upstream URL for each port in the collection \(dqmyrepo\(dq,
|
||||
perhaps as the first step in keeping your personal overlay up to date.
|
||||
.B comm \-3 <(prt\-get printf \(dq%i:%n %v\-%r\en\(dq | grep \-v ^no | cut \-d: \-f2 | sort) <(pkginfo \-i | sort)
|
||||
(inspired by a bug report from teodor) an alternative to \fBprt\-get diff\fP.
|
||||
In the output, left-justified lines show the version available in the
|
||||
repositories, while indented lines show the version installed. On a
|
||||
reasonably up-to-date system, the two processes in the above command will
|
||||
return many identical lines; these are suppressed by the -3 flag to
|
||||
\fBcomm(1)\fP.
|
||||
|
||||
.TP
|
||||
.B for u in $(prt\-get printf \(dq%M:%p/%n\en\(dq | grep \-i ^unmaintained | cut \-d: \-f2); do cd ${u%/*}; printf \(dq||%s ||\(dq ${u##*/}; git log ${u##*/} | head \-n 5 | awk '/^Date/ { $0=gensub(/^Date:\es+/,"","g"); printf(\(dq %s ||\en\(dq,$0); }'; cd \- >/dev/null; done
|
||||
Generate a table of unmaintained ports and the dates of their most recent
|
||||
commit, in PmWiki syntax (left-justified port names, centered dates).
|
||||
Requires that your repositories are synchronized using the \fBgit(1)\fP driver.
|
||||
Subsequent sorting by date may be done using \fBsort(1)\fP with the flags
|
||||
-k, -M, and -n (the appropriate key defs will depend on your locale).
|
||||
|
||||
.TP
|
||||
.B for L in /var/log/pkgbuild/*.log; do P=${L%__*}; P=${P##*/}; VR=${L##*__}; VR=${VR%.log}; if ! prt\-get isinst $P >/dev/null; then mv $L /var/log/uninstalled/; elif [ \(dq$(prt\-get current $P)\(dq != \(dq$VR\(dq ]; then mv $L /var/log/oldbuild/; fi; done
|
||||
.B for L in /var/log/pkgbuild/*.log; do P=${L%__*}; P=${P##*/}; VR=${L##*__}; VR=${VR%.log}; if ! prt\-get isinst $P >/dev/null; then mv $L /var/log/uninstalled; elif [ \(dq$(prt\-get current $P)\(dq != \(dq$VR\(dq ]; then mv $L /var/log/oldbuild/; fi; done
|
||||
(based on a feature request by samsep10l) a command you can put into a script
|
||||
called by root's crontab, in order to mimic Slackware's tidy directory listings
|
||||
(the main logdir only contains build logs of the latest installed packages;
|
||||
@@ -776,21 +787,34 @@ on declaring \(dqlogfile /var/log/pkgbuild/%n__%v-%r.log\(dq and \(dqwritelog
|
||||
enabled\(dq in \fBprt\-get.conf(5)\fP. Logs saved with a different filename
|
||||
pattern will require slight adjustments to the command.
|
||||
|
||||
.TP
|
||||
.B prt\-get printf \(dq%p\et%u\en\(dq | awk '($1 ~ /\e/myrepo$/) { print $2 }'
|
||||
Print the upstream URL for each port in the collection \(dqmyrepo\(dq, perhaps
|
||||
as the first step in keeping your personal overlay up to date.
|
||||
|
||||
.TP
|
||||
.B prt\-get printf \(dq%M\et%n\en\(dq | grep \-c ^Tim
|
||||
Count how many ports our most-overworked core team member claims responsibility for.
|
||||
|
||||
.TP
|
||||
.B comm \-13 <(prt\-get depends firefox\-bin |tail \-n +2 |sort) <(prt\-get depends firefox |tail \-n +2 |sort)
|
||||
Find the build-time dependencies of firefox. Runtime dependencies would also appear in the list generated by
|
||||
the first process substitution, and \fBcomm -13\fP will suppress what the two lists have in common.
|
||||
|
||||
.TP
|
||||
.B prt\-get listinst \-\-depsort | xargs prt\-get install \-\-install\-root=/mnt
|
||||
Sort the list of installed packages by dependencies, and then install all
|
||||
those packages onto a backup filesystem (mounted at /mnt). If you have a
|
||||
customized pkgadd.conf that you want applied to this operation, either copy
|
||||
it to /mnt/etc where pkgadd will be looking for it, or pass the additional
|
||||
option \-\-aargs=\(dq\-c /etc/pkgadd.conf\(dq to the install command.
|
||||
those packages onto a backup filesystem (mounted at /mnt). If you have a customized
|
||||
pkgadd.conf that you want applied to this operation, either copy it to
|
||||
/mnt/etc where pkgadd will be looking for it, or pass the additional option \-\-aargs=\(dq\-c
|
||||
/etc/pkgadd.conf\(dq to the install command.
|
||||
|
||||
.TP
|
||||
.B prt\-get list \-\-path \-\-regex '^xorg.*' | grep \-v \(dq/usr/ports/xorg\(dq
|
||||
Show the ports whose names begin with xorg, but which appear outside the
|
||||
xorg port collection.
|
||||
Show the ports whose names begin with xorg, but which appear outside the xorg port collection.
|
||||
(At the time of writing, this command returned at least two font ports.)
|
||||
|
||||
.SH "AUTHORS"
|
||||
Johannes Winkelmann <jw@tks6.net>, and others cited inline
|
||||
.SH "SEE ALSO"
|
||||
prt-get.conf(5), prt-cache(8), Pkgfile(5), pkgmk(8), pkgadd(8), ports(8)
|
||||
prt\-get.conf(5), prt\-cache(8), Pkgfile(5), pkgmk(8), pkgadd(8), ports(8)
|
||||
|
||||
@@ -128,33 +128,32 @@ replaced with the port's path, e.g. for port gcc in core, %p would be
|
||||
and %n would be
|
||||
.B gcc.
|
||||
This allows you to have separate log files per port.
|
||||
Separate log files for each version and release can be achieved using
|
||||
the placeholders %v and %r, respectively. But if you want to enable
|
||||
\fBrmlog_on_uninst\fP, it is best to avoid %p, %v, and %r when
|
||||
specifying \fBlogfile\fP (as explained below).
|
||||
Separate log files for each version and release can be achieved
|
||||
using the placeholders %v and %r, respectively. But if you want to enable
|
||||
\fBrmlog_on_uninst\fP, it is best to avoid %p, %v, and %r when specifying
|
||||
\fBlogfile\fP (as explained below).
|
||||
|
||||
.B rmlog_on_uninst
|
||||
can be set to 'yes' or 'no'; when set to yes, uninstalling a package
|
||||
will also try to delete its build log. Replacements in the template
|
||||
\fBlogfile\fP will be made using the \fIcurrent values\fP from the
|
||||
database of installed packages, and from the active repositories. If
|
||||
log files exist with different values of %p, %v, or %r than what the
|
||||
database and repositories provide, then the pattern substitutions will
|
||||
fail to match the names of those logs, and this feature will be a no-op.
|
||||
For example, suppose you specify the logfile pattern
|
||||
\(dq%p/.buildlogs/%n__%v-%r.log\(dq, and you have a package installed
|
||||
on your system through many versions, or after it has been moved from
|
||||
opt to contrib. Uninstalling that package would leave behind all the
|
||||
build logs except the latest. This pattern is also fragile with respect
|
||||
to repository purges; if one of your installed ports is dropped from
|
||||
the official repos, then either \(dq%p\(dq will expand to the path of
|
||||
your personal overlay (you did make a copy, right?), or it will not
|
||||
expand at all! See the EXAMPLES section of \fBprt\-get(8)\fP for
|
||||
alternative ways to tidy up your directory of build logs.
|
||||
which can be set to 'yes' or 'no'; when set to yes, uninstalling a
|
||||
package will also try to delete its build log. Replacements in the template
|
||||
\fBlogfile\fP will be made using the \fIcurrent values\fP from the database
|
||||
of installed packages, and from the active repositories. If log files exist
|
||||
with different values of %p, %v, or %r than what the database and repositories
|
||||
provide, then the pattern substitutions will fail to match the names of those
|
||||
logs, and this feature will be a no-op. For example, suppose you specify the
|
||||
logfile pattern \(dq%p/.buildlogs/%n-%v-%r.log\(dq, and you have a package
|
||||
installed on your system through many versions, or after it has been
|
||||
moved from opt to contrib. Uninstalling that package would leave behind all the
|
||||
build logs except the latest. This pattern is also fragile with respect to
|
||||
repository purges; if one of your installed ports is dropped from the official
|
||||
repos, then either \(dq%p\(dq will expand to the path of your personal overlay
|
||||
(you did make a copy, right?), or it will not expand at all! See the EXAMPLES
|
||||
section of \fBprt\-get(8)\fP for an alternative way to tidy up your directory
|
||||
of build logs.
|
||||
|
||||
.B readme
|
||||
can be set to 'disabled', to suppress the notification after installing
|
||||
a port with a README file; 'compact', to collect all the READMEs
|
||||
can be set to 'disabled', to suppress the notification after
|
||||
installing a port with a README file; 'compact', to collect all the READMEs
|
||||
into one post-transaction output; or 'verbose', to print separate
|
||||
information about each port with a README file. See
|
||||
.B prt\-get(8)
|
||||
|
||||
@@ -17,10 +17,11 @@ prtdir /usr/ports/opt
|
||||
### log options:
|
||||
# writelog enabled # (enabled|disabled)
|
||||
# logmode overwrite # (append|overwrite)
|
||||
# rm_on_success no # (yes|no)
|
||||
# rmlog_on_success no # (yes|no)
|
||||
# rmlog_on_uninst no # (yes|no)
|
||||
logfile /var/log/pkgbuild/%n.log
|
||||
# path, %p=path to port dir, %n=port name
|
||||
# %v=version, %r=release
|
||||
# %n=port name, %v=version, %r=release
|
||||
# %p=path to repository
|
||||
|
||||
### print README information:
|
||||
# readme verbose # (verbose|compact|disabled)
|
||||
|
||||
@@ -27,28 +27,26 @@ ArgParser::ArgParser( int argc, char** argv )
|
||||
m_hasFilter( false ),
|
||||
m_noStdConfig( false ),
|
||||
m_writeLog( false ),
|
||||
m_depSort( true ),
|
||||
m_nodeps( false ),
|
||||
m_softdeps( false ),
|
||||
m_revdep(false),
|
||||
m_all( false ),
|
||||
m_printPath( false ),
|
||||
m_execPreInstall( false ),
|
||||
m_execPostInstall( false ),
|
||||
m_preferHigher( false ),
|
||||
m_strictDiff( false ),
|
||||
m_sysup( false ),
|
||||
m_group( false ),
|
||||
m_useRegex(false),
|
||||
m_fullPath(false),
|
||||
m_quick(false),
|
||||
m_recursive(false),
|
||||
m_printTree(false),
|
||||
m_depSort(false),
|
||||
m_alternateConfigFile( "" ),
|
||||
m_pkgmkArgs( "" ),
|
||||
m_pkgaddArgs( "" ),
|
||||
m_pkgrmArgs( "" ),
|
||||
m_filter( "" ),
|
||||
m_sortArgs( "" ),
|
||||
m_filter( "" ),
|
||||
m_commandName( "" ),
|
||||
m_unknownOption( "" ),
|
||||
m_installRoot( "" ),
|
||||
@@ -82,7 +80,7 @@ bool ArgParser::isCommandGiven() const
|
||||
/*!
|
||||
\return a list of arguments not processed by ArgParser
|
||||
*/
|
||||
const list<string>& ArgParser::otherArgs() const
|
||||
const list<char*>& ArgParser::otherArgs() const
|
||||
{
|
||||
return m_otherArgs;
|
||||
}
|
||||
@@ -105,6 +103,7 @@ const string& ArgParser::pkgmkArgs() const
|
||||
return m_pkgmkArgs;
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
\return addtional arguments to pkgadd
|
||||
*/
|
||||
@@ -113,6 +112,7 @@ const string& ArgParser::pkgaddArgs() const
|
||||
return m_pkgaddArgs;
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
\return the name of the alternative configuration file
|
||||
*/
|
||||
@@ -121,34 +121,36 @@ const string& ArgParser::alternateConfigFile() const
|
||||
return m_alternateConfigFile;
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
parse the arguments
|
||||
\return true on success
|
||||
*/
|
||||
bool ArgParser::parse() {
|
||||
const int commandCount = 28;
|
||||
string commands[commandCount] = { "help", "info", "version",
|
||||
"search", "dsearch", "fsearch",
|
||||
"cache", "install", "remove",
|
||||
"current", "isinst", "diff",
|
||||
"path", "printf", "readme",
|
||||
"list", "listinst", "listorphans",
|
||||
"lock", "unlock", "listlocked",
|
||||
"cat", "ls", "edit", "dumpconfig",
|
||||
"dup", "depends", "deptree"
|
||||
};
|
||||
|
||||
Type commandID[commandCount] = { HELP, INFO, SHOW_VERSION,
|
||||
SEARCH, DSEARCH, FSEARCH,
|
||||
CREATE_CACHE, INSTALL, REMOVE,
|
||||
CURRENT, ISINST, DIFF,
|
||||
PATH, PRINTF, README,
|
||||
LIST, LISTINST, LISTORPHANS,
|
||||
LOCK, UNLOCK, LISTLOCKED,
|
||||
CAT, LS, EDIT, DUMPCONFIG,
|
||||
DUP, DEPENDS, DEPTREE
|
||||
};
|
||||
bool ArgParser::parse()
|
||||
{
|
||||
const int commandCount = 34;
|
||||
string commands[commandCount] = { "list", "search", "dsearch",
|
||||
"info", "version", "cache",
|
||||
"depends", "install", "depinst",
|
||||
"help", "isinst", "dup", "update",
|
||||
"quickdep", "diff", "quickdiff",
|
||||
"path", "listinst", "printf", "readme",
|
||||
"dependent", "sysup", "current",
|
||||
"fsearch", "lock", "unlock",
|
||||
"listlocked", "cat", "ls", "edit",
|
||||
"remove", "deptree", "dumpconfig",
|
||||
"listorphans" };
|
||||
|
||||
Type commandID[commandCount] = { LIST, SEARCH, DSEARCH, INFO,
|
||||
SHOW_VERSION, CREATE_CACHE,
|
||||
DEPENDS, INSTALL, DEPINST,
|
||||
HELP, ISINST, DUP, UPDATE,
|
||||
QUICKDEP, DIFF, QUICKDIFF,
|
||||
PATH, LISTINST, PRINTF, README,
|
||||
DEPENDENT, SYSUP, CURRENT,
|
||||
FSEARCH, LOCK, UNLOCK, LISTLOCKED,
|
||||
CAT, LS, EDIT, REMOVE, DEPTREE,
|
||||
DUMPCONFIG, LISTORPHANS };
|
||||
if ( m_argc < 2 ) {
|
||||
return false;
|
||||
}
|
||||
@@ -168,42 +170,71 @@ bool ArgParser::parse() {
|
||||
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 == "--test" ) { m_isTest = true;
|
||||
} else if ( s == "--cache" ) { m_useCache = true;
|
||||
} else if ( s == "--depsort" ) { m_depSort = true;
|
||||
} else if ( s == "--nodeps" ) { m_depSort = false;
|
||||
} else if ( s == "--softdeps" ) { m_softdeps = 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;
|
||||
if ( s == "-v" ) {
|
||||
m_verbose += 1;
|
||||
} else if ( s == "-vv" ) {
|
||||
m_verbose += 2;
|
||||
} else if ( s == "--test" ) {
|
||||
m_isTest = true;
|
||||
} else if ( s == "--cache" ) {
|
||||
m_useCache = true;
|
||||
} else if ( s == "--nodeps" ) {
|
||||
m_nodeps = true;
|
||||
} else if ( s == "--softdeps" ) {
|
||||
m_softdeps = 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 == "--no-std-config" ) { m_noStdConfig = 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 == "--group" || s == "-g" ) { m_group = true;
|
||||
} else if ( s == "--quick" || s == "-Q" ) { m_quick = true;
|
||||
} else if ( s == "--regex" ) { m_useRegex = true;
|
||||
} else if ( s == "--full" ) { m_fullPath = true;
|
||||
} else if ( s == "--recursive" || s == "-R" ) { m_recursive = true;
|
||||
} else if ( s == "--tree" || s == "-T" ) { m_printTree = true;
|
||||
} else if ( s == "-f" ) { m_pkgaddArgs += " " + s;
|
||||
} else if ( s == "-fi" ) { m_pkgaddArgs += " -f";
|
||||
} 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 == "-is" ) { m_pkgmkArgs += " " + s;
|
||||
} else if ( s == "-us" ) { m_pkgmkArgs += " " + s;
|
||||
} else if ( s == "-kw" ) { m_pkgmkArgs += " " + s;
|
||||
} else if ( s == "-ns" ) { m_pkgmkArgs += " " + s;
|
||||
} else if ( s == "--group" || s == "-g" ) {
|
||||
m_group = true;
|
||||
} else if ( s == "--regex" ) {
|
||||
m_useRegex = true;
|
||||
} else if ( s == "--full" ) {
|
||||
m_fullPath = true;
|
||||
} else if ( s == "--recursive" ) {
|
||||
m_recursive = true;
|
||||
} else if ( s == "--tree" ) {
|
||||
m_printTree = true;
|
||||
} else if ( s == "--depsort" ) {
|
||||
m_depSort = 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 == "-is" ) {
|
||||
m_pkgmkArgs += " " + s;
|
||||
} else if ( s == "-us" ) {
|
||||
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
|
||||
@@ -213,11 +244,11 @@ bool ArgParser::parse() {
|
||||
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, 7 ) == "--sort=" ) {
|
||||
m_sortArgs = s.substr( 7 );
|
||||
} else if ( s.substr( 0, 9 ) == "--config=" ) {
|
||||
m_alternateConfigFile = s.substr( 9 );
|
||||
m_isAlternateConfigGiven = true;
|
||||
@@ -240,45 +271,22 @@ bool ArgParser::parse() {
|
||||
} else {
|
||||
if (!m_isCommandGiven) {
|
||||
string s = m_argv[i];
|
||||
if ( s == "grpinst") {
|
||||
m_isCommandGiven = true;
|
||||
m_commandType = INSTALL;
|
||||
m_group = true;
|
||||
cout << "Warning: grpinst is obsolescent";
|
||||
cout << "; using install --group" << endl;
|
||||
} else if (s == "depinst") {
|
||||
m_isCommandGiven = true;
|
||||
m_commandType = INSTALL;
|
||||
m_depSort = true;
|
||||
} else if (s == "update") {
|
||||
m_isCommandGiven = true;
|
||||
m_commandType = INSTALL;
|
||||
} else if (s == "sysup") {
|
||||
m_isCommandGiven = true;
|
||||
m_commandType = DIFF;
|
||||
m_sysup = true;
|
||||
} else if (s == "quickdiff") {
|
||||
m_isCommandGiven = true;
|
||||
m_commandType = DIFF;
|
||||
m_quick = true;
|
||||
} else if (s == "quickdep") {
|
||||
m_isCommandGiven = true;
|
||||
m_commandType = DEPENDS;
|
||||
m_quick = true;
|
||||
} else if (s == "dependent") {
|
||||
m_isCommandGiven = true;
|
||||
m_commandType = DEPTREE;
|
||||
m_revdep = true;
|
||||
} else {
|
||||
for ( int i = 0; i < commandCount; ++i ) {
|
||||
if ( s == commands[i] ) {
|
||||
m_isCommandGiven = true;
|
||||
m_commandName = s;
|
||||
m_commandType = commandID[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
m_commandName = s;
|
||||
if ( s == "grpinst" ) {
|
||||
m_isCommandGiven = true;
|
||||
m_commandType = commandID[7];
|
||||
m_group = true;
|
||||
cout << "Warning: grpinst is obsolescent";
|
||||
cout << "; using install --group" << endl;
|
||||
} else {
|
||||
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;
|
||||
@@ -289,9 +297,12 @@ bool ArgParser::parse() {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
return m_isCommandGiven;
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
\return true whether --test has been specified
|
||||
*/
|
||||
@@ -300,6 +311,7 @@ bool ArgParser::isTest() const
|
||||
return m_isTest;
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
\return the level of verbose: -v -> 1, -vv -> 2
|
||||
*/
|
||||
@@ -308,6 +320,7 @@ int ArgParser::verbose() const
|
||||
return m_verbose;
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
\return whether --cache has been specified
|
||||
*/
|
||||
@@ -316,6 +329,7 @@ bool ArgParser::useCache() const
|
||||
return m_useCache;
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
\return whether prt-get was called as 'prt-cache' or not
|
||||
*/
|
||||
@@ -332,6 +346,14 @@ 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
|
||||
*/
|
||||
@@ -340,6 +362,7 @@ bool ArgParser::hasFilter() const
|
||||
return m_hasFilter;
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
\return whether there was a --no-std-config argument
|
||||
*/
|
||||
@@ -348,6 +371,7 @@ bool ArgParser::noStdConfig() const
|
||||
return m_noStdConfig;
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
\return the --filter="..." string
|
||||
*/
|
||||
@@ -357,18 +381,16 @@ const string& ArgParser::filter() const
|
||||
}
|
||||
|
||||
/*!
|
||||
\return the --sort="..." string
|
||||
\return whether there was a --nodeps argument
|
||||
*/
|
||||
const string& ArgParser::sortArgs() const
|
||||
bool ArgParser::nodeps() const
|
||||
{
|
||||
return m_sortArgs;
|
||||
}
|
||||
|
||||
bool ArgParser::depSort() const
|
||||
{
|
||||
return m_depSort;
|
||||
return m_nodeps;
|
||||
}
|
||||
|
||||
/*!
|
||||
\return whether there was a --softdeps argument
|
||||
*/
|
||||
bool ArgParser::followSoftdeps() const
|
||||
{
|
||||
return m_softdeps;
|
||||
@@ -387,16 +409,6 @@ bool ArgParser::printPath() const
|
||||
return m_printPath;
|
||||
}
|
||||
|
||||
bool ArgParser::revdep() const
|
||||
{
|
||||
return m_revdep;
|
||||
}
|
||||
|
||||
bool ArgParser::quick() const
|
||||
{
|
||||
return m_quick;
|
||||
}
|
||||
|
||||
bool ArgParser::recursive() const
|
||||
{
|
||||
return m_recursive;
|
||||
@@ -404,7 +416,12 @@ bool ArgParser::recursive() const
|
||||
|
||||
bool ArgParser::printTree() const
|
||||
{
|
||||
return (m_printTree || m_commandName == "deptree");
|
||||
return m_printTree;
|
||||
}
|
||||
|
||||
bool ArgParser::depSort() const
|
||||
{
|
||||
return m_depSort;
|
||||
}
|
||||
|
||||
const string& ArgParser::commandName() const
|
||||
@@ -453,11 +470,6 @@ bool ArgParser::strictDiff() const
|
||||
return m_strictDiff;
|
||||
}
|
||||
|
||||
bool ArgParser::sysup() const
|
||||
{
|
||||
return m_sysup;
|
||||
}
|
||||
|
||||
bool ArgParser::group() const
|
||||
{
|
||||
return m_group;
|
||||
@@ -473,6 +485,7 @@ bool ArgParser::fullPath() const
|
||||
return m_fullPath;
|
||||
}
|
||||
|
||||
|
||||
const string& ArgParser::ignore() const
|
||||
{
|
||||
return m_ignore;
|
||||
|
||||
@@ -31,15 +31,14 @@ public:
|
||||
bool parse();
|
||||
|
||||
/*! Command type */
|
||||
enum Type { HELP, INFO, SHOW_VERSION,
|
||||
SEARCH, DSEARCH, FSEARCH,
|
||||
CREATE_CACHE, INSTALL, REMOVE,
|
||||
CURRENT, ISINST, DIFF,
|
||||
PATH, PRINTF, README,
|
||||
LIST, LISTINST, LISTORPHANS,
|
||||
LOCK, UNLOCK, LISTLOCKED,
|
||||
CAT, LS, EDIT, DUMPCONFIG,
|
||||
DUP, DEPENDS, DEPTREE };
|
||||
enum Type { HELP, LIST, SEARCH, DSEARCH, INSTALL, DEPINST,
|
||||
INFO, DEPENDS, ISINST, DUP, UPDATE,
|
||||
QUICKDEP, DIFF,
|
||||
QUICKDIFF, SHOW_VERSION, CREATE_CACHE, PATH,
|
||||
LISTINST, PRINTF, README, DEPENDENT, SYSUP,
|
||||
CURRENT, FSEARCH, LOCK, UNLOCK, LISTLOCKED,
|
||||
CAT, LS, EDIT, REMOVE,
|
||||
DEPTREE, DUMPCONFIG, LISTORPHANS };
|
||||
|
||||
bool isCommandGiven() const;
|
||||
bool isTest() const;
|
||||
@@ -49,29 +48,27 @@ public:
|
||||
bool writeLog() const;
|
||||
bool hasFilter() const;
|
||||
bool noStdConfig() const;
|
||||
bool depSort() const;
|
||||
bool followSoftdeps() const;
|
||||
bool nodeps() const;
|
||||
bool all() const;
|
||||
bool printPath() const;
|
||||
bool execPreInstall() const;
|
||||
bool execPostInstall() const;
|
||||
bool preferHigher() const;
|
||||
bool strictDiff() const;
|
||||
bool sysup() const;
|
||||
bool group() const;
|
||||
bool useRegex() const;
|
||||
bool fullPath() const;
|
||||
bool revdep() const;
|
||||
bool quick() const;
|
||||
bool recursive() const;
|
||||
bool printTree() const;
|
||||
bool depSort() const;
|
||||
bool followSoftdeps() const;
|
||||
|
||||
const string& alternateConfigFile() const;
|
||||
const string& pkgmkArgs() const;
|
||||
const string& pkgaddArgs() const;
|
||||
const string& pkgrmArgs() const;
|
||||
const string& filter() const;
|
||||
const string& sortArgs() const;
|
||||
const string& filter() const;
|
||||
const string& installRoot() const;
|
||||
const string& ignore() const;
|
||||
|
||||
@@ -81,7 +78,7 @@ public:
|
||||
const string& commandName() const;
|
||||
const string& unknownOption() const;
|
||||
|
||||
const list<string>& otherArgs() const;
|
||||
const list<char*>& otherArgs() const;
|
||||
|
||||
int verbose() const;
|
||||
|
||||
@@ -102,9 +99,8 @@ private:
|
||||
|
||||
bool m_writeLog;
|
||||
|
||||
bool m_depSort;
|
||||
bool m_nodeps;
|
||||
bool m_softdeps;
|
||||
bool m_revdep;
|
||||
|
||||
bool m_all;
|
||||
bool m_printPath;
|
||||
@@ -113,21 +109,21 @@ private:
|
||||
bool m_execPostInstall;
|
||||
bool m_preferHigher;
|
||||
bool m_strictDiff;
|
||||
bool m_sysup;
|
||||
bool m_group;
|
||||
bool m_useRegex;
|
||||
bool m_fullPath;
|
||||
|
||||
bool m_quick;
|
||||
bool m_recursive;
|
||||
bool m_printTree;
|
||||
|
||||
bool m_depSort;
|
||||
|
||||
string m_alternateConfigFile;
|
||||
string m_pkgmkArgs;
|
||||
string m_pkgaddArgs;
|
||||
string m_pkgrmArgs;
|
||||
string m_filter;
|
||||
string m_sortArgs;
|
||||
string m_filter;
|
||||
string m_commandName;
|
||||
string m_unknownOption;
|
||||
string m_installRoot;
|
||||
@@ -140,7 +136,7 @@ private:
|
||||
|
||||
int m_verbose;
|
||||
|
||||
list<string> m_otherArgs;
|
||||
list<char*> m_otherArgs;
|
||||
|
||||
list< pair<char*, ConfigArgType> > m_configData;
|
||||
};
|
||||
|
||||
@@ -38,7 +38,7 @@ Configuration::Configuration( const std::string& configFile,
|
||||
m_followSoftdeps( false ),
|
||||
m_makeCommand( "" ), m_addCommand( "" ),
|
||||
m_removeCommand( "" ), m_runscriptCommand( "" ),
|
||||
m_compressionMode( "" ), m_packageDir( "" )
|
||||
m_packageDir( "" ), m_compressionMode( "" )
|
||||
{
|
||||
|
||||
}
|
||||
@@ -176,6 +176,8 @@ void Configuration::parseLine(const string& line, bool prepend)
|
||||
} else if ( startsWithNoCase( 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 ( s == "disabled" ) {
|
||||
m_writeLog = false;
|
||||
@@ -215,7 +217,7 @@ void Configuration::parseLine(const string& line, bool prepend)
|
||||
m_runScripts = true;
|
||||
} else if ( s == "no" ) {
|
||||
m_runScripts = false;
|
||||
}
|
||||
}
|
||||
} else if ( startsWithNoCase( s, "preferhigher" ) ) {
|
||||
s = stripWhiteSpace( s.replace( 0, 12, "" ) );
|
||||
if ( s == "yes" ) {
|
||||
@@ -227,9 +229,7 @@ void Configuration::parseLine(const string& line, bool prepend)
|
||||
s = stripWhiteSpace( s.replace( 0, 8, "" ) );
|
||||
if ( s == "yes" ) {
|
||||
m_useRegex = true;
|
||||
} else if ( s == "no" ) {
|
||||
m_useRegex = false;
|
||||
}
|
||||
}
|
||||
} else if ( startsWithNoCase( s, "softdeps" ) ) {
|
||||
s = stripWhiteSpace( s.replace( 0, 8, "" ) );
|
||||
if ( s == "yes" ) {
|
||||
|
||||
@@ -56,9 +56,8 @@ public:
|
||||
std::string addCommand() const;
|
||||
std::string removeCommand() const;
|
||||
std::string runscriptCommand() const;
|
||||
|
||||
std::string compressionMode() const;
|
||||
std::string packageDir() const;
|
||||
std::string compressionMode() const;
|
||||
|
||||
private:
|
||||
std::string m_configFile;
|
||||
@@ -87,8 +86,8 @@ private:
|
||||
std::string m_removeCommand;
|
||||
std::string m_runscriptCommand;
|
||||
|
||||
std::string m_compressionMode;
|
||||
std::string m_packageDir;
|
||||
std::string m_compressionMode;
|
||||
|
||||
void parseLine(const std::string& line, bool prepend=false);
|
||||
};
|
||||
|
||||
@@ -27,7 +27,6 @@ using namespace std;
|
||||
#include "pkgdb.h"
|
||||
#include "stringhelper.h"
|
||||
#include "argparser.h"
|
||||
#include "versioncomparator.h"
|
||||
#include "process.h"
|
||||
#include "configuration.h"
|
||||
|
||||
@@ -72,6 +71,38 @@ InstallTransaction::InstallTransaction( const list<string>& names,
|
||||
|
||||
}
|
||||
|
||||
/*!
|
||||
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_pkgDB( pkgDB ),
|
||||
m_resolver(),
|
||||
m_repo( repo ),
|
||||
m_depCalced( false ),
|
||||
m_installedPackages(),
|
||||
m_alreadyInstalledPackages(),
|
||||
m_ignoredPackages(),
|
||||
m_depNameList(),
|
||||
m_depList(),
|
||||
m_missingPackages(),
|
||||
m_installErrors(),
|
||||
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
|
||||
@@ -111,17 +142,17 @@ InstallTransaction::installError() const
|
||||
/*!
|
||||
install (commit) a transaction
|
||||
\param parser the argument parser
|
||||
\param update whether this is an update operation
|
||||
\return returns an InstallResult telling whether installation worked
|
||||
*/
|
||||
InstallTransaction::InstallResult
|
||||
InstallTransaction::install( const ArgParser* parser )
|
||||
InstallTransaction::install( const ArgParser* parser,
|
||||
bool update )
|
||||
{
|
||||
if ( m_packages.empty() ) {
|
||||
return NO_PACKAGE_GIVEN;
|
||||
}
|
||||
|
||||
bool update;
|
||||
const string forceRebuild = "-fr";
|
||||
list<string> ignoredPackages;
|
||||
StringHelper::split(parser->ignore(), ',', ignoredPackages);
|
||||
|
||||
@@ -144,62 +175,45 @@ InstallTransaction::install( const ArgParser* parser )
|
||||
continue;
|
||||
}
|
||||
|
||||
// Set the update flag if the package is installed and out of date,
|
||||
// or if the user has forced a rebuild.
|
||||
// Proceed to the next target if package is installed and up to date,
|
||||
// or is provided by an alias.
|
||||
if ( m_pkgDB->isInstalled( it->first, false ) ) {
|
||||
VersionComparator::COMP_RESULT
|
||||
rpDiff = VersionComparator::compareVersions(
|
||||
m_repo->getPackageVersion( package->name() ),
|
||||
m_pkgDB->getPackageVersion( package->name() ) );
|
||||
if ( rpDiff == VersionComparator::EQUAL &&
|
||||
parser->pkgmkArgs().find(forceRebuild) == string::npos ) {
|
||||
m_alreadyInstalledPackages.push_back( package->name() );
|
||||
continue;
|
||||
} else if ( (! m_config->preferHigher()) || parser->strictDiff()
|
||||
|| rpDiff == VersionComparator::GREATER
|
||||
|| ( parser->pkgmkArgs().find(forceRebuild)
|
||||
!= string::npos && find(parser->otherArgs().begin(),
|
||||
parser->otherArgs().end(), it->first)
|
||||
!= parser->otherArgs().end() ) ) {
|
||||
update = true;
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
} else if ( m_pkgDB->isInstalled( it->first, true ) ) {
|
||||
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() ) {
|
||||
info.preState = ( package->hasPreInstall() &&
|
||||
info.preState = ( package->hasPreInstall() &&
|
||||
(parser->execPreInstall() || m_config->runScripts())
|
||||
) ? DEFERRED : NONEXISTENT;
|
||||
info.postState = ( package->hasPostInstall() &&
|
||||
) ? DEFERRED : NONEXISTENT;
|
||||
info.postState = ( package->hasPostInstall() &&
|
||||
(parser->execPostInstall() || m_config->runScripts())
|
||||
) ? DEFERRED : NONEXISTENT;
|
||||
m_installedPackages.push_back( make_pair( package->path() + "/" + package->name(), info));
|
||||
) ? DEFERRED : NONEXISTENT;
|
||||
m_installedPackages.push_back( make_pair(package->path()
|
||||
+ "/" + package->name(), info) );
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((result = installPackage( package, parser, update, info )) == SUCCESS) {
|
||||
|
||||
m_installedPackages.push_back( make_pair( package->path() + "/" + package->name(), info));
|
||||
m_installedPackages.push_back( make_pair( package->path()
|
||||
+ "/" + package->name(), info));
|
||||
} else {
|
||||
|
||||
// log failures and pkgdest errors are critical,
|
||||
// don't proceed to the next install target if encountered
|
||||
// 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->path() + "/" + package->name(), info) );
|
||||
m_installErrors.push_back( make_pair(package->name(), info) );
|
||||
if ( parser->group() ) {
|
||||
return PKGMK_FAILURE;
|
||||
}
|
||||
@@ -221,7 +235,8 @@ InstallTransaction::installPackage( const Package* package,
|
||||
const ArgParser* parser,
|
||||
bool update,
|
||||
InstallTransaction::InstallInfo& info )
|
||||
const {
|
||||
const
|
||||
{
|
||||
|
||||
InstallTransaction::InstallResult result = SUCCESS;
|
||||
#ifdef USE_LOCKING
|
||||
@@ -295,26 +310,23 @@ const {
|
||||
write( fdlog, timestamp.c_str(), timestamp.length());
|
||||
}
|
||||
|
||||
string portdir = package->path() + "/" + package->name();
|
||||
chdir( portdir.c_str() );
|
||||
string pkgdir = package->path() + "/" + package->name();
|
||||
chdir( pkgdir.c_str() );
|
||||
|
||||
string runscriptCommand = "/bin/sh";
|
||||
string runscriptCommand = "sh";
|
||||
if (m_config->runscriptCommand() != "") {
|
||||
runscriptCommand = m_config->runscriptCommand();
|
||||
}
|
||||
if (parser->installRoot() != "") {
|
||||
runscriptCommand = "chroot " + parser->installRoot() + " "
|
||||
+ runscriptCommand;
|
||||
runscriptCommand = "chroot " + parser->installRoot() + runscriptCommand;
|
||||
}
|
||||
|
||||
// -- pre-install
|
||||
struct stat statData; struct stat fstatData;
|
||||
struct stat statData;
|
||||
if ((parser->execPreInstall() || m_config->runScripts()) &&
|
||||
stat((parser->installRoot() + portdir + "/pre-install").c_str(),
|
||||
&statData) == 0) {
|
||||
Process preProc( runscriptCommand,
|
||||
portdir + "/pre-install",
|
||||
fdlog );
|
||||
stat((parser->installRoot() + pkgdir + "/" + "pre-install").c_str(),
|
||||
&statData) == 0) {
|
||||
Process preProc( runscriptCommand, pkgdir + "/" + "pre-install", fdlog );
|
||||
if (preProc.executeShell()) {
|
||||
info.preState = FAILED;
|
||||
} else {
|
||||
@@ -323,39 +335,28 @@ const {
|
||||
}
|
||||
|
||||
// -- build
|
||||
string pkgdest = m_config->packageDir();
|
||||
string builtPkg = package->name() + "#" + package->version() + "-" +
|
||||
package->release() + ".pkg.tar." + m_config->compressionMode();
|
||||
string builtPkgPath = ( pkgdest != "" ) ? pkgdest + "/" + builtPkg :
|
||||
portdir + "/" + builtPkg ;
|
||||
string cmd = PKGMK_DEFAULT_COMMAND;
|
||||
if (m_config->makeCommand() != "") {
|
||||
cmd = m_config->makeCommand();
|
||||
}
|
||||
|
||||
// skip the build if a package exists newer than Pkgfile
|
||||
// (e.g., created by running pkgmk manually)
|
||||
if ( stat(builtPkgPath.c_str(), &statData) +
|
||||
stat((portdir + "/Pkgfile").c_str(), &fstatData) == 0) {
|
||||
time_t pkgMtime = statData.st_mtime;
|
||||
time_t pfMtime = fstatData.st_mtime;
|
||||
if ( ( difftime(pkgMtime,pfMtime) > 0 ) and
|
||||
(parser->pkgmkArgs().find(" -f") == string::npos) ) {
|
||||
cmd = "/bin/true"; }
|
||||
}
|
||||
|
||||
string args = "-d " + parser->pkgmkArgs();
|
||||
if ( parser->pkgmkArgs().find(" -f") != string::npos &&
|
||||
find( parser->otherArgs().begin(), parser->otherArgs().end(),
|
||||
package->name() ) == parser->otherArgs().end() ) {
|
||||
StringHelper::replaceAll(args," -f","");
|
||||
// do not force a rebuild unless the port was given on the command line
|
||||
if ( parser->pkgmkArgs().find(" -f")!=string::npos &&
|
||||
find(parser->otherArgs().begin(), parser->otherArgs().end(),
|
||||
package->name()) == parser->otherArgs().end() ) {
|
||||
StringHelper::replaceAll(args," -f", "");
|
||||
}
|
||||
Process makeProc( cmd, args, fdlog );
|
||||
if ( makeProc.executeShell() ) {
|
||||
result = PKGMK_FAILURE;
|
||||
} else {
|
||||
string message = ( pkgdest == "" ) ? "" :
|
||||
commandName + ": Using PKGMK_PACKAGE_DIR " + pkgdest;
|
||||
// -- update
|
||||
string pkgdest = m_config->packageDir();
|
||||
if ( pkgdest != "" ) {
|
||||
// TODO: don't manipulate pkgdir
|
||||
pkgdir = pkgdest;
|
||||
string message = "prt-get: Using PKGMK_PACKAGE_DIR: " + pkgdir;
|
||||
if (parser->verbose() > 0) {
|
||||
cout << message << endl;
|
||||
}
|
||||
@@ -363,79 +364,92 @@ const {
|
||||
write( fdlog, message.c_str(), message.length() );
|
||||
write( fdlog, "\n", 1 );
|
||||
}
|
||||
}
|
||||
|
||||
// no need to chdir if we provide absolute paths to pkgadd
|
||||
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 += builtPkgPath;
|
||||
|
||||
// - inform the user about what's happening
|
||||
string fullCommand = commandName + ": " + cmd + args;
|
||||
string summary;
|
||||
if (update) {
|
||||
string from = m_pkgDB->getPackageVersion(package->name());
|
||||
string to = m_repo->getPackageVersion(package->name());
|
||||
if (from == to) {
|
||||
summary = commandName + ": " + "reinstalling " +
|
||||
package->name() + " " + to;
|
||||
} else {
|
||||
summary = commandName + ": " + "updating " +
|
||||
package->name() + " from " + from + " to " + to;
|
||||
}
|
||||
} else {
|
||||
summary = commandName + ": " + "installing " + package->name() +
|
||||
" " + package->version() + "-" + package->release();
|
||||
}
|
||||
|
||||
// - print and log
|
||||
cout << summary << endl;
|
||||
if (parser->verbose() > 0) {
|
||||
cout << fullCommand << endl;
|
||||
}
|
||||
if ( m_config->writeLog() ) {
|
||||
time_t endTime;
|
||||
time(&endTime);
|
||||
timestamp = ctime(&endTime);
|
||||
timestamp = commandName + ": build done " + timestamp;
|
||||
// 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();
|
||||
}
|
||||
|
||||
write( fdlog, summary.c_str(), summary.length() );
|
||||
write( fdlog, "\n", 1 );
|
||||
write( fdlog, fullCommand.c_str(), fullCommand.length() );
|
||||
write( fdlog, "\n", 1 );
|
||||
write( fdlog, timestamp.c_str(), timestamp.length());
|
||||
write( fdlog, "\n", 1 );
|
||||
}
|
||||
args = "";
|
||||
if (parser->installRoot() != "") {
|
||||
args = "-r " + parser->installRoot() + " ";
|
||||
}
|
||||
|
||||
Process installProc( cmd, args, fdlog );
|
||||
if ( installProc.executeShell() ) {
|
||||
result = PKGADD_FAILURE;
|
||||
} else {
|
||||
// exec post install
|
||||
if ((parser->execPostInstall() || m_config->runScripts() ) &&
|
||||
stat((parser->installRoot() + portdir + "/post-install").c_str(),
|
||||
&statData) == 0) {
|
||||
Process postProc( runscriptCommand,
|
||||
portdir + "/post-install", fdlog );
|
||||
if (postProc.executeShell()) {
|
||||
info.postState = FAILED;
|
||||
|
||||
if ( update ) {
|
||||
args += "-u ";
|
||||
}
|
||||
if ( !parser->pkgaddArgs().empty() ) {
|
||||
args += parser->pkgaddArgs() + " ";
|
||||
}
|
||||
args +=
|
||||
package->name() + "#" +
|
||||
package->version() + "-" +
|
||||
package->release() + ".pkg.tar." + m_config->compressionMode();
|
||||
|
||||
|
||||
// - inform the user about what's happening
|
||||
string fullCommand = commandName + ": " + cmd + " " + args;
|
||||
string summary;
|
||||
if (update) {
|
||||
string from = m_pkgDB->getPackageVersion(package->name());
|
||||
string to = package->version() + "-" + package->release();
|
||||
if (from == to) {
|
||||
summary = commandName + ": " + "reinstalling " +
|
||||
package->name() + " " + to;
|
||||
} else {
|
||||
info.postState = EXEC_SUCCESS;
|
||||
summary = commandName + ": " + "updating " +
|
||||
package->name() + " from " + from + " to " + to;
|
||||
}
|
||||
} else {
|
||||
summary = commandName + ": " + "installing " +
|
||||
package->name() + " " +
|
||||
package->version() + "-" + package->release();
|
||||
}
|
||||
|
||||
// - print and log
|
||||
cout << summary << endl;
|
||||
if (parser->verbose() > 0) {
|
||||
cout << fullCommand << endl;
|
||||
}
|
||||
if ( m_config->writeLog() ) {
|
||||
time_t endTime;
|
||||
time(&endTime);
|
||||
timestamp = ctime(&endTime);
|
||||
timestamp = commandName + ": build done " + timestamp;
|
||||
|
||||
write( fdlog, summary.c_str(), summary.length() );
|
||||
write( fdlog, "\n", 1 );
|
||||
write( fdlog, fullCommand.c_str(), fullCommand.length() );
|
||||
write( fdlog, "\n", 1 );
|
||||
write( fdlog, timestamp.c_str(), timestamp.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((parser->installRoot() + "/" + 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -470,7 +484,8 @@ bool InstallTransaction::calculateDependencies()
|
||||
return false;
|
||||
}
|
||||
|
||||
list<pair<string, const Package*>>::const_iterator it = m_packages.begin();
|
||||
list< pair<string, const Package*> >::const_iterator it =
|
||||
m_packages.begin();
|
||||
for ( ; it != m_packages.end(); ++it ) {
|
||||
const Package* package = it->second;
|
||||
if ( package ) {
|
||||
@@ -514,8 +529,8 @@ void InstallTransaction::checkDependencies( bool greedy,
|
||||
|
||||
if ( index == -1 ) {
|
||||
index = m_depList.size();
|
||||
if ( ( not greedy ) or (isRequired( package->name() )) ) {
|
||||
m_depList.push_back( package->name() );
|
||||
if ( (!greedy) or isRequired( package->name() ) ) {
|
||||
m_depList.push_back( package->name() );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -560,7 +575,7 @@ void InstallTransaction::checkDependencies( bool greedy,
|
||||
for ( ; it != optionals.end(); ++it ) {
|
||||
string softdep = *it;
|
||||
if ( softdep.empty() ) { continue; }
|
||||
if ( isRequired(softdep) ) {
|
||||
if ( isRequired(softdep) ) {
|
||||
const Package* p = m_repo->getPackage( softdep );
|
||||
if ( p ) {
|
||||
checkDependencies( true, p, index );
|
||||
@@ -568,7 +583,7 @@ void InstallTransaction::checkDependencies( bool greedy,
|
||||
m_missingPackages.
|
||||
push_back( make_pair( softdep, package->name() ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -581,8 +596,8 @@ void InstallTransaction::checkDependencies( bool greedy,
|
||||
Method to determine whether a soft dependency should be part of the transaction
|
||||
*/
|
||||
bool InstallTransaction::isRequired(const string &pname) {
|
||||
if ( m_pkgDB->isInstalled(pname) ) { return true; }
|
||||
list<pair<string, const Package*>>::iterator it = m_packages.begin();
|
||||
if ( m_pkgDB->isInstalled(pname,false) ) { return true; }
|
||||
list< pair<string, const Package*> >::iterator it = m_packages.begin();
|
||||
for ( ; it != m_packages.end(); ++it ) {
|
||||
if ( pname == it->first ) { return true; }
|
||||
}
|
||||
@@ -640,11 +655,11 @@ InstallTransaction::installedPackages() const
|
||||
/*!
|
||||
calculate dependendencies for this package
|
||||
*/
|
||||
bool InstallTransaction::calcDependencies( )
|
||||
InstallTransaction::InstallResult
|
||||
InstallTransaction::calcDependencies( )
|
||||
{
|
||||
if ( m_packages.empty() ) {
|
||||
cout << "No packages given for this transaction" << endl;
|
||||
return false;
|
||||
return NO_PACKAGE_GIVEN;
|
||||
}
|
||||
|
||||
bool validPackages = false;
|
||||
@@ -657,18 +672,17 @@ bool InstallTransaction::calcDependencies( )
|
||||
m_missingPackages.push_back( make_pair( it->first, string("") ) );
|
||||
}
|
||||
}
|
||||
if ( !validPackages ) {
|
||||
return NO_PACKAGE_GIVEN;
|
||||
}
|
||||
|
||||
if (!validPackages) {
|
||||
cout << "No valid packages for this transaction" << endl;
|
||||
return false;
|
||||
}
|
||||
if ( !calculateDependencies() ) {
|
||||
cout << "Cyclic dependencies detected" << endl;
|
||||
return false;
|
||||
return CYCLIC_DEPEND;
|
||||
}
|
||||
return true;
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
const list<string>& InstallTransaction::ignoredPackages() const
|
||||
{
|
||||
return m_ignoredPackages;
|
||||
|
||||
@@ -33,6 +33,10 @@ class Configuration;
|
||||
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,
|
||||
@@ -50,10 +54,10 @@ public:
|
||||
/*! Result of an installation */
|
||||
enum InstallResult {
|
||||
SUCCESS, /*!< yeah, success */
|
||||
NO_PACKAGE_GIVEN, /*!< no package given to install */
|
||||
NO_PACKAGE_GIVEN, /*!< no package give to install */
|
||||
PACKAGE_NOT_FOUND, /*!< package not found */
|
||||
PKGMK_FAILURE, /*!< error while pkgmk */
|
||||
PKGDEST_ERROR, /*!< can't change to PKGDEST */
|
||||
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 */
|
||||
@@ -63,9 +67,9 @@ public:
|
||||
};
|
||||
|
||||
enum State {
|
||||
DEFERRED,
|
||||
EXEC_SUCCESS,
|
||||
FAILED,
|
||||
DEFERRED,
|
||||
NONEXISTENT
|
||||
};
|
||||
struct InstallInfo {
|
||||
@@ -79,13 +83,15 @@ public:
|
||||
bool hasReadme;
|
||||
};
|
||||
|
||||
InstallResult install( const ArgParser* parser );
|
||||
bool calcDependencies();
|
||||
InstallResult install( const ArgParser* parser,
|
||||
bool update );
|
||||
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;
|
||||
@@ -113,20 +119,21 @@ private:
|
||||
// packages< pair<name, hasReadme> > installed by this transaction
|
||||
list< pair<string, InstallInfo> > m_installedPackages;
|
||||
|
||||
// packages requested to be installed, but already present
|
||||
// packages which were requested to be installed which where already
|
||||
list<string> m_alreadyInstalledPackages;
|
||||
|
||||
// packages required by the transaction, but ignored by the user
|
||||
// packages which are required by the transaction, but ignored by
|
||||
// the user
|
||||
list<string> m_ignoredPackages;
|
||||
|
||||
list<string> m_depNameList;
|
||||
vector<string> m_depList;
|
||||
vector<string> treeWalk;
|
||||
|
||||
// packages requested to be installed, but not found in the ports tree
|
||||
// packages requested to be installed not found in the ports tree
|
||||
list< pair<string, string> > m_missingPackages;
|
||||
|
||||
// packages where build/install failed
|
||||
// packages where build/installed failed
|
||||
list< pair<string, InstallInfo> > m_installErrors;
|
||||
|
||||
/// prt-get itself
|
||||
|
||||
59
src/main.cpp
59
src/main.cpp
@@ -57,13 +57,17 @@ int main( int argc, char** argv )
|
||||
|
||||
|
||||
ArgParser::Type command = argParser.commandType();
|
||||
switch ( command ) {
|
||||
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;
|
||||
@@ -80,16 +84,25 @@ int main( int argc, char** argv )
|
||||
prtGet.isInstalled();
|
||||
break;
|
||||
case ArgParser::INSTALL:
|
||||
prtGet.install( argParser.depSort() );
|
||||
prtGet.install();
|
||||
break;
|
||||
case ArgParser::DEPENDS:
|
||||
prtGet.printDepends( argParser.quick() );
|
||||
break;
|
||||
case ArgParser::DEPTREE:
|
||||
prtGet.printDepTree();
|
||||
case ArgParser::DEPINST:
|
||||
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( argParser.quick() );
|
||||
prtGet.printDiff();
|
||||
break;
|
||||
case ArgParser::QUICKDIFF:
|
||||
prtGet.printQuickDiff();
|
||||
break;
|
||||
case ArgParser::CREATE_CACHE:
|
||||
prtGet.createCache();
|
||||
@@ -97,36 +110,36 @@ int main( int argc, char** argv )
|
||||
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.printDependent();
|
||||
break;
|
||||
case ArgParser::SYSUP:
|
||||
prtGet.sysup();
|
||||
break;
|
||||
case ArgParser::CURRENT:
|
||||
prtGet.current();
|
||||
break;
|
||||
case ArgParser::FSEARCH:
|
||||
prtGet.fsearch();
|
||||
break;
|
||||
case ArgParser::LIST:
|
||||
prtGet.listPackages();
|
||||
break;
|
||||
case ArgParser::LISTINST:
|
||||
prtGet.listInstalled();
|
||||
break;
|
||||
case ArgParser::LISTORPHANS:
|
||||
prtGet.listOrphans();
|
||||
break;
|
||||
case ArgParser::LISTLOCKED:
|
||||
prtGet.listLocked();
|
||||
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;
|
||||
@@ -139,9 +152,15 @@ int main( int argc, char** argv )
|
||||
case ArgParser::REMOVE:
|
||||
prtGet.remove();
|
||||
break;
|
||||
case ArgParser::DEPTREE:
|
||||
prtGet.printDependTree();
|
||||
break;
|
||||
case ArgParser::DUMPCONFIG:
|
||||
prtGet.dumpConfig();
|
||||
break;
|
||||
case ArgParser::LISTORPHANS:
|
||||
prtGet.listOrphans();
|
||||
break;
|
||||
default:
|
||||
cerr << "unknown command" << endl;
|
||||
break;
|
||||
|
||||
@@ -32,7 +32,6 @@ public:
|
||||
bool useAlias = false,
|
||||
bool* isAlias = 0,
|
||||
string* aliasOrignalName = 0 ) const;
|
||||
bool isOutdated( const std::string& name ) const;
|
||||
|
||||
|
||||
std::string getPackageVersion( const std::string& name ) const;
|
||||
|
||||
1118
src/prtget.cpp
1118
src/prtget.cpp
File diff suppressed because it is too large
Load Diff
40
src/prtget.h
40
src/prtget.h
@@ -55,25 +55,22 @@ public:
|
||||
void listPackages();
|
||||
void listShadowed();
|
||||
void listInstalled();
|
||||
void listOrphans();
|
||||
void listLocked();
|
||||
void setLock( bool lock );
|
||||
|
||||
void searchPackages( bool searchDesc=false );
|
||||
void fsearch();
|
||||
|
||||
void printInfo();
|
||||
void isInstalled();
|
||||
bool isOutdated();
|
||||
void current();
|
||||
void readme();
|
||||
|
||||
void install( bool dependencies=false );
|
||||
void remove();
|
||||
|
||||
void install( bool update=false,
|
||||
bool dependencies=false );
|
||||
void sysup();
|
||||
void current();
|
||||
void printDepends( bool simpleListing=false );
|
||||
void printDiff( bool simpleListing=false );
|
||||
void printDepTree();
|
||||
void printDependTree();
|
||||
void printDependent();
|
||||
void printDiff();
|
||||
void printQuickDiff();
|
||||
void listOrphans();
|
||||
|
||||
void createCache();
|
||||
|
||||
@@ -83,6 +80,14 @@ public:
|
||||
void cat();
|
||||
void ls();
|
||||
void edit();
|
||||
|
||||
void remove();
|
||||
|
||||
void setLock( bool lock );
|
||||
void listLocked();
|
||||
|
||||
void fsearch();
|
||||
|
||||
void dumpConfig();
|
||||
|
||||
int returnValue() const;
|
||||
@@ -91,10 +96,14 @@ public:
|
||||
|
||||
protected:
|
||||
|
||||
void printDepsLevel(int level, const Package* package, bool greedy);
|
||||
void printDepsLevel(int indent, const Package* package, bool greedy);
|
||||
|
||||
void executeTransaction( InstallTransaction& transaction );
|
||||
void evaluateResult( InstallTransaction& transaction,
|
||||
void printDependent(const std::string& dep, int level);
|
||||
|
||||
void executeTransaction( InstallTransaction& transaction,
|
||||
bool update );
|
||||
void evaluateResult( InstallTransaction& transaction,
|
||||
bool update,
|
||||
bool interrupted=false );
|
||||
void reportPrePost(const InstallTransaction::InstallInfo& info);
|
||||
|
||||
@@ -113,6 +122,7 @@ protected:
|
||||
const string& version2,
|
||||
bool locked);
|
||||
|
||||
|
||||
Repository* m_repo;
|
||||
PkgDB* m_pkgDB;
|
||||
Configuration* m_config;
|
||||
|
||||
@@ -86,26 +86,12 @@ const Package* Repository::getPackage( const string& name ) const
|
||||
return it->second;
|
||||
}
|
||||
|
||||
/*!
|
||||
\param name the package name to be matched
|
||||
\return the version-release in the repository
|
||||
*/
|
||||
std::string Repository::getPackageVersion( const string& name ) const
|
||||
{
|
||||
map<string, Package*>::const_iterator it = m_packageMap.find( name );
|
||||
if ( it == m_packageMap.end() ) {
|
||||
return "0";
|
||||
}
|
||||
const Package* p = it->second;
|
||||
string result = p->version()+"-"+p->release();
|
||||
return result;
|
||||
}
|
||||
|
||||
/*!
|
||||
Search packages for a match of \a pattern in name, or in description if
|
||||
Search packages for a match of \a pattern in name, and description of
|
||||
\a searchDesc is true.
|
||||
\note Name searches can often be done without opening the Pkgfiles, but not
|
||||
description search. Therefore, the latter is much slower
|
||||
\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
|
||||
@@ -202,10 +188,11 @@ void Repository::initFromFS( const list< pair<string, string> >& rootList,
|
||||
|
||||
|
||||
|
||||
// TODO: think about whether it would be faster (more efficient)
|
||||
// to put all packages into a map, and then iterate
|
||||
// over the list of allowed packages and copy them over.
|
||||
// Depending on the efficiency of find(), this might be faster.
|
||||
// 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;
|
||||
@@ -340,20 +327,9 @@ Repository::WriteResult Repository::writeCache( const string& cacheFile )
|
||||
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;
|
||||
}
|
||||
hasReadme = ( p->hasReadme() ) ? yesStr : noStr;
|
||||
hasPreInstall = ( p->hasPreInstall() ) ? yesStr : noStr;
|
||||
hasPostInstall = ( p->hasPostInstall() ) ? yesStr : noStr;
|
||||
|
||||
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(),
|
||||
@@ -403,37 +379,6 @@ bool Repository::createOutputDir( const string& path )
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
look for any port mentioning \a pattern as a dependency or soft dependency.
|
||||
searchOptionals=false (the default) only searches the "Depends on:" line.
|
||||
The output will need to be trimmed afterward, because in this namespace we
|
||||
can't check whether the matching ports are installed.
|
||||
*/
|
||||
void Repository::getDependentPackages( const string& pattern,
|
||||
list<Package*>& target,
|
||||
bool searchOptionals ) const {
|
||||
|
||||
map<string, Package*>::const_iterator im = m_packageMap.begin();
|
||||
for ( ; im != m_packageMap.end(); ++im ) {
|
||||
Package* q = im->second; string s;
|
||||
if (searchOptionals) {
|
||||
s = toLowerCase(q->optionals());
|
||||
} else {
|
||||
s = toLowerCase(q->dependencies());
|
||||
}
|
||||
|
||||
if ( s.find( pattern ) != string::npos ) {
|
||||
list<string> tokens;
|
||||
split( s, ',', tokens );
|
||||
list<string>::iterator ik = find( tokens.begin(),
|
||||
tokens.end(), pattern );
|
||||
if ( ik != tokens.end() ) {
|
||||
target.push_back( q );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
Search packages for a match of \a pattern in name. The name can
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
using namespace std;
|
||||
|
||||
#include "package.h"
|
||||
#include "stringhelper.h"
|
||||
|
||||
/*!
|
||||
\class Repository
|
||||
@@ -34,7 +33,6 @@ public:
|
||||
~Repository();
|
||||
|
||||
const Package* getPackage( const string& name ) const;
|
||||
std::string getPackageVersion( const string& name ) const;
|
||||
const map<string, Package*>& packages() const;
|
||||
const list<pair<Package*, Package*> >& shadowedPackages() const;
|
||||
|
||||
@@ -42,10 +40,6 @@ public:
|
||||
list<Package*>& target,
|
||||
bool searchDesc ) const;
|
||||
|
||||
void getDependentPackages( const string& pattern,
|
||||
list<Package*>& target,
|
||||
bool searchOptionals ) const;
|
||||
|
||||
void getMatchingPackages( const string& pattern,
|
||||
list<Package*>& target ) const;
|
||||
|
||||
|
||||
@@ -155,4 +155,5 @@ string replaceAll( string& in,
|
||||
return in;
|
||||
}
|
||||
|
||||
|
||||
}; // Namespace
|
||||
|
||||
Reference in New Issue
Block a user