1
0
mirror of https://github.com/moparisthebest/pacman synced 2024-08-13 17:03:46 -04:00
Commit Graph

789 Commits

Author SHA1 Message Date
Chantry Xavier
83fa6aa289 Remove duplicated get_upgrades function, use sysupgrade instead.
The alpm_get_upgrades was exactly the same as find_replacements +
_alpm_sync_sysupgrade, except that it automatically made the eventual
replacements, without asking the user : Replace %s with %s/%s? [Y/n]

The replace question, asked in find_replacements. can now be skipped by
using a NULL trans argument, so that we get the same behavior as with
alpm_get_upgrades.

So alpm_db_get_upgrades() can now be replaced by
alpm_sync_sysupgrade(db_local, syncdbs).

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-21 00:05:05 -06:00
Nagy Gabor
4696ad6cad New alpm_list_join function
This O(1) function joins 2 lists.

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-20 23:31:40 -06:00
Dan McGee
aa942a126b Add missing header includes for setlocale
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-20 11:01:56 -06:00
Nagy Gabor
84ebf82319 Versioned provisions.
This patch introduces versioned provisions in "provision 1.0-1" format.
_alpm_db_whatprovides was modified accordingly (added sync500.py),
alpm_depcmp was modified accordingly (add043.py passes now; added add044.py
and add045.py).

Notes:
alpm_db_search now uses the whole versioned %PROVIDES% string in its search.
debug logging was simplified in alpm_depcmp.

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
[Xavier: fixed a few typos, duplicate const strings with strdup before
modifying them, put some debugging back in alpm_depcmp, minor code cleanups
(var/function renaming), added a note in PKGBUILD man page.]
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
[Dan: made strcmp checks clearer, added a comment]
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-18 20:05:51 -06:00
Dan McGee
23b4e0270b Fix sh and scriptlet interaction
dash doesn't pass positional parameters to sourced scripts, causing install
scripts to fail. Instead of sourcing the script, make it executable and
call it directly which allows positional parameters to be passed correctly.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-18 16:49:02 -06:00
Nagy Gabor
2aa7e69da9 Add the pmconflict_t type.
pmdepmissing_t was used for two totally different things :
missing dependencies, and dependency conflicts.
So this patch simply adds a type for dep conflicts,
and convert the code to use it.

This fix the TODO in conflict.c :
/* TODO WTF is a 'depmissing' doing indicating a conflict? */

Additionally, the code in conflict.c now eliminates the duplicated conflicts.
If pkg1 conflicts with pkg2, and pkg2 conflicts with pkg1, only one of them will be stored.

However the conflict handling in sync_prepare (sync.c) is still very asymetrical, and very ugly too.
This should be improved in the future (there is already a pending patch from Nagy that cleans it a lot).

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2007-11-18 12:42:39 -06:00
Chantry Xavier
65fb99133d Simple s/conflict/fileconflict/ renaming.
The names related to conflicts are misleading :
For dependencies conflicts, the type is pmdepmissing,
and the function names contain just "conflict".

For file conflicts, the type is pmconflict,
and some functions contained just "conflict", some others "fileconflict".

So this is the first step for improving the situation.
Original idea/patch from Nagy, but the patch already didn't apply anymore,
so I did it again.
The main difference is that I kept the conflictype, with the following renaming :

pmconflicttype_t -> pmfileconflicttype_t
PM_CONFLICT_TYPE_TARGET -> PM_FILECONFLICT_TARGET
PM_CONFLICT_TYPE_FILE -> PM_FILECONFLICT_FILESYSTEM

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2007-11-18 12:42:34 -06:00
Dan McGee
5f0c241987 POSIX shell does not specify meaning of source operation
Just use '.' operator instead. Oops.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-18 12:37:29 -06:00
Nagy Gabor
55a7455135 libalpm/deps.c : improves IgnorePkg handling in resolvedeps.
resolvedeps will now search for other satisfiers
when we don't let it add a package from IgnorePkg.

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2007-11-18 12:37:16 -06:00
Chantry Xavier
8f824e70bb Remove the IgnorePkg handling from alpm_pkg_compare_version.
And check the IgnorePkg handling is done correctly in the other places.
For example, -Qu and -Su will automatically skip the ignored packages (-Su will print a warning),
but -S will install ignored packages anyway, because it was asked explicitly.

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2007-11-18 12:37:16 -06:00
Chantry Xavier
c8be7540a5 Remove provide.c and provide.h .
This file only contained one private function : _alpm_db_whatprovides .
And the public alpm_db_whatprovides was in db.c , so I moved everything there.

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
[Dan: updated POTFILES.in as well]
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-17 09:50:05 -06:00
Nagy Gabor
d311ad067f Generalized alpm_list_find.
The old alpm_list_find was renamed to alpm_list_find_ptr, and a new
alpm_list_find was introduced, which uses the fn comparison-function
parameter in its decision.
Now both alpm_list_find_ptr (a new ptrcmp helper function was also
added) and alpm_list_find_str are just an alpm_list_find call.

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
[Dan: made ptrcmp a static function]
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-17 09:44:48 -06:00
Dan McGee
3d10786394 Fix memleak in _alpm_trans_free with package lists
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-17 09:39:00 -06:00
Dan McGee
cfcc550e2a libalpm: use FREELIST when possible
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-16 21:15:49 -06:00
Dan McGee
2322909703 War on whitespace
Run the kernel's cleanfile script on all of our source files.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-16 20:18:45 -06:00
Dan McGee
3cd684b41d libalpm: simplify sync db lastupdate
Legacy code is hitting the trash here. Remove unnecessary _alpm_time2string
time storage abstraction in favor of just writing the time_t value to the
disk.

