Commit Graph

1539 Commits

Author SHA1 Message Date
Dan McGee 0ff52b6845 Merge branch 'maint'
Conflicts due to change in return calling style.

Conflicts:
	src/pacman/pacman.c
	src/pacman/sync.c
2011-03-21 07:53:13 -05:00
Lukas Fleischer c67c864ffd Don't initialize progress to zero before calling curl_easy_perform().
Drawing progress bars before calling curl_easy_perform() is needless as
the curl progress callback is called with zero progress before actually
downloading the file anyways. Fixes display of "0%" progress bars when
sync'ing package databases that are already up to date.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-21 07:51:27 -05:00
Dan McGee 488f341f57 Ensure dlcb is defined before calling it
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-21 07:50:31 -05:00
Dan McGee 451f9493f5 Update source translation files in prep for 3.5.1
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-20 23:08:22 -05:00
Dan McGee 32e35d4028 Fix comparison to 0 rather than NULL
Another fix found by Coccinelle example semantic patches.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-20 20:10:19 -05:00
Dan McGee bdc1508a06 Fix assignment before NULL check
Easy fix, found using null_ref.cocci example Coccinelle script.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-20 19:56:55 -05:00
Dan McGee 0303b26b1e Style change: return(x) --> return x
This was discussed and more or less agreed upon on the mailing list. A
huge checkin, but if we just do it and let people adjust the pain will
end soon enough. Rebasing should be relatively straighforward for anyone
that sees conflicts; just be sure you use the new return style if
possible.

The following semantic patch was used to do the change, along with some
hand-massaging in order to preserve parenthesis where appropriate:

The semantic match that finds this problem is as follows, although some
hand-massaging was done in order to keep parenthesis where appropriate:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
expression a;
@@
- return(a);
+ return a;

// </smpl>

A macros_file was also provided with the following content:

