* [pve-devel] [PATCH pve-manager/pmg-api/proxmox-backup/pwt 0/4] APT changelog switch-over
@ 2023-07-04 9:45 Fabian Grünbichler
2023-07-04 9:45 ` [pve-devel] [PATCH pmg-api 1/1] apt: use `apt changelog` for changelog fetching Fabian Grünbichler
` (4 more replies)
0 siblings, 5 replies; 8+ messages in thread
From: Fabian Grünbichler @ 2023-07-04 9:45 UTC (permalink / raw)
To: pve-devel
this series switches all apt changelog fetching to `apt changelog`,
dropping our own custom logic in turn.
(opted to send the whole series to pve-devel to avoid noise, obviously the
PMG/PBS patches are for PMG/PBS ;))
pmg-api:
Fabian Grünbichler (1):
apt: use `apt changelog` for changelog fetching
src/PMG/API2/APT.pm | 108 +++++++-------------------------------------
1 file changed, 16 insertions(+), 92 deletions(-)
proxmox-backup:
Fabian Grünbichler (1):
apt: use `apt changelog` for changelog fetching
pbs-api-types/src/lib.rs | 2 -
src/api2/node/apt.rs | 85 +++++-----------------------------------
src/tools/apt.rs | 77 ------------------------------------
3 files changed, 9 insertions(+), 155 deletions(-)
proxmox-widget-toolkit:
Fabian Grünbichler (1):
apt: drop ChangeLogUrl
src/node/APT.js | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
pve-manager:
Fabian Grünbichler (1):
apt: use `apt changelog` for changelog fetching
PVE/API2/APT.pm | 101 ++++++++----------------------------------------
1 file changed, 16 insertions(+), 85 deletions(-)
--
2.39.2
^ permalink raw reply [flat|nested] 8+ messages in thread
* [pve-devel] [PATCH pmg-api 1/1] apt: use `apt changelog` for changelog fetching
2023-07-04 9:45 [pve-devel] [PATCH pve-manager/pmg-api/proxmox-backup/pwt 0/4] APT changelog switch-over Fabian Grünbichler
@ 2023-07-04 9:45 ` Fabian Grünbichler
2023-07-04 9:45 ` [pve-devel] [PATCH proxmox-backup " Fabian Grünbichler
` (3 subsequent siblings)
4 siblings, 0 replies; 8+ messages in thread
From: Fabian Grünbichler @ 2023-07-04 9:45 UTC (permalink / raw)
To: pve-devel
support for it got added to Proxmox repositories, so there is no need to use
custom logic and manual fetching for this anymore.
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
---
Notes:
requires versioned depends on proxmox-widget-toolkit.
src/PMG/API2/APT.pm | 108 +++++++-------------------------------------
1 file changed, 16 insertions(+), 92 deletions(-)
diff --git a/src/PMG/API2/APT.pm b/src/PMG/API2/APT.pm
index 7fc7c29..1cd5f3d 100644
--- a/src/PMG/API2/APT.pm
+++ b/src/PMG/API2/APT.pm
@@ -85,32 +85,6 @@ my $get_pkgfile = sub {
return undef;
};
-my $get_changelog_url =sub {
- my ($pkgname, $info, $pkgver, $origin, $component) = @_;
-
- my $changelog_url;
- my $base = dirname($info->{FileName});
- if ($origin && $base) {
- $pkgver =~ s/^\d+://; # strip epoch
- my $srcpkg = $info->{SourcePkg} || $pkgname;
- if ($origin eq 'Debian') {
- $base =~ s!pool/updates/!pool/!; # for security channel
- $changelog_url = "http://packages.debian.org/changelogs/$base/" .
- "${srcpkg}_${pkgver}/changelog";
- } elsif ($origin eq 'Proxmox') {
- if ($component eq 'pmg-enterprise') {
- $changelog_url = "https://enterprise.proxmox.com/debian/pmg/$base/" .
- "${pkgname}_${pkgver}.changelog";
- } else {
- $changelog_url = "http://download.proxmox.com/debian/pmg/$base/" .
- "${pkgname}_${pkgver}.changelog";
- }
- }
- }
-
- return $changelog_url;
-};
-
my $assemble_pkginfo = sub {
my ($pkgname, $info, $current_ver, $candidate_ver) = @_;
@@ -122,10 +96,6 @@ my $assemble_pkginfo = sub {
if (my $pkgfile = &$get_pkgfile($candidate_ver)) {
$data->{Origin} = $pkgfile->{Origin};
- if (my $changelog_url = &$get_changelog_url($pkgname, $info, $candidate_ver->{VerStr},
- $pkgfile->{Origin}, $pkgfile->{Component})) {
- $data->{ChangeLogUrl} = $changelog_url;
- }
}
if (my $desc = $info->{LongDesc}) {
@@ -402,74 +372,28 @@ __PACKAGE__->register_method({
my $pkgname = $param->{name};
- my $cache = &$get_apt_cache();
- my $policy = $cache->policy;
- my $p = $cache->{$pkgname} || die "no such package '$pkgname'\n";
- my $pkgrecords = $cache->packages();
-
- my $ver;
- if ($param->{version}) {
- if (my $available = $p->{VersionList}) {
- for my $v (@$available) {
- if ($v->{VerStr} eq $param->{version}) {
- $ver = $v;
- last;
- }
- }
- }
- die "package '$pkgname' version '$param->{version}' is not available\n" if !$ver;
+ my $cmd = ['apt-get', 'changelog', '-qq'];
+ if (my $version = $param->{version}) {
+ push @$cmd, "$pkgname=$version";
} else {
- $ver = $policy->candidate($p) || die "no installation candidate for package '$pkgname'\n";
+ push @$cmd, "$pkgname";
}
- my $info = $pkgrecords->lookup($pkgname);
+ my $output = "";
- my $pkgfile = &$get_pkgfile($ver);
- my $url;
-
- die "changelog for '${pkgname}_$ver->{VerStr}' not available\n"
- if !($pkgfile && ($url = &$get_changelog_url($pkgname, $info, $ver->{VerStr}, $pkgfile->{Origin}, $pkgfile->{Component})));
-
- my $data = "";
-
- my $pmg_cfg = PMG::Config->new();
- my $proxy = $pmg_cfg->get('admin', 'http_proxy');
-
- my $ua = LWP::UserAgent->new;
- $ua->agent("PMG/1.0");
- $ua->timeout(10);
- $ua->max_size(1024*1024);
- $ua->ssl_opts(verify_hostname => 0); # don't care for changelogs
-
- if ($proxy) {
- $ua->proxy(['http', 'https'], $proxy);
- } else {
- $ua->env_proxy;
- }
-
- my $username;
- my $pw;
-
- if ($pkgfile->{Origin} eq 'Proxmox' && $pkgfile->{Component} eq 'pmg-enterprise') {
- my $info = PMG::API2::Subscription::read_etc_subscription();
- if ($info->{status} eq 'active') {
- $username = $info->{key};
- $pw = PMG::Utils::get_hwaddress();
- $ua->credentials("enterprise.proxmox.com:443", 'pmg-enterprise-repository',
- $username, $pw);
- }
- }
-
- syslog('info', "GET $url\n");
- my $response = $ua->get($url);
+ my $rc = PVE::Tools::run_command(
+ $cmd,
+ timeout => 10,
+ logfunc => sub {
+ my $line = shift;
+ $output .= "$line\n";
+ },
+ noerr => 1,
+ );
- if ($response->is_success) {
- $data = $response->decoded_content;
- } else {
- PVE::Exception::raise($response->message, code => $response->code);
- }
+ $output .= "RC: $rc" if $rc != 0;
- return $data;
+ return $output;
}});
__PACKAGE__->register_method({
--
2.39.2
^ permalink raw reply [flat|nested] 8+ messages in thread
* [pve-devel] [PATCH proxmox-backup 1/1] apt: use `apt changelog` for changelog fetching
2023-07-04 9:45 [pve-devel] [PATCH pve-manager/pmg-api/proxmox-backup/pwt 0/4] APT changelog switch-over Fabian Grünbichler
2023-07-04 9:45 ` [pve-devel] [PATCH pmg-api 1/1] apt: use `apt changelog` for changelog fetching Fabian Grünbichler
@ 2023-07-04 9:45 ` Fabian Grünbichler
2023-07-04 9:45 ` [pve-devel] [PATCH proxmox-widget-toolkit 1/1] apt: drop ChangeLogUrl Fabian Grünbichler
` (2 subsequent siblings)
4 siblings, 0 replies; 8+ messages in thread
From: Fabian Grünbichler @ 2023-07-04 9:45 UTC (permalink / raw)
To: pve-devel
support for it got added to Proxmox repositories, so there is no need to use
custom logic and manual fetching for this anymore.
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
---
Notes:
requires versioned depends on proxmox-widget-toolkit.
pbs-api-types/src/lib.rs | 2 -
src/api2/node/apt.rs | 85 +++++-----------------------------------
src/tools/apt.rs | 77 ------------------------------------
3 files changed, 9 insertions(+), 155 deletions(-)
diff --git a/pbs-api-types/src/lib.rs b/pbs-api-types/src/lib.rs
index 4764c51a..b663f2d7 100644
--- a/pbs-api-types/src/lib.rs
+++ b/pbs-api-types/src/lib.rs
@@ -395,8 +395,6 @@ pub struct APTUpdateInfo {
pub priority: String,
/// Package section
pub section: String,
- /// URL under which the package's changelog can be retrieved
- pub change_log_url: String,
/// Custom extra field for additional package information
#[serde(skip_serializing_if = "Option::is_none")]
pub extra_info: Option<String>,
diff --git a/src/api2/node/apt.rs b/src/api2/node/apt.rs
index f7328b81..491b8cc9 100644
--- a/src/api2/node/apt.rs
+++ b/src/api2/node/apt.rs
@@ -1,6 +1,5 @@
use anyhow::{bail, format_err, Error};
use serde_json::{json, Value};
-use std::collections::HashMap;
use std::os::unix::prelude::OsStrExt;
use proxmox_router::{
@@ -19,10 +18,9 @@ use pbs_api_types::{
APTUpdateInfo, NODE_SCHEMA, PRIV_SYS_AUDIT, PRIV_SYS_MODIFY, PROXMOX_CONFIG_DIGEST_SCHEMA,
UPID_SCHEMA,
};
-use pbs_buildcfg::PROXMOX_BACKUP_SUBSCRIPTION_FN;
use crate::config::node;
-use crate::tools::{apt, pbs_simple_http};
+use crate::tools::apt;
use proxmox_rest_server::WorkerTask;
#[api(
@@ -224,81 +222,17 @@ pub fn apt_update_database(
},
)]
/// Retrieve the changelog of the specified package.
-fn apt_get_changelog(param: Value) -> Result<Value, Error> {
- let name = pbs_tools::json::required_string_param(¶m, "name")?.to_owned();
- let version = param["version"].as_str();
-
- let pkg_info = apt::list_installed_apt_packages(
- |data| match version {
- Some(version) => version == data.active_version,
- None => data.active_version == data.candidate_version,
- },
- Some(&name),
- );
-
- if pkg_info.is_empty() {
- bail!("Package '{}' not found", name);
- }
-
- let proxy_config = read_and_update_proxy_config()?;
- let client = pbs_simple_http(proxy_config);
-
- let changelog_url = &pkg_info[0].change_log_url;
- // FIXME: use 'apt-get changelog' for proxmox packages as well, once repo supports it
- if changelog_url.starts_with("http://download.proxmox.com/") {
- let changelog = proxmox_async::runtime::block_on(client.get_string(changelog_url, None))
- .map_err(|err| {
- format_err!(
- "Error downloading changelog from '{}': {}",
- changelog_url,
- err
- )
- })?;
- Ok(json!(changelog))
- } else if changelog_url.starts_with("https://enterprise.proxmox.com/") {
- let sub = match proxmox_subscription::files::read_subscription(
- PROXMOX_BACKUP_SUBSCRIPTION_FN,
- &[proxmox_subscription::files::DEFAULT_SIGNING_KEY],
- )? {
- Some(sub) => sub,
- None => {
- bail!("cannot retrieve changelog from enterprise repo: no subscription info found")
- }
- };
- let (key, id) = match sub.key {
- Some(key) => match sub.serverid {
- Some(id) => (key, id),
- None => bail!("cannot retrieve changelog from enterprise repo: no server id found"),
- },
- None => {
- bail!("cannot retrieve changelog from enterprise repo: no subscription key found")
- }
- };
-
- let mut auth_header = HashMap::new();
- auth_header.insert(
- "Authorization".to_owned(),
- format!("Basic {}", base64::encode(format!("{}:{}", key, id))),
- );
-
- let changelog =
- proxmox_async::runtime::block_on(client.get_string(changelog_url, Some(&auth_header)))
- .map_err(|err| {
- format_err!(
- "Error downloading changelog from '{}': {}",
- changelog_url,
- err
- )
- })?;
- Ok(json!(changelog))
+fn apt_get_changelog(name: String, version: Option<String>) -> Result<Value, Error> {
+ let mut command = std::process::Command::new("apt-get");
+ command.arg("changelog");
+ command.arg("-qq"); // don't display download progress
+ if let Some(ver) = version {
+ command.arg(format!("{name}={ver}"));
} else {
- let mut command = std::process::Command::new("apt-get");
- command.arg("changelog");
- command.arg("-qq"); // don't display download progress
command.arg(name);
- let output = proxmox_sys::command::run_command(command, None)?;
- Ok(json!(output))
}
+ let output = proxmox_sys::command::run_command(command, None)?;
+ Ok(json!(output))
}
#[api(
@@ -349,7 +283,6 @@ pub fn get_versions() -> Result<Vec<APTUpdateInfo>, Error> {
origin: "unknown".into(),
priority: "unknown".into(),
section: "unknown".into(),
- change_log_url: "unknown".into(),
extra_info,
}
}
diff --git a/src/tools/apt.rs b/src/tools/apt.rs
index 5a8cd136..900843aa 100644
--- a/src/tools/apt.rs
+++ b/src/tools/apt.rs
@@ -90,70 +90,6 @@ const_regex! {
FILENAME_EXTRACT_REGEX = r"^.*/.*?_(.*)_Packages$";
}
-// FIXME: once the 'changelog' API call switches over to 'apt-get changelog' only,
-// consider removing this function entirely, as it's value is never used anywhere
-// then (widget-toolkit doesn't use the value either)
-fn get_changelog_url(
- package: &str,
- filename: &str,
- version: &str,
- origin: &str,
- component: &str,
-) -> Result<String, Error> {
- if origin.is_empty() {
- bail!("no origin available for package {}", package);
- }
-
- if origin == "Debian" {
- let mut command = std::process::Command::new("apt-get");
- command.arg("changelog");
- command.arg("--print-uris");
- command.arg(package);
- let output = proxmox_sys::command::run_command(command, None)?; // format: 'http://foo/bar' package.changelog
- let output = match output.split_once(' ') {
- Some((uri, _file_name)) if uri.len() > 2 => uri[1..uri.len() - 1].to_owned(),
- Some((uri, _file_name)) => bail!(
- "invalid output (URI part too short) from 'apt-get changelog --print-uris': {}",
- uri
- ),
- None => bail!(
- "invalid output from 'apt-get changelog --print-uris': {}",
- output
- ),
- };
- return Ok(output);
- } else if origin == "Proxmox" {
- // FIXME: Use above call to 'apt changelog <pkg> --print-uris' as well.
- // Currently not possible as our packages do not have a URI set in their Release file.
- let version = (VERSION_EPOCH_REGEX.regex_obj)().replace_all(version, "");
-
- let base = match (FILENAME_EXTRACT_REGEX.regex_obj)().captures(filename) {
- Some(captures) => {
- let base_capture = captures.get(1);
- match base_capture {
- Some(base_underscore) => base_underscore.as_str().replace('_', "/"),
- None => bail!("incompatible filename, cannot find regex group"),
- }
- }
- None => bail!("incompatible filename, doesn't match regex"),
- };
-
- if component == "pbs-enterprise" {
- return Ok(format!(
- "https://enterprise.proxmox.com/{}/{}_{}.changelog",
- base, package, version
- ));
- } else {
- return Ok(format!(
- "http://download.proxmox.com/{}/{}_{}.changelog",
- base, package, version
- ));
- }
- }
-
- bail!("unknown origin ({}) or component ({})", origin, component)
-}
-
pub struct FilterData<'a> {
/// package name
pub package: &'a str,
@@ -273,7 +209,6 @@ where
let mut origin_res = "unknown".to_owned();
let mut section_res = "unknown".to_owned();
let mut priority_res = "unknown".to_owned();
- let mut change_log_url = "".to_owned();
let mut short_desc = package.clone();
let mut long_desc = "".to_owned();
@@ -317,17 +252,6 @@ where
if let Some(origin_name) = pkg_file.origin() {
origin_res = origin_name;
}
-
- let filename = pkg_file.file_name();
- let component = pkg_file.component();
-
- // build changelog URL from gathered information
- // ignore errors, use empty changelog instead
- let url =
- get_changelog_url(&package, &filename, &version, &origin_res, &component);
- if let Ok(url) = url {
- change_log_url = url;
- }
}
}
@@ -352,7 +276,6 @@ where
title: short_desc,
arch: view.arch(),
description: long_desc,
- change_log_url,
origin: origin_res,
version: candidate_version.clone(),
old_version: match current_version {
--
2.39.2
^ permalink raw reply [flat|nested] 8+ messages in thread
* [pve-devel] [PATCH proxmox-widget-toolkit 1/1] apt: drop ChangeLogUrl
2023-07-04 9:45 [pve-devel] [PATCH pve-manager/pmg-api/proxmox-backup/pwt 0/4] APT changelog switch-over Fabian Grünbichler
2023-07-04 9:45 ` [pve-devel] [PATCH pmg-api 1/1] apt: use `apt changelog` for changelog fetching Fabian Grünbichler
2023-07-04 9:45 ` [pve-devel] [PATCH proxmox-backup " Fabian Grünbichler
@ 2023-07-04 9:45 ` Fabian Grünbichler
2023-11-13 17:18 ` [pve-devel] applied: " Thomas Lamprecht
2023-07-04 9:45 ` [pve-devel] [PATCH manager 1/1] apt: use `apt changelog` for changelog fetching Fabian Grünbichler
2023-11-14 8:30 ` [pve-devel] applied-series: [PATCH pve-manager/pmg-api/proxmox-backup/pwt 0/4] APT changelog switch-over Thomas Lamprecht
4 siblings, 1 reply; 8+ messages in thread
From: Fabian Grünbichler @ 2023-07-04 9:45 UTC (permalink / raw)
To: pve-devel
it's not returned anymore by the corresponding backends, since fetching
changelogs is now fully delegated to `apt`.
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
---
Notes:
could benefit from a Breaks on old versions of pve-manager/pmg-api ,
but not strictly required, it will simply allow attempting to fetch
changelogs for packages where the backend already said there is none
src/node/APT.js | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/node/APT.js b/src/node/APT.js
index 739aaf3..231e866 100644
--- a/src/node/APT.js
+++ b/src/node/APT.js
@@ -2,7 +2,7 @@ Ext.define('apt-pkglist', {
extend: 'Ext.data.Model',
fields: [
'Package', 'Title', 'Description', 'Section', 'Arch', 'Priority', 'Version', 'OldVersion',
- 'ChangeLogUrl', 'Origin',
+ 'Origin',
],
idProperty: 'Package',
});
@@ -108,8 +108,8 @@ Ext.define('Proxmox.node.APT', {
});
let show_changelog = function(rec) {
- if (!rec?.data?.ChangeLogUrl || !rec?.data?.Package) {
- console.debug('cannot show changelog, missing Package and/or ChangeLogUrl', rec);
+ if (!rec?.data?.Package) {
+ console.debug('cannot show changelog, missing Package', rec);
return;
}
@@ -154,7 +154,7 @@ Ext.define('Proxmox.node.APT', {
text: gettext('Changelog'),
selModel: sm,
disabled: true,
- enableFn: rec => !!rec?.data?.ChangeLogUrl && !!rec?.data?.Package,
+ enableFn: rec => !!rec?.data?.Package,
handler: (b, e, rec) => show_changelog(rec),
});
--
2.39.2
^ permalink raw reply [flat|nested] 8+ messages in thread
* [pve-devel] [PATCH manager 1/1] apt: use `apt changelog` for changelog fetching
2023-07-04 9:45 [pve-devel] [PATCH pve-manager/pmg-api/proxmox-backup/pwt 0/4] APT changelog switch-over Fabian Grünbichler
` (2 preceding siblings ...)
2023-07-04 9:45 ` [pve-devel] [PATCH proxmox-widget-toolkit 1/1] apt: drop ChangeLogUrl Fabian Grünbichler
@ 2023-07-04 9:45 ` Fabian Grünbichler
2023-11-14 8:30 ` [pve-devel] applied-series: [PATCH pve-manager/pmg-api/proxmox-backup/pwt 0/4] APT changelog switch-over Thomas Lamprecht
4 siblings, 0 replies; 8+ messages in thread
From: Fabian Grünbichler @ 2023-07-04 9:45 UTC (permalink / raw)
To: pve-devel
support for it got added to Proxmox repositories, so there is no need to use
custom logic and manual fetching for this anymore.
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
---
Notes:
requires versioned depends on proxmox-widget-toolkit.
PVE/API2/APT.pm | 101 ++++++++----------------------------------------
1 file changed, 16 insertions(+), 85 deletions(-)
diff --git a/PVE/API2/APT.pm b/PVE/API2/APT.pm
index 6694dbeb6..dc506e6fe 100644
--- a/PVE/API2/APT.pm
+++ b/PVE/API2/APT.pm
@@ -88,38 +88,6 @@ my $get_pkgfile = sub {
return undef;
};
-my $get_changelog_url =sub {
- my ($pkgname, $info, $pkgver, $pkgfile) = @_;
-
- my $base;
- $base = dirname($info->{FileName}) if defined($info->{FileName});
-
- my $origin = $pkgfile->{Origin};
-
- if ($origin && $base) {
- $pkgver =~ s/^\d+://; # strip epoch
- my $srcpkg = $info->{SourcePkg} || $pkgname;
- if ($origin eq 'Debian' || $origin eq 'Debian Backports') {
- $base =~ s!pool/updates/!pool/!; # for security channel
- return "http://packages.debian.org/changelogs/$base/${srcpkg}_${pkgver}/changelog";
- } elsif ($origin eq 'Proxmox') {
- # the product is just for getting the standard repos and is currently a required param,
- # but we actually only care about `files`, which includes _all_ configured repos
- my $data = Proxmox::RS::APT::Repositories::repositories("pve");
-
- for my $file ($data->{files}->@*) {
- for my $repo (grep { $_->{Enabled} } $file->{repositories}->@*) {
- next if !grep(/$pkgfile->{Component}/, $repo->{Components}->@*);
- next if !$repo->{URIs}[0] =~ m/$pkgfile->{Site}/;
-
- return $repo->{URIs}[0] . "/$base/${pkgname}_${pkgver}.changelog";
- }
- }
- }
- }
- return; # none found, with our heuristic that is..
-};
-
my $assemble_pkginfo = sub {
my ($pkgname, $info, $current_ver, $candidate_ver) = @_;
@@ -131,9 +99,6 @@ my $assemble_pkginfo = sub {
if (my $pkgfile = &$get_pkgfile($candidate_ver)) {
$data->{Origin} = $pkgfile->{Origin};
- my $changelog_url = $get_changelog_url->($pkgname, $info, $candidate_ver->{VerStr}, $pkgfile);
-
- $data->{ChangeLogUrl} = $changelog_url if $changelog_url;
}
if (my $desc = $info->{LongDesc}) {
@@ -410,62 +375,28 @@ __PACKAGE__->register_method({
my $pkgname = $param->{name};
- my $cache = &$get_apt_cache();
- my $policy = $cache->policy;
- my $p = $cache->{$pkgname} || die "no such package '$pkgname'\n";
- my $pkgrecords = $cache->packages();
-
- my $ver;
- if ($param->{version}) {
- if (my $available = $p->{VersionList}) {
- for my $v (@$available) {
- if ($v->{VerStr} eq $param->{version}) {
- $ver = $v;
- last;
- }
- }
- }
- die "package '$pkgname' version '$param->{version}' is not available\n" if !$ver;
+ my $cmd = ['apt-get', 'changelog', '-qq'];
+ if (my $version = $param->{version}) {
+ push @$cmd, "$pkgname=$version";
} else {
- $ver = $policy->candidate($p) || die "no installation candidate for package '$pkgname'\n";
+ push @$cmd, "$pkgname";
}
- my $info = $pkgrecords->lookup($pkgname);
-
- my $pkgfile = $get_pkgfile->($ver) or die "couldn't find package info file for ${pkgname}=$ver->{VerStr}\n";
-
- my $url = $get_changelog_url->($pkgname, $info, $ver->{VerStr}, $pkgfile)
- or die "changelog for '${pkgname}_$ver->{VerStr}' not available\n";
-
- my $ua = LWP::UserAgent->new();
- $ua->agent("PVE/1.0");
- $ua->timeout(10);
- $ua->max_size(1024 * 1024);
- $ua->ssl_opts(verify_hostname => 0); # don't care for changelogs
-
- my $datacenter_cfg = PVE::Cluster::cfs_read_file('datacenter.cfg');
- if (my $proxy = $datacenter_cfg->{http_proxy}) {
- $ua->proxy(['http', 'https'], $proxy);
- } else {
- $ua->env_proxy;
- }
+ my $output = "";
- if ($pkgfile->{Origin} eq 'Proxmox' && $pkgfile->{Component} eq 'pve-enterprise') {
- my $info = PVE::API2::Subscription::read_etc_subscription();
- if ($info->{status} eq 'active') {
- my $pw = PVE::API2Tools::get_hwaddress();
- $ua->credentials("enterprise.proxmox.com:443", 'pve-enterprise-repository', $info->{key}, $pw);
- }
- }
+ my $rc = PVE::Tools::run_command(
+ $cmd,
+ timeout => 10,
+ logfunc => sub {
+ my $line = shift;
+ $output .= "$line\n";
+ },
+ noerr => 1,
+ );
- my $response = $ua->get($url);
+ $output .= "RC: $rc" if $rc != 0;
- if ($response->is_success) {
- return $response->decoded_content;
- } else {
- PVE::Exception::raise($response->message, code => $response->code);
- }
- return '';
+ return $output;
}});
__PACKAGE__->register_method({
--
2.39.2
^ permalink raw reply [flat|nested] 8+ messages in thread
* [pve-devel] applied: [PATCH proxmox-widget-toolkit 1/1] apt: drop ChangeLogUrl
2023-07-04 9:45 ` [pve-devel] [PATCH proxmox-widget-toolkit 1/1] apt: drop ChangeLogUrl Fabian Grünbichler
@ 2023-11-13 17:18 ` Thomas Lamprecht
2023-11-14 7:04 ` Fabian Grünbichler
0 siblings, 1 reply; 8+ messages in thread
From: Thomas Lamprecht @ 2023-11-13 17:18 UTC (permalink / raw)
To: Proxmox VE development discussion, Fabian Grünbichler
Am 04/07/2023 um 11:45 schrieb Fabian Grünbichler:
> it's not returned anymore by the corresponding backends, since fetching
> changelogs is now fully delegated to `apt`.
>
> Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
> ---
>
> Notes:
> could benefit from a Breaks on old versions of pve-manager/pmg-api ,
> but not strictly required, it will simply allow attempting to fetch
> changelogs for packages where the backend already said there is none
>
> src/node/APT.js | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
>
applied, thanks!
Not directly related, but I get 404 not found for all Debian origin updates that
are currently pending on a Proxmox VE 8 VM of mine (e.g., for ffmpeg)
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [pve-devel] applied: [PATCH proxmox-widget-toolkit 1/1] apt: drop ChangeLogUrl
2023-11-13 17:18 ` [pve-devel] applied: " Thomas Lamprecht
@ 2023-11-14 7:04 ` Fabian Grünbichler
0 siblings, 0 replies; 8+ messages in thread
From: Fabian Grünbichler @ 2023-11-14 7:04 UTC (permalink / raw)
To: Proxmox VE development discussion, Thomas Lamprecht
On November 13, 2023 6:18 pm, Thomas Lamprecht wrote:
> Am 04/07/2023 um 11:45 schrieb Fabian Grünbichler:
>> it's not returned anymore by the corresponding backends, since fetching
>> changelogs is now fully delegated to `apt`.
>>
>> Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
>> ---
>>
>> Notes:
>> could benefit from a Breaks on old versions of pve-manager/pmg-api ,
>> but not strictly required, it will simply allow attempting to fetch
>> changelogs for packages where the backend already said there is none
>>
>> src/node/APT.js | 8 ++++----
>> 1 file changed, 4 insertions(+), 4 deletions(-)
>>
>>
>
> applied, thanks!
>
> Not directly related, but I get 404 not found for all Debian origin updates that
> are currently pending on a Proxmox VE 8 VM of mine (e.g., for ffmpeg)
yes, this is an (old) known issue also reported on the Debian side since
ages - the security repo doesn't get the changelogs published like the
other ones, only when packages are folded into the next point release
are they available via apt. sometimes it manages to pick it up locally
(from /usr/share/doc/$package/changelog.Debian.XX) *after* the upgrade,
but I haven't yet figured out what makes it do that only sometimes.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [pve-devel] applied-series: [PATCH pve-manager/pmg-api/proxmox-backup/pwt 0/4] APT changelog switch-over
2023-07-04 9:45 [pve-devel] [PATCH pve-manager/pmg-api/proxmox-backup/pwt 0/4] APT changelog switch-over Fabian Grünbichler
` (3 preceding siblings ...)
2023-07-04 9:45 ` [pve-devel] [PATCH manager 1/1] apt: use `apt changelog` for changelog fetching Fabian Grünbichler
@ 2023-11-14 8:30 ` Thomas Lamprecht
4 siblings, 0 replies; 8+ messages in thread
From: Thomas Lamprecht @ 2023-11-14 8:30 UTC (permalink / raw)
To: Proxmox VE development discussion, Fabian Grünbichler
Am 04/07/2023 um 11:45 schrieb Fabian Grünbichler:
> this series switches all apt changelog fetching to `apt changelog`,
> dropping our own custom logic in turn.
>
> (opted to send the whole series to pve-devel to avoid noise, obviously the
> PMG/PBS patches are for PMG/PBS ;))
now pushed the API patches for PVE, PBS and PMG too.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2023-11-14 8:30 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-04 9:45 [pve-devel] [PATCH pve-manager/pmg-api/proxmox-backup/pwt 0/4] APT changelog switch-over Fabian Grünbichler
2023-07-04 9:45 ` [pve-devel] [PATCH pmg-api 1/1] apt: use `apt changelog` for changelog fetching Fabian Grünbichler
2023-07-04 9:45 ` [pve-devel] [PATCH proxmox-backup " Fabian Grünbichler
2023-07-04 9:45 ` [pve-devel] [PATCH proxmox-widget-toolkit 1/1] apt: drop ChangeLogUrl Fabian Grünbichler
2023-11-13 17:18 ` [pve-devel] applied: " Thomas Lamprecht
2023-11-14 7:04 ` Fabian Grünbichler
2023-07-04 9:45 ` [pve-devel] [PATCH manager 1/1] apt: use `apt changelog` for changelog fetching Fabian Grünbichler
2023-11-14 8:30 ` [pve-devel] applied-series: [PATCH pve-manager/pmg-api/proxmox-backup/pwt 0/4] APT changelog switch-over Thomas Lamprecht
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox