Alexander Pyhalov
2014-08-08 6185b3543717666197bc743a5dd2558e67eead85
Add encumbered packages logic
3 files added
5 files modified
97 ■■■■ changed files
components/Makefile 10 ●●●● patch | view | raw | blame | history
components/components.ignore 3 ●●●●● patch | view | raw | blame | history
components/encumbered/Makefile 20 ●●●●● patch | view | raw | blame | history
components/encumbered/components.ignore 1 ●●●● patch | view | raw | blame | history
make-rules/encumbered.mk 24 ●●●●● patch | view | raw | blame | history
make-rules/ips.mk 4 ●●●● patch | view | raw | blame | history
tools/bass-o-matic 11 ●●●●● patch | view | raw | blame | history
tools/python/pkglint/userland.py 24 ●●●●● patch | view | raw | blame | history
components/Makefile
@@ -21,7 +21,7 @@
# Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
#
include ../make-rules/shared-macros.mk
-include ../make-rules/shared-macros.mk
# for now, the assumption is we build any directory with a Makefile.  This may
# not always be the case. If we build a new make-like tool to drive the upper
@@ -38,7 +38,7 @@
        | sed -f components.ignore \
        | sed -e 's;^;COMPONENT_DIRS += ;g' >$@
-include components.mk
-include $(WS_TOP)/components/$(ENCUMBERED)components.mk
# depends.mk is auto-generated by concatenating 'depend.mk' files in each
# component directory.
@@ -50,7 +50,7 @@
        | sed -e 's;$$;/depend.mk;g') >$@ \
        2>/dev/null
 
-include depends.mk
-include $(WS_TOP)/components/$(ENCUMBERED)depends.mk
download:        TARGET = download
@@ -84,7 +84,7 @@
    $(RM) components.mk depends.mk .profile
clobber:    $(COMPONENT_DIRS.nosetup) clean
    @cd ../tools ; echo "clobbering tools..." ; $(GMAKE) clobber
    @cd $(WS_TOP)/tools ; echo "clobbering tools..." ; $(GMAKE) clobber
    $(RM) -r $(WS_REPO) $(WS_LOGS) $(WS_LINT_CACHE)
@@ -115,7 +115,7 @@
endif
tools:
    @cd ../tools ; echo "building tools..." ; $(GMAKE) clean setup
    @cd $(WS_TOP)/tools ; echo "building tools..." ; $(GMAKE) clean setup
# $(WS_COMPONENTS) is the home directory for the zone user, so create a profile
# to pass a few things on to zone based builds
components/components.ignore
@@ -12,6 +12,9 @@
# skip libm, it should be delivered by illumos-gate now
/^osol\/math$/d
# Don't publish encumbered packages by default
/^encumbered\//d
/^areca$/d
/^beanshell$/d
/^clisp$/d
components/encumbered/Makefile
New file
@@ -0,0 +1,20 @@
#
# This file and its contents are supplied under the terms of the
# Common Development and Distribution License ("CDDL"), version 1.0.
# You may only use this file in accordance with the terms of version
# 1.0 of the CDDL.
#
# A full copy of the text of the CDDL should have accompanied this
# source.  A copy of the CDDL is also available via the Internet at
# http://www.illumos.org/license/CDDL.
#
#
# Copyright 2015 Alexander Pyhalov
#
include ../../make-rules/shared-macros.mk
include $(WS_TOP)/make-rules/encumbered.mk
include $(WS_TOP)/components/Makefile
components/encumbered/components.ignore
New file
@@ -0,0 +1 @@
# this is a sed script
make-rules/encumbered.mk
New file
@@ -0,0 +1,24 @@
#
# This file and its contents are supplied under the terms of the
# Common Development and Distribution License ("CDDL"), version 1.0.
# You may only use this file in accordance with the terms of version
# 1.0 of the CDDL.
#
# A full copy of the text of the CDDL should have accompanied this
# source.  A copy of the CDDL is also available via the Internet at
# http://www.illumos.org/license/CDDL.
#
#
# Copyright 2015 Alexander Pyhalov
#
WS_REPO =       $(WS_TOP)/$(MACH)/encumbered-repo
COMPONENT_PKGLINT_ENV += ENCUMBERED=true
PUBLISHER  = hipster-encumbered
BASS_O_MATIC =  $(WS_TOOLS)/bass-o-matic --subdir=/components/encumbered
ENCUMBERED = encumbered/
make-rules/ips.mk
@@ -364,14 +364,14 @@
# lint the manifests all at once
$(BUILD_DIR)/.linted-$(MACH):    $(BUILD_DIR)/.resolved-$(MACH)
    @echo "VALIDATING MANIFEST CONTENT: $(RESOLVED)"
    $(ENV) PYTHONPATH=$(WS_TOOLS)/python PROTO_PATH="$(PKG_PROTO_DIRS)"\
    $(ENV) PYTHONPATH=$(WS_TOOLS)/python PROTO_PATH="$(PKG_PROTO_DIRS)" $(COMPONENT_PKGLINT_ENV)\
        $(PKGLINT) $(CANONICAL_REPO:%=-c $(WS_LINT_CACHE)) \
            -f $(WS_TOOLS)/pkglintrc $(RESOLVED)
    $(TOUCH) $@
