Sync with c8-beta

This commit is contained in:
Andrew Lukoshko 2024-04-03 12:57:40 +00:00
parent d719a32ac9
commit fb493170c9
9 changed files with 437 additions and 179 deletions

6
.gitignore vendored
View File

@ -1,3 +1,3 @@
SOURCES/grafana-pcp-3.2.0.tar.gz SOURCES/grafana-pcp-5.1.1.tar.gz
SOURCES/grafana-pcp-vendor-3.2.0-1.tar.xz SOURCES/grafana-pcp-vendor-5.1.1-1.tar.xz
SOURCES/grafana-pcp-webpack-3.2.0-1.tar.gz SOURCES/grafana-pcp-webpack-5.1.1-1.tar.gz

View File

@ -1,3 +1,3 @@
7819dc1ba2fce0cc82ee4a3fb6729c3e527def16 SOURCES/grafana-pcp-3.2.0.tar.gz 3b2c6875861e93eade0ab4321a49dfd6c692ca7a SOURCES/grafana-pcp-5.1.1.tar.gz
10dac7852a8a4ba901344a4467c2ad60079cbff6 SOURCES/grafana-pcp-vendor-3.2.0-1.tar.xz 3eabf083226c04c7c5fa031d3b67d060cfc294f7 SOURCES/grafana-pcp-vendor-5.1.1-1.tar.xz
977e3be2161e3b288c6be1932bf8d1c5c01fff14 SOURCES/grafana-pcp-webpack-3.2.0-1.tar.gz 55fa447cbf8ffddc4ba5e50dc81b81e89f0f2fc7 SOURCES/grafana-pcp-webpack-5.1.1-1.tar.gz

View File