The only drawback is that everyone's sync DBs will have to be updated at
least once so that the lastupdate values are stored right. :)

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-16 11:51:26 -06:00
Dan McGee
4ce13e2398 Fix a would-be memleak with the new compute requiredby stuff
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-15 08:05:10 -06:00
Dan McGee
c8243bb8ed libalpm: change graph malloc to MALLOC macro
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-14 22:51:47 -06:00
Dan McGee
f75ee71762 Fix alpm_list_copy_data
So I spent a good 4 hours tracking a bug down tonight due to
alpm_list_copy_data not actually doing what I expected to do. We can't find
the size of an object we don't know the type of, so rewrite it so we pass
in the size explicitly. This was making _alpm_pkg_dup fail and causing all
sorts of other issues.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-14 22:51:16 -06:00
Dan McGee
c244cfecf6 Move alpm_splitdep usage to db_read
Holy inefficient batman! For a pacman -Qt operation (when we are using
compute_requiredby and not database entries), splitdep was being called ~1.3
million times on my local database. By splitting when we read the DB, we
drop this number to around 1700 and save a LOT of time in doing so (a 5x
increase in pacman -Qt speed here).

Note that the depends alpm_list_t in the package struct is no longer a
string list, but a list of pmdepent_t objects.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-14 21:00:02 -06:00
Dan McGee
7219326dd4 Remove REQUIREDBY usage from libalpm
Instead of using the often-busted REQUIREDBY entries in the pacman database,
compute them each time they are required. This should help many things:

1. Simplify the codebase
2. Prevent future database corruption
3. Ensure when we do use requiredby, it is always correct
4. Shrink the pmpkg_t memory overhead

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-14 18:49:50 -06:00
Nagy Gabor
85b06f1276 alpm_list_add == alpm_list_add_last
It's time to define that alpm_list_add(list, foo) adds 'foo' to the end of
'list' and returns with 'list', because:
1. list is a list, not a set.
2. sortbydeps _needs_ an alpm_list_add definition to work properly.

As a first step, I used this definition in recursedeps.

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
[Dan: punctuation cleanup in commit message and code comments, added comment
to alpm_list_add]
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-14 18:48:34 -06:00
Dan McGee
1b2817f539 Enforce const correctness on dep functions and rewrite alpm_dep_get_string
Add some const specifiers to the dep functions that can have them. In
addition, rewrite alpm_dep_get_string to use snprintf and cover all of
the bases (operators).

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-13 00:13:05 -06:00
Dan McGee
5e12d3dec9 Fix display of -Qip output when a package file is given
Too many fields were being shown on -Qip output, and sizes were not always
correct (-Qi and -Qip output on the same package did not agree).

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-13 00:09:45 -06:00
Dan McGee
53fdae9a19 Fix memleak with new alpm_list_reverse usage
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-11 12:59:45 -06:00
Dan McGee
8236be9fd8 Add a horrible little hack to get symlink001.py to pass again
This really doesn't give us any regressions in behavior, so it is safe to
do although quite ugly. Tell the conflict checking code to ignore symlinks
to dirs so that they are not seen as conflicts.

Hopefully this entire commit will get factored out soon enough.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-11 11:30:16 -06:00
Dan McGee
4a835f5f53 Ensure list tail pointer is updated when we remove tail node
Commit 2ee90ddae2 did a special check to see
if we were removing the head node, but not the tail node. Add a special case
for the tail node to ensure all relevant pointers get updated.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-11 10:47:28 -06:00
Nagy Gabor
b6b3b0135e Incorrect usage of alpm_db_whatprovides in sync.c
The old code thought that alpm_db_whatprovides returns with a list of strings (package names).
 Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-11 09:56:50 -06:00
Dan McGee
2898ccb609 libalpm: fix lstat wrapper to actually use newpath
Commit b55abdce7a introduced an lstat wrapper
function that never dereferences paths with a trailing slash, but still
called lstat on path instead of newpath. Oops!

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-11 09:51:09 -06:00
Dan McGee
7b4573d851 Remove unused and broken alpm_list_remove_node function
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-11 09:51:09 -06:00
Nathan Jones
8ec27835f4 Implement TotalDownload option.
Setting this option will change the download progress to show the amount
downloaded, download rate, ETA, and download percent of the entire
download list rather than per each individual file.

The progress bar is still based on the completion of the current file
regardless if the TotalDownload option is set.

This closes FS#7205.

