Added XBPS_ARCH environment var to override uname(2) machine result.

This commit is contained in:
Juan RP 2014-01-09 11:41:25 +01:00
parent 6537004532
commit 804a39c63b
5 changed files with 41 additions and 18 deletions

View File

@ -1,4 +1,4 @@
.Dd December 4, 2013
.Dd January 9, 2014
.Os Void Linux
.Dt xbps-install 8
.Sh NAME
@ -87,11 +87,17 @@ Assume yes to all questions and avoid interactive questions.
Shows the XBPS version.
.Sh ENVIRONMENT
.Bl -tag -width XBPS_TARGET_ARCH
.It Sy XBPS_TARGET_ARCH
.It Sy XBPS_ARCH
Overrides
.Xr uname 2
machine result with this value. Useful to install packages of a different
machine result with this value. Useful to install packages with a fake
architecture.
.It Sy XBPS_TARGET_ARCH
Sets the target architecture to this value. This variable differs from
.Sy XBPS_ARCH
in that it allows you to install packages partially, because
configuration phase is skipped (the target binaries might not be compatible with
the native architecture).
.Sh FILES
.Bl -tag -width /var/db/xbps/.<pkgname>.plist
.It Ar /etc/xbps/xbps.conf

View File

@ -1,4 +1,4 @@
.Dd December 4, 2013
.Dd January 9, 2014
.Os Void Linux
.Dt xbps-query 8
.Sh NAME
@ -155,11 +155,17 @@ Show the reverse dependencies for
.Ar PKG .
.Sh ENVIRONMENT
.Bl -tag -width XBPS_TARGET_ARCH
.It Sy XBPS_TARGET_ARCH
.It Sy XBPS_ARCH
Overrides
.Xr uname 2
machine result with this value. Useful to install packages of a different
machine result with this value. Useful to install packages with a fake
architecture.
.It Sy XBPS_TARGET_ARCH
Sets the target architecture to this value. This variable differs from
.Sy XBPS_ARCH
in that it allows you to install packages partially, because
configuration phase is skipped (the target binaries might not be compatible with
the native architecture).
.Sh FILES
.Bl -tag -width /var/db/xbps/.<pkgname>.plist
.It Ar /etc/xbps/xbps.conf

View File

@ -1,4 +1,4 @@
.Dd November 2, 2013
.Dd January 9, 2014
.Os Void Linux
.Dt xbps-rindex 8
.Sh NAME
@ -51,14 +51,20 @@ argument not set, it defaults to
.Sy ~/.ssh/id_rsa .
.Sh ENVIRONMENT
.Bl -tag -width XBPS_TARGET_ARCH
.It Sy XBPS_ARCH
Overrides
.Xr uname 2
machine result with this value. Useful to install packages with a fake
architecture.
.It Sy XBPS_TARGET_ARCH
Sets the target architecture to this value. This variable differs from
.Sy XBPS_ARCH
in that it allows you to install packages partially, because
configuration phase is skipped (the target binaries might not be compatible with
the native architecture).
.It Sy XBPS_PASSPHRASE
If this is set, it will use this passphrase for the RSA private key when signing
a repository. Otherwise it will ask you to enter the passphrase on the terminal.
.It Sy XBPS_TARGET_ARCH
Overrides
.Xr uname 2
machine result with this value. Useful to install packages of a different
architecture.
.Sh SEE ALSO
.Xr xbps-create 8 ,
.Xr xbps-dgraph 8 ,

View File

@ -1,5 +1,5 @@
/*-
* Copyright (c) 2008-2013 Juan Romero Pardines.
* Copyright (c) 2008-2014 Juan Romero Pardines.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -561,7 +561,8 @@ struct xbps_handle {
/**
* @var native_arch
*
* Machine architecture, as returned by uname(2)::machine.
* Machine architecture, defaults to uname(2)::machine
* if XBPS_ARCH is not set from environment.
*/
char native_arch[16];
/**

View File

@ -1,5 +1,5 @@
/*-
* Copyright (c) 2011-2013 Juan Romero Pardines.
* Copyright (c) 2011-2014 Juan Romero Pardines.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -89,7 +89,7 @@ xbps_init(struct xbps_handle *xhp)
};
struct utsname un;
char *buf;
const char *repodir;
const char *repodir, *native_arch;
int rv, cc, cch;
bool syslog_enabled = false;
@ -170,8 +170,12 @@ xbps_init(struct xbps_handle *xhp)
}
xhp->target_arch = getenv("XBPS_TARGET_ARCH");
uname(&un);
strlcpy(xhp->native_arch, un.machine, sizeof(xhp->native_arch));
if ((native_arch = getenv("XBPS_ARCH")) != NULL) {
strlcpy(xhp->native_arch, native_arch, sizeof(xhp->native_arch));
} else {
uname(&un);
strlcpy(xhp->native_arch, un.machine, sizeof(xhp->native_arch));
}
assert(xhp->native_arch);
if (xhp->cfg == NULL) {