libalpm
Arch Linux Package Manager Library
|
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <limits.h>
#include <archive.h>
#include <archive_entry.h>
#include "alpm_list.h"
#include "alpm.h"
#include "libarchive-compat.h"
#include "util.h"
#include "log.h"
#include "handle.h"
#include "package.h"
#include "deps.h"
#include "filelist.h"
Data Structures | |
struct | package_changelog |
Macros | |
#define | MAX_SIGFILE_SIZE 16384 |
Functions | |
static void * | _package_changelog_open (alpm_pkg_t *pkg) |
Open a package changelog for reading. | |
static size_t | _package_changelog_read (void *ptr, size_t size, const alpm_pkg_t UNUSED *pkg, void *fp) |
Read data from an open changelog 'file stream'. | |
static int | _package_changelog_close (const alpm_pkg_t UNUSED *pkg, void *fp) |
Close a package changelog for reading. | |
static const struct pkg_operations * | get_file_pkg_ops (void) |
Package file operations struct accessor. | |
static int | parse_descfile (alpm_handle_t *handle, struct archive *a, alpm_pkg_t *newpkg) |
Parses the package description file for a package into a alpm_pkg_t struct. | |
static int | handle_simple_path (alpm_pkg_t *pkg, const char *path) |
Handle the existence of simple paths for _alpm_load_pkg_internal() | |
static int | add_entry_to_files_list (alpm_filelist_t *filelist, size_t *files_size, struct archive_entry *entry, const char *path) |
Add a file to the files list for pkg. | |
static int | build_filelist_from_mtree (alpm_handle_t *handle, alpm_pkg_t *pkg, struct archive *archive) |
Generate a new file list from an mtree file and add it to the package. | |
static int | read_sigfile (const char *sigpath, unsigned char **sig) |
int | alpm_pkg_load (alpm_handle_t *handle, const char *filename, int full, int level, alpm_pkg_t **pkg) |
Create a package from a file. | |
#define MAX_SIGFILE_SIZE 16384 |
Referenced by read_sigfile().
|
static |
Close a package changelog for reading.
Similar to fclose in functionality, except that the 'file stream' is from an archive.
pkg | the package (file) that the changelog was read from |
fp | a 'file stream' to the package changelog |
References package_changelog::archive, and package_changelog::fd.
Referenced by get_file_pkg_ops().
|
static |
Open a package changelog for reading.
Similar to fopen in functionality, except that the returned 'file stream' is from an archive.
pkg | the package (file) to read the changelog |
References ALPM_ERR_MEMORY, ALPM_ERR_PKG_OPEN, package_changelog::archive, ASSERT, and package_changelog::fd.
Referenced by get_file_pkg_ops().
|
static |
Read data from an open changelog 'file stream'.
Similar to fread in functionality, this function takes a buffer and amount of data to read.
ptr | a buffer to fill with raw changelog data |
size | the size of the buffer |
pkg | the package that the changelog is being read from |
fp | a 'file stream' to the package changelog |
References ALPM_ERR_LIBARCHIVE, package_changelog::archive, and RET_ERR.
Referenced by get_file_pkg_ops().
|
static |
Add a file to the files list for pkg.
pkg | package to add the file to |
files_size | size of pkg->files.files |
entry | archive entry of the file to add to the list |
path | path of the file to be added |
References alpm_filelist_t::count, alpm_filelist_t::files, MALLOC, alpm_file_t::mode, alpm_file_t::name, alpm_file_t::size, and STRDUP.
Referenced by build_filelist_from_mtree().
|
static |
Generate a new file list from an mtree file and add it to the package.
An existing file list will be free()d first.
archive should point to an archive struct which is already at the position of the mtree's header.
handle | |
pkg | package to add the file list to |
archive | archive containing the mtree |
References _, add_entry_to_files_list(), ALPM_BUFFER_SIZE, ALPM_ERR_LIBARCHIVE, ALPM_LOG_DEBUG, alpm_filelist_t::count, error, alpm_filelist_t::files, GOTO_ERR, handle_simple_path(), alpm_file_t::name, and archive_read_buffer::ret.
|
static |
Package file operations struct accessor.
We implement this as a method because we want to reuse the majority of the default_pkg_ops struct and add only a few operations of our own on top.
References _package_changelog_close(), _package_changelog_open(), _package_changelog_read(), pkg_operations::changelog_close, pkg_operations::changelog_open, pkg_operations::changelog_read, and default_pkg_ops.
|
static |
Handle the existence of simple paths for _alpm_load_pkg_internal()
pkg | package to change |
path | path to examine |
Referenced by build_filelist_from_mtree().
|
static |
Parses the package description file for a package into a alpm_pkg_t struct.
archive | the archive to read from, pointed at the .PKGINFO entry |
newpkg | an empty alpm_pkg_t struct to fill with package info |
References _, alpm_dep_from_string(), alpm_list_add(), alpm_list_append(), ALPM_LOG_DEBUG, ALPM_LOG_WARNING, CALLOC, FREE, archive_read_buffer::line, archive_read_buffer::max_line_size, alpm_backup_t::name, archive_read_buffer::real_line_size, archive_read_buffer::ret, and STRDUP.
|
static |
References MALLOC, and MAX_SIGFILE_SIZE.
Referenced by alpm_pkg_load().