Commit Graph

1730 Commits

Author SHA1 Message Date
Dan McGee 30f53cfe8d Fix double read issue in maint releases
This is essentially a backport/cherry-pick of commit 33240e87b9 from
master, but has to be done by hand because the DB format has diverged. Read
more in the commit message used there, which follows.

Due to the way we funk around with package data loading, we had a condition
where the filelist got doubled up because it was loaded twice.

Packages are originally loaded with INFRQ_BASE. In an upgrade/sync, the
package is checked for file conflicts next, leaving us in an "INFRQ_BASE |
INFRQ_FILES" state. Later, when committing a single package, we have an
explicit call to _alpm_local_db_read() with INFRQ_ALL as the level. Because
the package's level did not match this, we skipped over our previous "does
the incoming level match where I'm at" shortcut, and continued to load
things again, because of a lack of fine-grained checking for each of DESC,
FILES, and INSTALL.

The end result is we loaded the filelist twice, causing our remove logic to
iterate twice over the installed files, spewing a bunch of "cannot find file
X" messages.

Fix the problem by doing a bit more bitmasking logic throughout the load
method, and also fix the sanity check at the beginning of the function- this
should *only* be used for local packages as opposed to the "not a package"
check that was there before.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-12 09:17:22 -06:00
Dan McGee 9e8af82c97 Back out anticipated epoch changes
After all the debate as to what to do on maint, we are going to end up just
incorporating epoch into the version string, so we don't need this separate
field at all. Revert commit 5c8083baa4 and also kill the force flag we were
recording here as well.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-11 23:15:44 -06:00
Dan McGee dd26592155 Merge branch 'diskspace-fixes' 2011-01-11 21:20:12 -06:00
Dan McGee 57c5afd69c Merge branch 'fix-double-load' 2011-01-11 21:20:10 -06:00
Dan McGee 33240e87b9 Fix double filelist issue when upgrading a package
Due to the way we funk around with package data loading, we had a condition
where the filelist got doubled up because it was loaded twice.

Packages are originally loaded with INFRQ_BASE. In an upgrade/sync, the
package is checked for file conflicts next, leaving us in an "INFRQ_BASE |
INFRQ_FILES" state. Later, when committing a single package, we have an
explicit call to _alpm_local_db_read() with INFRQ_ALL as the level. Because
the package's level did not match this, we skipped over our previous "does
the incoming level match where I'm at" shortcut, and continued to load
things again, because of a lack of fine-grained checking for each of DESC,
FILES, and INSTALL.

The end result is we loaded the filelist twice, causing our remove logic to
iterate twice over the installed files, spewing a bunch of "cannot find file
X" messages.

Fix the problem by doing a bit more bitmasking logic throughout the load
method, and also fix the sanity check at the beginning of the function- this
should *only* be used for local packages as opposed to the "not a package"
check that was there before.

A debug log message was added to upgraderemove as well to match the one
already in the normal remove codepath.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-11 21:16:39 -06:00
Dan McGee 25fab402c7 Call archive_read_data_skip() while checking diskspace
libarchive eventually calls it anyway, but backtraces make a lot more sense
if we call it, as well as matching our precedent from alpm_pkg_load().

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-11 21:15:24 -06:00
Dan McGee 6942bba75d Add error message stating which partition is full
This is helpful anyway to the user, and should also be helpful to us if we
see problems cropping up in the check during development.

Also add a missing ->used = 0 initialization in the code path less taken.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-11 21:15:24 -06:00
Dan McGee 55bff19b76 Unify two free diskspace error messages
Although they won't be the same in the gettext catalog because of the '\n'
we should still use the same text.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-11 21:15:24 -06:00
Dan McGee fe6e90c21f Add a progressbar for package integrity checking
This can take a while too, and it is really easy to add the necessary
callback stuff for adding a progressbar.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-11 21:15:10 -06:00
Dan McGee 9a82cb92a4 Small fix to download size lookup and a logger
These were just two small things I came across today and found could be
fixed or helpful, so I've added them and I'm not sure what else to bundle
them with. commit_count++

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-11 21:15:04 -06:00
Dan McGee 842cbc9ea4 Ensure we use local package when calculating removed size
We were checking if a package existed locally, but then using the
incoming package to calculate removed size rather than the currently
installed package.

Also adjust the local variable in the replaces loop to make it more
clear that we are always dealing with local packages here.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-10 10:50:03 -06:00
Dan McGee d03b57f459 Remove need for floating point division in backend
All of these can be done with integer division; the only slightly
interesting part is ensuring we round up like before with calling the
ceil() function.

We can also remove the math library from requirements; now that the only
ceil() calls are gone, we don't need this anymore.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-10 10:49:55 -06:00
Xavier Chantry 281a4c0a4f libalpm/be_package.c: fix small memleak
file_pkg_ops can be a static struct like in other backends, we just need
to initialize it at some point.

Dan: add initialization flag.

Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-07 21:27:39 -06:00
Dan McGee 62f5da3779 Fix some more simple conversion "errors"
None of these warn at the normal "-Wall -Werror" level, but casts do occur
that we are fine with. Make them explicit to silence some warnings when
using "-Wconversion".

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-07 21:15:47 -06:00
Allan McRae f966f3a834 Use size_t for alpm_list sizes
There is a lot of swtiching between size_t and int for alpm_list sizes
in the codebase.   Start converting these to all be size_t by adjusting
the return type of alpm_list_count and fixing all additional warnings
given by -Wconversion that are generated by this change.

Dan: a few more small changes to ensure things compile, adjusting some
printf format string characters to accommodate the larger size on x86_64.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-07 21:15:46 -06:00
Dan McGee 4bc6ed56aa Refactor old date parsing into single method
We've managed to duplicate this four times at this point, so make it a
method in util.c instead.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-07 20:55:05 -06:00
Allan McRae d288240426 Update copyright years for 2011
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-07 18:47:37 -06:00
Dan McGee 26652768d6 Remove FORCE reading from local DB
We never wrote it here, so no need to read it in either.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-05 20:56:06 -06:00
Dan McGee c41edf49be Fix function indentation
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-02 12:25:33 -06:00
Dan McGee 08d885fda5 Merge branch 'maint'
Conflicts:
	lib/libalpm/sync.c
	test/pacman/tests/ignore007.py
2010-12-30 09:41:46 -06:00
Allan McRae 351250adb4 Declare all local functions static
All functions that are limited to the local translation unit are
declared static.  This exposed that the _pkg_get_deltas declaration
in be_local.c was being satified by the function in packages.c which
when declared static caused linker failures.

Fixes all warnings with -Wmissing-{declarations,prototypes}.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-30 09:39:23 -06:00
Jakob Gruber 6ddc115c7f Respect Ignore{Pkg,Group} for group members
Fixes FS#19854.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-30 09:35:03 -06:00
Jakob Gruber df360b791d Move group code to separate function
This makes the following commits more readable.
No logic was changed in this commit.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-30 09:35:03 -06:00
Jakob Gruber cb7ba4e4e5 Add const to some ALPM function signatures
char * -> const char *.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-30 09:25:16 -06:00
Allan McRae d227771464 Use limits.h for PATH_MAX
We use PATH_MAX everywhere by including limits.h so there is no
point in doing a check for it in a different header when dealing
with FreeBSD's libfetch.

Also, remove autoconf check for strings.h header as it is not used
anywhere.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-29 19:26:21 -06:00
Allan McRae 81dd9d3ebc Detect undefined PATH_MAX
POSIX does not require PATH_MAX be defined when there is not actual
limit to its value.  This affects HURD based systems.  Work around
this by defining PATH_MAX to 4096 (as on Linux) when this is not
defined.

Also, clean up inclusions of limits.h and remove autoconf check for
this header as we do not use macro shields for its inclusion anyway.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-29 19:24:13 -06:00
Allan McRae fcc09bd7e3 Correct type for hash value storage
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-29 19:10:49 -06:00
Dan McGee a7972625e3 Merge branch 'depcmp-perf' 2010-12-29 18:43:47 -06:00
Dan McGee 735a197fc2 Use name hashes in depends to avoid strcmp calls
Just like we did for package name comparsions, if we add a depend name_hash
field on depend struct initialization, we can use it instead of doing a
string name comparison, saving us a lot of checks in the depcmp code.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-21 17:25:34 -06:00
Dan McGee 34a78d935a Remove need for memory allocation in _alpm_depcmp
Noticed when tweaking testdb, when we run _alpm_depcmp in loops and call it
seven million times, the strdup()/free() combo can add up. Remove the need
for any string duplication by some pointer manipulation and use of strncmp
instead of strcmp. Also kill the function logger and add an escape so we
don't needlessly retrieve the list of provides.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-21 17:25:02 -06:00
Dan McGee f2dff08600 Overhaul archive fgets function
The old function was written in a time before we relied on it for nearly
every operation. Since then, we have switched to the archive backend and now
fast parsing is a big deal.

The former function made a per-character call to the libarchive
archive_read_data() function, which resulted in some 21 million calls in a
typical "load all sync dbs" operation. If we instead do some buffering of
our own and read the blocks directly, and then find our newlines from there,
we can cut out the multiple layers of overhead and go from archive to parsed
data much quicker.

