Compare commits

..

No commits in common. "master" and "fowlmouth-patch-1" have entirely different histories.

7 changed files with 485 additions and 18592 deletions

1
.gitattributes vendored
View file

@ -1 +0,0 @@
/packages.json merge=union

View file

@ -1,26 +0,0 @@
os:
- linux
dist: trusty
language: c
cache:
directories:
- "$HOME/.choosenim"
install:
- export CHOOSENIM_CHOOSE_VERSION="0.18.0"
- |
curl https://nim-lang.org/choosenim/init.sh -sSf > init.sh
sh init.sh -y
- export PATH=$HOME/.nimble/bin:$PATH
before_script:
- set -e
- set -x
script:
- nim c -d:ssl -r package_scanner.nim && node ./validate_json.js
notifications:
email: false # noisy

View file

@ -1,13 +1,11 @@
# Nim packages [![Build Status](https://travis-ci.org/nim-lang/packages.svg?branch=master)](https://travis-ci.org/nim-lang/packages)
***Due to a mistake on my part (@flaviut), your branches may be out of date. Simply rebase on top of this repo to fix that. Sorry for any inconvenience.***
# Nim packages
This is a central listing of all packages for
[Nimble](https://github.com/nim-lang/nimble), a package manager for the
[Nim programming language](http://nim-lang.org).
An overview of all packages is available at https://nimble.directory.
NOTE: The packages listed here are not peer-reviewed or otherwise screened. We try to keep the list up-to-date but we cannot guarantee quality or maturity of the packages.
## Adding your own package
To add your own package, fork this repository, edit
[packages.json](packages.json) and make a pull request.
@ -15,68 +13,19 @@ To add your own package, fork this repository, edit
[Packages.json](packages.json) is a simple array of objects. Each package
object should have the following fields (unless the field is marked as
optional):
* name - The name of the package, this should match the name in the package's
nimble file.
babel file.
* url - The url from which to retrieve the package.
* method - The method that should be used to retrieve this package. Currently
"git" and "hg" is supported.
* tags - A list of tags describing this package.
* description - A description of this package.
* license - The license of the source code in the package.
* web - An optional URL for humans to read additional information about
* web - An optional url for humans to read additional information about
the package.
* doc - An optional URL for humans to read the package HTML documentation
### Requirements
While we really appreciate your contribution, please follow the requirements: other developers will rely on your package. Non-compliant packages might be removed with no warning.
* The URL should work, a .nimble file should be present and the package should be installable
* The package should build correctly with the latest Nim release
* The package should not contain files without a license or in breach of 3rd parties licensing
* Non-mature packages should be flagged as such, especially if they perform security-critical tasks (e.g. encryption)
* If a vulnerability is found, make a patch release against the latest stable release (or more) that fixes the issue without introducing any other change.
* Tiny libraries should be avoided where possible
* Avoid having many dependencies. Use "when defined(...)" to enable optional features.
* If abandoning a package, please tag it as "abandoned"
* The package name should be unique and specific. Avoid overly generic names e.g. "math", "http"
* Provide a contact email address.
* Optionally try to support older Nim releases (6 months to 1 year)
* Optionally GPG-sign your releases
* Optionally follow [SemVer 2](http://semver.org)
Your packages may be removed if the url stops working. It goes without saying
that your pull request will not be accepted unless you fill out all of the
above required fields correctly, the package that ``url`` points to must also
contain a .nimble file, or else it will be rejected.
The requirements might change in future.
## Renaming packages
To rename a package you will need to add a new entry for your package. Simply
perform the following steps:
* Duplicate your package's current entry.
* Remove every field in one of the entries apart from the `name` field.
* Add an `alias` field to that entry.
* Change the name in the other package entry.
For example:
```
...
{
"name": "myoldname",
"alias": "mynewname"
},
{
"name": "mynewname",
"url": "...",
"method": "git",
...
},
...
```

View file

@ -1,135 +0,0 @@
# A very simple Nim package scanner.
#
# Scans the package list from this repository.
#
# Check the packages for:
# * Missing name
# * Missing/unknown method
# * Missing/unreachable repository
# * Missing tags
# * Missing description
# * Missing/unknown license
# * Insecure git:// url on GitHub
#
# Usage: nim c -d:ssl -r package_scanner.nim
#
# Copyright 2015 Federico Ceratto <federico.ceratto@gmail.com>
# Released under GPLv3 License, see /usr/share/common-licenses/GPL-3
import httpclient
import net
import json
import os
import sets
import strutils
const
LICENSES = @[
"Allegro 4 Giftware",
"Apache License 2.0",
"BSD",
"BSD2",
"BSD3",
"CC0",
"GPL",
"GPLv2",
"GPLv3",
"LGPLv2",
"LGPLv3",
"MIT",
"MS-PL",
"MPL",
"WTFPL",
"libpng",
"zlib",
"ISC",
"Unlicense"
]
VCS_TYPES = @["git", "hg"]
proc canFetchNimbleRepository(name: string, urlJson: JsonNode): bool =
# The fetch is a lie!
# TODO: Make this check the actual repo url and check if there is a
# nimble file in it
result = true
var url: string
if not urlJson.isNil:
url = urlJson.str
try:
discard getContent(url, timeout=10000)
except HttpRequestError, TimeoutError:
echo "W: ", name, ": unable to fetch repo ", url, " ",
getCurrentExceptionMsg()
except AssertionError:
echo "W: ", name, ": httpclient failed ", url, " ",
getCurrentExceptionMsg()
except:
echo "W: Another error attempting to request: ", url
echo " Error was: ", getCurrentExceptionMsg()
proc verifyAlias(pdata: JsonNode, result: var int) =
if not pdata.hasKey("name"):
echo "E: missing alias' package name"
result.inc()
# TODO: Verify that 'alias' points to a known package.
proc check(): int =
var name: string
echo ""
let pkg_list = parseJson(readFile(getCurrentDir() / "packages.json"))
var names = initSet[string]()
for pdata in pkg_list:
name = if pdata.hasKey("name"): pdata["name"].str else: ""
if pdata.hasKey("alias"):
verifyAlias(pdata, result)
else:
if name == "":
echo "E: missing package name"
result.inc()
elif not pdata.hasKey("method"):
echo "E: ", name, " has no method"
result.inc()
elif not (pdata["method"].str in VCS_TYPES):
echo "E: ", name, " has an unknown method: ", pdata["method"].str
result.inc()
elif not pdata.hasKey("url"):
echo "E: ", name, " has no URL"
result.inc()
elif pdata.hasKey("web") and not canFetchNimbleRepository(name, pdata["web"]):
result.inc()
elif not pdata.hasKey("tags"):
echo "E: ", name, " has no tags"
result.inc()
elif not pdata.hasKey("description"):
echo "E: ", name, " has no description"
result.inc()
elif not pdata.hasKey("license"):
echo "E: ", name, " has no license"
result.inc()
elif pdata["url"].str.normalize.startsWith("git://github.com/"):
echo "E: ", name, " has an insecure git:// URL instead of https://"
result.inc()
else:
# Other warnings should go here
if not (pdata["license"].str in LICENSES):
echo "W: ", name, " has an unexpected license: ", pdata["license"]
if name.normalize notin names:
names.incl(name.normalize)
else:
echo("E: ", name, ": a package by that name already exists.")
result.inc()
echo ""
echo "Problematic packages count: ", result
when isMainModule:
quit(check())

File diff suppressed because it is too large Load diff

View file

@ -1,41 +0,0 @@
import strutils, json, os
proc cleanupWhitespace(s: string): string =
## Removes trailing whitespace and normalizes line endings to LF.
result = newStringOfCap(s.len)
var i = 0
while i < s.len:
if s[i] == ' ':
var j = i+1
while s[j] == ' ': inc j
if s[j] == '\c':
inc j
if s[j] == '\L': inc j
result.add '\L'
i = j
elif s[j] == '\L':
result.add '\L'
i = j+1
else:
result.add ' '
inc i
elif s[i] == '\c':
inc i
if s[i] == '\L': inc i
result.add '\L'
elif s[i] == '\L':
result.add '\L'
inc i
else:
result.add s[i]
inc i
if result[^1] != '\L':
result.add '\L'
proc editJson() =
var contents = parseFile("packages.json")
doAssert contents.kind == JArray
writeFile("packages.json", contents.pretty.cleanupWhitespace)
editJson()

View file

@ -1,2 +0,0 @@
var fs = require('fs');
JSON.parse(fs.readFileSync('packages.json', 'utf8'));