pkgsrc-Users archive

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

Re: How to 'make package' after 'make install' has been done?



  I've just rebuilt a whole bunch of packages from source, and now that
  I've installed them on my build machine, I'd like to run 'make
  package' so I can install the binaries on my other machines without
  having to build them all over again from source.

  Reading the documentation on http://www.netbsd.org/docs/pkgsrc
  (section 6.1), it seems to say that all I have to do is run 'make
  package' which will "...build and install your package (if not already
  done), ..."
  this implies that it won't bother to reinstall if the package is
  already installed.  However, reality is that 'make package' complains
  that the package is "already installed, perhaps an older version".

  So, what's the magic incantation to build the binary package from the
  existing work.$MACHINE_ARCH directory?

Did you clean before doing 'make pakage'?  If so, then the install will
fail, and package depends on install.

pkg_tarup is useful as obache@ pointed out.

Two other bits of advice:

  run 'make package' instead of make install in the first place.

  set in mk.conf:

DEPENDS_TARGET=                 package
UPDATE_TARGET=                  package

so that you get packages for dependencies.


I use the following script prior to pkg_rolling-replace and it has a
loop to ensure there are binary packages for all installed packages:



#!/bin/sh

# $Id: _update-pkgsrc,v 1.14 2008/05/20 17:45:54 gdt Exp $

# Do automatic periodic maintenance in pkgsrc.  Typically followed
# by pkg_rolling-replace.

# Copyright 2007 Gregory D. Troxel
# Permission to copy granted under 3-clause BSD license.

# This script expects to be invoked as a user, and uses sudo.
# Consider invoking as root and a reverse su for cvs.  For now, do the
# sudo tasks early if possible.

# XXX This script assumes that it is operating in /usr/pkgsrc.  It
# should be extended to work with the current directory, checking that
# it is a pkgsrc directory.

if [ "$1" = "noupdate" ]; then
    noupdate=t
fi

# XXX Substitute this at build time.
MAKE=make
if [ `uname` = "Darwin" ]; then
    MAKE=bmake
fi

# Get new vulnerability data.
sudo download-vulnerability-list

# Ensure that we have binary packages for all installed packages.
mkdir -p /usr/pkgsrc/packages/All
rm -f PKG.missing
(cd /var/db/pkg && ls) \
    | while read d; do
    if [ -d /var/db/pkg/"$d" ]; then
        if [ ! -f /usr/pkgsrc/packages/All/"$d".tgz ]; then
            echo $d >> PKG.missing
            sudo pkg_tarup -d /usr/pkgsrc/packages/All $d
        fi
    fi
done
                
# List working directories (for manual cleanup).
rm -f PKG.WORK
ls -d */*/work > PKG.WORK
if [ ! -s PKG.WORK ]; then
    rm PKG.WORK
fi

# Update sources
rm -f PKG.UPDATE
if [ "$noupdate" = "" ]; then
    cvs -q up -d -P > PKG.UPDATE 2>&1
else
    echo "NOUPDATE" > PKG.UPDATE
fi

# Check for vulnerable packages.
rm -f PKG.AUDIT; audit-packages | sort > PKG.AUDIT

# Check for mismatched packages
rm -f PKG.MISMATCH; pkg_chk -uq | sort > PKG.MISMATCH

# Make a list of packages not required by anything else.
rm -f PKG.automatic-required PKG.automatic-notrequired \
    PKG.manual-required PKG.manual-notrequired
for d in `cd /var/db/pkg && ls`; do
    D=/var/db/pkg/$d
    DREQ=$D/+REQUIRED_BY
    DINS=$D/+INSTALLED_INFO
    REQ=notrequired
    AUTO=manual
    if [ ! -d $D ]; then
        continue;
    fi
    if [ -s $DREQ ]; then
        REQ=required
    fi
    if [ -f $DINS ] && egrep 'automatic=(yes|YES)' $DINS > /dev/null; then
        AUTO=automatic
    fi
    echo $d >> PKG.$AUTO-$REQ
done

# Remove distfiles that are out of date. 
lintpkgsrc -mor

# Ensure that we have sources for all packages that are installed,
# plus all packages requested.
pkg_chk -g
cat pkgchk.conf pkgchk-manual.conf | egrep -v \# | while read pkg; do
    echo $pkg
    (cd $pkg && $MAKE fetch)
done

# Make list of out-dated binary packages, separated by whether they
# are installed or not.
rm -f PKG.old-installed PKG.old-notinstalled
lintpkgsrc -p | egrep -v '^(Cannot extract|Bogus:)' | egrep . | while read p; do
    pbase=`basename $p .tgz`
    installed=notinstalled
    if [ -d /var/db/pkg/$pbase ]; then
        installed=installed
    fi
    echo "$p" >> PKG.old-$installed
done

# Delete binary packages that are old and not installed.
# This must be done after the cvs update, and thus will probably not
# be able to ride the sudo timer.
if [ -f PKG.old-notinstalled ]; then
    cat PKG.old-notinstalled | sudo xargs rm -f && \
        rm PKG.old-notinstalled
fi

Attachment: pgpDCOCgbo1ur.pgp
Description: PGP signature



Home | Main Index | Thread Index | Old Index