Commit Graph

1231 Commits (272784636112c84b57b3bd4742ab9f0235abe5b8)

Author SHA1 Message Date
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 812483515a pkg: fix indexing of multi-part apks 2009-07-21 17:37:44 +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 be8b59dbe1 gzip: fix finalization of compressed output
the unflushed data when closing file can be several thousand kiloes,
loop until all is written out.
2009-07-20 15:20:37 +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 99be653f14 pkg: filenames with '/' cannot be control data 2009-07-20 08:56:53 +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 0942832325 index: fix output file permissions, verify signed index (ref #46) 2009-07-17 14:29:02 +03:00
Timo Teras 65be7ade1d pkg: remove debug prints 2009-07-17 14:09:52 +03:00
Timo Teras d694025b91 pkg: fix index generation
that got broke during verify implementation.
2009-07-17 14:06:43 +03:00
Timo Teras 3f4f9e9957 verify: new applet (ref #46)
an utility to check package signature and integrity.
2009-07-17 13:07:52 +03:00
Timo Teras 50fed1063e pkg: .PKGINFO field for data checksum is 'datahash'
in future we might add datahashalg to specify the algorithm used.
2009-07-16 15:32:21 +03:00
Timo Teras 251656734d archive: use the abuild-tar mangled checksum if available
to speed up apk installation avoid calculating checksums.
2009-07-16 15:27:00 +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 ba76c5f48a cache: make cache cleaning work again properly 2009-07-15 15:59:06 +03:00
Timo Teras a7c5fda40a blob: base64 encoding and decoding
and prefer sha1 checksums to be stored in base64 encoded format.
2009-07-15 14:48:57 +03:00
Timo Teras bfabf8f8d9 pkg: fix package scanner to read whole archive
otherwise we don't get chechksum anymore after the changes to
support partial gzip checksumming.
2009-07-15 08:38:30 +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 e98d8253b9 blob: add some likelyness to help compiler optimizations 2009-07-14 14:08:15 +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 e00f5ea74a build: optimize with -O2 by default
also make the array code more explicit to have gcc optimizer happy.
2009-07-14 11:01:03 +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
Timo Teras b30024d2bd openssl: register engines, and use oneshot digest when possible
to actually get hardware acceleration if available.
2009-07-13 14:28:52 +03:00
Timo Teras 3cbccbaf99 gunzip: accept concatenated gzip streams
allow .apk to consist of multiple separate gzip streams which
are just concatenated together.
2009-07-10 13:53: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
Natanael Copa d931f9fe5c ver: implement --limit
Support for limiting output for only showing the packages who have
the status we are interested in. For example --limit '<' will only
list packages that have a newer version available.

While here, we also fix so packages that are not in any repository
are displayed with '?'.
2009-07-09 08:17:58 +02: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 a3d19b5c0d apk: initialize openssl
add all ciphers and built-in engines so we get e.g. hw acceleration
of sha1 when available.
2009-07-08 16:19:06 +03:00
Timo Teras b54ff5dd1e build: link zlib dynamically, use --as-needed
use pkgconfig of zlib instead of hard requiring it. and link in
the pkg-config libs with --as-needed as not all of the openssl
libs are really required.
2009-07-08 10:46:38 +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 1531192cb9 add: ignore install failures on 'apk add --force'
and use this option in initramfs, so we are likely to get an usable
environment even if some packages from world are missing. fixes #50.
2009-07-07 10:03:30 +03:00
Timo Teras 812a6a3167 ver: fix output indentation 2009-07-07 09:45:09 +03:00
Timo Teras dc5c436c5a cache: delete also wget temporary files
check for the full filename to match an expected pattern or
delete it (so we delete files with .new, .new.backup, etc.).
final part of remote package caching: fixes #49.
2009-07-07 09:40:59 +03:00
Timo Teras b551c3b081 cache: use changeset to figure out downloadables
that way we get the same result as the 'apk add world' at boot
time; it might differ from currently installed set (ref #49).
2009-07-07 09:33:13 +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
Natanael Copa 4d940c7932 fetch: respect --simulate option 2009-07-06 08:48:25 +00:00
Natanael Copa d313c5e3cb info: fix compiler warning on x86_64
printf %i does not work so well with size_t on 64 bit.
Use %zu which seems to be portable enough.
2009-06-30 09:43:58 +00: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
Timo Teras 7a29678aac help: auto construct help
And add some more verbosity to the help message.
2009-06-25 15:14:07 +03:00
Timo Teras 3a48856475 upgrade: add --available option
That will make the upgrade prefer packages available in repositories.
This is good if one want's to downgrade packages by removing an experimental
repository. Or to force re-install of locally built vs. repository version
when the package version are same, but checksum is different. Fixes #51.
2009-06-25 11:09:40 +03:00
Timo Teras 4d04bd8a46 upgrade: new applet
Currently just goes through all world dependencies and updates them
where possible (ref #51).
2009-06-25 10:31:05 +03:00
Natanael Copa 5eab547de6 package: removed debug code 2009-06-22 09:41:49 +00:00
Natanael Copa 5b75b40bf9 version: added apk_version_compare_blob() function
We want be able to compare blobs so we basicly revert the old change,
and make a wrapper that takes version strings.
2009-06-22 11:08:39 +02:00
Natanael Copa 4bbed2d648 ver: only compare the given packages, show version
make apk_version_compare() take strings rather than blobs
add apk_pkgversion_compare(), a wrapper that takes packages
2009-06-20 12:38:07 +02: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 b669e488ed info: support for -d, --description
and re-arrange the order of displayed info
2009-06-19 18:35:17 +02:00
Natanael Copa 01268f7f01 info: allow multiple subactions at the same run
By using a bitmask we can combine subactions
2009-06-19 18:20:27 +02:00
Natanael Copa 7703f981d9 info: add size and webpage to usage 2009-06-19 17:36:05 +02:00
Natanael Copa 378ae7b02c info: add -w,--webpage and -s,--size options 2009-06-19 17:29:45 +02:00
Natanael Copa 61213c4018 improve --help output
apk --help will list the generic options only and give a list of commands
To get the details for a spefic command, 'apk command --help' should be used.
2009-06-19 15:40:37 +02:00
Natanael Copa 20a1217e86 add: support for forced versions
Support version numbers specified with packages. For example:

 apk add 'busybox<1.14'
 apk add 'squid=>3.0'
2009-06-16 09:59:21 +00:00
Natanael Copa d8b1b851c7 fetch: use lstat to verify filesize on existing targets
since we dont verify the checksum we dont need to calculate it
Speed up when you try fetch lots of stuff thats already there.
2009-06-16 09:57:34 +00:00
Natanael Copa 0dfc53b0c3 state: bugfix in the package version selector 2009-06-16 09:55:45 +00:00
Timo Teras 49c904c993 io: fix mmap bstream fd leak
We need to close the fd on destruction. This is what the corresponding
istream variant does too.
2009-06-11 13:03:10 +03:00
Natanael Copa 3646350479 fetch: readlink does not end buffer with \0
According the manpage readlink(2) does not append a null byte to buf.
So we have to do it ourselves.
2009-06-11 09:21:17 +00:00
Natanael Copa 64a85ec65d fetch: do not create hardlinks to softlinks but to softlink targets
Otherwise the iso image will have softlinks which is not what we want
2009-06-11 08:39:51 +00:00
Natanael Copa cd5d44fa9d fetch: removed debug message
leftovers from a debug session.
2009-06-09 09:58:34 +00:00
Natanael Copa 50cdcca833 fetch: added --link/-L option
fixes #42

This will also fix a bug that left an empty file in destination dir when
source file did not exist in repository.

There are still issues with paths longer than 255 chars.
2009-06-09 11:12:06 +02:00
Natanael Copa c8c9851369 fetch: fix fd leak
we should always close the in-stream, not only on failure.
2009-05-26 14:23:12 +00:00
Timo Teras 9b0c0a2053 Revert "add: replace coffe-cup with starwars"
This reverts commit 0906a1c7de.

Conflicts:

	src/add.c
2009-05-25 16:58:32 +03:00
Natanael Copa d584b19c32 state: upgrade deps for given packages to add -u 2009-05-24 15:20:35 +02:00
Linux User 651aa71ac2 add: fix segfault when no params are given 2009-05-21 20:24:07 +00:00
Natanael Copa 0906a1c7de add: replace coffe-cup with starwars
saves space
2009-05-21 14:54:07 +00:00
Natanael Copa a9640ba8e6 add: coffe-cup 2009-05-21 14:20:22 +00:00
Natanael Copa ec68b6822b add: fix segfault when no packages are given 2009-05-19 09:55:15 +00: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 32064c35cf add: create csum for virtuals. only add the virtual to world 2009-05-15 11:47:11 +00:00
Natanael Copa 7950a2b5a5 add: improve error reporting for virtual packages
By locking all the given dependendencies for virtual packages first
we can catch invalid deps and report those. This is alot more helpful
than just reporting "Unable to install <virutalpkg>"
2009-05-15 07:46: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 6db3bbd790 index: fix segfault bug when trying to deleting an unresolved dep 2009-05-14 07:18:11 +00:00
Natanael Copa 83840727f0 fix uninitialized variable bug 2009-05-14 08:49:26 +02: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 ade1841541 fix misc compiler warnings about unintialized variables.
The compiler is actually right about those.
2009-05-11 12:17:35 +00:00
Natanael Copa 110611c53c add: delay state initialization til we have all pkgs in db
The state size is taken from name_id and cannot be extended. So we
must wait with initializing the state til we have all packages added
to the db.

We must also always allocate the package name, incase its not in the
repository. This is done with apk_db_get_name().
2009-05-11 12:02:00 +00:00
Natanael Copa d8cddc4329 change apk audit letters to correspond to old sfic/lbu letters
A = "added"
U = "updated"
2009-05-06 13:15:46 +00:00
Natanael Copa 5daa663a86 info: let -e print which packages are installed 2009-04-21 12:23:34 +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 0dfbee9537 search: do not read the state db as this tool only query repos
This should be slightly faster and comsume less memory in theory
2009-04-21 11:37:48 +00:00
Natanael Copa 9e70b1c9c7 url: rename to .backup rather than unlink before wget 2009-04-21 11:15:24 +00:00
Natanael Copa 74b5e4f535 db: do not assume root ends with '/' 2009-04-21 08:51:18 +00:00
Natanael Copa 64e0adf0c7 url: unlink file before trying to download 2009-04-21 08:40:50 +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
Natanael Copa 1ae6f9d972 db: fix bug in apk_repository_update() 2009-04-21 08:12:12 +00:00
Natanael Copa 8a47023d3e Makefile: add -nopie to LDFLAGS 2009-04-21 07:40:11 +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 ec5b63c5e4 pkg: clean up writing of dependencies 2009-04-16 17:05:27 +03:00
Timo Teras 968dfbb8b3 pkg: apk_deps_del helper introduced 2009-04-16 16:32:04 +03:00
Timo Teras 4e08c87621 del: first remove all targets from world, and then calculate changes 2009-04-16 15:37:53 +03:00
Timo Teras d6f4fcacd1 pkg: fix apk v1.0 URL field import 2009-04-16 14:03:59 +03:00
Timo Teras 18db1c4cd3 db: fix addition of .apks not in any repository 2009-04-16 14:03:17 +03:00
Timo Teras af1b460033 build: rewrite make system to something slightly similar to kbuild
Tracks now probler header file dependencies and command line parameters
used to build files. E.g. changing CFLAGS rebuild all C-files. And changing
version rebuild now the files where it's used.
2009-04-16 13:49:16 +03:00
Timo Teras 371b68b8bf state: print also the changeset affect on installed-size 2009-04-15 17:01:46 +03:00
Timo Teras 6f7719d3f4 state: fix installation of package broken by autoclean patch 2009-04-15 16:38:22 +03:00
Timo Teras 55b7b89e65 state: auto clean packages
Automatically remove packages that are no longer required by a top
level dependency.
2009-04-15 16:05:17 +03:00
Timo Teras a9b6d18f7f state: make package deletion safer
Refuse to delete explicitly specified top-level packages unless
--force is specified.
2009-04-15 13:20:35 +03:00
Natanael Copa 33da51c596 fetch: close downloaded file. unlink on failure 2009-04-15 10:00:14 +00:00
Timo Teras ebe43a5e01 state: do not derefence unallocated memory
Enforce name_id to be within apk_state allocated area. New apk_name:s
can be created later for e.g. unknown packages requested at command line.
2009-04-15 12:44:24 +03:00
Timo Teras 33c2bc0d1a state: more uninitialized variables initialized 2009-04-15 12:41:01 +03:00
Natanael Copa cc1a0187ee state: style fix, init variable at declaration 2009-04-15 09:38:15 +00:00
Natanael Copa 0c1933a4d6 state: fix bug with uninitialized variable 'latest' 2009-04-15 09:29:00 +00: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 7cef96c30d blob: add strspn helpers 2009-04-14 18:46:35 +03:00
Timo Teras 024480aca0 info: option '-r' to print "required by" info 2009-04-14 09:35: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
Natanael Copa 355626171d version: avoid end up in endless loop if we compare 2 equal invalid versions
fixes issue with apk version -t asdf asdf
2009-04-13 09:18:48 +00:00
Natanael Copa 916c396c02 version: allow more digits come after letter
This is so we can handle arpwatch-2.1a15
This makes us not 100% compatible with Gentoo
2009-04-13 09:13:09 +00:00
Natanael Copa 01a028cc2f version: allow token letter after digit_or_zero
Otherwise we only allow letters after first digit, i.e 2a, 2b but not
2.2a, 2.2b etc.
2009-04-13 08:37:25 +00:00
Natanael Copa d9879b72d5 version: allow only TOKEN_LETTER after a digit 2009-04-03 21:42:15 +02:00
Natanael Copa 8fb4f6d17c ver: added --check/-c option to vaildate given version string 2009-04-03 21:40:53 +02:00
Natanael Copa 5381425012 ver: test given version strings with -t or --test 2009-04-03 19:53:44 +02:00
Natanael Copa 6e10456967 search: use fnmatch so we have support for wildcards 2009-04-03 12:16:12 +00:00
Timo Teras 207bff6e6c io: implement write cache
speeds up writing of package / file database.
2009-03-17 14:17:35 +02:00
Timo Teras 7735cc644d pkg: write dependencies directly file instead of buffer
So we don't get artificial limits on the amount of dependencies
(fixes #8).
2009-03-17 13:19:06 +02:00
Cameron Banta 57391d1e4c Created search applet 2009-03-07 11:34:37 +02:00
Cameron Banta e93cb1ffe5 Added -o option to apk info to list repository packages 2009-03-06 08:06:08 +02:00
Natanael Copa 2b10123399 db: unlink apk-new if it is identical to existing config 2009-03-04 09:27:59 +00:00
Timo Teras 3752b47e7b db: apk-new should be created if the existing file is modified 2009-03-04 11:08:49 +02:00
Timo Teras 652a7bb179 db: fix overwrite warning 2009-03-04 11:00:17 +02:00
Timo Teras a62dcf37c1 apk: --force to overwrite files 2009-03-04 08:36:56 +02:00
Timo Teras 457943f83e apk: --clean-protected option
So you will not get .apk-new files of the new configuration files.
2009-03-04 08:27:06 +02:00
Timo Teras b75ae58b78 pkg: show warning if deprecated .INSTALL is present in package 2009-02-27 11:32:37 +02:00
Timo Teras 7027a7d844 db: new apk to have separate install scripts for each action 2009-02-27 11:18:15 +02:00
Natanael Copa ca51ec3238 db: allow more than one --repository arg 2009-02-17 12:23:01 +00:00
Natanael Copa 502e5612cc db: do not allow overwrite busybox links
we let bb use /bin and /sbin, all packages overriding busybox must
install the bins in /usr/bin and /usr/sbin
2009-02-08 19:31:25 +00:00
Natanael Copa 9a1ab8e6fc info: list contents follw same style as list depends
- empty lines comes after not before
- separate pkgname with : when using -v option
2009-02-08 19:22:04 +00:00
Natanael Copa f16b671edc info: implement -R/--depends to show dependencies 2009-02-08 19:08:48 +00:00
Timo Teras b8eb27d75b db: fix purging of packages from database
apk_hash_delete() actually deletes the file entry, so unlinking
from other lists need to happen before that. Also free the diri
instead of leaking it.
2009-01-22 21:45:18 +02:00
Natanael Copa 3bcc676a2b db: print files when (un)installing if --verbose 2009-01-22 15:55:27 +00:00
Natanael Copa 75b339cae2 db: always create directories during install
We dont care if a directory have references or not, we care if directory
is relly there.

Only the creator of the direcotry will set the permissions.

This fixes the situation where you install a package owning a dir then
you remove this dir manually and try install a second package also owning
the dir.

For example:

  apk add e2fsprogs-dev
  rm -rf /usr/lib/pkgconfig
  apk add zlib-dev
2009-01-22 10:34:03 +00:00
Natanael Copa dfc8d4ce4c Revert "Revert "pkg: use absolute filenames for packages""
This reverts commit 600f9e7e03.

My bad. This was correct.
2009-01-21 09:59:12 +00:00
Natanael Copa 600f9e7e03 Revert "pkg: use absolute filenames for packages"
This reverts commit 46430ceb56.
The problem this was suppoed to fix was fixed by letting apk_db_open()
return with same working dir.
2009-01-21 09:04:31 +00:00
Natanael Copa 02073e84d6 db: let apk_db_open() leave working dir as it was 2009-01-21 09:03:10 +00:00
Natanael Copa 6078d305f4 info: don't print package name unless its installed 2009-01-20 13:26:06 +00:00
Natanael Copa 20d242a4bd info: list contents with -L 2009-01-20 13:04:17 +00:00
Timo Teras 46430ceb56 pkg: use absolute filenames for packages 2009-01-20 14:30:07 +02:00
Timo Teras aee61d0a0b db: try creating db if locking fails
Otherwise creating rootfs from scratch with --initdb cannot be locked
due to the lock file path missing.
2009-01-19 21:19:36 +02:00
Natanael Copa 57407ed4e9 db: create .apk-new even if file not in db
Protect files in protected dirs even if the file is not previously
registered in the database. We do so by always extracting to a
.apk-new file name, compare the checksums afterwards and rename if
file was identical.
2009-01-18 14:49:18 +01:00
Timo Teras 4d5efe6a05 archive: utimes modifies file, not link so don't use it for symlinks 2009-01-17 13:34:18 +02:00
Timo Teras 0365f7462b archive: preserve mtime on extraction 2009-01-17 11:42:15 +02: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
Natanael Copa 24b424a458 apk: added option --version/-V
Both variants should work:
 apk --version
 apk <applet> --version
2009-01-17 08:51:52 +00:00
Natanael Copa f88f8205a7 archive: set suid bit after chown if needed
chown will reset the suid bit so we need to set it again.
2009-01-17 08:06:23 +00:00
Timo Teras 1a9cc552a5 del: proper ordering of file db entry deletion 2009-01-17 09:33:02 +02:00
Timo Teras edfaac3099 db: apk_db_read_state() needs to be before apk_db_add_repository()
Otherwise installed db load fails due to internal reasons. This would
cause a lot of other funny stuff happen.
2009-01-16 16:25:19 +02:00
Timo Teras 82b9cb31fd db: make fetching from other than first repository work 2009-01-16 15:38:04 +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 6b6c10cdf2 db: fix relative --root to work after apk_db_create call
This was broke on --initdb addition to add applet since apk_db_create
changes the working directory.
2009-01-16 14:52:47 +02:00
Timo Teras 3e6fc1389f add: --upgrade|-u to control if upgrading is preferred or not 2009-01-16 13:59:36 +02:00
Natanael Copa 6354a27888 Makefile: added 'make static' target to build apk.static 2009-01-16 10:10:29 +00:00
Natanael Copa 7a50aa61b2 url: allow wget report error messages 2009-01-16 09:58:27 +00:00
Natanael Copa d8837aa6f4 apk: fix --root/-p option 2009-01-16 09:57:53 +00:00
Natanael Copa 33cb598bdf apk: short option for --root is -p
Used to be so in the really old days of apk.
2009-01-16 09:44:49 +00:00
Natanael Copa 50daa05773 info: only show package desc when --verbose
also introduce apk_verbosity. --quiet reduce verbosity and --verbose
increases it.

Default verbosity is 1.
2009-01-16 09:33:55 +00:00
Natanael Copa af6f329fc7 db: set the perms to /var/lib/apk/* to 644
this allows non-root users to query the database.
2009-01-16 08:17:28 +00:00
Timo Teras cf3dfb7611 db, hash: fix package purging/upgrading to update filedb properly 2009-01-16 09:33:05 +02:00
Natanael Copa fed45e4b7f db: try create root in case it does not exist
But we dont bother try create all subdirs (i.e mkdir -p ...)
2009-01-16 07:07:15 +00:00
Timo Teras cfdef51bee db: index file location is a URL 2009-01-15 12:55:26 +02:00
Timo Teras 4c7f1e0dec apk: isalnum() takes only unsigned char values add explicit check for that 2009-01-15 11:10:14 +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 15b547c55b db: keep only filename in file entries, hash by both directory and file 2009-01-14 10:44:47 +02:00
Timo Teras 3309eaa900 add: --initdb to replace create applet 2009-01-13 20:58:08 +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 af8f054560 state: fix again changeset ordering 2009-01-13 20:31:17 +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 c831ead63c state: fix generation of change-set to honour dependencies 2009-01-13 15:21:20 +02:00
Timo Teras 3755e1cde3 apk: per applet options 2009-01-13 14:09:45 +02:00
Timo Teras 0a7910c144 state: install packages in dependency order (not reverse) 2009-01-13 11:16:27 +02:00
Timo Teras ca364e34e2 pkg: use generic blob functions to parse dependencies 2009-01-13 09:32:04 +02:00
Timo Teras d16b424385 apk: honour --root command line switch
Was broken by earlier ROOT environment commit.
2009-01-13 09:31:27 +02:00
Natanael Copa b8940df6b9 apk: support for ROOT environment variable 2009-01-12 21:03:20 +00:00
Natanael Copa 09385545d9 db, package: new dependency format, second try
dependencies are separated with single space rather than ', '.
makes db file slightly easier to parse from a shell script which
might be handy.
2009-01-11 14:03:55 +00:00
Natanael Copa 9423906606 Makefile: build the info applet 2009-01-09 12:04:27 +00:00
Natanael Copa 1f21521684 info: new applet
so far it only lists installed packages
2009-01-09 11:02:16 +00:00
Natanael Copa 3867b4c71f Revert "db: change format for dependencies"
This reverts commit b852d670a9.
2009-01-09 11:00:20 +00:00
Natanael Copa f54b7bc320 db: report error when create db in non-existing dir 2009-01-09 10:19:23 +00:00
Natanael Copa b852d670a9 db: change format for dependencies
Each dep is separated with a single space. I.E:

D:dep1 dep2 dep3
2009-01-08 13:55:51 +00:00
Natanael Copa 08748b5c3f db: allow comments and empty lines in repositories file 2009-01-08 09:12:39 +00:00
Natanael Copa 174dd41113 src/database.c: get repository file from environment variable APK_REPOS
Defaults to /etc/apk/repositories, absolute path and not relative
the install root.
2009-01-08 07:16:53 +00:00
Natanael Copa d704e93f8d src/package.c: fix compiler warning on 64 bit hosts 2009-01-08 07:16:53 +00:00
Timo Teras 052fbe3f86 various: make fancy progress bar and update todo 2009-01-07 21:45:11 +02:00
Timo Teras c7ffc96a16 db: rmdir() directories only on package purge 2009-01-06 21:23:26 +02:00
Timo Teras 0655699133 db: remove forgotten debug print 2009-01-06 21:23:26 +02:00
Timo Teras 0314104d93 db, pkg: fix rest of memory leaks 2009-01-06 21:23:26 +02:00
Timo Teras 5e2aca2678 io: fix some memory leaks 2009-01-06 21:23:26 +02:00
Timo Teras 6b2b9d303e db: restructure in-memory organization 2009-01-06 21:23:26 +02:00
Timo Teras 354b6e4631 log: eliminate fortified build warning 2009-01-06 21:23:26 +02:00
Timo Teras 64b630b5fb archive: minor clean ups 2009-01-06 21:23:26 +02:00
Timo Teras a3769b2238 io: check inner stream existance before creating gunzip stream 2009-01-06 21:23:26 +02:00
Timo Teras fb911432cb apk_array: clear newly allocated memory 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 4bafa681fe io: prepartions for url handling 2008-11-28 15:03:27 +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 a96572fba8 db: compressed index file 2008-11-27 21:06:45 +02:00
Timo Teras f0609951b9 hash, db: use apk_blob_t and list_* 2008-11-27 20:25:01 +02:00
Timo Teras 1a7f3e3678 various: use apk_istream api 2008-11-27 16:59:04 +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 86676ac8c4 build: remove pthreads references 2008-11-12 11:57:53 +02:00
Timo Teras ffa03a21d8 db: remember empty .apks 2008-11-11 09:00:10 +02:00
Timo Teras 791cf6f05b pkg: speed up indexing of version 2 .apks 2008-11-07 19:18:53 +02:00
Timo Teras 0bf7a1a2cc io: implement mmap(2) for reading pkgs 2008-11-07 19:06:58 +02:00
Timo Teras aef0f036f0 use zlib internally to decompress 2008-11-07 17:11:08 +02:00
Timo Teras 6967c28b96 db: fix installation of apk v1 packages 2008-11-07 13:22:16 +02:00
Timo Teras 36f73847ee pkg: support for new scripts 2008-11-07 13:05:55 +02:00
Timo Teras 014d39488b db: do not install .PKGINFO files 2008-11-07 09:51:53 +02:00
Timo Teras 57154db85d db: parse new style .PKGINFO 2008-11-06 16:58:58 +02:00
Natanael Copa cb25f35ed4 give more helpful error messages 2008-10-26 11:35:34 +00:00
Timo Teras 219a1b2ee8 Overwriting of bb files, apk_create (from old apk-tools), chdir changes,
other stuff.
2008-04-22 08:16:26 +00: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 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