Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions master_changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ users)

## Repository
* No longer call tar tool to create archives, use tar library instead [#6945 @kit-ty-kate]
* [BUG] Do not fail on directories named `opam` when scanning the `packages` directory of a repository during `opam repo add` or `opam init` (worked on subsequent `opam update`) [#6941 @kit-ty-kate @rjbou]

## Lock
* [BUG] Fix `undefined variable` error when a lock file filter contains an undefined variables: fail gracefully with strict mode, continue and default the variable to false on normal mode [#6947 @rjbou - fix #6946]
Expand Down Expand Up @@ -185,6 +186,7 @@ users)
* Fix some forgotten sed in `extrasource` and `update` tests in #6734 [#6970 @rjbou]
* Add a test for `opam config subst` [#6936 @NathanReb]
* Add a lock test for undefined variables in a lock file [#6947 @rjbou - fix #6946]
* Add a test showing the behaviour of `opam repo add` and `opam update` when faced with a repository containing an `opam` directory [#6995 @kit-ty-kate]

### Engine
* Add `http-server` to launch a minimal http server [#6939 @rjbou]
Expand Down
7 changes: 5 additions & 2 deletions src/state/opamRepositoryState.ml
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,11 @@ let load_opams_from_dir repo_name repo_root =
(* FIXME: why is this different from OpamPackage.list ? *)
let rec aux r dir =
if OpamFilename.exists_dir dir then
let fnames = Sys.readdir (OpamFilename.Dir.to_string dir) in
if Array.exists (fun f -> String.equal f OpamPathName.opam_f) fnames then
let dir_str = OpamFilename.Dir.to_string dir in
let fnames = Sys.readdir dir_str in
let ( / ) = Filename.concat in
if Array.exists (fun f -> String.equal f OpamPathName.opam_f &&
not (Sys.is_directory (dir_str / f))) fnames then
match read_package_opam ~repo_name ~repo_root dir with
| Some (nv, opam) -> OpamPackage.Map.add nv opam r
| None -> r
Expand Down
42 changes: 42 additions & 0 deletions tests/reftests/repository.test
Original file line number Diff line number Diff line change
Expand Up @@ -967,3 +967,45 @@ Now run 'opam upgrade' to apply any package updates.
+++ test-git.new/packages/test/test.4/opam
@@ -0,0 +1,1 @@
+opam-version: "2.0"
### :: Test the scan of directories named 'opam'
### opam switch create opam-dir --empty
### <OPAM-DIR/repo>
opam-version: "2.0"
### <OPAM-DIR/packages/opam/opam.1/opam>
opam-version: "2.0"
build: ["echo" "init"]
### opam repo add --this-switch opam-dir OPAM-DIR
[opam-dir] Initialised
### opam install --verbose opam | sed-cmd echo
The following actions will be performed:
=== install 1 package
- install opam 1

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
Processing 2/3: [opam: echo init]
+ echo "init" (CWD=${BASEDIR}/OPAM/opam-dir/.opam-switch/build/opam.1)
- init
-> compiled opam.1
-> installed opam.1
Done.
### <OPAM-DIR/packages/opam/opam.1/opam>
opam-version: "2.0"
build: ["echo" "update"]
### opam update opam-dir

<><> Updating package repositories ><><><><><><><><><><><><><><><><><><><><><><>
[opam-dir] synchronised from file://${BASEDIR}/OPAM-DIR
Now run 'opam upgrade' to apply any package updates.
### opam reinstall --yes --verbose opam | sed-cmd echo
The following actions will be performed:
=== recompile 1 package
- recompile opam 1

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
Processing 2/4: [opam: echo update]
+ echo "update" (CWD=${BASEDIR}/OPAM/opam-dir/.opam-switch/build/opam.1)
- update
-> compiled opam.1
-> removed opam.1
-> installed opam.1
Done.
Loading