From 13fc402a405f6535d4392c136ce4e1705810cf20 Mon Sep 17 00:00:00 2001 From: Miro Hrončok Date: Feb 02 2022 12:09:53 +0000 Subject: Orphaned for 6+ weeks --- diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 7f1978f..0000000 --- a/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -/topojson-client-3.1.0-nm-dev.tgz -/topojson-client-3.1.0-nm-prod.tgz -/topojson-client-3.1.0.tar.gz -/topojson-client-3.1.0.tgz diff --git a/README.md b/README.md deleted file mode 100644 index 1f3d373..0000000 --- a/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# topojson-client - -The topojson-client package diff --git a/audited-null-licenses.toml b/audited-null-licenses.toml deleted file mode 100644 index f2605a6..0000000 --- a/audited-null-licenses.toml +++ /dev/null @@ -1,39 +0,0 @@ -[any] - -[prod] - -[dev] - -# All of these fall under rxjs, which has a proper license in its package.json: -"rxjs/webSocket" = "" -"rxjs/testing" = "" -"rxjs/operators" = "" -"rxjs/internal-compatibility" = "" -"rxjs/fetch" = "" -"rxjs/ajax" = "" - -# Just a module wrapper around the code in tslib, which does have a proper -# license in its package.json: -# tslib/modules -modules = "" -# A “dummy” module in the tests for tslib -# tslib/test/validateModuleExportsMatchCommonJS -validateModuleExportsMatchCommonJS = "" - -# These are all “dummy” modules in the tests for resolve: -# resolve/test/module_dir/zmodules/bbb -bbb = "" -# resolve/test/resolver/invalid_main -"invalid main" = "" -# resolve/test/resolver/incorrect_main -incorrect_main = "" -# resolve/test/resolver/dot_slash_main -dot_slash_main = "" -# resolve/test/resolver/dot_main -dot_main = "" -# resolve/test/resolver/baz -baz = "" -# resolve/test/resolver/browser_field -browser_field = "" -# resolve/test/resolver/symlinked/package -package = "" diff --git a/changelog b/changelog deleted file mode 100644 index eae0ecb..0000000 --- a/changelog +++ /dev/null @@ -1,5 +0,0 @@ -* Fri Feb 05 2021 Benjamin A. Beasley - 3.1.0-2 -- Add script to audit for dependencies with null licenses in %%check - -* Sat Jan 23 2021 Benjamin A. Beasley - 3.1.0-1 -- Initial package diff --git a/check-null-licenses b/check-null-licenses deleted file mode 100755 index db2e0d3..0000000 --- a/check-null-licenses +++ /dev/null @@ -1,191 +0,0 @@ -#!/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 - if not args.tree.is_dir(): - return f"Not a directory: {args.tree}" - 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", "") - - 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", "") - 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/dead.package b/dead.package new file mode 100644 index 0000000..5204a84 --- /dev/null +++ b/dead.package @@ -0,0 +1 @@ +Orphaned for 6+ weeks diff --git a/sources b/sources deleted file mode 100644 index 0ea266b..0000000 --- a/sources +++ /dev/null @@ -1,4 +0,0 @@ -SHA512 (topojson-client-3.1.0.tgz) = eb4e6ec52e9b718c465f0f6a8bad97cab57a437c706e776369c866371bbc1d64ed54fc597c424df5f77f4994b5439e129f6cb44ccc8cc458ff70920da861eb2b -SHA512 (topojson-client-3.1.0.tar.gz) = f3a23641f71a7f689677532a19af3c42842a8ea06cf2734791eeb1eb5f704ba651fe30304d83eff173981bb4965627d964bc1b771cda6f2c334a3375b3adc2f4 -SHA512 (topojson-client-3.1.0-nm-prod.tgz) = f61ac76d8b1dbbc530a3c576944cf891ba3d32ac8e37c9c190065cfd9c32fc95e6e1b57fbdcd352e319d00e26e4a056f79b6116f4339c0ecd0d2c3974c0ce204 -SHA512 (topojson-client-3.1.0-nm-dev.tgz) = fba29b79d6c6f17333c9aef7bd3664471f7fda654f519a285de5c0f6b90b6278dcb52a7ccb0c5924e34c533550c894a9790d18bbb70f82ef410c00f90dbc44e5 diff --git a/topo2geo.1 b/topo2geo.1 deleted file mode 100644 index bb6fd06..0000000 --- a/topo2geo.1 +++ /dev/null @@ -1,77 +0,0 @@ -.TH TOPO2GEO "1" "January 2021" "" "User Commands" -.SH NAME -topo2geo \- converts TopoJSON objects to GeoJSON features -.SH SYNOPSIS -.B topo2geo -.RI [ options ] -.RI <[ name =] file >\ ... -.SH DESCRIPTION -.P -Converts one or more TopoJSON objects from an input topology to one or more -GeoJSON features. -For example, to convert the \[lq]states\[rq] TopoJSON GeometryCollection object -in us.json to a GeoJSON feature collection in us-states.json: -.P -.in +4n -.EX -.B topo2geo states=us-states.json < us.json -.EE -.in -.P -For convenience, you can omit the object name and specify only the -.I file -name; the object name will be the basename of the file, with the directory and -extension removed. -For example, to convert the \[lq]states\[rq] TopoJSON GeometryCollection object -in us.json to a GeoJSON feature collection in states.json: -.P -.in +4n -.EX -.B topo2geo states.json < us.json -.EE -.in -.SH OPTIONS -.TP -\fB\-h\fR, \fB\-\-help\fR -Output usage information. -.TP -.BR \-V , \ \-\-version -Output the version number. -.TP -.BR \-n , \ \-\-newline\-delimited -Output -.UR https://ndjson.org/ -newline-delimited JSON -.UE , -with one feature per line. -.TP -.BR \-i , \ \-\-in\ \fIfile -Specify the input TopoJSON file name. -Defaults to -.B \- -for stdin. -.TP -.BR \-l , \ \-\-list -List the names of the objects in the input topology, and then exit. -For example, this: -.IP -.in +4n -.EX -.B topo2geo -l < us.json -.EE -.in -.IP -Will output this: -.IP -.in +4n -.EX -.B counties -.B states -.B nation -.EE -.in -.SH "SEE ALSO" -.BR geo2topo (1), -.BR topomerge (1), -.BR topoquantize (1), -.BR toposimplify (1) diff --git a/topojson-client-3.1.0-bundled-licenses.txt b/topojson-client-3.1.0-bundled-licenses.txt deleted file mode 100644 index 215e2c5..0000000 --- a/topojson-client-3.1.0-bundled-licenses.txt +++ /dev/null @@ -1,2 +0,0 @@ -"ISC" -"MIT" diff --git a/topojson-client.spec b/topojson-client.spec deleted file mode 100644 index f670a88..0000000 --- a/topojson-client.spec +++ /dev/null @@ -1,203 +0,0 @@ -%global npm_name topojson-client - -Name: %{npm_name} -Version: 3.1.0 -Release: %autorelease -b 2 -Summary: Manipulate TopoJSON and convert it to GeoJSON - -# License of topojson-client is ISC; 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: ISC and MIT -%global forgeurl https://github.com/topojson/%{npm_name} -%forgemeta -URL: %{forgeurl} -Source0: https://registry.npmjs.org/%{npm_name}/-/%{npm_name}-%{version}.tgz -# 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 pages -Source5: topo2geo.1 -Source6: topomerge.1 -Source7: topoquantize.1 -# https://bugzilla.redhat.com/show_bug.cgi?id=1920223 -Source8: check-null-licenses -Source9: audited-null-licenses.toml - -ExclusiveArch: %{nodejs_arches} noarch -BuildArch: noarch - -BuildRequires: nodejs-devel -BuildRequires: /usr/bin/esbuild -BuildRequires: symlinks -BuildRequires: rsync - -# For check-null-licenses -BuildRequires: python3 -BuildRequires: python3dist(toml) - -Requires: nodejs - -%description -This provides tools for manipulating TopoJSON, such as to merge shapes or -quantize coordinates, and for converting back to GeoJSON for rendering with -standard tools such as d3.geoPath. - -topo2geo - - Converts one or more TopoJSON objects from an input topology to one or more - GeoJSON features. - -topomerge - - Merges polygons (or meshes lines) from the specified source TopoJSON geometry - collection object, assigning to the target object. - -topoquantize - - Quantizes the coordinates of the input TopoJSON topology and delta-encodes - the topology’s arcs. - -See also topojson-server and topojson-simplify. - - -%prep -%setup -q -n package -# Copy in the tests from the GitHub tarball. -%setup -q -T -D -b 1 -n package -cp -rp '../%{npm_name}-%{version}/test' './' - -# Remove pre-compiled bundled JavaScript that was built with rollup. Fedora -# guidelines prevent us from using it. -rm -rf dist - -cp -p '%{SOURCE4}' . -# Set up bundled runtime (prod) node modules. -tar -xzf '%{SOURCE2}' -mkdir -p node_modules -pushd node_modules -ln -s ../node_modules_prod/* . -if [ -e ../node_modules_prod/.bin ] -then - ln -s ../node_modules_prod/.bin . -fi -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. Currently this is -# just .package-lock.json. 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. Currently there are -# none. -find node_modules_prod -type f \( -name '.*' -o -size 0 \) -print -delete - - -%build -# Under Fedora guidelines, we had to remove the pre-compiled bundled JavaScript -# sources. We have two options under the guidelines: -# -# 1. Patch everything to use ES6 modules directly. This is conceptually clean -# but messy in practice. -# 2. Rebuild it ourselves. This is easy, and stays closest to upstream. Since -# the rollup configuration is pretty trivial, and rollup is not in the prod -# tarball, we choose to use esbuild instead of rollup. We also do not build -# a minified bundle; that would be useful only for browsers. -# -# We choose to rebuild the bundle. We add a source map for better debugging, -# and we use CommonJS format instead of UMD since we do not need to support -# browsers. (Note that the tests would fail if we used iife format, for unknown -# reasons.) -mkdir -p dist -esbuild --bundle --platform=node --sourcemap \ - --outfile='dist/%{name}.js' 'src/index.js' - - -%install -install -d '%{buildroot}%{nodejs_sitelib}/%{npm_name}' -# Note that, per Fedora guidelines, we MUST install the original sources -# whether they are used or not. -cp -rp \ - package.json \ - bin \ - dist \ - src \ - 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. -find '%{buildroot}%{nodejs_sitelib}/%{npm_name}/bin/' -type f | - while read -r target - do - link="%{buildroot}%{_bindir}/$(basename "${target}")" - ln -sf "${target}" "${link}" - done -symlinks -c -o %{buildroot}%{_bindir}/* - -install -t '%{buildroot}%{_mandir}/man1' -p -m 0644 -D \ - '%{SOURCE5}' '%{SOURCE6}' '%{SOURCE7}' - - -%check -%{python3} '%{SOURCE8}' --exceptions '%{SOURCE9}' --with prod node_modules_prod -%{__nodejs} -e 'require("./")' - -# 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}' -%{python3} '%{SOURCE8}' --exceptions '%{SOURCE9}' --with dev node_modules_dev -# 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. Note that we do not use rollup at all; we -# want to test the same bundle we use in production. -NODE_ENV=test find test -type f -name '*-test.js' \ - -exec './node_modules/.bin/tape' '{}' '+' - - -%files -%doc README.md -%license LICENSE %{npm_name}-%{version}-bundled-licenses.txt -%{nodejs_sitelib}/%{npm_name} -%{_bindir}/topo2geo -%{_bindir}/topomerge -%{_bindir}/topoquantize -%{_mandir}/man1/topo2geo.1* -%{_mandir}/man1/topomerge.1* -%{_mandir}/man1/topoquantize.1* - - -%changelog -%autochangelog diff --git a/topomerge.1 b/topomerge.1 deleted file mode 100644 index e1815df..0000000 --- a/topomerge.1 +++ /dev/null @@ -1,93 +0,0 @@ -.TH TOPOMERGE "1" "January 2021" "" "User Commands" -.SH NAME -topomerge \- merges the source TopoJSON geometry collection, assigning to the -target -.SH SYNOPSIS -.B topomerge -.RI [ options ] -.RI < target = source > -.RI [ file ] -.SH DESCRIPTION -.P -Merges polygons (or meshes lines) from the specified -.I source -TopoJSON geometry collection object, assigning to the -.I target -object. -.SH OPTIONS -.TP -\fB\-h\fR, \fB\-\-help\fR -Output usage information. -.TP -.BR \-V , \ \-\-version -Output the version number. -.TP -.BR \-o , \ \-\-out\ \fIfile -Specify the output TopoJSON file name. -Defaults to -.B \- -for stdout. -.TP -.BR \-k , \ \-\-key\ \fIexpression -Specify a JavaScript -.IR expression , -given a TopoJSON geometry object -.I d -and its zero-based index -.I i -in its parent collection, that determines how geometry objects are grouped -before merging; each group is merged separately. -For example, given a topology of U.S. \fIcounties\fR, where the -.I id -of each county is its five-digit FIPS code, the county boundaries can be merged -into state boundaries by using the first two digits of the county FIPS code, -which represents the state FIPS code: -.IP -.in +4n -.EX -.B topomerge states=counties -k 'd.id.slice(0, 2)' < us-counties.json > us-states.json -.EE -.in -.IP -If a key is not specified, all input geometry objects will be merged together. -For example, this can be used to merge the state boundaries into a single -nation boundary: -.IP -.in +4n -.EX -.B topomerge nation=states < us-states.json > us.json -.EE -.in -.TP -.BR \-f , \ \-\-filter\ \fIexpression -Specify a JavaScript -.I expression -that filters the input geometries before merging or meshing. -In conjunction with -.BR \-\-mesh , -the -.I expression -is given two TopoJSON geometry objects -.I a -and -.I b -that represent the adjacent features for a given arc segment; if the -.I expression -evaluates truthily, the associated arc segment is retained in mesh. -Otherwise, the -.I expression -is given an input TopoJSON geometry object -.I d -and its zero-based index -.I i -in its parent collection; if the -.I expression -evaluates truthily, the geometry object is retained in the merged polygon. -.TP -.B \-\-mesh -Generate a geometry collection of lines rather than polygons. -.SH "SEE ALSO" -.BR geo2topo (1), -.BR topo2geo (1), -.BR topoquantize (1), -.BR toposimplify (1) diff --git a/topoquantize.1 b/topoquantize.1 deleted file mode 100644 index ed9ec49..0000000 --- a/topoquantize.1 +++ /dev/null @@ -1,38 +0,0 @@ -.TH TOPOQUANTIZE "1" "January 2021" "" "User Commands" -.SH NAME -topoquantize \- quantizes TopoJSON -.SH SYNOPSIS -.B topoquantize -.RI [ options ] -.RI < n > -.RI [ file ] -.SH DESCRIPTION -.P -Quantizes the coordinates of the input TopoJSON topology and delta-encodes the topology's arcs. -The quantization parameter -.I n -must be a positive integer greater than one, and determines the maximum expressible number of unique values per dimension in the resulting quantized coordinates; typically, a power of ten is chosen such as 1e4, 1e5 or 1e6. -If the -.I topology -does not already have a bbox, one is computed and assigned. -If the -.I topology -is already quantized, an error is thrown. -.SH OPTIONS -.TP -\fB\-h\fR, \fB\-\-help\fR -Output usage information. -.TP -.BR \-V , \ \-\-version -Output the version number. -.TP -.BR \-o , \ \-\-out\ \fIfile -Specify the output TopoJSON file name. -Defaults to -.B \- -for stdout. -.SH "SEE ALSO" -.BR geo2topo (1), -.BR topo2geo (1), -.BR topomerge (1), -.BR toposimplify (1)