Both users of the former function are switched over to the new signature,
made easier by the macros now in place in the sync backend parsing code.

Performance: for a `pacman -Su` (no upgrades available),
_alpm_archive_fgets() goes from being 29% of the total time to 12% The time
spent on the libarchive function being called dropped from 24% to 6%.

This pushes _alpm_pkg_find back to the title of slowest low-level function.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-21 14:58:17 -06:00
Allan McRae c78a808c49 Only check diskspace availability if needs more than zero
The amount of diskspace needed for a transaction can be less than
zero.  Only test this against the available disk space if it is
positive, which avoids a comparison being made between signed and
unsigned types (-Wsign-compare).

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-20 18:03:34 -06:00
Allan McRae a611879318 Always specify arguement type in function delcarations
Always declare a function with (void) rather than () when we expect
no arguements.  Fixes all warnings with -Wstrict-prototypes.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-20 18:03:21 -06:00
Dan McGee 8ac7f7e6e5 Use macros in sync DB parsing
This simplifies a lot of the repetative code and makes it obvious where the
tricky or different ones are (e.g. depends, dates). It also makes it
significantly easier to change the way this code works in the future.

There should be no functional change with this patch.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-20 18:02:47 -06:00
Dan McGee ab9c0814d2 Add a cushion for diskspace checking
It is the minimum of 5% of disk capacity or 20 MiB on a per-partition basis.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-15 00:41:41 -06:00
Dan McGee c7d332a26a Reorganize fields in package struct
Saves a few bytes due to padding (256 -> 248 bytes), especially on x86_64,
so we get the overhead of our new hash field right back.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-14 17:46:02 -06:00
Dan McGee 919bb6c9e0 Used hashed package name in _alpm_pkg_find
This results in huge gains to a lot of our codepaths since this is the most
frequent method of random access to packages in a list. The gains are seen
in both profiling and real life.

    $ pacman -Sii zvbi
    real: 0.41 sec -> 0.32 sec
    strcmp: 16,669,760 calls -> 473,942 calls
    _alpm_pkg_find: 52.73% -> 26.31% of time

    $ pacman -Su (no upgrades found)
    real: 0.40 sec -> 0.50 sec
    strcmp: 19,497,226 calls -> 524,097 calls
    _alpm_pkg_find: 52.36% -> 26.15% of time

There is some minor risk with this patch, but most of it should be avoided
by falling back to strcmp() if we encounter a package with a '0' hash value
(which we should not via any existing code path). We also do a strcmp once
hash values match to ensure against hash collisions. The risk left is that a
package name is modified once it was originally set, but the hash value is
left alone. That would probably result in a lot of other problems anyway.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-14 12:36:02 -06:00
Dan McGee c2a73ba989 When setting package name, set hash value as well
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-14 12:06:31 -06:00
Dan McGee dbf59a6b14 Add hash_sdbm function
This is prepping for the addition of a hash field to each package to greatly
speed up the string comparisons we frequently do on package name in
_alpm_pkg_find.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-14 11:56:32 -06:00
Dan McGee d1d163c5a3 Use _alpm_pkg_find in deps search
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-14 11:50:50 -06:00
Dan McGee a5e43b1605 Correctly force load of package reason
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-13 21:25:14 -06:00
Dan McGee 580fe21065 Abstract has_scriptlet() to package ops struct
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-13 21:25:14 -06:00
Dan McGee c00e05992e Remove non-public functions from header
And rename accordingly.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-13 21:16:47 -06:00
Dan McGee 94d3d665f0 Mark sync_db_read() as static
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-13 21:14:03 -06:00
Bruno Widmann 5f36523af9 Abort db_populate if dbpath is not set
Rather than segfault. Fixes FS#21345.

Signed-off-by: Bruno Widmann <bruno.widmann@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-13 16:45:22 -06:00
Dan McGee 1ff8118212 Create sync/ DB directory if it does not exist
Rather than error out, this is easy enough. Looks quite similar to the code
in be_local for creating the local directory.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12 22:41:02 -06:00
Allan McRae 21833d90e2 Merge desc and depends files in local db
Whenever depends is needed from the local db, so is desc.  The only
disadvantage to merging them is the additional time taken to read the
depends entries when they are not needed.  As depends is in general
relatively small, the additional time taken to read it in will be
negligable.  Also, merging these files will speed up local database
access due to less file seeks.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12 21:42:41 -06:00
Dan McGee 209d0643e5 Attempt to stop installation when we encounter problems
This should hopefully address some of the concerns raised in FS#11639 with
regards to continuing after filling the disk up.

Add some more checks and passing of error conditions between our functions.
When a libarchive warning is encountered, check if it is due to lack of disk
space and if so upgrade it to an error condition.  A review of other
libarchive warnings suggests that these are less critical and can remain as
informative warning messages at this stage.

Note the presence of errors after extraction of an entire package is complete.
If so, we abort the transaction to be on the safe side and keep damage to a
minimum.

Signed-off-by: Dan McGee <dan@archlinux.org>
[Allan: make ENOSPC warning into an error]
Signed-off-by: Allan McRae <allan@archlinux.org>

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12 21:42:41 -06:00
Dan McGee b276a76dc9 Turn libarchive warnings into libalpm warnings
Rather than hiding these warnings, show them to the user as they happen.
This will prevent things such as hiding full filesystem errors (ENOSPC) from
the user as seen in FS#11639.

Signed-off-by: Dan McGee <dan@archlinux.org>
[Allan: adjust warning wording and add gettext calls]
Signed-off-by: Allan McRae <allan@archlinux.org>

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12 21:42:41 -06:00
Dan McGee 3030542d10 Make reading from any file possible in sync DB
Whether it be "desc", "depends", or "deltas", it really doesn't matter-
treat them all the same and have the ability to read any data from any file
in that list. This continues the work in a44c7b8956.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12 20:38:20 -06:00
Dan McGee b7015af0fc diskspace style cleanups and small fixes
* Use our normal return() function syntax
* Rework a few things to reduce number of casts
* Fix void function argument declaration
* Add missing gettext _() call
* Remove need for seperate malloc() of statvfs/statfs structure
* Unify argument order of static functions- mountpoints now always
  passed first
* Count all files that start with '.' in a package against the DB
* Rename db to db_local in check_diskspace to clarify some code
* Fix some line wrapping to respect 80 characters

Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2010-12-12 20:32:05 -06:00
Dan McGee ec136784d4 Refactor statfs/statvfs type check
Turn it into a configure-type typedef, which allows us to reduce the
amount of duplicated code and clean up some #ifdef magic in the code
itself. Adjust some of the other defined checks to look at the headers
available rather than trying to pull in the right ones based on
configure checks.

Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2010-12-12 20:31:51 -06:00
Allan McRae 24684a616e Display progress bar for disk space checking
Checking disk space needed for a transaction can take a while so add
an informative progress bar.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12 20:30:11 -06:00
Allan McRae e22aa23c8f Add configuration option to control disk space checking
Disk space checking is likely to be an unnecessary bottleneck to
people with reasonable partition sizes so add a configuration option
to allow it to be disabled/enabled as wanted.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12 20:30:05 -06:00
Allan McRae 3f0d98c124 Implement disk space checking
Pull together the work of the previous commits to implement a check
for enough free space before performing an install transaction. Abort
if there is not enough free space with an appropriate pm_errno..

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12 20:29:59 -06:00
Allan McRae e527699ddd Add functions to calculate approximate disk usage by packages
Two helper function are added to calculate the disk usage from packages
that are either currently installed on the system or from a package
archive.

Some minor approximations have been made:

1. Size for directories is not considered when removing a package from the
   filesystem to avoid multiple counting across packages. Also, these are
   reported to take zero size while installing.

2. Symlinks are reported to contribute zero size towards removal as
   libarchive reports them to have zero size for install.

3. Package data files (.PKGINFO, .INSTALL, .CHANGELOG) are counted towards
   usage on dbpath on install, but their size is not counted on package
   removal.

4. No handling of extra size needed for .pacsave/.pacnew files.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12 20:29:54 -06:00
Allan McRae 695656d252 Add function to match file to mount point
For a given file, determine which mount point it is on or will be
installed to.  Take into account that we might be using an alternative
installation root.

Add additional helper function added to sort mount point list for easier
matching.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12 20:29:49 -06:00
Allan McRae f4e9deb6d7 Add function for listing system mount points
Add a mount_point_list() function that attempts to portably obtain
a list of system mount points and a struct to hold needed mount point
information.

Abort the transaction if we are unable to determine the mount points.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12 20:29:43 -06:00
Allan McRae adb10c3ab2 Prototype disk space checking functionality
Very basic prototyping for adding functionality to check free disk
space before performing package installs.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12 20:29:37 -06:00
Dan McGee f0051a7678 Remove AC_TYPE_SIGNAL usage
This macro is deemed unnecessary by even the autoconf guys, so we really
don't need to use it.

Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12 20:29:30 -06:00
Dan McGee fc74ef93b6 dirent usage cleanup
We were including the header in a lot of places it is no longer used.
Additionally, use the correct autoconf macro for determining whether
d_type is available as a member: HAVE_STRUCT_DIRENT_D_TYPE.

Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12 20:29:20 -06:00
Allan McRae 8e9a69e8f6 Move MAX_DELTA_RATIO definition
This is a delta specific definition so it makes more sense to put
it in the delta specific header file.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12 20:29:05 -06:00
Allan McRae a44c7b8956 Combine reading from depends and desc in sync db
This will allow us to eventually combine the depends and desc entries
within the sync database.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12 20:25:35 -06:00
Xavier Chantry abefa23341 alpm/remove.c : respect --dbonly during remove-upgrade
When a -Sk or -Uk operation induced a removal of an existing local
package, --dbonly was not in effect and the files were all removed.

