[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#931522: marked as done (apt: does not provide a means to check whether updates are available from a script)



Your message dated Tue, 9 Jul 2019 11:09:57 +0200
with message-id <20190709110532.GA4303@debian.org>
and subject line Re: Bug#931522: apt: does not provide a means to check whether updates are available from a script
has caused the Debian Bug report #931522,
regarding apt: does not provide a means to check whether updates are available from a script
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@bugs.debian.org
immediately.)


-- 
931522: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=931522
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems
--- Begin Message ---
Package: apt
Version: 1.8.2
Severity: wishlist

Dear Maintainer,

*** Reporter, please consider answering these questions, where appropriate ***

I wanted to check whether or not updates are available from my script written
in bash.

I found that aptitude can tell the number of packages which are available
for upgrade using

 aptitude search '~U' | wc -l

But for apt there is no reliable way to do the same, it outputs a warning that
its output is not meant to be parsed by scripts.

Please provide a commandline utility that tells '0' if no updates are available, and
'1' if some updates are available.

I would not mind having the same functionality available in C, but I found no
mention of it on the https://wiki.debian.org/Apt page.

*** End of the template - remove these template lines ***


-- Package-specific info:

-- (no /etc/apt/preferences present) --


-- (no /etc/apt/preferences.d/* present) --


-- (/etc/apt/sources.list present, but not submitted) --


-- (/etc/apt/sources.list.d/elastic-6.x.list present, but not submitted) --


-- (/etc/apt/sources.list.d/elastic-6.x.list~ present, but not submitted) --


-- (/etc/apt/sources.list.d/google-chrome.list present, but not submitted) --


-- (/etc/apt/sources.list.d/jitsi-stable.list present, but not submitted) --


-- (/etc/apt/sources.list.d/matrix-org.list present, but not submitted) --


-- (/etc/apt/sources.list.d/matrix-org.list~ present, but not submitted) --


-- (/etc/apt/sources.list.d/parsoid.list present, but not submitted) --


-- (/etc/apt/sources.list.d/parsoid.list~ present, but not submitted) --


-- (/etc/apt/sources.list.d/ring-nightly-main.list present, but not submitted) --


-- (/etc/apt/sources.list.d/ring-nightly-main.list~ present, but not submitted) --


-- (/etc/apt/sources.list.d/skype-stable.list present, but not submitted) --


-- (/etc/apt/sources.list.d/webmin.list present, but not submitted) --


-- (/etc/apt/sources.list.d/x2go.list present, but not submitted) --


-- (/etc/apt/sources.list.d/yarn.list present, but not submitted) --


-- (/etc/apt/sources.list.d/yarn.list~ present, but not submitted) --


-- System Information:
Debian Release: 10.0
  APT prefers testing
  APT policy: (500, 'testing'), (500, 'stable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.19.0-1-amd64 (SMP w/2 CPU cores)
Kernel taint flags: TAINT_WARN
Locale: LANG=ru_RU.UTF-8, LC_CTYPE=ru_RU.UTF-8 (charmap=UTF-8), LANGUAGE=ru_RU:ru (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages apt depends on:
ii  adduser                 3.118
ii  debian-archive-keyring  2019.1
ii  gpgv                    2.2.12-1
ii  libapt-pkg5.0           1.8.2
ii  libc6                   2.28-10
ii  libgcc1                 1:8.3.0-6
ii  libgnutls30             3.6.7-4
ii  libseccomp2             2.3.3-4
ii  libstdc++6              8.3.0-6

Versions of packages apt recommends:
ii  ca-certificates  20190110

Versions of packages apt suggests:
pn  apt-doc         <none>
ii  aptitude        0.8.11-7
ii  dpkg-dev        1.19.7
ii  gnupg           2.2.12-1
ii  gnupg2          2.2.12-1
ii  powermgmt-base  1.34
ii  synaptic        0.84.6

-- no debconf information

--- End Message ---
--- Begin Message ---
On Sun, Jul 07, 2019 at 02:33:18PM +1000, Svetlana Tkachenko wrote:
> Package: apt
> Version: 1.8.2
> Severity: wishlist
> 
> Dear Maintainer,
> 
> *** Reporter, please consider answering these questions, where appropriate ***
> 
> I wanted to check whether or not updates are available from my script written
> in bash.

It also depends on what you consider an available update, and if that is something
you actually care about, compared to upgrades that would be installed when running
(dist-,full-)upgrade.

> 
> I found that aptitude can tell the number of packages which are available
> for upgrade using
> 
>  aptitude search '~U' | wc -l
> 
> But for apt there is no reliable way to do the same, it outputs a warning that
> its output is not meant to be parsed by scripts.

You'll hopefully be able to do the same eventually. 

> 
> Please provide a commandline utility that tells '0' if no updates are available, and
> '1' if some updates are available.

Not going to add one-off tools for that.

> 
> I would not mind having the same functionality available in C, but I found no
> mention of it on the https://wiki.debian.org/Apt page.

You can use C++ or the Python or Perl bindings to iterate over the cache and
check if the candidate version is higher than the installed version; but this
is outside the scope of a bug report. In Python, this is essentially

	import apt
	print(len(p.is_upgradable for p in apt.Cache())

low-level bindings need more work.

-- 
debian developer - deb.li/jak | jak-linux.org - free software dev
ubuntu core developer                              i speak de, en

--- End Message ---

Reply to: