pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/mk mk: add cpe.mk for defining CPE_URI values for pack...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/4e855c23814e
branches:  trunk
changeset: 391018:4e855c23814e
user:      wiz <wiz%pkgsrc.org@localhost>
date:      Mon Jan 02 21:17:52 2023 +0000

description:
mk: add cpe.mk for defining CPE_URI values for packages by default

Mostly from tm@, thanks!

diffstat:

 mk/bsd.pkg.mk  |    3 +-
 mk/misc/cpe.mk |  100 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 102 insertions(+), 1 deletions(-)

diffs (118 lines):

diff -r e2303dad4882 -r 4e855c23814e mk/bsd.pkg.mk
--- a/mk/bsd.pkg.mk     Mon Jan 02 21:03:57 2023 +0000
+++ b/mk/bsd.pkg.mk     Mon Jan 02 21:17:52 2023 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: bsd.pkg.mk,v 1.2045 2022/11/23 13:30:38 jperkin Exp $
+#      $NetBSD: bsd.pkg.mk,v 1.2046 2023/01/02 21:17:52 wiz Exp $
 #
 # This file is in the public domain.
 #
@@ -843,3 +843,4 @@
 .endif
 .include "misc/warnings.mk"
 .include "misc/can-be-built-here.mk"
+.include "misc/cpe.mk"
diff -r e2303dad4882 -r 4e855c23814e mk/misc/cpe.mk
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/mk/misc/cpe.mk    Mon Jan 02 21:17:52 2023 +0000
@@ -0,0 +1,100 @@
+# $NetBSD: cpe.mk,v 1.1 2023/01/02 21:17:53 wiz Exp $
+# Derived from: FreeBSD MK/Uses/cpe.mk (3e1b730be0f27, 2014-07-26)
+# 
+# This Makefile fragment includes CPE information into packages based on the
+# CPE 2.3 formatting string. Additional information could be found on the
+# official NIST documentation:
+#
+# https://csrc.nist.gov/projects/security-content-automation-protocol/specifications/cpe
+#
+# User-settable variables:
+#
+# (none)
+#
+# Package-settable variables:
+#
+# CPE_PART
+#      This is sometimes referred as "type" of CPE. Character describing the
+#      type. Could be "a" for application, "h" for hardware and "o" for
+#      operating system.
+#      Default: "a"
+#
+# CPE_VENDOR
+#      Should describe or identify the organisation that created the product.
+#      Default: ${CPE_PRODUCT} (below)
+#
+# CPE_PRODUCT
+#      Name of the system/package or component. Should not contains any
+#      special characters. On applications CPE_VENDOR and CPE_PRODUCT may be
+#      identical.
+#      Default: ${PKGBASE}
+#
+# CPE_VERSION
+#      The version of the system/package or component.
+#      Default: ${PKGVERSION_NOREV}
+#
+# CPE_UPDATE
+#      Used for updates, service pack information or sometimes minor versions.
+#      Most often left blank.
+#      Default: empty
+#
+# CPE_EDITION
+#      Further granularity describing the build of the system/package or
+#      component, beyond version.
+#      Default: empty
+#
+# CPE_LANG
+#      A valid language tag as defined by IETF RFC 4646. Not relevant for
+#      pkgsrc at the moment.
+#      Default: empty
+#
+# CPE_SW_EDITION
+#      Characterise how the product is tailored to a particular market or
+#      class of end users.
+#      Default: empty
+#
+# CPE_TARGET_SW
+#      Describe the software computing environment within which the product
+#      operates.
+#      Default: operating system (${OPSYS}) and version (${OS_VERSION})
+#
+# CPE_TARGET_HW
+#      Instruction set architecture (e.g. x86) on which the product being
+#      described or identified by the WFN operates. 
+#      Default: x86 for i386, x64 for amd64, otherwise ${MACHINE_ARCH}
+#
+# CPE_OTHER
+#      Any other general descriptive or identifying information. Used for
+#      PKGREVISION in pkgsrc.
+#      Default: ${PKGREVISION} if exists
+#
+#
+# Variables defined by this file:
+# 
+# CPE_URI
+#      The CPE URI uniquely identifies a device or program by its vendor,
+#      product name, version, revision. Based on the above variables.
+#
+# Keywords: cpe
+
+.if !defined(CPE_MK)
+CPE_MK=                        # defined
+
+CPE_PART?=             a
+CPE_PRODUCT?=          ${PKGBASE:Q}
+CPE_VENDOR?=           ${CPE_PRODUCT}
+CPE_VERSION?=          ${PKGVERSION_NOREV}
+CPE_UPDATE?=
+CPE_EDITION?=
+CPE_LANG?=
+CPE_SW_EDITION?=
+CPE_TARGET_SW?=                ${OPSYS:tl}${OS_VERSION:C/\..*//}
+CPE_TARGET_HW?=                ${MACHINE_ARCH:S/i386/x86/:S/amd64/x64/}
+CPE_OTHER?=            ${PKGREVISION}
+
+_CPE_STR=              cpe:2.3:${CPE_PART}:${CPE_VENDOR}:${CPE_PRODUCT}:${CPE_VERSION}:${CPE_UPDATE}:${CPE_EDITION}:${CPE_LANG}:${CPE_SW_EDITION}:${CPE_TARGET_SW}:${CPE_TARGET_HW}:${CPE_OTHER}
+
+CPE_URI?=              ${_CPE_STR:C/:+$//}
+
+BUILD_DEFS+=           CPE_URI
+.endif



Home | Main Index | Thread Index | Old Index