Fixing this behavior was already marked as TODO in database012 pactest
------------
TODO: I honestly think the above should NOT delete the original les, it
hould upgrade the DB entry without touching anything on the file stem.
E.g. this test should be the same as:
   pacman -R --dbonly dummy && pacman -U --dbonly dummy.pkg.tar.gz
------------

Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
[Dan: small coding style touchup]
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12 20:19:24 -06:00
Xavier Chantry d0d8f605d5 alpm: don't expose alpm_depcmp
Either we expose all low levels function dealing with pmdepend_t
(splitdep and depfree come to mind), or we don't.

Since none of the tools use depcmp, I chose to remove it. In the future,
we might want to expose higher level functions such as
alpm_find_satisfier, or just lower level functions like splitdep and
depfree together with depcmp.

Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12 20:08:54 -06:00
Xavier Chantry d5a7dc67d9 alpm: kill alpm_deptest
This has been replaced by the more flexible alpm_find_satisfier
function, and alpm_deptest was completely unsused now.

Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12 20:08:27 -06:00
Xavier Chantry a03daad073 alpm: add new alpm_find_satisfier function
whatprovides and splitdep were removed, so depcmp alone is quite useless
now without splitdep, and deptest is not flexible enough.

Introduce a new alpm_find_satisfier which is hopefully more flexible,
this should make implementation of deptest very easy, and also help alpm
tools such as pactree.

Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12 20:07:58 -06:00
Xavier Chantry c2cce1f46a Fix a few problems reported by clang-analyzer
One missing NULL-check and 3 dead assignments.

Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12 20:07:15 -06:00
Dan McGee a35610beba Merge branch 'maint'
Conflicts:
	lib/libalpm/be_local.c
	lib/libalpm/trans.c
2010-12-12 19:53:20 -06:00
Xavier Chantry 5c8083baa4 be_files: write EPOCH instead of FORCE
This patch is only meant for 3.4.x. It prepares the place for the future
epoch-aware release.

All force packages that get reinstalled or upgraded will get an EPOCH
entry in the local database, and thus the new pacman with epoch won't
reinstall them by mistake on the first -Su.

Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12 19:45:04 -06:00
Dan McGee eedf4f4e63 Fix possible null pointer deref in check_arch
If we have a corrupted database, a package can come through without an arch,
causing the code to blow up when making strcmp() calls. It might even be
possible with perfectly valid database entries lacking an 'arch =' line.
This behavior was seen as at least one of the problems in FS#21668.

Ensure pkgarch is not null before doing anything further.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-10 19:45:14 -06:00
Dan McGee 0f3957ab48 Merge branch 'maint' 2010-10-18 16:52:57 -05:00
Xavier Chantry 30734c9a4a alpm/sync: very small memleak fix
Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-18 16:50:32 -05:00
Xavier Chantry a2d7f6f206 libalpm/remove: fix funny progress bar problem with empty packages
$ pacman -Rd kde-meta

Remove (15): kde-meta-kdewebdev-4.5-1 [0.00 MB]  kde-meta-kdeutils-4.5-1 [0.00 MB]
             kde-meta-kdetoys-4.5-1 [0.00 MB]  kde-meta-kdesdk-4.5-1 [0.00 MB]
             kde-meta-kdeplasma-addons-4.5-1 [0.00 MB]  kde-meta-kdepim-4.5-1 [0.00 MB]
             kde-meta-kdenetwork-4.5-1 [0.00 MB]  kde-meta-kdemultimedia-4.5-1 [0.00 MB]
             kde-meta-kdegraphics-4.5-1 [0.00 MB]  kde-meta-kdegames-4.5-1 [0.00 MB]
             kde-meta-kdeedu-4.5-1 [0.00 MB]  kde-meta-kdebase-4.5-1 [0.00 MB]
             kde-meta-kdeartwork-4.5-1 [0.00 MB]  kde-meta-kdeadmin-4.5-1 [0.00 MB]
             kde-meta-kdeaccessibility-4.5-1 [0.00 MB]

Total Removed Size:   0.06 MB

Do you want to remove these packages? [Y/n]
( 1/15) removing kde-meta-kdewebdev      [------------------------] 100%
$ it stopped here..

On one side, libalpm did not initialize the progress bar at 0 percent.
So with meta-packages that have 0 files, there was only one progress bar
call with percent == 100.

On the other side, pacman callback kept track of the last percent that
it received. When there are only meta-packages, we always received only
100, so pacman believed the progress bar needed not update. Thus only
the first package was actually displayed.

A proper fix for the callback would be to keep track of last package
name to make sure the recorded prev percent applies.

But since we now specify that both Add and Remove should at least send
percent=0 at beginning and percent=100 at the end, there is no need
for that.

Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-18 16:46:41 -05:00
Xavier Chantry 7237903c66 be_package: read force entry and convert to epoch
We still need to read force entry in epoch-aware pacman, so that when we
install an old force package, EPOCH gets written to the local db.

Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-14 20:23:13 -05:00
Dan McGee feb9889f22 Add epoch support to pacman/libalpm
This will allow for better control of what was previously the 'force' option
in a PKGBUILD and transferred into the built package.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-13 23:29:26 -05:00
Dan McGee ef32aa0219 Small tweaks after backend merge
Just a few small things I noticed looking through the code.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-13 23:09:20 -05:00
Allan McRae 24d77291da Only write to local repos
We do not write to sync repos so kill the code for that.

Signed-off-by: Allan McRae <allan@archlinux.org>
2010-10-14 13:17:40 +10:00
Allan McRae 5b17d8f27d Clean-up parsing sync database
Remove unnecessary parsing of fields not found in sync desc file.

Signed-off-by: Allan McRae <allan@archlinux.org>
2010-10-14 13:17:40 +10:00
Allan McRae fbcadebcab Clean-up parsing local database
Remove unnecessary parsing of fields not found in local desc files.
Leave %FORCE% parsing as this likely will make an appearance in desc
files in the future.

Signed-off-by: Allan McRae <allan@archlinux.org>
2010-10-14 13:17:40 +10:00
Allan McRae d39248120e Remove lazy loading of deltas
Local packages do not have deltas so remove lazy loading of delta
information.

Signed-off-by: Allan McRae <allan@archlinux.org>
2010-10-14 13:17:40 +10:00
Allan McRae e464339e3b Move and rename splitname
The splitname function is a general utility function and so is better
suited to util.h.  Rename it to _alpm_splitname to indicate it is an
internal libalpm function as was the case prior to splitting local and
sync db handling.

Signed-off-by: Allan McRae <allan@archlinux.org>
2010-10-14 13:17:40 +10:00
Allan McRae 448f78c067 Restrict visibility of checkdbdir and get_pkgpath
These functions are only needed by be_local and were only promoted
to db.{h,c} as part of the splitting of handling the local and sync
dbs.  Move them into be_local.c and make them static again.

Signed-off-by: Allan McRae <allan@archlinux.org>
2010-10-14 13:17:39 +10:00
Allan McRae 149ab6b272 Only download sync databases
As the sync databases are read directly from the tarball, we no
longer need to extract them.

Signed-off-by: Allan McRae <allan@archlinux.org>
2010-10-14 13:17:39 +10:00
Allan McRae 4a8e396a58 Parse sync database
Read in package information for a tar based sync database. Do not
use lazy loading for sync db.

Signed-off-by: Allan McRae <allan@archlinux.org>
2010-10-14 13:17:39 +10:00
Allan McRae 5e61f07735 Populate sync db from archive
Read in list of packages for sync db from tar archive.

Breaks reading in _alpm_sync_db_read and a lot of pactests (which
is expected as they do not handle sync db in archives...).

Signed-off-by: Allan McRae <allan@archlinux.org>
2010-10-14 13:17:39 +10:00
Allan McRae fc32faaa6a Completely separate local and sync db handling
Put the db_operations struct to use and completely split the handling
of the sync and local databases.

Signed-off-by: Allan McRae <allan@archlinux.org>
2010-10-14 13:17:39 +10:00
Allan McRae 5b2de3d8ec Separate be_files into be_sync and be_local
The file be_files.c is "split" to be_local.c and be_sync.c in order
to achieve separate handling of sync and local databases.

Some basic clean-up of functions that are only of use for local or
sync databases has been performed and some rough function renaming
in duplicated code has been performed to prevent compilation errors.
However, most of the clean-up and final separation of sync and local
db handling occurs in following patches.

Signed-off-by: Allan McRae <allan@archlinux.org>
2010-10-14 13:17:38 +10:00
Allan McRae 96e277cfd9 Move db cache handling functions
These will be needed for the handling of both local and sync database
caches, so put them in a common location.

