PaulHowarth/Blog/2006-08-24

Thursday 24th August 2006

Local Packages

Made some significant changes to my buildsystem:

  • Used suggestions from Extras/MockTricks to enable the autocache of mock buildroots to speed up mock. It's interesting to see how much the size of the minimal buildroot (the packages listed at fedoraProject:Packaging/Guidelines#Exceptions plus their dependencies) changes between distributions:

    $ ls -l /var/lib/mock/root-cache/
    total 1915456
    -rw-rw-r-- 1 root mock  81888007 Aug 24 11:42 centos-3-i386.tar.gz
    -rw-rw-r-- 1 root mock  85405813 Aug 24 11:54 centos-3-x86_64.tar.gz
    -rw-rw-r-- 1 root mock 121852773 Aug 24 11:40 centos-4-i386.tar.gz
    -rw-rw-r-- 1 root mock 128487310 Aug 24 11:52 centos-4-x86_64.tar.gz
    -rw-rw-r-- 1 root mock  89651706 Aug 24 11:31 fedora-1-i386-core.tar.gz
    -rw-rw-r-- 1 root mock  92763322 Aug 24 11:21 fedora-2-i386-core.tar.gz
    -rw-rw-r-- 1 root mock 130415162 Aug 24 11:11 fedora-3-i386-core.tar.gz
    -rw-rw-r-- 1 root mock 138236605 Aug 24 11:03 fedora-4-i386-core.tar.gz
    -rw-rw-r-- 1 root mock 143118349 Aug 24 11:58 fedora-4-x86_64-core.tar.gz
    -rw-rw-r-- 1 root mock 128570517 Aug 24 10:59 fedora-5-i386-core.tar.gz
    -rw-rw-r-- 1 root mock 132355621 Aug 24 12:06 fedora-5-x86_64-core.tar.gz
    -rw-rw-r-- 1 root mock 223028304 Aug 24 10:53 fedora-development-i386-core.tar.gz
    -rw-rw-r-- 1 root mock 229692899 Aug 24 10:40 fedora-development-x86_64-core.tar.gz
    -rw-rw-r-- 1 root mock  57085074 Aug 24 11:48 redhat-73-i386.tar.gz
    -rw-rw-r-- 1 root mock  86610677 Aug 24 11:46 redhat-8-i386.tar.gz
    -rw-rw-r-- 1 root mock  90143315 Aug 24 11:44 redhat-9-i386.tar.gz
  • Also from Extras/MockTricks, I set up a local squid cache. This isn't needed for any of the current distribution releases I'm building for since I keep local mirrors of those, but it enables me to build packages for rawhide without having to constantly re-download lots of large packages.

  • I made myself a wrapper script (mb) to run mock, so as to ensure that I don't forget to use the --autocache option or use setarch i386 for 32-bit builds. It also gives me a shorthand notation for the distributions, so I can do:

    $ mb fc4.32 some.src.rpm
    $ mb fc4.64 some.src.rpm
  • and I'll get 32 and 64 bit builds for FC4 :-)

  • Here's the script in case it's of any use to anyone (it'll need tweaking):
    # mb: mock build
    # mb distro.archbits options ...
    #
    # e.g.
    # mb rhl7.32 rebuild some.rpm
    # mb fc5.64 rebuild some.rpm
    
    # How to use mb
    usage () {
            echo "mb: usage: mb distro.archbits options ..."
    }
    
    # Parse distro.archbits
    case "$#" in
    0|1)    usage 1>&2
            exit 1;;
    *)      root="$1"
            shift;;
    esac
    distro=${root/%.*/}
    archbits=${root/#*.}
    if [ "${distro}.${archbits}" != "$root" ]; then
            echo "mb: cannot parse distro.archbits: $root" 1>&2
            exit 1
    fi
    
    # Only valid values for archbits are 32 and 64
    case "$archbits" in
    32|64)  ;;
    *)      echo "mb: archbits should be 32 or 64: $archbits"
            exit 1;;
    esac
    
    # Only valid values for distro are rhl[7-9], rhel[3-4], fc[1-6]
    case "$distro" in
    rhl7|rhl8|rhl9)                 ;;
    rhel3|rhel4)                    ;;
    fc1|fc2|fc3|fc4|fc5|fc6)        ;;
    *)      echo "mb: valid distros are: rhl[7-9], rhel[3-4], fc[1-6]" 1>&2
            exit 1;;
    esac
    
    # Work out buildroot name
    case "$root" in
    rhl7.32)        buildroot=redhat-73-i386;;
    rhl8.32)        buildroot=redhat-8-i386;;
    rhl9.32)        buildroot=redhat-9-i386;;
    rhel3.32)       buildroot=centos-3-i386;;
    rhel3.64)       buildroot=centos-3-x86_64;;
    rhel4.32)       buildroot=centos-4-i386;;
    rhel4.64)       buildroot=centos-4-x86_64;;
    fc1.32)         buildroot=fedora-1-i386-core;;
    fc2.32)         buildroot=fedora-2-i386-core;;
    fc3.32)         buildroot=fedora-3-i386-core;;
    fc4.32)         buildroot=fedora-4-i386-core;;
    fc4.64)         buildroot=fedora-4-x86_64-core;;
    fc5.32)         buildroot=fedora-5-i386-core;;
    fc5.64)         buildroot=fedora-5-x86_64-core;;
    fc6.32)         buildroot=fedora-devel-i386-core;;
    fc6.64)         buildroot=fedora-devel-x86_64-core;;
    *)              echo "mb: unsupported distribution/architecture: $root" 1>&2
                    exit 1;;
    esac
    
    # Run mock
    case $archbits in
    32)     echo setarch i386 mock --autocache -r $buildroot "$@"
            setarch i386 mock --autocache -r $buildroot "$@";;
    64)     echo mock --autocache -r $buildroot "$@"
            mock --autocache -r $buildroot "$@";;
    esac
  • Updated buildsys-macros to use the next major release version if the release version number extracted from /etc/redhat-release has a number larger than 80 after a decimal point. So for instance, building it on the current rawhide (FC 5.91) returns:

    dist .fc6
    fedora 6


Recent