Richard Lowe
2018-01-18 4505fe56c6e4b8079e24ecdedbe941a0d3c3854c
make-rules: use 'pkgdepend resolve -e' and REQUIRED_PACKAGES

The pkg(5) in OI is new enough now to allow the use of 'pkgdepend
resolve -e' to vastly reduce build times at the expense of manually
maintaining a list of dependencies.

This change allows that to happen in the "new" way, using the
REQUIRED_PACKAGES list that most Makefiles already contain, rather than
the "old" way way, using a static resolve.deps which was never actively
used in OI.
62 files deleted
3 files modified
249 ■■■■ changed files
components/archiver/bzip2/resolve.deps 2 ●●●●● patch | view | raw | blame | history
components/archiver/zip/resolve.deps 2 ●●●●● patch | view | raw | blame | history
components/developer/automake-1.10/resolve.deps 2 ●●●●● patch | view | raw | blame | history
components/developer/dejagnu/resolve.deps 2 ●●●●● patch | view | raw | blame | history
components/editor/emacs/README 2 ●●● patch | view | raw | blame | history
components/elinks/resolve.deps 7 ●●●●● patch | view | raw | blame | history
components/enscript/resolve.deps 5 ●●●●● patch | view | raw | blame | history
components/findutils/resolve.deps 1 ●●●● patch | view | raw | blame | history
components/foomatic/db-engine/resolve.deps 4 ●●●● patch | view | raw | blame | history
components/foomatic/filters/resolve.deps 4 ●●●● patch | view | raw | blame | history
components/gdbm/resolve.deps 1 ●●●● patch | view | raw | blame | history
components/gnupth/resolve.deps 2 ●●●●● patch | view | raw | blame | history
components/gocr/resolve.deps 3 ●●●●● patch | view | raw | blame | history
components/gutenprint/resolve.deps 12 ●●●●● patch | view | raw | blame | history
components/hexedit/resolve.deps 1 ●●●● patch | view | raw | blame | history
components/iftop/resolve.deps 4 ●●●● patch | view | raw | blame | history
components/ircii/resolve.deps 1 ●●●● patch | view | raw | blame | history
components/ksh93/resolve.deps 3 ●●●●● patch | view | raw | blame | history
components/lft/resolve.deps 2 ●●●●● patch | view | raw | blame | history
components/libmcrypt/resolve.deps 2 ●●●●● patch | view | raw | blame | history
components/libmng/resolve.deps 5 ●●●●● patch | view | raw | blame | history
components/library/aalib/resolve.deps 5 ●●●●● patch | view | raw | blame | history
components/library/libdnet/resolve.deps 2 ●●●●● patch | view | raw | blame | history
components/library/libevent/resolve.deps 1 ●●●● patch | view | raw | blame | history
components/library/libneon/resolve.deps 7 ●●●●● patch | view | raw | blame | history
components/library/popt/resolve.deps 1 ●●●● patch | view | raw | blame | history
components/library/readline/resolve.deps 1 ●●●● patch | view | raw | blame | history
components/library/slang/resolve.deps 7 ●●●●● patch | view | raw | blame | history
components/library/zlib/resolve.deps 1 ●●●● patch | view | raw | blame | history
components/libtecla/resolve.deps 1 ●●●● patch | view | raw | blame | history
components/libusb/ugen/resolve.deps 2 ●●●●● patch | view | raw | blame | history
components/libusb/wrapper/resolve.deps 3 ●●●●● patch | view | raw | blame | history
components/nethack/resolve.deps 7 ●●●●● patch | view | raw | blame | history
components/network/isc-dhcp/resolve.deps 4 ●●●● patch | view | raw | blame | history
components/network/lftp/resolve.deps 9 ●●●●● patch | view | raw | blame | history
components/open-fabrics/resolve.deps 10 ●●●●● patch | view | raw | blame | history
components/pam_pkcs11/resolve.deps 3 ●●●●● patch | view | raw | blame | history
components/pconsole/resolve.deps 3 ●●●●● patch | view | raw | blame | history
components/psutils/resolve.deps 3 ●●●●● patch | view | raw | blame | history
components/quagga/resolve.deps 5 ●●●●● patch | view | raw | blame | history
components/shell/getopt/resolve.deps 1 ●●●● patch | view | raw | blame | history
components/shell/parallel/resolve.deps 3 ●●●●● patch | view | raw | blame | history
components/shell/which/resolve.deps 1 ●●●● patch | view | raw | blame | history
components/slib/resolve.deps 1 ●●●● patch | view | raw | blame | history
components/slrn/resolve.deps 3 ●●●●● patch | view | raw | blame | history
components/spawn-fcgi/resolve.deps 1 ●●●● patch | view | raw | blame | history
components/stunnel/resolve.deps 3 ●●●●● patch | view | raw | blame | history
components/sysutils/fping/resolve.deps 1 ●●●● patch | view | raw | blame | history
components/sysutils/pv/resolve.deps 1 ●●●● patch | view | raw | blame | history
components/sysutils/pwgen/resolve.deps 1 ●●●● patch | view | raw | blame | history
components/sysutils/tree/resolve.deps 1 ●●●● patch | view | raw | blame | history
components/tcl/expect/resolve.deps 5 ●●●●● patch | view | raw | blame | history
components/text/groff/resolve.deps 11 ●●●●● patch | view | raw | blame | history
components/text/less/resolve.deps 2 ●●●●● patch | view | raw | blame | history
components/text/patch/resolve.deps 1 ●●●● patch | view | raw | blame | history
components/wdiff/resolve.deps 2 ●●●●● patch | view | raw | blame | history
components/web/lynx/resolve.deps 4 ●●●● patch | view | raw | blame | history
components/x11/xcb-util-cursor/resolve.deps 1 ●●●● patch | view | raw | blame | history
components/x11/xcb-util-image/resolve.deps 1 ●●●● patch | view | raw | blame | history
components/x11/xcb-util-keysyms/resolve.deps 1 ●●●● patch | view | raw | blame | history
components/x11/xcb-util-renderutil/resolve.deps 1 ●●●● patch | view | raw | blame | history
components/x11/xcb-util-wm/resolve.deps 1 ●●●● patch | view | raw | blame | history
components/x11/xcb-util/resolve.deps 1 ●●●● patch | view | raw | blame | history
doc/packaging.txt 20 ●●●●● patch | view | raw | blame | history
make-rules/ips.mk 39 ●●●●● patch | view | raw | blame | history
components/archiver/bzip2/resolve.deps
File was deleted
components/archiver/zip/resolve.deps
File was deleted
components/developer/automake-1.10/resolve.deps
File was deleted
components/developer/dejagnu/resolve.deps
File was deleted
components/editor/emacs/README
@@ -142,7 +142,7 @@
  emacs without issue. This is something that should be reverified
  with each update.
