Merge branch 'maint'
Conflicts: lib/libalpm/be_sync.c lib/libalpm/db.c src/pacman/util.c
This commit is contained in:
commit
c5addd94e3
9 changed files with 52 additions and 27 deletions
|
@ -405,7 +405,7 @@ static int local_db_populate(pmdb_t *db)
|
|||
* http://kerneltrap.org/mailarchive/linux-btrfs/2010/1/23/6723483/thread
|
||||
*/
|
||||
est_count = 0;
|
||||
while((ent = readdir(dbdir)) != NULL) {
|
||||
while(readdir(dbdir) != NULL) {
|
||||
est_count++;
|
||||
}
|
||||
rewinddir(dbdir);
|
||||
|
|
|
@ -236,9 +236,11 @@ static size_t estimate_package_count(struct stat *st, struct archive *archive)
|
|||
case ARCHIVE_COMPRESSION_XZ:
|
||||
per_package = 143;
|
||||
break;
|
||||
#ifdef ARCHIVE_COMPRESSION_UU
|
||||
case ARCHIVE_COMPRESSION_UU:
|
||||
per_package = 3543;
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
/* assume it is at least somewhat compressed */
|
||||
per_package = 200;
|
||||
|
@ -248,6 +250,7 @@ static size_t estimate_package_count(struct stat *st, struct archive *archive)
|
|||
|
||||
static int sync_db_populate(pmdb_t *db)
|
||||
{
|
||||
const char *dbpath;
|
||||
size_t est_count;
|
||||
int count = 0;
|
||||
struct stat buf;
|
||||
|
@ -265,14 +268,22 @@ static int sync_db_populate(pmdb_t *db)
|
|||
archive_read_support_compression_all(archive);
|
||||
archive_read_support_format_all(archive);
|
||||
|
||||
if(archive_read_open_filename(archive, _alpm_db_path(db),
|
||||
dbpath = _alpm_db_path(db);
|
||||
if(!dbpath) {
|
||||
/* pm_errno set in _alpm_db_path() */
|
||||
return 1;
|
||||
}
|
||||
|
||||
_alpm_log(PM_LOG_DEBUG, "opening database archive %s\n", dbpath);
|
||||
|
||||
if(archive_read_open_filename(archive, dbpath,
|
||||
ARCHIVE_DEFAULT_BYTES_PER_BLOCK) != ARCHIVE_OK) {
|
||||
_alpm_log(PM_LOG_ERROR, _("could not open file %s: %s\n"), _alpm_db_path(db),
|
||||
_alpm_log(PM_LOG_ERROR, _("could not open file %s: %s\n"), dbpath,
|
||||
archive_error_string(archive));
|
||||
archive_read_finish(archive);
|
||||
RET_ERR(PM_ERR_DB_OPEN, 1);
|
||||
}
|
||||
if(stat(_alpm_db_path(db), &buf) != 0) {
|
||||
if(stat(dbpath, &buf) != 0) {
|
||||
RET_ERR(PM_ERR_DB_OPEN, 1);
|
||||
}
|
||||
est_count = estimate_package_count(&buf, archive);
|
||||
|
|
|
@ -337,7 +337,7 @@ int SYMEXPORT alpm_db_set_pkgreason(pmdb_t *db, const char *name, pmpkgreason_t
|
|||
pkg->reason = reason;
|
||||
/* write DESC */
|
||||
if(_alpm_local_db_write(db, pkg, INFRQ_DESC)) {
|
||||
return -1;
|
||||
RET_ERR(PM_ERR_DB_WRITE, -1);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -124,6 +124,10 @@ static alpm_list_t *_pkg_get_deltas(pmpkg_t *pkg) { return pkg->deltas; }
|
|||
static alpm_list_t *_pkg_get_files(pmpkg_t *pkg) { return pkg->files; }
|
||||
static alpm_list_t *_pkg_get_backup(pmpkg_t *pkg) { return pkg->backup; }
|
||||
|
||||
static void *_pkg_changelog_open(pmpkg_t *pkg) { return NULL; }
|
||||
static size_t _pkg_changelog_read(void *ptr, size_t size, const pmpkg_t *pkg, const void *fp) { return 0; }
|
||||
static int _pkg_changelog_close(const pmpkg_t *pkg, void *fp) { return EOF; }
|
||||
|
||||
/** The standard package operations struct. Get fields directly from the
|
||||
* struct itself with no abstraction layer or any type of lazy loading.
|
||||
*/
|
||||
|
@ -142,6 +146,7 @@ struct pkg_operations default_pkg_ops = {
|
|||
.get_isize = _pkg_get_isize,
|
||||
.get_reason = _pkg_get_reason,
|
||||
.has_scriptlet = _pkg_has_scriptlet,
|
||||
|
||||
.get_licenses = _pkg_get_licenses,
|
||||
.get_groups = _pkg_get_groups,
|
||||
.get_depends = _pkg_get_depends,
|
||||
|
@ -152,6 +157,10 @@ struct pkg_operations default_pkg_ops = {
|
|||
.get_deltas = _pkg_get_deltas,
|
||||
.get_files = _pkg_get_files,
|
||||
.get_backup = _pkg_get_backup,
|
||||
|
||||
.changelog_open = _pkg_changelog_open,
|
||||
.changelog_read = _pkg_changelog_read,
|
||||
.changelog_close = _pkg_changelog_close,
|
||||
};
|
||||
|
||||
/* Public functions for getting package information. These functions
|
||||
|
|
|
@ -84,12 +84,11 @@ pmpkghash_t *_alpm_pkghash_create(size_t size)
|
|||
static size_t get_hash_position(unsigned long name_hash, pmpkghash_t *hash)
|
||||
{
|
||||
size_t position;
|
||||
alpm_list_t *ptr;
|
||||
|
||||
position = name_hash % hash->buckets;
|
||||
|
||||
/* collision resolution using open addressing with linear probing */
|
||||
while((ptr = hash->hash_table[position]) != NULL) {
|
||||
while(hash->hash_table[position] != NULL) {
|
||||
position = (position + 1) % hash->buckets;
|
||||
}
|
||||
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
#include <time.h>
|
||||
#include <syslog.h>
|
||||
#include <errno.h>
|
||||
#include <limits.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/wait.h>
|
||||
|
|
|
@ -287,11 +287,10 @@ check_buildenv() {
|
|||
# ? - not found
|
||||
##
|
||||
in_opt_array() {
|
||||
local needle=$(tr '[:upper:]' '[:lower:]' <<< $1); shift
|
||||
local needle=$1; shift
|
||||
|
||||
local opt
|
||||
for opt in "$@"; do
|
||||
opt=$(tr '[:upper:]' '[:lower:]' <<< $opt)
|
||||
if [[ $opt = $needle ]]; then
|
||||
echo 'y' # Enabled
|
||||
return
|
||||
|
@ -579,7 +578,6 @@ generate_checksums() {
|
|||
|
||||
local integ
|
||||
for integ in ${integlist[@]}; do
|
||||
integ=$(tr '[:upper:]' '[:lower:]' <<< "$integ")
|
||||
case "$integ" in
|
||||
md5|sha1|sha256|sha384|sha512) : ;;
|
||||
*)
|
||||
|
@ -1040,13 +1038,12 @@ create_package() {
|
|||
local comp_files=".PKGINFO"
|
||||
|
||||
# check for changelog/install files
|
||||
for i in 'changelog' 'install'; do
|
||||
orig=${!i}
|
||||
dest=$(tr '[:lower:]' '[:upper:]' <<<".$i")
|
||||
for i in 'changelog/.CHANGELOG' 'install/.INSTALL'; do
|
||||
IFS='/' read -r orig dest <<< "$i"
|
||||
|
||||
if [[ -n $orig ]]; then
|
||||
msg2 "$(gettext "Adding %s file...")" "$i"
|
||||
cp "$startdir/$orig" "$dest"
|
||||
if [[ -n ${!orig} ]]; then
|
||||
msg2 "$(gettext "Adding %s file...")" "$orig"
|
||||
cp "$startdir/${!orig}" "$dest"
|
||||
chmod 644 "$dest"
|
||||
comp_files+=" $dest"
|
||||
fi
|
||||
|
@ -1293,7 +1290,7 @@ check_sanity() {
|
|||
|
||||
local provides_list=()
|
||||
eval $(awk '/^[[:space:]]*provides=/,/\)/' "$BUILDFILE" | \
|
||||
sed -e "s/provides=/provides_list+=/" -e "s/#.*//")
|
||||
sed -e "s/provides=/provides_list+=/" -e "s/#.*//" -e 's/\\$//')
|
||||
for i in ${provides_list[@]}; do
|
||||
if [[ $i != ${i//</} || $i != ${i//>/} ]]; then
|
||||
error "$(gettext "Provides array cannot contain comparison (< or >) operators.")"
|
||||
|
@ -1303,7 +1300,7 @@ check_sanity() {
|
|||
|
||||
local backup_list=()
|
||||
eval $(awk '/^[[:space:]]*backup=/,/\)/' "$BUILDFILE" | \
|
||||
sed -e "s/backup=/backup_list+=/" -e "s/#.*//")
|
||||
sed -e "s/backup=/backup_list+=/" -e "s/#.*//" -e 's/\\$//')
|
||||
for i in "${backup_list[@]}"; do
|
||||
if [[ ${i:0:1} = "/" ]]; then
|
||||
error "$(gettext "Backup entry should not contain leading slash : %s")" "$i"
|
||||
|
@ -1312,8 +1309,8 @@ check_sanity() {
|
|||
done
|
||||
|
||||
local optdepends_list=()
|
||||
eval $(awk '/^[[:space:]]*optdepends=\(/,/\)[[:space:]]*(|#.*)$/' "$BUILDFILE" | \
|
||||
sed -e "s/optdepends=/optdepends_list+=/" -e "s/#.*//")
|
||||
eval $(awk '/^[[:space:]]*optdepends=\(/,/\)[[:space:]]*(#.*)?$/' "$BUILDFILE" | \
|
||||
sed -e "s/optdepends=/optdepends_list+=/" -e "s/#.*//" -e 's/\\$//')
|
||||
for i in "${optdepends_list[@]}"; do
|
||||
local pkg=${i%%:*}
|
||||
if [[ ! $pkg =~ ^[[:alnum:]\>\<\=\.\+\_\-]+$ ]]; then
|
||||
|
@ -1338,7 +1335,7 @@ check_sanity() {
|
|||
local valid_options=1
|
||||
local known kopt options_list
|
||||
eval $(awk '/^[[:space:]]*options=/,/\)/' "$BUILDFILE" | \
|
||||
sed -e "s/options=/options_list+=/" -e "s/#.*//")
|
||||
sed -e "s/options=/options_list+=/" -e "s/#.*//" -e 's/\\$//')
|
||||
for i in ${options_list[@]}; do
|
||||
known=0
|
||||
# check if option matches a known option or its inverse
|
||||
|
|
|
@ -761,8 +761,9 @@ static int multiselect_parse(char *array, int count, char *response)
|
|||
char *ends = NULL;
|
||||
char *starts = strtok_r(str, " ", &saveptr);
|
||||
|
||||
if (starts == NULL)
|
||||
if (starts == NULL) {
|
||||
break;
|
||||
}
|
||||
strtrim(starts);
|
||||
int len = strlen(starts);
|
||||
if(len == 0)
|
||||
|
@ -792,9 +793,11 @@ static int multiselect_parse(char *array, int count, char *response)
|
|||
if(!ends) {
|
||||
array[start-1] = include;
|
||||
} else {
|
||||
if(parseindex(ends, &end, start, count) != 0)
|
||||
int d;
|
||||
if(parseindex(ends, &end, start, count) != 0) {
|
||||
return -1;
|
||||
for(int d = start; d <= end; d++) {
|
||||
}
|
||||
for(d = start; d <= end; d++) {
|
||||
array[d-1] = include;
|
||||
}
|
||||
}
|
||||
|
@ -897,6 +900,10 @@ static int question(short preset, char *fmt, va_list args)
|
|||
stream = stderr;
|
||||
}
|
||||
|
||||
/* ensure all text makes it to the screen before we prompt the user */
|
||||
fflush(stdout);
|
||||
fflush(stderr);
|
||||
|
||||
vfprintf(stream, fmt, args);
|
||||
|
||||
if(preset) {
|
||||
|
@ -910,6 +917,7 @@ static int question(short preset, char *fmt, va_list args)
|
|||
return preset;
|
||||
}
|
||||
|
||||
fflush(stream);
|
||||
flush_term_input();
|
||||
|
||||
if(fgets(response, sizeof(response), stdin)) {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/bin/sh
|
||||
#!/bin/bash
|
||||
#
|
||||
# vercmptest - a test suite for the vercmp/libalpm program
|
||||
#
|
||||
|
|
Loading…
Add table
Reference in a new issue