Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get dependencies for local deb file? #107

Open
metal450 opened this issue Apr 30, 2020 · 5 comments
Open

Get dependencies for local deb file? #107

metal450 opened this issue Apr 30, 2020 · 5 comments
Labels

Comments

@metal450
Copy link

Given a local .deb file, is it possible to use apt-offline to generate a bundle of just the dependencies required to install that .deb file?

i.e. rather than

apt-offline set vim.sig --install-packages vim
apt-offline get vim.sig --bundle vim.zip

Something to the effect of

app-offline set x.sig --install-dependencies ./x.deb
app-offline get x.sig --bundle dependanciesForX.zip

?

@rickysarraf
Copy link
Owner

rickysarraf commented Apr 30, 2020 via email

@metal450
Copy link
Author

Cool...thanks for the quick reply, bummer it isn't there yet or on the horizon, but glad it sounds useful & may be someday! :)

I'm afraid I don't have the capability personally either, but in the interim, I suppose I can just manually churn out a long command for the few .debs I have that are distributed outside of apt (i.e. --install-packages dep1 dep2 dep3 dep4, etc).

Fingers crossed that this ends up getting tackled & eases the task of future reformats :)

@rahedges
Copy link

I was looking for this feature too.

Is there a way to pass the dependency from the Depends line to the set command? From the above example, could one call this:

sudo apt-offline set local-deb-offline.sig --install-packages libacl1 (>= 2.2.23), libblkid1 (>= 2.24), libc6 (>= 2.30), libkmod2 (>= 5~), libselinux1 (>= 2.1.9), adduser, dpkg (>= 1.19.3) | systemd-sysv, libudev1 (= 245.5-2), util-linux (>= 2.27.1)

I don't know how to specify the version ranges to the set command.

This would be similar to the apt-get satisfy command.

I am wanting to do this because I have an apt package coming from a PPA which is not configured on the offline machine. The application is the only .deb that will come from the PPA, the dependencies will all come from repos known to the offline system.

@rickysarraf
Copy link
Owner

I was looking for this feature too.

Is there a way to pass the dependency from the Depends line to the set command? From the above example, could one call this:

sudo apt-offline set local-deb-offline.sig --install-packages libacl1 (>= 2.2.23), libblkid1 (>= 2.24), libc6 (>= 2.30), libkmod2 (>= 5~), libselinux1 (>= 2.1.9), adduser, dpkg (>= 1.19.3) | systemd-sysv, libudev1 (= 245.5-2), util-linux (>= 2.27.1)

I don't know how to specify the version ranges to the set command.

This would be similar to the apt-get satisfy command.

This approach is bound to break. The dependencies listed above are that of dpkg. apt only manipulates versions, that are present in the repository, against what the user requests.

apt-offline ensures to not duplicate steps that are better dealt by dpkg/apt.

I am wanting to do this because I have an apt package coming from a PPA which is not configured on the offline machine. The application is the only .deb that will come from the PPA, the dependencies will all come from repos known to the offline system.

Why not ? It is an offline machine. So you could just enable that PPA repository and then let apt and apt-offline do the work of extracting the dependency.

There's this fairly new library: https://github.com/memory/python-dpkg

