Using pkg to fetch packages for different ABI

Daniel Eischen deischen at freebsd.org
Wed Feb 3 03:37:08 UTC 2016


On Tue, 2 Feb 2016, Jason Unovitch wrote:

> On Tue, Feb 2, 2016 at 8:21 PM, Daniel Eischen <deischen at freebsd.org> wrote:
>> I want to use pkg to maintain a set of packages for nanobsd
>> systems that are a different OS version and ABI than the
>> host system.  Basically, I want to be able to do:
>>
>>   # pkg fetch -d -r FreeBSD_10x_32 -o ./ <pkgname>
>>
>> and have it fetch all the required packages for <pkgname>.
>>
>> The host system is 10.2-RELEASE-p9 amd64, the target system
>> in this case is similar, but just x86, not amd64.  pkg is
>> version 1.6.2.
>>
>> Trying to initially update the repo catalog gives this:
>>
>>   # cat /usr/local/etc/pkg/repos/FreeBSD_10x_32.conf
>>   FreeBSD_10x_32: {
>>     ABI: "FreeBSD:x86:32"
>>     url: "pkg+http://pkg.FreeBSD.org/freebsd:10:x86:32/latest",
>>     mirror_type: "srv",
>>     signature_type: "fingerprints",
>>     fingerprints: "/usr/share/keys/pkg",
>>     enabled: yes
>>   }
>>
>>   # pkg update -r FreeBSD_10x_32
>>   Updating FreeBSD_10x_32 repository catalogue...
>>   Fetching meta.txz: 100%    944 B   0.9kB/s    00:01
>>   Fetching packagesite.txz: 100%    5 MiB   2.8MB/s    00:02
>>   Processing entries:   0%
>>   pkg: wrong architecture: freebsd:10:x86:32 instead of FreeBSD:10:amd64
>>   pkg: repository FreeBSD_10x_32 contains packages with wrong ABI:
>> freebsd:10:x86:32
>>   Processing entries: 100%
>>   Unable to update repository FreeBSD_10x_32
>>
>> Why does 'pkg' care what the ABI is unless we try to actually
>> install the packages?
>>
>> --
>> DE
>
> Set it via an environmental variable:
> setenv ABI freebsd:10:x86:32
>
> ABI can be overridden with environmental variables or via `-o
> ABI=freebsd:10:x86:32'.  I'm actually using environmental variables on
> a CentOS box with a locally compiled pkg to do a pkg fetch and pkg
> repo to store a couple packages for internal use.

Interesting, that works.  I would have thought setting it in
the repo.conf would have worked too, though.

So, can I have one (1) repo.conf and use it for multiple ABIs,
like so?:

   $ cat /usr/local/etc/pkg/repos/FreeBSD_10x.conf
   FreeBSD_10x: {
     url: "pkg+http://pkg.FreeBSD.org/${ABI}/latest
     mirror_type: "srv",
     signature_type: "fingerprints",
     fingerprints: "/usr/share/keys/pkg",
     enabled: yes
   }

   $ mkdir /tmp/10x_amd64
   $ mkdir /tmp/10x_x86
   $ pkg fetch -Ud -r FreeBSD_10x -o /tmp/10x_amd64 \
       security/sudo shells/bash
   $ pkg -o ABI=freebsd:10:x86:32 fetch -Ud -r FreeBSD_10x \
       -o /tmp/10x_x86 security/sudo shells/bash

I suppose this assumes that the package dependencies are exactly
the same for all the ABIs that one would need.

-- 
DE


More information about the freebsd-ports mailing list