2

How to get OS versions, builds(architectures) versions of packages?

As I know, there are similar Python packages such as launchpadlib. However, I cannot get OS versions, package builds with this library. I have searched but haven't found any package(s) that can give me all this information.

Implementation with html parser:

get os series

[('warty', '4.10'), ('hoary', '5.04'), ('breezy', '5.10'), ('dapper', '6.06'), ('edgy', '6.10'), ('feisty', '7.04'), ('gutsy', '7.10'), ('hardy', '8.04'), ('intrepid', '8.10'), ('jaunty', '9.04'), ('karmic', '9.10'), ('lucid', '10.04'), ('maverick', '10.10'), ('natty', '11.04'), ('oneiric', '11.10'), ('precise', '12.04'), ('quantal', '12.10'), ('raring', '13.04'), ('saucy', '13.10'), ('trusty', '14.04'), ('utopic', '14.10'), ('vivid', '15.04'), ('wily', '15.10'), ('xenial', '16.04'), ('yakkety', '16.10'), ('zesty', '17.04'), ('artful', '17.10'), ('bionic', '18.04')]

get package builds

libc6-dev
['amd64', 'i386', 'powerpc']

get package versions

libc6-dev
['2.3.2.ds1-13ubuntu2', '2.3.2.ds1-13ubuntu2.2', '2.3.2.ds1-13ubuntu2.2', '2.3.2.ds1-13ubuntu2.3']
Alexis Wilke
  • 19,179
  • 10
  • 84
  • 156
Lee Sihun
  • 21
  • 2
  • Possible duplicate of [How can I find the current OS in Python?](https://stackoverflow.com/questions/110362/how-can-i-find-the-current-os-in-python) – ddor254 Apr 01 '18 at 08:43
  • 1
    no, I want to retrieve os series, ubuntu packages. thank you for your answer – Lee Sihun Apr 01 '18 at 09:37

1 Answers1

0

on Ubuntu:

get your os version with :

 >>> import platform
 >>> platform.platform()

get your build package and versions with :

 >>> import subprocess
 >>> output = subprocess.check_output("apt-cache policy libc6-dev",shell=True)

 >>> manipulate output as string.

the shell output for the apt-cache policy is:

libc6-dev: Installed: 2.23-0ubuntu10 Candidate: 2.23-0ubuntu10
Version table: *** 2.23-0ubuntu10 500 500 http://il.archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages 500 http://security.ubuntu.com/ubuntu xenial-security/main amd64 Packages 100 /var/lib/dpkg/status 2.23-0ubuntu3 500 500 http://il.archive.ubuntu.com/ubuntu xenial/main amd64 Packages

ddor254
  • 1,570
  • 1
  • 12
  • 28
  • 1
    thank u. but this is not thing I want. My purpose is all of packages of various architecture, verions. – Lee Sihun Apr 01 '18 at 16:54
  • 1
    thank u. but this is not thing I want. My purpose is all of packages of various architecture, versions. For Example. os versions retrieve input : Ubuntu output : [('warty', '4.10'),~~~('bionic', '18.04')] package architectures input : ubuntu, warty, libc6 output : ['amd64', 'i386'~~] package versions input : ubuntu, warty, libc6, amd64 output : ['2.?.?.ds1-13ubuntu2', ~~~] sorry to lack of my explain. – Lee Sihun Apr 01 '18 at 17:05