lintme: FRC
    @echo "VALIDATING MANIFEST CONTENT: $(RESOLVED)"
    $(ENV) PYTHONPATH=$(WS_TOOLS)/python PROTO_PATH="$(PKG_PROTO_DIRS)"\
    $(ENV) PYTHONPATH=$(WS_TOOLS)/python PROTO_PATH="$(PKG_PROTO_DIRS)" $(COMPONENT_PKGLINT_ENV)\
        $(PKGLINT) $(CANONICAL_REPO:%=-c $(WS_LINT_CACHE)) \
            -f $(WS_TOOLS)/pkglintrc $(RESOLVED)
tools/bass-o-matic
@@ -35,7 +35,7 @@
# Locate SCM directories containing Userland components by searching from
# from a supplied top of tree for .p5m files.  Once a .p5m file is located,
# that directory is added to the list and no children are searched.
def FindComponentPaths(path, debug=None):
def FindComponentPaths(path, debug=None, subdir='/components'):
    expression = re.compile(".+\.p5m$", re.IGNORECASE)
    paths = []
@@ -43,7 +43,7 @@
    if debug:
        print >>debug, "searching %s for component directories" % path
    for dirpath, dirnames, filenames in os.walk(path + '/components'):
    for dirpath, dirnames, filenames in os.walk(path + subdir):
        found = 0
        for name in filenames:
@@ -126,12 +126,13 @@
    make_arg=None
    component_arg=None
    template_zone=None
    subdir="/components"
    workspace = os.getenv('WS_TOP')
    try:
        opts, args = getopt.getopt(sys.argv[1:], "w:c:d",
            [ "debug", "workspace=", "components=",
              "make", "component=", "template-zone=" ])
              "make", "component=", "template-zone=", "subdir=" ])
    except getopt.GetoptError, err:
        print str(err)
        usage()
@@ -147,12 +148,14 @@
            component_arg = arg
        elif opt in [ "--template-zone" ]:
            template_zone = arg
        elif opt in [ "--subdir" ]:
            subdir = arg
        elif opt in [ "-d", "--debug" ]:
            debug = sys.stdout
        else:
            assert False, "unknown option"
    component_paths = FindComponentPaths(workspace, debug)
    component_paths = FindComponentPaths(workspace, debug, subdir)
    if make_arg:
        if template_zone:
tools/python/pkglint/userland.py
@@ -28,10 +28,14 @@
import pkg.lint.base as base
from pkg.lint.engine import lint_fmri_successor
import pkg.fmri
import pkg.elf as elf
import re
import os.path
import subprocess
import pkg.client.api
import pkg.client.api_errors
import pkg.client.progress
class UserlandActionChecker(base.ActionChecker):
        """An opensolaris.org-specific class to check actions."""
@@ -443,6 +447,26 @@
    def __init__(self, config):
        super(UserlandManifestChecker, self).__init__(config)
    def forbidden_publisher(self, manifest, engine, pkglint_id="1001"):
        if not os.environ.get("ENCUMBERED"):
            for action in manifest.gen_actions_by_type("depend"):
                for f in action.attrlist("fmri"):
                    pkg_name=pkg.fmri.PkgFmri(f).pkg_name
                    info_needed = pkg.client.api.PackageInfo.ALL_OPTIONS - \
                                (pkg.client.api.PackageInfo.ACTION_OPTIONS |
                         frozenset([pkg.client.api.PackageInfo.LICENSES]))
                    progtracker = pkg.client.progress.NullProgressTracker()
                    interface=pkg.client.api.ImageInterface("/", pkg.client.api.CURRENT_API_VERSION, progtracker, lambda x: False, None,None)
                    ret = interface.info([pkg_name],True,info_needed)
                    if ret[pkg.client.api.ImageInterface.INFO_FOUND]:
                            for i in ret[pkg.client.api.ImageInterface.INFO_FOUND]:
                            if i.publisher not in ("openindiana.org","userland","on-nightly"):
                                engine.error(_("package %(pkg)s depends on %(name)s, which comes from forbidden publisher %(publisher)s") %
                                    {"pkg":manifest.fmri,"name":pkg_name,"publisher":i.publisher}, msgid="%s%s.1" % (self.name, pkglint_id))
    forbidden_publisher.pkglint_dest = _(
        "Dependencies should come from standard publishers" )
    def component_check(self, manifest, engine, pkglint_id="001"):
        manifest_paths = []
        files = False