Commit Graph

1556 Commits

Author SHA1 Message Date
Allan McRae 5782b8356c Prototype pacman files database operations
Add the -F/--files operations, -s/--sync support and nd provide dummy
functions for -s/--search, -l/-list and -o/--owns.

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-07-15 10:57:30 +10:00
Allan McRae e49abc9860 pacman: move database syncing to util.c
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-07-15 10:57:30 +10:00
Allan McRae b0dac754d2 Add pacman support for .files databases
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-07-15 10:57:30 +10:00
Allan McRae 1ada16f017 Fix formatting in parsearg_upgrade
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-07-14 20:46:03 +10:00
Allan McRae 2d7a41539b Simplify sync_cleandb
1) Remove checks for removing pre-tardb files
2) Remove the long redundant keep_used parameter
3) Fix pacman error due to removing .sig file along with database

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-07-14 20:45:55 +10:00
Andrew Gregory 2e5e496eb0 Fix overflow warnings
Fix new warnings generated by gcc-5 about potential overflows.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-07-12 16:23:18 +10:00
Lukas Fleischer a187fa4562 Match providers when showing optdep install status
Use alpm_find_satisfier() instead of alpm_db_get_pkg() when retrieving
the install status of a package to make sure we spot providers as well.

Fixes FS#36412

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-06-20 17:32:57 +10:00
Johannes Löthberg 53d9633449 util.c: table_display: Fix incorrect docstring
Commit 7b8f8753 removed the title parameter but forgot to remove it
from the docstring.

Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-06-20 17:32:57 +10:00
Charles Duffy 1040ad4e71 Fix compilation if libarchive headers are not in standard location
With commit 097d5a478b, including alpm.h also drags in archive.h.
Ensure the tools we build that depend on ALPM also include the necessary
flags to find libarchive headers if they are not installed in a standard
location.

[Dan: Add commit message]
Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-05-12 14:00:54 +10:00
Andrew Gregory d4e5de4bf6 pacsort: fix warning about signed overflow potential during comparison.
Some crazy person assumed we would have fewer than INT_MAX columns.

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-05-12 14:00:54 +10:00
Allan McRae 4dbac804a3 Pluralize callback string
In English, this string only has it plural form. However, we need to use the
pluralized translation as some languages can have multiple plural formats.

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-05-12 14:00:54 +10:00
Charles Pigott f34e48a988 Actually return the error value of check_db_local
Signed-off-by: Charles Pigott <charlespigott@googlemail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-03-15 15:32:58 +10:00
Will Miles 965539adbf common: Avoid errors on systems that define strnlen but not strndup
Add a configure test for a system library supplied strnlen, and disable
the embedded version in common if one is found.

Signed-off-by: Will Miles <wmiles@sgl.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-03-03 16:54:17 +10:00
Will Miles bb94729c09 util: Use util-common for strndup in pacsort and pactree
This small refactor reduces the number of replications of the local
imeplementation of strndup.

