Commit Graph

997 Commits

Author SHA1 Message Date
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
João Felipe Santos f374ead66a Portuguese Brazilian translation update for pacman 3.1.1
Signed-off-by: Giovanni Scafora <linuxmania@gmail.com>
2008-01-19 00:00:50 +01:00
Matthias Gorissen 8343121f87 Corrections of German translation
Signed-off-by: Giovanni Scafora <linuxmania@gmail.com>
2008-01-18 00:16:09 +01:00
Juan Pablo Gonzalez 6f181c22d2 Spanish translation update for pacman 3.1.1
Signed-off-by: Giovanni Scafora <linuxmania@gmail.com>
2008-01-16 23:54:34 +01:00
Vojtěch Gondžala de5e49f4be Czech translation update for pacman 3.1.1
Signed-off-by: Giovanni Scafora <linuxmania@gmail.com>
2008-01-16 17:19:50 +01:00
Jeff Bailes 601f6a8a29 English (British) translation update for pacman 3.1.1
Signed-off-by: Giovanni Scafora <linuxmania@gmail.com>
2008-01-16 17:14:50 +01:00
Nagy Gabor d9a9ffd77d Hungarian translation update for pacman 3.1.1
Signed-off-by: Giovanni Scafora <linuxmania@gmail.com>
2008-01-16 17:11:44 +01:00
Dan McGee db557e0563 Update message files for 3.1.1 release
We are in string freeze for the 3.1.1 release. This commit updates all the
message files to the latest code, and all translation updates should be
based off of these po-files. Please attempt to keep the line number changes
to a minimum- there should be no reason to update these po files with just
new line numbers. That way we can more easily see exactly which translations
were updated.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-01-14 23:16:16 -06:00
Dan McGee 38e981fab3 Merge branch 'maint' 2008-01-14 22:58:44 -06:00
Chantry Xavier 0c5b68877b Change the versioned provision format.
Change the 'provname provver' format to 'provname=provver'.
In .PKGINFO, the provisions are copied from the PKGBUILD without quotes. So
the provision version was actually handled as a different provision...

See FS#9171.

Dan: Unfortunately we have to change our original specification for
versioned provisions with this patch, but it ends up being the simpler and
cleaner solution in the long run, and if there is any time to change it the
time is now before many packages have been built. Keeping the ' ' based
format would have required us to do special parsing in repo-add, as well as
being susceptible to users not using quotes in their provides array.

Hopefully this will resolve the issues we had with our initial plan. Sorry
for the confusion.

Acked-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-14 22:03:03 -06:00
Jaroslaw Swierczynski 801a268056 FS#9183 : force correct permissions on tmp/.
[Xav: removed unneeded makepath_internal function, and fixed the permission
value : 1777 -> 01777]
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-01-13 18:42:26 -06:00
Chantry Xavier 8186dc11a9 Ensure correct dir permissions in the database.
Fix for FS#9176.
A previous commit (6e8daa553b) already forced all database files to 644.
Now the directories are also forced to 755.

Additionally, repo-add now sets the umask to 022, just like makepkg does, to
fix the problem at its root.

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-01-13 12:51:37 -06:00
Dan McGee 521de7ceed Merge branch 'maint' 2008-01-13 12:27:17 -06:00
Chantry Xavier ab506f77c0 util.c : fix segfault when the cachedir isn't usable.
For example, if the cachedir is a broken symlink or a non writable
directory, pacman fallbacks to /tmp/. Just before doing that, it freed the
handle->cachedirs list twice !
once in _alpm_filecache_setup, and once in alpm_option_set_cachedirs. So the
first one was removed.

Fixes FS#9186.

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2008-01-13 12:21:21 -06:00
Dan McGee 4f26701793 memleak fix with new dynamic depend structure
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-01-12 20:18:20 -06:00
Chantry Xavier 435ec29bc7 libalpm/sync.c: don't duplicate packages for the sync->data field.
Packages put in the sync->data field were always duplicated with pkg_dup,
and then freed, This is not needed.
Killing this duplication of packages made the memory usage during base
reinstall go from 10.4 MB to 8.1 MB.

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2008-01-12 17:51:29 -06:00
Nagy Gabor 633dbeac88 small checkdeps speed-up
In the old code 'alpm_list_diff(_alpm_db_get_pkgcache(db), dblist,
_alpm_pkg_cmp);' was slow.

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>

