From 9211e7007b0c93921a88e8311dee2e376b857769 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Nov 02 2021 13:10:38 +0000 Subject: import js-d3-flame-graph-3.0.2-7.el9 --- diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5b22c24 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +SOURCES/d3-flame-graph-3.0.2.tar.gz +SOURCES/js-d3-flame-graph-vendor-3.0.2-6.tar.xz diff --git a/.js-d3-flame-graph.metadata b/.js-d3-flame-graph.metadata new file mode 100644 index 0000000..f011b3c --- /dev/null +++ b/.js-d3-flame-graph.metadata @@ -0,0 +1,2 @@ +fb58e7c0a97d85b88c62d7e87cc782fb99c41fe9 SOURCES/d3-flame-graph-3.0.2.tar.gz +77ab2195bde4b30f33b952a710a9503e44c3da28 SOURCES/js-d3-flame-graph-vendor-3.0.2-6.tar.xz diff --git a/SOURCES/001-remove-unused-frontend-crypto-and-update-hash-fn.patch b/SOURCES/001-remove-unused-frontend-crypto-and-update-hash-fn.patch new file mode 100644 index 0000000..ff0e49a --- /dev/null +++ b/SOURCES/001-remove-unused-frontend-crypto-and-update-hash-fn.patch @@ -0,0 +1,80 @@ +diff --git a/package.json b/package.json +index 2284a2f..26bb09b 100644 +--- a/package.json ++++ b/package.json +@@ -58,5 +58,8 @@ + "d3-selection": "^1.4.1", + "d3-transition": "^1.3.2", + "d3-dispatch": "^1.0.6" ++ }, ++ "resolutions": { ++ "crypto-browserify": "https://registry.yarnpkg.com/@favware/skip-dependency/-/skip-dependency-1.1.1.tgz" + } + } +diff --git a/webpack.config.js b/webpack.config.js +index 7153477..e663cf1 100644 +--- a/webpack.config.js ++++ b/webpack.config.js +@@ -19,7 +19,11 @@ module.exports = [{ + filename: '[name].js', + library: 'flamegraph', + libraryExport: 'default', +- libraryTarget: 'umd' ++ libraryTarget: 'umd', ++ hashFunction: 'sha256', ++ }, ++ node: { ++ crypto: false + }, + plugins: [ + new CopyWebpackPlugin([{ +@@ -54,7 +58,11 @@ module.exports = [{ + path: path.resolve(__dirname, 'dist'), + filename: '[name].js', + library: ['flamegraph', 'colorMapper'], +- libraryTarget: 'umd' ++ libraryTarget: 'umd', ++ hashFunction: 'sha256', ++ }, ++ node: { ++ crypto: false + }, + module: { + rules: [{ +@@ -80,7 +88,11 @@ module.exports = [{ + path: path.resolve(__dirname, 'dist'), + filename: '[name].js', + library: ['flamegraph', 'tooltip'], +- libraryTarget: 'umd' ++ libraryTarget: 'umd', ++ hashFunction: 'sha256', ++ }, ++ node: { ++ crypto: false + }, + module: { + rules: [{ +@@ -101,7 +113,11 @@ module.exports = [{ + entry: './template.js', + output: { + path: path.resolve(__dirname, 'dist', 'templates'), +- filename: 'bundle.js' ++ filename: 'bundle.js', ++ hashFunction: 'sha256', ++ }, ++ node: { ++ crypto: false + }, + plugins: [ + new CleanWebpackPlugin({ +@@ -131,5 +147,10 @@ module.exports = [{ + use: ['style-loader', 'css-loader'] + } + ] ++ }, ++ optimization: { ++ minimizer: [ ++ new TerserPlugin() ++ ] + } + }] diff --git a/SOURCES/002-webpack-update-hash-fn.vendor.patch b/SOURCES/002-webpack-update-hash-fn.vendor.patch new file mode 100644 index 0000000..b842d88 --- /dev/null +++ b/SOURCES/002-webpack-update-hash-fn.vendor.patch @@ -0,0 +1,13 @@ +diff --git a/node_modules/webpack/lib/optimize/ConcatenatedModule.js b/node_modules/webpack/lib/optimize/ConcatenatedModule.js +index 03711c4..df4d216 100644 +--- a/node_modules/webpack/lib/optimize/ConcatenatedModule.js ++++ b/node_modules/webpack/lib/optimize/ConcatenatedModule.js +@@ -560,7 +560,7 @@ class ConcatenatedModule extends Module { + orderedConcatenationListIdentifiers += " "; + } + } +- const hash = createHash("md4"); ++ const hash = createHash("sha256"); + hash.update(orderedConcatenationListIdentifiers); + return this.rootModule.identifier() + " " + hash.digest("hex"); + } diff --git a/SOURCES/Makefile b/SOURCES/Makefile new file mode 100644 index 0000000..cef2f9b --- /dev/null +++ b/SOURCES/Makefile @@ -0,0 +1,42 @@ +ifndef VER + $(error VER is undefined) +endif +ifndef REL + $(error REL is undefined) +endif + +NAME := d3-flame-graph +RPM_NAME := js-$(NAME) +SOURCE_DIR := $(NAME)-$(VER) +SOURCE_TAR := $(NAME)-$(VER).tar.gz +VENDOR_TAR := $(RPM_NAME)-vendor-$(VER)-$(REL).tar.xz + +ALL_PATCHES := $(sort $(wildcard *.patch)) +VENDOR_PATCHES := $(sort $(wildcard *.vendor.patch)) +SOURCE_PATCHES := $(filter-out $(VENDOR_PATCHES),$(ALL_PATCHES)) + +all: $(SOURCE_TAR) $(VENDOR_TAR) + +$(SOURCE_TAR): + spectool -g $(RPM_NAME).spec + +$(VENDOR_TAR): $(SOURCE_TAR) + rm -rf $(SOURCE_DIR) + tar xf $(SOURCE_TAR) + + # Patches to apply before vendoring + for patch in $(SOURCE_PATCHES); do echo $$patch; patch -d $(SOURCE_DIR) -p1 --fuzz=0 < $$patch; done + + # Node.js + cd $(SOURCE_DIR) && yarn import && yarn install --pure-lockfile + ./list_bundled_nodejs_packages.py $(SOURCE_DIR)/ >> $@.manifest + + # Patches to apply after vendoring + for patch in $(VENDOR_PATCHES); do echo $$patch; patch -d $(SOURCE_DIR) -p1 --fuzz=0 < $$patch; done + + # Create tarball + XZ_OPT=-9 tar cJf $@ \ + $(SOURCE_DIR)/node_modules + +clean: + rm -rf *.tar.gz *.tar.xz *.manifest *.rpm $(NAME)-*/ diff --git a/SOURCES/list_bundled_nodejs_packages.py b/SOURCES/list_bundled_nodejs_packages.py new file mode 100755 index 0000000..3158c2c --- /dev/null +++ b/SOURCES/list_bundled_nodejs_packages.py @@ -0,0 +1,47 @@ +#!/usr/bin/env python3 +# +# generates Provides: bundled(npm(...)) = ... lines for each declared dependency and devDependency of package.json +# +import sys +import json +import re +from packaging import version + + +def read_declared_pkgs(package_json_path): + with open(package_json_path) as f: + package_json = json.load(f) + return list(package_json['dependencies'].keys()) + list(package_json['devDependencies'].keys()) + + +def read_installed_pkgs(yarn_lock_path): + with open(yarn_lock_path) as f: + lockfile = f.read() + return re.findall(r'^"?' # can start with a " + r'(.+?)@.+(?:,.*)?:\n' # characters up to @ + r' version "(.+)"', # and the version + lockfile, re.MULTILINE) + + +def list_provides(declared_pkgs, installed_pkgs): + for declared_pkg in declared_pkgs: + # there can be multiple versions installed of one package (transitive dependencies) + # but rpm doesn't support Provides: with a single package and multiple versions + # so let's declare the oldest version here + versions = [version.parse(pkg_version) + for pkg_name, pkg_version in installed_pkgs if pkg_name == declared_pkg] + oldest_version = sorted(versions)[0] + yield f"Provides: bundled(npm({declared_pkg})) = {oldest_version}" + + +if __name__ == "__main__": + if len(sys.argv) != 2: + print(f"usage: {sys.argv[0]} package-X.Y.Z/", file=sys.stdout) + sys.exit(1) + + package_dir = sys.argv[1] + declared_pkgs = read_declared_pkgs(f"{package_dir}/package.json") + installed_pkgs = read_installed_pkgs(f"{package_dir}/yarn.lock") + provides = list_provides(declared_pkgs, installed_pkgs) + for provide in sorted(provides): + print(provide) diff --git a/SPECS/js-d3-flame-graph.spec b/SPECS/js-d3-flame-graph.spec new file mode 100644 index 0000000..228f1d6 --- /dev/null +++ b/SPECS/js-d3-flame-graph.spec @@ -0,0 +1,120 @@ +%global pkgname d3-flame-graph +%global github https://github.com/spiermar/d3-flame-graph + +Name: js-d3-flame-graph +Version: 3.0.2 +Release: 7%{?dist} +Summary: A D3.js plugin that produces flame graphs + +BuildArch: noarch + +License: ASL 2.0 +URL: %{github} + +Source0: %{github}/archive/%{version}/%{pkgname}-%{version}.tar.gz +Source1: js-d3-flame-graph-vendor-%{version}-6.tar.xz +Source2: Makefile +Source3: list_bundled_nodejs_packages.py + +Patch1: 001-remove-unused-frontend-crypto-and-update-hash-fn.patch +Patch2: 002-webpack-update-hash-fn.vendor.patch + +BuildRequires: web-assets-devel +BuildRequires: nodejs +Requires: web-assets-filesystem + +# Bundled npm packages +Provides: bundled(npm(clean-webpack-plugin)) = 3.0.0 +Provides: bundled(npm(copy-webpack-plugin)) = 5.1.1 +Provides: bundled(npm(css-loader)) = 3.4.2 +Provides: bundled(npm(d3-array)) = 2.4.0 +Provides: bundled(npm(d3-dispatch)) = 1.0.6 +Provides: bundled(npm(d3-ease)) = 1.0.6 +Provides: bundled(npm(d3-format)) = 1.4.3 +Provides: bundled(npm(d3-hierarchy)) = 1.1.9 +Provides: bundled(npm(d3-scale)) = 3.2.1 +Provides: bundled(npm(d3-selection)) = 1.4.1 +Provides: bundled(npm(d3-transition)) = 1.3.2 +Provides: bundled(npm(eslint)) = 6.8.0 +Provides: bundled(npm(eslint-config-standard)) = 14.1.0 +Provides: bundled(npm(eslint-loader)) = 3.0.3 +Provides: bundled(npm(eslint-plugin-import)) = 2.20.1 +Provides: bundled(npm(eslint-plugin-node)) = 11.0.0 +Provides: bundled(npm(eslint-plugin-promise)) = 4.2.1 +Provides: bundled(npm(eslint-plugin-standard)) = 4.0.1 +Provides: bundled(npm(html-webpack-plugin)) = 3.2.0 +Provides: bundled(npm(script-ext-html-webpack-plugin)) = 2.1.4 +Provides: bundled(npm(style-loader)) = 1.1.3 +Provides: bundled(npm(tape)) = 4.13.2 +Provides: bundled(npm(terser-webpack-plugin)) = 1.4.3 +Provides: bundled(npm(webpack)) = 4.42.0 +Provides: bundled(npm(webpack-cli)) = 3.3.11 +Provides: bundled(npm(webpack-dev-server)) = 3.10.3 + +%description +A D3.js plugin that produces flame graphs from hierarchical data. + + +%package doc +Summary: Documentation and example files for js-d3-flame-graph + +%description doc +Documentation and example files for js-d3-flame-graph. + + +%prep +%setup -q -T -D -b 0 -n %{pkgname}-%{version} +%setup -q -T -D -b 1 -n %{pkgname}-%{version} + +%patch1 -p1 + + +%build +./node_modules/.bin/webpack --mode production + + +%install +install -d -m 755 %{buildroot}/%{_datadir}/%{pkgname} +mv dist/templates/* %{buildroot}/%{_datadir}/%{pkgname} +rmdir dist/templates + +install -d -m 755 %{buildroot}/%{_jsdir}/%{pkgname} +cp -a dist/* %{buildroot}/%{_jsdir}/%{pkgname} + + +%files +%{_jsdir}/%{pkgname} +%{_datadir}/%{pkgname} + +%license LICENSE +%doc README.md + + +%files doc +%doc README.md examples + + +%changelog +* Mon Aug 09 2021 Mohan Boddu - 3.0.2-7 +- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags + Related: rhbz#1991688 + +* Wed Jun 30 2021 Andreas Gerstmayr - 3.0.2-6 +- change webpack hash function to sha256 +- remove unused cryptographic implementations + +* Tue Jun 22 2021 Mohan Boddu - 3.0.2-5 +- Rebuilt for RHEL 9 BETA for openssl 3.0 + Related: rhbz#1971065 + +* Fri Apr 16 2021 Mohan Boddu - 3.0.2-4 +- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937 + +* Tue Jan 26 2021 Fedora Release Engineering - 3.0.2-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild + +* Tue Jul 28 2020 Fedora Release Engineering - 3.0.2-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild + +* Fri Mar 20 2020 Andreas Gerstmayr 3.0.2-1 +- initial version