Commit Graph

1029 Commits

Author SHA1 Message Date
Dan McGee 245efca759 Remove unnecessary archive_entry_set_pathname() calls
I'm not sure why these were ever here, as by this point we have already
extracted the file meaning a call to this function is basically a no-op.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-04-27 17:27:05 -05:00
Dan McGee 6d79ba2db0 Fix some fallout from the delta/download changes
We removed one too many FREELIST() calls when trying to fix some memleaks,
and add a safety/sanity check to ensure filename is set, as packages in old
DBs are likely to not have this field.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-04-26 13:03:53 -05:00
Chantry Xavier 481c3edc89 get_filename : use the FILENAME db field only.
Reference : FS#9547.

The get_filename function first tries to get the filename field from the
database, and if it doesn't find it, it tries to guess it based on the name,
version and arch.

This field was introduced in 3.0, but there are still many old entries in
the official databases without it. So the databases need to be regenerated
first before this patch can be applied.
There is a second problem with the delta code, which needs the filename for
locally installed packages too, but this field is not present in the local
db. So the delta code needs to be fixed first.

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-04-26 11:54:47 -05:00
Chantry Xavier 8fdf08ef78 libalpm/sync.c : memleak fixes.
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2008-04-26 11:54:46 -05:00
Chantry Xavier 670fadf041 Get rid of the delta patches list
As Nathan noticed, the new informations in the delta struct allows us to
get rid of this list :
http://www.archlinux.org/pipermail/pacman-dev/2008-February/011163.html

So I rewrote apply_deltas for that. The previous apply_deltas also had a
limitation: it assumed that the initial package and the deltas were in the
first cache dir, which is not necessarily the case. That situation is
supported now.

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-04-26 11:54:38 -05:00
Chantry Xavier 701a03dcdb Completely rework delta algorithm
Using the graph structures that Nagy set up for dependency sorting, we now
do a similar process for deltas. Load up all of the deltas into a graph
object on which we can then apply Dijkstra's algorithm, using the new weight
field of graph struct.
We initialize the nodes weight using the base files that we can use in our
filecache (both filename and md5sum must match). The algorithm then picks
the best path among those that can be resolved.

Note that this algorithm has a few advantages over the old one:
1. It is completely file agnostic. These delta chains do not have to consist
   of package files- this could be adopted to do delta-fied DBs.
2. It does not use the local_db anymore, or even care if a package or file
   is currently installed. Instead, it only looks in the filecache for files
   and packages that match delta chain entries.

Original-work-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2008-04-26 11:36:01 -05:00
Dan McGee 30bdf94c2b Rework delta struct and modify code accordingly
Start to move the delta struct away from an assumed package name scheme and
towards something that is package (or even filename) agnostic. This will
allow us much greater flexibility in the usage of deltas (maybe even sync
DBs some day) as well as allowing code outside of delta.h/delta.c to be much
cleaner with less of a need for snprintf() calls.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-04-26 11:30:12 -05:00
Nagy Gabor 1b5a851851 Kill compute_requiredby usage in can_remove_package()
In the can_remove_package function, we don't need to compute the whole
requiredby list, we just need to find one member of it that doesn't belong
to the targets list.
That way we get a small speedup and remove the only usage of
alpm_pkg_compute_requiredby in the backend, so that it can be tweaked for
frontend usage.

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-04-25 18:51:47 -05:00
Dan McGee 7a873a8f12 Give libalpm native support for both libdownload and libfetch
This should remove the need for any additional patching to run on platforms
that have libfetch available but not libdownload. It isn't the prettiest,
but we have kept our libdownload impact down to just a few files, so it can
be easily done.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-04-19 16:18:17 -05:00
Dan McGee 64e1dd64a4 Remove unnecessary NULL check in FREE() macro
free() is designed to do nothing if it is passed a NULL pointer, so there is
no need to check for it on our end. Change/fix the macro.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-04-19 15:59:40 -05:00
Dan McGee bf84c23266 Merge branch 'maint' 2008-04-15 19:07:51 -05:00
Dan McGee c7a81c0b54 More non-Linux build updates, mostly Darwin
Darwin's binary format does support symbols with differing visibilities, but
it does not support the protected or internal visibilities- only hidden. For
Darwin only, we should fall back to this visibility to prevent warnings from
the compiler and because it is close enough for our library purposes.

See http://gcc.gnu.org/viewcvs/*checkout*/trunk/gcc/config/darwin.c, search
for the "darwin_assemble_visibility" function for more details.

Also add pacman.static.exe to gitignore.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-04-15 15:57:36 -05:00
Dan McGee d685d0220f Fix gettext on non-Linux platforms
Linux includes all the gettext stuff in glibc, so there is no need for the
libintl links which we failed to include in our linker variables. Update the
makefiles which should enable NLS support on all platforms, including OS X
and Cygwin.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-04-14 21:01:30 -05:00
Dan McGee ba70c52945 Fix compilation errors on x86_64
Things must have gotten stricter with GCC 4.3 on the '%zd' printf string and
this is the first I've tried to compile there. Fix the problem by using
size_t instead of int.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-04-14 18:24:45 -05:00
K. Piche 2d991a25ae remove.c: refactor into functions
Pulled two loops out of _alpm_remove_prepare and gave them their own
functions.

Signed-off-by: K. Piche <kevin@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-04-14 17:36:33 -05:00
K. Piche db4258c1fd Some comments for _alpm_unpack.
Signed-off-by: K. Piche <kevin@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-04-14 17:19:32 -05:00
K. Piche 9f56137034 add.c: added some tracing and improved some variable locality
Signed-off-by: K. Piche <kevin@archlinux.org>
[Dan: removed one logger]
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-04-14 17:17:22 -05:00
Dan McGee ee2bbb39b5 Memory allocation and other small cleanups
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-04-10 20:54:48 -05:00
Dan McGee 4bd0a85095 Merge branch 'maint' 2008-04-10 20:54:34 -05:00
Dan McGee e9a0d35d08 Remove unnecessary import in dload.h
We no longer expose any of libdownload in our public functions, so no need
to include this header anymore.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-04-10 20:53:28 -05:00
Dan McGee 4b7f7e2a59 Correctly use the fd returned my mkstemp()
There were a few issues with this code:
1. We already had an open fd to a file, but never used it to our benefit.
   Use the libarchive convienence method to write the current file contents
   straight to a file descriptor.
2. The real problem cropped up on Windows where the locking semantics caused
   the old way of extraction to fail because we had an open file descriptor.
   By using the file descriptor and closing it ASAP, we prevent these
   failures.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-04-08 18:55:22 -05:00
Dan McGee a708c6eadc Allow disabling of internal (libdownload) code
Add a new --disable-internal-download flag to configure allowing the
internal download code to be skipped. This will be helpful on platforms that
currently don't support either libdownload or libfetch (such as Cygwin) and
for just compiling a lighter weight pacman binary.

This was made really easy by our recent refactoring of the download code
into separate internal and external functions, as well as some error code
cleanup.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-04-06 21:00:11 -05:00
Dan McGee 9c7ebe6872 Remove a bit more download.h pollution
Kill it where it isn't absolutely necessary.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-04-06 20:28:43 -05:00
Dan McGee 4c872594da Remove unnecessary header file, move one macro to util.c
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-04-06 20:20:20 -05:00
Dan McGee e4a4cf7ce5 libalpm error cleanup, step 1
Remove unused error codes, begin refactoring some of the others.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-04-06 20:16:57 -05:00
Dan McGee 073bac794d Merge branch 'maint'
Conflicts:

	configure.ac
	contrib/Makefile.am
2008-04-01 22:14:58 -05:00
Dan McGee ab9187d07d Set handle->logstream to null after fclose()
We correctly closed the logfile stream when recalling set_logfile, but did
not NULL out the dead pointer once we did this. Fix the problem which was
the cause of FS#10056.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-04-01 18:08:58 -05:00
Dan McGee 0d1263af26 Merge branch 'maint' 2008-03-30 13:42:24 -05:00
Chantry Xavier 3fe43ffa04 Duplicate the result of archive_entry_pathname.
After the libarchive upgrade from 2.4.12 to 2.4.14, our usage of
archive_entry_pathname became dangerous. We were using the result of that
function even after calls to archive_entry_set_pathname.
With 2.4.14, the entryname becomes wrong after these calls, and so all the
future use of entryname are bogus. entryname is used quite a lot for
logging, so that's not so bad. But it's also used for the backup handling,
so that's not very cool. For example, reinstalling a package with backup
entries will erase all the md5 entries from the DB, because they won't be
found back.

entryname is now a static string so that we can easily keep the result of
archive_entry_pathname.

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
[Dan: fixed version numbers in commit message]
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-03-28 18:32:04 -05:00
Nagy Gabor 562442633a Use pkgcache instead of db_scan in remove.c
This should be a notable speed-up (apart from kernel cache).

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-03-28 17:53:04 -05:00
Dan McGee d140b440a8 Read .PKGINFO directly from package file
With the addition of the archive_fgets() function, we can now skip the temp
file usage in pkg_load/parse_descfile that was not needed. This has a nice
benefit of probably being both faster, reducing code, and getting rid of
"expensive" file operations.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-03-27 12:07:32 -05:00
Dan McGee f8c737d3b6 Add an archive_fgets() function
This crude function allows reading from an archive on a line-by-line basis
similar to the familiar fgets() call on a FILE stream. This is the first
step in being able to read DB entries straight from an archive.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-03-27 12:07:26 -05:00
Dan McGee 1dfd841e40 Make db->treename a pointer
I really don't think we need statically allocated strings here.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-03-26 20:19:44 -05:00
Dan McGee 5f1ccdbc27 Merge branch 'maint' 2008-03-23 16:58:53 -05:00
Nagy Gabor d1ea16dfd0 Avoid duplicated target names.
This patch should avoid duplicated target names in the backend.
1. sync_loadtarget will return with PM_ERR_TRANS_DUP_TARGET when trying to
add a duplicated target
2. sysupgrade never pulls duplicated targets
3. resolvedeps won't pull duplicated targets anymore

A pulled list was introduced in sync_prepare to improve the
pmsyncpkg_t<->pmpkg_t list conversion by making it more direct.

Also replace sync1005 and sync1006 by the sync1008 pactest, which is
similar but more interesting (the provisions are dependencies instead of
explicit targets).
sync1005 didn't work as expected anyway. It was expecting that pacman
failed, and pacman indeed failed, but not for the good reason. It didn't
fail during the preparation step because of conflicting targets, but during
the commit step, because of a md5 error...
And sync1006 didn't pass and was not really worth fixing. We have already
enough failing pactests more important than these two.
sync1008 pass with this patch.

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2008-03-23 16:57:14 -05:00
Dan McGee 6104f2e1fb memleak fix: ensure we free result of get_destfile()
In the file:// download case, we didn't free the return from get_destfile()
after we were done with it. Fix it. (Found with xfercommand001.py)

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-03-23 16:57:14 -05:00
Dan McGee 1086950c82 memleak fix: ensure backup fname isn't lost if unused
The _alpm_backup_split function always alloced memory for the fname, and we
let it disappear in a specific case (upgrade026.py). Fix the issue.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-03-23 16:55:52 -05:00
Dan McGee bf86700369 Switch pmgrp_t to dynamic allocation, general group cleanup
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-03-23 14:51:51 -05:00
Dan McGee f7f43dbb48 Update database mtime after it has been extracted
This will reduce the need for running an -Syy if the DB was only
half-extracted, as the mtime won't get updated until the new database is
completely in place.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-03-23 14:08:31 -05:00
Chantry Xavier 5af076f09f Kill the dependsonly option.
From the man page :
"This is pretty useless and we're not sure why it even exists."

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2008-03-22 18:39:15 +01:00
Chantry Xavier e7a2232934 Kill PM_TRANS_TYPE_ADD.
This was totally useless.

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-03-17 21:01:22 -05:00
Chantry Xavier 73ab153c44 Kill some obsolete references to -A option.
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2008-03-17 21:00:09 -05:00
Nagy Gabor 35135c0a0c Add -Rss option
* -Rss removes all dependencies (including explicitly installed ones).
* updated documentation
* two pactest files added to test the difference between -Rs and -Rss

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
2008-03-10 19:16:01 -05:00
Nagy Gabor d060e31be3 Remove trans->targets
Its implementation was quite broken:
* add_loadtarget() might have silently filtered out some targets when
  replacing an older version.
* This was used in sync.c to determine whether a target is implicit or not,
  which is incorrect behavior. Before this patch we silently removed user
  confirmed replacements; now we always warn on a replacement.
* remove001.py behavior was quite odd in adding same target 5 times to the
  target list, we can change this behavior to be a failure.

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
[Xav: changed remove001 pactest accordingly]
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
[Dan: rewrote commit message]
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-03-10 18:57:36 -05:00
Dan McGee 91b7f288fe Merge branch 'maint'
Conflicts:

	configure.ac
2008-03-09 12:03:54 -05:00
Chantry Xavier fc48dc3118 Refactoring of the download code.
This should be the main step in the download refactoring initiated by commit
81a2a06818.
The stub functions introduced by that commit were implemented.

The big download code was mostly composed of two steps, and so it has been
naturally splitted in two functions :  download_external and download_internal

file:/// urls are now handled manually, instead of forcing the use of the
internal downloader.

Thanks to Dan for fixing the remaining issues and cleaning up the patch :)

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2008-03-09 12:03:22 -05:00
Nagy Gabor 1dfcf1495b Remove a bogus comment from libalpm/remove.c
We do the opposite.

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
2008-03-09 11:30:01 -05:00
Nagy Gabor 54af52f87d New alpm_version function
Now pacman frontend uses this function instead of the compile-time libalpm
version number.

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
[Dan: fix one more spot where LIB_VERSION was used]
Signed-off-by: Dan McGee <dan@archlinux.org>
(cherry picked from commit 49197b7492)
2008-03-06 19:05:14 -06:00
Vojtěch Gondžala 7c3f6feb41 Update Czech translation
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-03-04 23:05:43 -06:00
Nagy Gabor 4a0498bd29 Remove a bogus comment
This comment was created for the old provision version format and needless.

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-03-04 06:40:32 -06:00
Dan McGee 190d17c0e8 Kill all of the line numbers from the translations
Hopefully the last of the huge commits ever. This also adds the c-format tag
to all of the translated messages.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-03-03 20:14:37 -06:00
Chantry Xavier 8725dce294 Disable the line number in .po files.
Add the --no-location xgettext option to disable the line numbers. They are
not very useful, and generate a huge number of pointless line changes on
every update.

Ref: http://www.archlinux.org/pipermail/pacman-dev/2008-March/011332.html

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2008-03-03 19:59:36 -06:00
Dan McGee 8a24ad3754 Convert Hungarian translation translation to UTF-8
The issue was discussed in this thread on the mailing list:
http://archlinux.org/pipermail/pacman-dev/2008-March/011324.html

In addition, the GNU gettext manual states that translation encoding is
completely separate from the encoding used by the users of the translation.
It makes sense for our project to use UTF-8 for all translations, regardless
of the preferred encoding used by users of a certain language. This allows
all contributors to more easily edit a translation file if necessary and not
have to worry about codepage issues.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-03-03 19:59:25 -06:00
Nagy Gabor 49197b7492 New alpm_version function
Now pacman frontend uses this function instead of the compile-time libalpm
version number.

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
[Dan: fix one more spot where LIB_VERSION was used]
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-03-01 17:02:05 -06:00
Dan McGee 73ac9f7b27 Merge branch 'maint' 2008-03-01 16:24:42 -06:00
Nagy Gabor aecc2fd190 Set a missing pm_errno in _alpm_pkg_load()
Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-03-01 15:57:59 -06:00
Chantry Xavier d734ebdde2 libalpm: clean up of md5sum functions.
test_delta_md5sum and test_pkg_md5sum were simple wrappers to test_md5sum,
and only used once, so not very useful. I removed them.
Also, test_md5sum and alpm_pkg_checkmd5sum functions were a bit duplicated,
so I refactored them with a new _alpm_test_md5sum function in libalpm/util.c

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2008-02-27 19:02:17 -06:00
Dan McGee c2dbbd60bc Start removing some junk from the function template
I screwed up originally when I accepted the TotalDownload patch,
8ec27835f4. I didn't realize how deeply it
modified libalpm and I probably shouldn't have let it do what it did. This
commit reverts much of what that patch added in order to clean up our
internal function calls. We can find another way to do it right down the
road here but for now it has to go.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-02-27 18:58:24 -06:00
Chantry Xavier 4fe7eb66eb libalpm/dload.c : memleak fixes.
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2008-02-27 18:55:26 -06:00
Chantry Xavier 79945ef7ff clean up dltotal leftover from 81a2a06818.
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2008-02-27 18:53:18 -06:00
Dan McGee d75f693155 Merge branch 'maint'
Also bump the devel version on the master branch to 3.2.0devel.
2008-02-25 20:49:59 -06:00
甘露(Lu.Gan) 7a9d444de8 Update simplified chinese (zh_CN) translation.
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2008-02-25 20:31:23 -06:00
Chantry Xavier 66591e8284 fix two broken translated strings.
Using c-format on every strings allowed me two found two broken ones.
One was harmless, but the other caused a segfault, as reported in FS#9658.

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2008-02-25 20:26:04 -06:00
Chantry Xavier 7eaad2f2a9 xgettext : change pass-c-format flag to c-format.
Currently xgettext apparently attempts to autodetect c format strings (eg a
string with a %s) to decide whether to use c-format flag or not.