[Xav: In my opinion, computing both dblist and modified in one for loop also makes
the code clearer, besides being more efficient.
Also renamed joined to targets since I also find that clearer.]

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2008-01-12 11:05:52 -06:00
Chantry Xavier e654236db6 don't send CHECKDEPS_DONE event when NODEPS is set.
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-01-12 10:45:45 -06:00
Aaron Griffin 26f4993e1d Store replaces in the local DB too
Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
[Dan: might as well store 'force' too]
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-01-12 01:33:57 -06:00
Dan McGee 2630556bde Merge branch 'maint' 2008-01-11 23:19:52 -06:00
Dan McGee 3e133524a5 Add functions to manipulate pmdepend_t objects
We didn't have a free function before, causing some memory leaks. We also
need a dup function now that strings are not in the structure but are
dynamically allocated.

Also adapt pmdepmissing_t to use a pointer to a depend struct instead of an
inclusive one so we can use the functions we created here.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-01-11 22:58:05 -06:00
Allan McRae 8372a9e8c7 Only notify of dependency check in removal if performed
Moves "checking dependencies..." notification into code block where
dependency checking is performed to stop spurious notification.
Reference: http://archlinux.org/pipermail/pacman-dev/2008-January/010714.html

Signed-off-by: Allan McRae <mcrae_allan@hotmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-01-11 19:29:49 -06:00
Dan McGee f9a7d8cba4 Fix library interface
Two functions defined in alpm.h were not marked with SYMEXPORT, causing
linking errors if they were used.

In addition, remove the incorrect use of the 'alpm_' prefix from an internal
function and replace it with '_alpm_'.

Fixes FS#9155.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-01-11 08:43:10 -06:00
Dan McGee ccc1c73152 Use dynamic string allocation in package structures
This also affects all structures with static strings, such as depmiss,
conflict, etc. This should help a lot with memory usage, and hopefully make
things a bit more "idiot proof".

Currently our pactest pass/fail rate is identical before and after this
patch. This is not to say it is a perfect patch- I have yet to pull valgrind
out. However, this should be quite safe to use in all situations from here
on out, and we can start plugging the memleaks.

Original-work-by: Aaron Griffin <aaronmgriffin@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-01-11 00:01:58 -06:00
Chantry Xavier 47761d5aec Move the fallback on providers from backend to frontend.
This reverts commit e28973169d.
This code might fit better in the frontend than in the backend finally.
Ref: http://www.archlinux.org/pipermail/pacman-dev/2007-November/010150.html

I also changed it for fixing FS#8763 :
if there is exactly one provider, pacman will pull it and print a warning.
if there are several providers, pacman will list them and fail. It's up to
the user to pick one. Add sync501 pactest to reflect that.
2008-01-09 18:33:11 -06:00
Dan McGee 9dd016001e Remove upgradedelay and all code associated with it
It wasn't even implemented correctly, and it really doesn't have a use if
packagers just do their job correctly anyway for a distro. Let's not try to
solve a problem with the wrong solution now.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-01-08 15:49:52 -06:00
Dan McGee a24c323aba Remove unused date element from pmpkg_t struct
We had an unused date element in the pmpkg_t struct (not builddate or
installdate). Kill it off and fix the one function that was using it.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-01-08 13:29:41 -06:00
Chantry Xavier a71f4c4c6a conflict.c : fix for FS#8156, detect conflict between symlink and dir.
The previous fileconflict check (package vs filesystem) skipped the conflict
when the file on the filesystem was a directory or a symlink to a directory,
no matter what the file in the package was.
Now, the conflict will only be skipped if the file in the package is a
directory (so compatible with a dir or a dir symlink on the filesystem).

So in the case of 8156 (new fileconflict003 pactest for this case), instead
of silently ignoring the extraction of the test symlink, pacman will now
fail because of a file conflict between the test symlink in the pkg2 package
and the test directory on the filesystem.

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2008-01-06 10:59:41 +01:00
Dan McGee 1a0aaa20df Don't stat cachedir immediately
By attempting to stat the cachedir when we load the pacman config, pacman
bails out if it is a non-existant directory, even if it will never be
needed. This is unfortunate as it is only used for sync transactions anyway.
Instead, wait until we need it in _alpm_filecache_setup to actually do
anything.

