Commit Graph

416 Commits (0b7d6dfbf2c7e54171719f4a427789962d365642)

Author SHA1 Message Date
Timo Teräs 73a03c2e40 db: allow replacing files of origin package is same
basically this makes packager's life simpler as there is no need
to list the subpkg names in replaces. this was also very error
prone and tedious job to do properly.
2014-04-25 22:17:49 +03:00
Timo Teräs d99e82c633 audit: include all files in etc/apk in overlay
This implements a new protected path flag '!' to include always
matching entries in the backup mode (overlay). This is also turned
on for etc/apk to include everything there in overlay, because
the full list of repositories and signing keys need to be in
overlay - just getting them from a package is not enough during
bootstrap.
2014-03-12 09:08:26 +02:00
Timo Teräs a6c4103df5 db: allow using cached packages with --no-network 2013-10-02 16:06:10 +03:00
Timo Teräs 74c4c95976 db, url: fix exec sentinels
http://ewontfix.com/11/
2013-10-01 16:22:29 +03:00
Timo Teräs 2721772488 db: minor improvements to an error and a verbose log messages 2013-09-20 21:54:33 +03:00
Timo Teräs cecb810746 db: fix error message 2013-09-20 21:31:29 +03:00
Natanael Copa 21d4e9243a db: fix segfault when --root points to invalid dir
fixes #2134
2013-07-17 08:30:53 +03:00
Dubiousjim ac7616b0a9 various: applet help text and comment fixes
Acked-by: Natanael Copa <ncopa@alpinelinux.org>
2013-06-28 13:45:41 +03:00
Timo Teräs a2fa544ac6 db: write ipkg flags in proper place 2013-06-21 11:48:15 +03:00
Timo Teräs 654ddbf05f db: reset broken pkg state on reinstall 2013-06-21 11:45:03 +03:00
Timo Teräs 3f27da2ade solver: fix pinning+cache to work
Mistakenly allowed masked out package to be installed if it was
in cache.
2013-06-20 14:08:16 +03:00
Timo Teräs 7e18398781 commit, db: make file conflicts and script errors non-fatal
fixes #1482
2013-06-20 13:12:44 +03:00
Timo Teräs 6da083fc24 all: few behavioural regression fixes
Wildcard matching with no names should match all packages only for
info and search applet. "apk del" would otherwise try to delete
everything, etc.