Python 3.12.4 (main, Jul 15 2024, 12:17:32) [GCC 13.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pydpkg
>>> deb = pydpkg.D
pydpkg.Dpkg(  pydpkg.Dsc(   
>>> deb = pydpkg.Dpkg("zstd_1.5.6+dfsg-1_amd64.deb")
>>> deb
'Package: zstd\nSource: libzstd\nVersion: 1.5.6+dfsg-1\nArchitecture: amd64\nMaintainer:
 RPM packaging team <[email protected]>\nInstalled-Size: 2247\nDepends: li
bc6 (>= 2.34), libgcc-s1 (>= 3.0), liblz4-1 (>= 1.8.0), liblzma5 (>= 5.1.1alpha+20120614
), libstdc++6 (>= 12), zlib1g (>= 1:1.1.4)\nSection: utils\nPriority: optional\nMulti-Ar
ch: foreign\nHomepage: https://github.com/facebook/zstd\nDescription: fast lossless comp
ression algorithm -- CLI tool\n Zstd, short for Zstandard, is a fast lossless compressio
n algorithm, targeting\n real-time compression scenarios at zlib-level compression ratio
.\n .\n This package contains the CLI program implementing zstd.\n\n'

>>> deb.get('Depends')
'libc6 (>= 2.34), libgcc-s1 (>= 3.0), liblz4-1 (>= 1.8.0), liblzma5 (>= 5.1.1alpha+20120
614), libstdc++6 (>= 12), zlib1g (>= 1:1.1.4)'

>>> deb.get('Depends').split(",")
['libc6 (>= 2.34)', ' libgcc-s1 (>= 3.0)', ' liblz4-1 (>= 1.8.0)', ' liblzma5 (>= 5.1.1a
lpha+20120614)', ' libstdc++6 (>= 12)', ' zlib1g (>= 1:1.1.4)']

>>> deb.epoch
0

>>> deb.version
'1.5.6+dfsg-1'

>>> deb.Depends
'libc6 (>= 2.34), libgcc-s1 (>= 3.0), liblz4-1 (>= 1.8.0), liblzma5 (>= 5.1.1alpha+20120
614), libstdc++6 (>= 12), zlib1g (>= 1:1.1.4)'
>>> 

This is not enough information to craft the complete url.

@rickysarraf
Copy link
Owner

There's also the option to manipulate .dsc

@ python
Python 3.12.4 (main, Jul 15 2024, 12:17:32) [GCC 13.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pydpkg
>>> dsc = pydpkg.D
pydpkg.Dpkg(  pydpkg.Dsc(   
>>> dsc = pydpkg.Dsc("user-mode-linux_6.10um1.dsc")
>>> dsc
dsc file user-mode-linux_6.10um1.dsc is not signed or has a corrupt sig: Expected: ASCII-armored PGP data
'Format: 3.0 (native)\nSource: user-mode-linux\nBinary: user-mode-linux\nArchitecture: i386 amd64\nVersion: 6.10um1\nMaintainer: User Mode Linux Maintainers <[email protected]>\nUploaders: Ritesh Raj Sarraf <[email protected]>\nHomepage: https://user-mode-linux.sourceforge.net/\nStandards-Version: 4.6.1\nVcs-Browser: https://salsa.debian.org/uml-team/user-mode-linux\nVcs-Git: https://salsa.debian.org/uml-team/user-mode-linux.git\nBuild-Depends: debhelper-compat (= 13), quilt, linux-source-6.10, python3-docutils, xz-utils, m4, kmod, libvdeplug-dev | libvdeplug2-dev, libpcap-dev, bc, dpkg (>= 1.16.2), libssl-dev, bison, flex, gcc-multilib\nPackage-List: \n user-mode-linux deb kernel optional arch=i386,amd64\nChecksums-Sha1: \n e21c416dbc8961ca02c6d46751370be9ec3d6100 35296 user-mode-linux_6.10um1.tar.xz\n ae32ac205ba955177c8d424e118d57ba89085d00 1001 user-mode-linux_6.10um1.dsc\nChecksums-Sha256: \n 7afee03b97b390e3fe6eb9f37c599b28dac639880b8ae245ad76df05849f92ab 35296 user-mode-linux_6.10um1.tar.xz\n c529d6d56e405a16364173da67fd346e78efe737498fc27f36afd8238fdc0668 1001 user-mode-linux_6.10um1.dsc\nFiles: \n 6a911e050dd5a3b426cf0021d72b28c5 35296 user-mode-linux_6.10um1.tar.xz\n 44edbc4cef216da1b7c5ebcbe5a05ace 1001 user-mode-linux_6.10um1.dsc\n\n'

>>> dsc.
dsc.all_checksums_correct  dsc.get(                   dsc.pgp_message
dsc.all_files_present      dsc.headers                dsc.sizes
dsc.checksums              dsc.message                dsc.source_files
dsc.corrected_checksums    dsc.message_str            dsc.validate()
dsc.filename               dsc.missing_files          

>>> dsc.source_files
['/var/tmp/Debian-Build/Result/user-mode-linux_6.10um1.tar.xz', '/var/tmp/Debian-Build/Result/user-mode-linux_6.10um1.dsc']
>>> 

So what'll be needed is a cross-platform python-apt library, which to my knowledge is not cross-platform.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants