Commit Graph

918 Commits

Author SHA1 Message Date
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
Chantry Xavier 6b8f404a33 small memleak fix in sync.c.
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2008-01-23 19:52:16 -06:00
Dan McGee 9247ddbe8a conflict.c: move debug message out of inner loop
We have a debug message in the target vs. target file conflict check, and
this is a bit rediculous when it comes to watching output from something
like smoke001.py. Instead, put the output outside this inner loop so we only
see it at most once per target, which is much more reasonable.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-01-21 19:44:10 -06:00
Dan McGee 36264a3ab9 Fix memleak found by add004.py
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-01-21 19:44:02 -06:00
Nagy Gabor 2a7101c049 New --asexplicit option
This is the symmetric of --asdeps, install packages explicitly.
Documentation and completion files were updated accordingly.
Added sync301.py and upgrade032.py pactest files to test this.

I also made a little modification in ALLDEPS handling too.

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2008-01-21 19:39:26 -06:00
Chantry Xavier b2914bf0af Move the deptest code from frontend to backend.
The deptest code (pacman -T) used by makepkg was mostly in the frontend.
There were 2 drawbacks:
1) the public splitdep function returns a pmdepend_t struct, but the
_alpm_dep_free function for freeing it is private. So there was a memleak.
2) there is a helper in the backend (satisfycmp in deps.c) which makes this
function much easier.

So this adds a new public alpm_deptest in libalpm/deps.c, which cleans
pacman_deptest in pacman/deptest.c a lot.
Besides, alpm_splitdep was made private, because the frontend no longer
requires it, and _alpm_dep_free is also private.
Finally the deptest001 pactest was extended.

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-01-21 19:35:43 -06:00
Dan McGee 927af790ee Convert deltas to dynamic allocation
Another elimination of a static length structure in libalpm. Should result
in a little more memory saved during execution of packages with lots of
deltas attached.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-01-21 19:33:32 -06:00
Dan McGee f6785dcb89 Merge branch 'maint' 2008-01-18 19:33:25 -06:00