chore: leanpkg: secondary output to stderr

This commit is contained in:
Sebastian Ullrich 2021-01-12 11:05:30 +01:00
parent 35e4f7391a
commit 607d788001
3 changed files with 6 additions and 6 deletions

View file

@ -67,7 +67,7 @@ version = \"0.1\"
execCmd {cmd := "git", args := #["init", "-q"]}
unless upstreamGitBranch = "master" do
execCmd {cmd := "git", args := #["checkout", "-B", upstreamGitBranch]}
) <|> IO.println "WARNING: failed to initialize git repository"
) <|> IO.eprintln "WARNING: failed to initialize git repository"
def init (n : String) := initPkg n false

View file

@ -8,7 +8,7 @@ namespace Leanpkg
def execCmd (args : IO.Process.SpawnArgs) : IO Unit := do
let envstr := String.join <| args.env.toList.map fun (k, v) => s!"{k}={v.getD ""} "
let cmdstr := " ".intercalate (args.cmd :: args.args.toList)
IO.println <| "> " ++ envstr ++
IO.eprintln <| "> " ++ envstr ++
match args.cwd with
| some cwd => cmdstr ++ " # in directory " ++ cwd
| none => cmdstr

View file

@ -45,20 +45,20 @@ def materialize (relpath : String) (dep : Dependency) : Solver Unit :=
match dep.src with
| Source.path dir => do
let depdir := resolveDir dir relpath
IO.println s!"{dep.name}: using local path {depdir}"
IO.eprintln s!"{dep.name}: using local path {depdir}"
modify (·.insert dep.name depdir)
| Source.git url rev branch => do
let depdir := "build/deps/" ++ dep.name
let alreadyThere ← IO.isDir depdir
if alreadyThere then
IO.print s!"{dep.name}: trying to update {depdir} to revision {rev}"
IO.println (match branch with | none => "" | some branch => "@" ++ branch)
IO.eprint s!"{dep.name}: trying to update {depdir} to revision {rev}"
IO.eprintln (match branch with | none => "" | some branch => "@" ++ branch)
let hash ← gitParseOriginRevision depdir rev
let revEx ← gitRevisionExists depdir hash
unless revEx do
execCmd {cmd := "git", args := #["fetch"], cwd := depdir}
else
IO.println s!"{dep.name}: cloning {url} to {depdir}"
IO.eprintln s!"{dep.name}: cloning {url} to {depdir}"
execCmd {cmd := "git", args := #["clone", url, depdir]}
let hash ← gitParseOriginRevision depdir rev
execCmd {cmd := "git", args := #["checkout", "--detach", hash], cwd := depdir}