If we use --flag=_:1:c-format instead of --flag=_:1:pass-c-format, the
c-format will be applied everywhere.
I couldn't find this documented anywhere though. But the pass prefix is
mentioned here :
http://www.gnu.org/software/gettext/manual/html_node/xgettext-Invocation.html#xgettext-Invocation
"Specifies additional flags for strings occurring as part of the argth
argument of the function word. The possible flags are the possible format
string indicators, such as ‘c-format’, and their negations, such as
‘no-c-format’, possibly prefixed with ‘pass-’."

And c-format is documented there :
http://www.gnu.org/software/gettext/manual/html_node/c_002dformat-Flag.html#c_002dformat-Flag
"This situation happens quite often. The printf function is often called
with strings which do not contain a format specifier. Of course one would
normally use fputs but it does happen. In this case xgettext does not
recognize this as a format string but what happens if the translation
introduces a valid format specifier? The printf function will try to access
one of the parameters but none exists because the original code does not
pass any parameters."

And that's exactly what happened with FS#9658.
So using c-format for every string will prevent this issue from happening
again.

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2008-02-25 20:25:57 -06:00
Dan McGee f159203f6f Remove pmserver_t abstraction
Remove what was a pretty weird abstraction in the libalpm backend. Instead
of parsing server URLs as we get them (of which we don't usually use more
than a handful anyway), wait until they are actually used, which allows us
to store them as a simple string list instead. This allows us to remove a
lot of code, and will greatly simplify the continuing refactoring of the
download code.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-02-24 20:21:58 -06:00
Dan McGee 81a2a06818 Add new stub download functions for use throughout the code
Add new stub functions that work by calling the existing (terrible) download
forreal function, which needs a serious overhaul. Hide the existing
functions and switch all former users to the new functions.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-02-24 20:21:58 -06:00
Dan McGee 3e8ae774bd Move download code out of server.c
This is the first in what will be a series of patches to clean up the
current download code in libalpm. Start by moving download code out of
server.c and into download.c.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-02-24 20:21:58 -06:00
Dan McGee ca1a187131 More cleanup to alpm_list
* Remove some #include statements that are not strictly necessary
* Remove node_new function that is really just a one-liner

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-02-24 18:07:44 -06:00
Nagy Gabor 8cfccf68c1 alpm_list.c clean-up
* Introduces 'list == NULL' convention for empty list. That means
alpm_list_new isn't needed anymore, so kill it

* Small straightforward fixes in alpm_list.c

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2008-02-25 00:52:58 +01:00
Chantry Xavier d5857ee15b libalpm/sync.c : fix poorly worded debug message.
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2008-02-25 00:30:21 +01:00
Dan McGee 3ad3077d8d Merge branch 'maint'
Conflicts:

	src/pacman/callback.c
2008-02-24 01:22:07 -06:00
Sergey Tereschenko 105e01c8ef Update Russian translation
Some corrections from the previous translation.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-02-24 00:44:35 -06:00
甘露(Lu.Gan) 731a774319 Add new Simplified Chinese translation
Thanks a lot! Now we get to fix the breakage this causes in output messages.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-02-22 08:24:08 -06:00
Dan McGee 4bd52f3fe4 Merge branch 'maint'
Remove gettext() function addition from gensync and updatesync in master as
gettext is no longer used in them anyway.
2008-02-20 18:58:04 -06:00
Mateusz Herych 5676dbae4d Final updates to Polish translation
Good job on the group effort guys, thanks for getting this one complete.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-02-19 08:41:05 -06:00
Sergey Tereschenko 848edb2f38 Update libalpm russian translation.
Cleaned up by Oleg Finkelshteyn.

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2008-02-18 12:53:30 -06:00
Allan McRae b091ccc400 Do not warn about up to date package when downloading only
Stops the "<pkg> is up to date -- reinstalling" message when using the
download only flag.
Ref: http://archlinux.org/pipermail/pacman-dev/2008-January/010952.html

