Skip to content
This repository has been archived by the owner on Apr 18, 2019. It is now read-only.

Commit

Permalink
First pass refresh of hab CLI UI with musl/libc fix.
Browse files Browse the repository at this point in the history
hab CLI
-------

This change is part spike and experiment and part functional. It is a
first attempt at unifying the `hab` CLI output and formatting to be more
consisten and easier to scan as a newcomer (in the short term) and
experienced user (in the long term).

Most of the commands have the following narrative, much like an essay:

* An intro/goal/summary of the objective
* A middle with the concrete steps to achieve the objective
* A final summary/conclusion to confirm success

Here is an example of a package install invocation:

```
> hab install core/redis
» Installing core/redis
↓ Downloading core/glibc/2.22/20160427193532
    16.21 MB / 16.21 MB \ [========================================] 100.00 % 2.98 MB/s
✓ Installed core/glibc/2.22/20160427193532
↓ Downloading core/linux-headers/4.3/20160427193435
    798.63 KB / 798.63 KB | [======================================] 100.00 % 1.56 MB/s
✓ Installed core/linux-headers/4.3/20160427193435
↓ Downloading core/redis/3.0.7/20160427222845
    1.46 MB / 1.46 MB | [==========================================] 100.00 % 3.28 MB/s
✓ Installed core/redis/3.0.7/20160427222845
★ Install of core/redis complete with 3 packages installed.
```

musl/libc/ioctl
---------------

In the course of building in a progress bar, an issue was found with in the
`libc` crate relating to the types of ioctl contants when used by musl (more
detail in: rust-lang/libc#289). Unfortunately, this
meant vendoring libc so that it would be used as a transitive dependency in the
crates that generated the errors (currently this is the `pbr` crate, which is
completely correct in tits implementation). Without this temporary measure, the
`hab` CLI won't build as-is with the musl target. The other option is to
feature-disable the progress bar until the upstream is resolved, but it really
hampers the far superior user experience that a progress bar like this
provides.

Signed-off-by: Fletcher Nichol <fnichol@nichol.ca>

Pull request: #522
Approved by: fnichol
  • Loading branch information
fnichol authored and thesentinels committed May 17, 2016
1 parent 671119c commit 7fb39ce
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/crypto/artifact.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ pub fn get_archive_reader<P: AsRef<Path>>(src: &P) -> Result<BufReader<File>> {
}

/// verify the crypto signature of a .hart file
pub fn verify<P1: ?Sized, P2: ?Sized>(src: &P1, cache_key_path: &P2) -> Result<()>
pub fn verify<P1: ?Sized, P2: ?Sized>(src: &P1, cache_key_path: &P2) -> Result<(String, String)>
where P1: AsRef<Path>,
P2: AsRef<Path>
{
Expand Down Expand Up @@ -158,7 +158,7 @@ pub fn verify<P1: ?Sized, P2: ?Sized>(src: &P1, cache_key_path: &P2) -> Result<(
debug!("Expected hash {}", expected_hash);
debug!("My hash {}", computed_hash);
if computed_hash == expected_hash {
Ok(())
Ok((pair.name_with_rev(), expected_hash))
} else {
let msg = format!("Habitat artifact is invalid, \
hashes don't match (expected: {}, computed: {})",
Expand Down
2 changes: 1 addition & 1 deletion src/package/archive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ impl PackageArchive {
/// # Failures
///
/// * Fails if it cannot verify the signature for any reason
pub fn verify<P: AsRef<Path>>(&self, cache_key_path: &P) -> Result<()> {
pub fn verify<P: AsRef<Path>>(&self, cache_key_path: &P) -> Result<(String, String)> {
artifact::verify(&self.path, cache_key_path)
}

Expand Down

0 comments on commit 7fb39ce

Please sign in to comment.