mirror of
https://github.com/moparisthebest/pacman
synced 2025-02-28 09:21:53 -05:00
Add Architecture and --arch option
Signed-off-by: Xavier Chantry <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
parent
92f0775e76
commit
594621cbeb
@ -166,6 +166,8 @@ Options
|
||||
If an install scriptlet exists, do not execute it. Do not use this
|
||||
unless you know what you are doing.
|
||||
|
||||
*\--arch* <'arch'>::
|
||||
Specify an alternate architecture.
|
||||
|
||||
Query Options[[QO]]
|
||||
-------------------
|
||||
|
@ -97,6 +97,14 @@ Options
|
||||
Include another config file. This file can include repositories or
|
||||
general configuration options.
|
||||
|
||||
*Architecture =* auto | i686 | x86_64 | ...::
|
||||
If set, pacman will only allow installation of packages of the given
|
||||
architecture (e.g. 'i686', 'x86_64', etc). The special value 'auto' will
|
||||
use the system architecture, provided by in ``uname -m''. If unset, no
|
||||
architecture checks are made. *NOTE*: packages with the special
|
||||
architecture 'any' can always be installed, as they are meant to be
|
||||
architecture independent.
|
||||
|
||||
*XferCommand =* /path/to/command %u::
|
||||
If set, an external program will be used to download all remote files.
|
||||
All instances of `%u` will be replaced with the download URL. If present,
|
||||
|
@ -19,6 +19,7 @@ SyncFirst = pacman
|
||||
#XferCommand = /usr/bin/wget --passive-ftp -c -O %o %u
|
||||
#XferCommand = /usr/bin/curl %u > %o
|
||||
#CleanMethod = KeepInstalled
|
||||
Architecture = auto
|
||||
|
||||
# Pacman won't upgrade packages listed in IgnorePkg and members of IgnoreGroup
|
||||
#IgnorePkg =
|
||||
|
@ -151,6 +151,9 @@ void alpm_option_add_ignoregrp(const char *grp);
|
||||
void alpm_option_set_ignoregrps(alpm_list_t *ignoregrps);
|
||||
int alpm_option_remove_ignoregrp(const char *grp);
|
||||
|
||||
const char *alpm_option_get_arch();
|
||||
void alpm_option_set_arch(const char *arch);
|
||||
|
||||
void alpm_option_set_usedelta(unsigned short usedelta);
|
||||
|
||||
pmdb_t *alpm_option_get_localdb();
|
||||
|
@ -79,6 +79,7 @@ void _alpm_handle_free(pmhandle_t *handle)
|
||||
FREELIST(handle->cachedirs);
|
||||
FREE(handle->logfile);
|
||||
FREE(handle->lockfile);
|
||||
FREE(handle->arch);
|
||||
FREELIST(handle->dbs_sync);
|
||||
FREELIST(handle->noupgrade);
|
||||
FREELIST(handle->noextract);
|
||||
@ -213,6 +214,15 @@ alpm_list_t SYMEXPORT *alpm_option_get_ignoregrps()
|
||||
return handle->ignoregrp;
|
||||
}
|
||||
|
||||
const char SYMEXPORT *alpm_option_get_arch()
|
||||
{
|
||||
if (handle == NULL) {
|
||||
pm_errno = PM_ERR_HANDLE_NULL;
|
||||
return NULL;
|
||||
}
|
||||
return handle->arch;
|
||||
}
|
||||
|
||||
pmdb_t SYMEXPORT *alpm_option_get_localdb()
|
||||
{
|
||||
if (handle == NULL) {
|
||||
@ -520,6 +530,12 @@ int SYMEXPORT alpm_option_remove_ignoregrp(const char *grp)
|
||||
return(0);
|
||||
}
|
||||
|
||||
void SYMEXPORT alpm_option_set_arch(const char *arch)
|
||||
{
|
||||
if(handle->arch) FREE(handle->arch);
|
||||
if(arch) handle->arch = strdup(arch);
|
||||
}
|
||||
|
||||
void SYMEXPORT alpm_option_set_usedelta(unsigned short usedelta)
|
||||
{
|
||||
handle->usedelta = usedelta;
|
||||
|
@ -58,6 +58,7 @@ typedef struct _pmhandle_t {
|
||||
|
||||
/* options */
|
||||
unsigned short usesyslog; /* Use syslog instead of logfile? */ /* TODO move to frontend */
|
||||
char *arch; /* Architecture of packages we should allow */
|
||||
unsigned short usedelta; /* Download deltas if possible */
|
||||
} pmhandle_t;
|
||||
|
||||
|
@ -149,6 +149,7 @@ static void usage(int op, const char * const myname)
|
||||
printf(_(" -r, --root <path> set an alternate installation root\n"));
|
||||
printf(_(" -b, --dbpath <path> set an alternate database location\n"));
|
||||
printf(_(" --cachedir <dir> set an alternate package cache location\n"));
|
||||
printf(_(" --arch <arch> set an alternate architecture\n"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -195,6 +196,19 @@ static void setuseragent(void)
|
||||
setenv("HTTP_USER_AGENT", agent, 0);
|
||||
}
|
||||
|
||||
static void setarch(const char *arch)
|
||||
{
|
||||
if (strcmp(arch, "auto") == 0) {
|
||||
struct utsname un;
|
||||
uname(&un);
|
||||
pm_printf(PM_LOG_DEBUG, "config: architecture: %s\n", un.machine);
|
||||
alpm_option_set_arch(un.machine);
|
||||
} else {
|
||||
pm_printf(PM_LOG_DEBUG, "config: architecture: %s\n", arch);
|
||||
alpm_option_set_arch(arch);
|
||||
}
|
||||
}
|
||||
|
||||
/** Free the resources.
|
||||
*
|
||||
* @param ret the return value
|
||||
@ -376,6 +390,7 @@ static int parseargs(int argc, char *argv[])
|
||||
{"ignoregroup", required_argument, 0, 1010},
|
||||
{"needed", no_argument, 0, 1011},
|
||||
{"asexplicit", no_argument, 0, 1012},
|
||||
{"arch", required_argument, 0, 1013},
|
||||
{0, 0, 0, 0}
|
||||
};
|
||||
|
||||
@ -450,6 +465,9 @@ static int parseargs(int argc, char *argv[])
|
||||
case 1012:
|
||||
config->flags |= PM_TRANS_FLAG_ALLEXPLICIT;
|
||||
break;
|
||||
case 1013:
|
||||
setarch(optarg);
|
||||
break;
|
||||
case 'Q': config->op = (config->op != PM_OP_MAIN ? 0 : PM_OP_QUERY); break;
|
||||
case 'R': config->op = (config->op != PM_OP_MAIN ? 0 : PM_OP_REMOVE); break;
|
||||
case 'S': config->op = (config->op != PM_OP_MAIN ? 0 : PM_OP_SYNC); break;
|
||||
@ -827,6 +845,10 @@ static int _parseconfig(const char *file, const char *givensection,
|
||||
setrepeatingoption(ptr, "HoldPkg", option_add_holdpkg);
|
||||
} else if(strcmp(key, "SyncFirst") == 0) {
|
||||
setrepeatingoption(ptr, "SyncFirst", option_add_syncfirst);
|
||||
} else if(strcmp(key, "Architecture") == 0) {
|
||||
if(!alpm_option_get_arch()) {
|
||||
setarch(ptr);
|
||||
}
|
||||
} else if(strcmp(key, "DBPath") == 0) {
|
||||
/* don't overwrite a path specified on the command line */
|
||||
if(!config->dbpath) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user