Signed-off-by: Allan McRae <mcrae_allan@hotmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-02-18 00:18:43 -06:00
Dan McGee 92ab7c33fb Move pmgraph_t struct and functions to their own header file
This will allow us to utilize this helpful type and functions in places
besides dependency calculations. In addition, remove the public declaration
of pmgraph_t in alpm.h- there is zero need to expose this internal type.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-02-16 11:58:49 -06:00
Dan McGee 6b07b5d345 Merge branch 'maint'
Conflicts:

	lib/libalpm/be_files.c
	lib/libalpm/package.c
2008-02-15 19:40:22 -06:00
Matthias Gorissen be95e4d8a0 More small updates to German translation
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-02-15 16:07:28 -06:00
Dan McGee 59a6b519da Merge branch 'translations' into maint 2008-02-14 21:22:27 -06:00
Dan McGee b206aaee88 Ensure DESC infolevel is loaded before checking pkg->filename
This is the first step of fixing FS#9547. This should not break any existing
code that may rely on this function behaving the way it did, and should be
good for inclusion in a maint release.

In addition, update pactest so it fills the FILENAME field in the DB entries
it creates so we can move forward with a real fix to this issue.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-02-13 22:52:53 -06:00
Vojtěch Gondžala 706c690b64 Updated Czech translation for 3.1.2 release
Signed-off-by: Giovanni Scafora <linuxmania@gmail.com>
2008-02-12 23:05:33 +01:00
Chantry Xavier 279fbc44b1 Update french translation.
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Giovanni Scafora <linuxmania@gmail.com>
2008-02-12 12:17:20 +01:00
Dan McGee 9bf487b2ff Move some translations to their generic language code
For our Czech, Polish, and Russian translations, they do not need to be at
the more specific 'lang_COUNTRY' code, but can live at just plain 'lang'.
This follows the pattern of most other translated programs out there as
Roman pointed out on IRC.

ru_RU: 2 (pacman and libalpm)
ru: 128 for him, 131 for me (everything else)

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-02-11 20:40:44 -06:00
Dan McGee fbf3beb8d2 ensure chk_fileconflicts reads entire file list
If the end of the pB list was reached before the end of pA, we failed to
read any remaining files from the pA list. Add an additional loop to ensure
all entries of pA are added to the return list regardless of whether we have
reached the end of pB.

This new loop also eliminates the now-unnecessary check for a null pB, as we
need to ensure we are excluding directories in the resulting output anyway.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-02-11 20:40:43 -06:00
Dan McGee bfc024eab3 Merge branch 'maint' 2008-02-07 20:16:16 -06:00
Nagy Gabor 77c3cf9790 Remove alpm_sync_get_newversion function
sync->newversion shouldn't be public at all, and internally we access it directly.
(Before pmsyncpkg_t clean-up the analogue of this field [type] was needed in replaces computation.)

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2008-02-07 20:15:30 -06:00
Nagy Gabor 7dc37109b0 alpm_sync_sysupgrade split
This patch indroduces a new public alpm_sync_newversion, which scans for new
version of a package in sync repos.
Hopefully this will reduce code duplication in the future:
* check-for-pacman-new-version from front-end can be easier
* -Qu refactoring

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2008-02-07 20:15:23 -06:00
Chantry Xavier 0c2206f542 libalpm/add.c : safety check for fixing FS#9235.
Fixes FS#9235.

We already had the following case in extract_single_file :
/* cases 1,2,3: couldn't stat an existing file, skip all backup checks */

But we actually only did a lstat here. And if lstat worked, we did a stat
without checking.
When lstat works and stat fails, it means we have a broken symlink, like in
FS#9235. We can actually treat this case like a non-existing file.
The broken symlink will then be simply overwritten.

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2008-02-07 14:58:23 +01:00
Nagy Gabor 05d5634958 libalpm/package.c : add _alpm_pkgname_pkg_cmp function.
_alpm_pkgname_pkg_cmp(pkgname, pkg) returns true iff pkg's name is pkgname.
This is useful if you want to remove a package from pmpkg_t* list, and you
want to search for package name.

