portage-2.1.8 has new –rebuilt-binaries option

In portage-2.1.8 there’s a new emerge –rebuilt-binaries option that is very useful for people who build binary packages and install them on multiple computers (using PORTAGE_BINHOST or shared PKGDIR). The option causes packages to be automatically reinstalled in cases when rebuilt binary packages are available (due to revdep-rebuild or similar cases). Rebuilds are detected by comparison of BUILD_TIME package metadata. This option is enabled automatically when using binary packages (–usepkgonly or –getbinpkgonly) together with –update and –deep.

9 thoughts on “portage-2.1.8 has new –rebuilt-binaries option”

  1. Very nice.

    I’m writting on an automatic update system for a school. One binhost with many clients syncing from it.
    As I use bashrc to modify packages anyway I included a script to modify the revision number of a binary package to match the buildtime. I have to review it now if it is still needed. Hope not.

    Thanks for that

  2. Hey Zac, you mention in bug 306659 a script to add missing BUILD_TIME fields to $PKGDIR/Packages. Does that exist somewhere?

  3. I didn’t make a script for updating $PKGDIR/Packages because it’s non-essential. If you really need it for some reason, you can just remove $PKGDIR/Packages and then run `emaint –fix binhost` to regenerate it.

  4. I tried the emaint fix, but packages built with the older portage were still missing BUILD_TIMEs. Also, I tried recreating a package with quickpkg, and it didn’t add BUILD_TIME either. Its working well for packages rebuilt with portage-2.1.8 though.

  5. Right, you need to build your new packages with >=portage-2.1.8, or else –rebuilt-binaries won’t help you. I have a script that uses the BINPKGMD5 metadata (which is supported by older portage) to generate a list of atoms to reinstall:

    #!/usr/bin/python
    # Compare /var/db/pkg/*/*/BINPKGMD5 against the current packages in
    # $PKGDIR and list those that differ. Run `emaint --fix binhost` before
    # using this script. This script is superceded by the emerge
    # --rebuilt-binaries option which is supported by >=portage-2.1.8.
    
    import sys
    import portage
    
    settings = portage.settings
    bintree = portage.db[settings['ROOT']]['bintree']
    vardb = portage.db[settings['ROOT']]['vartree'].dbapi
    pkgindex = bintree._load_pkgindex()
    
    binpkg_hashes = {}
    for d in pkgindex.packages:
    	binpkg_hashes[d['CPV']] = d['MD5']
    
    aux_keys = ['BINPKGMD5', 'SLOT']
    for cpv in vardb.cpv_all():
    	binpkg_md5 = binpkg_hashes.get(cpv)
    	if binpkg_md5 is None:
    		continue
    	md5, slot = vardb.aux_get(cpv, aux_keys)
    	if md5 != binpkg_md5:
    		sys.stdout.write("%s:%sn" % (portage.cpv_getkey(cpv), slot))
    		sys.stdout.flush()
    

Comments are closed.