The package rpms/fkill-cli.git has added or updated architecture specific content in its spec file (ExclusiveArch/ExcludeArch or %ifarch/%ifnarch) in commit(s): https://src.fedoraproject.org/cgit/rpms/fkill-cli.git/commit/?id=726b0139f60....
Change: +ExclusiveArch: %{nodejs_arches} noarch
Thanks.
Full change: ============
commit 726b0139f60e09259444b11cdc3d11ff2585fd9b Author: Benjamin A. Beasley code@musicinmybrain.net Date: Mon Jun 14 10:35:28 2021 -0400
Initial package
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..bb5d847 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +/fkill-cli-6.1.0-nm-dev.tgz +/fkill-cli-6.1.0-nm-prod.tgz +/fkill-cli-6.1.0.tar.gz +/fkill-cli-6.1.0.tgz diff --git a/audited-null-licenses.toml b/audited-null-licenses.toml new file mode 100644 index 0000000..2c456ca --- /dev/null +++ b/audited-null-licenses.toml @@ -0,0 +1,58 @@ +[any] + +# All of these fall under rxjs, which has a proper license in its package.json: +"rxjs/webSocket" = "<unknown version>" +"rxjs/testing" = "<unknown version>" +"rxjs/operators" = "<unknown version>" +"rxjs/internal-compatibility" = "<unknown version>" +"rxjs/fetch" = "<unknown version>" +"rxjs/ajax" = "<unknown version>" + +# Just a module wrapper around the code in tslib, which does have a proper +# license in its package.json: +# tslib/modules +modules = "<unknown version>" +# A “dummy” module in the tests for tslib +# tslib/test/validateModuleExportsMatchCommonJS +validateModuleExportsMatchCommonJS = "<unknown version>" + +# These are all “dummy” modules in the tests for resolve: +# resolve/test/module_dir/zmodules/bbb +bbb = "<unknown version>" +# resolve/test/resolver/invalid_main +"invalid main" = "<unknown version>" +# resolve/test/resolver/incorrect_main +incorrect_main = "<unknown version>" +# resolve/test/resolver/dot_slash_main +dot_slash_main = "<unknown version>" +# resolve/test/resolver/dot_main +dot_main = "<unknown version>" +# resolve/test/resolver/baz +baz = "<unknown version>" +# resolve/test/resolver/browser_field +browser_field = "<unknown version>" +# resolve/test/resolver/symlinked/package +package = "<unknown version>" + +# stream-http/test/browser is covered by stream-http’s MIT license +browser = "<unknown version>" + +# flatted/cjs is covered by flatted’s ISC license +cjs = "<unknown version>" + +# uid2/LICENSE is MIT +uid2 = "0.0.3" + +[prod] + +[dev] + +# yaml/browser/dist is covered by yaml’s ISC license +dist = "<unknown version>" + +# @babel/helpers/scripts/package.json is covered by @babel/helpers’s MIT +# license +# @babel/traverse/scripts/package.json is covered by @babel/traverse’s MIT +# license +# @babel/types/scripts/package.json is covered by @babel/types’s MIT license +scripts = "<unknown version>" diff --git a/check-null-licenses b/check-null-licenses new file mode 100755 index 0000000..c19c60f --- /dev/null +++ b/check-null-licenses @@ -0,0 +1,189 @@ +#!/usr/bin/python3 +# -*- coding: utf-8 -*- + +import json +from argparse import ArgumentParser, FileType, RawDescriptionHelpFormatter +from pathlib import Path +from sys import exit, stderr + +import toml + + +def main(): + args = parse_args() + problem = False + for pjpath in args.tree.glob("**/package.json"): + name, version, license = parse(pjpath) + identity = f"{name} {version}" + if version in args.exceptions.get(name, ()): + continue # Do not even check the license + elif license is None: + problem = True + print( + f"Missing license in package.json for {identity}", file=stderr + ) + elif isinstance(license, dict): + if isinstance(license.get("type"), str): + continue + print( + ( + "Missing type for (deprecated) license object in " + f"package.json for {identity}: {license}" + ), + file=stderr, + ) + elif isinstance(license, list): + if license and all( + isinstance(entry, dict) and isinstance(entry.get("type"), str) + for entry in license + ): + continue + print( + ( + "Defective (deprecated) licenses array-of objects in " + f"package.json for {identity}: {license}" + ), + file=stderr, + ) + elif isinstance(license, str): + continue + else: + print( + ( + "Weird type for license in " + f"package.json for {identity}: {license}" + ), + file=stderr, + ) + problem = True + if problem: + return "At least one missing license was found." + + +def check_exception(exceptions, name, version): + x = args.exceptions + + +def parse(package_json_path): + with package_json_path.open("rb") as pjfile: + pj = json.load(pjfile) + try: + license = pj["license"] + except KeyError: + license = pj.get("licenses") + try: + name = pj["name"] + except KeyError: + name = package_json_path.parent.name + version = pj.get("version", "<unknown version>") + + return name, version, license + + +def parse_args(): + parser = ArgumentParser( + formatter_class=RawDescriptionHelpFormatter, + description=( + "Search for bundled dependencies without declared licenses" + ), + epilog=""" + +The exceptions file must be a TOML file with zero or more tables. Each table’s +keys are package names; the corresponding values values are exact version +number strings, or arrays of version number strings, that have been manually +audited to determine their license status and should therefore be ignored. + +Exceptions in a table called “any” are always applied. Otherwise, exceptions +are applied only if a corresponding --with TABLENAME argument is given; +multiple such arguments may be given. + +For +example: + + [any] + example-foo = "1.0.0" + + [prod] + example-bar = [ "2.0.0", "2.0.1",] + + [dev] + example-bat = [ "3.7.4",] + +would always ignore version 1.0.0 of example-foo. It would ignore example-bar +2.0.1 only when called with “--with prod”. + +Comments may (and should) be used to describe the manual audits upon which the +exclusions are based. + +Otherwise, any package.json with missing or null license field in the tree is +considered an error, and the program returns with nonzero status. +""", + ) + parser.add_argument( + "-x", + "--exceptions", + type=FileType("r"), + help="Manually audited package versions file", + ) + parser.add_argument( + "-w", + "--with", + action="append", + default=[], + help="Enable a table in the exceptions file", + ) + parser.add_argument( + "tree", + metavar="node_modules_dir", + type=Path, + help="Path to search recursively", + default=".", + ) + args = parser.parse_args() + + if args.exceptions is None: + args.exceptions = {} + xname = None + else: + with args.exceptions as xfile: + xname = getattr(xfile, "name", "<exceptions>") + args.exceptions = toml.load(args.exceptions) + if not isinstance(args.exceptions, dict): + parser.error(f"Invalid format in {xname}: not an object") + for tablename, table in args.exceptions.items(): + if not isinstance(table, dict): + parser.error( + f"Non-table entry in {xname}: {tablename} = {table!r}" + ) + overlay = {} + for key, value in table.items(): + if isinstance(value, str): + overlay[key] = [value] + elif not isinstance(value, list) or not all( + isinstance(entry, str) for entry in value + ): + parser.error( + f"Invalid format in {xname} in [{tablename}]: " + f"{key!r} = {value!r}" + ) + table.update(overlay) + + x = args.exceptions.get("any", {}) + for add in getattr(args, "with"): + try: + x.update(args.exceptions[add]) + except KeyError: + if xname is None: + parser.error( + f"No table {add}, as no exceptions file was given" + ) + else: + parser.error(f"No table {add} in {xname}") + # Store the merged dictionary + args.exceptions = x + + return args + + +if __name__ == "__main__": + exit(main()) diff --git a/fkill-cli-6.1.0-bundled-licenses.txt b/fkill-cli-6.1.0-bundled-licenses.txt new file mode 100644 index 0000000..7268bd1 --- /dev/null +++ b/fkill-cli-6.1.0-bundled-licenses.txt @@ -0,0 +1,8 @@ +"0BSD" +"Apache-2.0" +"BSD-2-Clause" +"CC0-1.0" +"CC-BY-3.0" +"ISC" +"MIT" +"(MIT OR CC0-1.0)" diff --git a/fkill-cli.spec b/fkill-cli.spec new file mode 100644 index 0000000..b0185ea --- /dev/null +++ b/fkill-cli.spec @@ -0,0 +1,189 @@ +%global npm_name fkill-cli + +Name: %{npm_name} +Version: 6.1.0 +Release: 1%{?dist} +Summary: Fabulously kill processes + +# License of fkill-cli is MIT; others come from bundled dependencies. See +# the license file %%{npm_name}-%%{version}-bundled-licenses.txt for a list of +# licenses in NPM format. Each bundled dependency has the license specified in +# the "license" key of its package.json file. +License: MIT and 0BSD and ASL 2.0 and BSD and CC0 and CC-BY and ISC and (MIT or CC0) +%global forgeurl https://github.com/sindresorhus/%%7Bnpm_name%7D +%forgemeta +URL: %{forgeurl} +Source0: https://registry.npmjs.org/%%7Bnpm_name%7D/-/%%7Bnpm_name%7D-%%7Bversion%7D.... +# The test files are not included in the NPM tarball. Instead of using a +# dl-tests.sh script source, we add the corresponding GitHub tarball as a +# second source. This results in some duplication in the source RPM, but it is +# a lot simpler! +# +# Note https://docs.fedoraproject.org/en-US/packaging-guidelines/Node.js/ says, +# “The canonical method for shipping most node modules is tarballs from the npm +# registry. […] This method should be preferred to using checkouts from git or +# automatically generated tarballs from GitHub.” (Otherwise, we might just use +# the GitHub tarball as the primary source.) +Source1: %{forgesource} +# Created with (from nodejs-packaging RPM): +# nodejs-packaging-bundler %%{npm_name} %%{version} +Source2: %{npm_name}-%{version}-nm-prod.tgz +Source3: %{npm_name}-%{version}-nm-dev.tgz +Source4: %{npm_name}-%{version}-bundled-licenses.txt +# Hand-written man page +Source5: fkill.1 +# https://bugzilla.redhat.com/show_bug.cgi?id=1920223 +Source6: check-null-licenses +Source7: audited-null-licenses.toml + +ExclusiveArch: %{nodejs_arches} noarch +BuildArch: noarch + +BuildRequires: nodejs-devel +BuildRequires: symlinks +BuildRequires: rsync + +# For check-null-licenses +BuildRequires: python3 +BuildRequires: python3dist(toml) + +# Dependencies shell out to ps and ss: +BuildRequires: procps-ng +BuildRequires: iproute + +Requires: nodejs + +# Dependencies shell out to ps and ss: +Requires: procps-ng +Requires: iproute + +%global test_sources fixture.js test.js + +%description +%{summary}. + + +%prep +%setup -q -n package +# Copy in the tests from the GitHub tarball. +%setup -q -T -D -b 1 -n package +for src in %{test_sources} +do + cp -p "../%{npm_name}-%{version}/${src}" ./ +done + +cp %{SOURCE4} . +# Set up bundled runtime (prod) node modules. +tar -xzf %{SOURCE2} +mkdir -p node_modules +pushd node_modules +ln -s ../node_modules_prod/* . +ln -s ../node_modules_prod/.bin . +popd + +# Fix shebang lines in executables. For some reason, brp-mangle-shebangs does +# not seem to do this under %%nodejs_sitelib. +find . -type f -perm /0111 | + while read -r fn + do + if head -n 1 "${fn}" | grep -E '^#!%{_bindir}/env[[:blank:]]+' >/dev/null + then + sed -r -i '1s/env +//' "${fn}" + fi + done + +# Remove dotfiles (hidden files) from bundled dependencies. As of 6.1.0-1, +# these include: (.editorconfig .eslintignore .eslintrc .eslintrc.json .gitkeep +# .istanbul.yml .jscs.json .npmignore .nycrc .travis.yml) and are all not +# needed at runtime. If a dependency appears with an important hidden file, we +# may need to exclude it from removal. +# +# Also remove zero-length files from bundled dependencies. As of 6.1.0-1, these +# are only in tests and examples for bundled dependencies, neither of which +# will be used by the installed package, so it is OK if these portions of the +# dependencies are broken by the removal. +find node_modules_prod -type f ( -name '.*' -o -size 0 ) -print -delete + +# Remove hidden directories from bundled dependencies, except those known to be +# useful. If a dependency appears with an important hidden directory, we may +# need to exclude it from removal. +# +# We do need to keep .bin/ directories around, as they will be used in %%check. +# We can remove them from the installed buildroot, however. +find node_modules_prod -depth -type d -name '.*' ! -name '.bin' \ + -printf '--> Remove hidden directory %p\n' -exec rm -rvf '{}' ';' + +# Fix some goofy permissions +find node_modules_prod -type f -name '*.json' -perm /0111 \ + -execdir chmod -v a-x '{}' '+' + + +# Nothing to build + + +%install +install -d %{buildroot}%{nodejs_sitelib}/%{npm_name} +cp -rp \ + package.json \ + cli.js \ + interactive.js \ + node_modules node_modules_prod \ + %{buildroot}%{nodejs_sitelib}/%{npm_name} + +install -d %{buildroot}%{_bindir} +# Create an absolute symlink in the buildroot, then convert it to a relative +# one that will still resolve after installation. Otherwise, to create a +# relative symlink, we would have to know how deeply nested %%nodejs_sitelib +# is, which breaks the abstraction of using a macro. +ln -sf %{buildroot}%{nodejs_sitelib}/%{npm_name}/cli.js \ + %{buildroot}%{_bindir}/fkill +symlinks -c -o %{buildroot}%{_bindir}/fkill + +install -D -t %{buildroot}%{_mandir}/man1 -p -m 0644 %{SOURCE5} + +# We do not need binaries associated with bundled node libraries, so even .bin +# directories may be removed from the buildroot. +find %{buildroot}/%{nodejs_sitelib}/%{npm_name}/node_modules_prod \ + -depth -type d -name '.bin' \ + -printf '--> Remove hidden directory %p\n' -exec rm -rvf '{}' ';' +# Also, remove the .bin symlink: +rm -vf %{buildroot}/%{nodejs_sitelib}/%{npm_name}/node_modules/.bin + + +%check +%{python3} %{SOURCE6} --exceptions %{SOURCE7} --with prod node_modules_prod +%{python3} %{SOURCE6} --exceptions %{SOURCE7} --with dev node_modules_dev +%nodejs_symlink_deps --check +# We do not call: +# %%{__nodejs} -e 'require("./")' +# because this package does not provide an importable module. See the lack of a +# "main" or "module" key in package.json. + +# Set up bundled dev node_modules for testing. We must do this here, not in +# prep, so that they are not pulled into the installed RPM. +tar -xzf %{SOURCE3} +# The usual symlinking approach recommended by the guidelines does not work as +# some dependencies are split across the prod and dev tarballs due to plugins. +# Instead, we overlay the two directories using local rsync. This is less +# space-efficient, but it works! +rm -rf node_modules +cp -rp ./node_modules_prod node_modules +rsync -aqP ./node_modules_dev/ ./node_modules/ + +# See scripts.test in package.json. We must explicitly specify the test script, +# or ava recurses inside node_modules*/ looking for tests and finds a great +# many excuses to crash. +NODE_ENV=test ./node_modules/.bin/ava test.js + + +%files +%doc readme.md +%license license %{npm_name}-%{version}-bundled-licenses.txt +%{nodejs_sitelib}/%{npm_name} +%{_bindir}/fkill +%{_mandir}/man1/fkill.1* + + +%changelog +* Thu Jun 10 2021 Benjamin A. Beasley code@musicinmybrain.net - 6.1.0-1 +- Initial package diff --git a/fkill.1 b/fkill.1 new file mode 100644 index 0000000..faef08a --- /dev/null +++ b/fkill.1 @@ -0,0 +1,55 @@ +.color 1 +.TH FKILL "1" "January 2021" "" "User Commands" +.SH NAME +fkill - fabulously kill processes +.SH SYNOPSIS +.B fkill +.RI [< pid | name >\ ...] +.SH DESCRIPTION +.P +To kill a port, prefix it with a colon. +For example: +.BR :8080 . +.P +Run without arguments to use the interactive interface. +In interactive mode, +.B [u1F6A6]n% +indicates high CPU usage and +.B [u1F40F]n% +indicates high memory usage. +.P +The process name is case insensitive. +.SH OPTIONS +.TP +.BR -f , \ --force +Force kill +.TP +.BR -v , \ --verbose +Show process arguments +.TP +.BR -f , \ --force +Force kill +.TP +.BR -s , \ --silent +Silently kill and always exit with code 0 +.SH EXAMPLES +.P +.EX +.B $ fkill 1337 +.EE +.EX +.B $ fkill safari +.EE +.EX +.B $ fkill :8080 +.EE +.EX +.B $ fkill 1337 safari :8080 +.EE +.EX +.B $ fkill +.EE +.SH "SEE ALSO" +.BR kill (1), +.BR killall (1), +.BR pkill (1) diff --git a/sources b/sources new file mode 100644 index 0000000..1c2e859 --- /dev/null +++ b/sources @@ -0,0 +1,4 @@ +SHA512 (fkill-cli-6.1.0-nm-dev.tgz) = 94595ee0859f6b26dafc1b067cf9bf5bd4f54a77fbf057e7dede03e09e39b472ad97cf8c027834bbb9648f8897e9531c320872e14021d3165d122dc3c7c37703 +SHA512 (fkill-cli-6.1.0-nm-prod.tgz) = b66ddd903ea75446978fa7522923af7abd5b91b61e9bc92410683120ca04badf315db8d4529116d265a05289a8c4f9aa1f29d2997e69b24c5662f8188aa6880d +SHA512 (fkill-cli-6.1.0.tar.gz) = 889ffb7a13e40eb74fdb83e6e37ca37b78db1397a385efb7b8418b6fdb146184d147497583fc8cc992048030617d75dc46ff3b27c1d9b13b79d5d496e04e81f0 +SHA512 (fkill-cli-6.1.0.tgz) = ba7b55b87804423c135d01a259cc0c4e2d1492cea1b7d47985bd660d3e001108ad67fcfc52b86fb1e42c1840b79151237f143a6dd98231a03f84a4d9e5a403ac
arch-excludes@lists.fedoraproject.org