Reported as FS#9096.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-01-05 17:39:38 -06:00
Dan McGee 5aa873edb6 sync.c: add sanity check so we don't dereference a null pointer
Originally noticed in FS#9024, but was fixed in previous changes anyway.
However, it doesn't hurt to still check it.

Also add a pactest from Chantry Xavier for the original problem to ensure
we can't reproduce it.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-01-05 17:35:43 -06:00
Chantry Xavier 85a8b150ed conflict.c : fix for upgrade042.
Thanks to the proactive backup handling, we don't need to add the moving
file to the skip_add list.
The backup handling will make sure nothing gets overwritten.

Ref: http://www.archlinux.org/pipermail/pacman-dev/2007-December/010610.html

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-01-05 16:49:09 -06:00
Chantry Xavier 601a85082d add.c : fix upgrade026 pactest.
This was the case of the bash packaging error where a file was removed from
the package but not the backup array.
I just added a sanity check so that only the files from the backup array
that are also in the filelist are used.

I had to edit upgrade026 pactest slightly : it required the file to be
copied to .pacsave instead of moved. But just moving it should be enough, as
we agreed on the ML :
http://www.archlinux.org/pipermail/pacman-dev/2007-December/010440.html

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-01-05 13:47:49 -06:00
Matthias Gorissen 04472f925a Update of German translation
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-01-05 13:47:35 -06:00
Dan McGee c18191ba5b Small code cleanups with indents/spaces
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-01-01 20:03:24 -06:00
Dan McGee 4abd710ec9 Remove gettext calls from debug-level messages
These used FUNCTION output level and not DEBUG, so I didn't catch them way
back when I removed those gettext calls. Remove them now (which exposed a
nice little memory access error elsewhere in the code). This should have a
slight speedup effect on the code too as we no longer have to make the
gettext call even when these messages aren't printed.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-01-01 20:03:24 -06:00
Dan McGee 553ce8323c Fix another usage of pkg_new in _alpm_sync_addtarget
Use _alpm_pkg_dup instead.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-01-01 20:03:24 -06:00
Dan McGee d18686a563 Switch pkg_new -> pkg_dup in find_replacements
Ugh, it was a pain to figure out why the Total Removed Size was showing up
wrong in the output of removed packages, but this was why- we used a stupid
_alpm_pkg_new call instead of just duping the package. Fix this. In the long
run, we really need to figure out better ways to not duplicate all this
package information.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-01-01 20:03:24 -06:00
Chantry Xavier ac0605b9c2 new upgade042 pactest + bugfix in chk_filedifference.
This adds a pactest for the relocation of a config file between two packages
(case of etc/profile moving from bash to filesystem).
While running this pactest, I found out that chk_filedifference didn't work
correctly with an empty list as second argument. So that's fixed now.

Ref: http://www.archlinux.org/pipermail/pacman-dev/2007-December/010610.html

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-01-01 20:03:18 -06:00
Dan McGee fbd88a8212 Remove .FILELIST generation from makepkg (and elsewhere)
This is something pacman can do on its own straight from the archive, and we
will reduce the chance of problems occurring becuase of inproper FILELIST
generation as we have had in the past with special characters in filenames.

Once we remove it from makepkg. we can remove any usage of it from all of
our other tools, including pacman, pactest, and contrib/ utilities.

Note that removing it from pacman uncovered a few other bugs anyway, so this
was probably a good move.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-29 11:58:23 -06:00
Chantry Xavier 01930400a5 add a new upgrade026 pactest for backup handling.
This is the bash case when the /etc/profile file was removed by error from
the package, but stayed in the backup array.

Ref:
http://www.archlinux.org/pipermail/arch-dev-public/2007-December/003556.html

Also fixed a little typo in add.c, but it's disabled code.

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2007-12-29 11:17:20 -06:00
Chantry Xavier c913c53322 libalpm/add.c: disable buggy backup handling code that didn't do anything.
As I mentioned earlier on the ML :
http://www.archlinux.org/pipermail/pacman-dev/2007-December/010416.html
the first part of commit 843d368ef6 had no effect because of a bug.

