Commit Graph

135 Commits (cute-signatures)

Author SHA1 Message Date
Timo Teräs 12bdec38a3 solver, dot: elementary provides fixes
implementation is still not near finished, but now at least it
can handle it to a minimum degree. many cases are not done right
yet, though. ref #574.
2012-02-24 18:29:30 +02:00
Timo Teräs 99145e2c0d all: introduce apk_provides and use it in apk_name
in preparation for provides support. implements also some
dependency satisfaction helper routines.

ref #574.
2012-02-24 16:31:40 +02:00
Timo Teräs ba3ee3f863 audit, db: add etc/apk/protected_files.d and new audit features
fixes #607.

audit is now mostly rewritten for the new functionality. And
has new features like --check-permissions, --recursive and
--packages.

$ROOT/etc/apk/protected_files.d/*.list can now contain additional
protected paths, one path per line:

+etc
@etc/init.d
-tmp

+ will include the directory as protected configuration directory.
@ considers the directory protected, but will backup only symlinks.
- removes any protection

lbu should be modified to put include and exclude paths in
etc/apk/protected_files.d/lbu.list. Additionally, some packages
might provide their own listings.

E.g. ssh might want to provide ssh.list with something like:
+root/.ssh
+home/*/.ssh
2012-02-23 15:05:06 +02:00
Timo Teräs 77e203bf32 db, io: load repositories also from etc/apk/repositories.d/*.list
Load additional repositories from $ROOT/etc/apk/repositories.d/*.list
unless --repositories-file is given as parameter.
2012-02-22 13:57:05 +02:00
Timo Teräs bf82e2e5fd db, solver, io: scan cache items at startup
It is faster to just scan the cache directory for existing packages
at startup than trying to faccessat() them on demand. It also makes
quite a few parts of the code more readable and simpler.
2012-02-22 08:45:40 +02:00
Timo Teräs 41fb3a4f9e solver, db: repository pinning improvements
* solver internally calculates now using tags; not repository masks
* installeddb now contains the tag name where the package came from
  -> we can now handle upgrades properly
* the pinning is still a preference, and not strictly enforced;
  versioned dependencies may overrule preference
2012-02-15 13:57:36 +02:00
Timo Teräs 97bd260bfd db: record file uid/gid/mode in installed db 2012-02-14 15:51:26 +02:00
Timo Teräs 29ebf435d7 db: smarter handling of directory owner, group and mode 2012-02-10 15:21:41 +02:00
Timo Teräs 304dc4a692 pkg, db: fix signature checking for files without control part
Also clean up handling of signature failures for index files.
2012-01-31 15:49:04 +02:00
Timo Teräs b3df78ed03 solver, upgrade: properly detect missing repository tags
* upgrade needs explicit check so we don't try self-upgrade
   (which would print additional messages on screen)
 * add can fix problems, so check against the new world
 * merge the code in few places
2012-01-17 14:48:22 +02:00
Timo Teräs 1f9a36de68 db: support line feed as 'world' dependency separator
* default writing the world with spaces if a space is found
   (for backwards compatibility) for now
2012-01-12 14:33:29 +02:00
Timo Teräs 30965aa867 solver: print repository tag when committing package changes 2012-01-12 11:33:04 +02:00
Timo Teräs f1de353b81 db, solver: refuse committing changes if there is missing tags 2012-01-12 10:42:27 +02:00
Timo Teräs 34756e6b87 solver: report number of (mega)bytes used 2011-12-27 14:06:03 +02:00
Timo Teräs 500f8d4a7d solver, db: implement repository pinning
Improves /etc/apk/repositories format so you can say:
http://nl.alpinelinux.org/alpine/v2.3/main
@edge http://nl.alpinelinux.org/alpine/edge/main
@testing http://nl.alpinelinux.org/alpine/edge/testing

After which you can pin dependencies to these tags using:
 apk add stableapp newapp@edge bleedingapp@testing

Apk will now by default only use the untagged repositories,
but adding a tag to specific dependency:
 1. will prefer that tag for the name
 2. allowing pulling in dependencies from that tag (though,
    it prefers untagged packages to satisfy deps if possible)

fixes #575
2011-10-29 05:18:21 +03:00
Timo Teräs e34d2ed5fd solver, db: run triggers in dependency order
fixes #738
2011-09-14 11:30:35 +03:00
Timo Teräs f51aa6d42d upgrade: reimplement self-upgrade (after solver merge) 2011-09-14 10:57:51 +03:00
Timo Teräs 1817b0a3c3 all: update copyright year statement 2011-09-13 11:53:01 +03:00
Timo Teräs a5a7021658 applets: start using solver code
still todo:
  - 'fix' is missing
  - 'del -R' does not work
  - 'upgrade' does not do self-upgrade first

... and a lot of testing.
2011-09-09 16:32:31 +03:00
Timo Teräs 169cb3a97e dot: applet to generate the dot attributed graph language files
This applet can be used to generate data for graphviz tools.
Useful to visualize package dependencies, and possible errors
in the repository.

Usage examples:
  apk dot gnome-desktop | tred | dot -Tpng gnome-desktop.png
    -- to generate simplified dependency chart of gnome-desktop
  apk dot --errors | dot -Tpng index-errors.png
    -- to generate chart visualizing dependency errors in index
2011-07-24 14:56:52 +03:00
William Pitcock 384eada8af apk_database: add APK_DEFAULT_ARCH for ppc, ppc64 and arm ports 2011-07-16 04:31:27 -05:00
William Pitcock 37a682e560 apk_database: move APK_DEFAULT_ARCH to headers so that we can use it in version(). 2011-07-16 04:28:41 -05:00
Timo Teräs 95555ede4d db: more fix for read-only cache remounting
remount to read-write before trying to create the cache directory
subdirs. fix a fd leak that might prevent remounting back to rw.
2011-05-27 16:49:25 +03:00
Natanael Copa cec1fa2b0f db: Allow override arch when using --root
This is so we can do x86 --root installs on x86_64 hosts.

Using --arch without --root can make great damage so we only enable it
if --root is used.
2011-04-14 19:59:01 +00:00
Timo Teräs 91c4cc6c18 fetch: fix fetching of packages with arch 2011-04-07 14:14:27 +03:00
Timo Teräs 415e230a7f db, cache: automatically remount cache read-write when needed
.. and back to read-only after finishing with modifications.

fixes #512
2011-03-16 14:56:13 +02:00
Timo Teräs 1e17da9d70 db: handle arch similarly to stable branch
if package arch is not set, do not append anything to repository.
if arch is set, it is appended to repository.
2011-03-16 14:56:13 +02:00
Timo Teräs 28dcd5d3b3 pkg: recognize install_if
Parse install_if from package metadata and include it in the
indexes. Also setup the reverse install_if dependencies when
loading a database. ref #443.

Actual install_if functionality is not yet implemented.
2011-01-04 10:05:20 +02:00
Timo Teräs d8ba07e484 pkg, db: allow index with unsupported features to be loaded
Just disable installation of packages using the new stuff. Also
flag lower case package info fields as non-critical and allow
installation even if that features is not supported.
2011-01-03 21:06:41 +02:00
Timo Teräs 972bec3210 various: use 'atoms' for certain package field and misc fixes
- implement a hash table for commonly shared fields such as
   license, version and architecture
 - use macroes to print blobs or pkgname-pkgver strings
 - fix some old cruft
2010-12-14 19:51:16 +02:00
Timo Teräs fca1c30b80 pkg, db: add preliminary support for arch field
Architecture is now:
 - parsed from .PKGINFO
 - written to index and installed db
 - appended to repository URL when fetching files
2010-12-14 17:06:29 +02:00
Timo Teräs 6e34f048c7 db: remove support for unsigned repository index
Unsigned indexes should not be needed anymore anyway.
2010-12-10 16:42:25 +02:00
Timo Teräs 37e8f803a5 db: fix hash lookups on 64-bit machines
The hash is 'unsigned long' everywhere which is 64-bits (on 64-bit
boxes). Fix the one instance of it being 'unsigned int' since that
would be 32-bit and cause lookup failures on 64-bit boxes.
2010-11-23 11:32:42 +02:00
Timo Teräs 19419f1a88 io, db: id cache should be specific to database root, not system root
Otherwise we end up using wrong uid/gid mappings when doing install
to alternate system root. Fixes #434.
2010-10-08 15:36:54 +03:00
Natanael Copa 36d1bfb4ed db: make apk_wait a part of dbopts 2010-06-11 07:02:18 +00:00
Natanael Copa 3ec82a5a42 First steps for libapk 2010-06-11 07:02:18 +00:00
Timo Teras ef7d467083 fetch: do not include installed non-repository files in search
we do not create mirror repositories from other valid repositories,
not from what was installed locally.
2010-03-04 14:01:37 +02:00
Timo Teras 58e771303c index, version: support for repository descriptions (fixes #141)
ability embed description information to repository indexes
(e.g. repository name and version) and show it via "apk version -I".
2009-09-03 14:56:24 +04:00
Timo Teras 892395d594 add: refuse to add bad dependencies to world
allow also overriding old (possibly bad) world dependency.
hopefully it's more bullet proof now.
2009-08-13 16:02:02 +03:00
Timo Teras 279513bfbe db: implement triggers (fixes #45) 2009-08-13 14:10:30 +03:00
Timo Teras 36b5cee98b db, pkg: separate structure for fields of installed packages
this makes the database package entry smaller, and we propbably
get more fields to installed_package later too. this cleans up
the way scripts are stored and is a preparation for supporting
triggers. some parsing for trigger meta-data. ref #45.
2009-08-12 19:17:46 +03:00
Timo Teras f02f326238 db: prefer local repositories, and implement --no-network
this helps boots sequence when network is not available.
2009-08-06 16:00:20 +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 1fea5639b4 fix: new applet to reinstall and fix package
also makes it possibly to upgrade package without adding it to
top-level deps. fixes #69.
2009-08-04 15:19:29 +03:00
Timo Teras ea90152664 apk: use *at instead of chdir+normal file syscall
this way we never change cwd, and relative filenames are always
parsed consistently. this also helps filename construction in many
places. this patch also changes '--root' to override location of
all configuration to be in the new root. previously it depended
on the file which one was used.
2009-07-31 16:08:09 +03:00
Timo Teras 5b48b85560 audit: protection mask for "symlinks only"
and use it for /etc/init.d by default. fixes #99.
2009-07-30 10:42:20 +03:00
Timo Teras c8c52e1dc6 db: remove APK_NAME_VIRTUAL flag
use the package 'installed_size' == 0 as a test instead for
dependency only packages.
2009-07-24 14:02:56 +03:00
Timo Teras e5be34335c db: create cache index with non-repository packages
this enables virtual packages and files specified from command
line to work on non-harddisk installs.
2009-07-24 14:00:57 +03:00
Timo Teras 718ef3079e add: fixes to installing non-repository package
make sure cache is enabled on non-permanent rootfs setups.
some optimizations and fixes too.
2009-07-22 20:47:21 +03:00
Timo Teras 2345548e45 index: read also new style index files 2009-07-21 17:59:08 +03:00
Timo Teras eca9c22205 db: signed index loading (ref #46)
prefer index in the new format as signed .tar.gz.
2009-07-20 11:13:03 +03:00
Timo Teras 6b471bb614 various: new style index generation
change the index generation to do old index, or the new style index
where package identity is sha1 of control block and it's contained
within an .tar.gz to allow signing in future.
2009-07-16 15:16:05 +03:00
Timo Teras 981bc118f8 db: live with sha1 and md5
this also convers scripts file to a tar archive.
2009-07-14 19:14:05 +03:00
Timo Teras ab37bd0b0c db: speed up fdb creation
avoid recalculating hashes, and store the lengths of names, so
we can optimize some operations.
2009-07-14 11:55:08 +03:00
Timo Teras f1985b03bd hash: allow caching of hash value 2009-07-14 10:47:20 +03:00
Timo Teras 4562f44f9b bstream: make tokenizable and load index using bstream
some fixes on index reading code too.
2009-07-14 09:33:47 +03:00
Natanael Copa fa47cadb98 db: removed apk_repository_update_all() as its no longer needed
We use APK_UPDATE_CACHE apk_flag instead.
2009-07-09 06:25:27 +00:00
Timo Teras 1a54de02b5 db: open flags revisited
more fine grained control what to load, and rename some of the
flags to be shorter.
2009-07-07 09:27:56 +03:00
Timo Teras 9858ffff69 cache: new applet (ref #49)
Administrative tool to download or delete files to/from the cache.
2009-06-29 11:22:55 +03:00
Timo Teras 233918e518 db: cache packages (ref #49)
If /etc/apk/cache is a symlink to directory, a copy of all installed
packages is stored there, and the index of remote repositories will
be there instead of /var/lib/apk. This enables to reconstruct running
system during boot.

Left as todo: remove cached copy when the package is removed, and
additional apk applet to download missing packages to cache and/or
remove extra items.
2009-06-29 09:29:57 +03:00
Natanael Copa cb074581f0 db: add function apk_repository_update_all
We might want to add an --update-index option to misc applets. For
example:

  apk add --update-index -u package
  apk version --update-index
2009-06-19 19:01:15 +02:00
Natanael Copa b91f9406da add: support for virtual meta packages
implements 'apk add --virutal metaname dep1 dep2...' where metaname will
be an empy meta package with dep1 and dep2 as dependencies.

This is useful to prevent abuild to add each makedepend to world which
causes some headache when it comes to unintalling them after sucessful build.
2009-05-14 12:01:09 +00:00
Natanael Copa 2b6e5d6e40 index: support for -d to delete packages from given index
The syntax is: apk index -d /path/to/APK_INDEX.gz pkg...

It does not seem like its possible to remove packages in the db so we
trick apk_db_index_write() by setting the repo to on-zero.

It's still not perfect since it does not recalculate the dependencies.
2009-05-12 06:27:25 +00:00
Natanael Copa b0921ebac5 info: do not read the repositories as this tool only query the statedb
This allows you to query the state db even if you do not have write
permissions in cache dir (which is needed if you have remote repositories)

This should speed up things and save some memory if you have big and slow
remote repositories.
2009-04-21 11:39:16 +00:00
Timo Teras 4c2bfd9ded db: cache index files, 'update' applet
Cache non-local index files always locally.
Introduce 'update' applet to force refresh of cached index files.
Fixes #19.
2009-04-16 20:05:22 +03:00
Timo Teras 9567337fd2 fetch: new applet to download .apk files
Fixes #24.
2009-04-15 09:56:09 +03:00
Timo Teras a23f6f4afb state: rework changeset calculation algorithm
Calculate changesets directly by stabilizating the package graph instead of
recalculating the whole graph and then diffing (similar approach as seen
in 'smart' package manager). The algorithm is not complete: defferred
search space forking is missing. So you don't always get a solution on
complex graphs.

Benefits:
- usually the search state tree is smaller (less memory used)
- speed relational to changeset size, not database size (usually faster)
- touch only packages related to users request (can work on partitially
  broken state; upgrades only necessary packages, fixes #7)

Also implemented:
- command prompt to confirm operation if packages are deleted or downgraded
- requesting deletion of package suggests removal of all packages depending
  on the package being removed (you'll get list of packages that also get
  removed if you want package X removed)
- option --simulate to see what would have been done (mainly for testing)
- an untested implementation of versioned dependencies and conflicts

A lot has changed, so expect new bugs too.
2009-04-14 18:48:02 +03:00
Timo Teras c11b70c7f0 db: track reverse dependencies
This will be used later by the commit change calculator (for improved
changeset calculation, ref #7). Will be also used by "apk info" to show
reverse dependencies or "required by" information.
2009-04-14 09:21:30 +03:00
Timo Teras a98b57b1ae db: database locking and creation to part of opening it
Add flags field to db open call. Also make error reporting quite a bit
more detailed.
2009-01-17 11:08:48 +02:00
Timo Teras 1b5422fb4a index: write out only packages specified in command line
Ignore /etc/apk/repositories, so additional repositories that depend
on other repositories need to have explicit --repository reference on
command line when generating the index (to avoid warnings).
2009-01-16 15:14:23 +02:00
Timo Teras 3e6fc1389f add: --upgrade|-u to control if upgrading is preferred or not 2009-01-16 13:59:36 +02:00
Timo Teras 2cfde12c89 audit: new command to check changed files
Currently only implement --backup to get list of (config) files in
protected directories to backup.

This also fixes a database corruption bug in database.c.
2009-01-14 19:48:30 +02:00
Timo Teras a59347fdac db: hash files by name, instead of keep two directory lists 2009-01-13 20:32:18 +02:00
Timo Teras b7f9f9bdb2 info: implement who owns packages query (apk_info -W)
In quiet mode e.g. "apk info -q -W <file list>" a list of dependencies
suitable for .PKGINFO is output in one line.
2009-01-13 15:22:14 +02:00
Timo Teras 3755e1cde3 apk: per applet options 2009-01-13 14:09:45 +02:00
Timo Teras 052fbe3f86 various: make fancy progress bar and update todo 2009-01-07 21:45:11 +02:00
Timo Teras 6b2b9d303e db: restructure in-memory organization 2009-01-06 21:23:26 +02:00
Timo Teras dc2ffc30e8 io: apk_ostream stuff 2008-11-28 16:28:54 +02:00
Timo Teras 5ea81ca564 add: add support to install packages not in a repository 2008-11-28 13:34:40 +02:00
Timo Teras 545a915faf db: rework 'files' to 'installed'
Make the db of installed packages more similar to index file and
reuse the code. Also rename the database file.
2008-11-28 13:15:06 +02:00
Timo Teras f0609951b9 hash, db: use apk_blob_t and list_* 2008-11-27 20:25:01 +02:00
Timo Teras 8e23a2ba4e db: checksum installed files, protect config files
Checksum of installed is computed on the fly when extracting them
and it'll be saved to fdb. When installing config files those are
diverted with suffix .apk-new if earlier version of same file with
local changes exist.
2008-11-14 14:26:59 +02:00
Timo Teras 384c2f1d94 Preserve uid and gid. Quiet flag to print dots on progress. 2008-04-22 06:04:20 +00:00
Timo Teras 823283edca Argument parsing. Some other stuff too. 2008-04-21 16:30:10 +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