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

2532 Commits

Author SHA1 Message Date
Allan McRae
60d958c78b Initialize memory to prevent issues when freeing on error
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-12-27 17:08:32 +10:00
Allan McRae
be4198b34e _alpm_recursedeps: free memory on error
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-12-27 17:08:32 +10:00
Allan McRae
32413213cb apply_deltas: fix memory leak on error
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-12-27 17:08:32 +10:00
Allan McRae
25b492aab6 Merge branch 'maint' 2014-12-27 17:07:04 +10:00
Allan McRae
5221440b6b fix duplication of package sha256sum
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-12-27 17:04:53 +10:00
Johannes Löthberg
1f1e53c208 libalpm: Add accessors for the base field
This commit adds the necessary accessor functions to get the PKGBASE of
a package, forcing the desc file to be parsed.

Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-12-24 11:19:30 +10:00
Johannes Löthberg
9f527d2de4 libalpm: Parse and write PKGBASEs
This commit adds support to libalpm to parse the pkgbase present in
packages .PKGINFO files, writing the PKGBASE to the %BASE% section of
the local DBs desc files and for parsing it again when loading the local
DB

Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-12-24 11:19:30 +10:00
Allan McRae
21faf1682e mount_point_list: free memory on error
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-12-24 11:19:30 +10:00
Allan McRae
2114ef1874 conflict_new: free memory on error
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-12-24 11:19:30 +10:00
Allan McRae
9cf1b2c004 _alpm_runscriptlet: free memory on error
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-12-24 11:19:30 +10:00
Allan McRae
88eedef6c6 add_fileconflict: free memory on error
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-12-24 11:19:30 +10:00
Allan McRae
52d2ff648d create_tempfile: fix memory leak on error
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-12-24 11:19:30 +10:00
Allan McRae
123ecb8e07 _alpm_split_backup: free memory on error
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-12-24 11:19:29 +10:00
Allan McRae
c6dd581ec5 alpm_dep_from_string: free memory on error
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-12-24 11:19:29 +10:00
Allan McRae
27506aba8f _alpm_conflict_dup: fix memory leak on error
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-12-24 11:19:29 +10:00
Allan McRae
46459da39b local_db_read: fix memory leak on error
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-12-24 11:19:29 +10:00
Allan McRae
895780bd9a _alpm_db_new: free memory on error
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-12-24 11:19:29 +10:00
Allan McRae
87e55a4ee7 _alpm_db_get_pkgcache_hash: check for error when loading pkgcache
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-12-24 11:19:29 +10:00
Allan McRae
cd5e4b89f4 _alpm_delta_parse: free memory on error
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-12-24 11:19:29 +10:00
Allan McRae
e892234207 _alpm_dep_dup: free memory on error
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-12-24 11:19:29 +10:00
Allan McRae
c0d9d26070 build_payload: free memory on error
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-12-24 11:19:29 +10:00
Allan McRae
32ebd7ad5d depmiss_new: free memory on error
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-12-24 11:19:29 +10:00
Allan McRae
bf06efaa78 _alpm_delta_dup: free memory on error
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-12-24 11:19:28 +10:00
Evangelos Foutras
c07593c64c Use correct mode bits for the log file (0000 -> 0644)
Following commit 086bbc5 (Use O_CLOEXEC as much as possible when opening
files), the log file would be created by pacman with blank permissions.

Signed-off-by: Allan McRae <allan@archlinux.org>
2014-12-24 11:15:25 +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
Andrew Gregory
3af0268fdb remove.c: honor inverted patterns in noupgrade
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-12-18 22:22:35 +10:00
Andrew Gregory
df36fe2e79 add alpm_option_match_noupgrade
For parity with alpm_option_match_noextract.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-12-18 22:22:35 +10:00
Dave Reisner
ef0577e3d5 version: fix memory leak in early return
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-11-19 14:14:04 +10:00
Allan McRae
3446453c72 Fix translation error and remove empty po files
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-11-19 14:13:15 +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
96e9cf35f1 Add alpm_option_match_noextract
This is useful for frontends testing whether a file is in NoExtract

Signed-off-by: Allan McRae <allan@archlinux.org>
2014-11-18 12:31:30 +10:00
Allan McRae
5d11605958 extract_single_file: fix memory leak in error condition
The memory assigned to checkfile was leaked in the error condition.

