initial upload
This commit is contained in:
parent
4063fe0014
commit
ab77dd37ae
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
/d3-flame-graph-*.tar.gz
|
||||
/d3-flame-graph-deps-*.tar.xz
|
17
README.md
17
README.md
@ -1,3 +1,20 @@
|
||||
# js-d3-flame-graph
|
||||
|
||||
The js-d3-flame-graph package
|
||||
|
||||
## Build instructions
|
||||
```
|
||||
VER=3.0.2
|
||||
spectool -g js-d3-flame-graph.spec
|
||||
./create_dependency_bundle.sh d3-flame-graph-$VER.tar.gz d3-flame-graph-deps-$VER.tar.xz
|
||||
./check_npm_dependencies.py js-d3-flame-graph.spec d3-flame-graph-$VER.tar.gz d3-flame-graph-deps-$VER.tar.xz
|
||||
fedpkg new-sources d3-flame-graph-$VER.tar.gz d3-flame-graph-deps-$VER.tar.xz
|
||||
|
||||
fedpkg local
|
||||
fedpkg lint
|
||||
fedpkg mockbuild
|
||||
fedpkg scratch-build --srpm
|
||||
|
||||
fedpkg build
|
||||
fedpkg update
|
||||
```
|
||||
|
42
check_npm_dependencies.py
Executable file
42
check_npm_dependencies.py
Executable file
@ -0,0 +1,42 @@
|
||||
#!/usr/bin/env python3
|
||||
import sys
|
||||
import tarfile
|
||||
import json
|
||||
import os.path
|
||||
|
||||
def read_spec_provides(spec_path):
|
||||
with open(spec_path) as f:
|
||||
for line in f:
|
||||
if line.startswith('Provides:'):
|
||||
yield line.strip()
|
||||
|
||||
def read_node_deps(source_archive_path):
|
||||
root_dir = os.path.basename(source_archive_path)[:-len('.tar.gz')]
|
||||
with tarfile.open(source_archive_path) as tar:
|
||||
f = tar.extractfile(f'{root_dir}/package.json')
|
||||
package_json = json.load(f)
|
||||
return list(package_json['devDependencies'].keys()) + list(package_json['dependencies'].keys())
|
||||
|
||||
def read_node_deps_versions(dep_bundle_path, dependencies):
|
||||
with tarfile.open(dep_bundle_path) as tar:
|
||||
for dependency in dependencies:
|
||||
f = tar.extractfile(f'node_modules/{dependency}/package.json')
|
||||
package_json = json.load(f)
|
||||
yield f'Provides: bundled(nodejs-{package_json["name"]}) = {package_json["version"]}'
|
||||
|
||||
if __name__ == '__main__':
|
||||
if len(sys.argv) != 4:
|
||||
print('usage: {} specfile source-archive dependency-bundle'.format(sys.argv[0]))
|
||||
sys.exit(1)
|
||||
|
||||
provides = list(read_spec_provides(sys.argv[1]))
|
||||
dependencies = sorted(read_node_deps(sys.argv[2]))
|
||||
actual_provides = list(read_node_deps_versions(sys.argv[3], dependencies))
|
||||
|
||||
if provides == actual_provides:
|
||||
print("Dependencies are up-to-date with the specfile.")
|
||||
sys.exit(0)
|
||||
else:
|
||||
print("Dependencies don't match, please update the specfile:")
|
||||
print ('\n'.join(actual_provides))
|
||||
sys.exit(1)
|
34
create_dependency_bundle.sh
Executable file
34
create_dependency_bundle.sh
Executable file
@ -0,0 +1,34 @@
|
||||
#!/bin/bash -eu
|
||||
|
||||
SRC=$(readlink -f "${1:?Usage: $0 source destination}")
|
||||
DEST=$(readlink -f "${2:?Usage: $0 source destination}")
|
||||
|
||||
if [ -f "$DEST" ]; then
|
||||
echo "File $DEST exists already."
|
||||
exit 0
|
||||
fi
|
||||
if [ "$#" -gt 2 ]; then
|
||||
PATCHES=$(readlink -f "${@:3}")
|
||||
else
|
||||
PATCHES=""
|
||||
fi
|
||||
|
||||
pushd "$(mktemp -d)"
|
||||
|
||||
echo Extracting sources...
|
||||
tar xfz "$SRC"
|
||||
cd d3-flame-graph-*
|
||||
|
||||
echo Applying patches...
|
||||
for patch in $PATCHES
|
||||
do
|
||||
patch -p1 < $patch
|
||||
done
|
||||
|
||||
echo Installing dependencies...
|
||||
npm install
|
||||
|
||||
echo Compressing...
|
||||
XZ_OPT=-9 tar cJf "$DEST" node_modules
|
||||
|
||||
popd
|
89
js-d3-flame-graph.spec
Normal file
89
js-d3-flame-graph.spec
Normal file
@ -0,0 +1,89 @@
|
||||
%global pkgname d3-flame-graph
|
||||
%global github https://github.com/spiermar/d3-flame-graph
|
||||
|
||||
Name: js-d3-flame-graph
|
||||
Version: 3.0.2
|
||||
Release: 1%{?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: d3-flame-graph-deps-%{version}.tar.xz
|
||||
Source2: create_dependency_bundle.sh
|
||||
|
||||
BuildRequires: web-assets-devel
|
||||
BuildRequires: nodejs
|
||||
Requires: web-assets-filesystem
|
||||
|
||||
# Bundled npm packages
|
||||
Provides: bundled(nodejs-clean-webpack-plugin) = 3.0.0
|
||||
Provides: bundled(nodejs-copy-webpack-plugin) = 5.1.1
|
||||
Provides: bundled(nodejs-css-loader) = 3.4.2
|
||||
Provides: bundled(nodejs-d3-array) = 2.4.0
|
||||
Provides: bundled(nodejs-d3-dispatch) = 1.0.6
|
||||
Provides: bundled(nodejs-d3-ease) = 1.0.6
|
||||
Provides: bundled(nodejs-d3-format) = 1.4.3
|
||||
Provides: bundled(nodejs-d3-hierarchy) = 1.1.9
|
||||
Provides: bundled(nodejs-d3-scale) = 3.2.1
|
||||
Provides: bundled(nodejs-d3-selection) = 1.4.1
|
||||
Provides: bundled(nodejs-d3-transition) = 1.3.2
|
||||
Provides: bundled(nodejs-eslint) = 6.8.0
|
||||
Provides: bundled(nodejs-eslint-config-standard) = 14.1.0
|
||||
Provides: bundled(nodejs-eslint-loader) = 3.0.3
|
||||
Provides: bundled(nodejs-eslint-plugin-import) = 2.20.1
|
||||
Provides: bundled(nodejs-eslint-plugin-node) = 11.0.0
|
||||
Provides: bundled(nodejs-eslint-plugin-promise) = 4.2.1
|
||||
Provides: bundled(nodejs-eslint-plugin-standard) = 4.0.1
|
||||
Provides: bundled(nodejs-html-webpack-plugin) = 3.2.0
|
||||
Provides: bundled(nodejs-script-ext-html-webpack-plugin) = 2.1.4
|
||||
Provides: bundled(nodejs-style-loader) = 1.1.3
|
||||
Provides: bundled(nodejs-tape) = 4.13.2
|
||||
Provides: bundled(nodejs-terser-webpack-plugin) = 2.3.5
|
||||
Provides: bundled(nodejs-webpack) = 4.42.0
|
||||
Provides: bundled(nodejs-webpack-cli) = 3.3.11
|
||||
Provides: bundled(nodejs-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 -n %{pkgname}-%{version}
|
||||
%setup -q -a 1 -n %{pkgname}-%{version}
|
||||
|
||||
%build
|
||||
rm -rf dist
|
||||
./node_modules/webpack/bin/webpack.js --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
|
||||
* Fri Mar 20 2020 Andreas Gerstmayr <agerstmayr@redhat.com> 3.0.2-1
|
||||
- initial version
|
2
sources
Normal file
2
sources
Normal file
@ -0,0 +1,2 @@
|
||||
SHA512 (d3-flame-graph-3.0.2.tar.gz) = 992c21ed8e88428cfa2475c6b4cffbc14fbdb163137cdab79a7f93ec9df8acacb890037a763d2e0d81e6e3755c8eb2d502cfaeb9027a077e80c5691c40516e47
|
||||
SHA512 (d3-flame-graph-deps-3.0.2.tar.xz) = b062cf151816a5d1ef4d60667097ed6e395dc14d5dcd877423e62ebed7e0d8c8513ac63f1d82c55ba03fa965a069afcaacba438e2ad1c6967f78f26428432900
|
Loading…
Reference in New Issue
Block a user