Additional steps taken, mainly for ASSERT() macros:
$ sed -i -e 's#return(NULL)#return NULL#' lib/libalpm/*.c
$ sed -i -e 's#return(-1)#return -1#' lib/libalpm/*.c

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-20 19:49:45 -05:00
Dave Reisner 0cf05c77ad lib/dload.c: fix opening braces to conform with coding style
Signed-off-by: Dave Reisner <d@falconindy.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-20 18:49:01 -05:00
Dan McGee b2fde01c54 Merge branch 'maint' 2011-03-20 11:49:42 -05:00
Dan McGee 67c0e9cab3 Add missing include for size_t
Needed for things like our strndup() substitute function.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-20 11:45:17 -05:00
Dave Reisner 352b799efc lib/dload.c: remove lingering libfetch specific headers
Signed-off-by: Dave Reisner <d@falconindy.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-20 11:32:02 -05:00
Allan McRae f6716ae94a Use sane umask for repo db downloads
Fixes FS#23343.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-20 11:17:00 -05:00
tuxce b48f718417 Correctly parse %DELTAS% entries in sync DB
We erroniously dropped the call to _alpm_delta_parse() when macro-izing,
causing segfaults for repos that provide deltas. Addresses FS#23314.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-17 10:51:44 -05:00
Dave Reisner 0da6c591c0 Fix triple progress bars on download
Signed-off-by: Dave Reisner <d@falconindy.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-17 10:05:26 -05:00
Dan McGee e47fc2d7c6 Ensure we have a root partition when checking space
Partially addresses the "why doesn't CheckSpace work in a chroot" issue.
We can't make it work, but we can at least detect when it won't work by
checking for a partition for our given installation root. If we can't
determine the mountpoint for this, bail out with an error.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-17 09:33:04 -05:00
Dan McGee e6c9076a74 Merge branch 'maint' 2011-03-16 19:55:28 -05:00
Dave Reisner deed0286ef alpm_list: fix typo in doxygen comment
Signed-off-by: Dave Reisner <d@falconindy.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-16 19:52:54 -05:00
Dan McGee e28c47ade3 Update translations for message with added newline
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-16 19:52:54 -05:00
Allan McRae 771c002c98 Add missing newline to warning message
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-16 19:52:54 -05:00
Dan McGee cff36093f3 Merge branch 'download' 2011-03-16 19:25:35 -05:00
Dan McGee 9ae6ee0f09 Updated translations for 3.5.0 from Transifex
Thanks to all translators that contributed!

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-16 10:30:02 -05:00
Dave Reisner f2eac18a6e Remove all traces of libfetch
Signed-off-by: Dave Reisner <d@falconindy.com>
2011-03-09 15:22:32 -05:00
Dave Reisner 4ad4527d10 dload: temp patch to allow curl/fetch coexistance
this is just some debuggery to allow pacman to operate with both fetch
and curl at the same time. use the PACMANDL variable to control which
library is used.

Signed-off-by: Dave Reisner <d@falconindy.com>
2011-03-09 15:22:32 -05:00
Dave Reisner 96e458b705 dload.c: add curl_download_internal
This is a feature complete re-implementation of the fetch based internal
downloader, with a few improvements:

* support for SSL
* gzip and deflate compression on HTTP connections
* reuses a single connection over the entire session for lower resource
  usage.

Signed-off-by: Dave Reisner <d@falconindy.com>
2011-03-09 15:22:32 -05:00
Dave Reisner 8a58648471 handle error case for PM_ERR_LIBCURL
Add PM_ERR_LIBCURL to error enum and handle case in error.c by returning
curl_easy_strerror() based on the error number carried by the gloabl alpm
handle.

Signed-off-by: Dave Reisner <d@falconindy.com>
2011-03-09 15:22:32 -05:00
Dave Reisner a5b6a75787 share code between libfetch and libcurl
no actual code changes here. change preprocessor logic to include
get_tempfile, get_destfile, signal handler enum, and the interrupt
handler logic when either HAVE_LIBCURL or HAVE_LIBFETCH are defined.

Signed-off-by: Dave Reisner <d@falconindy.com>
2011-03-09 15:22:32 -05:00
Dave Reisner 159e1b06a5 prefix fetch based functions with fetch_
Do this in preparation for implementing similar curl based
functionality. We want the ability to test these side by side.

Signed-off-by: Dave Reisner <d@falconindy.com>
2011-03-09 15:22:32 -05:00
Dave Reisner 278c847106 handle: Add CURL* and CURLcode vars to struct
Adding the CURLcode is necessary in order to return an error string from
pm_error. Unlike libfetch, curl returns numerical error numbers and does
not maintain a staticly allocated string with the last error generated.

Adding the curl object itself to the handle is advantageous (and
encouraged by curl_easy_perform(3)) because the handle is reusable for
successive operations. This cuts back on overhead when downloading
multiple files in a single transaction.

Signed-off-by: Dave Reisner <d@falconindy.com>
2011-03-09 15:22:32 -05:00
Dave Reisner 75bfe825fc add curl to alpm initialization and teardown routines
Signed-off-by: Dave Reisner <d@falconindy.com>
2011-03-09 15:22:32 -05:00
Allan McRae f2023176f6 Do not print warning with files entry in sync db
repo-add can add a "files" entry into the sync db.  Currently we
do nothing with this file, so explicitly skip it to prevent
unknown database file warnings.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-07 13:54:38 -06:00
Dan McGee 0b6aa428cf Fix gettext plural detection
Our keywords were all screwed up in this regard. Fix it so our
ngettext() shortcut calls are actually recognized and respected.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-03 11:10:14 -06:00
Xavier Chantry 79f8cfb529 libalpm/diskspace.c: remove bogus parenthesis
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-01 18:16:52 -06:00
Dan McGee b12be99c89 Ensure d_type is not DT_UNKNOWN before relying on it
Fixes FS#23090, a rather serious problem where the user was completely
unable to read the local database. Even if entry->d_type is available,
the given filesystem providing it may not fill the contents, in which
case we should fall back to a stat() as we did before. In this case, the
filesystem was XFS but there may be others.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-01 13:39:43 -06:00
Dan McGee 09ce8b446c Fix some easy to find double translations
A lot of these were places that should have used the same message but
didn't, or were very easy to convert to using the same message and
letting some of the burden off of the translators.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-28 17:50:23 -06:00
Dan McGee 07538b948a Update translation template files
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-28 11:11:19 -06:00
Dan McGee f45369800a Check local DB version before continuing transaction
Ensure we have a local DB version that is up to par with what we expect
before we go down any road that might modify it. This should prevent
stupid mistakes with the 3.5.X upgrade and people not running
pacman-db-upgrade after the transaction as they will need to.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-28 10:46:00 -06:00
Dan McGee 5ea4706f57 Move locking functions to where they are needed
We only call these from the transaction init and teardown, so move them
to that file, mark them static, and push more of the logic of handle
manipulation into these functions.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-28 10:43:36 -06:00
Dan McGee 1eccae3d93 Fix trans no-argument function definitions
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-28 10:41:32 -06:00
Jonathan Conder acd9269478 Fix double close of the lock file
According to FOPEN(3), using fclose on an fdopen'd file stream also
closes the underlying file descriptor. This happened in _alpm_lckmk
(util.c), which meant that when alpm_trans_release closed it again, the
log file (which reused the original file descriptor) was closed instead.

Signed-off-by: Jonathan Conder <jonno.conder@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-27 13:32:41 -06:00
Dave Reisner 1fcc496756 alpm: alpm_db_get_pkgcache_list => alpm_db_get_pkgcache
This avoids needless breakage of the public API.

Signed-off-by: Dave Reisner <d@falconindy.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-25 09:46:36 -06:00
Dave Reisner eefe8c8364 alpm: remove public visibility of pmpkghash_t
There's no API functions exposed which allow manipulation of this type,
so remove it from public view. Also, rename the public and private
alpm_db_get_pkgcache symbol to alpm_db_get_pkgcache_has.

Signed-off-by: Dave Reisner <d@falconindy.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-25 09:45:13 -06:00
Dan McGee 2f96764058 Continue resolving dependencies rather than bailing on first error
This allows error messages emitted by the frontend to be a bit more
descriptive and not have the annoying "well why didn't you tell me that
the first time" problem. If a package had multiple missing deps, we
would bail on the first one before rather than finish processing all
missing dependencies, and only print one error message. Instead,
continue through this entire set of missing deps and append all eventual
errors.

The added pactest tests this case, as the to be installed package has
two missing dependencies. However, pactest does not actually test or see
the difference in output from before and after, so it passes in both
cases, but it is clearly visible in the logs.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-25 07:55:16 -06:00
Dan McGee d4d304cdb7 Various small spelling fixes and small tweaks
Nothing that changes behavior here. Spelling fixes and pushing a
variable down to the scope it is used.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-25 07:53:11 -06:00
Dan McGee 7c14e48776 Mark log callback format string const
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-24 09:38:59 -06:00
Dan McGee 6735807c0f Remove trans->skip_add
This is old code that has since gone stale; we no longer ever add
anything to this list so no need to keep it around and check the
contents during extraction.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-22 16:48:51 -06:00
Dan McGee cfa7602032 Don't generate filelist unless we are going to use it
We throw it away if !full, so no need to waste time creating the list in the
first place.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-16 20:57:07 -06:00
Dan McGee 00c393d49f Conflict checking code cleanup
* Make conflict_isin() static; it is used nowhere else.
* Remove does_conflict(): it turns out to be replaceable by a single call to
  _alpm_depcmp(). By pushing it up, we can reduce calls to _alpm_splitdep()
  from 60,368 to 16,940 during one test -Su operation I ran.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-16 20:57:07 -06:00
Dan McGee d1cc1ef6c3 Fix some database size estimation problems
* Use stat() and not lstat(); we don't care for the size of the symlink if
  it is one, we want the size of the reference file.
* FS#22896, fix local database estimation on platforms that don't abide by
  the nlink assumption for number of children.
* Fix a missing newline on an error message.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-15 16:58:08 -06:00
Pang Yan Han 62a2e45b12 Use CALLOC for _alpm_graph_new()
Change _alpm_graph_new() to use CALLOC to avoid explicit zeroing out of fields
in pmgraph_t.

Signed-off-by: Pang Yan Han <pangyanhan@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-15 16:23:36 -06:00
Dan McGee 30f338cce6 diskspace: allow used flag to be toggled for both remove and install
Turn it into an enum rather than a boolean, and use a bitmask like we do for
reading DB entries. The relevant flag is turned on in our two calculate
loops, and anything reading the used flag later can decided which flag (or
either) is relevant.

This will allow the read-only partition code to be triggered on a
remove-only operation, e.g. if /boot was read-only and one tried to remove
grub in a sync transaction. Of course, right now, we don't actually run the
diskspace check code in the '-R' codepath.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-11 10:51:59 -06:00