Age | Commit message (Collapse) | Author |
|
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>
|
|
To round a value, we don't need floorf- we can just cast to an int.
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
%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>
|
|
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
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>
|
|
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
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>
|
|
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>
|
|
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
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>
|
|
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
We shouldn't use the _alpm prefix (copy-paste issue, no big deal).
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
|
|
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>
|
|
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
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>
|
|
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>
|
|
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>
|
|
Added needs_transaction, putting out "hey do we need root?" tests in one place.
Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
|
|
Yeah, I added a space. It deserves its own commit.
Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
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>
|
|
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
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>
|
|
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
|
|
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>
|
|
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
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>
|
|
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>
|
|
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
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>
|
|
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
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>
|
|
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>
|