Skip to content

Commit

Permalink
Merge pull request #16 from collabora/wip/refi64/publish-tweaks
Browse files Browse the repository at this point in the history
apt2aptly: Add --publish-origin/-label, some dry run & logging fixes
  • Loading branch information
sjoerdsimons committed Sep 4, 2023
2 parents e1f6462 + d25d611 commit f61f788
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions apt2aptly/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ struct Opts {
/// Publish the repo and snapshots to the given prefix.
#[clap(long = "publish-to")]
publish_prefix: Option<String>,
/// Set the published release's 'Origin' to the given value.
#[clap(long, requires_if(ArgPredicate::IsPresent, "publish_prefix"))]
publish_origin: Option<String>,
/// Set the published release's 'Label' to the given value.
#[clap(long, requires_if(ArgPredicate::IsPresent, "publish_prefix"))]
publish_label: Option<String>,
/// Use the given GPG key when publishing.
#[clap(long, requires_if(ArgPredicate::IsPresent, "publish_prefix"))]
publish_gpg_key: Option<String>,
Expand Down Expand Up @@ -347,15 +353,15 @@ async fn sync_dist(
publish_prefix, dist_path
);
} else {
info!(
"Deleting previous published distribution {}/{}...",
publish_prefix, dist_path
);
aptly
.publish_prefix(publish_prefix)
.distribution(&dist_path)
.delete(&publish::DeleteOptions { force: true })
.await?;
info!(
"Deleted previous published distribution {}/{}",
publish_prefix, dist_path
);
}

aptly_published_cache.remove(&publish_key);
Expand Down Expand Up @@ -431,14 +437,16 @@ async fn sync_dist(
signing: Some(signing),
skip_bz2: true,
skip_contents: true,
origin: opts.publish_origin.clone(),
label: opts.publish_label.clone(),
..Default::default()
},
)
.await?;
}

aptly_published_cache.insert(publish_key);
}

aptly_published_cache.insert(publish_key);
}

Ok(())
Expand Down

0 comments on commit f61f788

Please sign in to comment.