Signed-off-by: Allan McRae <allan@archlinux.org>
2010-10-13 23:53:18 +10:00
Allan McRae 0909a72000 Move database handling utility functions
Move splitname, checkdbdir, get_pkgpath into db.{h,c} as these will be
needed to parse both the local and sync databases during the initial
splitting.  They will be moved out of db.{h,c} at to more appropriate
locations at a later stage.

Signed-off-by: Allan McRae <allan@archlinux.org>
2010-10-13 23:53:18 +10:00
Allan McRae c56b576f6f Fix documentation syntax and typo
Signed-off-by: Allan McRae <allan@archlinux.org>
2010-10-13 23:53:18 +10:00
Dan McGee efbae3cfcb Initial hack at a DB operations struct
It doesn't do a whole lot yet, but these type of operations will
potentially be different for the DBs we load.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-13 23:53:18 +10:00
Dan McGee 522ef5e981 Move the cache stuff where it should be
Cache bullshit only has relevance to be_files, so move it there.

Signed-off-by: Dan McGee <dan@archlinux.org>
[Allan: BIG rebase]
Signed-off-by: Allan McRae <allan@archlinux.org>
2010-10-13 23:53:18 +10:00
Dan McGee b9a531c2d7 Move changelog functions to callback struct
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-13 23:53:18 +10:00
Dan McGee 6cebd4e602 Complete rework of package accessor logic
Hopefully we've finally arrived at package handling nirvana, or at least
this commit will get us a heck of a lot closer. The former method of getting
the depends list for a package was the following:

1. call alpm_pkg_get_depends()
2. this method would check if the package came from the cache
3. if so, ensure our cache level is correct, otherwise call db_load
4. finally return the depends list

Why did this suck? Because getting the depends list from the package
shouldn't care about whether the package was loaded from a file, from the
'package cache', or some other system which we can't even use because the
damn thing is so complicated. It should just return the depends list.

So what does this commit change? It adds a pointer to a struct of function
pointers to every package for all of these 'package operations'  as I've
decided to call them (I know, sounds completely straightforward, right?). So
now when we call an alpm_pkg_get-* function, we don't do any of the cache
logic or anything else there- we let the actual backend handle it by
delegating all work to the method at pkg->ops->get_depends.

Now that be_package has achieved equal status with be_files, we can treat
packages from these completely different load points differently. We know a
package loaded from a zip file will have all of its fields populated, so
we can set up all its accessor functions to be direct accessors. On the
other hand, the packages loaded from the local and sync DBs are not always
fully-loaded, so their accessor functions are routed through the same logic
as before.

Net result? More code. However, this code now make it roughly 52 times
easier to open the door to something like a read-only tar.gz database
backend.

Are you still reading? I'm impressed. Looking at the patch will probably be
clearer than this long-winded explanation.

Signed-off-by: Dan McGee <dan@archlinux.org>
[Allan: rebase and adjust]
Signed-off-by: Allan McRae <allan@archlinux.org>
2010-10-13 23:53:18 +10:00
Dan McGee d1126db128 Allow local and sync db to be treated separately
Implement this seemingly simple change in package.h:

 typedef enum _pmpkgfrom_t {
-       PKG_FROM_CACHE = 1,
-       PKG_FROM_FILE
+       PKG_FROM_FILE = 1,
+       PKG_FROM_LOCALDB,
+       PKG_FROM_SYNCDB
 } pmpkgfrom_t;

which requires flushing out several assumptions from around the codebase
with regards to usage of the PKG_FROM_CACHE value. Make some changes where
required to allow the switch, and now the correct value should be set (via a
crude hack) depending on whether a package was loaded as an entry in a local
db or a sync db.

This patch underwent some big rebasing from Allan and Dan.

Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2010-10-13 23:53:18 +10:00
Dan McGee 49176461a6 Unify caching concerns in package accessors
Move almost all of the caching related stuff into a single #define
(which should maybe even just be a static function) so we don't
duplicate logic all over the place. This also makes the code a heck of a
lot shorter and means further changes to this stuff don't have to touch
each and every getter function.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-13 23:53:17 +10:00
Dan McGee 3a06a9fa9f Read 'force' entry from packages
We weren't reading this in from our packages, thus causing us not to write
it out to our local database. Adding this now will help ease the upgrade
path for epoch later and not require reinstallation of all force packages.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-11 17:48:11 -05:00
Dan McGee dff73a2a69 Avoid stat call to determine is_directory if possible
On Linux and OS X, we can determine if an entry obtained through a readdir()
call is a directory without also having to stat it. This can save a
significant number of syscalls. The performance increase isn't dramatic, but
it could be on some platforms (e.g. Cygwin) so it shouldn't hurt to use this
unconditionally where supported.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-11 10:06:03 -05:00
Sebastian Nowicki 821ff061b1 Set pm_errno on libarchive errors while reading
Signed-off-by: Sebastian Nowicki <sebnow@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-09-27 10:53:48 -05:00
Dan McGee d2ff8f4b96 Update gettext Makefiles to 0.18
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-09-23 08:17:06 -05:00
Dan McGee d201d1f312 Merge branch 'maint' 2010-09-15 07:31:37 -05:00
Baurzhan Muftakhidinov e29dde9157 Update Kazakh translation
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-09-15 07:19:51 -05:00
Dan McGee fe788ee4a6 Fix libfetch configure checking
I don't know what I tested in commit 3e7b90ff69, but it definitely wasn't
working as advertised. Fix the checks in the source code itself to match the
right define (HAVE_LIBFETCH), as well as make sure the configure check
defaults to looking for the library but not bailing if it could not be
found.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-09-06 11:20:51 -05:00
Dan McGee 6d41da4086 Minor translation file updates after `make distcheck`
It touched up these a bit after it ran, so might as well check the changes
in so we don't have to deal with them again later.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-09-03 20:10:10 -05:00
Dan McGee 881bf5c90f Merge branch 'maint' 2010-09-03 20:06:08 -05:00
Tobias Eriksson 3739e2c10c libalpm Swedish translation update
Signed-off by: Tobias Eriksson <tobier@tobier.se>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-09-03 19:55:22 -05:00
Dan McGee 3e7b90ff69 Clean up libfetch checking in configure
Model it after the new OpenSSL check, and have it be a bit more useful. If
you do not explicitly pass a command line option, it will be linked if
available but will not error out if it is missing. Also bump the version to
that where connection caching was introduced as we use these new features in
the codebase.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-09-02 12:30:36 -05:00
Dan McGee eba521913d Use OpenSSL MD5 crypto functions if available
I've noticed my Atom-powered laptop is dog-slow when doing integrity checks
on packages, and it turns out our MD5 implementation isn't near as good as
that provided by OpenSSL. Using their routines instead provided anywhere
from a 1.4x up to a 1.8x performance benefit over our built-in MD5 function.

This does not remove the MD5 code from our codebase, but it does enable
linking against OpenSSL to get their much faster implementation if it is
available on whatever platform you are using. At configure-time, we will
default to using it if it is available, but this can be easily changed by
using the `--with-openssl` or `--without-openssl` arguments to configure.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-09-02 12:05:23 -05:00
Dan McGee 24d8a15308 libalpm md5: use larger and dynamic buffer
This gave at least a 10% improvement on a few tested platforms due to the
reduced number of read calls from files when computing the md5sum. It really
is just a precursor to another patch to come which is to use MD5 functions
that do the job a lot better than anything we can do.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-09-02 10:33:21 -05:00
Dan McGee 5a25f54757 Merge branch 'maint' 2010-09-01 21:19:06 -05:00
Gaspar Santos a7c4159b16 Add new European Portuguese translation
This is being checked in as 'pt' rather than 'pt_PT' as that is what
Transifex seems to want, and it is also the dominant choice of packages
already installed on my system when doing a count of the files located in
the /usr/share/locale translation directories.

Thanks for the new translation!

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-09-01 21:15:07 -05:00
Jonathan Conder 693ebbd16b use execv to avoid using sh just to run ldconfig
Signed-off-by: Jonathan Conder <j@skurvy.no-ip.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-08-27 11:19:15 -05:00
Jonathan Conder 0223a028e0 redirect scriptlet stderr synchronously through alpm
Fixes FS#18770, and hopefully an occasional deadlock in my frontend as well.
For simplicity it redirects all scriptlet output through SCRIPTLET_INFO, and
all callbacks in the child process have been replaced for thread-safety.

Signed-off-by: Jonathan Conder <j@skurvy.no-ip.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-08-27 11:19:09 -05:00
Dan McGee 8d88f0c897 Merge branch 'maint' 2010-08-23 21:53:06 -05:00
Allan McRae 48589ccc64 Fix some whitespace issues
The combination of tabs and spaces is annoying in any editor that
does not use a tab width of 2 spaces.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-08-23 21:49:05 -05:00
Dan McGee d896527d21 fgets invocation cleanup
From the fgets manpage:

	fgets() reads in at most one less than size characters from stream and
	stores them into the buffer pointed to by s. Reading stops after an EOF
	or a newline. If a newline is read, it is stored into the buffer. A
	'\0' is stored after the last character in the buffer.