Signed-off-by: Allan McRae <allan@archlinux.org>
2014-11-18 11:58:26 +10:00
Allan McRae
5d618438c4 _alpm_backup_dup: fix memory leak in error case
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-11-18 11:58:26 +10:00
Allan McRae
d9aa7025ea Remove logging of NoExtract events
With globbing in NoExtract, these log events can quickly pile up hiding
important information from the log.

Signed-off-by: Allan McRae <allan@archlinux.org>
2014-11-18 11:58:25 +10:00
Allan McRae
8c00dd7341 Fix crash when using external downloader
Commit 9d96bed9 attempts to use the same effective URL for the db and its
signature download.  However, this information is not available when we use
an external downloader, resulting in a crash.

Fall back to the old method when the effective URL is unavailable.

Signed-off-by: Allan McRae <allan@archlinux.org>
2014-11-17 17:13:48 +10:00
Christian Hesse
d649dc669d dload: mark final_url as const
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-10-19 20:48:40 +10:00
Christian Hesse
d8f395fb56 dload: unlink file on filesize exceeded error
On filesize exceeded error pacman leaves a .part file in cache dir,
resulting in this error on next try:

error: failed to commit transaction (wrong or NULL argument passed)
Errors occurred, no packages were upgraded.

Unlink the file on error to avoid this.
2014-10-16 23:19:52 +10:00
Christian Hesse
11dff8a50e dload: use better error message on exceeded file size
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-10-16 23:19:52 +10:00
Christian Hesse
9d96bed9d6 be_sync: use effective URL for db file signature download
If download server is dynamic mirror chances are that db file download
and db file signature download are redirected to different mirrors,
resulting in invalid signature.
This uses effective URL for db file signature download and makes the
files always match.

Signed-off-by: Christian Hesse <mail@eworm.de>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-10-16 22:45:47 +10:00
Andrew Gregory
c1d6cec2e2 sync.c: download packages before starting commit
download_files sets the transaction state to STATE_DOWNLOADING.
Modifying the state after it has already been set to STATE_COMMITTING
created a brief window where SIGINT would fail to interrupt the process
and caused interrupted downloads to result in a 'transaction started'
message in the log with no matching transaction end.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2014-10-13 14:28:29 +10:00
Olivier Brunel
1e3c088c2e alpm: Fix wrong xferred/total sizes when resuming downloads
When a package is already partially downloaded in the cache, its download
size will only be of what's left to be downloaded. Since pkg->download_size
is what's used when calculating the total download size for the totaldl
callback, same thing apply.

However, the download progress callback was including this initial size,
which would thus lead to invalid values (and percentage) used in frontends.
That is, the progress bar could e.g. go further than 100%

In the case of pacman, there is a sanity check for different historical
reason (44a57c89), so before the possible "overflow" was noticed, the total
download size/progress reported was wrong. Once caught, the TotalDownload
option was ignored and it would use individual file download values as
fallback instead.

Signed-off-by: Olivier Brunel <jjk@jjacky.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-10-02 22:50:17 +10:00
Andrew Gregory
7ee01c8666 _alpm_key_in_keychain: cache known keys
Implements FS#38042

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2014-10-01 09:12:54 +10:00
Andrew Gregory
aec4241af2 check_keyring: skip keys known to be missing
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2014-10-01 09:10:08 +10:00
Andrew Gregory
e123e04741 remove retry check from signature validation
The retry path was removed by
4ccf16dff5

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2014-10-01 09:03:31 +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
Florian Pritz
4e263f24c6 libalpm: export alpm_splitdep as alpm_dep_from_depstring and alpm_dep_free
Signed-off-by: Florian Pritz <bluewind@xinu.at>
2014-09-30 22:20:53 +10:00
Florian Pritz
13c9745302 deps.c: split _alpm_depcmp into _alpm_depcmp_provides
This allows to reuse the provision checker for a simple list of
provisions without a package.

Signed-off-by: Florian Pritz <bluewind@xinu.at>
2014-09-30 22:07:11 +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
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
f0c351b3fa alpm.h: remove outdated pkg_get_backup doxygen
alpm_pkg_get_backup hasn't returned strings since
54ef162a1a in 2011.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-09-23 21:43:16 +10:00
Allan McRae
d02efd2f20 Check the version of the local database during validation
When we check the database version directly, there is no longer a
need to scan for depends files.