@ -0,0 +1,259 @@
From 7ed5650dc812fcbfcda7162845c4e6ea73a239a6 Mon Sep 17 00:00:00 2001
From: Andreas Gerstmayr <agerstmayr@redhat.com>
Date: Thu, 7 Jul 2022 15:38:28 +0200
Subject: [PATCH] remove unused frontend crypto
update `package.json` and then run `yarn install` to update the
`yarn.lock` lockfile
diff --git a/package.json b/package.json
index 14c2960..db6858a 100644
--- a/package.json
+++ b/package.json
@@ -63,6 +63,10 @@
"redux-persist": "^6.0.0",
"redux-thunk": "^2.3.0"
},
+ "resolutions": {
+ "crypto-browserify": "https://registry.yarnpkg.com/@favware/skip-dependency/-/skip-dependency-1.1.1.tgz",
+ "http-signature": "https://registry.yarnpkg.com/@favware/skip-dependency/-/skip-dependency-1.1.1.tgz"
+ },
"engines": {
"node": ">=14"
}
diff --git a/yarn.lock b/yarn.lock
index 44bcec7..c2a86be 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -4067,18 +4067,6 @@ array.prototype.flatmap@^1.2.5:
es-abstract "^1.19.2"
es-shim-unscopables "^1.0.0"
-asn1@~0.2.3:
- version "0.2.6"
- resolved "https://registry.yarnpkg.com/asn1/-/asn1-0.2.6.tgz#0d3a7bb6e64e02a90c0303b31f292868ea09a08d"
- integrity sha512-ix/FxPn0MDjeyJ7i/yoHGFt/EX6LyNbxSEhPPXODPL+KB0VPk86UYfL0lMdy+KCnv+fmvIzySwaK5COwqVbWTQ==
- dependencies:
- safer-buffer "~2.1.0"
-
-assert-plus@1.0.0, assert-plus@^1.0.0:
- version "1.0.0"
- resolved "https://registry.yarnpkg.com/assert-plus/-/assert-plus-1.0.0.tgz#f12e0f3c5d77b0b1cdd9146942e4e96c1e4dd525"
- integrity sha512-NfJ4UzBCcQGLDlQq7nHxH+tv3kyZ0hHQqF5BO6J7tNJeP5do1llPr8dZ8zHonfhAu0PHAdMkSo+8o0wxg9lZWw==
-
astral-regex@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/astral-regex/-/astral-regex-2.0.0.tgz#483143c567aeed4785759c0865786dc77d7d2e31"
@@ -4321,13 +4309,6 @@ base64-js@^1.3.1:
resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.5.1.tgz#1b1b440160a5bf7ad40b650f095963481903930a"
integrity sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==
-bcrypt-pbkdf@^1.0.0:
- version "1.0.2"
- resolved "https://registry.yarnpkg.com/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz#a4301d389b6a43f9b67ff3ca11a3f6637e360e9e"
- integrity sha512-qeFIXtP4MSoi6NLqO12WfqARWWuCKi2Rn/9hJLEmtB5yTNr9DqFWkJRCf2qShWzPeAMRnOgCrq0sg/KLv5ES9w==
- dependencies:
- tweetnacl "^0.14.3"
-
big.js@^5.2.2:
version "5.2.2"
resolved "https://registry.yarnpkg.com/big.js/-/big.js-5.2.2.tgz#65f0af382f578bcdc742bd9c281e9cb2d7768328"
@@ -4839,11 +4820,6 @@ core-js@^3.6.5:
resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.26.0.tgz#a516db0ed0811be10eac5d94f3b8463d03faccfe"
integrity sha512-+DkDrhoR4Y0PxDz6rurahuB+I45OsEUv8E1maPTB6OuHRohMMcznBq9TMpdpDMm/hUPob/mJJS3PqgbHpMTQgw==
-core-util-is@1.0.2:
- version "1.0.2"
- resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7"
- integrity sha512-3lqz5YjWTYnW6dlDa5TLaTCcShfar1e40rmcJVwCBJC6mWlFuj0eCHIElmG1g5kyuJ/GD+8Wn4FFCcz4gJPfaQ==
-
cosmiconfig@^6.0.0:
version "6.0.0"
resolved "https://registry.yarnpkg.com/cosmiconfig/-/cosmiconfig-6.0.0.tgz#da4fee853c52f6b1e6935f41c1a2fc50bd4a9982"
@@ -4890,6 +4866,10 @@ cross-spawn@^7.0.0, cross-spawn@^7.0.2, cross-spawn@^7.0.3:
shebang-command "^2.0.0"
which "^2.0.1"
+"crypto-browserify@https://registry.yarnpkg.com/@favware/skip-dependency/-/skip-dependency-1.1.1.tgz", "http-signature@https://registry.yarnpkg.com/@favware/skip-dependency/-/skip-dependency-1.1.1.tgz", http-signature@~1.3.6:
+ version "1.1.1"
+ resolved "https://registry.yarnpkg.com/@favware/skip-dependency/-/skip-dependency-1.1.1.tgz#f8cae15d883ffc0abc663b5eaaa711fcc64bb5c2"
+
css-animation@^1.3.2:
version "1.6.1"
resolved "https://registry.yarnpkg.com/css-animation/-/css-animation-1.6.1.tgz#162064a3b0d51f958b7ff37b3d6d4de18e17039e"
@@ -5469,13 +5449,6 @@ d3@5.15.0:
d3-voronoi "1"
d3-zoom "1"
-dashdash@^1.12.0:
- version "1.14.1"
- resolved "https://registry.yarnpkg.com/dashdash/-/dashdash-1.14.1.tgz#853cfa0f7cbe2fed5de20326b8dd581035f6e2f0"
- integrity sha512-jRFi8UDGo6j+odZiEpjazZaWqEal3w/basFjQHQEwVtZJGDpxbH1MeYluwCS8Xq5wmLJooDlMgvVarmWfGM44g==
- dependencies:
- assert-plus "^1.0.0"
-
data-urls@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/data-urls/-/data-urls-2.0.0.tgz#156485a72963a970f5d5821aaf642bef2bf2db9b"
@@ -5722,14 +5695,6 @@ duplexer@^0.1.2:
resolved "https://registry.yarnpkg.com/duplexer/-/duplexer-0.1.2.tgz#3abe43aef3835f8ae077d136ddce0f276b0400e6"
integrity sha512-jtD6YG370ZCIi/9GTaJKQxWTZD045+4R4hTk/x1UyoqadyJ9x9CgSi1RlVDQF8U2sxLLSnFkCaMihqljHIWgMg==
-ecc-jsbn@~0.1.1:
- version "0.1.2"
- resolved "https://registry.yarnpkg.com/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz#3a83a904e54353287874c564b7549386849a98c9"
- integrity sha512-eh9O+hwRHNbG4BLTjEl3nw044CkGm5X6LoaCf7LPp7UU8Qrt47JYNi6nPX8xjW97TKGKm1ouctg0QSpZe9qrnw==
- dependencies:
- jsbn "~0.1.0"
- safer-buffer "^2.1.0"
-
electron-to-chromium@^1.4.172:
version "1.4.264"
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.264.tgz#2f68a062c38b7a04bf57f3e6954b868672fbdcd3"
@@ -6336,16 +6301,6 @@ extract-zip@2.0.1:
optionalDependencies:
"@types/yauzl" "^2.9.1"
-extsprintf@1.3.0:
- version "1.3.0"
- resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.3.0.tgz#96918440e3041a7a414f8c52e3c574eb3c3e1e05"
- integrity sha512-11Ndz7Nv+mvAC1j0ktTa7fAb0vLyGGX+rMHNBYQviQDGU0Hw7lhctJANqbPhu9nV9/izT/IntTgZ7Im/9LJs9g==
-
-extsprintf@^1.2.0:
- version "1.4.1"
- resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.4.1.tgz#8d172c064867f235c0c84a596806d279bf4bcc07"
- integrity sha512-Wrk35e8ydCKDj/ArClo1VrPVmN8zph5V4AtHwIuHhvMXsKf73UT3BOD+azBIW+3wOJ4FhEH7zyaJCFvChjYvMA==
-
fast-deep-equal@^3.1.1, fast-deep-equal@^3.1.3:
version "3.1.3"
resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525"
@@ -6746,13 +6701,6 @@ getos@^3.2.1:
dependencies:
async "^3.2.0"
-getpass@^0.1.1:
- version "0.1.7"
- resolved "https://registry.yarnpkg.com/getpass/-/getpass-0.1.7.tgz#5eff8e3e684d569ae4cb2b1282604e8ba62149fa"
- integrity sha512-0fzj9JxOLfJ+XGLhR8ze3unN0KZCgZwiSSDz168VERjK8Wl8kVSdcu2kspd4s4wtAa1y/qrVRiAA0WclVsu0ng==
- dependencies:
- assert-plus "^1.0.0"
-
glob-parent@^5.1.2, glob-parent@~5.1.2:
version "5.1.2"
resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.2.tgz#869832c58034fe68a4093c17dc15e8340d8401c4"
@@ -7011,15 +6959,6 @@ http-proxy@^1.18.1:
follow-redirects "^1.0.0"
requires-port "^1.0.0"
-http-signature@~1.3.6:
- version "1.3.6"
- resolved "https://registry.yarnpkg.com/http-signature/-/http-signature-1.3.6.tgz#cb6fbfdf86d1c974f343be94e87f7fc128662cf9"
- integrity sha512-3adrsD6zqo4GsTqtO7FyrejHNv+NgiIfAfv68+jVlFmSr9OGy7zrxONceFRLKvnnZA5jbxQBX1u9PpB6Wi32Gw==
- dependencies:
- assert-plus "^1.0.0"
- jsprim "^2.0.2"
- sshpk "^1.14.1"
-
https-proxy-agent@^5.0.0:
version "5.0.1"
resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz#c59ef224a04fe8b754f3db0063a25ea30d0005d6"
@@ -7990,11 +7929,6 @@ js-yaml@^4.1.0:
dependencies:
argparse "^2.0.1"
-jsbn@~0.1.0:
- version "0.1.1"
- resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.1.tgz#a5e654c2e5a2deb5f201d96cefbca80c0ef2f513"
- integrity sha512-UVU9dibq2JcFWxQPA6KCqj5O42VOmAY3zQUfEKxU0KpTGXwNoCjkX1e13eHNvw/xPynt6pU0rZ1htjWTNTSXsg==
-
jsdoc-type-pratt-parser@~2.2.5:
version "2.2.5"
resolved "https://registry.yarnpkg.com/jsdoc-type-pratt-parser/-/jsdoc-type-pratt-parser-2.2.5.tgz#c9f93afac7ee4b5ed4432fe3f09f7d36b05ed0ff"
@@ -8058,11 +7992,6 @@ json-schema-traverse@^1.0.0:
resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz#ae7bcb3656ab77a73ba5c49bf654f38e6b6860e2"
integrity sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==
-json-schema@0.4.0:
- version "0.4.0"
- resolved "https://registry.yarnpkg.com/json-schema/-/json-schema-0.4.0.tgz#f7de4cf6efab838ebaeb3236474cbba5a1930ab5"
- integrity sha512-es94M3nTIfsEPisRafak+HDLfHXnKBhV3vU5eqPcS3flIWqcxJWgXHXiey3YrpaNsanY5ei1VoYEbOzijuq9BA==
-
json-stable-stringify-without-jsonify@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz#9db7b59496ad3f3cfef30a75142d2d930ad72651"
@@ -8092,16 +8021,6 @@ jsonfile@^6.0.1:
optionalDependencies:
graceful-fs "^4.1.6"
-jsprim@^2.0.2:
- version "2.0.2"
- resolved "https://registry.yarnpkg.com/jsprim/-/jsprim-2.0.2.tgz#77ca23dbcd4135cd364800d22ff82c2185803d4d"
- integrity sha512-gqXddjPqQ6G40VdnI6T6yObEC+pDNvyP95wdQhkWkg7crHH3km5qP1FsOXEkzEQwnz6gz5qGTn1c2Y52wP3OyQ==
- dependencies:
- assert-plus "1.0.0"
- extsprintf "1.3.0"
- json-schema "0.4.0"
- verror "1.10.0"
-
"jsx-ast-utils@^2.4.1 || ^3.0.0":
version "3.3.1"
resolved "https://registry.yarnpkg.com/jsx-ast-utils/-/jsx-ast-utils-3.3.1.tgz#a3e0f1cb7e230954eab4dcbce9f6288a78f8ba44"
@@ -10611,7 +10530,7 @@ safe-buffer@~5.1.1:
resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d"
integrity sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==
-"safer-buffer@>= 2.1.2 < 3", "safer-buffer@>= 2.1.2 < 3.0.0", safer-buffer@^2.0.2, safer-buffer@^2.1.0, safer-buffer@~2.1.0:
+"safer-buffer@>= 2.1.2 < 3", "safer-buffer@>= 2.1.2 < 3.0.0":
version "2.1.2"
resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a"
integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==
@@ -10989,21 +10908,6 @@ sprintf-js@~1.0.2:
resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c"
integrity sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==
-sshpk@^1.14.1:
- version "1.17.0"
- resolved "https://registry.yarnpkg.com/sshpk/-/sshpk-1.17.0.tgz#578082d92d4fe612b13007496e543fa0fbcbe4c5"
- integrity sha512-/9HIEs1ZXGhSPE8X6Ccm7Nam1z8KcoCqPdI7ecm1N33EzAetWahvQWVqLZtaZQ+IDKX4IyA2o0gBzqIMkAagHQ==
- dependencies:
- asn1 "~0.2.3"
- assert-plus "^1.0.0"
- bcrypt-pbkdf "^1.0.0"
- dashdash "^1.12.0"
- ecc-jsbn "~0.1.1"
- getpass "^0.1.1"
- jsbn "~0.1.0"
- safer-buffer "^2.0.2"
- tweetnacl "~0.14.0"
-
stable@^0.1.8:
version "0.1.8"
resolved "https://registry.yarnpkg.com/stable/-/stable-0.1.8.tgz#836eb3c8382fe2936feaf544631017ce7d47a3cf"
@@ -11459,11 +11363,6 @@ tunnel-agent@^0.6.0:
dependencies:
safe-buffer "^5.0.1"
-tweetnacl@^0.14.3, tweetnacl@~0.14.0:
- version "0.14.5"
- resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-0.14.5.tgz#5ae68177f192d4456269d108afa93ff8743f4f64"
- integrity sha512-KXXFFdAbFXY4geFIwoyNK+f5Z1b7swfXABfL7HXCmoIWMKU3dmS26672A4EeQtDzLKy7SXmfBu51JolvEKwtGA==
-
type-check@^0.4.0, type-check@~0.4.0:
version "0.4.0"
resolved "https://registry.yarnpkg.com/type-check/-/type-check-0.4.0.tgz#07b8203bfa7056c0657050e3ccd2c37730bab8f1"
@@ -11649,15 +11548,6 @@ value-equal@^1.0.1:
resolved "https://registry.yarnpkg.com/value-equal/-/value-equal-1.0.1.tgz#1e0b794c734c5c0cade179c437d356d931a34d6c"
integrity sha512-NOJ6JZCAWr0zlxZt+xqCHNTEKOsrks2HQd4MqhP1qy4z1SkbEP467eNx6TgDKXMvUOb+OENfJCZwM+16n7fRfw==
-verror@1.10.0:
- version "1.10.0"
- resolved "https://registry.yarnpkg.com/verror/-/verror-1.10.0.tgz#3a105ca17053af55d6e270c1f8288682e18da400"
- integrity sha512-ZZKSmDAEFOijERBLkmYfJ+vmk3w+7hOLYDNkRCuRuMJGEmqYNCNLyBBFwWKVMhfwaEF3WOd0Zlw86U/WC/+nYw==
- dependencies:
- assert-plus "^1.0.0"
- core-util-is "1.0.2"
- extsprintf "^1.2.0"
-
w3c-hr-time@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/w3c-hr-time/-/w3c-hr-time-1.0.2.tgz#0a89cdf5cc15822df9c360543676963e0cc308cd"