This means there is no need at all to do 'size - 1' math. Remove all of that
and just use sizeof() for simplicity on the buffer we plan on reading into.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-08-23 21:48:28 -05:00
Jozef Riha 0478dfa1a5 Add Slovak translation
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-08-23 21:45:54 -05:00
Dan McGee ce3f4e7800 Enable libfetch connection caching
This will allow downloads to reuse connections if possible, which could make
big differences on perceived FTP speed as the connection won't have to be
reestablished each time. For the most part, HTTP requests wouldn't be using
keep alive anyway so this won't have an effect there.

I'm not enthused about having to do this with the library initialization,
but there isn't a much better place due to the fact that the loop over
databases occurs on the frontend and not the backend.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-08-23 17:42:22 -05:00
Mateusz Herych c3f5375380 Updates for Polish translations
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-08-18 13:11:28 -05:00
Dan McGee ddc4130c97 Merge branch 'maint' 2010-07-27 10:18:35 -05:00
Baurzhan Muftakhidinov 0d6efb35ce Small fix to Kazakh translation
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-07-27 10:14:35 -05:00
Dan McGee fa4f25626c Mark sync_pkg and sync_target as static functions
We no longer use these anywhere outside of sync.c, so do the rename and add
static to their definition to meet our coding standards.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-07-27 10:10:55 -05:00
Dan McGee f8d7cd6b26 Maintain a list of seen packages when installing a group
As reported in FS#20221, we don't always do the right thing when installing
a group and using the --needed option. This was due to the code pulling
packages based on what was already in the transaction's add list, but
completely ignoring the fact that we may have already seen and skipped this
same package in an earlier repository.

Add a list to the private _alpm_sync_pkg() function that allows us to have
this extra information so we don't mistakenly downgrade a package when using
--needed.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-07-27 10:10:55 -05:00
Allan McRae a835599496 Download sync db into DBPath/sync
The sync db should be stored in the sync/ folder.  This cleans up
DBPath to only have local/ and sync/ directories in it.

A nice side effect is that the db are now in the right place so we
can implement directly reading from them.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-07-07 07:26:04 -05:00
Allan McRae 68dcabdfbe Remove DBEXT usage
With commit 5dffef78, the repo database always has a symlink
of the form reponame.db.  Use that filename and let libarchive
determine the compression type.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-07-07 07:25:55 -05:00
Allan McRae 60de8ec932 Check return value of fgets calls
Prevents compiler warnings with -D_FORTIFY_SOURCE=2

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-07-07 07:24:57 -05:00
Allan McRae 5a3aae02fe Check return value of chdir and getcwd
Prevents compiler warnings when building with -D_FORTIFY_SOURCE=2

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-07-01 00:14:59 -05:00
Allan McRae 41724cbcde Check return value of fwrite when copying files
Check that writing to destination file actually occurs in
_alpm_copyfile.  Required adding a new error (PM_ERR_WRITE)
as none of the others appeared appropriate.

Prevents compiler warning when using -D_FORTIFY_SOURCE=2.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-06-30 23:49:48 -05:00
Allan McRae 081e6a8360 Do not compare signed and unsigned types
The casting of nread is safe as it is tested to be >0 when it is
initally assigned.  It is also being implicitly cast in the fwrite
call in the line above.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-06-30 08:32:11 -05:00
Dan McGee 67d71ea932 Merge branch 'maint' 2010-06-20 21:01:32 -05:00
Dan McGee 6c00ca8f23 Handle sync target + ignore properly
Rather than say we can't find the target after saying "No, I guess I don't
want to install this", we should make sure the ignored status gets passed
all the way through. This fixes FS#19866.

Pactest is also included that failed before due to the fact that we normally
treat an unfound package as a reason to exit with a non-zero status.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-06-20 15:19:19 -05:00
Allan McRae 59c47aaf52 Clarify testing within conditional statements
Follow the HACKING guidelines and always use != 0 or == 0 rather
than negation within conditional statements to improve clarity.
Most of these are !strcmp usages which is the example of what not
to do in the HACKING document.

Signed-off-by: Allan McRae <allan@archlinux.org>
2010-06-21 01:04:58 +10:00
Andres P 3e4d2c3aa6 libalpm: compare pkgname with strcoll
Use strcoll to compare package names to provide output sorted
according to a users LC_COLLATE settings.

Signed-off-by: Andres P <aepd87@gmail.com>
[Allan: added commit message]
Signed-off-by: Allan McRae <allan@archlinux.org>
2010-06-21 01:04:57 +10:00
Ionuț Bîru c355d2a3b7 Update Romanian translation
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-06-14 12:18:01 -05:00
Leandro Inácio 6e31ddf42e Revise Portuguese (Brazil) translation
Fix the '\t' characters that got introduced by the last update of this
translation that should not have been there.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-06-14 12:08:28 -05:00
Manuel Tortosa 8fbc91e693 Updating Catalan translation
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-06-14 12:02:07 -05:00
Juan Pablo González T fe7b77cd8a Update Spanish translation
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-06-14 11:00:20 -05:00
Roman Kyrylych ea7696b441 Update Ukrainian translation
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-06-14 10:29:57 -05:00
Leandro Inácio 6297248087 Update Portuguese (Brazil) translation
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-06-11 19:01:46 -05:00
Dan McGee 5f5b6f16af translations: rename Norwegian translation from nb_NO to nb
This puts us more in line with other projects that don't attach the country
code to the language code.

$ du -sh /usr/share/locale/nb*/LC_MESSAGES
3.5M    /usr/share/locale/nb/LC_MESSAGES
132K    /usr/share/locale/nb_NO/LC_MESSAGES

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-06-11 10:05:45 -05:00
Dan McGee f9c70d3140 translations: rename Swedish translation from sv_SE to sv
This puts us more in line with other projects that don't attach the country
code to the language code.

$ du -sh /usr/share/locale/sv*/LC_MESSAGES
7.2M    /usr/share/locale/sv/LC_MESSAGES
60K     /usr/share/locale/sv_SE/LC_MESSAGES

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-06-11 09:57:12 -05:00
Christos Nouskas d978039cf0 Revise Greek translation
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-06-09 15:16:59 -05:00
Dan McGee 8163beb622 Update English (British) translation
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-06-07 20:17:14 -05:00
Matthias Gorissen b00d911331 Update German translation
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-06-07 15:08:43 -05:00
Sergey Tereschenko 982018bf74 Update Russian translation
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-06-07 12:24:48 -05:00
Dan McGee 93def410b8 Add note about XySSL/PolarSSL name change
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-06-07 10:35:08 -05:00
Baurzhan Muftakhidinov 9a56830164 Update Kazakh translation
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-06-07 09:30:39 -05:00
Xavier Chantry 3012c0e091 Update French translation
Thanks to CalimeroTeknik <calimeroteknik@free.fr> for providing many
corrections !

Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-06-06 16:42:01 -05:00
Christos Nouskas b79193a37e Update Greek translation
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-06-06 16:41:35 -05:00
Vojtěch Gondžala d58f398312 Update Czech translation
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-06-05 11:40:42 -05:00
Nagy Gabor c80e04a151 Update Hungarian translation
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-06-05 11:34:31 -05:00
Giovanni Scafora a3b1585b7b Update Italian translation
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-06-05 11:30:51 -05:00
甘露(Gan Lu) a66f8dbbb1 Update Chinese translation
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-06-05 11:27:45 -05:00
Samed Beyribey 10aba2fd53 Update Turkish translation
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-06-04 19:44:33 -05:00
Dan McGee f60db581a7 translation: update pot/po files for libalpm in prep for release
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-06-04 13:36:38 -05:00
Jonathan Conder 9ab6bfad22 fix memory leak in _alpm_sync_commit
Signed-off-by: Jonathan Conder <j@skurvy.no-ip.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-05-18 11:51:31 -05:00
Nagy Gabor eada558e12 Partial fix for the phonon/qt issue
This patch fixes the phonon/qt issue, if all to-be-upgraded packages are
explicit targets (ie. only not-yet-installed packages are pulled by
resolvedeps). This condition covers the most common situations, for example
it should hold with every -Su operation.

After this patch sync405.py passes, but sync406.py doesn't.

The work is inspired by the patch of Henning Garus, thanks for his work:
http://mailman.archlinux.org/pipermail/pacman-dev/2010-February/010429.html
(I moved the alpm_list_diff computation to sync.c in order to compute it
only once.)

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-05-18 11:33:00 -05:00
Nagy Gabor 25cd6c2e8d Fix a serious bug in the download code
After commit df99495b82 pacman downloaded files from the first repo only,
and reported corrupted packages for all files from other repos.

The download_size was set to 0 for _all_ transaction packages after
downloading some files from the first repo. This code-block was moved to its
correct place.

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-05-14 15:03:21 -05:00
Jonathan Conder df99495b82 Compute package download size outside _alpm_sync_prepare
And add a new info level for this piece of data.

Signed-off-by: Jonathan Conder <j@skurvy.no-ip.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-05-05 18:15:52 -05:00
Nagy Gabor ac9dde072c Introduce -D, --database
The request of FS#12950 is implemented.

