This commit is contained in:
zapashcanon 2022-05-06 15:51:39 +02:00
parent e19d64cff5
commit d87efdd6cf
Signed by: zapashcanon
GPG Key ID: 8981C3C62D1D28F1
4 changed files with 105 additions and 5 deletions

View File

@ -1,3 +1,24 @@
(lang dune 1.11)
(name memo)
(explicit_js_mode)
(lang dune 2.0)
(name still_dep)
(license ISC)
(authors "zapashcanon <contact@ndrs.fr>")
(maintainers "zapashcanon <contact@ndrs.fr>")
(source
(github zapashcanon/still_dep))
(generate_opam_files true)
(package
(name still_dep)
(synopsis "still dep")
(description "still dep")
(depends
(ocaml
(>= 4.05))
(dune
(>= 2.0))))

View File

@ -1,3 +1,9 @@
(executable
(name still_dep)
(libraries unix))
(public_name still_dep)
(modules still_dep)
(libraries unix))
(executable
(name still_not_dep)
(modules still_not_dep)
(libraries unix))

45
src/still_not_dep.ml Normal file
View File

@ -0,0 +1,45 @@
;;
if Array.length Sys.argv <> 2 then (
Format.printf "usage: %s <package name>@." Sys.argv.(0);
exit 1
)
let pkg = Sys.argv.(1)
let chan =
Unix.open_process_in ("opam list -a --color=never -s")
let _ =
try
while true do
(* one pkg *)
let line = input_line chan in
(* the last version of this pkg *)
let last_ver =
input_line
(Unix.open_process_in
("opam show --color=never " ^ line ^ " -f version"))
in
let chan' =
Unix.open_process_in
( "opam list --color=never --required-by " ^ line ^ "." ^ last_ver
^ " -s" )
in
let seen = ref false in
try
while true do
(* one dep of this pkg *)
let line' = input_line chan' in
(* if pkg is here, then this pkg still depends on pkg *)
if line' = pkg then (
seen := true;
try Unix.kill (Unix.process_in_pid chan') Sys.sigkill with Sys_error _ -> ();
raise_notrace End_of_file
)
done
with End_of_file -> begin
ignore(Unix.close_process_in chan');
if not !seen then print_endline line;
end
done
with End_of_file -> ()

28
still_dep.opam Normal file
View File

@ -0,0 +1,28 @@
# This file is generated by dune, edit dune-project instead
opam-version: "2.0"
synopsis: "still dep"
description: "still dep"
maintainer: ["zapashcanon <contact@ndrs.fr>"]
authors: ["zapashcanon <contact@ndrs.fr>"]
license: "ISC"
homepage: "https://github.com/zapashcanon/still_dep"
bug-reports: "https://github.com/zapashcanon/still_dep/issues"
depends: [
"ocaml" {>= "4.05"}
"dune" {>= "2.0"}
]
build: [
["dune" "subst"] {pinned}
[
"dune"
"build"
"-p"
name
"-j"
jobs
"@install"
"@runtest" {with-test}
"@doc" {with-doc}
]
]
dev-repo: "git+https://github.com/zapashcanon/still_dep.git"