View File

@ -1,28 +0,0 @@
diff --git a/package.json b/package.json
index 698043c..d9f0f44 100644
--- a/package.json
+++ b/package.json
@@ -70,6 +70,8 @@
"redux-thunk": "^2.3.0"
},
"resolutions": {
+ "crypto-browserify": "https://registry.yarnpkg.com/@favware/skip-dependency/-/skip-dependency-1.1.1.tgz",
+ "http-signature": "https://registry.yarnpkg.com/@favware/skip-dependency/-/skip-dependency-1.1.1.tgz",
"monaco-editor": "0.20.0",
"rxjs": "6.6.3"
},
diff --git a/webpack.config.js b/webpack.config.js
index ae72fd8..529d6bf 100644
--- a/webpack.config.js
+++ b/webpack.config.js
@@ -89,6 +89,10 @@ module.exports.getWebpackConfig = (config, options) => {
...config.module,
rules: removeDataTestAttributeInProduction(options.production, excludeExtractionLoaderForMonaco(config.module.rules)),
},
+ node: {
+ ...config.node,
+ crypto: false
+ },
plugins: [
...updateForkTsCheckerPluginSettings(config.plugins),
new MonacoWebpackPlugin({

View File

@ -1,74 +0,0 @@
VERSION := $(shell rpm --specfile *.spec --qf '%{VERSION}\n' | head -1)
RELEASE := $(shell rpm --specfile *.spec --qf '%{RELEASE}\n' | head -1 | cut -d. -f1)
NAME := grafana-pcp
RPM_NAME := $(NAME)
SOURCE_DIR := $(NAME)-$(VERSION)
SOURCE_TAR := $(NAME)-$(VERSION).tar.gz
VENDOR_TAR := $(RPM_NAME)-vendor-$(VERSION)-$(RELEASE).tar.xz
WEBPACK_TAR := $(RPM_NAME)-webpack-$(VERSION)-$(RELEASE).tar.gz
# patches which must be applied before creating the vendor tarball, for example:
# - changes in dependency versions
# - changes in Go module imports (which affect the vendored Go modules)
PATCHES_PRE_VENDOR := \
001-remove-unused-frontend-crypto.patch
# patches which must be applied before creating the webpack, for example:
# - changes in Node.js sources or vendored dependencies
PATCHES_PRE_WEBPACK := \
001-remove-unused-frontend-crypto.patch
all: $(SOURCE_TAR) $(VENDOR_TAR) $(WEBPACK_TAR)
$(SOURCE_TAR):
spectool -g $(RPM_NAME).spec
$(VENDOR_TAR): $(SOURCE_TAR)
# start with a clean state
rm -rf $(SOURCE_DIR)
tar xf $(SOURCE_TAR)
# Patches to apply before vendoring
for patch in $(PATCHES_PRE_VENDOR); do echo applying $$patch ...; patch -d $(SOURCE_DIR) -p1 --fuzz=0 < $$patch; done
# Go
cd $(SOURCE_DIR) && go mod vendor -v
awk '$$2~/^v/ && $$4 != "indirect" {print "Provides: bundled(golang(" $$1 ")) = " substr($$2, 2)}' $(SOURCE_DIR)/go.mod | \
sed -E 's/=(.*)-(.*)-(.*)/=\1-\2.\3/g' > $@.manifest
# Node.js
cd $(SOURCE_DIR) && yarn install --pure-lockfile
# Remove files with licensing issues
find $(SOURCE_DIR) -type d -name 'node-notifier' -prune -exec rm -r {} \;
find $(SOURCE_DIR) -type f -name '*.exe' -delete
# Remove not required packages
rm -r $(SOURCE_DIR)/node_modules/puppeteer
./list_bundled_nodejs_packages.py $(SOURCE_DIR) >> $@.manifest
# Jsonnet
cd $(SOURCE_DIR) && jb --jsonnetpkg-home=vendor_jsonnet install
# Create tarball
XZ_OPT=-9 time -p tar cJf $@ \
$(SOURCE_DIR)/vendor \
$(SOURCE_DIR)/node_modules \
$(SOURCE_DIR)/vendor_jsonnet
$(WEBPACK_TAR): $(VENDOR_TAR)
# start with a clean state
rm -rf $(SOURCE_DIR)
tar xf $(SOURCE_TAR)
tar xf $(VENDOR_TAR)
# Patches to apply before creating the webpack
for patch in $(PATCHES_PRE_WEBPACK); do echo applying $$patch ...; patch -d $(SOURCE_DIR) -p1 --fuzz=0 < $$patch; done
cd $(SOURCE_DIR) && \
../build_frontend.sh
tar cfz $@ $(SOURCE_DIR)/dist
clean:
rm -rf *.tar.gz *.tar.xz *.manifest *.rpm $(NAME)-*/

View File

@ -1,5 +1,19 @@
#!/bin/bash -eu #!/bin/bash -eu
# Revert upstream change: "rename plugin IDs from pcp-*-* to performancecopilot-*-*"
# https://github.com/performancecopilot/grafana-pcp/commit/70ca5cc307e231cea14281e1cd2268ae4f1f445c
# This change would break all existing custom dashboards. Using sed here instead of a patch
# to catch all future usage of the new upstream plugin ids.
find src cypress \( -name '*.ts' -o -name '*.json' -o -name '*.jsonnet' -o -name '*.libsonnet' \) \
-exec sed -i \
-e 's/performancecopilot-redis-datasource/pcp-redis-datasource/g' \
-e 's/performancecopilot-vector-datasource/pcp-vector-datasource/g' \
-e 's/performancecopilot-bpftrace-datasource/pcp-bpftrace-datasource/g' \
-e 's/performancecopilot-flamegraph-panel/pcp-flamegraph-panel/g' \
-e 's/performancecopilot-breadcrumbs-panel/pcp-breadcrumbs-panel/g' \
-e 's/performancecopilot-troubleshooting-panel/pcp-troubleshooting-panel/g' \
{} \;
# Build the frontend # Build the frontend
yarn run build yarn run build

68
SOURCES/create_bundles.sh Executable file
View File

@ -0,0 +1,68 @@
#!/bin/bash -eux
VERSION=$(rpm --specfile ./*.spec --qf '%{VERSION}\n' | head -1)
RELEASE=$(rpm --specfile ./*.spec --qf '%{RELEASE}\n' | head -1 | cut -d. -f1)
CHANGELOGTIME=$(rpm --specfile ./*.spec --qf '%{CHANGELOGTIME}\n' | head -1)
SOURCE_DATE_EPOCH=$((CHANGELOGTIME - CHANGELOGTIME % 86400))
SOURCE_DIR=grafana-pcp-$VERSION
SOURCE_TAR=grafana-pcp-$VERSION.tar.gz
VENDOR_TAR=grafana-pcp-vendor-$VERSION-$RELEASE.tar.xz
WEBPACK_TAR=grafana-pcp-webpack-$VERSION-$RELEASE.tar.gz
## Download and extract source tarball
spectool -g grafana-pcp.spec
rm -rf "${SOURCE_DIR}"
tar xf "${SOURCE_TAR}"
## Create vendor bundle
pushd "${SOURCE_DIR}"
# Vendor Go dependencies
go mod vendor
# List bundled dependencies
awk '$2 ~ /^v/ && $4 != "indirect" {print "Provides: bundled(golang(" $1 ")) = " substr($2, 2)}' go.mod | \
sed -E 's/=(.*)-(.*)-(.*)/=\1-\2.\3/g' > "../${VENDOR_TAR}.manifest"
# Vendor Node.js dependencies
patch -p1 --fuzz=0 < ../0001-remove-unused-frontend-crypto.patch
yarn install --frozen-lockfile
# Remove files with licensing issues
find . -type d -name 'node-notifier' -prune -exec rm -r {} \;
find . -type f -name '*.exe' -delete
# List bundled dependencies
../list_bundled_nodejs_packages.py . >> "../${VENDOR_TAR}.manifest"
# Vendor Jsonnet dependencies
jb --jsonnetpkg-home=vendor_jsonnet install
popd
# Create tarball
# shellcheck disable=SC2046
XZ_OPT=-9 tar \
--sort=name \
--mtime="@${SOURCE_DATE_EPOCH}" --clamp-mtime \
--owner=0 --group=0 --numeric-owner \
-cJf "${VENDOR_TAR}" \
"${SOURCE_DIR}/vendor" \
"${SOURCE_DIR}/node_modules" \
"${SOURCE_DIR}/vendor_jsonnet"
## Create webpack
pushd "${SOURCE_DIR}"
../build_frontend.sh
popd
# Create tarball
tar \
--sort=name \
--mtime="@${SOURCE_DATE_EPOCH}" --clamp-mtime \
--owner=0 --group=0 --numeric-owner \
-czf "${WEBPACK_TAR}" \
"${SOURCE_DIR}/dist"

View File

@ -0,0 +1,21 @@
#!/bin/bash -eu
#
# create vendor and webpack bundles inside a container (for reproducibility)
# using a Go cache:
# ./create_bundles_in_container.sh --security-opt label=disable -v $(pwd)/.gocache:/root/go
#
cat <<EOF | podman build -t grafana-pcp-build -f - .
FROM fedora:36
RUN dnf upgrade -y && \
dnf install -y rpmdevtools python3-packaging make golang nodejs yarnpkg golang-github-jsonnet-bundler golang-github-google-jsonnet
WORKDIR /tmp/grafana-pcp-build
COPY grafana-pcp.spec create_bundles.sh build_frontend.sh list_bundled_nodejs_packages.py *.patch .
RUN mkdir bundles
CMD ./create_bundles.sh && mv *.tar.* bundles
EOF
podman run --name grafana-pcp-build --replace "$@" grafana-pcp-build
podman cp grafana-pcp-build:bundles/. .

View File

@ -1,12 +1,6 @@
# gobuild and gotest macros are not available on CentOS Stream # Specify if the frontend will be compiled as part of the build or
# remove once BZ 1965292 is resolved # is attached as a webpack tarball (in case of an unsuitable nodejs version on the build system)
# definitions lifted from Fedora 34 podman.spec %define compile_frontend 0
%if ! 0%{?gobuild:1}
%define gobuild(o:) GO111MODULE=off go build -buildmode pie -compiler gc -tags="rpm_crashtraceback ${BUILDTAGS:-}" -ldflags "${LDFLAGS:-} -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \\n') -extldflags '-Wl,-z,relro -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld '" -a -v -x %{?**};
%endif
%if ! 0%{?gotest:1}
%define gotest() GO111MODULE=off go test -buildmode pie -compiler gc -ldflags "${LDFLAGS:-} -extldflags '-Wl,-z,relro -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld '" %{?**};
%endif
%global grafanapcp_arches %{lua: go_arches = {} %global grafanapcp_arches %{lua: go_arches = {}
for arch in rpm.expand("%{go_arches}"):gmatch("%S+") do for arch in rpm.expand("%{go_arches}"):gmatch("%S+") do
@ -18,13 +12,11 @@
end end
end} end}
# Specify if the frontend and dashboards will be compiled as part of the build or are attached %global gomodulesmode GO111MODULE=auto
# as a webpack tarball (in case of an unsuitable nodejs or jsonnet version on the build system)
%define compile_frontend 0
Name: grafana-pcp Name: grafana-pcp
Version: 3.2.0 Version: 5.1.1
Release: 3%{?dist} Release: 1%{?dist}
Summary: Performance Co-Pilot Grafana Plugin Summary: Performance Co-Pilot Grafana Plugin
License: ASL 2.0 License: ASL 2.0
URL: https://github.com/performancecopilot/grafana-pcp URL: https://github.com/performancecopilot/grafana-pcp
@ -39,17 +31,21 @@ Source1: grafana-pcp-vendor-%{version}-1.tar.xz
# lags behind the NVR of this package. # lags behind the NVR of this package.
Source2: grafana-pcp-webpack-%{version}-1.tar.gz Source2: grafana-pcp-webpack-%{version}-1.tar.gz
%endif %endif
Source3: Makefile Source3: create_bundles.sh
Source4: build_frontend.sh Source4: build_frontend.sh
Source5: list_bundled_nodejs_packages.py Source5: list_bundled_nodejs_packages.py
Source6: create_bundles_in_container.sh
Patch1: 001-remove-unused-frontend-crypto.patch Patch1: 0001-remove-unused-frontend-crypto.patch
# Intersection of go_arches and nodejs_arches # Intersection of go_arches and nodejs_arches
ExclusiveArch: %{grafanapcp_arches} ExclusiveArch: %{grafanapcp_arches}
BuildRequires: systemd-rpm-macros, golang, go-srpm-macros
%if 0%{?fedora} >= 31 BuildRequires: systemd-rpm-macros
BuildRequires: golang
BuildRequires: go-srpm-macros
%if 0%{?rhel} >= 9
BuildRequires: go-rpm-macros BuildRequires: go-rpm-macros
%endif %endif
@ -57,13 +53,12 @@ BuildRequires: go-rpm-macros
BuildRequires: make, nodejs >= 1:14, yarnpkg, golang-github-google-jsonnet BuildRequires: make, nodejs >= 1:14, yarnpkg, golang-github-google-jsonnet
%endif %endif
# omit golang debugsource, see BZ 995136 and related %global plugin_dir %{_sharedstatedir}/grafana/plugins/performancecopilot-pcp-app
%global dwz_low_mem_die_limit 0 %global install_dir %{_datadir}/performancecopilot-pcp-app
%global _debugsource_template %{nil}
%global install_dir %{_sharedstatedir}/grafana/plugins/performancecopilot-pcp-app # grafana-pcp requires systemd-tmpfiles
%{?systemd_requires}
Requires: grafana >= 7.5.9 Requires: grafana >= 9.0.9
Suggests: pcp >= 5.2.2 Suggests: pcp >= 5.2.2
Suggests: redis >= 5.0.0 Suggests: redis >= 5.0.0
Suggests: bpftrace >= 0.9.2 Suggests: bpftrace >= 0.9.2
@ -79,60 +74,55 @@ Obsoletes: pcp-webapp-vector <= 4.3.4
# this is for security purposes, if nodejs-foo ever needs an update, # this is for security purposes, if nodejs-foo ever needs an update,
# affected packages can be easily identified. # affected packages can be easily identified.
# Note: generated by the Makefile (see README.md) # Note: generated by the Makefile (see README.md)
Provides: bundled(golang(github.com/grafana/grafana-plugin-sdk-go)) = 0.115.0 Provides: bundled(golang(github.com/grafana/grafana-plugin-sdk-go)) = 0.141.0
Provides: bundled(golang(github.com/stretchr/testify)) = 1.7.0 Provides: bundled(golang(github.com/hashicorp/golang-lru)) = 0.5.4
Provides: bundled(npm(@babel/plugin-transform-modules-commonjs)) = 7.16.0 Provides: bundled(golang(github.com/stretchr/testify)) = 1.8.0
Provides: bundled(npm(@grafana/data)) = 7.5.11 Provides: bundled(npm(@babel/plugin-transform-modules-commonjs)) = 7.18.6
Provides: bundled(npm(@grafana/runtime)) = 7.5.11 Provides: bundled(npm(@grafana/data)) = 9.1.6
Provides: bundled(npm(@grafana/toolkit)) = 7.5.11 Provides: bundled(npm(@grafana/runtime)) = 9.1.6
Provides: bundled(npm(@grafana/ui)) = 7.5.11 Provides: bundled(npm(@grafana/toolkit)) = 9.1.6
Provides: bundled(npm(@testing-library/jest-dom)) = 5.4.0 Provides: bundled(npm(@grafana/ui)) = 9.1.6
Provides: bundled(npm(@testing-library/react)) = 10.4.9 Provides: bundled(npm(@trivago/prettier-plugin-sort-imports)) = 3.4.0
Provides: bundled(npm(@types/blueimp-md5)) = 2.18.0 Provides: bundled(npm(@types/blueimp-md5)) = 2.18.0
Provides: bundled(npm(@types/d3-selection)) = 1.4.3 Provides: bundled(npm(@types/d3-selection)) = 2.0.1
Provides: bundled(npm(@types/enzyme)) = 3.10.8 Provides: bundled(npm(@types/enzyme)) = 3.10.8
Provides: bundled(npm(@types/enzyme-adapter-react-16)) = 1.0.6 Provides: bundled(npm(@types/enzyme-adapter-react-16)) = 1.0.6
Provides: bundled(npm(@types/expect-puppeteer)) = 3.3.1 Provides: bundled(npm(@types/jest)) = 26.0.24
Provides: bundled(npm(@types/jest)) = 26.0.15 Provides: bundled(npm(@types/lodash)) = 4.14.181
Provides: bundled(npm(@types/jest-environment-puppeteer)) = 4.4.1
Provides: bundled(npm(@types/lodash)) = 4.14.176
Provides: bundled(npm(@types/memoize-one)) = 5.1.2 Provides: bundled(npm(@types/memoize-one)) = 5.1.2
Provides: bundled(npm(@types/react-autosuggest)) = 9.3.14 Provides: bundled(npm(@types/react-autosuggest)) = 10.1.5
Provides: bundled(npm(@types/react-redux)) = 7.1.20 Provides: bundled(npm(@types/react-redux)) = 7.1.24
Provides: bundled(npm(@types/redux)) = 3.6.0 Provides: bundled(npm(@types/redux)) = 3.6.0
Provides: bundled(npm(@types/redux-persist)) = 4.3.1 Provides: bundled(npm(@types/redux-persist)) = 4.3.1
Provides: bundled(npm(@types/redux-persist-transform-filter)) = 0.0.4 Provides: bundled(npm(babel-plugin-react-remove-properties)) = 0.3.0
Provides: bundled(npm(babel-plugin-remove-object-properties)) = 1.0.2
Provides: bundled(npm(blueimp-md5)) = 2.19.0 Provides: bundled(npm(blueimp-md5)) = 2.19.0
Provides: bundled(npm(core-js)) = 2.6.12 Provides: bundled(npm(core-js)) = 2.6.12
Provides: bundled(npm(cypress)) = 10.10.0
Provides: bundled(npm(d3-flame-graph)) = 3.1.1 Provides: bundled(npm(d3-flame-graph)) = 3.1.1
Provides: bundled(npm(d3-selection)) = 1.4.2 Provides: bundled(npm(d3-selection)) = 1.4.2
Provides: bundled(npm(emotion)) = 10.0.27 Provides: bundled(npm(emotion)) = 10.0.27
Provides: bundled(npm(enzyme)) = 3.11.0 Provides: bundled(npm(enzyme)) = 3.11.0
Provides: bundled(npm(enzyme-adapter-react-16)) = 1.15.6 Provides: bundled(npm(enzyme-adapter-react-16)) = 1.15.6
Provides: bundled(npm(eslint-plugin-prettier)) = 3.3.1 Provides: bundled(npm(eslint-plugin-prettier)) = 4.2.1
Provides: bundled(npm(jest-date-mock)) = 1.0.8
Provides: bundled(npm(jest-puppeteer)) = 5.0.4
Provides: bundled(npm(lodash)) = 4.17.21 Provides: bundled(npm(lodash)) = 4.17.21
Provides: bundled(npm(loglevel)) = 1.7.1 Provides: bundled(npm(loglevel)) = 1.8.0
Provides: bundled(npm(loglevel-plugin-prefix)) = 0.8.4 Provides: bundled(npm(loglevel-plugin-prefix)) = 0.8.4
Provides: bundled(npm(memoize-one)) = 4.1.0 Provides: bundled(npm(memoize-one)) = 4.1.0
Provides: bundled(npm(monaco-editor)) = 0.20.0 Provides: bundled(npm(monaco-editor)) = 0.31.1
Provides: bundled(npm(monaco-editor-webpack-plugin)) = 1.9.0 Provides: bundled(npm(monaco-editor-webpack-plugin)) = 7.0.1
Provides: bundled(npm(prettier-plugin-organize-imports)) = 2.3.4 Provides: bundled(npm(prettier-plugin-organize-imports)) = 2.3.4
Provides: bundled(npm(puppeteer)) = 10.4.0
Provides: bundled(npm(react-autosuggest)) = 10.1.0 Provides: bundled(npm(react-autosuggest)) = 10.1.0
Provides: bundled(npm(react-monaco-editor)) = 0.36.0 Provides: bundled(npm(react-monaco-editor)) = 0.47.0
Provides: bundled(npm(react-redux)) = 7.2.6 Provides: bundled(npm(react-redux)) = 7.2.9
Provides: bundled(npm(react-use)) = 15.3.8 Provides: bundled(npm(react-use)) = 17.4.0
Provides: bundled(npm(redux)) = 3.7.2 Provides: bundled(npm(redux)) = 4.1.0
Provides: bundled(npm(redux-persist)) = 4.10.2 Provides: bundled(npm(redux-persist)) = 6.0.0
Provides: bundled(npm(redux-thunk)) = 2.4.0 Provides: bundled(npm(redux-thunk)) = 2.4.1
Provides: bundled(npm(utility-types)) = 3.10.0 Provides: bundled(npm(utility-types)) = 3.10.0
%description %description
This Grafana plugin for Performance Co-Pilot includes datasources for This Grafana plugin for Performance Co-Pilot includes data sources for
scalable time series from pmseries(1) and Redis, live PCP metrics and scalable time series from pmseries(1) and Redis, live PCP metrics and
bpftrace scripts from pmdabpftrace(1), as well as several dashboards. bpftrace scripts from pmdabpftrace(1), as well as several dashboards.
@ -143,23 +133,16 @@ bpftrace scripts from pmdabpftrace(1), as well as several dashboards.
%setup -q -T -D -b 2 %setup -q -T -D -b 2
%endif %endif
%patch1 -p1 %patch -P 1 -p1
# Set up Go build subdir and links
mkdir -p %{_builddir}/src/github.com/performancecopilot
ln -s %{_builddir}/%{name}-%{version} \
%{_builddir}/src/github.com/performancecopilot/grafana-pcp
%build %build
# Build frontend datasources # Build frontend data sources
%if %{compile_frontend} %if %{compile_frontend}
%{SOURCE4} %{SOURCE4}
%endif %endif
# Build backend datasource # Build backend data source
cd %{_builddir}/src/github.com/performancecopilot/grafana-pcp
export GOPATH=%{_builddir}
%gobuild -o dist/datasources/redis/pcp_redis_datasource_$(go env GOOS)_$(go env GOARCH) ./pkg %gobuild -o dist/datasources/redis/pcp_redis_datasource_$(go env GOOS)_$(go env GOARCH) ./pkg
@ -167,37 +150,52 @@ export GOPATH=%{_builddir}
install -d -m 755 %{buildroot}/%{install_dir} install -d -m 755 %{buildroot}/%{install_dir}
cp -a dist/* %{buildroot}/%{install_dir} cp -a dist/* %{buildroot}/%{install_dir}
# On rpm-ostree based distributions, /var is exclusively reserved for application state.
# Grafana also supports installing plugins through the UI, therefore this RPM installs
# its content to /usr/share, and creates a symlink from /var to it using systemd-tmpfiles.
mkdir -p %{buildroot}%{_tmpfilesdir}
echo "L+ %{plugin_dir} - - - - %{install_dir}" > %{buildroot}%{_tmpfilesdir}/%{name}.conf
%postun %postun
# uninstall of old package # uninstall of old package
%systemd_postun_with_restart grafana-server.service %systemd_postun_with_restart grafana-server.service
%posttrans %posttrans
# install or upgrade of new package # install or upgrade of new package
# create symlink after the previous package got removed
%tmpfiles_create %_tmpfilesdir/%{name}.conf
# restart Grafana after the previous package got removed
if [ -x /usr/bin/systemctl ]; then if [ -x /usr/bin/systemctl ]; then
/usr/bin/systemctl try-restart grafana-server.service || : /usr/bin/systemctl try-restart grafana-server.service || :
fi fi
%check %check
# Test frontend datasources # Test frontend data sources
%if %{compile_frontend} %if %{compile_frontend}
yarn test yarn test
%endif %endif
# Test backend datasource # Test backend data source
cd %{_builddir}/src/github.com/performancecopilot/grafana-pcp
export GOPATH=%{_builddir}
%gotest ./pkg/... %gotest ./pkg/...
%files %files
%{install_dir} %{install_dir}
%{_tmpfilesdir}/%{name}.conf
# remove symlink when package is uninstalled
%ghost %{plugin_dir}
%license LICENSE NOTICE %license LICENSE NOTICE
%doc README.md %doc README.md
%changelog %changelog
* Thu Apr 20 2023 Stan Cox <scox@redhat.com> 5.1.1-1
- update to 5.1.1 tagged upstream community sources, see CHANGELOG
* Tue Nov 01 2022 Stan Cox <scox@redhat.com> 3.2.0-3 * Tue Nov 01 2022 Stan Cox <scox@redhat.com> 3.2.0-3
- resolve CVE-2022-27664 grafana-pcp: golang: net/http: handle server errors after sending GOAWAY - resolve CVE-2022-27664 grafana-pcp: golang: net/http: handle server errors after sending GOAWAY