On the backend side, I introduced a new function, alpm_db_set_pkgreason(),
to modify the install reason of a package in the local database. On the
front-end side, I introduced a new main operation, -D/--database, which has
two options, --asdeps and --asexplicit. I documented this in pacman manual.
I've created two pactests to test -D: database001.py and database002.py.

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-05-05 10:37:01 -05:00
Dan McGee 4f80993933 Remove call to function logger
It isn't really necessary here and it helps us get rid of some link
pollution so we can have a slim vercmp binary.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-05-04 23:38:52 -05:00
Dan McGee 2a6f3f0652 Move vercmp code into a separate file
This will facilitate using this object file on its own in the vercmp tool
which will be done in a future commit. The net impact on the generated
binaries should not be noticeable after this commit.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-05-04 23:32:13 -05:00
Xavier Chantry 7965345d43 More consistent printing of off_t and time_t
time_t : %ld
off_t : %jd and cast to intmax_t

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-03-25 21:58:35 -05:00
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
Juan Pablo Gonzalez Tognarelli 08c535e262 update spanish translation
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
2009-07-29 19:34:26 +02:00
Giovanni Scafora 8fdab1e1f0 update italian translation
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
2009-07-29 19:34:26 +02:00
Xavier Chantry 04c31828b6 Update French translation
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
2009-07-29 19:33:30 +02:00
Dan McGee 9b086d8b9e Update PO files in prep for 3.3 release 2009-07-27 21:42:16 -05:00
Dan McGee fb1936bc19 Update POT files 2009-07-27 21:41:58 -05:00
Dan McGee 2f0fc0decb Update copyrights in gettext files 2009-07-27 21:40:43 -05:00
Sebastian Nowicki 30c4d53ce5 Add a fetch callback to allow front-end download support
This allows a frontend to define its own download algorithm so that the
libfetch dependency can be omitted without using an external process.
The callback will be used when if it is defined, otherwise the old
behavior applies.