Fix also interactive mode to ask questions only if we are actually
changing something.
2013-06-19 20:56:18 +03:00
Timo Teräs 5725f656b0 policy: new applet
to show different versions of package and the repositories from
which it is available from.
2013-06-18 14:54:18 +03:00
Timo Teräs 98c6b46de6 db: store repository tag names including leading @ 2013-06-18 14:30:44 +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 54509e7a1a all: various conversions to foreach_array_item, and simplifications of code 2013-06-18 08:03:40 +03:00
Timo Teräs 656190b0a0 io: get rid of APK_PROGRESS_SCALE
no need to muldiv all the time, just pass the current amount of bytes
done, and let callbacks use that directly.
2013-06-17 17:28:03 +03:00
Timo Teräs ade8d0b4e9 cache: implement progress bar (ref #1170) 2013-06-17 17:13:14 +03:00
Timo Teräs 0a13141889 print: move progress printing to common functions 2013-06-17 16:47:49 +03:00
Timo Teräs 92764088a2 db, cache: do not use cache/tmp for downloads
instead use prefix for temporary files.
2013-06-17 16:33:59 +03:00
Timo Teräs 9d10037807 db: refactor repository file construction
Fixes also 'fetch' applet to prefer copying/linking to files from
cache if possible.
2013-06-17 14:38:27 +03:00
Timo Teräs 59d15ab259 solver, errors: fix few additional test cases and clean ups 2013-06-13 21:59:08 +03:00
Timo Teräs b8c44536ca solver: rewrite as deductive solver -- core features
Implementing basic dependency handling, install_if and awareness
of pinning.
2013-06-13 18:22:00 +03:00
Timo Teräs 447b194b26 index: add sensible error message if metadata is too long
fixes #1476

Instead of:
ERROR: Index generation failed: Success

The following is now printed:
ERROR: Metadata for package timo-1.0-r0 is too long.
ERROR: Index generation failed: No buffer space available
2013-05-30 10:22:35 +03:00
Timo Teräs aec93ee730 db: unify handling of special packages
make cache a special kind of repository, and automatically cache
special packages (virtual packages, or ones installed from command
line). add test cases for handling virtual packages. fixes #1617.
2013-05-30 08:48:32 +03:00
Timo Teräs 035da87036 db, info: allow packages to install files/symlinks to root
fixes #1578
2013-05-29 14:37:42 +03:00
Timo Teräs 6a761c72e2 db: make dev/null a character device with --initdb
fixes #1714
2013-05-29 13:44:42 +03:00
Timo Teräs 43850a126b apk: implement --progress-fd to write progress to a specified fd 2012-09-20 15:12:15 +03:00
Timo Teräs 8a4371ccd7 db: remove AT_SYMLINK_NOFOLLOW for directory permissions
fchmodat does not support this flag - symlinks do not have permissions.

Sysadmin probably does not expect us to not follow symlinks either:
if /var -> /mnt/foo/var, we should be making sure the permissions
and ownership is correct on the target directory, not on the symlink.

Since fchmodat never returned ENOENT with AT_SYMLINK_NOFOLLOW, this
also fixes directory re-creation if it does not exist. fixes #1348.
2012-09-04 10:38:13 +03:00
Timo Teräs ea5b08d1d5 audit: fix protection mask of non-db directories
If a directory has protection mask, but does not exist in db, we
do not handle it right unless we calculate the protection mask by
hand, or create temporary db dir entry for it. For simplicity create
always the db dir entry -- depending on audit type we likely need
to create it anyway. This commit also caches the db dir entry in the
audit tree context to avoid duplicate lookups. ref #1241.
2012-07-16 14:44:15 +03:00
Timo Teräs 38c1e65afb db: strip leading and trailing slashes from protected path spec 2012-05-01 14:30:06 +03:00
Timo Teräs ff83382e21 db: fix has_protected_children setup on leaf path entries
Fixes --recurse during audit.
2012-04-27 08:09:59 +03:00
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 9ef5bf6e2d pkg, db: use 's' for source repository tags instead of 'p'
Will use 'p' for provides.
2012-02-24 09:22:42 +02:00
Timo Teräs 7392acb95e db: keep architecture in $ROOT/etc/apk/arch
This we use proper arch in case modifying chroot installation.
2012-02-23 17:04:51 +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 a1d16c5d5d db: fix repositories.d to be loaded only without --repositories-file 2012-02-22 17:08:07 +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 8e5c040ffd db: merge identical repositories
Just in case same repository is mentioned with different tags.
2012-02-22 09:52:28 +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 a9d526836e apk: fix some unharmful leaks reported by valgrind 2012-02-17 10:02:44 +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 087c587e57 db: allow directory to have sticky bit, and suid/sgid bits set 2012-02-10 23:08:10 +02:00
Timo Teräs 9ac8d87102 db, fix: more secure way to choose effective directory permissions
And implement --directory-permissions for fix-applet to reset all
directory uid, gid and modes.
2012-02-10 16:40:01 +02:00
Timo Teräs f2e41a488e db: fix directory permissions recalculation 2012-02-10 15:58:35 +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 fe9b4a3888 blob: optimize spn and cspn 2012-02-08 17:01:14 +02:00
Timo Teräs 3320fba50d db: increase hash sizes 2012-02-08 14:02:51 +02:00
Natanael Copa 7d88cdc9e4 db: do not abort on bad repositories
Only show a warning if we have a non-existing repository or bad
repository signature but don't abort.

This is not to break compat with behaviour in previous releases.
2012-02-01 17:04:06 +01:00
Natanael Copa ddd386157c db: fix bug with --repository
The 'r' variable is overwritten and no longer holds the repository
number.
2012-02-01 13:41:25 +01: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 60ee611620 db: print dependencies referring to missing tags instead of tags 2012-01-17 10:53:35 +02:00
Timo Teräs fc57b73101 db: fix loading of world after previous commits 2012-01-16 10:29:49 +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 3e8dc3da09 db: properly detect when pkg install trigger needs executing
call apk_pkg_install() and hlist_tail_ptr() only once. the latter
is O(n) and can get very slow.
2012-01-06 10:35:04 +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 8d4d68d818 pkg: convert struct apk_install_package flags to bitfield 2011-10-19 15:26:55 -04:00
Timo Teräs 89d003f8c2 pkg: introduce "replaces_priority"
If two packages replace each other, the one with highes priority
will keep the file. Additionally, if we have a package overriding
another's file it's remembered and handled properly. This is
essentially to allow "policy packages" which just overwrite certain
(configuration) files from other package(s).
2011-10-19 11:38:23 -04:00
Timo Teräs a787038dbe pkg, info: remember installed packages "replaces"
"replaces" is now turned to a full dependency type list, so you can
make package overwrite files only certain versions of the package
(though, we should probably take this into account already at solution
calculation phase).

Also make 'info --replaces' print the "replaces" of the package.

This is in preparation for the policy package support, which still
requires "replacement priority" field to decide which packages' files
get the preference.
2011-10-18 18:11:26 -04: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 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
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 433da92e37 index: handle errors instead of silently failing
Make indexer keep noise about errors that prevent index generation.
Detect certain errors in the APKs better. And also have the applet
return error in these scenarios.
2011-06-28 15:40:52 +03: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 38e54240a3 db: remount read-only after the file handles have been closed
The apk cache might be on the readonly media so we need wait with
remounting til after atleast this filehandle is closed.
2011-05-27 11:38:50 +00:00
Timo Teräs c5de3cdc4c db: fix post-install script error message formatting 2011-05-23 15:32:32 +03:00
Timo Teräs 9901058891 db: remount ro cache to rw earlier for update to work 2011-04-22 11:24:33 +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 8e01be4777 apk: fix gcc 4.6 warnings 2011-03-27 02:51:51 +02:00
Timo Teräs 93eb38a31a db: relocate from /var/lib/apk
move all files therein to other places. this allows /var to be
mounted from harddisk, but rest of system be run from ramdisk.

this also removes support for historical version of the scripts
database which was obsoleted in 2.0_pre16 (in July 2009).
2011-03-16 16:53:07 +02:00
Timo Teräs 2222a15edd db: move lock file to /var/lock
in accordance with FSH. this also to clear /var of apk related things
as we might want to run /var as harddisk, but rest of system from
ramdisk.
2011-03-16 15:39:36 +02:00
Timo Teräs 5d64bc5d8c db: fix cache tmpfs detection
comment out the code that was out for testing. duh.
2011-03-16 15:21:41 +02: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 15badbfd97 db: detect tmpfs better
Use statfs() filesystem type, instead of the device IDs.
2011-03-16 14:56:13 +02:00
Timo Teräs 1c6ab67984 db: fix package caching 2011-01-21 09:37:19 +02:00
Timo Teräs 0e450c5fb6 add: use default arch instead of noarch, improve errors
Packages without architecture should get the platforms default
architecture (so we are backwards compatible). Only the virtual
packages should get 'noarch' by default. Also print full path
to the index file which failed.
2011-01-05 14:33:16 +02:00
Timo Teräs 94ce7f01bf db: check and initiailize required package fields before addition to db
The atomization change broke virtual packages because they don't
have license or arch set.
2011-01-04 11:45:34 +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 6e89c1d5b7 db: print full url/filename of the failing package
.. instead of the pkgname-pkgver string.
2010-12-09 11:10:12 +02:00
Timo Teräs 6398d338c6 db: fix the previous commit
id cache needs to be initialized early. and group database filename
is surprisingly 'group'.
2010-10-08 16:09:03 +03: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 5c4583a902 db: optionally remove dirs when unref
We want remove dirs when they are unreferenced so we remove all dirs on
apk del, but we don't want remove dirs when closing database. So we make
removing dir optional when unreferencing it.

This partially reverts commit c7ffc96a16.

fixes #406
2010-09-22 14:34:35 +00:00
Natanael Copa b4adf7645f Fix building on eglibc
Seems like recent eglibc requires that you include sys/stat.h
2010-08-30 13:04:25 +00:00
Timo Teräs ec6359732d db: reinitialize trigger_pkg_list node after deletion
The trigger list can be reused after it's cleared, make sure
the list node is initialized all the time.
2010-06-15 14:40:46 +03:00
Timo Teräs 8b317678e3 db: --simulate never needs write access to db
So open the db in read-only mode instead. This allows --simulate to
be run as non-root user.
2010-06-12 13:48:42 +03:00
Timo Teräs 43cb554c3f various: use O_CLOEXEC and add some error checking 2010-06-11 13:42:21 +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
Natanael Copa 60b537e356 db: do not free trigger list after package is unpacked
The triggers are read during apk_db_unpack_pkg(). If we delete the
triggers list after then unpack we delete the triggers which is not
what we want.

This fixes bug introduced in ce3cf8bff9
2010-06-10 17:50:11 +00:00
Timo Teräs f85d87e5f9 db: fix usage of apk_name_array in install_ctx
got broken to the previous array cleanup and grepping struct
definition only from headers.
2010-06-07 17:45:04 +03:00
Timo Teräs 7be853e637 all: rework how arrays work
Instead of having a null pointer, use a dummy array which just
says the array is empty. This helps in multiple places of the code
which would otherwise need explicitly need to check first if the
array exists. This has been cause of multiple seg.faults in the
past as the array check is easily omitted.

This also removes (or fixes) all existing checks accordingly.
2010-06-05 12:33:54 +03:00
Timo Teräs ce3cf8bff9 db, pkg: fix triggers related crash
clean up the triggers properly, in proper order.
2010-06-01 16:46:53 +03: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 49f5d8cb01 db: fix previous commit
add the missing variable.
2010-03-01 11:26:45 +02:00
Timo Teras fcdb316ab7 db: read also non-repository package index if reading repository indexes
otherwise regeneration of non-repository index might go wrong or we
might delete too many files from cache when doing 'cache clean'.
2010-03-01 11:20:17 +02:00
Timo Teras 3f9fe4c28b db: keep packages with no files with installed status
got broke few commits ago when apk_pkg_installed() call was
moved to happen after the package name has been read.
2009-12-25 14:15:10 +02:00
Timo Teras b58ec46f7c db: make fdb load package description before calling pkg_install
this is now mandatory after the overlay fixes. otherwise the
package will not get listed as installed.
2009-12-22 17:33:44 +02:00
Natanael Copa d4f0b2ab70 db: check the overlay files package name rather than the ovl file itself 2009-12-21 16:39:53 +00:00
Timo Teras 884fabbf30 db: honor overlay file even for protected paths 2009-12-21 18:12:45 +02:00
Timo Teras 6417de4d10 apk: remove the unneeded --never-overwrite
turns out the logic does not work with overlays as expected due
to busybox symlinks being unmanaged. remove the useless option.
2009-12-21 16:53:47 +02:00
Timo Teras f44f34811d db: accept files in overlay without directory
appears this is possible, so support it.
2009-12-21 16:31:58 +02:00
Timo Teras f2a7800b22 db: use proper instance for overlay file entries
lookup proper directory instance as the tar output might not be
linear.
2009-12-21 14:30:33 +02:00
Timo Teras d0909569c6 apk: --overlay-from-stdin
get list of overlay files from stdin, so those do not get overwritten.
2009-12-21 14:14:02 +02:00
Timo Teras 366e7d07ae db: read time only once when writing scriptsdb
less syscalls.
2009-12-21 11:42:39 +02:00
Natanael Copa 407ef801d9 db: check if target exist before renaming tempfile
do not overwrite target if we have --never-overwrite and target exists.

ref #197
2009-11-24 08:25:24 +00:00
Timo Teras a7360395ea db: fix migration and pruning of symlinks to dirs
the old code treated a symlink to directory as file; it tried
to calculate regular has of it. fix this by: 1) using no follow
on migration and pruning stats, and 2) the helper function to
check if it's point to directory and not calculate hash in that
case. fixes #188.
2009-10-26 09:46:09 +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 9e71df3cf3 db: cache needs to be on non-tmpfs
check device major if it's tmpfs and refuse to use cache if
we've been fooled.
2009-08-13 20:27:33 +03:00
Timo Teras e20ce5a9c0 db: fix script arguments
the first item is place holder for argv[0] = script name. it's
overwritten by the apk_pkgi_run_script.
2009-08-13 19:21:31 +03:00
Timo Teras 6c96730cdf add, del, db: fix various bugs introduced by earlier commits
- make virtual packages work again
- make apk del (for non-empty packages) work again
2009-08-13 18:41:03 +03:00
Timo Teras 279513bfbe db: implement triggers (fixes #45) 2009-08-13 14:10:30 +03:00
Timo Teras 05f016481a db: fix some (unimportant) memory leaks 2009-08-12 19:29:14 +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 dee6ffa492 io: better error handling when writing stuff out
also have the output stream support writing to temporary file
and do renameat/unlinkat on close depending on if all writes
succeeded or not.
2009-08-12 11:05:09 +03:00
Timo Teras bd9835a20e archive: update for new place of checksum in tar header
and take checksums for symlinks too.
2009-08-11 19:57:30 +03:00
Timo Teras addae04c26 db, audit: audit symlinks (by hash of the link target) 2009-08-11 19:02:22 +03:00
Timo Teras 949d375aa9 db: fix checking of non-repository files from cache
otherwise, non repository files present in cache are not
considered for installation (e.g. when booting from cdrom).
2009-08-11 18:28:22 +03:00
Timo Teras 5d19789a3b pkg, db: execute scripts from /var/cache/misc (fixes #129) 2009-08-11 17:56:24 +03:00
Timo Teras 1011c4e346 db: fix previous commit 2009-08-11 16:01:29 +03:00
Natanael Copa 6dd59d7817 db: ignore empty lines in /etc/apk/repositories
fixes #127
2009-08-11 09:22:12 +00:00
Timo Teras bc93eaffb0 db, pkg: fix package verification during installation
some hooks to package verification code were missing causing the
verification to not be done (causing pre-script to be not run).
fixes #124, #126.
2009-08-10 08:47:05 +03:00
Timo Teras bf7b80662d state: do not look into world in state_new
instead enforce world dependencies when the package name
is first referenced upon.
2009-08-06 16:39:09 +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 fac43e2d60 db: make missing index non-fatal
it's a warning not an error to have non-existant repository.
bad signature means tampering; but we might want to just ignore
those. this is especially important if we have http repositories
and we are bootstrapping (without network).
2009-08-06 13:12:26 +03:00
Timo Teras 6f1de8cd53 db: command line repositories take preference
over the ones in config file. also remove the apk_root == NULL
check as this cannot happen anymore. a valid root is always
required.
2009-08-06 10:17:28 +03:00
Timo Teras a602c49b31 db: support "replaces" directive (fixes #113)
it will allow to overwrite files owned by some other packages
to get upgrades right (e.g. when splitting or renaming packages)
2009-08-04 16:54:15 +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 8c19869c29 db: return hard error if repository opening fails
otherwise we can accept unsigned repositories, and install bad
packages.
2009-08-04 11:08:19 +03:00
Timo Teras 1029d15ecd db: jump through hoops to get checksums for hardlinks
should really fix abuild-tar.
2009-07-31 20:05:04 +03:00
Timo Teras 123226bad2 db: load cache's installed index only if cache is active
other wise cache_fd points to var/lib/apk and contains the real
installed db causing it to be loaded twice.
2009-07-31 19:35:08 +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
Natanael Copa fe43d8ab1d db: allow update of untrusted index 2009-07-30 19:16:37 +00:00
Timo Teras c1fe6d08f3 db: fix checksum storing to db
also take precautions in audit code if the db is missing the
checksum.
2009-07-30 11:55:59 +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 f482701eee db: fix protected directory handling (fixes #89)
we don't want to do checksumming of existing files unless it's
in a protected directory. also, we keep the original file if it's
*modified*.
2009-07-29 19:39:59 +03:00
Timo Teras 7b05eef61f tar: make checksumming of inner files conditional
and force checksumming only when unpacking archive. otherwise
it's extra computation for nothing.
2009-07-29 19:16:04 +03:00
Timo Teras 195859b3fd db: fix repository write locking 2009-07-24 14:12:59 +03:00
Timo Teras e1b489c8b5 db: increase required verbosity for filename prints 2009-07-24 14:04:57 +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 042879f417 index: fully process archive when reading index for signature check
can't cancel an index reading or we lose signature checking.
2009-07-23 11:41:10 +03:00
Timo Teras a388f4bfa6 index: more informative error message
when failed to load an existing index.
2009-07-23 11:35:40 +03:00
Timo Teras 90aaa28a95 apk: add --purge option (fixes #61)
and do not remove modified configuration files unless --purge is
specified.
2009-07-22 21:34:25 +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 23582a0ec5 db: honour clean-protected flag again 2009-07-22 16:00:14 +03:00
Timo Teras 93f0b3524c various: more informative error messages 2009-07-22 14:56:27 +03:00
Timo Teras 0a7991f70d various: misc fixes
- error codes for verification failure types
- fix some fdb corruption on file migration
- combine some dependency parsing code
- fix versioned dependencies
2009-07-22 14:24:19 +03:00
Timo Teras 0dadc27ce1 db: fix protected directory handling
do not overwrite untracked files.
2009-07-22 12:00:56 +03:00
Timo Teras 680a301511 various: installation fixes
- extract everything as .apk-new and overwrite only after data
  has been checksummed
- url construction fixes (to work with simple http servers)
- end of gunzip stream fixed
- remove oneshot digesting flag for now as it's usage was broken
2009-07-22 11:36:55 +03:00
Timo Teras 772e4aa26a various: fix installation of new style apks 2009-07-21 18:25:22 +03:00
Timo Teras 2345548e45 index: read also new style index files 2009-07-21 17:59:08 +03:00
Timo Teras 75802cb07d db: increase hash sizes a bit 2009-07-21 14:26:06 +03:00
Timo Teras 1339b14365 db: don't run pre-install until control data is verified
to make sure the scripts have not been altered.
2009-07-21 14:06:35 +03:00
Timo Teras 84e3786e05 db: fixes to package checksumming while installing it 2009-07-21 13:49:35 +03:00
Timo Teras 89d1abe4e6 db: write errors about repository update (fixes #70) 2009-07-20 11:41:45 +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 e30834fdcb digest: use oneshot context flag where approriate
speeds up digest calculation on some cases.
2009-07-17 15:56:09 +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 0f6d96a4f5 gzip: always autoclose the inner stream 2009-07-16 13:47:26 +03:00
Timo Teras 6715a0ba12 pkg: remove support for the deprecated .INSTALL script 2009-07-16 08:52:22 +03:00
Timo Teras 623bc9c5a8 index: reuse existing index (fixes #25)
replace the old 'delete' option, with 'index'. the idea is that
one can provide existing index files to take cached meta-data of
the package from (assumes package has not been modified if index is
newer, and package size has not changed).

this way one always gives the list of .apk files to include in
the new index, and the old index is used only as "cache".
2009-07-15 16:47:43 +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 e9eaedff50 db: remove debug print
was left there unintentionally while debugging stuff.
2009-07-14 17:44:31 +03:00
Timo Teras 8d1eeb58e4 blob: some helpers to replace snprintf
snprintf is dog slow. make the blob stuff have some helper functions
so we can use them in code paths that are executed often.
2009-07-14 13:27:21 +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
Timo Teras e69b81f525 io: move csumming away from bstream to gunzip
in future we want to checksum on gzip boundary basis, not the
full file.
2009-07-13 20:37:03 +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
Natanael Copa 080fa825dd implement --update-cache option
This will update the repository cache upon db_open.
2009-07-09 06:08:44 +00:00
Timo Teras f1125dfcde db: check cache directory early
we need to know if caching is enabled, before the repositories are
added. otherwise the cache is not used properly at db opening time.
2009-07-08 16:19:53 +03:00
Timo Teras bf094dc5ea csum: use openssl instead
instead of having static md5 implemenation, use the openssl
library for digest functions.
2009-07-08 10:45:49 +03:00
Timo Teras c84196e0d3 apk: add --wait option to wait for exclusive lock (fixes #26) 2009-07-07 10:30:54 +03: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
Timo Teras fac4cdb3fa blob: function to checksum a blob
And use it in couple of places. Some whitespace fixes too.
2009-06-28 18:52:40 +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 9e58b2dd55 db: warn rather than fail with error if a repo index fails to load 2009-05-19 09:39:57 +00:00
Natanael Copa 250dee4101 db: fix bug that made inverted new installs and upgrades
We upgrade when we have an oldpkg.
2009-05-18 14:22:43 +00: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
Natanael Copa 74b5e4f535 db: do not assume root ends with '/' 2009-04-21 08:51:18 +00:00
Natanael Copa 9d22718d1d db: improve error reporting
apk_db_add_repository does its own error reporting and does not set errno
reliable. This patch also tell which repository it failed to load the index
for rather than just say it failed to open "APK_INDEX.gz" which does not tell
much.
2009-04-21 08:17:17 +00:00