Signed-off-by: Will Miles <wmiles@sgl.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-03-03 16:54:17 +10:00
Allan McRae 578ceb29fa sync_cleandb: ensure stat call succeeds
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-03-03 16:54:17 +10:00
Allan McRae 9f1c5f0251 pacsort: test string is not NULL before strlen
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-03-03 16:54:17 +10:00
Allan McRae 2108d95526 Fix memory leaks in dump_pkg_full
Leaks when using -Sii with package signatures

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-03-03 16:54:17 +10:00
Allan McRae 7879a5b3e5 Merge branch 'maint' 2015-02-20 10:36:18 +10:00
Allan McRae e0f889e2ea Update translations from Transifex 2015-02-20 10:21:15 +10:00
Allan McRae 5baec6d5e9 Update translations from Transifex
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-02-14 11:18:49 +10:00
Allan McRae 2e48101999 Update copyright notices for 2015
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-02-01 21:19:04 +10:00
Andrew Gregory 926280cfc7 remove support for .pacorig files
Leave user files in place and save new config files with a .pacnew
extension.  This reduces the complexity of file extraction and respects
the principle that pacman shouldn't modify files it didn't create.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2015-01-21 14:27:47 +10:00
Andrew Gregory 3b20561748 ini.c: move error output into conf.c
Move the remaining output into conf.c by notifying the callback of read
errors.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2015-01-21 14:27:47 +10:00
Andrew Gregory ea96b56722 ini.c: remove useless key check
key points to a statically allocated string so it can't be NULL and
empty keys are rejected by the callback.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2015-01-21 14:27:47 +10:00
Andrew Gregory e7d8e2b5ac ini.c: remove empty section name restriction
alpm will reject empty database names already.  Reduces error handling
in the ini parser.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2015-01-21 14:27:46 +10:00
Andrew Gregory 4ccafc484d ini.c: remove unnecessary helper function
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2015-01-21 14:27:46 +10:00
Andrew Gregory 09cfe2a4c0 ini.c: move Include parsing to conf.c
Reduces the number of errors the ini parser must handle to make it more
suitable for sharing with the backend.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2015-01-21 14:27:46 +10:00
Andrew Gregory 9eb07a81fa ini.c: remove final callback call
Storing repo information removes the need for the final callback.  This
allows the call signature to be re-purposed for indicating read errors.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2015-01-21 14:27:46 +10:00
Andrew Gregory 7ed0d60a0d conf.c: parse config in a single pass
Fixes FS#28255

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2015-01-21 14:27:46 +10:00
Andrew Gregory 95121cc4f1 conf.c: use masks for siglevel inheritance
This will allow pacman to parse its config file in a single pass and
removes the need for the *_SET siglevels in alpm that were only required
for pacman's siglevel inheritance.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2015-01-21 14:27:46 +10:00
Andrew Gregory 2aa85c3bfd conf.c: store repo settings in dedicated struct
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2015-01-21 14:27:46 +10:00
Allan McRae 62d5a71fba Remove testdb
Replaced by pacman -Dk / -Dkk

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-01-02 21:44:59 +10:00
Allan McRae e8a3e3d81a Integrate testdb into pacman
The functionality of testdb is now available in pacman. pacman -Dk will
check the local database for consistency, and pacman -Dkk will check the
sync databases.

Note that unlike testdb, you can not specify individual sync databases to
check as sync databases act as a whole and not individually. A single database
can be checked using an alternative pacman.conf file.

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-01-02 21:44:58 +10:00
Allan McRae 194dea2de1 Split install reason changing into its own function
Prepare for other functions to be added to the --database option.

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-01-02 21:44:58 +10:00
Allan McRae 4c4890dd1c Clarify "assume installed" error message
The error message on failing to add an "assume installed" entry to the backend
was not clear.  Clarify by making "assume-installed" none translatable and
adding a hyphen to match calling flag.

Signed-off-by: Allan McRae <allan@archlinux.org>
2014-12-28 13:06:15 +10:00
Allan McRae d5e93e895b pacsort: fix memory leak
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-12-27 17:08:32 +10:00
Allan McRae f4796c905c pacman/util.c: fix potential memory leak in indentprint 2014-12-24 11:19:29 +10:00
Allan McRae eac09e1d9f Fix memory leak in ALPM_EVENT_OPTDEP_REMOVAL callback
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-12-24 11:19:29 +10:00
Allan McRae 863cfb5808 Improve db upgrade error message
This message is clearer without (another) error prefix.

Signed-off-by: Allan McRae <allan@archlinux.org>
2014-12-24 11:19:28 +10:00
Allan McRae 54db3745d6 Update translations from transifex
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-12-19 13:53:35 +10:00
Dave Reisner 16259d728e shut up GCC on -Wmaybe-initialized warnings
Admittedly, these are totally bogus, but a clean build is a happy build.

Signed-off-by: Allan McRae <allan@archlinux.org>
2014-12-18 16:34:03 +10:00
Micah Saint Germain a4b23417f9 Fix pointer declarations to be globally consistent
Refactored inconsistent pointer declarations to better improve consistency
throughout the pacman codebase which will, in turn, increase readability to
the user.

Expected format of a pointer declaration:
`typename *varname`

Signed-off-by: Micah Saint Germain <micah@lexme.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-12-18 16:32:55 +10:00
Dave Reisner 04bc3a24eb pacsort: parse inputs up front into control struct
This moves most of the parsing work out of the sorting path. The explode
and splitfile functions now call input_new and append input_t structs
to the list of sort candidates instead of raw strings. This lets us
make smarter and easier decisions in the sorting callbacks, which are
now also split into the version and file comparison methods for clarity.

This fixes two bugs:

1) Incorrect ordering with filenames containing epoch in the pkgver
2) Incorrect ordering with package names which are substrings of
each other (e.g. "systemd" and "systemd-sysvcompat").

Performance of the --files mode degrades slightly as a result of this
change, but not unreasonably. Sorting with small inputs (5-10) doubles
in runtime, but larger inputs (4000+) only increase by 20%.

ref: https://bugs.archlinux.org/task/37631

Signed-off-by: Allan McRae <allan@archlinux.org>
2014-11-20 14:40:25 +10:00
Allan McRae 193b2b33f8 Update po files to send to Transifex
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-11-18 15:14:51 +10:00
Allan McRae db402d6029 Pull translation updates from Transifex
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-11-18 15:12:40 +10:00
Allan McRae eda65967ec Do not warn about missing files in NoExtract
When checking a packages files, ignore any missing files in NoExtract

Signed-off-by: Allan McRae <allan@archlinux.org>
2014-11-18 12:50:56 +10:00
Florian Pritz 9594f513a4 Add --assume-installed to pacman --help
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-11-05 11:01:09 +10:00
Andrew Gregory 82208c0239 testdb: ignore ALPM_DB_VERSION
Replaces the test for hidden files which appears to be leftover from
2e431e1cc before sync db checking was moved to a separate function.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-10-19 21:32:46 +10:00
Andrew Gregory 01beca5df7 pacman: add --confirm option
--confirm cancels the effect of a previous --noconfirm.
This makes it easier for scripts to default to --noconfirm
but allow users to override it.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-10-13 12:54:29 +10:00
Florian Pritz 04e8048725 Add --assume-installed option
This allows to ignore specific dependencies.

Signed-off-by: Florian Pritz <bluewind@xinu.at>
2014-09-30 22:33:26 +10:00
Andrew Gregory b275e5184e table_display: only check width when non-zero
A width of 0 indicates that either pacman is not attached
to a tty or the user does not want line wrapping.  Either
way pacman should not fall back to the basic display.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2014-09-30 14:05:13 +10:00
Andrew Gregory dc339faf6a avoid line wrapping if not in a tty or COLUMNS=0
Scripts that parse pacman's output (like pacsearch) generally do not
want wrapped lines.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2014-09-30 14:04:23 +10:00
Andrew Gregory b52ed49d75 Revert "Remove log_cb, add ALPM_EVENT_LOG instead"
Moving logging to the event callback caused warnings
under clang due to non-literal format strings and
silenced all log messages when --print was used.

This reverts commit cd793c5ab7.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>

Conflicts:
	lib/libalpm/alpm.h
	src/pacman/callback.c
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-09-30 12:56:21 +10:00
Johannes Löthberg 31b9862600 pacman.c: Add -gg, -ii, and -yy to help summary
The sync help summaries was missing the information about:
* -gg: View all groups and members
* -ii: View extended information
* -yy: Force refresh even if DBs are up to date

Fixes FS#41388.

