summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2007-11-04Fix basename usage in pacman and utilitiesDan McGee
basename() is a rather untrusty function call on a lot of platforms as it does some weird and different things. To solve this, I added a mbasename fuction to pacman to take its place, and simply removed its usage in the utilities (it isn't worth dealing with there). Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-04Remove final use of the math library from pacmanDan McGee
To round a value, we don't need floorf- we can just cast to an int. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-29When printing size_t, use %zdDan McGee
%d was used, which worked for Linux and FreeBSD. Not so for Darwin. The warning was probably spat out when compiling on x68_64 as well, but no developers use this architecture as their primary one. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-29pacman/query.c: add missing free()Dan McGee
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-26Clean up LDADD usageDan McGee
We had a lot of unnecessary overstatements of libraries to include on linking, and autoconf/automake takes care of this for us. This also helps some compilation issues on other platforms. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-26Fix mcheck detection and usageDan McGee
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-26Dependency error/log messages fixNagy Gabor
The old code used only the depend.name in messages, which might have not been informative. The new code uses the whole dependency string in %DEPENDS% format. (Dan: slight English clarification in one of the messages) Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-25Add alpm_dep_get_string methodNagy Gabor
Public alpm_dep_get_string function is introduced, which converts a pmdepend_t structure to printable string in %DEPENDS% format. This function is now used in pacman to print dependency error messages. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-24Add strndup implemention for environments that are missing itDan McGee
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-23One more added include to help compilation elsewhereDan McGee
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-22Ensure all localization stuff is correctly guardedDan McGee
Anything dealing with libintl and localization should be correctly guarded inside an ENABLE_NLS block on both the pacman and libalpm sides. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-22Fix broken or missing includesDan McGee
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-19Add download size to target list.Nathan Jones
This displays the download size, taking into account delta files and cached files. This closes FS#4182. Signed-off-by: Nathan Jones <nathanj@insightbb.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-19Download delta files if UseDelta is set.Nathan Jones
Delta files will be used if the size is smaller than a percent (MAX_DELTA_RATIO) of the package size. Signed-off-by: Nathan Jones <nathanj@insightbb.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-16Remove rounding on package size totalsDan McGee
We print the total to two decimal places, so there is no real need for rounding of the values. Remove the rounding and switch all output to two decimal places. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-14pacman/pacman.c : put back root check even if -r is specified.Chantry Xavier
Root is needed for most install / remove operation, because it's needed for chrooting, for running scriptlets. Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2007-10-10util/testdb: fix up function namingDan McGee
We shouldn't use the _alpm prefix (copy-paste issue, no big deal). Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-08pacman/pacman.c : add --logfile option.Chantry Xavier
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2007-10-08Update usage of gcc __attribute__ flagsDan McGee
Change the default visibility of libalpm functions to internal instead of hidden- this allows for slightly better optimization because it tells GCC that the function can never be called outside of the current module (see http://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html). Also added some attributes to the pacman print functions so that they check the format strings being passed to them. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-08Remove the non-user friendly --ask optionDan McGee
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-04Fix -Sy and -Sp operations.Chantry Xavier
When the -Sy operation failed, the lock wasn't removed because alpm_trans_release wasn't called. This is fixed now. Also, after my last change in commit 52e7e6d74733f7a431376a9e528c4fe4d3732068 , Sp didn't do anything anymore. That's because needs_transaction returned false for -Sp, so the sync transaction wasn't run. However, the current implementation of -Sp requires a sync transaction. Also, since a transaction creates the lock file at the beginning, and releases it at the end, this mean that -Sp requires root access anyway.. I think I understand now why Aaron found that the current -Sp implementation is hackish :) Signed-off-by: Chantry Xavier <shiningxc@gmail.com> Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
2007-10-03needs_transaction adjustmentsChantry Xavier
I just moved the root path check out of needs_transaction, and put it directly in pacman.c . I think this part is alright. For the other problems, I thought about doing the transaction first, in a new sync trans function, which will init and release a transaction. And then doing the commands like -Ss / -Sl / -Sg / -Si. The problem is that for commands like -Sys / -Syl / etc, only the refresh part of the transaction should be done. So I had to introduce an ugly sync_only hack. Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
2007-09-28Allow --refresh specified for most -S optionsAaron Griffin
Included options are -g, -i, -s, and -l All of these will sync the DB if -y is specified and permissions are appropriate. Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
2007-09-28Break out transaction test to a separate functionAaron Griffin
Added needs_transaction, putting out "hey do we need root?" tests in one place. Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
2007-09-28OMG a space!Aaron Griffin
Yeah, I added a space. It deserves its own commit. Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
2007-09-28Support for localized times in metadataAaron Griffin
Packages and DBs now support using the UNIX epoch (seconds since Jan 1, 1970) for use in builddate and installdate. This will only affect newly built packages. Old existing packages with the text format are still supported, but this is deprecated. In the case of removal of text time support, this code will fail gracefully, returning the start of the epoch for broken packages. Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
2007-09-28Add 'full' parameter to alpm_pkg_loadDan McGee
In most cases, we want to fully scan a package when we load it, which serves as a integrity verification check. However, there are times when it is only desired to read the metadata and nothing else, so allow the caller of pkg_load to choose the behavior they need. This pays big dividends in speeding up pacman cache cleaning functionality. Old (729 packages): real 1m43.717s user 1m20.785s sys 0m2.993s New (729 packages): real 0m25.607s user 0m19.389s sys 0m0.543s Signed-off-by: Dan McGee <dan@archlinux.org>
2007-09-28Update comments dealing with pkgext/dbext strippingDan McGee
pacman/callback.c already did the work I set out to do with this commit, so update the comments accordingly in the frontend and backend. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-09-28Reimplement pacman cache cleaning the right wayDan McGee
Partial cache cleaning was eliminated in a previous commit because it relied on package naming conventions. Re-add it the correct way- we actually open up each package in the cache and get a name and version out of it. If the name and version match that of an installed package, keep it. If the package is not installed or the version does not match the locally-installed version, get rid of it. This can easily be modified if some other heuristic of keeping and removing packages is desired, or if we should clean out the cache dir of any files that are not packages, etc. The biggest current problem with this new approach- speed. Here is one run on my local machine, going from 1643 to 729 packages in the cache (753 in the local DB): real 4m25.829s user 3m22.527s sys 0m6.713s This is likely best addressed by the package loading scheme, which may be loading the entirety of each package archive, which is a waste when we only need the .PKGINFO file read. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-09-28Remove package name dependency from libalpmDan McGee
Previously, package names must match a specified scheme or they will cause pacman add operations to fail. This is not a very intelligent or necessary way to act, so remove the dependency on the name of the package to be installed and read all relevant information from the metadata instead. This does have one causality to be addressed later- pacman cache cleaning functionality, which has never been phenomenal, just lost most capability. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-09-27document the -Qii option.Chantry Xavier
I suppose -Qii could be used for other things than displaying the list of backup files, but currently, it's the only one, so that's how I documented it.. Signed-off-by: Chantry Xavier <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2007-09-25Preliminary support for optdependsDan McGee
Add some alpm functions for getting optdepends, have makepkg include them in the PKGINFO file, and have a pacman -Qi operation display the raw string as stored by libalpm. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-09-16trans.c : reworking of transaction interruptionsChantry Xavier
My two previous hacks related to this part (8038190c7c4786e1c49494eea1b40cdddcbd5136 and b15a5194d1a8485a2769560e49e6ff03e1862533) were caused by the lack of understanding of a feature introduced a while ago: Better control over CTRL-C interruptions -- do not leave the DB in an inconsistent state (54008798efcc9646f622f6b052ecd83281d57cda). Now I have been looking at this commit, and the added feature is indeed interesting. The main problem I had with it is that it does a rather unusual use of alpm_trans_release, which caused a few problems that I tried to fix in a weird way. I think these problems were caused by the fact that there weren't any difference between "interrupt transaction" and "release a transaction which failed" actions from the alpm_trans_release POV. So I decided to add a new function instead, alpm_trans_interrupt, which is called on Ctrl+C, and which only sets trans->state to STATE_INTERRUPTED so that remove_commit and add_commit can exit cleanly at a safe moment. This allowed me to revert my two previous hacks as well. Also ensure we handle SIGINT correctly in all cases- if a transaction is not ongoing, then we can free the transaction and exit quickly. Signed-off-by: Chantry Xavier <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2007-09-16Remove the DB consistency check from pacman and libalpm.Chantry Xavier
This reverts commit dfc85cb5f516ffbcff557522e9703c5c7d88b047 and b6f3fe6957d0206485eac98fb2120578b75d0058. This DB check is already in testdb (among others). Also testdb now uses the db path set at make time by default, so specifying the db path is optional. Signed-off-by: Chantry Xavier <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2007-09-11Add testdb util for finding inconsistencies in the database.Chantry Xavier
Signed-off-by: Chantry Xavier <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2007-09-11make alpm_strerror binding friendlyStefano Esposito
I'm currently working on python bindings for alpm written in pyrex. While working i found that declaring alpm_strerror as char * alpm_strerror (void) instead of char * alpm_strerror (int err) and then using pm_errno in the implementation instead of err, could make it more bindings-friendly. Dan: cleaned up and added void to declaration. Instead of replacing existing function, add a new function called 'alpm_strerrorlast(void)'. Signed-off-by: Stefano Esposito <stefano.esposito87@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2007-09-11Make some small changes recommended by splintDan McGee
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-09-06Add a few missing includes, caught while compiling on cygwinDan McGee
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-08-26separate local from sync dbs on filesystemTravis Willard
Introduce two new methods into the API - alpm_db_register_sync and alpm_db_register_local, which replace the functionality of alpm_db_register. db_register_local always returns the local DB, and db_register_sync will always try to register a sync DB. This conceptually separates the local DB from sync DBs in the code. Also updated the pacman frontend to use the new functions. In addition, this changes the location of all sync DBs in the filesystem from $DBPATH/$REPO to $DBPATH/sync/$REPO, This removes the silly limitation that a sync DB couldn't be named 'local', along with structurally separating sync DBs and the local DB in the filesystem. Signed-off-by: Travis Willard <travis@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2007-08-26pacman/sync.c : kill extra newline with groups on -Ss operation.Chantry Xavier
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2007-08-23libalpm: add newlines to all strings passed to log callbackDan McGee
This allows us to remove the hack in the frontend where we added a newline to everything coming out of the pm_printf functions, and instead let the developer put newlines where they want them. This should be the last hangover of that auto-newline stuff. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-08-22pacman.c: clarify reason for doing 2 strcmp operationsDan McGee
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-08-21Various valgrind mem leak fixesDan McGee
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-08-21Add a default cachedir if one wasn't specifiedDan McGee
Use the default cachedir (specified at compile time) if one wasn't specified on the command line or in the config file. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-08-21Post trial install changes, round oneDan McGee
A bunch of changes related to my first "real" install of pacman-git into /usr/local and trying to use it. * Shift some uses of free -> FREE in libalpm. * Move stat and sanity checks of config paths into libalpm from the config and argument parsing in pacman.c. * Fix issue where dbpath still was not defined early enough due to its requirement for being used in alpm_db_register. This should be rewritten so it doesn't have this dependency, but this will work for now. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-08-16Fix some errors spit out by -WextraDan McGee
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-08-16Remove support for SHA1 from pacman.Andrew Fyfe
There's no need for a second hashing algorithm. MD5 serves the purpose of verifying that a package file hasn't been corrupted during download. Signed-off-by: Andrew Fyfe <andrew@neptune-one.net> Signed-off-by: Dan McGee <dan@archlinux.org>
2007-08-16pacman.c: Alphabetize listing of query optionsDan McGee
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-08-15new query options : explicit (-Qe) and deps (-Qd).Chantry Xavier
The t shortcut for --test was removed, the orphan option (previously -Qe) was renamed to -Qt, -Qe lists all packages installed explictly, and -Qd lists all packages installed as dependencies. Besides, t can be combined with either e or d. Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2007-08-15libalpm/query.c : makes orphans and foreign options as filters.Chantry Xavier
The --foreign and --orphans functions now behave as a filter for the other options. This cleans the code a bit, and will make easier the adding of new filter options, like explicit (show only explictly installed packages) or depends (show only packages installed as dependencies). Signed-off-by: Chantry Xavier <shiningxc@gmail.com>