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

2569 Commits

Author SHA1 Message Date
Allan McRae
ff487212a2 Do not warn about downgrades when only downloading package
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-07-12 16:23:25 +10:00
David Macek
d5536d3eb3 libalpm: Do a sanity check before manipulating final DB URL
The change in commit 9d96bed9d6 causes download errors for the .db.sig file
in case the final URL for the .db file contains query strings or other
unexpected stuff. This commit isn't intended to be a total solution, but it
should eliminate the problem in the most obvious cases.

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-05-12 14:00:55 +10:00
David Macek
d568a4335b Fix comment in alpm_db_update
Fix comment to better explain the magic constant used when allocating a buffer
for ".db.sig" URL.

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-05-12 14:00:55 +10:00
Andrew Gregory
9a9e0203de alpm_logaction: implement documented return value
"return 0 on success, -1 on error (pm_errno is set accordingly)"

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-05-12 14:00:55 +10:00
Andrew Gregory
1545a04253 alpm_logaction: allow falling back to syslog
Even if opening the log file fails, if a user has enabled syslog we may
still be able to log to that.  Set the error return value and continue
instead of bailing out.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-05-12 14:00:54 +10:00
Andrew Gregory
e4af5e3c97 alpm_logaction: check logfile before opening
valgrind does not like calling open(NULL, ...).  This also makes the
return value 0 if logfile has not been set.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-05-12 14:00:54 +10:00
Andrew Gregory
ae7067440c merge _alpm_logaction into alpm_logaction
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-05-12 14:00:54 +10:00
Allan McRae
54067c390f Silence warning from clang
clang is wrong - dbfile is always used initialized in that function.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-05-12 14:00:54 +10:00
Andrew Gregory
e374e6829c close stdin before running install scripts
libalpm does not guarantee that script output will be presented to the
user or that stdin will be connected to a terminal.  Close stdin so that
scripts do not attempt to use it for user interaction.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-03-26 14:44:14 +10:00
Andrew Gregory
721b785e73 be_package: fallback to standard filelist loading
In order to work properly, loading the filelist from an mtree file
requires a libarchive patch that has not yet been included in an
official release.[1]  Under certain circumstances, an unpatched
libarchive may refuse to read the mtree file due to inconsistencies
between it and the user's file system.  In order to allow alpm to
recover in this situation, read the mtree data into a temporary filelist
that is only copied over to the package if the entire read is
successful.

[1] 661684170b

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-03-26 14:44:13 +10:00
Andrew Gregory
edeafcc988 add_entry_to_files_list: pass filelist directly
Allows entries to be added to arbitrary filelists not connected to
a package.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-03-26 14:44:13 +10:00
Andrew Gregory
156d41a186 remove: use strcmp for files in skip_remove
Paths from noupgrade, the transaction skip_remove, and package backup
lists were combined into a single list matched using fnmatch causing
paths with glob characters to match unrelated files.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-03-03 16:54:17 +10:00
Andrew Gregory
ba532bda6b sync_prepare: exclude removals from resolvedeps
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-03-03 16:54:17 +10:00
Allan McRae
8f92fe47a7 calculate_removed_size: ensure llstat succeeds
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-03-03 16:54:17 +10:00
Allan McRae
d9b5cb238d Abort of failure to add version file to empty local database
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-03-03 16:54:17 +10:00
Allan McRae
fc5be14dac parse_descfile: fix memory leak in error case
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
27e3125c8d Merge branch 'maint' 2015-02-12 13:33:20 +10:00
Allan McRae
ba869597fb Disable directory ownership warnings
There was a lot of confusion regarding these warnings, particularly for
packages that create users post_install and then chown the directories.

Signed-off-by: Allan McRae <allan@archlinux.org>
2015-02-12 13:25:44 +10:00
Andrew Gregory
0c9f4329f8 set package origin when adding to db cache
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-02-12 13:22:40 +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
Allan McRae
54c630f6ec Merge branch 'maint' 2015-02-01 21:18:31 +10:00
Andrew Gregory
841e531c51 trans_commit: restore pm_errno after updating log
If the call to alpm_logaction failed it would overwrite pm_errno,
leading to error messages unrelated to the actual reason the transaction
failed.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-02-01 21:13:11 +10:00
Andrew Gregory
5167160c0c extract_single_file: consolidate extraction logic
Also adds checks that the filename does not exceed PATH_MAX.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2015-01-21 14:27:47 +10:00
Andrew Gregory
ba0d225d93 extract_single_file: use .pacnew for check files
Prevents the need to rename the file if we end up keeping it and ensures
that pacnew files always reflect the most recent version by overwriting
stale copies.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2015-01-21 14:27:47 +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
a82a5cf3f7 extract_single_file: use full path in messages
If an error occurs the actual path being extracted is more useful than
the original path from the package file list.  The original path is
still used for checks that use it directly.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2015-01-21 14:27:47 +10:00
Andrew Gregory
4ba0561fe7 extract_single_file: factor out db file extraction
alpm's database files (.INSTALL, .MTREE, etc.) should be extracted no
matter what; skip mtree/needbackup/noextract/noupgrade checks for them.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2015-01-21 14:27:47 +10:00
Andrew Gregory
f917a4a55a extract_single_file: reduce indentation
Puts all of the conflict cases at the same level.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2015-01-21 14:27:47 +10:00
Andrew Gregory
63660afbc7 extract_single_file: consolidate needbackup checks
We need to know if a file needs to be backed up for all extracted files.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2015-01-21 14:27:47 +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
Allan McRae
92febc847c Merge branch 'maint' 2015-01-21 14:27:25 +10:00
Daniel Micay
c6263da168 fix geometric growth in _alpm_greedy_grow
It was allocating the required size rather than the calculated new size,
resulting in pathological incremental reallocations.

Signed-off-by: Daniel Micay <danielmicay@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-01-21 14:27:04 +10:00
Daniel Micay
21281e9b69 be_local: fix _alpm_greedy_grow usage
The files_size variable contains the current capacity (in bytes) and
should not be used to calculate the next length increment. It only works
because _alpm_greedy_grow currently results in incremental growth.

Signed-off-by: Daniel Micay <danielmicay@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-01-21 14:26:54 +10:00
Andrew Gregory
8da9be0955 initialize pointers passed to _alpm_pkg_dup
_alpm_pkg_dup leaves the destination pointer unaltered in case of fatal
errors, so when commits 2f0ca00e and be4198b3 freed the pointer, they
fixed a memory leak on non-fatal errors by replacing it with
a segmentation fault on fatal errors.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-01-02 21:48:59 +10:00
Andrew Gregory
4060c5c77f be_package.c: fix style violation
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-01-02 21:48:59 +10:00
Allan McRae
763fb3d9e7 Remove logically dead code in _alpm_local_db_write
We can only get to cleanup: through fp being NULL due to fopen failing or
normal execution when fclose is called.

Signed-off-by: Allan McRae <allan@archlinux.org>
2014-12-27 17:08:32 +10:00
Allan McRae
804688ab6a _alpm_run_chroot: only close working directory if it was opened
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-12-27 17:08:32 +10:00
Allan McRae
2f0ca00e55 _alpm_db_add_pkgincache: free potential memory leak
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-12-27 17:08:32 +10:00
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