diff --git a/lib/datasource/cargo/index.js b/lib/datasource/cargo/index.js new file mode 100644 index 0000000000000000000000000000000000000000..96681bb1d388171e5601a8181bc0901e471f8c46 --- /dev/null +++ b/lib/datasource/cargo/index.js @@ -0,0 +1,56 @@ +const got = require('got'); + +module.exports = { + getPkgReleases, +}; + +async function getPkgReleases(purl) { + const { fullname: name } = purl; + const crateUrl = `https://crates.io/api/v1/crates/${name}`; + try { + const res = (await got(crateUrl, { + json: true, + })).body; + if (!(res && res.crate && res.crate.name)) { + logger.warn({ dependency: name }, `Received invalid crate data`); + return null; + } + const result = { + releases: [], + }; + if (res.versions) { + result.releases = res.versions.map(version => ({ + version: version.num, + })); + } + result.sourceUrl = res.crate.repository; + result.homepage = res.crate.homepage; + return result; + } catch (err) { + if (err.statusCode === 404 || err.code === 'ENOTFOUND') { + logger.info({ dependency: name }, `Dependency lookup failure: not found`); + logger.debug( + { + err, + }, + 'Crate lookup error' + ); + return null; + } + if ( + err.statusCode === 429 || + (err.statusCode > 500 && err.statusCode < 600) + ) { + logger.warn( + { dependency: name, err }, + `cargo crates.io registry failure` + ); + throw new Error('registry-failure'); + } + logger.warn( + { err, dependency: name }, + 'cargo crates.io lookup failure: Unknown error' + ); + return null; + } +} diff --git a/lib/datasource/index.js b/lib/datasource/index.js index 9d529f3f477bc19f3dc7cec80f86df6cc566e362..8704697a5aaae02febc4a8c7a342b7b60e305013 100644 --- a/lib/datasource/index.js +++ b/lib/datasource/index.js @@ -10,20 +10,22 @@ const packagist = require('./packagist'); const pypi = require('./pypi'); const terraform = require('./terraform'); const gitlab = require('./gitlab'); +const cargo = require('./cargo'); const { addMetaData } = require('./metadata'); const datasources = { - orb, + cargo, docker, github, + gitlab, go, npm, nuget, + orb, packagist, pypi, terraform, - gitlab, }; const cacheNamespace = 'datasource-releases'; diff --git a/test/_fixtures/cargo/amethyst.json b/test/_fixtures/cargo/amethyst.json new file mode 100644 index 0000000000000000000000000000000000000000..f8c703d9ccc5295d98516c118bcc1683e17a51aa --- /dev/null +++ b/test/_fixtures/cargo/amethyst.json @@ -0,0 +1 @@ +{"crate":{"id":"amethyst","name":"amethyst","updated_at":"2018-10-23T04:59:52.036066+00:00","versions":[114081,102536,93381,75864,64007,63921,55723,47311,45120,44923,33265,24782,21411,20555,20456,20314,20192],"keywords":["amethyst","game","engine","sdk"],"categories":["game-engines"],"badges":[{"badge_type":"appveyor","attributes":{"repository":"amethyst/amethyst","service":null,"branch":"master","id":null,"project_name":null}},{"badge_type":"travis-ci","attributes":{"repository":"amethyst/amethyst","branch":"master"}}],"created_at":"2016-01-04T03:42:04.120616+00:00","downloads":10368,"recent_downloads":3510,"max_version":"0.9.0","description":"Data-oriented game engine written in Rust","homepage":"https://www.amethyst.rs/","documentation":"https://www.amethyst.rs/doc/master/doc/amethyst","repository":"https://github.com/amethyst/amethyst","links":{"version_downloads":"/api/v1/crates/amethyst/downloads","versions":null,"owners":"/api/v1/crates/amethyst/owners","owner_team":"/api/v1/crates/amethyst/owner_team","owner_user":"/api/v1/crates/amethyst/owner_user","reverse_dependencies":"/api/v1/crates/amethyst/reverse_dependencies"},"exact_match":false},"versions":[{"id":114081,"crate":"amethyst","num":"0.9.0","dl_path":"/api/v1/crates/amethyst/0.9.0/download","readme_path":"/api/v1/crates/amethyst/0.9.0/readme","updated_at":"2018-10-23T04:59:52.036066+00:00","created_at":"2018-10-23T04:59:52.036066+00:00","downloads":2037,"features":{"json":["amethyst_assets/json"],"nightly":["amethyst_animation/nightly","amethyst_assets/nightly","amethyst_audio/nightly","amethyst_config/nightly","amethyst_core/nightly","amethyst_controls/nightly","amethyst_network/nightly","amethyst_renderer/nightly","amethyst_input/nightly","amethyst_ui/nightly","amethyst_utils/nightly"],"profiler":["thread_profiler","thread_profiler/thread_profiler","amethyst_animation/profiler","amethyst_assets/profiler","amethyst_audio/profiler","amethyst_config/profiler","amethyst_core/profiler","amethyst_controls/profiler","amethyst_input/profiler","amethyst_locale/profiler","amethyst_renderer/profiler","amethyst_ui/profiler","amethyst_utils/profiler"],"saveload":["amethyst_core/saveload"],"sdl_controller":["amethyst_input/sdl_controller"]},"yanked":false,"license":"MIT/Apache-2.0","links":{"dependencies":"/api/v1/crates/amethyst/0.9.0/dependencies","version_downloads":"/api/v1/crates/amethyst/0.9.0/downloads","authors":"/api/v1/crates/amethyst/0.9.0/authors"},"crate_size":41178},{"id":102536,"crate":"amethyst","num":"0.8.0","dl_path":"/api/v1/crates/amethyst/0.8.0/download","readme_path":"/api/v1/crates/amethyst/0.8.0/readme","updated_at":"2018-08-05T23:35:13.513554+00:00","created_at":"2018-08-05T23:35:13.513554+00:00","downloads":1694,"features":{"nightly":["amethyst_animation/nightly","amethyst_assets/nightly","amethyst_audio/nightly","amethyst_config/nightly","amethyst_core/nightly","amethyst_controls/nightly","amethyst_renderer/nightly","amethyst_input/nightly","amethyst_ui/nightly","amethyst_utils/nightly"],"profiler":["thread_profiler","thread_profiler/thread_profiler","amethyst_animation/profiler","amethyst_assets/profiler","amethyst_audio/profiler","amethyst_config/profiler","amethyst_core/profiler","amethyst_controls/profiler","amethyst_input/profiler","amethyst_locale/profiler","amethyst_renderer/profiler","amethyst_ui/profiler","amethyst_utils/profiler"],"sdl_controller":["amethyst_input/sdl_controller"]},"yanked":false,"license":"MIT/Apache-2.0","links":{"dependencies":"/api/v1/crates/amethyst/0.8.0/dependencies","version_downloads":"/api/v1/crates/amethyst/0.8.0/downloads","authors":"/api/v1/crates/amethyst/0.8.0/authors"},"crate_size":null},{"id":93381,"crate":"amethyst","num":"0.7.0","dl_path":"/api/v1/crates/amethyst/0.7.0/download","readme_path":"/api/v1/crates/amethyst/0.7.0/readme","updated_at":"2018-05-19T05:26:43.556173+00:00","created_at":"2018-05-19T05:26:43.556173+00:00","downloads":779,"features":{"nightly":["amethyst_animation/nightly","amethyst_assets/nightly","amethyst_audio/nightly","amethyst_config/nightly","amethyst_core/nightly","amethyst_controls/nightly","amethyst_renderer/nightly","amethyst_input/nightly","amethyst_ui/nightly","amethyst_utils/nightly"],"profiler":["thread_profiler","thread_profiler/thread_profiler","amethyst_animation/profiler","amethyst_assets/profiler","amethyst_audio/profiler","amethyst_config/profiler","amethyst_core/profiler","amethyst_controls/profiler","amethyst_renderer/profiler","amethyst_input/profiler","amethyst_ui/profiler","amethyst_utils/profiler"]},"yanked":false,"license":"MIT/Apache-2.0","links":{"dependencies":"/api/v1/crates/amethyst/0.7.0/dependencies","version_downloads":"/api/v1/crates/amethyst/0.7.0/downloads","authors":"/api/v1/crates/amethyst/0.7.0/authors"},"crate_size":null},{"id":75864,"crate":"amethyst","num":"0.6.0","dl_path":"/api/v1/crates/amethyst/0.6.0/download","readme_path":"/api/v1/crates/amethyst/0.6.0/readme","updated_at":"2017-12-30T02:37:56.438368+00:00","created_at":"2017-12-30T02:37:56.438368+00:00","downloads":709,"features":{"profiler":["thread_profiler/thread_profiler"]},"yanked":false,"license":"MIT/Apache-2.0","links":{"dependencies":"/api/v1/crates/amethyst/0.6.0/dependencies","version_downloads":"/api/v1/crates/amethyst/0.6.0/downloads","authors":"/api/v1/crates/amethyst/0.6.0/authors"},"crate_size":null},{"id":64007,"crate":"amethyst","num":"0.5.1","dl_path":"/api/v1/crates/amethyst/0.5.1/download","readme_path":"/api/v1/crates/amethyst/0.5.1/readme","updated_at":"2017-11-30T02:44:34.228865+00:00","created_at":"2017-08-30T16:08:02.076925+00:00","downloads":511,"features":{"profiler":["thread_profiler/thread_profiler"]},"yanked":false,"license":"MIT OR Apache-2.0","links":{"dependencies":"/api/v1/crates/amethyst/0.5.1/dependencies","version_downloads":"/api/v1/crates/amethyst/0.5.1/downloads","authors":"/api/v1/crates/amethyst/0.5.1/authors"},"crate_size":null},{"id":63921,"crate":"amethyst","num":"0.5.0","dl_path":"/api/v1/crates/amethyst/0.5.0/download","readme_path":"/api/v1/crates/amethyst/0.5.0/readme","updated_at":"2017-11-30T03:43:52.655220+00:00","created_at":"2017-08-29T17:36:45.542505+00:00","downloads":153,"features":{"profiler":["thread_profiler/thread_profiler"]},"yanked":false,"license":"MIT OR Apache-2.0","links":{"dependencies":"/api/v1/crates/amethyst/0.5.0/dependencies","version_downloads":"/api/v1/crates/amethyst/0.5.0/downloads","authors":"/api/v1/crates/amethyst/0.5.0/authors"},"crate_size":null},{"id":55723,"crate":"amethyst","num":"0.4.3","dl_path":"/api/v1/crates/amethyst/0.4.3/download","readme_path":"/api/v1/crates/amethyst/0.4.3/readme","updated_at":"2017-11-30T03:58:14.298921+00:00","created_at":"2017-06-03T23:39:08.055273+00:00","downloads":409,"features":{"default":["opengl"],"direct3d":[],"opengl":[],"profiler":["thread_profiler/thread_profiler"]},"yanked":false,"license":"MIT/Apache-2.0","links":{"dependencies":"/api/v1/crates/amethyst/0.4.3/dependencies","version_downloads":"/api/v1/crates/amethyst/0.4.3/downloads","authors":"/api/v1/crates/amethyst/0.4.3/authors"},"crate_size":null},{"id":47311,"crate":"amethyst","num":"0.4.2","dl_path":"/api/v1/crates/amethyst/0.4.2/download","readme_path":"/api/v1/crates/amethyst/0.4.2/readme","updated_at":"2017-11-30T02:28:10.733064+00:00","created_at":"2017-03-07T22:35:26.137229+00:00","downloads":423,"features":{"default":["opengl"],"direct3d":[],"opengl":[]},"yanked":false,"license":"MIT/Apache-2.0","links":{"dependencies":"/api/v1/crates/amethyst/0.4.2/dependencies","version_downloads":"/api/v1/crates/amethyst/0.4.2/downloads","authors":"/api/v1/crates/amethyst/0.4.2/authors"},"crate_size":null},{"id":45120,"crate":"amethyst","num":"0.4.1","dl_path":"/api/v1/crates/amethyst/0.4.1/download","readme_path":"/api/v1/crates/amethyst/0.4.1/readme","updated_at":"2017-11-30T02:46:19.858552+00:00","created_at":"2017-02-10T05:34:28.151911+00:00","downloads":292,"features":{"default":["opengl"],"direct3d":[],"opengl":[]},"yanked":false,"license":"MIT/Apache-2.0","links":{"dependencies":"/api/v1/crates/amethyst/0.4.1/dependencies","version_downloads":"/api/v1/crates/amethyst/0.4.1/downloads","authors":"/api/v1/crates/amethyst/0.4.1/authors"},"crate_size":null},{"id":44923,"crate":"amethyst","num":"0.4.0","dl_path":"/api/v1/crates/amethyst/0.4.0/download","readme_path":"/api/v1/crates/amethyst/0.4.0/readme","updated_at":"2017-11-30T02:31:06.671385+00:00","created_at":"2017-02-07T07:30:59.355103+00:00","downloads":205,"features":{"default":["opengl"],"direct3d":[],"opengl":[]},"yanked":false,"license":"MIT/Apache-2.0","links":{"dependencies":"/api/v1/crates/amethyst/0.4.0/dependencies","version_downloads":"/api/v1/crates/amethyst/0.4.0/downloads","authors":"/api/v1/crates/amethyst/0.4.0/authors"},"crate_size":null},{"id":33265,"crate":"amethyst","num":"0.3.1","dl_path":"/api/v1/crates/amethyst/0.3.1/download","readme_path":"/api/v1/crates/amethyst/0.3.1/readme","updated_at":"2017-11-30T04:18:49.922837+00:00","created_at":"2016-09-07T17:49:01.070242+00:00","downloads":655,"features":{},"yanked":false,"license":"MIT/Apache-2.0","links":{"dependencies":"/api/v1/crates/amethyst/0.3.1/dependencies","version_downloads":"/api/v1/crates/amethyst/0.3.1/downloads","authors":"/api/v1/crates/amethyst/0.3.1/authors"},"crate_size":null},{"id":24782,"crate":"amethyst","num":"0.3.0","dl_path":"/api/v1/crates/amethyst/0.3.0/download","readme_path":"/api/v1/crates/amethyst/0.3.0/readme","updated_at":"2017-11-30T04:18:49.834846+00:00","created_at":"2016-03-31T07:12:24.417369+00:00","downloads":634,"features":{},"yanked":false,"license":"MIT/Apache-2.0","links":{"dependencies":"/api/v1/crates/amethyst/0.3.0/dependencies","version_downloads":"/api/v1/crates/amethyst/0.3.0/downloads","authors":"/api/v1/crates/amethyst/0.3.0/authors"},"crate_size":null},{"id":21411,"crate":"amethyst","num":"0.2.1","dl_path":"/api/v1/crates/amethyst/0.2.1/download","readme_path":"/api/v1/crates/amethyst/0.2.1/readme","updated_at":"2017-11-30T04:18:49.721035+00:00","created_at":"2016-01-27T22:12:58.346004+00:00","downloads":581,"features":{},"yanked":false,"license":"MIT/Apache-2.0","links":{"dependencies":"/api/v1/crates/amethyst/0.2.1/dependencies","version_downloads":"/api/v1/crates/amethyst/0.2.1/downloads","authors":"/api/v1/crates/amethyst/0.2.1/authors"},"crate_size":null},{"id":20555,"crate":"amethyst","num":"0.1.4","dl_path":"/api/v1/crates/amethyst/0.1.4/download","readme_path":"/api/v1/crates/amethyst/0.1.4/readme","updated_at":"2017-11-30T04:18:49.690252+00:00","created_at":"2016-01-11T04:30:07.247905+00:00","downloads":407,"features":{},"yanked":false,"license":"MIT/Apache-2.0","links":{"dependencies":"/api/v1/crates/amethyst/0.1.4/dependencies","version_downloads":"/api/v1/crates/amethyst/0.1.4/downloads","authors":"/api/v1/crates/amethyst/0.1.4/authors"},"crate_size":null},{"id":20456,"crate":"amethyst","num":"0.1.3","dl_path":"/api/v1/crates/amethyst/0.1.3/download","readme_path":"/api/v1/crates/amethyst/0.1.3/readme","updated_at":"2017-11-30T04:18:49.685229+00:00","created_at":"2016-01-09T23:30:24.282179+00:00","downloads":288,"features":{},"yanked":false,"license":"MIT/Apache-2.0","links":{"dependencies":"/api/v1/crates/amethyst/0.1.3/dependencies","version_downloads":"/api/v1/crates/amethyst/0.1.3/downloads","authors":"/api/v1/crates/amethyst/0.1.3/authors"},"crate_size":null},{"id":20314,"crate":"amethyst","num":"0.1.1","dl_path":"/api/v1/crates/amethyst/0.1.1/download","readme_path":"/api/v1/crates/amethyst/0.1.1/readme","updated_at":"2017-11-30T04:18:49.672273+00:00","created_at":"2016-01-07T03:51:25.730482+00:00","downloads":298,"features":{},"yanked":false,"license":"MIT/Apache-2.0","links":{"dependencies":"/api/v1/crates/amethyst/0.1.1/dependencies","version_downloads":"/api/v1/crates/amethyst/0.1.1/downloads","authors":"/api/v1/crates/amethyst/0.1.1/authors"},"crate_size":null},{"id":20192,"crate":"amethyst","num":"0.1.0","dl_path":"/api/v1/crates/amethyst/0.1.0/download","readme_path":"/api/v1/crates/amethyst/0.1.0/readme","updated_at":"2017-11-30T04:18:49.663242+00:00","created_at":"2016-01-04T03:42:04.120616+00:00","downloads":293,"features":{},"yanked":false,"license":"MIT/Apache-2.0","links":{"dependencies":"/api/v1/crates/amethyst/0.1.0/dependencies","version_downloads":"/api/v1/crates/amethyst/0.1.0/downloads","authors":"/api/v1/crates/amethyst/0.1.0/authors"},"crate_size":null}],"keywords":[{"id":"amethyst","keyword":"amethyst","created_at":"2016-01-04T03:42:04.120616+00:00","crates_cnt":15},{"id":"game","keyword":"game","created_at":"2014-11-21T04:39:31.646099+00:00","crates_cnt":141},{"id":"engine","keyword":"engine","created_at":"2014-12-21T17:42:48.133982+00:00","crates_cnt":47},{"id":"sdk","keyword":"sdk","created_at":"2015-06-07T13:11:08.891856+00:00","crates_cnt":16}],"categories":[{"id":"game-engines","category":"Game engines","slug":"game-engines","description":"Crates for creating games.","created_at":"2017-01-17T19:13:05.112025+00:00","crates_cnt":105}]} diff --git a/test/_fixtures/cargo/libc.json b/test/_fixtures/cargo/libc.json new file mode 100644 index 0000000000000000000000000000000000000000..53ff2086abe2312e69505d75c8f3585d4a99d5b2 --- /dev/null +++ b/test/_fixtures/cargo/libc.json @@ -0,0 +1 @@ +{"crate":{"id":"libc","name":"libc","updated_at":"2018-11-22T06:00:01.887655+00:00","versions":[119061,102589,95089,93661,86416,83417,83347,82661,77227,76325,72807,69615,67575,65812,63743,61242,60588,60383,59067,59046,56839,53711,51450,46700,42535,41598,38948,35816,33357,31311,29868,29286,28414,26549,25536,24776,23609,22138,21365,21096,19509,19469,17958,17638,17572,17355,16916,14628,13021,10384,9938,8437,7842,7408,6260,4732,4106,3006],"keywords":[],"categories":[],"badges":[{"badge_type":"appveyor","attributes":{"service":null,"project_name":"rust-lang-libs/libc","repository":"rust-lang/libc","branch":null,"id":null}},{"badge_type":"travis-ci","attributes":{"repository":"rust-lang/libc","branch":null}}],"created_at":"2015-01-15T20:22:13.100871+00:00","downloads":11264639,"recent_downloads":1246539,"max_version":"0.2.44","description":"A library for types and bindings to native C functions often found in libc or\nother common platform libraries.\n","homepage":"https://github.com/rust-lang/libc","documentation":"http://doc.rust-lang.org/libc","repository":"https://github.com/rust-lang/libc","links":{"version_downloads":"/api/v1/crates/libc/downloads","versions":null,"owners":"/api/v1/crates/libc/owners","owner_team":"/api/v1/crates/libc/owner_team","owner_user":"/api/v1/crates/libc/owner_user","reverse_dependencies":"/api/v1/crates/libc/reverse_dependencies"},"exact_match":false},"versions":[{"id":119061,"crate":"libc","num":"0.2.44","dl_path":"/api/v1/crates/libc/0.2.44/download","readme_path":"/api/v1/crates/libc/0.2.44/readme","updated_at":"2018-11-22T06:00:01.887655+00:00","created_at":"2018-11-22T06:00:01.887655+00:00","downloads":157138,"features":{"align":[],"default":["use_std"],"rustc-dep-of-std":["align","rustc-std-workspace-core"],"use_std":[]},"yanked":false,"license":"MIT OR Apache-2.0","links":{"dependencies":"/api/v1/crates/libc/0.2.44/dependencies","version_downloads":"/api/v1/crates/libc/0.2.44/downloads","authors":"/api/v1/crates/libc/0.2.44/authors"},"crate_size":347920},{"id":102589,"crate":"libc","num":"0.2.43","dl_path":"/api/v1/crates/libc/0.2.43/download","readme_path":"/api/v1/crates/libc/0.2.43/readme","updated_at":"2018-08-06T13:58:01.547975+00:00","created_at":"2018-08-06T13:58:01.547975+00:00","downloads":1083116,"features":{"align":[],"default":["use_std"],"use_std":[]},"yanked":false,"license":"MIT/Apache-2.0","links":{"dependencies":"/api/v1/crates/libc/0.2.43/dependencies","version_downloads":"/api/v1/crates/libc/0.2.43/downloads","authors":"/api/v1/crates/libc/0.2.43/authors"},"crate_size":null},{"id":95089,"crate":"libc","num":"0.2.42","dl_path":"/api/v1/crates/libc/0.2.42/download","readme_path":"/api/v1/crates/libc/0.2.42/readme","updated_at":"2018-06-01T21:41:57.990052+00:00","created_at":"2018-06-01T21:41:57.990052+00:00","downloads":643415,"features":{"default":["use_std"],"use_std":[]},"yanked":false,"license":"MIT/Apache-2.0","links":{"dependencies":"/api/v1/crates/libc/0.2.42/dependencies","version_downloads":"/api/v1/crates/libc/0.2.42/downloads","authors":"/api/v1/crates/libc/0.2.42/authors"},"crate_size":null},{"id":93661,"crate":"libc","num":"0.2.41","dl_path":"/api/v1/crates/libc/0.2.41/download","readme_path":"/api/v1/crates/libc/0.2.41/readme","updated_at":"2018-05-21T15:06:52.283653+00:00","created_at":"2018-05-21T15:06:52.283653+00:00","downloads":135165,"features":{"default":["use_std"],"use_std":[]},"yanked":false,"license":"MIT/Apache-2.0","links":{"dependencies":"/api/v1/crates/libc/0.2.41/dependencies","version_downloads":"/api/v1/crates/libc/0.2.41/downloads","authors":"/api/v1/crates/libc/0.2.41/authors"},"crate_size":null},{"id":86416,"crate":"libc","num":"0.2.40","dl_path":"/api/v1/crates/libc/0.2.40/download","readme_path":"/api/v1/crates/libc/0.2.40/readme","updated_at":"2018-03-26T06:55:01.045990+00:00","created_at":"2018-03-26T06:55:01.045990+00:00","downloads":559067,"features":{"default":["use_std"],"use_std":[]},"yanked":false,"license":"MIT/Apache-2.0","links":{"dependencies":"/api/v1/crates/libc/0.2.40/dependencies","version_downloads":"/api/v1/crates/libc/0.2.40/downloads","authors":"/api/v1/crates/libc/0.2.40/authors"},"crate_size":null},{"id":83417,"crate":"libc","num":"0.2.39","dl_path":"/api/v1/crates/libc/0.2.39/download","readme_path":"/api/v1/crates/libc/0.2.39/readme","updated_at":"2018-03-05T16:41:58.165278+00:00","created_at":"2018-03-05T16:41:58.165278+00:00","downloads":279045,"features":{"default":["use_std"],"use_std":[]},"yanked":false,"license":"MIT/Apache-2.0","links":{"dependencies":"/api/v1/crates/libc/0.2.39/dependencies","version_downloads":"/api/v1/crates/libc/0.2.39/downloads","authors":"/api/v1/crates/libc/0.2.39/authors"},"crate_size":null},{"id":83347,"crate":"libc","num":"0.2.38","dl_path":"/api/v1/crates/libc/0.2.38/download","readme_path":"/api/v1/crates/libc/0.2.38/readme","updated_at":"2018-03-05T02:37:48.373061+00:00","created_at":"2018-03-05T02:37:48.373061+00:00","downloads":8549,"features":{"default":["use_std"],"use_std":[]},"yanked":false,"license":"MIT/Apache-2.0","links":{"dependencies":"/api/v1/crates/libc/0.2.38/dependencies","version_downloads":"/api/v1/crates/libc/0.2.38/downloads","authors":"/api/v1/crates/libc/0.2.38/authors"},"crate_size":null},{"id":82661,"crate":"libc","num":"0.2.37","dl_path":"/api/v1/crates/libc/0.2.37/download","readme_path":"/api/v1/crates/libc/0.2.37/readme","updated_at":"2018-02-27T12:01:41.193552+00:00","created_at":"2018-02-27T12:01:41.193552+00:00","downloads":57696,"features":{"default":["use_std"],"use_std":[]},"yanked":false,"license":"MIT/Apache-2.0","links":{"dependencies":"/api/v1/crates/libc/0.2.37/dependencies","version_downloads":"/api/v1/crates/libc/0.2.37/downloads","authors":"/api/v1/crates/libc/0.2.37/authors"},"crate_size":null},{"id":77227,"crate":"libc","num":"0.2.36","dl_path":"/api/v1/crates/libc/0.2.36/download","readme_path":"/api/v1/crates/libc/0.2.36/readme","updated_at":"2018-01-12T15:57:05.925907+00:00","created_at":"2018-01-12T15:57:05.925907+00:00","downloads":411175,"features":{"default":["use_std"],"use_std":[]},"yanked":false,"license":"MIT/Apache-2.0","links":{"dependencies":"/api/v1/crates/libc/0.2.36/dependencies","version_downloads":"/api/v1/crates/libc/0.2.36/downloads","authors":"/api/v1/crates/libc/0.2.36/authors"},"crate_size":null},{"id":76325,"crate":"libc","num":"0.2.35","dl_path":"/api/v1/crates/libc/0.2.35/download","readme_path":"/api/v1/crates/libc/0.2.35/readme","updated_at":"2018-01-04T03:32:05.574245+00:00","created_at":"2018-01-04T03:32:05.574245+00:00","downloads":76227,"features":{"default":["use_std"],"use_std":[]},"yanked":false,"license":"MIT/Apache-2.0","links":{"dependencies":"/api/v1/crates/libc/0.2.35/dependencies","version_downloads":"/api/v1/crates/libc/0.2.35/downloads","authors":"/api/v1/crates/libc/0.2.35/authors"},"crate_size":null},{"id":72807,"crate":"libc","num":"0.2.34","dl_path":"/api/v1/crates/libc/0.2.34/download","readme_path":"/api/v1/crates/libc/0.2.34/readme","updated_at":"2017-11-30T15:47:00.179016+00:00","created_at":"2017-11-30T15:47:00.179016+00:00","downloads":289639,"features":{"default":["use_std"],"use_std":[]},"yanked":false,"license":"MIT/Apache-2.0","links":{"dependencies":"/api/v1/crates/libc/0.2.34/dependencies","version_downloads":"/api/v1/crates/libc/0.2.34/downloads","authors":"/api/v1/crates/libc/0.2.34/authors"},"crate_size":null},{"id":69615,"crate":"libc","num":"0.2.33","dl_path":"/api/v1/crates/libc/0.2.33/download","readme_path":"/api/v1/crates/libc/0.2.33/readme","updated_at":"2017-11-30T03:01:39.752229+00:00","created_at":"2017-10-28T20:20:15.081891+00:00","downloads":288053,"features":{"default":["use_std"],"use_std":[]},"yanked":false,"license":"MIT/Apache-2.0","links":{"dependencies":"/api/v1/crates/libc/0.2.33/dependencies","version_downloads":"/api/v1/crates/libc/0.2.33/downloads","authors":"/api/v1/crates/libc/0.2.33/authors"},"crate_size":null},{"id":67575,"crate":"libc","num":"0.2.32","dl_path":"/api/v1/crates/libc/0.2.32/download","readme_path":"/api/v1/crates/libc/0.2.32/readme","updated_at":"2017-11-30T03:52:06.751004+00:00","created_at":"2017-10-06T14:16:36.183976+00:00","downloads":232800,"features":{"default":["use_std"],"use_std":[]},"yanked":false,"license":"MIT/Apache-2.0","links":{"dependencies":"/api/v1/crates/libc/0.2.32/dependencies","version_downloads":"/api/v1/crates/libc/0.2.32/downloads","authors":"/api/v1/crates/libc/0.2.32/authors"},"crate_size":null},{"id":65812,"crate":"libc","num":"0.2.31","dl_path":"/api/v1/crates/libc/0.2.31/download","readme_path":"/api/v1/crates/libc/0.2.31/readme","updated_at":"2017-11-30T03:21:16.371491+00:00","created_at":"2017-09-20T03:45:25.228566+00:00","downloads":165732,"features":{"default":["use_std"],"use_std":[]},"yanked":false,"license":"MIT/Apache-2.0","links":{"dependencies":"/api/v1/crates/libc/0.2.31/dependencies","version_downloads":"/api/v1/crates/libc/0.2.31/downloads","authors":"/api/v1/crates/libc/0.2.31/authors"},"crate_size":null},{"id":63743,"crate":"libc","num":"0.2.30","dl_path":"/api/v1/crates/libc/0.2.30/download","readme_path":"/api/v1/crates/libc/0.2.30/readme","updated_at":"2017-11-30T02:38:31.047644+00:00","created_at":"2017-08-27T18:10:50.883879+00:00","downloads":232963,"features":{"default":["use_std"],"use_std":[]},"yanked":false,"license":"MIT/Apache-2.0","links":{"dependencies":"/api/v1/crates/libc/0.2.30/dependencies","version_downloads":"/api/v1/crates/libc/0.2.30/downloads","authors":"/api/v1/crates/libc/0.2.30/authors"},"crate_size":null},{"id":61242,"crate":"libc","num":"0.2.29","dl_path":"/api/v1/crates/libc/0.2.29/download","readme_path":"/api/v1/crates/libc/0.2.29/readme","updated_at":"2017-11-30T03:18:48.166855+00:00","created_at":"2017-08-01T01:19:13.341558+00:00","downloads":202507,"features":{"default":["use_std"],"use_std":[]},"yanked":false,"license":"MIT/Apache-2.0","links":{"dependencies":"/api/v1/crates/libc/0.2.29/dependencies","version_downloads":"/api/v1/crates/libc/0.2.29/downloads","authors":"/api/v1/crates/libc/0.2.29/authors"},"crate_size":null},{"id":60588,"crate":"libc","num":"0.2.28","dl_path":"/api/v1/crates/libc/0.2.28/download","readme_path":"/api/v1/crates/libc/0.2.28/readme","updated_at":"2017-11-30T02:22:38.354867+00:00","created_at":"2017-07-24T17:09:13.948619+00:00","downloads":57853,"features":{"default":["use_std"],"use_std":[]},"yanked":false,"license":"MIT/Apache-2.0","links":{"dependencies":"/api/v1/crates/libc/0.2.28/dependencies","version_downloads":"/api/v1/crates/libc/0.2.28/downloads","authors":"/api/v1/crates/libc/0.2.28/authors"},"crate_size":null},{"id":60383,"crate":"libc","num":"0.2.27","dl_path":"/api/v1/crates/libc/0.2.27/download","readme_path":"/api/v1/crates/libc/0.2.27/readme","updated_at":"2017-11-30T02:27:43.363802+00:00","created_at":"2017-07-22T17:15:02.416831+00:00","downloads":19362,"features":{"default":["use_std"],"use_std":[]},"yanked":false,"license":"MIT/Apache-2.0","links":{"dependencies":"/api/v1/crates/libc/0.2.27/dependencies","version_downloads":"/api/v1/crates/libc/0.2.27/downloads","authors":"/api/v1/crates/libc/0.2.27/authors"},"crate_size":null},{"id":59067,"crate":"libc","num":"0.2.26","dl_path":"/api/v1/crates/libc/0.2.26/download","readme_path":"/api/v1/crates/libc/0.2.26/readme","updated_at":"2017-11-30T03:11:12.480219+00:00","created_at":"2017-07-07T23:15:50.860753+00:00","downloads":139634,"features":{"default":["use_std"],"use_std":[]},"yanked":false,"license":"MIT/Apache-2.0","links":{"dependencies":"/api/v1/crates/libc/0.2.26/dependencies","version_downloads":"/api/v1/crates/libc/0.2.26/downloads","authors":"/api/v1/crates/libc/0.2.26/authors"},"crate_size":null},{"id":59046,"crate":"libc","num":"0.2.25","dl_path":"/api/v1/crates/libc/0.2.25/download","readme_path":"/api/v1/crates/libc/0.2.25/readme","updated_at":"2017-11-30T03:29:56.031391+00:00","created_at":"2017-07-07T17:20:26.072226+00:00","downloads":27064,"features":{"default":["use_std"],"use_std":[]},"yanked":false,"license":"MIT/Apache-2.0","links":{"dependencies":"/api/v1/crates/libc/0.2.25/dependencies","version_downloads":"/api/v1/crates/libc/0.2.25/downloads","authors":"/api/v1/crates/libc/0.2.25/authors"},"crate_size":null},{"id":56839,"crate":"libc","num":"0.2.24","dl_path":"/api/v1/crates/libc/0.2.24/download","readme_path":"/api/v1/crates/libc/0.2.24/readme","updated_at":"2017-11-30T03:40:54.602099+00:00","created_at":"2017-06-15T19:39:48.812470+00:00","downloads":184788,"features":{"default":["use_std"],"use_std":[]},"yanked":false,"license":"MIT/Apache-2.0","links":{"dependencies":"/api/v1/crates/libc/0.2.24/dependencies","version_downloads":"/api/v1/crates/libc/0.2.24/downloads","authors":"/api/v1/crates/libc/0.2.24/authors"},"crate_size":null},{"id":53711,"crate":"libc","num":"0.2.23","dl_path":"/api/v1/crates/libc/0.2.23/download","readme_path":"/api/v1/crates/libc/0.2.23/readme","updated_at":"2017-11-30T03:06:24.458020+00:00","created_at":"2017-05-19T03:34:16.804139+00:00","downloads":303056,"features":{"default":["use_std"],"use_std":[]},"yanked":false,"license":"MIT/Apache-2.0","links":{"dependencies":"/api/v1/crates/libc/0.2.23/dependencies","version_downloads":"/api/v1/crates/libc/0.2.23/downloads","authors":"/api/v1/crates/libc/0.2.23/authors"},"crate_size":null},{"id":51450,"crate":"libc","num":"0.2.22","dl_path":"/api/v1/crates/libc/0.2.22/download","readme_path":"/api/v1/crates/libc/0.2.22/readme","updated_at":"2017-11-30T03:52:13.978067+00:00","created_at":"2017-04-26T22:38:24.471289+00:00","downloads":171719,"features":{"default":["use_std"],"use_std":[]},"yanked":false,"license":"MIT/Apache-2.0","links":{"dependencies":"/api/v1/crates/libc/0.2.22/dependencies","version_downloads":"/api/v1/crates/libc/0.2.22/downloads","authors":"/api/v1/crates/libc/0.2.22/authors"},"crate_size":null},{"id":46700,"crate":"libc","num":"0.2.21","dl_path":"/api/v1/crates/libc/0.2.21/download","readme_path":"/api/v1/crates/libc/0.2.21/readme","updated_at":"2017-11-30T02:54:36.471869+00:00","created_at":"2017-03-02T02:47:02.806228+00:00","downloads":587784,"features":{"default":["use_std"],"use_std":[]},"yanked":false,"license":"MIT/Apache-2.0","links":{"dependencies":"/api/v1/crates/libc/0.2.21/dependencies","version_downloads":"/api/v1/crates/libc/0.2.21/downloads","authors":"/api/v1/crates/libc/0.2.21/authors"},"crate_size":null},{"id":42535,"crate":"libc","num":"0.2.20","dl_path":"/api/v1/crates/libc/0.2.20/download","readme_path":"/api/v1/crates/libc/0.2.20/readme","updated_at":"2017-11-30T03:02:12.823936+00:00","created_at":"2017-01-17T17:24:02.660081+00:00","downloads":474477,"features":{"default":["use_std"],"use_std":[]},"yanked":false,"license":"MIT/Apache-2.0","links":{"dependencies":"/api/v1/crates/libc/0.2.20/dependencies","version_downloads":"/api/v1/crates/libc/0.2.20/downloads","authors":"/api/v1/crates/libc/0.2.20/authors"},"crate_size":null},{"id":41598,"crate":"libc","num":"0.2.19","dl_path":"/api/v1/crates/libc/0.2.19/download","readme_path":"/api/v1/crates/libc/0.2.19/readme","updated_at":"2017-11-30T03:22:12.162153+00:00","created_at":"2017-01-04T22:37:52.728926+00:00","downloads":116723,"features":{"default":["use_std"],"use_std":[]},"yanked":false,"license":"MIT/Apache-2.0","links":{"dependencies":"/api/v1/crates/libc/0.2.19/dependencies","version_downloads":"/api/v1/crates/libc/0.2.19/downloads","authors":"/api/v1/crates/libc/0.2.19/authors"},"crate_size":null},{"id":38948,"crate":"libc","num":"0.2.18","dl_path":"/api/v1/crates/libc/0.2.18/download","readme_path":"/api/v1/crates/libc/0.2.18/readme","updated_at":"2017-11-30T02:48:23.076471+00:00","created_at":"2016-12-02T21:36:53.789601+00:00","downloads":418904,"features":{"default":["use_std"],"use_std":[]},"yanked":false,"license":"MIT/Apache-2.0","links":{"dependencies":"/api/v1/crates/libc/0.2.18/dependencies","version_downloads":"/api/v1/crates/libc/0.2.18/downloads","authors":"/api/v1/crates/libc/0.2.18/authors"},"crate_size":null},{"id":35816,"crate":"libc","num":"0.2.17","dl_path":"/api/v1/crates/libc/0.2.17/download","readme_path":"/api/v1/crates/libc/0.2.17/readme","updated_at":"2017-11-30T03:00:25.666845+00:00","created_at":"2016-10-15T07:47:24.133563+00:00","downloads":418124,"features":{"default":["use_std"],"use_std":[]},"yanked":false,"license":"MIT/Apache-2.0","links":{"dependencies":"/api/v1/crates/libc/0.2.17/dependencies","version_downloads":"/api/v1/crates/libc/0.2.17/downloads","authors":"/api/v1/crates/libc/0.2.17/authors"},"crate_size":null},{"id":33357,"crate":"libc","num":"0.2.16","dl_path":"/api/v1/crates/libc/0.2.16/download","readme_path":"/api/v1/crates/libc/0.2.16/readme","updated_at":"2017-11-30T03:44:41.088177+00:00","created_at":"2016-09-09T06:56:18.886090+00:00","downloads":225259,"features":{"default":["use_std"],"use_std":[]},"yanked":false,"license":"MIT/Apache-2.0","links":{"dependencies":"/api/v1/crates/libc/0.2.16/dependencies","version_downloads":"/api/v1/crates/libc/0.2.16/downloads","authors":"/api/v1/crates/libc/0.2.16/authors"},"crate_size":null},{"id":31311,"crate":"libc","num":"0.2.15","dl_path":"/api/v1/crates/libc/0.2.15/download","readme_path":"/api/v1/crates/libc/0.2.15/readme","updated_at":"2017-11-30T03:02:49.574754+00:00","created_at":"2016-08-05T01:54:20.962345+00:00","downloads":270240,"features":{"default":["use_std"],"use_std":[]},"yanked":false,"license":"MIT/Apache-2.0","links":{"dependencies":"/api/v1/crates/libc/0.2.15/dependencies","version_downloads":"/api/v1/crates/libc/0.2.15/downloads","authors":"/api/v1/crates/libc/0.2.15/authors"},"crate_size":null},{"id":29868,"crate":"libc","num":"0.2.14","dl_path":"/api/v1/crates/libc/0.2.14/download","readme_path":"/api/v1/crates/libc/0.2.14/readme","updated_at":"2017-11-30T02:26:29.634195+00:00","created_at":"2016-07-11T18:54:03.962781+00:00","downloads":217252,"features":{"default":["use_std"],"use_std":[]},"yanked":false,"license":"MIT/Apache-2.0","links":{"dependencies":"/api/v1/crates/libc/0.2.14/dependencies","version_downloads":"/api/v1/crates/libc/0.2.14/downloads","authors":"/api/v1/crates/libc/0.2.14/authors"},"crate_size":null},{"id":29286,"crate":"libc","num":"0.2.13","dl_path":"/api/v1/crates/libc/0.2.13/download","readme_path":"/api/v1/crates/libc/0.2.13/readme","updated_at":"2017-11-30T03:08:12.109385+00:00","created_at":"2016-06-28T19:40:27.264246+00:00","downloads":126842,"features":{"default":["use_std"],"use_std":[]},"yanked":false,"license":"MIT/Apache-2.0","links":{"dependencies":"/api/v1/crates/libc/0.2.13/dependencies","version_downloads":"/api/v1/crates/libc/0.2.13/downloads","authors":"/api/v1/crates/libc/0.2.13/authors"},"crate_size":null},{"id":28414,"crate":"libc","num":"0.2.12","dl_path":"/api/v1/crates/libc/0.2.12/download","readme_path":"/api/v1/crates/libc/0.2.12/readme","updated_at":"2017-11-30T02:26:50.765781+00:00","created_at":"2016-06-10T15:11:59.859394+00:00","downloads":128526,"features":{"default":["use_std"],"use_std":[]},"yanked":false,"license":"MIT/Apache-2.0","links":{"dependencies":"/api/v1/crates/libc/0.2.12/dependencies","version_downloads":"/api/v1/crates/libc/0.2.12/downloads","authors":"/api/v1/crates/libc/0.2.12/authors"},"crate_size":null},{"id":26549,"crate":"libc","num":"0.2.11","dl_path":"/api/v1/crates/libc/0.2.11/download","readme_path":"/api/v1/crates/libc/0.2.11/readme","updated_at":"2017-11-30T02:54:30.293252+00:00","created_at":"2016-05-03T20:19:50.829787+00:00","downloads":279559,"features":{"default":["use_std"],"use_std":[]},"yanked":false,"license":"MIT/Apache-2.0","links":{"dependencies":"/api/v1/crates/libc/0.2.11/dependencies","version_downloads":"/api/v1/crates/libc/0.2.11/downloads","authors":"/api/v1/crates/libc/0.2.11/authors"},"crate_size":null},{"id":25536,"crate":"libc","num":"0.2.10","dl_path":"/api/v1/crates/libc/0.2.10/download","readme_path":"/api/v1/crates/libc/0.2.10/readme","updated_at":"2017-11-30T04:00:24.731513+00:00","created_at":"2016-04-12T22:56:49.175130+00:00","downloads":140544,"features":{"default":["use_std"],"use_std":[]},"yanked":false,"license":"MIT/Apache-2.0","links":{"dependencies":"/api/v1/crates/libc/0.2.10/dependencies","version_downloads":"/api/v1/crates/libc/0.2.10/downloads","authors":"/api/v1/crates/libc/0.2.10/authors"},"crate_size":null},{"id":24776,"crate":"libc","num":"0.2.9","dl_path":"/api/v1/crates/libc/0.2.9/download","readme_path":"/api/v1/crates/libc/0.2.9/readme","updated_at":"2017-11-30T03:47:12.048321+00:00","created_at":"2016-03-31T04:45:51.223181+00:00","downloads":85548,"features":{"default":["use_std"],"use_std":[]},"yanked":false,"license":"MIT/Apache-2.0","links":{"dependencies":"/api/v1/crates/libc/0.2.9/dependencies","version_downloads":"/api/v1/crates/libc/0.2.9/downloads","authors":"/api/v1/crates/libc/0.2.9/authors"},"crate_size":null},{"id":23609,"crate":"libc","num":"0.2.8","dl_path":"/api/v1/crates/libc/0.2.8/download","readme_path":"/api/v1/crates/libc/0.2.8/readme","updated_at":"2017-11-30T02:31:10.014767+00:00","created_at":"2016-03-07T22:42:56.442340+00:00","downloads":176270,"features":{"default":["use_std"],"use_std":[]},"yanked":false,"license":"MIT/Apache-2.0","links":{"dependencies":"/api/v1/crates/libc/0.2.8/dependencies","version_downloads":"/api/v1/crates/libc/0.2.8/downloads","authors":"/api/v1/crates/libc/0.2.8/authors"},"crate_size":null},{"id":22138,"crate":"libc","num":"0.2.7","dl_path":"/api/v1/crates/libc/0.2.7/download","readme_path":"/api/v1/crates/libc/0.2.7/readme","updated_at":"2017-11-30T02:26:14.801490+00:00","created_at":"2016-02-09T23:27:41.755788+00:00","downloads":164160,"features":{"default":[]},"yanked":false,"license":"MIT/Apache-2.0","links":{"dependencies":"/api/v1/crates/libc/0.2.7/dependencies","version_downloads":"/api/v1/crates/libc/0.2.7/downloads","authors":"/api/v1/crates/libc/0.2.7/authors"},"crate_size":null},{"id":21365,"crate":"libc","num":"0.2.6","dl_path":"/api/v1/crates/libc/0.2.6/download","readme_path":"/api/v1/crates/libc/0.2.6/readme","updated_at":"2017-11-30T03:50:08.394122+00:00","created_at":"2016-01-27T01:00:27.842917+00:00","downloads":76364,"features":{"default":[]},"yanked":false,"license":"MIT/Apache-2.0","links":{"dependencies":"/api/v1/crates/libc/0.2.6/dependencies","version_downloads":"/api/v1/crates/libc/0.2.6/downloads","authors":"/api/v1/crates/libc/0.2.6/authors"},"crate_size":null},{"id":21096,"crate":"libc","num":"0.2.5","dl_path":"/api/v1/crates/libc/0.2.5/download","readme_path":"/api/v1/crates/libc/0.2.5/readme","updated_at":"2017-11-30T04:00:24.708032+00:00","created_at":"2016-01-21T21:32:48.948442+00:00","downloads":23083,"features":{"default":[]},"yanked":false,"license":"MIT/Apache-2.0","links":{"dependencies":"/api/v1/crates/libc/0.2.5/dependencies","version_downloads":"/api/v1/crates/libc/0.2.5/downloads","authors":"/api/v1/crates/libc/0.2.5/authors"},"crate_size":null},{"id":19509,"crate":"libc","num":"0.2.4","dl_path":"/api/v1/crates/libc/0.2.4/download","readme_path":"/api/v1/crates/libc/0.2.4/readme","updated_at":"2017-11-30T04:20:50.966957+00:00","created_at":"2015-12-17T23:20:44.957419+00:00","downloads":151441,"features":{"default":[]},"yanked":false,"license":"MIT/Apache-2.0","links":{"dependencies":"/api/v1/crates/libc/0.2.4/dependencies","version_downloads":"/api/v1/crates/libc/0.2.4/downloads","authors":"/api/v1/crates/libc/0.2.4/authors"},"crate_size":null},{"id":19469,"crate":"libc","num":"0.2.3","dl_path":"/api/v1/crates/libc/0.2.3/download","readme_path":"/api/v1/crates/libc/0.2.3/readme","updated_at":"2017-11-30T03:05:29.856154+00:00","created_at":"2015-12-16T21:01:18.534146+00:00","downloads":4292,"features":{"default":[]},"yanked":false,"license":"MIT/Apache-2.0","links":{"dependencies":"/api/v1/crates/libc/0.2.3/dependencies","version_downloads":"/api/v1/crates/libc/0.2.3/downloads","authors":"/api/v1/crates/libc/0.2.3/authors"},"crate_size":null},{"id":17958,"crate":"libc","num":"0.2.2","dl_path":"/api/v1/crates/libc/0.2.2/download","readme_path":"/api/v1/crates/libc/0.2.2/readme","updated_at":"2017-11-30T03:10:31.178202+00:00","created_at":"2015-11-10T18:10:05.382010+00:00","downloads":157979,"features":{"default":[]},"yanked":false,"license":"MIT/Apache-2.0","links":{"dependencies":"/api/v1/crates/libc/0.2.2/dependencies","version_downloads":"/api/v1/crates/libc/0.2.2/downloads","authors":"/api/v1/crates/libc/0.2.2/authors"},"crate_size":null},{"id":17638,"crate":"libc","num":"0.2.1","dl_path":"/api/v1/crates/libc/0.2.1/download","readme_path":"/api/v1/crates/libc/0.2.1/readme","updated_at":"2017-11-30T04:04:16.047232+00:00","created_at":"2015-11-05T01:47:03.827924+00:00","downloads":14032,"features":{"default":[]},"yanked":false,"license":"MIT/Apache-2.0","links":{"dependencies":"/api/v1/crates/libc/0.2.1/dependencies","version_downloads":"/api/v1/crates/libc/0.2.1/downloads","authors":"/api/v1/crates/libc/0.2.1/authors"},"crate_size":null},{"id":17572,"crate":"libc","num":"0.2.0","dl_path":"/api/v1/crates/libc/0.2.0/download","readme_path":"/api/v1/crates/libc/0.2.0/readme","updated_at":"2017-11-30T03:30:03.255002+00:00","created_at":"2015-11-03T21:32:22.041055+00:00","downloads":3228,"features":{"default":[]},"yanked":false,"license":"MIT/Apache-2.0","links":{"dependencies":"/api/v1/crates/libc/0.2.0/dependencies","version_downloads":"/api/v1/crates/libc/0.2.0/downloads","authors":"/api/v1/crates/libc/0.2.0/authors"},"crate_size":null},{"id":17355,"crate":"libc","num":"0.1.12","dl_path":"/api/v1/crates/libc/0.1.12/download","readme_path":"/api/v1/crates/libc/0.1.12/readme","updated_at":"2017-11-30T03:53:57.332797+00:00","created_at":"2015-10-28T21:22:48.024978+00:00","downloads":606851,"features":{"cargo-build":[],"default":["cargo-build"]},"yanked":false,"license":"MIT/Apache-2.0","links":{"dependencies":"/api/v1/crates/libc/0.1.12/dependencies","version_downloads":"/api/v1/crates/libc/0.1.12/downloads","authors":"/api/v1/crates/libc/0.1.12/authors"},"crate_size":null},{"id":16916,"crate":"libc","num":"0.1.11","dl_path":"/api/v1/crates/libc/0.1.11/download","readme_path":"/api/v1/crates/libc/0.1.11/readme","updated_at":"2017-11-30T04:00:11.197225+00:00","created_at":"2015-10-19T20:51:19.038697+00:00","downloads":329,"features":{"cargo-build":[],"default":["cargo-build"]},"yanked":true,"license":"MIT/Apache-2.0","links":{"dependencies":"/api/v1/crates/libc/0.1.11/dependencies","version_downloads":"/api/v1/crates/libc/0.1.11/downloads","authors":"/api/v1/crates/libc/0.1.11/authors"},"crate_size":null},{"id":14628,"crate":"libc","num":"0.1.10","dl_path":"/api/v1/crates/libc/0.1.10/download","readme_path":"/api/v1/crates/libc/0.1.10/readme","updated_at":"2017-11-30T02:36:03.506148+00:00","created_at":"2015-08-15T20:29:52.723609+00:00","downloads":271991,"features":{"cargo-build":[],"default":["cargo-build"]},"yanked":false,"license":"MIT/Apache-2.0","links":{"dependencies":"/api/v1/crates/libc/0.1.10/dependencies","version_downloads":"/api/v1/crates/libc/0.1.10/downloads","authors":"/api/v1/crates/libc/0.1.10/authors"},"crate_size":null},{"id":13021,"crate":"libc","num":"0.1.9","dl_path":"/api/v1/crates/libc/0.1.9/download","readme_path":"/api/v1/crates/libc/0.1.9/readme","updated_at":"2017-11-30T03:11:03.349653+00:00","created_at":"2015-07-11T20:51:59.562389+00:00","downloads":6897,"features":{"cargo-build":[],"default":["cargo-build"]},"yanked":true,"license":"MIT/Apache-2.0","links":{"dependencies":"/api/v1/crates/libc/0.1.9/dependencies","version_downloads":"/api/v1/crates/libc/0.1.9/downloads","authors":"/api/v1/crates/libc/0.1.9/authors"},"crate_size":null},{"id":10384,"crate":"libc","num":"0.1.8","dl_path":"/api/v1/crates/libc/0.1.8/download","readme_path":"/api/v1/crates/libc/0.1.8/readme","updated_at":"2017-11-30T02:28:30.975602+00:00","created_at":"2015-05-17T19:46:43.744066+00:00","downloads":239337,"features":{"cargo-build":[],"default":["cargo-build"]},"yanked":false,"license":"MIT/Apache-2.0","links":{"dependencies":"/api/v1/crates/libc/0.1.8/dependencies","version_downloads":"/api/v1/crates/libc/0.1.8/downloads","authors":"/api/v1/crates/libc/0.1.8/authors"},"crate_size":null},{"id":9938,"crate":"libc","num":"0.1.7","dl_path":"/api/v1/crates/libc/0.1.7/download","readme_path":"/api/v1/crates/libc/0.1.7/readme","updated_at":"2017-11-30T02:57:45.661351+00:00","created_at":"2015-05-07T07:53:09.958093+00:00","downloads":33008,"features":{"cargo-build":[],"default":["cargo-build"]},"yanked":false,"license":"MIT/Apache-2.0","links":{"dependencies":"/api/v1/crates/libc/0.1.7/dependencies","version_downloads":"/api/v1/crates/libc/0.1.7/downloads","authors":"/api/v1/crates/libc/0.1.7/authors"},"crate_size":null},{"id":8437,"crate":"libc","num":"0.1.6","dl_path":"/api/v1/crates/libc/0.1.6/download","readme_path":"/api/v1/crates/libc/0.1.6/readme","updated_at":"2017-11-30T02:25:07.277378+00:00","created_at":"2015-04-07T17:10:55.631663+00:00","downloads":47738,"features":{"cargo-build":[],"default":["cargo-build"]},"yanked":false,"license":"MIT/Apache-2.0","links":{"dependencies":"/api/v1/crates/libc/0.1.6/dependencies","version_downloads":"/api/v1/crates/libc/0.1.6/downloads","authors":"/api/v1/crates/libc/0.1.6/authors"},"crate_size":null},{"id":7842,"crate":"libc","num":"0.1.5","dl_path":"/api/v1/crates/libc/0.1.5/download","readme_path":"/api/v1/crates/libc/0.1.5/readme","updated_at":"2017-11-30T03:21:15.827062+00:00","created_at":"2015-04-03T01:01:05.479603+00:00","downloads":10910,"features":{"cargo-build":[],"default":["cargo-build"]},"yanked":false,"license":"MIT/Apache-2.0","links":{"dependencies":"/api/v1/crates/libc/0.1.5/dependencies","version_downloads":"/api/v1/crates/libc/0.1.5/downloads","authors":"/api/v1/crates/libc/0.1.5/authors"},"crate_size":null},{"id":7408,"crate":"libc","num":"0.1.4","dl_path":"/api/v1/crates/libc/0.1.4/download","readme_path":"/api/v1/crates/libc/0.1.4/readme","updated_at":"2017-11-30T03:49:57.924961+00:00","created_at":"2015-03-28T17:51:19.880974+00:00","downloads":9609,"features":{"cargo-build":[],"default":["cargo-build"]},"yanked":false,"license":"MIT/Apache-2.0","links":{"dependencies":"/api/v1/crates/libc/0.1.4/dependencies","version_downloads":"/api/v1/crates/libc/0.1.4/downloads","authors":"/api/v1/crates/libc/0.1.4/authors"},"crate_size":null},{"id":6260,"crate":"libc","num":"0.1.3","dl_path":"/api/v1/crates/libc/0.1.3/download","readme_path":"/api/v1/crates/libc/0.1.3/readme","updated_at":"2017-11-30T04:04:15.866089+00:00","created_at":"2015-03-12T21:09:28.261382+00:00","downloads":16759,"features":{"cargo-build":[],"default":["cargo-build"]},"yanked":false,"license":"MIT/Apache-2.0","links":{"dependencies":"/api/v1/crates/libc/0.1.3/dependencies","version_downloads":"/api/v1/crates/libc/0.1.3/downloads","authors":"/api/v1/crates/libc/0.1.3/authors"},"crate_size":null},{"id":4732,"crate":"libc","num":"0.1.2","dl_path":"/api/v1/crates/libc/0.1.2/download","readme_path":"/api/v1/crates/libc/0.1.2/readme","updated_at":"2017-11-30T03:36:02.708097+00:00","created_at":"2015-02-08T14:03:43.901010+00:00","downloads":25299,"features":{"cargo-build":[],"default":["cargo-build"]},"yanked":false,"license":"MIT/Apache-2.0","links":{"dependencies":"/api/v1/crates/libc/0.1.2/dependencies","version_downloads":"/api/v1/crates/libc/0.1.2/downloads","authors":"/api/v1/crates/libc/0.1.2/authors"},"crate_size":null},{"id":4106,"crate":"libc","num":"0.1.1","dl_path":"/api/v1/crates/libc/0.1.1/download","readme_path":"/api/v1/crates/libc/0.1.1/readme","updated_at":"2017-11-30T03:53:57.315980+00:00","created_at":"2015-01-29T16:47:33.701342+00:00","downloads":5983,"features":{"cargo-build":[],"default":["cargo-build"]},"yanked":false,"license":"MIT/Apache-2.0","links":{"dependencies":"/api/v1/crates/libc/0.1.1/dependencies","version_downloads":"/api/v1/crates/libc/0.1.1/downloads","authors":"/api/v1/crates/libc/0.1.1/authors"},"crate_size":null},{"id":3006,"crate":"libc","num":"0.1.0","dl_path":"/api/v1/crates/libc/0.1.0/download","readme_path":"/api/v1/crates/libc/0.1.0/readme","updated_at":"2017-11-30T03:21:20.770945+00:00","created_at":"2015-01-15T20:22:13.116297+00:00","downloads":3534,"features":{"cargo-build":[],"default":["cargo-build"]},"yanked":false,"license":"MIT/Apache-2.0","links":{"dependencies":"/api/v1/crates/libc/0.1.0/dependencies","version_downloads":"/api/v1/crates/libc/0.1.0/downloads","authors":"/api/v1/crates/libc/0.1.0/authors"},"crate_size":null}],"keywords":[],"categories":[]} diff --git a/test/datasource/__snapshots__/cargo.spec.js.snap b/test/datasource/__snapshots__/cargo.spec.js.snap new file mode 100644 index 0000000000000000000000000000000000000000..d6b4ef707482a27a057391f96890f0dd2d4a6948 --- /dev/null +++ b/test/datasource/__snapshots__/cargo.spec.js.snap @@ -0,0 +1,246 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`datasource/cargo getPkgReleases processes real data 1`] = ` +Object { + "homepage": "https://github.com/rust-lang/libc", + "releases": Array [ + Object { + "version": "0.2.44", + }, + Object { + "version": "0.2.43", + }, + Object { + "version": "0.2.42", + }, + Object { + "version": "0.2.41", + }, + Object { + "version": "0.2.40", + }, + Object { + "version": "0.2.39", + }, + Object { + "version": "0.2.38", + }, + Object { + "version": "0.2.37", + }, + Object { + "version": "0.2.36", + }, + Object { + "version": "0.2.35", + }, + Object { + "version": "0.2.34", + }, + Object { + "version": "0.2.33", + }, + Object { + "version": "0.2.32", + }, + Object { + "version": "0.2.31", + }, + Object { + "version": "0.2.30", + }, + Object { + "version": "0.2.29", + }, + Object { + "version": "0.2.28", + }, + Object { + "version": "0.2.27", + }, + Object { + "version": "0.2.26", + }, + Object { + "version": "0.2.25", + }, + Object { + "version": "0.2.24", + }, + Object { + "version": "0.2.23", + }, + Object { + "version": "0.2.22", + }, + Object { + "version": "0.2.21", + }, + Object { + "version": "0.2.20", + }, + Object { + "version": "0.2.19", + }, + Object { + "version": "0.2.18", + }, + Object { + "version": "0.2.17", + }, + Object { + "version": "0.2.16", + }, + Object { + "version": "0.2.15", + }, + Object { + "version": "0.2.14", + }, + Object { + "version": "0.2.13", + }, + Object { + "version": "0.2.12", + }, + Object { + "version": "0.2.11", + }, + Object { + "version": "0.2.10", + }, + Object { + "version": "0.2.9", + }, + Object { + "version": "0.2.8", + }, + Object { + "version": "0.2.7", + }, + Object { + "version": "0.2.6", + }, + Object { + "version": "0.2.5", + }, + Object { + "version": "0.2.4", + }, + Object { + "version": "0.2.3", + }, + Object { + "version": "0.2.2", + }, + Object { + "version": "0.2.1", + }, + Object { + "version": "0.2.0", + }, + Object { + "version": "0.1.12", + }, + Object { + "version": "0.1.11", + }, + Object { + "version": "0.1.10", + }, + Object { + "version": "0.1.9", + }, + Object { + "version": "0.1.8", + }, + Object { + "version": "0.1.7", + }, + Object { + "version": "0.1.6", + }, + Object { + "version": "0.1.5", + }, + Object { + "version": "0.1.4", + }, + Object { + "version": "0.1.3", + }, + Object { + "version": "0.1.2", + }, + Object { + "version": "0.1.1", + }, + Object { + "version": "0.1.0", + }, + ], + "sourceUrl": "https://github.com/rust-lang/libc", +} +`; + +exports[`datasource/cargo getPkgReleases processes real data 2`] = ` +Object { + "homepage": "https://www.amethyst.rs/", + "releases": Array [ + Object { + "version": "0.9.0", + }, + Object { + "version": "0.8.0", + }, + Object { + "version": "0.7.0", + }, + Object { + "version": "0.6.0", + }, + Object { + "version": "0.5.1", + }, + Object { + "version": "0.5.0", + }, + Object { + "version": "0.4.3", + }, + Object { + "version": "0.4.2", + }, + Object { + "version": "0.4.1", + }, + Object { + "version": "0.4.0", + }, + Object { + "version": "0.3.1", + }, + Object { + "version": "0.3.0", + }, + Object { + "version": "0.2.1", + }, + Object { + "version": "0.1.4", + }, + Object { + "version": "0.1.3", + }, + Object { + "version": "0.1.1", + }, + Object { + "version": "0.1.0", + }, + ], + "sourceUrl": "https://github.com/amethyst/amethyst", +} +`; + +exports[`datasource/cargo getPkgReleases throws for 5xx 1`] = `[Error: registry-failure]`; diff --git a/test/datasource/cargo.spec.js b/test/datasource/cargo.spec.js new file mode 100644 index 0000000000000000000000000000000000000000..b3fee5092d767a8bcb7102d779751cd52db854a4 --- /dev/null +++ b/test/datasource/cargo.spec.js @@ -0,0 +1,74 @@ +const got = require('got'); +const fs = require('fs'); +const { getPkgReleases } = require('../../lib/datasource/cargo'); + +let res1 = fs.readFileSync('test/_fixtures/cargo/libc.json', 'utf8'); +res1 = JSON.parse(res1); +let res2 = fs.readFileSync('test/_fixtures/cargo/amethyst.json', 'utf8'); +res2 = JSON.parse(res2); + +jest.mock('got'); + +describe('datasource/cargo', () => { + describe('getPkgReleases', () => { + it('returns null for empty result', async () => { + got.mockReturnValueOnce(null); + expect( + await getPkgReleases({ fullname: 'non_existent_crate' }) + ).toBeNull(); + }); + it('returns null for missing fields', async () => { + got.mockReturnValueOnce({ crate: {} }); + expect( + await getPkgReleases({ fullname: 'non_existent_crate' }) + ).toBeNull(); + }); + it('returns null for 404', async () => { + got.mockImplementationOnce(() => + Promise.reject({ + statusCode: 404, + }) + ); + expect(await getPkgReleases({ fullname: 'some_crate' })).toBeNull(); + }); + it('throws for 5xx', async () => { + got.mockImplementationOnce(() => + Promise.reject({ + statusCode: 502, + }) + ); + let e; + try { + await getPkgReleases({ fullname: 'some_crate' }); + } catch (err) { + e = err; + } + expect(e).toBeDefined(); + expect(e).toMatchSnapshot(); + }); + it('returns null for unknown error', async () => { + got.mockImplementationOnce(() => { + throw new Error(); + }); + expect(await getPkgReleases('some_crate')).toBeNull(); + }); + it('processes real data', async () => { + got.mockReturnValueOnce({ + body: res1, + }); + const res = await getPkgReleases({ fullname: 'libc' }); + expect(res).toMatchSnapshot(); + expect(res).not.toBeNull(); + expect(res).toBeDefined(); + }); + it('processes real data', async () => { + got.mockReturnValueOnce({ + body: res2, + }); + const res = await getPkgReleases({ fullname: 'amethyst' }); + expect(res).toMatchSnapshot(); + expect(res).not.toBeNull(); + expect(res).toBeDefined(); + }); + }); +});