- Remember to update resolve.deps when updating to a new version,
- Remember to update REQUIRED_PACKAGES when updating to a new version,
  as dependencies can change. Instructions are on the Userland website.
- We deliver the following packages:
components/elinks/resolve.deps
File was deleted
components/enscript/resolve.deps
File was deleted
components/findutils/resolve.deps
File was deleted
components/foomatic/db-engine/resolve.deps
File was deleted
components/foomatic/filters/resolve.deps
File was deleted
components/gdbm/resolve.deps
File was deleted
components/gnupth/resolve.deps
File was deleted
components/gocr/resolve.deps
File was deleted
components/gutenprint/resolve.deps
File was deleted
components/hexedit/resolve.deps
File was deleted
components/iftop/resolve.deps
File was deleted
components/ircii/resolve.deps
File was deleted
components/ksh93/resolve.deps
File was deleted
components/lft/resolve.deps
File was deleted
components/libmcrypt/resolve.deps
File was deleted
components/libmng/resolve.deps
File was deleted
components/library/aalib/resolve.deps
File was deleted
components/library/libdnet/resolve.deps
File was deleted
components/library/libevent/resolve.deps
File was deleted
components/library/libneon/resolve.deps
File was deleted
components/library/popt/resolve.deps
File was deleted
components/library/readline/resolve.deps
File was deleted
components/library/slang/resolve.deps
File was deleted
components/library/zlib/resolve.deps
File was deleted
components/libtecla/resolve.deps
File was deleted
components/libusb/ugen/resolve.deps
File was deleted
components/libusb/wrapper/resolve.deps
File was deleted
components/nethack/resolve.deps
File was deleted
components/network/isc-dhcp/resolve.deps
File was deleted
components/network/lftp/resolve.deps
File was deleted
components/open-fabrics/resolve.deps
File was deleted
components/pam_pkcs11/resolve.deps
File was deleted
components/pconsole/resolve.deps
File was deleted
components/psutils/resolve.deps
File was deleted
components/quagga/resolve.deps
File was deleted
components/shell/getopt/resolve.deps
File was deleted
components/shell/parallel/resolve.deps
File was deleted
components/shell/which/resolve.deps
File was deleted
components/slib/resolve.deps
File was deleted
components/slrn/resolve.deps
File was deleted
components/spawn-fcgi/resolve.deps
File was deleted
components/stunnel/resolve.deps
File was deleted
components/sysutils/fping/resolve.deps
File was deleted
components/sysutils/pv/resolve.deps
File was deleted
components/sysutils/pwgen/resolve.deps
File was deleted
components/sysutils/tree/resolve.deps
File was deleted
components/tcl/expect/resolve.deps
File was deleted
components/text/groff/resolve.deps
File was deleted
components/text/less/resolve.deps
File was deleted
components/text/patch/resolve.deps
File was deleted
components/wdiff/resolve.deps
File was deleted
components/web/lynx/resolve.deps
File was deleted
components/x11/xcb-util-cursor/resolve.deps
File was deleted
components/x11/xcb-util-image/resolve.deps
File was deleted
components/x11/xcb-util-keysyms/resolve.deps
File was deleted
components/x11/xcb-util-renderutil/resolve.deps
File was deleted
components/x11/xcb-util-wm/resolve.deps
File was deleted
components/x11/xcb-util/resolve.deps
File was deleted
doc/packaging.txt
@@ -109,18 +109,16 @@
    a .depend.res copy in the build directory, the umbrella dependency
    resolution target is {build-dir}/.resolved-$(MACH).
    The resolution step is also set up to use the -e flag to pkgdepend resolve,
    which limits the set of packages it looks at to resolve the dependencies it
    generated in the previous step.  This makes the resolution step a great deal
    faster, but requires that you keep a static list of these packages checked
    into the workspace, and update it when packages are added to it.  Having
    extra packages in there is safe.
    The resolution step is also set up to use the -e flag to pkgdepend
    resolve, which limits the set of packages it looks at to resolve the
    dependencies it generated in the previous step.  This makes the resolution
    step a great deal faster, but requires that you keep a static list of
    these packages, and update it when packages are added to it.  Having extra
    packages in there is safe.
    In order to create this list, build and publish your component (or at least
    through the resolution stage) without a file "resolve.deps" in the component
    directory, and run "gmake sample-resolve.deps".  If the file is empty (that
    is, no computed dependencies were found), a warning will be emitted and the
    file will be removed, as pkgdepend currently errors out in that case.
    This list is kept as the REQUIRED_PACKAGES list in your component
    Makefile, which you must append to (as shared-rules introduce some
    packages there themselves for your benefit).
    To test, run "gmake clean" and re-publish.
