forked from mirrors/pacman
Compare commits
9 Commits
v6.0.1
...
morganamil
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8b35654474 | ||
|
|
39c3cbdf56 | ||
|
|
165e492485 | ||
|
|
be76f8bf06 | ||
|
|
625f3d645b | ||
|
|
e187aa9b48 | ||
|
|
c5c6633dd1 | ||
|
|
2109de613a | ||
|
|
fbb29b5047 |
@@ -70,6 +70,8 @@ repo-add Options
|
|||||||
Remove old package files from the disk when updating their entry in the
|
Remove old package files from the disk when updating their entry in the
|
||||||
database.
|
database.
|
||||||
|
|
||||||
|
*\--include-sigs*::
|
||||||
|
Include package PGP signatures in the repository database (if available)
|
||||||
|
|
||||||
Example
|
Example
|
||||||
-------
|
-------
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ extern "C" {
|
|||||||
* This struct represents an instance of libalpm.
|
* This struct represents an instance of libalpm.
|
||||||
* @ingroup libalpm_handle
|
* @ingroup libalpm_handle
|
||||||
*/
|
*/
|
||||||
typedef struct __alpm_handle_t alpm_handle_t;
|
typedef struct _alpm_handle_t alpm_handle_t;
|
||||||
|
|
||||||
/** A database.
|
/** A database.
|
||||||
*
|
*
|
||||||
@@ -98,7 +98,7 @@ typedef struct __alpm_handle_t alpm_handle_t;
|
|||||||
* Databases are automatically unregistered when the \link alpm_handle_t \endlink is released.
|
* Databases are automatically unregistered when the \link alpm_handle_t \endlink is released.
|
||||||
* @ingroup libalpm_databases
|
* @ingroup libalpm_databases
|
||||||
*/
|
*/
|
||||||
typedef struct __alpm_db_t alpm_db_t;
|
typedef struct _alpm_db_t alpm_db_t;
|
||||||
|
|
||||||
|
|
||||||
/** A package.
|
/** A package.
|
||||||
@@ -111,13 +111,7 @@ typedef struct __alpm_db_t alpm_db_t;
|
|||||||
* to be added or removed from the system.
|
* to be added or removed from the system.
|
||||||
* @ingroup libalpm_packages
|
* @ingroup libalpm_packages
|
||||||
*/
|
*/
|
||||||
typedef struct __alpm_pkg_t alpm_pkg_t;
|
typedef struct _alpm_pkg_t alpm_pkg_t;
|
||||||
|
|
||||||
/** Transaction structure used internally by libalpm
|
|
||||||
* @ingroup libalpm_trans
|
|
||||||
* */
|
|
||||||
typedef struct __alpm_trans_t alpm_trans_t;
|
|
||||||
|
|
||||||
|
|
||||||
/** The time type used by libalpm. Represents a unix time stamp
|
/** The time type used by libalpm. Represents a unix time stamp
|
||||||
* @ingroup libalpm_misc */
|
* @ingroup libalpm_misc */
|
||||||
@@ -1080,8 +1074,10 @@ typedef struct _alpm_question_import_key_t {
|
|||||||
alpm_question_type_t type;
|
alpm_question_type_t type;
|
||||||
/** Answer: whether or not to import key */
|
/** Answer: whether or not to import key */
|
||||||
int import;
|
int import;
|
||||||
/** The key to import */
|
/** UID of the key to import */
|
||||||
alpm_pgpkey_t *key;
|
const char *uid;
|
||||||
|
/** Fingerprint the key to import */
|
||||||
|
const char *fingerprint;
|
||||||
} alpm_question_import_key_t;
|
} alpm_question_import_key_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -2719,7 +2715,8 @@ typedef enum _alpm_transflag_t {
|
|||||||
ALPM_TRANS_FLAG_RECURSE = (1 << 5),
|
ALPM_TRANS_FLAG_RECURSE = (1 << 5),
|
||||||
/** Modify database but do not commit changes to the filesystem. */
|
/** Modify database but do not commit changes to the filesystem. */
|
||||||
ALPM_TRANS_FLAG_DBONLY = (1 << 6),
|
ALPM_TRANS_FLAG_DBONLY = (1 << 6),
|
||||||
/* (1 << 7) flag can go here */
|
/** Do not run hooks during a transaction */
|
||||||
|
ALPM_TRANS_FLAG_NOHOOKS = (1 << 7),
|
||||||
/** Use ALPM_PKG_REASON_DEPEND when installing packages. */
|
/** Use ALPM_PKG_REASON_DEPEND when installing packages. */
|
||||||
ALPM_TRANS_FLAG_ALLDEPS = (1 << 8),
|
ALPM_TRANS_FLAG_ALLDEPS = (1 << 8),
|
||||||
/** Only download packages and do not actually install. */
|
/** Only download packages and do not actually install. */
|
||||||
|
|||||||
@@ -48,13 +48,13 @@ extern "C" {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/** A doubly linked list */
|
/** A doubly linked list */
|
||||||
typedef struct __alpm_list_t {
|
typedef struct _alpm_list_t {
|
||||||
/** data held by the list node */
|
/** data held by the list node */
|
||||||
void *data;
|
void *data;
|
||||||
/** pointer to the previous node */
|
/** pointer to the previous node */
|
||||||
struct __alpm_list_t *prev;
|
struct _alpm_list_t *prev;
|
||||||
/** pointer to the next node */
|
/** pointer to the next node */
|
||||||
struct __alpm_list_t *next;
|
struct _alpm_list_t *next;
|
||||||
} alpm_list_t;
|
} alpm_list_t;
|
||||||
|
|
||||||
/** Frees a list and its contents */
|
/** Frees a list and its contents */
|
||||||
|
|||||||
@@ -269,7 +269,6 @@ static alpm_list_t *add_fileconflict(alpm_handle_t *handle,
|
|||||||
STRDUP(conflict->file, filestr, goto error);
|
STRDUP(conflict->file, filestr, goto error);
|
||||||
if(!pkg2) {
|
if(!pkg2) {
|
||||||
conflict->type = ALPM_FILECONFLICT_FILESYSTEM;
|
conflict->type = ALPM_FILECONFLICT_FILESYSTEM;
|
||||||
STRDUP(conflict->ctarget, "", goto error);
|
|
||||||
} else if(pkg2->origin == ALPM_PKG_FROM_LOCALDB) {
|
} else if(pkg2->origin == ALPM_PKG_FROM_LOCALDB) {
|
||||||
conflict->type = ALPM_FILECONFLICT_FILESYSTEM;
|
conflict->type = ALPM_FILECONFLICT_FILESYSTEM;
|
||||||
STRDUP(conflict->ctarget, pkg2->name, goto error);
|
STRDUP(conflict->ctarget, pkg2->name, goto error);
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ struct db_operations {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/* Database */
|
/* Database */
|
||||||
struct __alpm_db_t {
|
struct _alpm_db_t {
|
||||||
alpm_handle_t *handle;
|
alpm_handle_t *handle;
|
||||||
char *treename;
|
char *treename;
|
||||||
/* do not access directly, use _alpm_db_path(db) for lazy access */
|
/* do not access directly, use _alpm_db_path(db) for lazy access */
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ enum mount_fsinfo {
|
|||||||
MOUNT_FSINFO_FAIL,
|
MOUNT_FSINFO_FAIL,
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct __alpm_mountpoint_t {
|
typedef struct _alpm_mountpoint_t {
|
||||||
/* mount point information */
|
/* mount point information */
|
||||||
char *mount_dir;
|
char *mount_dir;
|
||||||
size_t mount_dir_len;
|
size_t mount_dir_len;
|
||||||
|
|||||||
@@ -23,19 +23,19 @@
|
|||||||
|
|
||||||
#include "alpm_list.h"
|
#include "alpm_list.h"
|
||||||
|
|
||||||
enum __alpm_graph_vertex_state {
|
enum _alpm_graph_vertex_state {
|
||||||
ALPM_GRAPH_STATE_UNPROCESSED,
|
ALPM_GRAPH_STATE_UNPROCESSED,
|
||||||
ALPM_GRAPH_STATE_PROCESSING,
|
ALPM_GRAPH_STATE_PROCESSING,
|
||||||
ALPM_GRAPH_STATE_PROCESSED
|
ALPM_GRAPH_STATE_PROCESSED
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct __alpm_graph_t {
|
typedef struct _alpm_graph_t {
|
||||||
void *data;
|
void *data;
|
||||||
struct __alpm_graph_t *parent; /* where did we come from? */
|
struct _alpm_graph_t *parent; /* where did we come from? */
|
||||||
alpm_list_t *children;
|
alpm_list_t *children;
|
||||||
alpm_list_t *iterator; /* used for DFS without recursion */
|
alpm_list_t *iterator; /* used for DFS without recursion */
|
||||||
off_t weight; /* weight of the node */
|
off_t weight; /* weight of the node */
|
||||||
enum __alpm_graph_vertex_state state;
|
enum _alpm_graph_vertex_state state;
|
||||||
} alpm_graph_t;
|
} alpm_graph_t;
|
||||||
|
|
||||||
alpm_graph_t *_alpm_graph_new(void);
|
alpm_graph_t *_alpm_graph_new(void);
|
||||||
|
|||||||
@@ -26,6 +26,7 @@
|
|||||||
|
|
||||||
#include "alpm_list.h"
|
#include "alpm_list.h"
|
||||||
#include "alpm.h"
|
#include "alpm.h"
|
||||||
|
#include "trans.h"
|
||||||
|
|
||||||
#ifdef HAVE_LIBCURL
|
#ifdef HAVE_LIBCURL
|
||||||
#include <curl/curl.h>
|
#include <curl/curl.h>
|
||||||
@@ -50,7 +51,7 @@ do { \
|
|||||||
} \
|
} \
|
||||||
} while(0)
|
} while(0)
|
||||||
|
|
||||||
struct __alpm_handle_t {
|
struct _alpm_handle_t {
|
||||||
/* internal usage */
|
/* internal usage */
|
||||||
alpm_db_t *db_local; /* local db pointer */
|
alpm_db_t *db_local; /* local db pointer */
|
||||||
alpm_list_t *dbs_sync; /* List of (alpm_db_t *) */
|
alpm_list_t *dbs_sync; /* List of (alpm_db_t *) */
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ struct pkg_operations {
|
|||||||
*/
|
*/
|
||||||
extern const struct pkg_operations default_pkg_ops;
|
extern const struct pkg_operations default_pkg_ops;
|
||||||
|
|
||||||
struct __alpm_pkg_t {
|
struct _alpm_pkg_t {
|
||||||
unsigned long name_hash;
|
unsigned long name_hash;
|
||||||
char *filename;
|
char *filename;
|
||||||
char *base;
|
char *base;
|
||||||
|
|||||||
@@ -32,7 +32,7 @@
|
|||||||
* A combination of a hash table and a list, allowing for fast look-up
|
* A combination of a hash table and a list, allowing for fast look-up
|
||||||
* by package name but also iteration over the packages.
|
* by package name but also iteration over the packages.
|
||||||
*/
|
*/
|
||||||
struct __alpm_pkghash_t {
|
struct _alpm_pkghash_t {
|
||||||
/** data held by the hash table */
|
/** data held by the hash table */
|
||||||
alpm_list_t **hash_table;
|
alpm_list_t **hash_table;
|
||||||
/** head node of the hash table data in normal list format */
|
/** head node of the hash table data in normal list format */
|
||||||
@@ -45,7 +45,7 @@ struct __alpm_pkghash_t {
|
|||||||
unsigned int limit;
|
unsigned int limit;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct __alpm_pkghash_t alpm_pkghash_t;
|
typedef struct _alpm_pkghash_t alpm_pkghash_t;
|
||||||
|
|
||||||
alpm_pkghash_t *_alpm_pkghash_create(unsigned int size);
|
alpm_pkghash_t *_alpm_pkghash_create(unsigned int size);
|
||||||
|
|
||||||
|
|||||||
@@ -350,7 +350,7 @@ static int key_search_keyserver(alpm_handle_t *handle, const char *fpr,
|
|||||||
pgpkey->data = key;
|
pgpkey->data = key;
|
||||||
if(key->subkeys->fpr) {
|
if(key->subkeys->fpr) {
|
||||||
pgpkey->fingerprint = key->subkeys->fpr;
|
pgpkey->fingerprint = key->subkeys->fpr;
|
||||||
} else if(key->subkeys->keyid) {
|
} else {
|
||||||
pgpkey->fingerprint = key->subkeys->keyid;
|
pgpkey->fingerprint = key->subkeys->keyid;
|
||||||
}
|
}
|
||||||
pgpkey->uid = key->uids->uid;
|
pgpkey->uid = key->uids->uid;
|
||||||
@@ -504,19 +504,15 @@ int _alpm_key_import(alpm_handle_t *handle, const char *uid, const char *fpr)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
STRDUP(fetch_key.uid, uid, return -1);
|
|
||||||
STRDUP(fetch_key.fingerprint, fpr, free(fetch_key.uid); return -1);
|
|
||||||
|
|
||||||
alpm_question_import_key_t question = {
|
alpm_question_import_key_t question = {
|
||||||
.type = ALPM_QUESTION_IMPORT_KEY,
|
.type = ALPM_QUESTION_IMPORT_KEY,
|
||||||
.import = 0,
|
.import = 0,
|
||||||
.key = &fetch_key
|
.uid = uid,
|
||||||
|
.fingerprint = fpr
|
||||||
};
|
};
|
||||||
QUESTION(handle, &question);
|
QUESTION(handle, &question);
|
||||||
|
|
||||||
free(fetch_key.uid);
|
|
||||||
free(fetch_key.fingerprint);
|
|
||||||
|
|
||||||
if(question.import) {
|
if(question.import) {
|
||||||
/* Try to import the key from a WKD first */
|
/* Try to import the key from a WKD first */
|
||||||
if(email_from_uid(uid, &email) == 0) {
|
if(email_from_uid(uid, &email) == 0) {
|
||||||
|
|||||||
@@ -198,7 +198,8 @@ int SYMEXPORT alpm_trans_commit(alpm_handle_t *handle, alpm_list_t **data)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(_alpm_hook_run(handle, ALPM_HOOK_PRE_TRANSACTION) != 0) {
|
if(!(trans->flags & ALPM_TRANS_FLAG_NOHOOKS) &&
|
||||||
|
_alpm_hook_run(handle, ALPM_HOOK_PRE_TRANSACTION) != 0) {
|
||||||
RET_ERR(handle, ALPM_ERR_TRANS_HOOK_FAILED, -1);
|
RET_ERR(handle, ALPM_ERR_TRANS_HOOK_FAILED, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -232,7 +233,10 @@ int SYMEXPORT alpm_trans_commit(alpm_handle_t *handle, alpm_list_t **data)
|
|||||||
event.type = ALPM_EVENT_TRANSACTION_DONE;
|
event.type = ALPM_EVENT_TRANSACTION_DONE;
|
||||||
EVENT(handle, (void *)&event);
|
EVENT(handle, (void *)&event);
|
||||||
alpm_logaction(handle, ALPM_CALLER_PREFIX, "transaction completed\n");
|
alpm_logaction(handle, ALPM_CALLER_PREFIX, "transaction completed\n");
|
||||||
_alpm_hook_run(handle, ALPM_HOOK_POST_TRANSACTION);
|
|
||||||
|
if(!(trans->flags & ALPM_TRANS_FLAG_NOHOOKS)) {
|
||||||
|
_alpm_hook_run(handle, ALPM_HOOK_POST_TRANSACTION);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
trans->state = STATE_COMMITED;
|
trans->state = STATE_COMMITED;
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ typedef enum _alpm_transstate_t {
|
|||||||
} alpm_transstate_t;
|
} alpm_transstate_t;
|
||||||
|
|
||||||
/* Transaction */
|
/* Transaction */
|
||||||
struct __alpm_trans_t {
|
typedef struct _alpm_trans_t {
|
||||||
/* bitfield of alpm_transflag_t flags */
|
/* bitfield of alpm_transflag_t flags */
|
||||||
int flags;
|
int flags;
|
||||||
alpm_transstate_t state;
|
alpm_transstate_t state;
|
||||||
@@ -44,7 +44,7 @@ struct __alpm_trans_t {
|
|||||||
alpm_list_t *add; /* list of (alpm_pkg_t *) */
|
alpm_list_t *add; /* list of (alpm_pkg_t *) */
|
||||||
alpm_list_t *remove; /* list of (alpm_pkg_t *) */
|
alpm_list_t *remove; /* list of (alpm_pkg_t *) */
|
||||||
alpm_list_t *skip_remove; /* list of (char *) */
|
alpm_list_t *skip_remove; /* list of (char *) */
|
||||||
};
|
} alpm_trans_t;
|
||||||
|
|
||||||
void _alpm_trans_free(alpm_trans_t *trans);
|
void _alpm_trans_free(alpm_trans_t *trans);
|
||||||
/* flags is a bitfield of alpm_transflag_t flags */
|
/* flags is a bitfield of alpm_transflag_t flags */
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ LOCKFILE=
|
|||||||
CLEAN_LOCK=0
|
CLEAN_LOCK=0
|
||||||
USE_COLOR='y'
|
USE_COLOR='y'
|
||||||
PREVENT_DOWNGRADE=0
|
PREVENT_DOWNGRADE=0
|
||||||
|
INCLUDE_SIGS=0
|
||||||
|
|
||||||
# Import libmakepkg
|
# Import libmakepkg
|
||||||
source "$LIBRARY"/util/compress.sh
|
source "$LIBRARY"/util/compress.sh
|
||||||
@@ -260,7 +261,7 @@ db_write_entry() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# compute base64'd PGP signature
|
# compute base64'd PGP signature
|
||||||
if [[ -f "$pkgfile.sig" ]]; then
|
if (( INCLUDE_SIGS )) && [[ -f "$pkgfile.sig" ]]; then
|
||||||
if grep -q 'BEGIN PGP SIGNATURE' "$pkgfile.sig"; then
|
if grep -q 'BEGIN PGP SIGNATURE' "$pkgfile.sig"; then
|
||||||
error "$(gettext "Cannot use armored signatures for packages: %s")" "$pkgfile.sig"
|
error "$(gettext "Cannot use armored signatures for packages: %s")" "$pkgfile.sig"
|
||||||
return 1
|
return 1
|
||||||
@@ -622,6 +623,9 @@ while (( $# )); do
|
|||||||
-p|--prevent-downgrade)
|
-p|--prevent-downgrade)
|
||||||
PREVENT_DOWNGRADE=1
|
PREVENT_DOWNGRADE=1
|
||||||
;;
|
;;
|
||||||
|
--include-sigs)
|
||||||
|
INCLUDE_SIGS=1
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
args+=("$1")
|
args+=("$1")
|
||||||
;;
|
;;
|
||||||
|
|||||||
@@ -541,12 +541,12 @@ void cb_question(void *ctx, alpm_question_t *question)
|
|||||||
{
|
{
|
||||||
alpm_question_import_key_t *q = &question->import_key;
|
alpm_question_import_key_t *q = &question->import_key;
|
||||||
/* the uid is unknown with db signatures */
|
/* the uid is unknown with db signatures */
|
||||||
if (q->key->uid == NULL) {
|
if (q->uid == NULL) {
|
||||||
q->import = yesno(_("Import PGP key %s?"),
|
q->import = yesno(_("Import PGP key %s?"),
|
||||||
q->key->fingerprint);
|
q->fingerprint);
|
||||||
} else {
|
} else {
|
||||||
q->import = yesno(_("Import PGP key %s, \"%s\"?"),
|
q->import = yesno(_("Import PGP key %s, \"%s\"?"),
|
||||||
q->key->fingerprint, q->key->uid);
|
q->fingerprint, q->uid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -634,6 +634,7 @@ static int parsearg_trans(int opt)
|
|||||||
case OP_DBONLY:
|
case OP_DBONLY:
|
||||||
config->flags |= ALPM_TRANS_FLAG_DBONLY;
|
config->flags |= ALPM_TRANS_FLAG_DBONLY;
|
||||||
config->flags |= ALPM_TRANS_FLAG_NOSCRIPTLET;
|
config->flags |= ALPM_TRANS_FLAG_NOSCRIPTLET;
|
||||||
|
config->flags |= ALPM_TRANS_FLAG_NOHOOKS;
|
||||||
break;
|
break;
|
||||||
case OP_NOPROGRESSBAR:
|
case OP_NOPROGRESSBAR:
|
||||||
config->noprogressbar = 1;
|
config->noprogressbar = 1;
|
||||||
|
|||||||
@@ -840,7 +840,7 @@ int sync_prepare_execute(void)
|
|||||||
conflict->file, conflict->target, conflict->ctarget);
|
conflict->file, conflict->target, conflict->ctarget);
|
||||||
break;
|
break;
|
||||||
case ALPM_FILECONFLICT_FILESYSTEM:
|
case ALPM_FILECONFLICT_FILESYSTEM:
|
||||||
if(conflict->ctarget[0]) {
|
if(conflict->ctarget) {
|
||||||
printf(_("%s: %s exists in filesystem (owned by %s)\n"),
|
printf(_("%s: %s exists in filesystem (owned by %s)\n"),
|
||||||
conflict->target, conflict->file, conflict->ctarget);
|
conflict->target, conflict->file, conflict->ctarget);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user