Signed-off-by: Sebastian Nowicki <sebnow@gmail.com>
[Dan: minor cleanups]
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-07-22 21:27:46 -05:00
Nagy Gabor 1d19f0896c Introduce -Suu
If the user switches from unstable repo to a stable one, it is quite hard to
sync its system with the new repo (the user will see many "Local is newer
than stable" messages, nothing more). That's why I introduced -Suu, which
treats a sync package like an upgrade, iff the package version doesn't match
with the local one's.

I added a new pactest (sync104.py) to test this, and I updated the
documentation of -Su.

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
[Dan: slight doc reword]
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-07-22 20:16:52 -05:00
Nagy Gabor cf669eda9c Fix a minor memleak
Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-07-21 21:45:07 -05:00
Giovanni Scafora 1c4596b4be Update Italian Translation
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-07-21 20:24:06 -05:00
Xavier Chantry 344ced22c3 Fix one bug with .paccheck leftover file
This happens for example if you install a new package, and one of its
backup config file is already on the file system.

If the local file was different, it was saved to .pacorig which is fine.

However if the local file and pkg file were the same, the pkg file
(temporarily extracted as .paccheck) was left on the system.

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-07-20 16:38:15 -05:00
Xavier Chantry 60b6cde637 Fix 2 minor memleaks
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-07-20 16:37:45 -05:00
Xavier Chantry 5d15bb68f7 Do not create .pacsave with -R, if the file is unchanged
This fixes FS#15546

Also fix the interface of unlink_file which was really stupid..
(alpm_list_t used with only one element)

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-07-20 16:37:37 -05:00
Xavier Chantry 45f90de0eb Fix klibc conflict case.
A package can now replace symdir->dir by dir without fileconflicts.

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-07-20 10:13:42 -05:00
Xavier Chantry bfd6817112 Fix fileconflict004
When one package wants to replace a directory by a file, we check that all
files in that directory were owned by that package.

Additionally pacman can be more verbose when the extraction of the symlink
(or file) fails. The patch to add.c looks more complex than it is, I just
moved and reindented code to handle cases 10 and 11 together.

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-07-20 10:13:25 -05:00
Xavier Chantry 2e043aae36 Run ldconfig inside chroot.
This fixes FS#15294.

The code to run a command inside a chroot was refactored from the
_alpm_runscriptlet function to _alpm_run_chroot.

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
2009-07-16 06:12:04 -05:00
Dan McGee c72b4543b6 Update copyright headers and messages
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-07-01 02:08:33 -05:00
Dan McGee be7266155f Allow remove to accept 'local/' prefix
See FS#14642- this allows -Qs output to be fed back into pacman without
problems or having to strip off the 'local/' prefix manually.

Signed-off-by: Dan McGee <dan@archlinux.org>
2009-07-01 01:42:35 -05:00
Volodia Macovei 6af163dd79 Add new Romanian translation
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-06-30 23:34:18 -05:00
Dan McGee a89eae99f6 Fix compile warning fail on older versions of GCC
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-06-30 23:14:18 -05:00
Dan McGee 8c8fa2d82c Search package groups when searching a DB
See FS#13099. This makes sense especially for the pacman frontend, as we
show groups in the search output.

Signed-off-by: Dan McGee <dan@archlinux.org>
2009-06-23 21:51:49 -05:00
Nagy Gabor f250b034b4 Enable remove progressbar with -S (conflict resolving)
$ sudo pacman -S mc

Old output:
***********
:: mc conflicts with mc-mp. Remove mc-mp? [Y/n] y
...
(1/1) checking for file conflicts                   [################] 100%
(1/1) installing mc                                 [################] 100%

New output:
***********
:: mc conflicts with mc-mp. Remove mc-mp? [Y/n] y
...
(1/1) checking for file conflicts                   [################] 100%
(1/1) removing mc-mp                                [################] 100%
(1/1) installing mc                                 [################] 100%

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-06-13 09:57:59 -05:00
Dan McGee aa579b8438 Give sensible feedback when a repo has no configured servers
This fixes FS#14899. When running an -Sp operation without servers
configured for a repository, we would segfault, so add an assert to the
backend method returning the first server preventing a null pointer
dereference.

In addition, add a new error code to libalpm that indicates we have no
servers configured for a repository. This makes -Sy and -S <package>
operations fail gracefully and helpfully when a repo is set up with no
servers, as the default mirrorlist in Arch is provided this way.

Signed-off-by: Dan McGee <dan@archlinux.org>
2009-06-08 20:02:17 -05:00
Nagy Gabor 19b8b63885 Introduce _alpm_pkg_free_trans()
The main purpose of this function to make our code more readable.
It frees transaction specific fields of pmpkg_t. (It is used when a package
is removed from the target list.)

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-06-07 15:11:16 -05:00
Xavier Chantry 13b281d743 xdelta : only handle gz compression specifically
There is apparently no need to handle the re-compression manually when
applying a xdelta patch in case of bzip2 or xz.

Only gzip needs to be handled specifically for disabling timestamp with the
-n option.

After this patch, if xdelta is enhanced with xz support (1-line patch), it
will be transparent from pacman side.

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-06-06 11:16:45 -05:00
Nagy Gabor c520d38451 Introduce PM_TRANS_FLAG_NOLOCK
This flag indicates that the front-end will not call alpm_trans_commit(),
so the database needn't be locked. This is the first step toward fixing
FS#8905.

If this flag is set, alpm_trans_commit() does nothing and returns with
an error (that has new code: PM_ERR_TRANS_NOT_LOCKED).

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-06-01 22:00:57 -05:00
Nagy Gabor 0bf340f73c Remove unused error codes and handle PM_ERR_RETRIEVE by alpm_strerror()
Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-05-18 23:11:43 -05:00
Nagy Gabor 882bff36ac Remove find_replacements()
"Foo replaces bar" simply means that "foo is a new version of bar".
So this patch refactors the code to use this "rule".

_alpm_sync_sysupgrade now does the following for each local package [bar]
(pseudo-code):
for db in syncdbs {
   if(db contains bar) {check if db/bar is an upgrade; break;}
   replacers = find(bar replacers in db);
   if(replacers!=NULL) {ask_user; break;}
}

Note:
1. Replacers are grouped per repo. If more than one package replace bar in
a repo, all of them are considered ("package set of bar replacers").
2. If repo1/foo1 and repo2/foo2 both replaces bar, only repo1/foo1 is
considered (if repo1 stands before repo2 in pacman.conf). FS#11737 is fixed.
3. It can happen that pacman doesn't consider any replacer, if it found a
literal "earlier", so sync132.py modified accordingly (btw, that situation
should not appear irl).

The new sysupgrade code doesn't use sync_newversion(), so I removed the
"local is newer than repo" message, which was annoying with -Qu and
SyncFirst.

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-05-18 23:11:05 -05:00
Gerardo Exequiel Pozzi ed848b1c54 Fix non-C style comments in libalpm
Signed-off-by: Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-05-11 20:26:49 -05:00
Bryan Ischo db3e166503 Look in target-list first to resolve dependencies
This fixes a bug introduced by my previous changes which changes the
behavior of IgnorePkg/IgnoreGroup to allow the user to remove unresolvable
packages from the transaction.  The bug is that the target-list was no
longer being consulted first to resolve dependencies, which means that if
two packages in the sync database satisfied a dependency, and the user
explicitly requested one of those two packages in the sync, the other
package was still being pulled in.

A new test was added, sync993.py, to verify the desired behavior.

Signed-off-by: Bryan Ischo <bji-keyword-pacman.3644cb@www.ischo.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-04-11 14:39:24 -05:00
Bryan Ischo d70465decc Remove duplicates from the unresolvable list before prompting user
Signed-off-by: Bryan Ischo <bji-keyword-pacman.3644cb@www.ischo.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-04-11 14:24:52 -05:00
Dan McGee 4b78852f7e const-ify endswith()
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-04-11 14:13:03 -05:00
Nagy Gabor aefb4e0fa5 Remove pmsyncpkg_t
pmsyncpkg_t data sructure was removed:
1. pmpkg_t.reason is used instead of pmsyncpkg_t.newreason. (The target
packages come from sync repos, so we can use this field without any
problems. Upgrade transaction also uses this field to store this info.)
2. pmsyncpkg_t.removes was moved to pmpkg_t.removes.
This step requires careful programming, because we don't duplicate packages
when we add them to trans->packages. So we modify sync pkgcache when we
add this transaction-only info to our package. Hence it is important to
free this list when we remove any package from the target list
(remove_unresolvable, remove_conflicts, trans_free), otherwise this could
confuse the new sync transactions (with non-pacman GUI).

Overall, our code became ~100 line shorter, and we can call our helper
functions directly on trans->packages in sync.c, we don't need to maintain
parallel package lists.

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-04-11 14:05:13 -05:00
Nagy Gabor 391952600d Fix for trans001.py (FS#9088)
From now on _alpm_db_find_fileconflicts() works with upgrade and remove
target lists (like checkdeps), which makes it transaction independent
(we still need a trans param because of the progressbar). This is a small
step towards the universal transaction. So we call this function directly
from sync.c before commiting the remove transaction. This is much safer,
but we can get false fileconflict error alarms in some tricky cases
("symlinks puzzle" etc).

The patch on find_fileconflict looks complex, but it is mainly an
"indent-patch", the new code-part can be found after the
/* check remove list ... */ comment, and I modified something around the
"file has changed hand" case (see comment modifications in the code).

Unfortunately sync.c became more ugly, because we have to create 2 parallel
internal transactions: to avoid duplicated work, upgrade transaction is
used to load package data (filelists). This problem will disappear, when
we finally get rid of internal transactions.

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-04-11 13:59:55 -05:00
Nagy Gabor 634304feae Free *data list when user removes unresolvable packages
Resolvedeps reports error when it cannot resolve some dependencies, puts
them into the *data list, and set pm_errno. If user removes the
unresolvable packages from the target list, we have no error anymore,
so from now on we free *data list (we eliminate a memleak) and unset
pm_errno.

(Additionally I removed two needless lines from the code, unresolvable list
is always freed in cleanup.)

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-04-11 13:55:46 -05:00
Nagy Gabor 56fd24ecf8 Print warning in _alpm_resolvedep() if a satisfier package is ignored without QUESTION
After commit f57f8d3386 pacman *silently*
ignores packages from IgnorePkg/IgnoreGroup during dependency resolving,
if prompt == 0. This behavior is changed to "give warning + ignore".
(Otherwise the user is not informed about the fact that the package
resolving was blocked by ignorepkg.)

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-04-11 13:54:50 -05:00
Nagy Gabor 77efd51216 New error type: PM_ERR_PKG_IGNORED
This patch fixes FS#12059.
Now sync_addtarget can return with PM_ERR_PKG_IGNORED, which indicates that
although the requested package was found it is in ignorepkg, so alpm could
not add it to the transaction. So the front-end can decide what to do.

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-04-11 13:54:25 -05:00
Dan McGee 93ca155b48 Merge branch 'xav/repo-add' 2009-04-11 13:50:56 -05:00
Sebastian Nowicki 63fc93607b Add detail documentation for alpm_db_update()
This adds alpm_db_update() to the alpm_databases Doxygen group. The function
is described in more detail and a code example is given.

Signed-off-by: Dan McGee <dan@archlinux.org>
2009-04-11 12:50:37 -05:00
Samed Beyribey 3cb4eaef4f fixed typos and alignment problem in Turkish translation
Signed-off-by: Samed Beyribey <ras0ir@eventualis.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-04-05 21:40:58 -05:00
Xavier Chantry c8beffa790 Fix several issues with xdelta
1) The changes to sync.c look big but there are mostly caused by
the indentation. Fix a bug where download_size == 0 because the packages and
deltas are already in the cache, but we still need to build the deltas list
and apply the deltas to create the final package.

2) Fix the gzip / md5sum issue by switching to xdelta3, disabling external
recompression and using gzip -n in pacman, and disable bsdtar compression
and using gzip -n in makepkg.

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
2009-03-15 18:08:36 +01:00
Xavier Chantry 9519d22df7 be_files.c : use %jd instead of %ju for intmax_t
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-03-15 11:41:37 -05:00
Xavier Chantry de97282fbd Revert "popen does NOT require /bin/sh in a subchroot"
This reverts commit 9558639d80.

This change was wrong, popen does require /bin/sh in a subchroot.

1) pacman -S lilo -r root

Notice no error

2) rm root/bin/sh ; pacman -S lilo -r root

Notice an error :
error: scriptlet failed to execute correctly

Actually, we already get an explicit error here, when popen is run, so there
is no need to check for bin/sh explicitely.

Besides this check was problematic in some cases. For example, bash itself
has a scriptlet, but only post_install and post_upgrade, no pre_install and
pre_upgrade. However, since bash has a scriptlet, runscriptlet will also be
called before bash is installed. It won't do anything since the scriptlet
has no pre_install function. But if we keep the check, we will still get
"error : no /bin/sh".

Conflicts:

	lib/libalpm/trans.c

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-03-15 11:41:37 -05:00
Xavier Chantry 36863b968f runscriptlet : Flush open fds before fork() to avoid cloning buffers
This is a bug I noticed 2 years ago :
http://www.nabble.com/Re%3A-logging-output-crazy-to11437357.html#a11479679

I thought I fixed it with 57d77eab32

But the bug was still here. Reading man fork, this part caught my attention:

*  The child inherits copies of the parent's set  of  open  file
descriptors.  Each  file descriptor  in  the  child refers to the same open
file description (see open(2)) as the corresponding file descriptor in the
parent.  This means that the two descriptors  share open  file  status
flags, current file offset, and signal-driven I/O attributes (see the
description of F_SETOWN and F_SETSIG in fcntl(2)).

Since the open file descriptors are inherited, it is probably a good idea to
flush them before forking.

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-03-15 11:40:49 -05:00
Dan McGee 4458f71851 Merge branch 'maint' 2009-02-28 15:43:36 -06:00
Xavier Chantry 8c09c19139 libalpm: remove from_md5 and to_md5 from pmdelta_t
The from_md5 and to_md5 fields were a nice extra safety, which would avoid
trying to apply deltas on corrupted package files. However, they are not
strictly necessary, since xdelta should be able to detect that on its own.

The main problem is that it is impossible to compute these informations from
the delta only. So repo-add would not be able to compute the delta entry
based on just the delta file.

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-02-28 15:33:46 -06:00
Baurzhan Muftakhidinov b3c67a195f Add new Kazakh translation
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-02-24 08:24:47 -06:00
Bryan Ischo f57f8d3386 Don't prompt the user for unignore of IgnorePkg/IgnoreGroup packages
Don't prompt the user for unignore of IgnorePkg/IgnoreGroup packages,
except for packages explicitly listed for sync by the user.  This
eliminates many unnecessary prompts when IgnorePkg/IgnoreGroup is
used.

Signed-off-by: Bryan Ischo <bryan@ischo.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-02-23 20:37:14 -06:00
Bryan Ischo 0268550401 Enabled new interactive prompt and updated some tests
Enabled a new prompt to ask the user if they'd like to remove
unresolvable packages from the transaction rather than failing it.

Many pactest tests that used to fail now return success codes, because
pacman now issues a prompt allowing the user to cancel rather than
failing many transactions, and the pactest scripts always choose to
cancel with no error rather than failing.  The only net effect is that
the return status of pacman is now 0 in cases where it used to be
nonzero.

Signed-off-by: Bryan Ischo <bryan@ischo.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-02-23 20:33:56 -06:00
Bryan Ischo 6c4d702cb1 Reorganize code for one-at-a-time resolving
This change reorganizes the internal code so that packages are
resolved one at a time instead of all at once from a list.  This will
allow a future checkin to prompt the user to see if they'd rather
remove unresolvable packages from the transaction and continue, or
fail the transaction.  This change does not affect the actual behavior
of libalpm and all tests pass without changes.

Signed-off-by: Bryan Ischo <bryan@ischo.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-02-18 20:52:22 -06:00
Xavier Chantry 34e1413d75 Delay the creation of local and sync db dir.
We don't need to create the directories when local or sync dbs are
registered. For example, if a sync db does not exist, we cannot even do
"pacman -Q" as an user.

Instead, we can create the local db if needed during the db_prepare
operation, and sync dbs on db_update.

Also remove some more useless abstractions in db_update and switch to a much
more efficient way to remove a sync db : rm -rf.

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
2009-01-20 14:07:15 +01:00
Xavier Chantry 14230869e6 Remove some db abstraction crap.
These db_open and db_close looked quite useless. And they caused the db
directory to be opened on a simple registering of a database. This is
totally unneeded, this opening can be delayed to when we actually need it.

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
2009-01-20 14:04:54 +01:00
Xavier Chantry eab9684837 alpm_unpack : change prefix handling to workaround FS#12148.
Instead of appending the prefix to each entry name, we can chdir to the
prefix before extracting, and restoring when it is done.
This seems to work better with the strange and special case of FS#12148
where an archive contained the "./" entry.

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
2009-01-20 14:03:46 +01:00
Dan McGee c794661f1e Merge branch 'maint' 2009-01-18 13:48:48 -06:00
Nagy Gabor 472e51b975 Use archive_entry_set_perm instead of archive_entry_set_mode
This patch fixes FS#12148 ('unstable' regular file).
I also changed the other archive_entry_set_mode usage in add.c to
archive_entry_set_perm.

Since I cannot find any relevant info in libarchive manual, I quote
Tim Kientzle (the author of libarchive) here, and I say thank you for
his help.

*** Tim Kientzle wrote *************************************

This is the problem in libalpm/util.c:

323    if(S_ISREG(st->st_mode)) {
324            archive_entry_set_mode(entry, 0644);
325    } else if(S_ISDIR(st->st_mode)) {
326            archive_entry_set_mode(entry, 0755);
327    }

Your example unstable.db.tar.gz is not empty.  It has
one entry in it, called "./".  That entry is marked
as a directory.  But, when you call archive_entry_set_mode(),
you are changing the file type!  archive_read_extract()
then creates the file /var/unstable as you requested.
(archive_read_extract() will replace an empty directory
with a file.)

You should either set the mode value correctly:

323    if(S_ISREG(st->st_mode)) {
324            archive_entry_set_mode(entry, IFREG | 0644);
325    } else if(S_ISDIR(st->st_mode)) {
326            archive_entry_set_mode(entry, IFDIR | 0755);
327    }

Or use archive_entry_set_perm(), which does not change
the file type:

323    if(S_ISREG(st->st_mode)) {
324            archive_entry_set_perm(entry, 0644);
325    } else if(S_ISDIR(st->st_mode)) {
326            archive_entry_set_perm(entry, 0755);
327    }

************************************************************

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-01-18 13:35:17 -06:00
Nagy Gabor cb7337eb64 db->pkgcache_loaded and db->grpcache_loaded
Clearly the old code was more elegant (NULL cache indicated "not loaded"),
but it had some drawbacks, so from now on we indicate the state of caches
explicitly.

Old drawbacks:
When we had an empty database (unstable), libalpm called db_populate after
every pkgcache access, because NULL pkgcache indicated "not loaded" state.
This is not a common case, but the same situation can happen with grpcache,
which is more problematic: If the user had a custom repo with no groups,
grpcache was always NULL. (grpcache is also loaded per database.) Thus
every get_grpcache call induced a load_grpcache operation, so the benefits
of grpcache was completely lost.

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-01-12 23:59:37 -06:00
Nagy Gabor 4da70d800a Rename alpm_get_md5sum to alpm_compute_md5sum and alpm_dep_get_string to alpm_dep_compute_string
This patch introduces the following function name convention:
_compute_ in function name: the return value must be freed.
_get_ in function name: the return value must not be freed.

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-01-12 23:59:30 -06:00
Nagy Gabor a888f377a5 HoldPkg rework
The HoldPkg feature is even more important when the packages to be held are
pulled automatically by pacman, in a -Rc and -Rs operation. Before, it only
applied when the packages were explicitly requested by the user to be
removed. This patch extends holdpkg to -Rc and -Rs by doing the HoldPkg
check just before trans_commit.

Additionally, the whole HoldPkg stuff was moved to the front-end.

I changed the default behavior to "don't remove", so I modified remove030.py
pactest as well.

See also: FS#9173.

Original-work-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-01-12 22:44:00 -06:00
Xavier Chantry 8017b0bb8e Remove libdownload support and fix libfetch one.
Aaron said to consider libdownload a dead project so libdownload support was
removed to more easily fix libfetch one (otherwise many ifdef needed).

There was no direct replacement for ferror to detect an error while
downloading. So instead, I added a check at the end to see if the file was
fully downloaded, which is just a small chunk of code taken from here:
http://cvsweb.netbsd.org/bsdweb.cgi/pkgsrc/net/libfetch/files/fetch.c?only_with_tag=MAIN

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-01-12 22:40:15 -06:00
Dan McGee 0501d340cd Merge branch 'maint' 2009-01-06 20:22:15 -06:00
Vojtěch Gondžala c6bcdf4dc7 Update Czech translation
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-01-05 19:06:39 -06:00
Dan McGee 6f9539aefb Merge branch 'maint'
Conflicts:
	po/it.po
2009-01-04 11:12:28 -06:00
Mateusz Herych 997a611fa4 Update Polish translation
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-01-03 19:07:44 -06:00
Samed Beyribey a2cbccb8c7 Update Turkish translation
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-01-03 09:25:24 -06:00
Sergey Tereschenko c850786e43 Update Russian translation
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-01-03 09:24:07 -06:00
Roman Kyrylych 3acc265f9d Update Unkranian translation
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-01-03 09:20:41 -06:00
Giovanni Scafora 03a63e01a5 Update Italian translation
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-01-03 09:17:50 -06:00
Matthias Gorissen 024012649f Update German translation
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-01-03 09:14:35 -06:00
Juan Pablo González Tognarelli 792ee97645 Update Spanish translation
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-01-03 00:30:09 -06:00
Dan McGee a30bf868ca Merge branch 'maint' 2009-01-03 00:18:22 -06:00
Allan McRae b55f478042 libalpm: add PID to db.lck
This is the first step in being able to automatically remove phantom
lock files.

Signed-off-by: Allan McRae <allan@archlinux.org>
[Dan: fix compilation warnings]
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-01-03 00:00:19 -06:00
Allan McRae a73ad4f0e3 Separate local db directory creation and db write
Changelogs and install files were getting extracted into the local
db folder before it was manually created.  This created issues for
uses with 0077 umasks and was highlighted with the new sudo handling
of umasks (FS#12263).

This moves the local db creation to its own function which is called
before the start of package archive extraction.  Also, added a check
that the folder is actually created.

Signed-off-by: Allan McRae <allan@archlinux.org>
[Dan: rename to _alpm_db_prepare()]
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-01-02 23:52:32 -06:00
Sterling Winter b3169a5687 Log pacsave warnings to pacman.log
Pacman currently logs .pacnew warnings to pacman.log but a similar history
of .pacsave warnings isn't kept. The user should be able to search
pacman.log to discover when and where all .pac* files were created by
pacman.

Addresses FS#12531.

Signed-off-by: Dan McGee <dan@archlinux.org>
2009-01-02 23:40:20 -06:00
Dan McGee f8b689d48e Merge branch 'maint'
Conflicts:
	lib/libalpm/dload.c
	po/it.po
	scripts/makepkg.sh.in
2009-01-02 22:48:52 -06:00
Dan McGee cc7f3b705e Print proxy information when downloading
May help debug issues we come across with proxy behavior (e.g. those pesky
segfaults) as well as be informative to the user when things aren't working
quite right. Addresses FS#12396.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-12-10 19:45:15 -06:00
Dan McGee 61c6552862 Merge branch 'maint'
Conflicts:
	lib/libalpm/dload.c
2008-12-02 22:15:02 -06:00
Dan McGee b99bebc008 Add regex to delta code so we don't segfault when reading line
If the delta line doesn't match our regex, we won't go and process it,
possibly walking off the end of the string.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-11-30 17:17:00 -06:00
Dan McGee f7192b5958 Minor code cleanups
Mostly noticed when compiling libalpm/pacman with ICC.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-11-17 21:47:55 -06:00
Dan McGee 43f9eb1aa9 Set SIGPIPE handler to SIG_IGN when downloading
We don't want a failed write to kill our whole program when we are
downloading things, so set the SIGPIPE handler to ignore when downloading
and restore any previous signal handler when we complete the download.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-10-31 19:46:13 -05:00
Dan McGee 8d4e1e6754 Make libfetch the 'native' download library
Use libfetch naming in the code in place of libdownload names. This is in
preparation for dropping support for libdownload at some point as libfetch
can run on Linux.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-10-31 19:46:13 -05:00
Nagy Gabor 314b4462d2 -Qu rework
From now on -Qu is an "outdated package" filter on local database.
(This is a behaviour change.)

This patch fixes some memleaks and makes the code cleaner, for details see
my comment on FS#7884.

FS#11868 is implemented.

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-10-31 19:46:13 -05:00
Dan McGee cd51abf0c8 Merge branch 'maint' 2008-10-28 22:20:09 -05:00
Lyman Li 2f5d792725 Update Chinese translation
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-10-28 22:06:34 -05:00
Dan McGee d1fec15d81 Correctly close the pipe used for scriptlet execution
We never had a call to pclose() in here before, leaving our file descriptor
in some sort of limbo state. In addition, clean up some of the other logic
such as directly calling exit(1) on a popen() failure rather than going to
our cleanup block, and handling and respecting the exit status of the
subprocess correctly.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-10-18 23:59:28 -05:00
Sergey Tereschenko d24592cbcd Minor updates to Russian translation
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-10-12 23:19:07 -05:00
Dan McGee fa02a71abd Merge branch 'maint' 2008-10-12 21:36:45 -05:00