Makefile revision 1261
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley###############################################################################
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley# Makefile for X Consolidation packages
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley# Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley# Permission is hereby granted, free of charge, to any person obtaining a
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley# copy of this software and associated documentation files (the "Software"),
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley# to deal in the Software without restriction, including without limitation
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley# the rights to use, copy, modify, merge, publish, distribute, sublicense,
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley# and/or sell copies of the Software, and to permit persons to whom the
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley# Software is furnished to do so, subject to the following conditions:
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley# The above copyright notice and this permission notice (including the next
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley# paragraph) shall be included in all copies or substantial portions of the
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley# DEALINGS IN THE SOFTWARE.
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley###############################################################################
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley# Heavily inspired by / borrowed from the ON usr/src/pkg/Makefile
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley# Please read the comments in it and the accompanying README in ON for many
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley# details omitted here.
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley# Major differences in the X implementation:
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley# - X only supports building one repo, not redist + extra
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley# - X only supports building packages on the same platform as the binaries,
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley# no cross-platform packaging
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley# - X has no bfu legacy to deal with
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley# - ON has all manifests in one directory, X splits into current & legacy
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley# - Integrates with X consolidation makefile/build system instead of ON's
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley### Include common definitions
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley# We don't yet support building packages cross-architecture, but would
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley# need this if we ever did. (See "Cross platform packaging notes" in
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley# the ON usr/src/pkg/Makefile for what we'd have to do.)
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley# Map X makefile names to the ones used in the rules copied from ON
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley# More to be updated if we ever decide to support building cross-platform
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley# Map the V=1 style of enabling more verbose build messages used in the
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley# X.Org/automake builds to the macro used in the rules copied from ON
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley# You can enable verbose output with either V=1 or PKGDEBUG=""
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley# Commands used in rules copied from ON
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley# To suppress package dependency generation on any system, regardless
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley# of how it was installed, set SUPPRESSPKGDEP=true in the build
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley# environment.
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley# The packages directory will contain the processed manifests as
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley# direct build targets and subdirectories for package metadata extracted
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley# incidentally during manifest processing.
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley# Nothing underneath $(PDIR) should ever be managed by SCM.
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley# By default, PKGS will list all manifests. To build and/or publish a
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley# subset of packages, override this on the command line or in the
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley# build environment and then reference (implicitly or explicitly) the all
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley# or install targets.
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob HalleyCURRENT_MANIFESTS :sh= (cd manifests; print *.p5m)
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob HalleyMANIFESTS = $(CURRENT_MANIFESTS) $(LEGACY_MANIFESTS)
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley# Track the synthetic manifests separately so we can properly express
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley# build rules and dependencies. The synthetic and real packages use
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley# different sets of transforms and macros for pkgmogrify.
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley# Special manifest for exceptions to pass to pkglint & validate_pkg
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley# Manifests are in either manifests or legacy directory - merge in $(PDIR)
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob HalleyALL_MANIFESTS = $(PMANIFESTS) $(SMANIFESTS) $(EMANIFESTS)
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley### Additional metadata generation
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley# This should eventually move into pkg publication
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob HalleyFONT_MANIFESTS :sh= (cd manifests; print system-font-*.p5m)
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob HalleyFONT_METADATA = $(FONT_MANIFESTS:%.p5m=$(PDIR)/%.font)
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob HalleyFONT_ATTRS = $(FONT_MANIFESTS:%.p5m=$(PDIR)/%.attr)
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley### Manifest mogrification
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley# RELEASE = uname -r for the target release
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley# The PKGVERS_BRANCH is determined by the values in the Makefile.buildnum
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob HalleyPKGVERS_BRANCH_MAIN = 0.$(TRUNKID).$(UPDATENUM).$(SRUNUM).$(PLATNUM)
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob HalleyPKGVERS_BRANCH = $(PKGVERS_BRANCH_MAIN).$(BUILDID).$(NIGHTLYID)
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob HalleyPKGVERS_BUILD = $(PKGVERS_BUILTON)-$(PKGVERS_BRANCH)
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley# Generate pkgmogrify transform file with correct build version info in
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley# Build number is derived from last nv_XXX tag in hg log
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley$(PDIR)/versions: transforms/versions.tmpl $(PDIR)
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley @print "## Substituting build info in versions transformation template"
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley $(PERL) -p -e "s{_PKGVERS_BUILD_}{$(PKGVERS_BUILD)};" \
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley -e "s{_HG_ID_}{$${HG_ID}}" transforms/versions.tmpl > $@
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley# Set variables used by pkgmogrify
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley# These are the macros that may be used in package manifests
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley# Most upstream packages provide specific version numbers instead of using
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley# the default of $(OSPKGVERS)
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley# Some use $(X11PKGVERS) to refer to the X11 katamari version since they
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley# bundle together components from multiple upstream packages with individual
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley# version numbers
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley# Base URL for ARC cases used in opensolaris.arc_url metadata
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob HalleyPKGMOG_DEFINES += ARC_URL='http://arc.opensolaris.org/caselog/'
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley# Platform specific choices
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob HalleyPKGMOG_DEFINES += i386_ONLY=$(POUND_SIGN) sparc_ONLY=$(POUND_SIGN)
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley# Architecture specific directory names
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley# Perl version string used in package names, such as pkg:/runtime/perl-512
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob HalleyPERL_PKG_VERSION_CMD = print $(PERL_VERSION) | tr -d '.'
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob HalleyPKGMOG_DEFINES += PERL_PKG_VERSION=$(PERL_PKG_VERSION_CMD:sh)
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley# Python version string used in path names, such as /usr/lib/python2.6
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob HalleyPKGMOG_DEFINES += PYTHON_PATH_VERSION=$(PYTHON_VERSION)
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley# Python version string used in package names, such as pkg:/runtime/python-26
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob HalleyPYTHON_PKG_VERSION_CMD = print $(PYTHON_VERSION) | tr -d '.'
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob HalleyPKGMOG_DEFINES += PYTHON_PKG_VERSION=$(PYTHON_PKG_VERSION_CMD:sh)
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob HalleyPROC_CURRENT_PKGS = $(CURRENT_MANIFESTS:%.p5m=$(PDIR)/%.mog)
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob HalleyPROC_LEGACY_PKGS = $(LEGACY_MANIFESTS:%.p5m=$(PDIR)/%.mog)
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob HalleyPROC_SYNTH_PKGS = $(SYNTH_MANIFESTS:%.p5m=$(PDIR)/%.mog)
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob HalleyPROC_EXCEPTIONS = $(EXCEPTION_MANIFESTS:%.p5m=$(PDIR)/%.mog)
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley# Default transformations to apply
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley# Additional transforms for specific types of packages
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley$(PROC_CURRENT_PKGS) $(PROC_SYNTH_PKGS) $(PROC_EXCEPTIONS) := \
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley# Combine & uniq metadata & license attributes generated during build
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley @print "## Gathering metadata from build for $(@F)"
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley system-font-*) ADDITIONAL_ATTRS="$(@:%.attr=%.font)" ;; \
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley ~(N)$(PROTOMETA)/$(@F:.attr=)/license_*.p5m /dev/null > $@
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley $(PKGDEBUG)$(PKGMOGRIFY) $(PKGMOG_VERBOSE) $(PM_INC:%= -I %) \
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley### Dependency detection
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley# Package manifest containing list of packages to use in dependency
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley# resolution, and not containing any dependencies to be detected/resolved.
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob HalleyDEP_CURRENT_PKGS_1 = $(CURRENT_MANIFESTS:%.p5m=$(PDIR)/%.dep)
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob HalleyDEP_CURRENT_PKGS = $(DEP_CURRENT_PKGS_1:$(PDIR)/$(DEP_LIST_PKG).dep=)
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob HalleyDEP_LEGACY_PKGS = $(LEGACY_MANIFESTS:%.p5m=$(PDIR)/%.dep)
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob HalleyDEP_LEGACY_PKGS += $(DEP_LIST_PKG:%=$(PDIR)/%.dep)
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob HalleyDEP_SYNTH_PKGS = $(SYNTH_MANIFESTS:%.p5m=$(PDIR)/%.dep)
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley 'PLATFORM=i86hvm' \
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley 'PLATFORM=i86pc' \
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley 'PLATFORM=i86xpv' \
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley 'ISALIST=amd64' \
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley 'ISALIST=i386'
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley 'PLATFORM=sun4u' \
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley 'PLATFORM=sun4v' \
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley 'ISALIST=sparcv9' \
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley 'ISALIST=sparc'
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley $(PKGDEBUG)if [[ "$(SUPPRESSPKGDEP)" != "true" ]]; then \
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley pkgdepend generate -m $(PKGDEP_TOKENS:%=-D %) $(<) \
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley$(DEP_SYNTH_PKGS) $(DEP_LEGACY_PKGS): $$(@:%.dep=%.mog)
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley @print "## Skipping dependency generation for $(@F:%.dep=%)"
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley### Dependency resolution
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob HalleyDEP_RES_CURRENT_PKGS = $(DEP_CURRENT_PKGS:%=%.res)
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley# Root of pkg image to use for dependency resolution
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley# Normally / on the machine used to build the binaries
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley# File listing packages to consider in dependency resolution.
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley# Automatically generated from the developer package to ensure they
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley# stay in sync.
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley$(PKGDEP_RESOLVE_LIST): $(PDIR)/$(DEP_LIST_PKG).mog
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley @print "## Generating package list for dependency resolution"
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley $(PKGDEBUG)$(PKGMOGRIFY) $(PKGMOG_VERBOSE) $(PM_INC:%= -I %) \
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley -O /dev/null -P $(@) $(PDIR)/$(DEP_LIST_PKG).mog extract_depends
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley# This rule resolves dependencies across all manifests for packages
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley# currently delivering files.
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley$(PDIR)/gendeps: $(DEP_CURRENT_PKGS) $(PKGDEP_RESOLVE_LIST)
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley $(PKGDEBUG)if [[ "$(SUPPRESSPKGDEP)" = "true" ]]; then \
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley print "## Suppressing dependency resolution"; \
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley print "## Resolving dependencies"; \
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley pkgdepend -R $(PKGDEP_RESOLVE_IMAGE) resolve -E \
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley $(PKGDEP_VERBOSE_FLAG) -e $(PKGDEP_RESOLVE_LIST) \
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley$(DEP_RES_SYNTH_PKGS) $(DEP_RES_LEGACY_PKGS): $$(@:%.dep.res=%.dep)
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley @print "## Skipping dependency generation for $(@F:%.dep.res=%)"
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley# Post-processing of manifests after dependency resolution
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob HalleyRES_CURRENT_PKGS = $(CURRENT_MANIFESTS:%.p5m=$(PDIR)/%.res)
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob HalleyRES_LEGACY_PKGS = $(LEGACY_MANIFESTS:%.p5m=$(PDIR)/%.res)
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob HalleyRES_SYNTH_PKGS = $(SYNTH_MANIFESTS:%.p5m=$(PDIR)/%.res)
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley @print "## Post-processing manifest for $(@F:%.res=%)"
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley $(PKGDEBUG)if [[ -s $< ]] ; then \
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley $(PKGMOGRIFY) $(PKGMOG_VERBOSE) $(PM_INC:%= -I %) \
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley -O $@ -P $(@:%.res=%.synth) $< $(POST_TRANSFORMS) ; \
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley $(CP) $< $@ ; \
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley# Generate info for synthetic manifests
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley$(RES_SYNTH_PKGS): $(RES_PKGS) $$(@:%.res=%.dep.res)
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley @print "## Gathering package lists for synthetic package $(@F:%.res=%)"
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley $(PKGDEBUG)$(PKGMOGRIFY) $(PKGMOG_VERBOSE) $(PM_INC:%= -I %) \
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley $(PKGDEBUG)$(SED) -n -f $(@:%.res=%.synth.sed) $(PDIR)/*.synth >> $(@)
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley### pkglint checking (pre-publication)
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley# This rule runs pkglint across all manifests to be published.
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley# We require that packages be free from lint ERRORs before allowing them
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley# to be published. Lint WARNINGs are acceptable (though unpleasant)
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley# The list of packages is the list of packages that did not resolve to
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley# 0-byte files, $CHECK_PKGS
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley$(PDIR)/checkmf: $(PDIR)/gendeps $(DEP_SYNTH_PKGS) $(DEP_PKGS)
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley @print "## Checking packages"
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley -$(PKGDEBUG)for p in $(DEP_SYNTH_PKGS:%.dep=%) $(DEP_PKGS:%.dep=%); do \
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley if [[ -s $$p.res ]]; then \
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley if [[ -n "$${CHECK_PKGS}" ]]; then \
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley $(PKGLINT) -f $(PKGLINTRC) $${CHECK_PKGS} $(PROC_EXCEPTIONS) \
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley if grep '^ERROR' $(PDIR)/pkglint-output.txt; then \
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley### Repo setup
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley# Default in developer builds is "xnv-devel"
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley# X RE cronjob build scripts override to "xnv-nightly"
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley# Initialize the empty on-disk repositories
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley $(PKGDEBUG)pkgrepo add-publisher -s $(@) $(PKGPUBLISHER)
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley### Package publication to repo
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob HalleyPUB_PKGS= $(SYNTH_PKGS:%=$(PDIR)/%.pub) $(PKGS:%=$(PDIR)/%.pub)
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halleypublish_pkgs: $(PKGDEST) $(PDIR)/gendeps $(PDIR)/checkmf $(PUB_PKGS)
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley$(PUB_PKGS): $(PKGDEST) $(PDIR)/gendeps $(PDIR)/checkmf
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley$(PDIR)/%.pub: $(PKGDEST) $(PDIR)/gendeps $(PDIR)/%.res
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley print "## Publishing $(@F:%.pub=%) to proto repository"; \
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley --fmri-in-manifest --no-index --no-catalog -T '*.py' \
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley### Repo finalization
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley @print "## Creating repository metadata"
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley### pkglint checking (post-publication)
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley# Perform a pkglint run on the published repositories. We remove package
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley# version information from the lint output so that it is comparable across
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley @print "## Running pkglint on the $(PKGPUBLISHER) repository"
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley -l file://$(PKGDEST) -c /tmp/pkglint_cache.$$$$ \
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley > $(PDIR)/pkglint.out 2> $(PDIR)/pkglint.lint ; \
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley $(PKGDEBUG)$(SED) -e 's/@[0-9TZ.:,-]*//g' $(PDIR)/pkglint.lint
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley### Overall rules
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halleyall: $(PROC_PKGS) $(PROC_SYNTH_PKGS) $(DEP_PKGS) $(DEP_SYNTH_PKGS) \
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley# rules to validate proto area against manifests, and check for safe
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley# file permission modes
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob HalleyEXCEPTIONS= $(PWD)/../exception_lists/packaging $(PDIR)/generated-exceptions
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley# Automatically exclude all pkg-config uninstalled.pc files, since those
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley# should never be packaged
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley $(PKGDEBUG)(cd $(PKGROOT) ; find . -name '*-uninstalled.pc') > $@
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halleyprotocmp: $(PROC_PKGS) $(EXCEPTIONS) $(PROC_EXCEPTIONS) fix_perms
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley $(PKGDEBUG)validate_pkg -a $(PKGMACH) -v $(EXCEPTIONS:%=-e %) \
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley $(PKGDEBUG)validate_pkg -a $(PKGMACH) -M -m $(PDIR)
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley @print "## Checking for manifests not in pkgfmt expected form"
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley# Instead of fixing all the upstream packages to follow our permission rules
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley# just fix the proto area to match our rules
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley @print "## Fixing proto area permissions"
6ea1b817e31b89a627e146fe69e23ea0a64c89ecBob Halley $(PKGDEBUG)find $(PKGROOT) -type f -exec chmod a-w \{\} \+