Original-work-by: Earnestly <zibeon@gmail.com>
Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-09-23 23:29:03 +10:00
Andrew Gregory 24e0bd215c pacman: set SA_RESTART for signal handler
Calling a signal handler interrupts some functions, most notably read()
and therefore fgets().

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2014-09-23 21:43:16 +10:00
Andrew Gregory c792262b13 wrap fgets to retry on EINTR
The read() underlying fgets() can be interrupted by a signal handler
causing fgets() to return NULL.  Before we started handling SIGWINCH,
the odds of interrupting a read were low and typically resulted in
termination anyway.  Replace all fgets calls with a wrapper that retries
in EINTR.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2014-09-23 21:43:16 +10:00
Andrew Gregory d981f93f18 sync.c: fix style violations
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-08-04 14:23:58 +10:00
Andrew Gregory 4ccf49d3e7 pacman.c: simplify stdin parsing
Incorporate memory exhaustion and end-of-stream
checks into the main loop.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-08-04 14:23:58 +10:00
Andrew Gregory 71da296d01 check_pkg_fast: check file type
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2014-08-03 18:46:32 +10:00
Andrew Gregory c3835c157a check_file_exists: replace lstat with llstat
Paths are constructed directly from package file lists and may contain
trailing slashes, causing lstat to dereference symlinks.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2014-08-03 18:46:32 +10:00
Andrew Gregory bbeced26f6 llstat: modify path in place
This makes llstat's signature differ from lstat's, but we never actually
use it on a const string and this saves a large number of strdup's.
This also allows stripping multiple trailing slashes and corrects a bug
where calling llstat on "/" would result in calling lstat on an empty
string.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2014-08-03 18:46:32 +10:00
Andrew Gregory e8de265f80 move _alpm_lstat into util-common
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2014-08-03 18:46:32 +10:00
Andrew Gregory e0a7682607 use monotonic clock for progress updates
gettimeofday is susceptible to backwards system time adjustments,
skewing or altogether breaking progress output.  For the sake of
platforms that lack clock_gettime support, gettimeofday is retained as
a fallback.

Fixes FS#36983

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-06-29 11:14:42 +10:00
Dave Reisner 357b9a24a9 cache terminal size, add SIGWINCH handler to reset
Refactoring getcols, yet again. We do the following:

1) Introduce a static global in src/pacman/util.c
2) getcols always prefers this cached value, but will derive it from
the COLUMNS environment var, the characteristics of stdout, or a sane
default (in that order).
3) Introduce a SIGWINCH signal handler to reset the cached value,
meaning we only call ioctl when we don't know the value.

On my machine, pacman -Syy goes from ~4300 ioctl calls to 3.
2014-06-29 11:04:17 +10:00
Allan McRae 07647d3d43 Revert refactoring in fa0c1e14
This will cause the code to break as soon as we handle another signal such
as SIGWINCH...

Signed-off-by: Allan McRae <allan@archlinux.org>
2014-06-29 10:59:46 +10:00
Silvan Jegen fa0c1e1419 pacman: Correct signal handler comment and refactor
One of the comments for this function is out of sync with the code.
Since the code exhibits the more sane behavior of treating SIGINT and
SIGHUB the same way (by not exiting pacman when there is a commit in
flight) we adjust the comment.

Given this code flow, the if/else statements can be simplified somewhat
as well.

Signed-off-by: Silvan Jegen <s.jegen@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-06-24 15:53:18 +10:00
Olivier Brunel 8dbb80cfe9 events: Make alpm_event_t an union of all event-specific struct
Signed-off-by: Olivier Brunel <jjk@jjacky.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-06-24 13:57:18 +10:00
Olivier Brunel f1fadecfb3 Update the question callback
Much like with events, instead of using a bunch of void* arguments for
all questions, we now send one pointer to an alpm_question_t union.
This contains the type of question that was triggered.

With this information, a question-specific struct can be accessed in
order to get additional arguments.

Signed-off-by: Olivier Brunel <jjk@jjacky.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-06-24 13:52:15 +10:00
Hong Shick Pak 7b41952bfc Move break to a new line for consistency
This was the only break that didn't have its own line in the function
parsearg_query.

