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

1320 Commits

Author SHA1 Message Date
Allan McRae
98ee520907 Sort and avoid duplicates in -Sii output
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-03-25 21:32:48 -05:00
Allan McRae
526806e7ac alpm_list_diff_sorted - make some arguments const
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-03-25 21:31:37 -05:00
Dan McGee
cdbb90aceb Show 'Required By' in -Sii output
Just as we do in -Qi, we can compute required by information for sync
database packages. The behavior seems sane; for a given package, the -Sii
required by will show all packages in *any* sync database that require it.

Implements FS#16244.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-03-23 22:24:14 -05:00
Dan McGee
f6c7de77ed Unbreak the database partial extraction code
Basically I'm the idiot that thought I could make it better and completely
forgot how freeing the contents of the original lists would screw up our
nice little diff extraction lists. This caused segfaults among other
problems. Last time I try to do that...

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff627ce26 in strcmp () from /lib/libc.so.6
(gdb) bt

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-03-15 23:06:22 -05:00
Dan McGee
a36ff9404b Bump copyright dates to 2010
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-03-14 19:46:59 -05:00
Xavier Chantry
1aa1d00248 fix a few warnings reported by clang
- remove unused variables
- some more sanity checks
- safer printf

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-03-14 19:25:48 -05:00
Dan McGee
be2f43191d Reduce duplicate code in DB extraction
Follow-up to the previous "Only extract new DB entries" patch; move the
partial extraction code inside one side of the loop so we can use the same
code for actually doing file extraction.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-03-14 19:16:26 -05:00
Xavier Chantry
2f4ee4341d Only extract new DB entries
This implements FS#15198. The idea apparently came from Csaba Henk
<csaba-ml <at> creo.hu> which submitted a patch to Frugalware, so thanks to
him, even though I did not look at the code :)

The idea is to only extract folders for new packages into the package
database and clean up the old directories. This is essentially implementing
Xyne's "rebase" script within pacman.

If using -Syy, just remove and extract everything.

If using -Sy :
1. Generate list of directories in DB
2. Generate list of directories in archive
3. Compare both
4. Clean up old directories
5. Extract new directories

