new: add pkh put, a native dput replacement for PPA uploads
Upload built source packages over SFTP with host-key verification (Launchpad fingerprints pinned in host_keys.yml, ask-to-accept otherwise), Launchpad account discovery (git config lp.user), and pre-flight checks the upload queue itself never does: changes file discovery/validation, PPA existence via the Launchpad API, target series validity, and debian/control Section validity (sections bundled in distro_info.yml). Upload log prevents duplicate uploads unless --force.
This commit is contained in:
@@ -31,6 +31,24 @@ pub fn display_path(path: &Path) -> String {
|
||||
path.display().to_string()
|
||||
}
|
||||
|
||||
/// Style of an unsized operation: spinner and prefix on one line
|
||||
pub(crate) fn spinner_style() -> ProgressStyle {
|
||||
ProgressStyle::default_bar()
|
||||
.template("> {spinner:.blue} {prefix}")
|
||||
.unwrap()
|
||||
}
|
||||
|
||||
/// Style of a sized transfer: prefix on the first line, the bar on its own
|
||||
/// indented line below so long prefixes cannot push it out of the terminal
|
||||
pub(crate) fn transfer_style() -> ProgressStyle {
|
||||
ProgressStyle::default_bar()
|
||||
.template(
|
||||
"> {spinner:.blue} {prefix}\n {msg} [{bar:40.cyan/blue}] {pos}/{len} ({eta})",
|
||||
)
|
||||
.unwrap()
|
||||
.progress_chars("=> ")
|
||||
}
|
||||
|
||||
/// Create a spinner-style progress bar attached to `multi`, returning the bar
|
||||
/// and a callback compatible with [`crate::ProgressCallback`]
|
||||
pub fn create_progress_bar(
|
||||
@@ -38,26 +56,15 @@ pub fn create_progress_bar(
|
||||
) -> (ProgressBar, impl Fn(&str, &str, usize, usize) + '_) {
|
||||
let pb = multi.add(ProgressBar::new(0));
|
||||
pb.enable_steady_tick(Duration::from_millis(50));
|
||||
pb.set_style(
|
||||
ProgressStyle::default_bar()
|
||||
.template("> {spinner:.blue} {prefix}")
|
||||
.unwrap(),
|
||||
);
|
||||
pb.set_style(spinner_style());
|
||||
|
||||
let pb_clone = pb.clone();
|
||||
let callback = move |prefix: &str, msg: &str, progress: usize, total: usize| {
|
||||
let pb = &pb_clone;
|
||||
if progress != 0 && total != 0 {
|
||||
pb.set_style(ProgressStyle::default_bar()
|
||||
.template("> {spinner:.blue} {prefix}\n {msg} [{bar:40.cyan/blue}] {pos}/{len} ({eta})")
|
||||
.unwrap()
|
||||
.progress_chars("=> "));
|
||||
pb.set_style(transfer_style());
|
||||
} else {
|
||||
pb.set_style(
|
||||
ProgressStyle::default_bar()
|
||||
.template("> {spinner:.blue} {prefix}")
|
||||
.unwrap(),
|
||||
);
|
||||
pb.set_style(spinner_style());
|
||||
}
|
||||
|
||||
if !prefix.is_empty() {
|
||||
|
||||
Reference in New Issue
Block a user