Signed-off-by: Allan McRae <allan@archlinux.org>
2014-09-23 21:43:05 +10:00
Allan McRae
1660ed3cf9 Add version file to empty local database
If a user manually creates the local database directory, or has an empty
local database for some other reason, we silently add a version file

Signed-off-by: Allan McRae <allan@archlinux.org>
2014-09-23 21:27:11 +10:00
Allan McRae
7e9ad22ac2 Add version file when creating local database directory
The version of the local pacman database is stored in its root in the file
ALPM_DB_VERSION.  The version is starting at 9, corresponding to the
next libalpm library version.

Signed-off-by: Allan McRae <allan@archlinux.org>
2014-09-23 21:26:55 +10:00
Allan McRae
d3f5ab0e70 Create local database directory if it is missing
This means that a missing local database becomes an error (as it
should be immediately created).  Note this only creates the "local"
directory and not its parent, which is checked for during locking.

Signed-off-by: Allan McRae <allan@archlinux.org>
2014-09-23 21:25:45 +10:00
Andrew Gregory
8bf2c753f5 fix improper FREELIST calls
* conflicts need to be freed with alpm_conflict_free
* sync dbs need to be unregistered and are handled by alpm_release

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-09-16 20:03:33 +10:00
Olivier Brunel
99a5017f55 Fix loading invalid package
In 5acfa65f when adding a new variable (hit_mtree), the initialization of a
variable (config) was dropped, which could lead to loading invalid package
files, i.e. files that aren't archive (no metadata loaded) would return a new
alpm_pkg_t with everything set to 0/NULL.

Depending on the operation/use of the package, this could lead to segfault.

Signed-off-by: Olivier Brunel <jjk@jjacky.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-08-09 14:08:41 +10:00
Andrew Gregory
574e45df28 trans_commit: log beginning and end of transaction
This makes it clear whether a transaction successfully completed and
allows log parsers to group related actions.

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
Ryo Munakata
7c75564af9 filecache_find_url: dereference the 'filebase' pointer
Signed-off-by: Ryo Munakata <ryomnktml@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-08-04 14:23:58 +10:00
Andrew Gregory
2025279eb6 replace strdup with STRDUP
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
0bf4ae726d handle_unlock: log error when lock file is missing
Problems due to concurrent running instances of pacman can be difficult
to diagnose.  Log a warning to make it more obvious that that's what
happened, that it's a bad idea, and hopefully encourage people who do
things like removing the lock file to run pacman from an install script
to at least be courteous enough to put it back when they're done.

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
03b9bf08ac handle_unlock: log lock removal failure
Rather than have individual callers log failure, just
do it directly in _alpm_handle_unlock.

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
7f1360b440 signing.c: remove useless error check
CHECK_ERR checks gpg_err which is a local variable.  Calling
gpg_op_import_result cannot modify it.

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
f4992960ad deps.c: use alpm_list_find_ptr
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
0c43198ee0 dep_graph_init: filter ignored packages by name
Ignored packages are from the transaction remove list which consists of
duplicated packages so a direct pointer comparison is not appropriate.

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
32413ad44b handle: factor out string list option handling
Consolidates repeated code and replaces dangerous
strdup calls with STRDUP.

Also fix a couple variables named "pkg" that
refer to file paths.

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
9506409c3f sync_prepare: remove useless check for replacers
Since 017184fa, alpm_sync_sysupgrade will not add both a replacement and
a literal upgrade to the transaction.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
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
0e18cefe38 filelist_intersection: manually compare paths
Prevents the need to modify paths, removing strndup as an unchecked
point of failure, and lengths only need to be calculated if the paths
match.

Also removed an old comment regarding directory/symlink compatibility.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-08-03 18:46:31 +10:00
Christian Hesse
e05fd5e060 libalpm: check for valid public key algorithm 2014-06-29 11:12:36 +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
Olivier Brunel
d06d993d56 alpm.h: Move alpm_errno_t definition up
Because for the new question types, we'll need to use alpm_errno_t let's
move its definition up.

Of course to do so, we also need to move that of alpm_handle_t as well, so move
all opaque structures on top.

Signed-off-by: Olivier Brunel <jjk@jjacky.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-06-24 13:44:51 +10:00
Allan McRae
b9f98ae97c Add compatibility with gpgme-1.5.0
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-06-02 10:31:25 +10:00
Dave Reisner
7a5e41925f dload: avoid using CURLOPT_FAILONERROR
Use of this flag causes connections to be closed on 404s -- a common
occurrence when your config sets DatabaseOptional. Handle the error
gracefully, so that the connection can be reused.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-05-22 15:52:22 +10:00
Andrew Gregory
dd694f433b register_syncdb: reject db names that contain /
alpm downloads databases based on basename causing [foo] and [bar/foo]
to silently overwrite each other.

