Commit Graph

23 Commits (cute-signatures)

Author SHA1 Message Date
Ariadne Conill 3fd120db5c applet: rework APK_DEFINE_APPLET to use constructor attribute
this allows the applet registration to work in a portable way, without having to
weird things with the linker.

ref #10794
2021-12-14 12:05:59 -06:00
Timo Teräs a627ab8eb8 make apk_database optional for applets that don't need it
The new v3 applets don't use it, and eventually all applets will
use the new formats only.

This prepares the code for this, and moves trust, id_cache, and
root_fd to apk_ctx which is enough for v3 applets at this time.

The generic code is made to not initialize apk_database if it's
not needed.
2020-10-09 16:09:19 +03:00
Timo Teräs 354713d2f7 rename apk_db_options to apk_ctx, rework logging
makes apk_verbosity non-global

fixes #10682
2020-10-09 16:09:19 +03:00
Timo Teräs 7a7eca8670 make apk_flags non-global, make progress printing state non-global
ref #10682
2020-10-09 16:09:19 +03:00
Timo Teräs efe0c4afec adb: introduce apk-tools database format, and few applets
This is a flat buffers inspired format that allows fast
mmaped access to the data with low overhead, signature support
and relatively good forward support.
2020-10-09 16:09:19 +03:00
Timo Teräs edb45ae464 enforce options definitions to bind the enum and the descriptor
This uses some macro trickery to make sure that there's one-to-one
mapping with the option index enum and the descriptor. The down
side is that enum's are generated via #define's and editors might
not pick them up for auto completion, but the benefits are more:
it's no longer possible have mismatching enum value and descriptor
index, and the amount of source code lines is less.
2020-08-24 13:35:36 +03:00
TBK 5d796b5678 use SPDX-License-Identifier in source files 2020-05-07 10:45:42 +03:00
Timo Teräs 1d7123d837 rewrite option descriptors to be single string
This reduces the number of relocations on PIE binaries, and also
reduces the executable size. Parsing of the options is slightly
sped up as only the exact matching option group parser is called.
2020-05-06 13:05:25 +03:00
Timo Teräs 5258b484bf add script to autogenerate help from man pages
This creates main help like:
--
usage: apk [<OPTIONS>...] COMMAND [<ARGUMENTS>...]

Package installation and removal:
  add        Add packages to WORLD and commit changes
  del        Remove packages from WORLD and commit changes

System maintenance:
  fix        Check WORLD against the system and ensure consistency
  update     Update repository indexes
  upgrade    Install upgrades available from repositories
  cache      Commands related to the management of an offline package cache

Querying package information:
  info       Give detailed information about packages or repositories
  list       List packages matching a pattern or other criteria
  dot        Generate graphviz graphs
  policy     Show repository policy for packages

Repository maintenance:
  index      Create repository index file from packages
  fetch      Download packages from global repositories to a local directory
  manifest   Show checksums of package contents
  verify     Verify package integrity and signature

Miscellaneous:
  audit      Audit directories for changes
  stats      Show statistics about repositories and installations
  version    Compare package versions or perform tests on version strings

This apk has coffee making abilities.
--

And applet specific help like:
--
usage: apk add [<OPTIONS>...] PACKAGES...

Description:
  apk add adds the requested packages to WORLD and installs (or upgrades)
  them if not already present, ensuring all dependencies are met.

Options:
  --initdb         Initialize a new package database
  -l, --latest     Disables normal heuristics for choosing which repository to install a
  -u, --upgrade    When adding packages which are already installed, upgrade them rather
  -t, --virtual NAME
                   Instead of adding the specified packages to WORLD, create a new
  --no-chown       Do not change file owner or group
--
2020-05-06 13:05:19 +03:00
Drew DeVault b62d252b7b Update apk to make man pages sole source of truth
Detailed docs have been removed from the apk binaries, in favor of
git-style short summaries of each command.
2020-01-26 09:03:18 +02:00
William Pitcock abf7c2838b apk: usage: cleanup help text when no applet is selected 2018-01-09 17:07:13 +00:00
Timo Teräs 8a28c6d0d4 enable automatic update of indexes controlled by --cache-max-age
This modifies apk cache for indexes to be automatically refreshed
periodically without explicit 'update' or '--update-cache' usage.

The default is to do if-modified-since request if the local copy
is older than 4 hours. This age can be changed with --cache-max-age.
Using --update-cache will change this age to 60 seconds to make
sure the cached copy is relatively new. The small age is in order
to try to avoid downloading indexes second time when apk-tools is
upgraded and apk re-execs after self-upgrade.

Accordingly using explicitly 'apk update' will now enforce
--force-refresh and request the very latest index by requesting
any potential http proxy to do refresh too.
2018-01-04 10:56:09 +02:00
Timo Teräs 38e3f54638 rework option parsing to have a group structure
Add also a new 'commit' group that is the common options
for all applets that can commit package changes.
2014-10-08 15:29:27 +03:00
Timo Teräs 1e36692a8a finally fix building PIE binaries
the dynamic applet registration never worked with PIE, and as
a temporary hack -nopie was added to default link flags in 2008.

this commit reworks the applet registration mechanism to something
that is compatible with PIE, and removes the hack. finally!
2014-05-12 19:45:36 +03:00
Timo Teräs fe41ae07b9 apk: use string array in applet mains, separate apk_name_foreach_matching 2013-06-18 13:02:27 +03:00
Timo Teräs 1817b0a3c3 all: update copyright year statement 2011-09-13 11:53:01 +03:00
Timo Teras ecdacd1503 all: implement database open options
so user can override trusted keys directory and repositories file.
2009-08-06 14:25:03 +03:00
Timo Teras 7a29678aac help: auto construct help
And add some more verbosity to the help message.
2009-06-25 15:14:07 +03:00
Natanael Copa ca51ec3238 db: allow more than one --repository arg 2009-02-17 12:23:01 +00:00
Timo Teras 3755e1cde3 apk: per applet options 2009-01-13 14:09:45 +02:00
Timo Teras 823283edca Argument parsing. Some other stuff too. 2008-04-21 16:30:10 +00:00
Timo Teras 951602e551 Fixes for hardened environment (and old gcc) 2008-04-21 09:41:53 +00:00
Timo Teras d6c7435242 Initial commit of some stuff written so far. Still in state of flux. Expect
breakage and major changes.
2008-04-17 14:09:13 +00:00