This allows cleaning the -Ru code a bit, by removing the need of a dummy
pkg.

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2008-02-06 08:46:15 +01:00
Nagy Gabor e63366ae5e New remove option : -u / --unneeded (FS#6505).
With --unneeded option 'pacman -R' doesn't stop in case of dependency error;
it removes the needed-dependency targets from the target-list instead.  See
also: http://archlinux.org/pipermail/pacman-dev/2007-October/009653.html .

The patch also adds a new causingpkg field to pmdepmissing_t which indicates
the to-be-removed package which would cause a dependency break. This is
needed, because miss->depend.name may be a provision. miss->causingpkg will
be useful in -R dependency error messages too.

[Xavier: renamed inducer to causingpkg, removed the _alpm_pkgname_pkg_cmp
helper function as requested by Aaron. This might be added by a further
commit.  Other small cleanups, updated manpage and bash completion.]

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2008-02-06 08:46:15 +01:00
Nagy Gabor 1fc83f4af6 pmsyncpkg_t cleanup
Fix for sync044.py and reason001.py.
Rename sync->data to sync->removes (alpm_list_t *)
Replace pmsynctype_t sync->type by pmpkgreason_t sync->newreason

The type field was set to UPGRADE or DEPEND or REPLACE.
Instead of using type = UPGRADE or DEPEND, we now rather use a
"pmpkgreason_t newreason" field directly (= explicit or depend) which allows
a better handling of the install reason.
And the REPLACE type is now deduced implicitly when the sync->removes list
is not empty.

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-01-27 12:05:33 -06:00
Nagy Gabor 9bfbd73917 Fix PM_ERR_CONFLICTING_DEPS handling in sync.c
* eliminate asymmetry (innerconflict vs. outerconflict)
* fix a memleak (in case of PM_ERR_MEMORY deps wasn't freed)
* fix wrong pmconflict_t duplication (*retconflict = *conflict)

Note: the new code introduces some code duplication which shall disappear by
fixing FS#7524.

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-01-27 11:54:35 -06:00
Nagy Gabor ea828b5693 New _alpm_conflict_dup function
Added function to cleanly duplicate a conflict.

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2008-01-27 11:54:25 -06:00
Nagy Gabor f432ce41e0 small sync.c code clean-up
Remove unnecessary synclist_free function, and use our standard way
(alpm_list_free_inner + alpm_list_free) instead.
This slightly reduces code duplication.

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-01-27 11:52:46 -06:00
Chantry Xavier 88cbee3c24 libalpm/sync.c : conflicts resolving cleanup.
The original patch from Nagy tried to resolve target vs target conflicts,
and so broke the following pactests : sync040, sync041 and sync990

Nagy's proposal to solve this situation was to choose the interactive way,
ask the user how to deal with it: either remove pkg1 or remove pkg2 or stop
here.  So he left this as a TODO.

But instead of trying to resolve these conflicts or asking the user, I
tried to find a more conservative way, looking at what the current pactests
expected:
If between the two conflicting packages, one provides the other, pacman
will keep that one and remove the other from the target list.  That breaks
sync893 and sync897. But Dan agreed these two looked weird and should be
changed.

This commit should close FS#8897, FS#8899 and FS#9024.

Reference:
http://www.archlinux.org/pipermail/pacman-dev/2007-October/009745.html
http://www.archlinux.org/pipermail/pacman-dev/2007-December/010393.html

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-01-23 20:13:01 -06:00
Dan McGee 69c6d59bb6 Fix flip-flopped parameters to CALLOC macro
The mixup causes a fail in the build using --enable-debug on x86_64 but not
i686, so none of us caught this right away. Fix it. FS#9297.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-01-23 20:13:01 -06:00
Chantry Xavier 8240da6cb3 libalpm/cache.c : don't duplicate packages in pkgcache.
Edit _alpm_db_add_pkgincache to not duplicate packages, because this is not
needed, is slower, and uses more memory. This made the max memory usage
during base reinstall go from 10.4MB to 9.7MB.

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-01-23 20:13:01 -06:00
Chantry Xavier 22c900e7d5 Add new public alpm_checkdbconflicts function.
This function has a limited purpose, but might be interesting to do a
sanity check from a frontend (eg testdb).

Also removed the private _alpm_checkconflicts function to avoid confusion.
This function was used only once in libalpm, in sync.c, and was just a
single line anyway. Having to do it manually makes it explicit that we are
looking for two kind of conflicts (targ vs targ and db vs targ).

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-01-23 20:12:41 -06:00