mirror of
https://gitlab.archlinux.org/pacman/pacman.git
synced 2025-11-17 23:54:40 +01:00
Compare commits
9 Commits
v6.0.1
...
morganamil
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a61c500557 | ||
|
|
39c3cbdf56 | ||
|
|
165e492485 | ||
|
|
be76f8bf06 | ||
|
|
625f3d645b | ||
|
|
e187aa9b48 | ||
|
|
c5c6633dd1 | ||
|
|
2109de613a | ||
|
|
fbb29b5047 |
@@ -364,6 +364,9 @@ Query Options (apply to '-Q')[[QO]]
|
|||||||
replacements are not checked here. This option works best if the sync
|
replacements are not checked here. This option works best if the sync
|
||||||
database is refreshed using '-Sy'.
|
database is refreshed using '-Sy'.
|
||||||
|
|
||||||
|
*-w, \--backup*::
|
||||||
|
List all modified backup files owened by a given package. Multiple packages can
|
||||||
|
be specified on the command line. Pass twice to print all backup files.
|
||||||
|
|
||||||
Remove Options (apply to '-R')[[RO]]
|
Remove Options (apply to '-R')[[RO]]
|
||||||
------------------------------------
|
------------------------------------
|
||||||
|
|||||||
@@ -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 */
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -83,6 +83,7 @@ typedef struct __config_t {
|
|||||||
unsigned short op_q_upgrade;
|
unsigned short op_q_upgrade;
|
||||||
unsigned short op_q_check;
|
unsigned short op_q_check;
|
||||||
unsigned short op_q_locality;
|
unsigned short op_q_locality;
|
||||||
|
unsigned short op_q_backup;
|
||||||
|
|
||||||
unsigned short op_s_clean;
|
unsigned short op_s_clean;
|
||||||
unsigned short op_s_downloadonly;
|
unsigned short op_s_downloadonly;
|
||||||
@@ -180,6 +181,7 @@ enum {
|
|||||||
OP_DBPATH,
|
OP_DBPATH,
|
||||||
OP_CASCADE,
|
OP_CASCADE,
|
||||||
OP_CHANGELOG,
|
OP_CHANGELOG,
|
||||||
|
OP_BACKUP,
|
||||||
OP_CLEAN,
|
OP_CLEAN,
|
||||||
OP_NODEPS,
|
OP_NODEPS,
|
||||||
OP_DEPS,
|
OP_DEPS,
|
||||||
|
|||||||
@@ -348,7 +348,7 @@ void dump_pkg_full(alpm_pkg_t *pkg, int extra)
|
|||||||
|
|
||||||
/* Print additional package info if info flag passed more than once */
|
/* Print additional package info if info flag passed more than once */
|
||||||
if(from == ALPM_PKG_FROM_LOCALDB && extra) {
|
if(from == ALPM_PKG_FROM_LOCALDB && extra) {
|
||||||
dump_pkg_backups(pkg);
|
dump_backup_status(pkg);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* final newline to separate packages */
|
/* final newline to separate packages */
|
||||||
@@ -359,6 +359,34 @@ void dump_pkg_full(alpm_pkg_t *pkg, int extra)
|
|||||||
alpm_list_free(validation);
|
alpm_list_free(validation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int get_backup_file_changed(const char *root,
|
||||||
|
const alpm_backup_t *backup)
|
||||||
|
{
|
||||||
|
char path[PATH_MAX];
|
||||||
|
int ret = 0;
|
||||||
|
|
||||||
|
snprintf(path, PATH_MAX, "%s%s", root, backup->name);
|
||||||
|
|
||||||
|
/* if we find the file, calculate checksums, otherwise it is missing */
|
||||||
|
if(access(path, R_OK) == 0) {
|
||||||
|
char *md5sum = alpm_compute_md5sum(path);
|
||||||
|
|
||||||
|
if(md5sum == NULL) {
|
||||||
|
pm_printf(ALPM_LOG_ERROR,
|
||||||
|
_("could not calculate checksums for %s\n"), path);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* if checksums don't match, file has been modified */
|
||||||
|
ret = strcmp(md5sum, backup->hash) != 0;
|
||||||
|
free(md5sum);
|
||||||
|
} else if(errno != ENOENT) {
|
||||||
|
pm_printf(ALPM_LOG_ERROR,
|
||||||
|
_("could not read %s: %s\n"), path, strerror(errno));
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
static const char *get_backup_file_status(const char *root,
|
static const char *get_backup_file_status(const char *root,
|
||||||
const alpm_backup_t *backup)
|
const alpm_backup_t *backup)
|
||||||
{
|
{
|
||||||
@@ -401,7 +429,7 @@ static const char *get_backup_file_status(const char *root,
|
|||||||
|
|
||||||
/* Display list of backup files and their modification states
|
/* Display list of backup files and their modification states
|
||||||
*/
|
*/
|
||||||
void dump_pkg_backups(alpm_pkg_t *pkg)
|
void dump_backup_status(alpm_pkg_t *pkg)
|
||||||
{
|
{
|
||||||
alpm_list_t *i;
|
alpm_list_t *i;
|
||||||
const char *root = alpm_option_get_root(config->handle);
|
const char *root = alpm_option_get_root(config->handle);
|
||||||
@@ -450,6 +478,32 @@ void dump_pkg_files(alpm_pkg_t *pkg, int quiet)
|
|||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void dump_pkg_backups(alpm_pkg_t *pkg, int quiet, int all)
|
||||||
|
{
|
||||||
|
const char *pkgname, *root;
|
||||||
|
alpm_list_t *backups;
|
||||||
|
alpm_list_t *i;
|
||||||
|
|
||||||
|
pkgname = alpm_pkg_get_name(pkg);
|
||||||
|
backups = alpm_pkg_get_backup(pkg);
|
||||||
|
root = alpm_option_get_root(config->handle);
|
||||||
|
|
||||||
|
for(i = backups; i; i = i->next) {
|
||||||
|
alpm_backup_t *backup = i->data;
|
||||||
|
|
||||||
|
if(!all && backup->hash && !get_backup_file_changed(root, backup)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!quiet) {
|
||||||
|
printf("%s%s%s ", config->colstr.title, pkgname, config->colstr.nocolor);
|
||||||
|
}
|
||||||
|
printf("%s%s\n", root, backup->name);
|
||||||
|
}
|
||||||
|
|
||||||
|
fflush(stdout);
|
||||||
|
}
|
||||||
|
|
||||||
/* Display the changelog of a package
|
/* Display the changelog of a package
|
||||||
*/
|
*/
|
||||||
void dump_pkg_changelog(alpm_pkg_t *pkg)
|
void dump_pkg_changelog(alpm_pkg_t *pkg)
|
||||||
|
|||||||
@@ -24,7 +24,8 @@
|
|||||||
|
|
||||||
void dump_pkg_full(alpm_pkg_t *pkg, int extra);
|
void dump_pkg_full(alpm_pkg_t *pkg, int extra);
|
||||||
|
|
||||||
void dump_pkg_backups(alpm_pkg_t *pkg);
|
void dump_backup_status(alpm_pkg_t *pkg);
|
||||||
|
void dump_pkg_backups(alpm_pkg_t *pkg, int quiet, int all);
|
||||||
void dump_pkg_files(alpm_pkg_t *pkg, int quiet);
|
void dump_pkg_files(alpm_pkg_t *pkg, int quiet);
|
||||||
void dump_pkg_changelog(alpm_pkg_t *pkg);
|
void dump_pkg_changelog(alpm_pkg_t *pkg);
|
||||||
|
|
||||||
|
|||||||
@@ -150,6 +150,7 @@ static void usage(int op, const char * const myname)
|
|||||||
addlist(_(" -t, --unrequired list packages not (optionally) required by any\n"
|
addlist(_(" -t, --unrequired list packages not (optionally) required by any\n"
|
||||||
" package (-tt to ignore optdepends) [filter]\n"));
|
" package (-tt to ignore optdepends) [filter]\n"));
|
||||||
addlist(_(" -u, --upgrades list outdated packages [filter]\n"));
|
addlist(_(" -u, --upgrades list outdated packages [filter]\n"));
|
||||||
|
addlist(_(" -w, --backup list modified backup files of a package (-xx for all backup files)\n"));
|
||||||
} else if(op == PM_OP_SYNC) {
|
} else if(op == PM_OP_SYNC) {
|
||||||
printf("%s: %s {-S --sync} [%s] [%s]\n", str_usg, myname, str_opt, str_pkg);
|
printf("%s: %s {-S --sync} [%s] [%s]\n", str_usg, myname, str_opt, str_pkg);
|
||||||
printf("%s:\n", str_opt);
|
printf("%s:\n", str_opt);
|
||||||
@@ -516,6 +517,10 @@ static int parsearg_query(int opt)
|
|||||||
case 'c':
|
case 'c':
|
||||||
config->op_q_changelog = 1;
|
config->op_q_changelog = 1;
|
||||||
break;
|
break;
|
||||||
|
case OP_BACKUP:
|
||||||
|
case 'w':
|
||||||
|
(config->op_q_backup)++;
|
||||||
|
break;
|
||||||
case OP_DEPS:
|
case OP_DEPS:
|
||||||
case 'd':
|
case 'd':
|
||||||
config->op_q_deps = 1;
|
config->op_q_deps = 1;
|
||||||
@@ -583,6 +588,7 @@ static void checkargs_query_display_opts(const char *opname) {
|
|||||||
invalid_opt(config->op_q_check, opname, "--check");
|
invalid_opt(config->op_q_check, opname, "--check");
|
||||||
invalid_opt(config->op_q_info, opname, "--info");
|
invalid_opt(config->op_q_info, opname, "--info");
|
||||||
invalid_opt(config->op_q_list, opname, "--list");
|
invalid_opt(config->op_q_list, opname, "--list");
|
||||||
|
invalid_opt(config->op_q_backup, opname, "--backup");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void checkargs_query_filter_opts(const char *opname) {
|
static void checkargs_query_filter_opts(const char *opname) {
|
||||||
@@ -634,6 +640,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;
|
||||||
@@ -895,6 +902,7 @@ static int parseargs(int argc, char *argv[])
|
|||||||
{"dbpath", required_argument, 0, OP_DBPATH},
|
{"dbpath", required_argument, 0, OP_DBPATH},
|
||||||
{"cascade", no_argument, 0, OP_CASCADE},
|
{"cascade", no_argument, 0, OP_CASCADE},
|
||||||
{"changelog", no_argument, 0, OP_CHANGELOG},
|
{"changelog", no_argument, 0, OP_CHANGELOG},
|
||||||
|
{"backup", no_argument, 0, OP_BACKUP},
|
||||||
{"clean", no_argument, 0, OP_CLEAN},
|
{"clean", no_argument, 0, OP_CLEAN},
|
||||||
{"nodeps", no_argument, 0, OP_NODEPS},
|
{"nodeps", no_argument, 0, OP_NODEPS},
|
||||||
{"deps", no_argument, 0, OP_DEPS},
|
{"deps", no_argument, 0, OP_DEPS},
|
||||||
|
|||||||
@@ -315,6 +315,9 @@ static int display(alpm_pkg_t *pkg)
|
|||||||
if(config->op_q_list) {
|
if(config->op_q_list) {
|
||||||
dump_pkg_files(pkg, config->quiet);
|
dump_pkg_files(pkg, config->quiet);
|
||||||
}
|
}
|
||||||
|
if(config->op_q_backup) {
|
||||||
|
dump_pkg_backups(pkg, config->quiet, config->op_q_backup != 1);
|
||||||
|
}
|
||||||
if(config->op_q_changelog) {
|
if(config->op_q_changelog) {
|
||||||
dump_pkg_changelog(pkg);
|
dump_pkg_changelog(pkg);
|
||||||
}
|
}
|
||||||
@@ -325,8 +328,8 @@ static int display(alpm_pkg_t *pkg)
|
|||||||
ret = check_pkg_full(pkg);
|
ret = check_pkg_full(pkg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!config->op_q_info && !config->op_q_list
|
if(!config->op_q_info && !config->op_q_list && !config->op_q_changelog
|
||||||
&& !config->op_q_changelog && !config->op_q_check) {
|
&& !config->op_q_check && !config->op_q_backup) {
|
||||||
if(!config->quiet) {
|
if(!config->quiet) {
|
||||||
const colstr_t *colstr = &config->colstr;
|
const colstr_t *colstr = &config->colstr;
|
||||||
printf("%s%s %s%s%s", colstr->title, alpm_pkg_get_name(pkg),
|
printf("%s%s %s%s%s", colstr->title, alpm_pkg_get_name(pkg),
|
||||||
@@ -431,7 +434,7 @@ int pacman_query(alpm_list_t *targets)
|
|||||||
db_local = alpm_get_localdb(config->handle);
|
db_local = alpm_get_localdb(config->handle);
|
||||||
|
|
||||||
/* operations on all packages in the local DB
|
/* operations on all packages in the local DB
|
||||||
* valid: no-op (plain -Q), list, info, check
|
* valid: no-op (plain -Q), list, info, check, backup
|
||||||
* invalid: isfile, owns */
|
* invalid: isfile, owns */
|
||||||
if(targets == NULL) {
|
if(targets == NULL) {
|
||||||
if(config->op_q_isfile || config->op_q_owns) {
|
if(config->op_q_isfile || config->op_q_owns) {
|
||||||
|
|||||||
Reference in New Issue
Block a user