tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Cross-building packages using pkgsrc



[I didn't cross-post this to freebsd-ports%freebsd.org@localhost - if someone
wants to, for their information, please feel free.  This relates only
to cross-building with pkgsrc - agc]

I was at the recent MeetBSD (but fairly tied up all Saturday) at which
there was a call for cross-building of packages in the FreeBSD ports
system.

I finally had a chance to look at doing this in pkgsrc today, and this
(single line) command allows me to cross build pkgsrc/lang/perl5 for
NetBSD/amd64 current (having first installed gson's marvellous
pkgsrc/misc/py-anita):

        % cat `which cross-build-pkg`
        #! /bin/sh

        anita --test-timeout 14400 --disk-size 3G --run "/etc/rc.d/dhcpcd 
forcestart; cd /usr; ftp -o - 
http://ftp.netbsd.org/pub/pkgsrc/current/pkgsrc.tar.bz2 | tar xjf -; cd 
/usr/pkgsrc/$1; make package" interact 
http://nyftp.netbsd.org/pub/NetBSD-daily/HEAD/201211040530Z/i386/
        %

Some notes:

+ I was doing this on NetBSD/amd64 6.99.10 (running in a VM on Mac OS X,
but that's not really relevant)

+ I could have taken the pkgsrc instance via iSCSI or NFS, or used a
local origin for it, but this shows the general principle

+ Should probably use dhclient for platforms prior to 6.0

+ yes, i'm aware there is no error checking in the shell script

+ I'll look at adding (some variant of) this to pkgsrc

+ I've bumped the total test timeout to 4 hours (instead of 2), but
building packages which may take a long time without output can cause
timeouts in anita (default is 5 minutes) - you'll see python
tracebacks like this

        pexpect.TIMEOUT: Timeout exceeded in read_nonblocking().
        <pexpect.spawn object at 0x7f7ff631a410>
        version: 2.3 ($Revision: 399 $)
        command: /usr/pkg/bin/qemu-system-x86_64
        ...
        child_fd: 55
        closed: False
        timeout: 300

+ architectures are hardcoded in the cross-build-pkg script right now,
but that's easy enough to change or make into a command line option. 
also pkgsrc-current vs.  2012Q3.  again, mainly to show cross-building
in general.

+ i think there must be some fixes for qemu that we could use, as
sparc 5.0.2 didn't fare too well - qemu hung twice - for information,
i was using qemu-1.2.0nb4. sean bruno made a point of using the most
up to date development version of qemu in his talk on saturday

+ riz suggested using our build.sh-generated live images along with qemu

+ it strikes me that there are lots of optimisations to make, including
setting up an environment, copying already build packages to a central
location, using pre-compiled binary packages, and tons of others. this
also has interesting implications for mass updates of packages

Regards,
Alistair


Home | Main Index | Thread Index | Old Index