make-rules/ips.mk
@@ -18,7 +18,7 @@
#
# CDDL HEADER END
#
# Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
# Copyright 2014 Andrzej Szeszo. All rights reserved.
#
@@ -376,31 +376,24 @@
$(MANIFEST_BASE)-%.depend:    $(MANIFEST_BASE)-%.mangled
    $(PKGDEPEND) generate $(PKGDEPEND_GENERATE_OPTIONS) $< >$@
# These files should contain a list of packages that the component is known to
# depend on.  Using resolve.deps is not required, but significantly speeds up
# the "pkg resolve" step.
# XXX existing pkg5 is too old for that
#EXTDEPFILES = $(wildcard $(sort $(addsuffix ../resolve.deps, $(dir $(DEPENDED)))))
# pkgdepend resolve builds a map of all installed packages by default.  This
# makes dependency resolution particularly slow.  We can dramatically improve
# performance here by creating a file with a list of packages that we know
# are needed, dramatically reducing the overhead involved in creating and
# searching this map.
#
# Generate a resolve.deps file from the dependencies in the Makefile and
# fragments that it uses.
RESOLVE_DEPS=$(BUILD_DIR)/resolve.deps
# This is a target that should only be run by hand, and not something that
# .resolved-$(MACH) should depend on.
sample-resolve.deps:
    echo "<transform depend type=(require|require-any) -> print %(fmri)>" > rd-trans
    for i in build/*.depend; do \
        $(PKGMOGRIFY) -O /dev/null $$i rd-trans | tr " " "\n" | sort -u > m1; \
        $(PKGMOGRIFY) -O /dev/null $$i.res rd-trans | tr " " "\n" | sort -u > m2; \
        comm -13 m1 m2; \
    done | sed -e 's/@[^ ]*//g' -e 's,pkg:/,,g' | sort -u > resolve.deps
    $(RM) rd-trans m1 m2
    if [[ ! -s resolve.deps ]]; then \
        echo "No computed dependencies found; removing empty resolve.deps."; \
        $(RM) resolve.deps; \
    fi
$(RESOLVE_DEPS):    Makefile $(BUILD_DIR)
    @for pkg in $(REQUIRED_PACKAGES:%=/%) ; do \
        echo $${pkg} ; \
    done | sort -u >$@
# resolve the dependencies all at once
$(BUILD_DIR)/.resolved-$(MACH):    $(DEPENDED)
    $(PKGDEPEND) resolve $(EXTDEPFILES:%=-e %) -m $(DEPENDED)
$(BUILD_DIR)/.resolved-$(MACH):    $(DEPENDED) $(RESOLVE_DEPS)
    $(PKGDEPEND) resolve $(RESOLVE_DEPS:%=-e %) -m $(DEPENDED)
    $(TOUCH) $@
#