Signed-off-by: Hong Shick Pak <hong@hspak.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-06-23 22:35:21 +10:00
Allan McRae 4d65332ccd Clarify that -Ql prints a file list
FS#40234

Signed-off-by: Allan McRae <allan@archlinux.org>
2014-05-25 14:38:35 +10:00
Florian Pritz b929e74f2e util: Use off_t instead of int for size values
Old output:
> Total Installed Size:  -1527.44 MiB

Fixed:
> Total Installed Size:  2568.56 MiB

Bug introduced in 7b8f8753b1.

Signed-off-by: Florian Pritz <bluewind@xinu.at>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-05-22 15:50:20 +10:00
Andrew Gregory 060d06d2f7 remove.c: downgrade TRANS_DUP_TARGET to warning
Matches the behavior for sync packages.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-05-07 14:14:41 +10:00
Dave Reisner 5293d57840 strtrim: reset pointer after trimming leading whitespace
Breakage introduced in 92216c5864 when we changed the signature
of strtrim to return something more useful.

Fixes FS#39976.

Signed-off-by: Allan McRae <allan@archlinux.org>
2014-04-21 20:25:45 +10:00
Andrew Gregory b26432dbdb conf.c: remove extra indentation
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-03-27 15:16:52 +10:00
Andrew Gregory b0dc547fcb check config_new return value
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-03-27 15:16:52 +10:00
Sören Brinkmann fb8437b588 pacman/upgrade: Fix memory leaks
Make sure allocated memory is freed before returning.

Signed-off-by: Sören Brinkmann <soeren.brinkmann@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-03-27 15:16:52 +10:00
Sören Brinkmann fcf0cefd1a pacman/upgrade: Refactor memory management
Refactor the upgrade routine to use an array that can be allocated in
one step instead of an alpm_list that is gradually extended in loops.

Signed-off-by: Sören Brinkmann <soeren.brinkmann@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-03-27 15:16:50 +10:00
Sören Brinkmann 3ebb7b94d9 pacman/upgrade: Check malloc() return value
Check the return value of malloc() before dereferencing the returned pointer.

Signed-off-by: Sören Brinkmann <soeren.brinkmann@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-03-16 13:43:33 +10:00
Andrew Gregory f3a280bc67 remove check for unused ALPM_ERR_PKG_IGNORED
alpm_add_pkg does not ignore packages.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-03-04 14:04:29 +10:00
Andrew Gregory 2e9602716c simplify check for leading "local/"
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-03-04 13:59:46 +10:00
Allan McRae b2488eb356 Fix warnings with strict-overflow in gcc-4.9
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-03-03 11:25:55 +10:00
Olivier Brunel cfaff6e0c1 Add events on pacnew/pacsave/pacorig file creation
ALPM still adds a warning to the log, but doesn't emit an event about
said warning, instead using a specific event to let the frontend what
happened/how to inform the user.

Note that there are 2 cases for installing a .pacnew file, to not
overwrite user changes and because file is in NoUpgrade. In the later case
the warning was a bit different: it happened before and said "extracting"
instead of "installed." Now both happen after and are phrased the same.

Signed-off-by: Olivier Brunel <jjk@jjacky.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-03-03 11:25:55 +10:00
Olivier Brunel bd3d1a17c2 Add events _PKGDOWNLOAD_{START, DONE, FAILED}
These will be emmitted when download a package file from a repository,
indicating that the download starts, and whether it was successfull or
not.

Note that when multiple servers are available, no event is emmitted when
switching to another server.

(This doesn't apply to alpm_fetch_pkgurl(), but since it is called by
the frontend, it shouldn't have problems knowing when the download
starts and when it ends.)

Signed-off-by: Olivier Brunel <jjk@jjacky.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-03-03 11:25:54 +10:00
Olivier Brunel 01cc55a1f4 Add events ALPM_EVENT_RETRIEVE_{DONE, FAILED}
To go along with RETRIEVE_START, one other event will be emmitted once
the downloads are done: RETRIEVE_DONE if all files were successfully
downloaded, else RETRIEVE_FAILED.

