distro_info: add UNRELEASED series handling, use it in deb and chlog
This commit is contained in:
+30
-5
@@ -198,14 +198,39 @@ fn main() {
|
||||
let changelog_path = cwd.join("debian/changelog");
|
||||
match pkh::changelog::parse_changelog_header(&changelog_path) {
|
||||
Ok((_pkg, _ver, current_series)) => {
|
||||
// Try to get the list of available series for this distribution
|
||||
// UNRELEASED is not a real series: offer it as a
|
||||
// pinned first entry (selecting it keeps the changelog
|
||||
// unreleased) on top of the current vendor's series
|
||||
// list, defaulting to the development series. Any
|
||||
// other series resolves through the series list of
|
||||
// its own distribution.
|
||||
match rt.block_on(async {
|
||||
let dist =
|
||||
pkh::distro_info::get_dist_from_series(¤t_series).await?;
|
||||
pkh::distro_info::get_ordered_series_name(&dist).await
|
||||
if pkh::distro_info::is_unreleased(¤t_series) {
|
||||
let dist = pkh::build::env::current_vendor();
|
||||
let mut series_list =
|
||||
vec![pkh::distro_info::UNRELEASED.to_string()];
|
||||
series_list.extend(
|
||||
pkh::distro_info::get_ordered_series_name(&dist).await?,
|
||||
);
|
||||
Ok(series_list)
|
||||
} else {
|
||||
let dist =
|
||||
pkh::distro_info::get_dist_from_series(¤t_series).await?;
|
||||
pkh::distro_info::get_ordered_series_name(&dist).await
|
||||
}
|
||||
}) {
|
||||
Ok(series_list) => {
|
||||
match pkh::ui::select_series(&series_list, ¤t_series) {
|
||||
// Default to the development series (the
|
||||
// first real entry) when the changelog is
|
||||
// UNRELEASED, not to the pinned entry itself
|
||||
let default = if pkh::distro_info::is_unreleased(¤t_series)
|
||||
&& series_list.len() > 1
|
||||
{
|
||||
series_list[1].clone()
|
||||
} else {
|
||||
current_series.clone()
|
||||
};
|
||||
match pkh::ui::select_series(&series_list, &default) {
|
||||
Ok(selected) => Some(selected),
|
||||
Err(e) => {
|
||||
error!(
|
||||
|
||||
Reference in New Issue
Block a user