pkg: fetching binary packages to a local dumpdir for a different ABI

Matthew Seaman matthew at FreeBSD.org
Fri Mar 11 11:16:17 UTC 2016


On 03/11/16 10:00, Miroslav Lachman wrote:
> O. Hartmann wrote on 03/11/2016 10:42:
> 
> [...]
> 
>> The ABI is also unclear. Some documents say it is freebsd:10:x86:64
>> (which
>> looks more the Intel/Linux dominated terminology) and also this one is
>> considered correct: FreeBSD:10:amd64 (looks more FreeBSD'ish). It is
>> said that
>> the variable ABI is derived from "sh" - how?
> 
> It is freebsd:10:x86:64. You can look at http://pkg.freebsd.org/
> The full URL is http://pkg.freebsd.org/freebsd:10:x86:64/

Actually, ${ABI} *used* to be freebsd:10:x86:64.  It changed to
FreeBSD:10:amd64 quite some time and numerous releases of pkg(8) ago now.

The ABI is usually determined by examining the binary of /bin/sh --
chosen because /bin/sh is likely to be present even on the most cut-down
jail.   It works vaguely similarly to the way file(1) does:

% file /bin/sh
/bin/sh: ELF 64-bit LSB executable, x86-64, version 1 (FreeBSD),
dynamically linked, interpreter /libexec/ld-elf.so.1, for FreeBSD 10.2
(1002509), stripped

although there's no common code history between file(1) and pkg(8).  If
you feel like reading some C code, look at

https://github.com/freebsd/pkg/blob/master/libpkg/pkg_elf.c#L691

-- the functions pkg_get_myarch_elfparse() and pkg_get_myarch() at line
964 are what does the job.

	Cheers,

	Matthew




-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freebsd.org/pipermail/freebsd-ports/attachments/20160311/d8ded934/attachment.sig>


More information about the freebsd-ports mailing list