commit
93e5dc3f48
@ -1,133 +0,0 @@ |
|||||||
diff --git a/cmd/tools/vcreate_test.v b/cmd/tools/vcreate_test.v
|
|
||||||
index 3d07f4773..de8a202df 100644
|
|
||||||
--- a/cmd/tools/vcreate_test.v
|
|
||||||
+++ b/cmd/tools/vcreate_test.v
|
|
||||||
@@ -2,127 +2,6 @@ import os
|
|
||||||
|
|
||||||
const test_path = 'vcreate_test'
|
|
||||||
|
|
||||||
-fn init_and_check() ? {
|
|
||||||
- os.execute_or_exit('${os.quoted_path(@VEXE)} init')
|
|
||||||
-
|
|
||||||
- assert os.read_file('vcreate_test.v') ? == [
|
|
||||||
- 'module main\n',
|
|
||||||
- 'fn main() {',
|
|
||||||
- " println('Hello World!')",
|
|
||||||
- '}',
|
|
||||||
- '',
|
|
||||||
- ].join_lines()
|
|
||||||
-
|
|
||||||
- assert os.read_file('v.mod') ? == [
|
|
||||||
- 'Module {',
|
|
||||||
- " name: 'vcreate_test'",
|
|
||||||
- " description: ''",
|
|
||||||
- " version: ''",
|
|
||||||
- " license: ''",
|
|
||||||
- ' dependencies: []',
|
|
||||||
- '}',
|
|
||||||
- '',
|
|
||||||
- ].join_lines()
|
|
||||||
-
|
|
||||||
- assert os.read_file('.gitignore') ? == [
|
|
||||||
- '# Binaries for programs and plugins',
|
|
||||||
- 'main',
|
|
||||||
- 'vcreate_test',
|
|
||||||
- '*.exe',
|
|
||||||
- '*.exe~',
|
|
||||||
- '*.so',
|
|
||||||
- '*.dylib',
|
|
||||||
- '*.dll',
|
|
||||||
- 'vls.log',
|
|
||||||
- '',
|
|
||||||
- ].join_lines()
|
|
||||||
-
|
|
||||||
- assert os.read_file('.gitattributes') ? == [
|
|
||||||
- '*.v linguist-language=V text=auto eol=lf',
|
|
||||||
- '*.vv linguist-language=V text=auto eol=lf',
|
|
||||||
- '*.vsh linguist-language=V text=auto eol=lf',
|
|
||||||
- '**/v.mod linguist-language=V text=auto eol=lf',
|
|
||||||
- '',
|
|
||||||
- ].join_lines()
|
|
||||||
-
|
|
||||||
- assert os.read_file('.editorconfig') ? == [
|
|
||||||
- '[*]',
|
|
||||||
- 'charset = utf-8',
|
|
||||||
- 'end_of_line = lf',
|
|
||||||
- 'insert_final_newline = true',
|
|
||||||
- 'trim_trailing_whitespace = true',
|
|
||||||
- '',
|
|
||||||
- '[*.v]',
|
|
||||||
- 'indent_style = tab',
|
|
||||||
- 'indent_size = 4',
|
|
||||||
- '',
|
|
||||||
- ].join_lines()
|
|
||||||
-}
|
|
||||||
-
|
|
||||||
fn test_v_init() ? {
|
|
||||||
- dir := os.join_path(os.temp_dir(), test_path)
|
|
||||||
- os.rmdir_all(dir) or {}
|
|
||||||
- os.mkdir(dir) or {}
|
|
||||||
- defer {
|
|
||||||
- os.rmdir_all(dir) or {}
|
|
||||||
- }
|
|
||||||
- os.chdir(dir) ?
|
|
||||||
-
|
|
||||||
- init_and_check() ?
|
|
||||||
-}
|
|
||||||
-
|
|
||||||
-fn test_v_init_in_git_dir() ? {
|
|
||||||
- dir := os.join_path(os.temp_dir(), test_path)
|
|
||||||
- os.rmdir_all(dir) or {}
|
|
||||||
- os.mkdir(dir) or {}
|
|
||||||
- defer {
|
|
||||||
- os.rmdir_all(dir) or {}
|
|
||||||
- }
|
|
||||||
- os.chdir(dir) ?
|
|
||||||
- os.execute_or_exit('git init .')
|
|
||||||
- init_and_check() ?
|
|
||||||
-}
|
|
||||||
-
|
|
||||||
-fn test_v_init_no_overwrite_gitignore() ? {
|
|
||||||
- dir := os.join_path(os.temp_dir(), test_path)
|
|
||||||
- os.rmdir_all(dir) or {}
|
|
||||||
- os.mkdir(dir) or {}
|
|
||||||
- os.write_file('$dir/.gitignore', 'blah') ?
|
|
||||||
- defer {
|
|
||||||
- os.rmdir_all(dir) or {}
|
|
||||||
- }
|
|
||||||
- os.chdir(dir) ?
|
|
||||||
-
|
|
||||||
- os.execute_or_exit('${os.quoted_path(@VEXE)} init')
|
|
||||||
-
|
|
||||||
- assert os.read_file('.gitignore') ? == 'blah'
|
|
||||||
-}
|
|
||||||
-
|
|
||||||
-fn test_v_init_no_overwrite_gitattributes_and_editorconfig() ? {
|
|
||||||
- git_attributes_content := '*.v linguist-language=V text=auto eol=lf'
|
|
||||||
- editor_config_content := '[*]
|
|
||||||
-charset = utf-8
|
|
||||||
-end_of_line = lf
|
|
||||||
-insert_final_newline = true
|
|
||||||
-trim_trailing_whitespace = true
|
|
||||||
-
|
|
||||||
-[*.v]
|
|
||||||
-indent_style = tab
|
|
||||||
-indent_size = 4
|
|
||||||
-'
|
|
||||||
-
|
|
||||||
- dir := os.join_path(os.temp_dir(), test_path)
|
|
||||||
- os.rmdir_all(dir) or {}
|
|
||||||
- os.mkdir(dir) or {}
|
|
||||||
- os.write_file('$dir/.gitattributes', git_attributes_content) ?
|
|
||||||
- os.write_file('$dir/.editorconfig', editor_config_content) ?
|
|
||||||
- defer {
|
|
||||||
- os.rmdir_all(dir) or {}
|
|
||||||
- }
|
|
||||||
- os.chdir(dir) ?
|
|
||||||
-
|
|
||||||
- os.execute_or_exit('${os.quoted_path(@VEXE)} init')
|
|
||||||
-
|
|
||||||
- assert os.read_file('.gitattributes') ? == git_attributes_content
|
|
||||||
- assert os.read_file('.editorconfig') ? == editor_config_content
|
|
||||||
+ println('vcreate_test disabled')
|
|
||||||
}
|
|
@ -1,25 +0,0 @@ |
|||||||
{ lib, stdenv, fetchurl, pkg-config, dbus, expat }: |
|
||||||
|
|
||||||
let version = "1.0.3"; in |
|
||||||
|
|
||||||
stdenv.mkDerivation { |
|
||||||
pname = "libnih"; |
|
||||||
inherit version; |
|
||||||
|
|
||||||
src = fetchurl { |
|
||||||
url = "https://code.launchpad.net/libnih/1.0/${version}/+download/libnih-${version}.tar.gz"; |
|
||||||
sha256 = "01glc6y7z1g726zwpvp2zm79pyb37ki729jkh45akh35fpgp4xc9"; |
|
||||||
}; |
|
||||||
|
|
||||||
nativeBuildInputs = [ pkg-config ]; |
|
||||||
buildInputs = [ dbus expat ]; |
|
||||||
|
|
||||||
doCheck = false; # fails 1 of 17 test |
|
||||||
|
|
||||||
meta = { |
|
||||||
description = "A small library for C application development"; |
|
||||||
homepage = "https://launchpad.net/libnih"; |
|
||||||
license = lib.licenses.gpl2; |
|
||||||
platforms = lib.platforms.linux; |
|
||||||
}; |
|
||||||
} |
|
@ -0,0 +1,44 @@ |
|||||||
|
{ lib |
||||||
|
, rustPlatform |
||||||
|
, fetchFromGitHub |
||||||
|
, nix-gitignore |
||||||
|
, makeWrapper |
||||||
|
, stdenv |
||||||
|
, darwin |
||||||
|
, callPackage |
||||||
|
|
||||||
|
# runtime dependencies |
||||||
|
, nix # for nix-prefetch-url |
||||||
|
, nix-prefetch-git |
||||||
|
, git # for git ls-remote |
||||||
|
}: |
||||||
|
|
||||||
|
let |
||||||
|
runtimePath = lib.makeBinPath [ nix nix-prefetch-git git ]; |
||||||
|
sources = (builtins.fromJSON (builtins.readFile ./sources.json)).pins; |
||||||
|
in rustPlatform.buildRustPackage rec { |
||||||
|
pname = "npins"; |
||||||
|
version = src.version; |
||||||
|
src = passthru.mkSource sources.npins; |
||||||
|
|
||||||
|
cargoSha256 = "0rwnzkmx91cwcz9yw0rbbqv73ba6ggim9f4qgz5pgy6h696ld2k8"; |
||||||
|
|
||||||
|
buildInputs = lib.optional stdenv.isDarwin (with darwin.apple_sdk.frameworks; [ Security ]); |
||||||
|
nativeBuildInputs = [ makeWrapper ]; |
||||||
|
|
||||||
|
# (Almost) all tests require internet |
||||||
|
doCheck = false; |
||||||
|
|
||||||
|
postFixup = '' |
||||||
|
wrapProgram $out/bin/npins --prefix PATH : "${runtimePath}" |
||||||
|
''; |
||||||
|
|
||||||
|
meta = with lib; { |
||||||
|
description = "Simple and convenient dependency pinning for Nix"; |
||||||
|
homepage = "https://github.com/andir/npins"; |
||||||
|
license = licenses.eupl12; |
||||||
|
maintainers = with maintainers; [ piegames ]; |
||||||
|
}; |
||||||
|
|
||||||
|
passthru.mkSource = callPackage ./source.nix {}; |
||||||
|
} |
@ -0,0 +1,57 @@ |
|||||||
|
# Not part of the public API – for use within nixpkgs only |
||||||
|
# |
||||||
|
# Usage: |
||||||
|
# ```nix |
||||||
|
# let |
||||||
|
# sources = builtins.fromJSON (builtins.readFile ./sources.json); |
||||||
|
# in mkMyDerivation rec { |
||||||
|
# version = src.version; # This obviously only works for releases |
||||||
|
# src = pkgs.npins.mkSource sources.mySource; |
||||||
|
# } |
||||||
|
# ``` |
||||||
|
|
||||||
|
{ fetchgit |
||||||
|
, fetchzip |
||||||
|
, fetchurl |
||||||
|
}: |
||||||
|
let |
||||||
|
mkSource = spec: |
||||||
|
assert spec ? type; let |
||||||
|
path = |
||||||
|
if spec.type == "Git" then mkGitSource spec |
||||||
|
else if spec.type == "GitRelease" then mkGitSource spec |
||||||
|
else if spec.type == "PyPi" then mkPyPiSource spec |
||||||
|
else if spec.type == "Channel" then mkChannelSource spec |
||||||
|
else throw "Unknown source type ${spec.type}"; |
||||||
|
in |
||||||
|
spec // { outPath = path; }; |
||||||
|
|
||||||
|
mkGitSource = { repository, revision, url ? null, hash, ... }: |
||||||
|
assert repository ? type; |
||||||
|
# At the moment, either it is a plain git repository (which has an url), or it is a GitHub/GitLab repository |
||||||
|
# In the latter case, there we will always be an url to the tarball |
||||||
|
if url != null then |
||||||
|
(fetchzip { |
||||||
|
inherit url; |
||||||
|
sha256 = hash; |
||||||
|
extension = "tar"; |
||||||
|
}) |
||||||
|
else assert repository.type == "Git"; fetchgit { |
||||||
|
url = repository.url; |
||||||
|
rev = revision; |
||||||
|
}; |
||||||
|
|
||||||
|
mkPyPiSource = { url, hash, ... }: |
||||||
|
fetchurl { |
||||||
|
inherit url; |
||||||
|
sha256 = hash; |
||||||
|
}; |
||||||
|
|
||||||
|
mkChannelSource = { url, hash, ... }: |
||||||
|
fetchzip { |
||||||
|
inherit url; |
||||||
|
sha256 = hash; |
||||||
|
extension = "tar"; |
||||||
|
}; |
||||||
|
in |
||||||
|
mkSource |
@ -0,0 +1,19 @@ |
|||||||
|
{ |
||||||
|
"pins": { |
||||||
|
"npins": { |
||||||
|
"type": "GitRelease", |
||||||
|
"repository": { |
||||||
|
"type": "GitHub", |
||||||
|
"owner": "andir", |
||||||
|
"repo": "npins" |
||||||
|
}, |
||||||
|
"pre_releases": false, |
||||||
|
"version_upper_bound": null, |
||||||
|
"version": "0.1.0", |
||||||
|
"revision": "5c9253ff6010f435ab73fbe1e50ae0fdca0ec07b", |
||||||
|
"url": "https://api.github.com/repos/andir/npins/tarball/0.1.0", |
||||||
|
"hash": "019fr9xsirld8kap75k18in3krkikqhjn4mglpy3lyhbhc5n1kh6" |
||||||
|
} |
||||||
|
}, |
||||||
|
"version": 2 |
||||||
|
} |
Loading…
Reference in new issue