Signed-off-by: Nathan Jones <nathanj@insightbb.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-11 09:46:13 -06:00
Nathan Jones
3312de65e6 Implement IgnoreGroup.
This option acts as if IgnorePkg was set on each package in the group.

This closes FS#1592.

Signed-off-by: Nathan Jones <nathanj@insightbb.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-11 09:44:30 -06:00
Nathan Jones
5c58b3d500 Add IgnoreGroup and --ignoregroup option.
This will be used in the next commit.

Signed-off-by: Nathan Jones <nathanj@insightbb.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-11 09:44:26 -06:00
Dan McGee
e6673544b2 Fix some issues with localized dates/epoch usage
Commit 47622eef4d introduced localized times
in the metadata by way of storing the UNIX epoch value instead of a hard
coded date string. However, it missed a few things:
* If we weren't in the C/POSIX/en_US locale, the date parsing would fail
  as it tried to use the abbreviations of the locale being used. Fix this
  by switching the LC_TIME value before we parse a date.
* We used ctime to print the date value, which is always the C locale
  string. Instead, use strftime to print a localized date string.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-08 23:18:07 -06:00
Giovanni Scafora
c00f46b653 Update Italian Translation
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-08 21:16:07 -06:00
Jeff Bailes
4bbb055cd9 Update en_GB translation
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-07 19:03:58 -06:00
Aaron Griffin
d0d58489ff Add STRDUP macro to mirror MALLOC/CALLOC
Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
2007-11-06 23:23:03 -06:00
Aaron Griffin
2ee90ddae2 Maintain list tail pointers in the head node
List head nodes contain null 'prev' pointer, which we can (ab)use to maintain a
back reference to the tail pointer of the list.

While list additions are not _significantly_ improved, they are still sped up.

Original
   $ time pacman -Qo /usr/bin/wtpt
   /usr/bin/wtpt is owned by lcms 1.17-2

   real    0m3.623s
   user    0m1.883s
   sys     0m1.473s

New
   $ time pacman -Qo /usr/bin/wtpt
   /usr/bin/wtpt is owned by lcms 1.17-2

   real    0m2.006s
   user    0m0.263s
   sys     0m1.627s

Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
2007-11-06 22:47:10 -06:00
Dan McGee
52b7fd81f5 libalpm/db.c: change two warnings to errors
These two warnings really indicate failure, so the message they print should
do so as well.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-05 21:10:43 -06:00
Chantry Xavier
0686fec839 Remove the newline automatically added by alpm_logaction.
This way, _alpm_logaction behaves like _alpm_log, and gives more control.

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2007-11-04 18:04:43 -06:00
Dan McGee
b55abdce7a libalpm: use an lstat wrapper so we never dereference dir symlinks
Linux lstat follows POSIX standards and dereferences a symlink pointing
to a directory if there is a trailing slash. For purposes of libalpm, we
don't want this so make a lstat wrapper that suppresses this behavior.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-04 18:02:25 -06:00
Dan McGee
99f42d6bd2 libalpm: open the logstream on demand
Don't open a stream to the logfile until necessary. This will allow us
to catch any errors in opening the logfile instead of ignorning them.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-04 16:38:59 -06:00
Dan McGee
86ca39d15e Clean up usage of extern variables
Instead of declaring the extern variable in every *.c file, include it in
the header file that makes sense. This means handle.h for the handle, and
conf.h for the pacman side config object.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-04 12:05:22 -06:00
Dan McGee
006387828c Readd scriptlet logging that got lost in an earlier commit
I broke scriptlet logging with ad691001e2.
Readd more or less what was there before, although it still needs a lot of
work including hopefully rewriting it to a new event subsystem and having
it log to a seperate file.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-04 11:27:41 -06:00
Dan McGee
c26fe63ee5 Add some more autoconf macros to filter our CFLAGS usage
Hopefully these new autoconf macros, with a little magic, will allow us to
compile with any compiler and still choose the options we have available
to us.

Tested locally with gcc 4.2.2 and gcc 3.4.6; the latter doesn't support two
of the items we previously had hardcoded in our CFLAGS.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-04 10:42:07 -06:00
Dan McGee
ab91cef655 Add a little const correctness fix to alpm_list
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-04 09:50:59 -06:00
Dan McGee
6aeda5fbff When printing size_t, use %zd
%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-29 23:32:58 -05:00
Dan McGee
be387148c9 libalpm/handle.c: make realpath() call portable
BSD didn't support the NULL second argument GNU extension, so do it the
old fashioned way.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-29 23:12:37 -05:00
Dan McGee
dede5371e7 Copy pmdelta_t objects in _alpm_pkg_dup()
This was forgotten in the original set of patches.

CC: Nathan Jones <nathanj@insightbb.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-29 21:06:13 -05:00
Dan McGee
74aa54a1f6 Make general list copy function
Package dup needs to copy all members. Nathan had his implementation, but
I generalized it to this new alpm_list function (and will use it in the
next commit).

CC: Nathan Jones <nathanj@insightbb.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-29 21:05:04 -05:00