So I fixed the bug, but since this would change backup handling behavior,
and possibly require other bigger changes to work right, I decided to just
disable that part temporarily, and left a TODO in the code.

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-28 19:57:11 -06:00
Chantry Xavier 630541a72e french translation : one broken message caused a segfault.
pacman segfaulted on sync012 pactest because of one broken translation.

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2007-12-28 19:56:14 -06:00
Chantry Xavier 457692b928 libalpm/remove.c : switch back to lstat usage.
commit b55abdce7a changed every instance of lstat to alpm_stat to remove an
eventual trailing /, but in remove.c, this is not wanted.

Ref: http://www.archlinux.org/pipermail/pacman-dev/2007-December/010451.html

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-28 19:55:38 -06:00
Allan McRae 14d6832ef2 Allow NULL parameter in alpm_trans_commit
Fixes FS#7380: alpm crashes on passing NULL to alpm_trans_commit in
a sync operation.  Adds check that data parameter is not NULL in
several functions.

Signed-off-by: Allan McRae <mcrae_allan@hotmail.com>
[Dan: fix whitespace]
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-28 19:46:21 -06:00
Allan McRae cca4ec647e Add remove counterparts to alpm_option_add_* functions
Fixes FS#7428. Added functions to remove cachedir, noupgrade, noextract,
ignorepkg, holdpkg and ignoregrp.

Signed-off-by: Allan McRae <mcrae_allan@hotmail.com>
[Dan: fix whitespace]
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-28 19:43:59 -06:00
Nathan Jones 7fdb2ee48a Check ignored packages in _alpm_sync_addtarget().
This will allow someone to install a group but ignore individual
packages inside the group.

Signed-off-by: Nathan Jones <nathanj@insightbb.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-21 11:09:24 -06:00
Nathan Jones b43301428e Fix memory leak in shortest_delta_path.
It is possible for the if statement to never succeed, causing path to
never be freed. It is also possible for the if statement to succeed more
than once per loop, which could have caused a segfault.

Signed-off-by: Nathan Jones <nathanj@insightbb.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-21 11:08:05 -06:00
Vojtěch Gondžala 9a6582a8fd Add new Czech translation
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-21 11:05:44 -06:00
Chantry Xavier 020629a371 Finish french translation.
It's probably far from perfect, but at least I tried to translate
everything.
I noticed a missing newline at libalpm/trans.c , line 573 :
_alpm_log(PM_LOG_ERROR, _("call to popen failed (%s)"),

I don't think it's possible to fix it now (string freeze?), so I didn't.

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2007-12-21 11:05:44 -06:00
Nagy Gabor c0845db8f7 Updated Hungarian translation
1 untranslated message translated and 1 message fixed

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-20 08:05:54 -06:00
Nagy Gabor 13dd2864ca PM_DEP_MOD_LT and PM_DEP_MOD_GT depmods added
You can use foo<2.0 and foo>2.0 as depend
add046.py and add047.py pactests were added to check this

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-19 14:48:05 -06:00
Nagy Gabor 47f4c5a480 Updated Hungarian translation
* Updated libalpm translation
* Regenerated hu.po files, because the 'call-for-translators version' was outdated

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-19 13:30:04 -06:00
Giovanni Scafora 16ed9ad19b Updated Italian Translation
Signed-off-by: Giovanni Scafora <linuxmania@gmail.com>

	modified:   lib/libalpm/po/it.po
	modified:   po/it.po
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-18 18:27:23 -06:00
Giovanni Scafora a11b2065af Updated Italian Translation for pacman 3.1
Signed-off-by: Giovanni Scafora <linuxmania@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-17 20:43:12 -06:00
Dan McGee ce424a356f Check for errors on descfile extraction
If /tmp was full during the early stages of package extraction, we were
unable to extract the package description file with the call to
archive_read_data_into_fd(archive, fd) becuase we never checked the return
code. Add a check to ensure the extraction was successful and print and
return an error if it was not instead of falling through to a possibly
untrue error message.

This should fix FS #8885.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-16 22:45:57 -06:00
Aaron Griffin 9558639d80 popen does NOT require /bin/sh in a subchroot
I appears that when chrooted, the /bin/sh used by popen is that of the parent
process. This is true until the process forks once chrooted, which we do not
want to do.

As such, this actually makes things nicer. We don't need a /bin/sh in a chroot
to run install scriptlets, and don't need to check for it in the root directory

Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-10 23:03:16 -06:00
Aaron Griffin 565d2eeed5 Correct scriptlet usage pattern
The new pattern is as follows:
    . /path/to/scriptlet
    post_upgrade X Y

This requires less frameworking in the install scripts (the three lines that
shift and eval a function are nasty)

Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-10 23:02:07 -06:00
Dan McGee 9781d0d637 Update GNU GPL boilerplate and copyright dates
Update the GPL boilerplate to direct people to the GNU website for a copy of
the license, as well as bump all of Judd's copyrights to 2007.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-10 22:55:39 -06:00
Dan McGee 7249c08bdf Improve changelog handling through addition of open/read/close functions
Thanks to Allan for inspiring all this work on what was one little TODO item
in the codebase. :)