Original-work-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
[Dan: fix compile error, s/int/size_t/]
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-03-14 19:12:24 -05:00
Xavier Chantry
087be2f1fb delta : add external cleanup script
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-03-14 18:34:42 -05:00
Dan McGee
0eadc99240 Merge branch 'maint'
Just a slight touchup in makepkg due to the [ -> [[ conversion, so nothing
to see here.

Conflicts:
	scripts/makepkg.sh.in
2010-01-19 22:03:54 -06:00
Dan McGee
a12ed63545 NULL out handle after release
We free'd the handle but didn't NULL out the global variable, leading to
problems if you try to reinitialize the library. Make sure we clean up after
ourselves.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-01-19 21:52:54 -06:00
Xavier Chantry
a2c9cbdbdc improve download_internal error messages
download_internal is supposed to always set pm_errno but did not in many
cases.

The most important (and tested) change is the one concerning fetchStat. This
is typically where the code will fail when the network is down for example.

Before commit d2dbb04a9a, this fetchStat call did not exist and the
same kind of errors would be encountered in the fetchXGet call that follows.
I just copied the error printing to restore the old behavior.

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-12-13 23:22:16 -06:00
Nagy Gabor
444ff95641 Print error on duplicated database entries
Some users reported duplicated database entries in /var/lib/pacman/local/,
for example, both foo-1.0-1 and foo-2.0-1 subdirectories existed. (Bogus
3rd-party scripts, backup?) In this case pacman reported no error and its
behaviour was mysterious.

From now on, pacman detects this situation and prints an error message.

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-12-13 23:18:58 -06:00
Dan McGee
926dfe5827 Fix requiredby output
This is a bit embarrassing. For example:
$ pacman -Qi mesa
...
Required By    : mesa  mesa  mesa  mesa  mesa  mesa

Something is clearly not right, and the problem was introduced in commit
0bc961. Fix the issue by getting the package name off the correct variable.

Signed-off-by: Dan McGee <dan@archlinux.org>
2009-12-07 22:48:59 -06:00
Dan McGee
d2dbb04a9a download: major refactor to address lingering issues
Sorry for this being such a huge patch, but I believe it is necessary for
quite a few reasons which I will attempt to explain herein. I've been
mulling this over for a while, but wasn't super happy with making the
download interface more complex. Instead, if we carefully order things in
the internal download code, we can actually make the interface simpler.

1. FS#15657 - This involves `name.db.tar.gz.part` files being left around the
filesystem, and then causing all sorts of issues when someone attempts to
rerun the operation they canceled. We need to ensure that if we resume a
download, we are resuming it on exactly the same file; if we cannot be
almost postive of that then we need to start over.

2. http://www.mail-archive.com/pacman-dev@archlinux.org/msg03536.html - Here
we have a lighttpd bug to ruin the day. If we send both a Range: header and
If-Modified-Since: header across the wire in a GET request, lighttpd doesn't
do what we want in several cases. If the file hadn't been modified, it
returns a '304 Not Modified' instead of a '206 Partial Content'. We need to
do a stat (e.g. HEAD in HTTP terms) operation here, and the proceed
accordingly based off the values we get back from it.

3. The mtime stuff was rather ugly, and relied on the called function to
write back to a passed in reference, which isn't the greatest. Instead, use
the power of the filesystem to contain this info. Every file downloaded
internally is now carefully timestamped with the remote file time. This
should allow the resume logic to work. In order to guarantee this, we need
to implement a signal handler that catches interrupts, notifies the running
code, and causes it to set the mtimes on the file. It then rethrows the
signal so the pacman signal handler (or any frontend) works as expected.

4. We did a lot of funky stuff in trying to track the DB last modified time.
It is a lot easier to just keep the downloaded DB file around and track the
time on that rather than in a funky dot file. It also kills a lot of code.

5. For GPG verification of the databases down the road, we are going to need
the DB file around for at least a short bit of time anyway, so this gets us
closer to that.

Signed-off-by: Dan McGee <dan@archlinux.org>
[Xav: fixed printf with off_t]
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
2009-11-15 19:47:30 -06:00
Laszlo Papp
be266b4364 Refactor do/while cycle and multiple while cycles
* It makes the code clearer to read/understand
* Cppcheck tool doesn't show this anymore: [./util.c:215]: (error) Resource leak: fd

[Dan: don't change the coding style]
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-11-15 19:40:56 -06:00
Manuel Tortosa
88706168f2 Add Catalan translation
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-11-15 19:09:58 -06:00
Dan McGee
7ae15768e5 Merge branch 'maint' 2009-11-10 18:21:19 -06:00
Dan McGee
133a39e2bb Fix opendir error condition checks
Thanks to Laszlo Papp <djszapi@archlinux.us> for the following catch:
  opendir(path)) == (DIR *)-1;
is maybe the result of misunderstanding the manpage. If an opendir() call
isn't successful it returns NULL rather than '(DIR *)-1'.

Noticed-by: Laszlo Papp <djszapi@archlinux.us>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-10-27 21:11:29 -05:00
Laszlo Papp
361a25c086 Fix a small typo in alpm_list.c
Signed-off-by: Laszlo Papp <djszapi@archlinux.us>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-10-24 10:27:48 -05:00
Dan McGee
0bc961a8be Reduce unnecessary get_name() function calls
alpm_pkg_get_name() gives us little benefit in backend code besides a NULL
check on the package passed in; we could do that ourself if necessary. By
changing to direct references in the cases where we are sure we have a valid
package, we save a function call each time we need a package name. This
function can't be inlined because it is externally accessible.

This cuts the calls to get_name() from 1.3 million times in a
pacman -Qu operation to around 2400.

Signed-off-by: Dan McGee <dan@archlinux.org>
2009-10-24 10:10:12 -05:00
Xavier Chantry
2c2596177d dload.c : clear sigaction flag to make valgrind happy
This fixes the following valgrind warning :

==26831== Syscall param rt_sigaction(act->sa_flags) points to uninitialised
byte(s)
==26831==    at 0x4282547: __libc_sigaction (in /lib/libc-2.10.1.so)
==26831==    by 0x403C693: download_internal (dload.c:152)
==26831==    by 0x403D0E4: _alpm_download_single_file (dload.c:311)
==26831==    by 0x4033B72: alpm_db_update (be_files.c:319)
==26831==    by 0x805205E: pacman_sync (sync.c:257)
==26831==    by 0x804EE54: main (pacman.c:1120)
==26831==  Address 0xbec6cc04 is on thread 1's stack
==26831==
==26831== Syscall param rt_sigaction(act->sa_restorer) points to
uninitialised byte(s)
==26831==    at 0x4282547: __libc_sigaction (in /lib/libc-2.10.1.so)
==26831==    by 0x403C693: download_internal (dload.c:152)
==26831==    by 0x403D0E4: _alpm_download_single_file (dload.c:311)
==26831==    by 0x4033B72: alpm_db_update (be_files.c:319)
==26831==    by 0x805205E: pacman_sync (sync.c:257)
==26831==    by 0x804EE54: main (pacman.c:1120)
==26831==  Address 0xbec6cc08 is on thread 1's stack
==26831==

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-10-20 22:25:39 -05:00
Laszlo Papp
4281a1a7f2 Size handling was changed in fgets() functions
Pacman's fgets function in the API used hardcoded numbers to identify the size.
This is not good practice, so replace them with sizeof handling.

Signed-off-by: Laszlo Papp <djszapi@archlinux.us>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-10-19 07:37:53 -05:00
solsTiCe d'Hiver
e3ac806262 use bitwise shift operator in enum "bit field"
This offers a cleaner way to deal with constant in enum and allow easy
maintainance

Signed-off-by: solsTiCe d'Hiver <solstice.dhiver@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-10-11 22:13:49 -05:00
Nagy Gabor
72bc947cbb Fix "-Sd conflict_pkg" bug
If the -d switch was invoked with -S (or -U), the removes list was simply
lost, because trans->remove was computed in an
"if(!(trans->flags & PM_TRANS_FLAG_NODEPS))" block.

I've added a new pactest file, sync045.py (derived from sync043.py) to test
this.

Additionally, I did some other minor cleanups in sync_prepare:
 * preferred list is not needed anymore
 * I removed a needless alpm_list_remove_dupes line (the target list should
   not contain dupes at all)
 * I moved alpm_list_free(remove); to cleanup part to eliminate a possible
   memleak

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-10-11 15:30:52 -05:00
Xavier Chantry
3dc87851cc alpm_list : add new alpm_list_diff_sorted function
This is more efficient than alpm_list_diff since it assumes the two lists
are sorted. And also we get the two sides of the diff.

Even sorting should more efficient than the current list_diff. Sorting the
two lists should be O(n*log(n)+m*log(m)) while the current list_diff is
O(n*m). So I also reimplemented list_diff using list_diff_sorted.

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-10-11 15:28:10 -05:00
Xavier Chantry
14ab02e289 Rework the alpm_unpack functions
Add support to extract a list of entries

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-10-11 15:18:47 -05:00
Xavier Chantry
caea098c21 cygwin fix : use unsigned char for ctype function
See http://www.nabble.com/-PATCH-RFA--Distinguish-between-EOF-and-character-with-value-0xff-td23161772.html#a23188494

cygwin 1.7 actually displays a warning when using signed char with the ctype
function, so that compilation fails when using -Wall -Werror.

So we just cast all arguments to unsigned char.

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-10-11 15:12:20 -05:00
Dan McGee
4828d9ef7c libalpm: clean up lock function
We were doing a lot of manual work; leverage the standard library a bit to
do more for us.

Signed-off-by: Dan McGee <dan@archlinux.org>
2009-10-11 14:42:04 -05:00
Dan McGee
6e312220ec Reduce calls to list_count() in removing package
We don't need to count the number of packages left once per file when
removing; we only need to do it once per package. Also move a variable into
the correct scope.

Signed-off-by: Dan McGee <dan@archlinux.org>
2009-10-11 14:42:04 -05:00
Dan McGee
3bc8c28ce3 Add missing get_usedelta() method
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-10-11 14:42:04 -05:00
Dan McGee
145103aacc typing: a few more fixes for special int types
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-10-11 14:41:59 -05:00
Dan McGee
35dc9b0314 int typing: s/unsigned short/int/ in libalpm
After our recent screwup with size_t and ssize_t in the download code, I
found the `-Wsign-conversion` flag to GCC to see if we were doing anything
else boneheaded. I didn't find anything quite as bad, but we did have some
goofups- most of our public unsigned methods would return -1 on error, which
is a bit odd in an unsigned context.

Signed-off-by: Dan McGee <dan@archlinux.org>
2009-10-11 13:51:47 -05:00
Dan McGee
cf0d619670 Merge branch 'maint' 2009-10-11 12:57:57 -05:00
Xavier Chantry
5e03941ee5 alpm_list : fix a bug in alpm_list_remove
A NULL list element triggered an infinite loop. Not cool :)

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-10-11 12:55:55 -05:00
甘露(Lu.Gan)
aea22ac2fd Update Chinese translation
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-10-11 12:55:17 -05:00
Christian Larsson
9282a4a909 Update Swedish translation
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-10-07 18:12:26 -05:00
甘露(Lu.Gan)
f77d73af4b Update chinese translation
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-10-07 18:12:26 -05:00
Xavier Chantry
ba14bd7728 New Greek translation
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-10-07 18:12:26 -05:00
Xavier Chantry
8db120c260 Update translations
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-10-07 18:12:26 -05:00
Xavier Chantry
a0acf8b509 Update all pot and po files for 3.3.2 release
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-10-07 18:12:26 -05:00
Dan McGee
8e7652f1af Merge branch 'maint'
Conflicts:
	lib/libalpm/dload.c
2009-09-29 21:08:06 -05:00
Xavier Chantry
20392c0a02 dload : fix infinite download (big type mistake)
fetchIO_read returns -1 in case of error, and the return type is
ssize_t, not size_t ! So we converted -1 to an unsigned, which led to
huge file write.

The rest is just changing the error return a bit.

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-09-29 20:52:56 -05:00
Dan McGee
86d4b8a3aa Merge branch 'maint' 2009-09-22 21:38:16 -05:00
Dan McGee
e76b3374d8 Clean up translation file headers
Get them a bit more standardized across the board, as they were quite a
mess. Also note the two new translations we received for 3.3.1.

Signed-off-by: Dan McGee <dan@archlinux.org>
2009-09-22 18:28:42 -05:00
Laszlo Papp
802b1a6f2f Add Swedish translation
This is for 3.3.0, not for 3.3.1. But since there are only like 10 messages
missing, it seems worth including now.

Signed-off-by: Christian Larsson <congacx@gmail.com>
Signed-off-by: Laszlo Papp <djszapi2@archlinux.us>
[Dan: fix some busted translation strings]
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-09-22 18:09:55 -05:00
Ondrej Kucera
cfb86fed7c Update Czech translation
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
2009-09-23 00:22:41 +02:00
Rodrigo Flores
38ac020f51 Update Brazilian translation
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
2009-09-22 21:48:40 +02:00
Laszlo Papp
9c13a6c364 Add Norwegian translation
Signed-off-by: Hans-Kristian Arntzen <maister@archlinux.us>
Signed-off-by: Laszlo Papp <djszapi@archlinux.us>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-09-21 22:43:55 -05:00
Mateusz Herych
c07aef0d6e Update Polish translation
Signed-off-by: Giovanni Scafora <giovanni@archlinux.org>
2009-09-20 16:31:10 -05:00
Dan McGee
72883e3bcb Fully implement database lazy loading
Commit 34e1413d75 attempted to implement lazy loading of package databases.
Although it took care of my main complaint (creating the database directory
if it didn't exist), it didn't allow sync repos to be registered before
alpm_option_set_dbpath() had been called.

With this patch, we no longer compute the individual repository DB paths
until necessary, allowing full lazy loading to work as intended, and
allowing us to drop the extra setlibpath() calls from the frontend. This
allows the changes introduced in a2cd48960 (but later reverted) to be added
back in again.

Signed-off-by: Dan McGee <dan@archlinux.org>
2009-09-20 12:19:57 -05:00
Dan McGee
6bfca2fd14 Merge branch 'maint'
Message updates made this one a bit messy, but nothing too bad.

Conflicts:
	lib/libalpm/add.c
	lib/libalpm/remove.c
2009-09-20 12:09:10 -05:00
Xavier Chantry
481014e944 delta : simple code refactoring
This will make the code re-usable for other purpose.

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-09-20 11:57:12 -05:00
Xavier Chantry
f4809dcc9c sync.c : duplicate the target before modifying it
It was probably a bad idea to modify the target directly in case of
repo/pkg syntax.

Duplicating it also allows us to keep the original target string, which
is more informative when printing errors.

Also remove a duplicated error message from libalpm, and improve the
message already returned to the frontend.

$ pacman -S foo/bar

before
error: repository 'foo' not found
error: 'bar': no such repository

after
error: 'foo/bar': could not find repository for target

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-09-20 11:56:46 -05:00
Giovanni Scafora
6cd8d6bd05 Update Italian translation
Signed-off-by: Giovanni Scafora <giovanni@archlinux.org>
2009-09-18 22:01:07 +02:00
Roman Kyrylych
90a06b1cf0 Update Ukrainian translation
Signed-off-by: Giovanni Scafora <giovanni@archlinux.org>
2009-09-18 22:00:19 +02:00
Samed Beyribey
ccf7c31f52 Update Turkish translation
Signed-off-by: Giovanni Scafora <giovanni@archlinux.org>
2009-09-18 22:00:19 +02:00
Juan Pablo González Tognarelli
419c4a2afa Update Spanish translation
Signed-off-by: Giovanni Scafora <giovanni@archlinux.org>
2009-09-18 22:00:19 +02:00
Sergey Tereschenko
65e7682638 Update Russian translation
Signed-off-by: Giovanni Scafora <giovanni@archlinux.org>
2009-09-18 22:00:19 +02:00
Volodia Macovei
259cb3aad4 Update Romanian translation
Signed-off-by: Giovanni Scafora <giovanni@archlinux.org>
2009-09-18 22:00:19 +02:00
Baurzhan Muftakhidinov
9516d5afe6 Update Kazakh translation
Signed-off-by: Giovanni Scafora <giovanni@archlinux.org>
2009-09-18 22:00:19 +02:00
Nagy Gabor
5d0734861f Update Hungarian translation
Signed-off-by: Giovanni Scafora <giovanni@archlinux.org>
2009-09-18 14:34:05 +02:00
Matthias Gorissen
9424197b42 Update German translation
Signed-off-by: Giovanni Scafora <giovanni@archlinux.org>
2009-09-18 14:34:05 +02:00
Dan McGee
922448a9bf Update en_GB translation
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-09-16 19:44:01 -05:00
Xavier Chantry
9d4448dc7f Update french translation
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-09-16 19:37:04 -05:00
Xavier Chantry
9505c594fd Update all pot and po files for 3.3.1 release
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-09-16 19:36:59 -05:00
Xavier Chantry
1df3b91931 String improvements
Add more untranslated strings, improve consistency, etc.

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-09-16 19:36:49 -05:00
Nagy Gabor
08ee4059b5 Catch an untranslated warning in lib/remove.c
Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-09-15 07:09:16 -05:00
Dan McGee
95cb4b6874 Merge branch 'maint' 2009-09-14 22:10:20 -05:00
Nagy Gabor
d0d6c58c05 Add makepkgopt to be_package.c
After commit 774c252 the --debug output shows 5-6 "syntax error..." lines
for each package. After this patch pacman recognizes makepkgopt as a valid
key, but doesn't do anything.

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-09-14 22:09:05 -05:00
Xavier Chantry
b4317a740a Change the interface for target loading
-int alpm_trans_sysupgrade(int enable_downgrade);
-int alpm_trans_sync(char *target);
-int alpm_trans_add(char *target);
-int alpm_trans_remove(char *target);
+int alpm_sync_sysupgrade(int enable_downgrade);
+int alpm_sync_target(char *target);
+int alpm_sync_dbtarget(char *db, char *target);
+int alpm_add_target(char *target);
+int alpm_remove_target(char *target);

* functions renaming
* add new sync_dbtarget which allows to specify the db
* repo/ syntax handling is moved to frontend
( should implement FS#15141)
* group handling is moved to backend
( see http://www.archlinux.org/pipermail/pacman-dev/2009-June/008847.html )
2009-09-12 13:06:43 +02:00
Xavier Chantry
8ff3b87066 Remove transaction type
This basically started with this change :

 /* Transaction */
 struct __pmtrans_t {
-       pmtranstype_t type;
        pmtransflag_t flags;
        pmtransstate_t state;
-       alpm_list_t *packages;      /* list of (pmpkg_t *) */
+       alpm_list_t *add;      /* list of (pmpkg_t *) */
+       alpm_list_t *remove;      /* list of (pmpkg_t *) */

And then I have to modify all the code accordingly.
2009-09-08 22:17:41 -05:00
Nagy Gabor
0da96abc90 Use sync.c for upgrade transaction prepare and commit
This patch utilizes the power of sync.c to fix FS#3492 and FS#5798.
Now an upgrade transaction is just a sync transaction internally (in alpm),
so all sync features are available with -U as well:
* conflict resolving
* sync dependencies from sync repos
* remove unresolvable targets

See http://www.archlinux.org/pipermail/pacman-dev/2009-June/008725.html
for the concept.

We use "mixed" target list, where PKG_FROM_FILE origin indicates local
package file, PKG_FROM_CACHE indicates sync package. The front-end can add
only one type of packages (depending on transaction type) atm, but if alpm
resolves dependencies for -U, we may get a real mixed trans->packages list.

_alpm_pkg_free_trans() was modified so that it can handle both target types
_alpm_add_prepare() was removed, we use _alpm_sync_prepare() instead
_alpm_add_commit() was renamed to _alpm_upgrade_targets()

sync.c (and deps.c) was modified slightly to handle mixed target lists,
the modifications are straightforward. There is one notable change here: We
don't create new upgrade trans in sync.c, we replace the pkgcache entries
with the loaded package files in the target list (this is a bit hackish) and
call _alpm_upgrade_targets(). This implies a TODO (pkg->origin_data.db is
not accessible anymore), but it doesn't hurt anything with pacman front-end,
so it will be fixed later (otherwise this patch would be huge).

I updated the documentation of -U and I added a new pactest, upgrade090.py,
to test the syncdeps feature of -U.

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-09-08 22:04:14 -05:00
Nagy Gabor
12b55958d8 Add a new reason field to pmconflict_t struct
Sometimes "foo conflicts with bar" information is not enough, see this
thread: http://bbs.archlinux.org/viewtopic.php?id=77647. That's why I added
a new reason field to our pmconflict_t struct that stores the packager-
defined conflict that induced the fact that package1 conflicts with
package2.

I modified the front-end (in callback.c, sync.c, upgrade.c) to print this
new information as well.

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
2009-09-08 21:58:52 -05:00
Xavier Chantry
845f21207c libalpm/util.c : remove _alpm_strreplace
This function is unused since commit
358cc5804a.

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
[Dan: also kill from util.h]
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-09-06 19:09:45 -05:00
Xavier Chantry
5b27e78ba0 Check package arch before installing
This implements FS#15622

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-09-06 15:51:25 -05:00
Xavier Chantry
594621cbeb Add Architecture and --arch option
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-09-06 15:50:42 -05:00
Dan McGee
92f0775e76 Merge branch 'maint'
Conflicts:
	lib/libalpm/dload.c
2009-08-18 20:49:25 -05:00
Xavier Chantry
7dae79e7b9 dload.c : various fixes
- fix one memleak if get_filename failed

- cleanup according to Joerg's feedback:

"url_for_string: If fetchParseURL returned successful, you should always
have a scheme set. The logic for anonftp should only be needed for very
broken server -- do you know of any such?

download_internal:
Specifying 'p' is now a nop -- it is tried by default first with
fall-back to active FTP."

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
[Dan: remove from pacman.conf and pacman.conf.5]
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-08-18 20:47:12 -05:00
Xavier Chantry
6f97842ab2 dload.c : change the way to check for mtimes
libfetch supports checking mtime so we do not need to do it manually.

when the databases are already up-to-date, initiating a connection with
fetchXGet and closing it right after with fetchIO_close took a very long
time (up to 10min!) on some network.

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
(cherry picked from commit d7675e393f)
2009-08-18 20:41:47 -05:00
Dan McGee
14a93b2e43 Make fetch timeout actually 10 seconds
We had 10000 as our timeout value, assuming it was expressed in ms. This is
false after looking at the current code, so reset it back to 10 seconds.

Addresses FS#15369.

Signed-off-by: Dan McGee <dan@archlinux.org>
2009-08-13 21:01:40 -05:00
Dan McGee
7bb9c4098b Merge branch 'maint' 2009-08-08 11:23:38 -05:00
Xavier Chantry
3cf0ee98c0 dload.c : only call fwrite once
I assume the loop was never iterated more than once, because the write
location was not updated at each loop iteration (buffer instead of buffer +
nwritten), yet we never had reports of corrupted download.

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-08-08 11:17:24 -05:00
Xavier Chantry
d7675e393f dload.c : change the way to check for mtimes
libfetch supports checking mtime so we do not need to do it manually.

when the databases are already up-to-date, initiating a connection with
fetchXGet and closing it right after with fetchIO_close took a very long
time (up to 10min!) on some network.

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-08-08 11:13:33 -05:00
Xavier Chantry
4fa6f262a6 Add a missing newline.
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-08-03 07:39:05 -05:00
Marc - A. Dahlhaus
8152077f6d Use full path to ldconfig
If /sbin is not in the PATH and sudo is used, ldconfig cannot be found.  So
use /sbin/ldconfig instead. The code checked for the existence of
/sbin/ldconfig anyway..

Signed-off-by: Marc - A. Dahlhaus <mad@wol.de>
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-08-03 07:37:44 -05:00
Xavier Chantry
e8db103122 fix warning when internal download is not used
After commit 30c4d53ce5, get_destfile and
get_tempfile are only used for internal download, so move these two
functions inside the ifdef

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-08-02 12:16:02 -05:00
Armando M. Baratti
44359218ea Update Brazilian Portuguese translation
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-08-01 15:51:57 -05:00
Dan McGee
bc83ff76c6 French translation reformat
'make distcheck' had issues with this one and reformatted it. In addition,
it found a fuzzy message which is now fixed due to an inadvertent msgid
edit.

Signed-off-by: Dan McGee <dan@archlinux.org>
2009-08-01 13:36:07 -05:00
Jeff Bailes
4cadee4f08 update english british translation
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
2009-07-31 01:49:07 +02:00
Nagy Gabor
fc29d0c990 update hungarian translation
Thanks to Avramucz Peter <muczyjoe@gmail.com>
for having translated all the scripts !

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
2009-07-30 19:27:37 +02:00
Lu Gan
9a0122982c update simplified chinese translation
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
2009-07-30 19:27:37 +02:00
Sergey Tereschenko
433c52bb91 update russian translation
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
2009-07-30 19:27:37 +02:00
Roman Kyrylych (Роман Кирилич)
78e92b1d02 update ukrainian translation
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
2009-07-30 19:27:36 +02:00
Matthias Gorissen
05533b8b11 update german translation
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
2009-07-29 19:41:34 +02:00
Baurzhan Muftakhidinov
00c26338de update Kazakh translation
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
2009-07-29 19:37:53 +02:00
Volodia Macovei
684047a764 update romanian translation
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
2009-07-29 19:34:27 +02:00
Mateusz Herych
e65d82afa1 update polish translation
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
2009-07-29 19:34:27 +02:00
Samed Beyribey
734aa1ce59 update turkish translation
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
2009-07-29 19:34:27 +02:00
Vojtech Gondzala
4e643a3dd7 update czech translation
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
2009-07-29 19:34:26 +02:00