Signed-off-by: Olivier Brunel <jjk@jjacky.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-03-03 11:25:54 +10:00
Olivier Brunel cd793c5ab7 Remove log_cb, add ALPM_EVENT_LOG instead
When ALPM emits a log message, it still goes through _alpm_log() but
instead of calling a specific log callback, it goes as an event.

Signed-off-by: Olivier Brunel <jjk@jjacky.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-03-03 11:25:54 +10:00
Olivier Brunel 28dbd5551e Update the event callback
Instead of using two void* arguments for all events, we now send one
pointer to an alpm_event_t struct. This contains the type of event that
was triggered.

With this information, the pointer can then be typecasted to the
event-specific struct in order to get additional arguments.

Signed-off-by: Olivier Brunel <jjk@jjacky.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-03-03 11:25:54 +10:00
Pierre Neidhardt 0deeb9991c pactree: removed 'provision' from linear output
Linear output is especially useful when piped to other commands, e.g.

  $ pactree -lu pacman | pacman -Qqkk -

The above command would previously show errors on packages with provisions.

Signed-off-by: Pierre Neidhardt <ambrevar@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-02-04 14:21:07 +10:00
Andrew Gregory b9601b1e59 alpm: export *_free functions
Front-ends should be able to free memory that alpm hands them.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-02-04 13:48:37 +10:00
Allan McRae 1601532a53 Give groups display text singular and plural forms
Reported on transifex

Signed-off-by: Allan McRae <allan@archlinux.org>
2014-02-04 09:01:38 +10:00
Rafael Ferreira 236f1795e9 Do not remove source code references in PO/POT files
FS#34240.  This is useful for translators and has little cost to us since
we moved to transifex for translations.

Signed-off-by: Allan McRae <allan@archlinux.org>
2014-02-02 16:32:55 +10:00
Andrew Gregory aa4d3298fb table_display: free memory on errors
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-01-30 14:22:27 +10:00
Andrew Gregory 4d68092e2f dump_pkg_full: fix optionalfor memory leak
alpm_pkg_compute_optional returns a generated list that needs to be
free'd.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-01-30 13:46:58 +10:00
Silvan Jegen 819b4cd54e Move NULL check before dereference
Signed-off-by: Silvan Jegen <s.jegen@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-01-30 13:40:25 +10:00
Silvan Jegen 77da9dc974 Another NULL check removed
Signed-off-by: Silvan Jegen <s.jegen@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-01-30 13:40:25 +10:00
Silvan Jegen cb8eae24c9 Another unneeded NULL check removed
Signed-off-by: Silvan Jegen <s.jegen@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-01-30 13:40:25 +10:00
Silvan Jegen d895cae16c Remove unneeded NULL check
Signed-off-by: Silvan Jegen <s.jegen@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-01-30 13:40:24 +10:00
Andrew Gregory aabb7c3cdd pacman: use exit status 0 for --help and --version
The user requesting usage or version information is not an error.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-01-30 13:12:00 +10:00
Andrew Gregory 333373f90e enable_colors: always set color strings
Only setting color strings when colors is true allowed subsequent
calls to enable colors but not disable them.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-01-28 20:52:46 +10:00
Florian Pritz cd2370754a Remove ts and sw from vim modeline when noet is set
Forcing vim users to view files with a tabstop of 2 seems really
unnecessary when noet is set. I find it much easier to read code with
ts=4 and I dislike having to override the modeline by hand.

Command run:
find . -type f -exec sed -i '/vim.* noet/s# ts=2 sw=2##' {} +

Signed-off-by: Florian Pritz <bluewind@xinu.at>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-01-28 20:19:25 +10:00
Andrew Gregory e6464f0cb6 pacman.c: free string commandline options
Plugs a memory leak when values were passed twice.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-01-28 20:10:49 +10:00