Change changelog handling so we can now dump a changelog from both installed
packages and package files (fixes FS#7371). We do this by moving all of the
machinery to the backend where it should have been in the first place.

The changelog reading is now done through a open/read/close interface
similar to the fopen/fread/fclose functions (can you guess how it is done?).
It is buffered by the frontend, so programs using the library can read as
much or as little as they want at a time.

Unfortunately, I could not implement a changelog_feof function due to some
shortcomings of libarchive. However, I left the stub code in there,
commented out, in case it becomes possible later or anyone wants to take a
stab at it.

Original-work-by: Allan McRae <mcrae_allan@hotmail.com>
Improved-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-09 11:33:08 -06:00
Chantry Xavier 2ef78355fc _alpm_unpack: return 1 when the file is not found.
If _alpm_unpack has a specific file to extract (not NULL), but doesn't find
it, it'll now return 1, for indicating the failure.

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-08 21:54:46 -06:00
Chantry Xavier 97fe3d3f5a libalpm/server.c : fix segfault when downloading failed.
The alpm_list_free(complete) needs to be done OUTSIDE the loop walking
through the server list.

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-07 09:45:20 -06:00
Nagy Gabor 43eacf2852 Remove duplicated PM_TRANS_CONV_INSTALL_IGNOREPKG message
Now alpm_checkdeps first search for literals, then search for no-literal satisfiers

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
[Dan: fix spelling of INTALL, fix line wrapping]
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-05 11:28:47 -06:00
Chantry Xavier 87d95f14f7 libalpm/backup.c : simple refactoring.
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2007-12-04 17:59:45 -06:00
Giovanni Scafora 0d1cb03756 Update it translation for 3.1
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-03 09:11:34 -06:00
Jeff Bailes 4ce004a846 Update en_GB translation for 3.1
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-02 22:36:18 -06:00
Dan McGee 3170106149 Update all translation files in anticipation of 3.1 release
Update all of the pot and po files with the latest messages available.

Translators- you are encouraged to do this as well every time you update the
translation, and the directions in 'translation-help' should help. Also feel
free to delete all the old translations that end up at the bottom of these
files and only clutter things up.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-02 21:44:40 -06:00
Chantry Xavier 594f1fbbb1 alpm_list : change the alpm_list_find* to return the matching item.
alpm_list_find and alpm_list_find_ptr will now return a void *, and
alpm_list_find_str will return a char *, instead of an int.

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-02 18:12:41 -06:00
Dan McGee 0b6d73a5b4 Remove _alpm_depmiss_isin
This is unneeded now that commit 2ed6b482d2
has eliminated the last user of this function.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-02 17:25:34 -06:00
Dan McGee 7341d09541 Add 4 new pactests to get better code coverage by pactest
I started playing around with gcov today and it showed a few places in the
code that we don't test at all. This is the start of ensuring that we
execute most of the code in our codebase.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-02 17:24:22 -06:00
Chantry Xavier 250331a636 Add new --needed option for -S.
During a pacman operation such as a group install, pacman can ask several
questions such as "local version is up to date. Upgrade anyway?". They are
usually all answered either by yes or by no:
* yes when you want to reinstall all the targets.
* no when you only want to install the missing ones (either because you are
installing a group, or because you are copying a pacman -S line from wiki or
whatever).

So instead of asking this question for each target, it is now now configured
with a flag.  Yes will be the default -S behavior, No will be achieved with
the --needed flag.

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-02 11:14:13 -06:00
Chantry Xavier 22c2043160 Minor fixes in sync.c and deps.c.
* memleak found by Nagy in checkdeps
* an useless line found by Nagy in resolvedeps
* data wasn't set to the missing dependencies in sync_prepare
* use the MALLOC macro in resolvedeps

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-01 11:10:22 -06:00
Aaron Griffin 5f811dc020 Ensure 0644 permissions for install and changelog files
Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-01 10:43:16 -06:00
Dan McGee cff1e2a58f Remove alpm_depcmp DEBUG output
alpm_depcmp is simple enough that we shouldn't need constant debug logging,
and the logging we do have in there negatively impacts our speed regardless
of whether we actually are seeing it or not. If it ever needs debugging, it
would be trivial to reimplement it by just temporarily reverting this
commit.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-30 23:02:06 -06:00
Dan McGee e95e346ac7 Remove some null checks in _alpm_checkdeps
Hopefully these are unnecessary, as they were probably added originally to
cover up a problem instead of finding the root cause. I'd rather fail hard
in these cases anyway.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-30 22:57:47 -06:00
Nagy Gabor 2ed6b482d2 alpm_checkdeps clean-up
No bugfixes, just makes the code human-readable

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-30 21:17:04 -06:00
Nagy Gabor 72f40b3876 _alpm_checkconflicts split
_alpm_innerconflicts: check for target<->target conflicts
_alpm_outerconflicts: check for target<->localpkg conflicts
This will be useful in sync.c clean-up and in testdb.c

As an application the patch also fixes a misleading message (and a memleak)
in add.c

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>
2007-11-25 16:14:16 -06:00
Nagy Gabor 7d37d9278d Fix for sync1003 and sync1004 pactests
checkdeps and resolvedeps now take both a remove list and an install list as
arguments, allowing dependencies to be calculated correctly.

This broke the sync990 pactest, but this pactest used dependencies and
provides in an unusual way, so it has been changed.

Dan: the sync990 pactest was just plain wrong. It didn't satisfy the
dependencies correctly, so should never have succeeded.

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
[Dan: some variable renaming, clarification in commit message]
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-25 15:29:37 -06:00
Aaron Griffin 6e8daa553b Force mode of all database files to 644
In the case of a packaging error where install or changelog had bad permissions,
pacman respected the original permissions without trying to fix it - this means
that some operations (changelog) artificially required root permissions to run

In addition, minor function housekeeping on _alpm_unpack

Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
2007-11-25 14:03:13 -06:00
Aaron Griffin c7879e77a7 Additionally search for non-regex strings on a db search operation
This closes out FS#6500 and covers cases where the package names contain regex
characters (i.e. the case of dvd+rw-tools)

Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
2007-11-25 14:02:25 -06:00
Aaron Griffin 7af1f66441 Make the download failure message more clear
Use the word "disk" in place of the host name for local files

Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
2007-11-25 14:02:03 -06:00
Chantry Xavier 8d9ee923ec Fix several memleaks, mostly related to errors handling.
* The frontend calls alpm_trans_prepare(&data), and in case of errors,
receive the missing dependencies / conflicts / etc in the data pointer.
It apparently needs to free this structure totally with :
alpm_list_free_inner(data, free)
alpm_list_free(data)

So I added alpm_list_free_inner(data, free) in
pacman/{sync.c,remove.c,add,c}

* in _alpm_sync_prepare, the deps and asked lists were not freed in case
of errors (unresolvable conflicts).
Besides the code for handling this case was duplicated.

* in _alpm_remove_commit, free was used instead of alpm_list_free for
newfiles.

* newline fix in pacman/sync.c

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-25 14:01:19 -06:00
Chantry Xavier 8bee526d28 Fix a memleak in _alpm_sync_free.
An alpm_list_free call was missing.
Also make use of alpm_list_free_inner in both _alpm_sync_free and
_alpm_trans_free.

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-25 14:00:38 -06:00
Dan McGee f5d2150e9d Remove -F/--freshen operation
This operation made sense in the days before sync DBs existed, but it no
longer has the same usefulness it once did.

Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
2007-11-21 11:51:17 -06:00
Nagy Gabor 7cf28a7595 Improved 'dependency cycle' warning
From now on libalpm informs user about packages which will be
installed/removed in wrong order.

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-21 10:25:52 -06:00
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