Also remove an extra tab

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-05-04 16:14:44 +10:00
Allan McRae
ee72c016ab Always supply base name and version info in .PKGFILE if needed
Provide pkgbase information for non-split packages with pkgbase set.
Also record the version of the "base" package.  This is useful for
matching package files to source packages.

Signed-off-by: Allan McRae <allan@archlinux.org>
2014-03-27 15:24:22 +10:00
Allan McRae
ffdc2c5396 Use MALLOC throughtout libalpm
Use MALLOC instead of malloc for safety in libalpm.  Some changes are pure
refactoring, but for others this provides a success check for memory
allocation.

Signed-off-by: Allan McRae <allan@archlinux.org>
2014-03-08 16:58:30 +10:00
Andrew Gregory
2330a64589 sync_prepare: ignore explicitly removed conflicts
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-03-04 13:57:02 +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
Andrew Gregory
9bfd6ff275 restrict transaction package origins
This moves the "wrong args" error up from trans_commit to add_pkg when
used with a local pkg and adds the error for remove_pkg when used with
a sync pkg, which currently just removes the db entry.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-03-03 11:25:54 +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
Florian Pritz
b6f6a165c4 be_local: Use alpm_greedy_grow
Signed-off-by: Florian Pritz <bluewind@xinu.at>
2014-03-03 11:25:54 +10:00
Florian Pritz
5acfa65ffb be_package: Build the file list from MTREE if possible
This greatly speeds up file list generation times by avoiding
uncompressing the whole package.

pacman -S base with a deliberate file conflict:
before: 9.1 seconds
after:  2.2 seconds

Signed-off-by: Florian Pritz <bluewind@xinu.at>
2014-03-03 11:25:54 +10:00
Florian Pritz
8e60adc916 be_package: Refactor code adding a file to the files list
Signed-off-by: Florian Pritz <bluewind@xinu.at>
2014-03-03 11:25:54 +10:00
Florian Pritz
11fb1d30f4 be_package: Refactor handling of simple path checks
This is used to deduplicate code when using the mtree as the file list
source.

Signed-off-by: Florian Pritz <bluewind@xinu.at>
2014-03-03 11:25:54 +10:00
Florian Pritz
42f4a5081e util: Add _alpm_realloc() and _alpm_greedy_grow()
These will be used in the following patches.

Signed-off-by: Florian Pritz <bluewind@xinu.at>
2014-03-03 11:25:54 +10:00
Florian Pritz
f27fad9b89 Check if a file is in the package's file list before extracting
Signed-off-by: Florian Pritz <bluewind@xinu.at>
2014-03-03 11:25:54 +10:00
Andrew Gregory
a7da2a47c3 _alpm_sync_prepare: fix unresolvable packages leak
If the user opted not to remove the unresolvable packages from the
transaction, the list was neither free'd nor saved to the transaction to
be free'd in trans_release.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-02-08 09:55:35 +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
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
c2edd31eae _alpm_resolvedeps: free targ inside loop
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-01-30 14:12:06 +10:00
Andrew Gregory
fac9ac6c40 sync_prepare: manually set pm_errno
_alpm_resolvedeps resets pm_errno to 0 by calling alpm_checkdeps.
Whenever the last call succeeded, pm_errno was not properly set,
preventing pacman from properly handling the error and leaking
additional memory.  We know pm_errno should be ALPM_ERR_UNSATISFIED_DEPS
if resolvedeps has failed, so just set it manually.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-01-30 14:02:31 +10:00
Andrew Gregory
6be08f76f6 local_db_populate: initialize empty pkgcache
If the db directory did not exist when local_db_populate was called, the
pkgcache wouldn't be initialized, causing pkghash_add_pkg to fail.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-01-30 13:45:53 +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
Olivier Brunel
4e9d88aa05 Rename ALPM_EVENT_OPTDEP_REQUIRED to _OPTDEP_REMOVAL
Because this event is triggered when an optdepend for another package is
being removed.

Signed-off-by: Olivier Brunel <jjk@jjacky.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-01-28 20:10:49 +10:00