Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incompatible with upcoming bare Cargo registry #32

Closed
ishitatsuyuki opened this issue May 15, 2017 · 19 comments
Closed

Incompatible with upcoming bare Cargo registry #32

ishitatsuyuki opened this issue May 15, 2017 · 19 comments

Comments

@ishitatsuyuki
Copy link
Contributor

ishitatsuyuki commented May 15, 2017

rust-lang/cargo#4026 introduced local registry without checkout, and this tool doesn't work since it relies on registry directory structure.

The old format isn't compatible with the new format at all, so choose one:

  • port and branch the code
  • use the system Cargo executable to query them
  • link to Cargo (bad buildtime)
  • directly query crates.io (used by cargo-edit)
@nabijaczleweli
Copy link
Owner

Hmmm, I guess we could basically do the same thing as we do now but through the git2 layer rather than raw FS.

4026 landed in nightly 5 days ago, so it'll land in stable like 4 weeks from that, or does cargo release on a different cycle than rustc?

@ishitatsuyuki
Copy link
Contributor Author

It should land as 0.20.0, so 1 or 2 months. I think keeping the code in master until it hits stable is a good idea.

@nabijaczleweli
Copy link
Owner

Eh, the difference between non-bare and bare is only the location of the repo itself (and IIRC git2 is smart enough to follow .git), so one can implement git2-based searching w/o breaking the current cargo.

@nabijaczleweli nabijaczleweli changed the title Incompatible with bare Cargo registry Incompatible with upcoming bare Cargo registry May 15, 2017
@pravic
Copy link

pravic commented May 16, 2017

nabijaczleweli closed this in 1ec0f2f 32 minutes ago

Doesn't work though:

cargo install-update -al
    Updating registry `https://github.com/rust-lang/crates.io-index`

Failed read master branch of registry repositry at
 $CARGO_HOME/registry/index/github.com-1ecc6299db9ec823.

@nabijaczleweli
Copy link
Owner

nabijaczleweli commented May 16, 2017

Can you check that that directory is actually a git repository? It works for me, but

@pravic
Copy link

pravic commented May 16, 2017

>ls $CARGO_HOME/registry/index/github.com-1ecc6299db9ec823
config  description  FETCH_HEAD  HEAD  hooks  info  objects  refs

@nabijaczleweli
Copy link
Owner

Interesting, a manually-cloned bare repo works for me. Try replacing master with HEAD at main.rs#L57, maybe? Otherwise printing that error would work as well 🤔

@pravic
Copy link

pravic commented May 16, 2017

error: Error { code: -3, klass: 4, message: "Revspec 'HEAD' not found." }.

@nabijaczleweli
Copy link
Owner

And it's the same with master, I presume?

@pravic
Copy link

pravic commented May 16, 2017

Yep

@nabijaczleweli
Copy link
Owner

That's definitely interesting, but I can't see how I can do anything else than read master or HEAD (but probably `master)?

@pravic
Copy link

pravic commented May 16, 2017

https://libgit2.github.com/libgit2/#HEAD/group/revparse
https://git-scm.com/docs/git-rev-parse.html#_specifying_revisions

You have to use an origin/master, I guess. Because it isn't a working copy and we have no master branch in it.
Works for me.

nabijaczleweli added a commit that referenced this issue May 16, 2017
Because it works:tm:, the more you know

Ref: #32
@nabijaczleweli
Copy link
Owner

If that's the last thing then I'm gonna release it, if y'all have no objections?

@pravic
Copy link

pravic commented May 16, 2017

I don't know. It seems, it works on nightly now, so I have no objections.
Have you checked on stable Rust?

@nabijaczleweli
Copy link
Owner

I only use stable so yes.

@nabijaczleweli
Copy link
Owner

Released in v1.0.0

@durka
Copy link
Contributor

durka commented Nov 17, 2017

I'm seeing this issue in v1.3.1.

durska:piston-image alex$ rustc -vV
rustc 1.22.0-beta.3 (cc6ed0640 2017-11-13)
binary: rustc
commit-hash: cc6ed0640fbcd2dff95b4532fd12aa0d6c545f28
commit-date: 2017-11-13
host: x86_64-apple-darwin
release: 1.22.0-beta.3
LLVM version: 4.0
durska:piston-image alex$ cargo -vV
cargo 0.23.0-beta (cee38cd30 2017-11-12)
release: 0.23.0
commit-hash: cee38cd30d16b343b13721ec813dc89eb1c1642d
commit-date: 2017-11-12
durska:piston-image alex$ cargo install-update -V
cargo-install-update 1.3.1
durska:piston-image alex$ cargo install-update -al
    Updating registry `https://github.com/rust-lang/crates.io-index`

Failed read master branch of registry repositry at /Users/alex/.cargo/registry/index/github.com-88ac128001ac3a9a.
durska:piston-image alex$ ls -al /Users/alex/.cargo/registry/index/github.com-88ac128001ac3a9a
total 0
drwxr-xr-x  3 alex  staff  102 Sep 20 00:15 .
drwxr-xr-x  4 alex  staff  136 Sep 20 00:15 ..
drwxr-xr-x  9 alex  staff  306 Oct 17 12:38 .git
durska:piston-image alex$ ls -al /Users/alex/.cargo/registry/index/github.com-88ac128001ac3a9a/.git
total 24
drwxr-xr-x  9 alex  staff  306 Oct 17 12:38 .
drwxr-xr-x  3 alex  staff  102 Sep 20 00:15 ..
-rw-r--r--  1 alex  staff   23 Sep 20 00:15 HEAD
-rw-r--r--  1 alex  staff  144 Sep 20 00:15 config
-rw-r--r--  1 alex  staff   73 Sep 20 00:15 description
drwxr-xr-x  3 alex  staff  102 Sep 20 00:15 hooks
drwxr-xr-x  3 alex  staff  102 Sep 20 00:15 info
drwxr-xr-x  4 alex  staff  136 Sep 20 00:15 objects
drwxr-xr-x  4 alex  staff  136 Sep 20 00:15 refs

@durka
Copy link
Contributor

durka commented Nov 17, 2017

The refs/heads directory is empty. This could be a problem.

@durka
Copy link
Contributor

durka commented Nov 17, 2017

The problem seems to be that it's reading the wrong index. github.com-88ac128001ac3a9a has a later modified date on the directory, but github.com-1ecc6299db9ec823 has newer files in it.

durka added a commit to durka/cargo-update that referenced this issue Nov 17, 2017
The previous code used the directory last-modified date to decide
which is the newest index checkout. However, this doesn't account
for the possibility of files within the directory that have been
touched more recently than the directory itself. I don't know how
this situation arises but my guess is it has to do with switching
cargo versions back and forth using rustup.

Ref: nabijaczleweli#32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants