How To: Change .deb Package Dependencies

Write tutorials here
There are more tutorials here http://community.linuxmint.com/tutorial/welcome
Forum rules
Please don't add support questions to tutorials,start your own thread in the appropriate sub-forum instead. Before you post please read this
Dean
Level 1
Level 1
Posts: 35
Joined: Thu May 28, 2009 4:01 pm
Location: Jacksonville NC
Contact:

How To: Change .deb Package Dependencies

Postby Dean » Tue Oct 27, 2009 9:06 pm

Just a quick reference guide to changing dependencies on any .deb file.

First you will need to extract the .deb to a temporary directory (tmpdir).

Code: Select all

dpkg-deb -x name-of-package.deb tmpdir


Note: Some times the package is a really long name with a bunch of random numbers and letters, especially if you are grabbing the file from /var/cache/apt/archives/. If this is the case you can either rename the .deb to something easier or you can type part of the file name then press "tab" to allow the terminal to finish the rest of the name.

Then we are going to pull the control file that is located in the tmp/DEBIAN/ folder. This is where you will make your dependency changes.

Code: Select all

dpkg-deb --control name-of-package.deb


Now to edit the file

Code: Select all

gedit tmpdir/DEBIAN/control


You should now see something like this

Code: Select all

Package: gnome-panel
Version: 1:2.26.0-0ubuntu7
Architecture: i386
Maintainer: Ubuntu Desktop Team <ubuntu-desktop@lists.ubuntu.com>
Installed-Size: 1168
Depends: libatk1.0-0 (>= 1.20.0), libbonobo2-0 (>= 2.15.0), libbonoboui2-0 (>= 2.15.1), libc6 (>= 2.4), libcairo2 (>= 1.2.4), libdbus-1-3 (>= 1.0.2), libdbus-glib-1-2 (>= 0.78), libecal1.2-7 (>= 2.26.1), libedataserver1.2-11 (>= 2.26.1), libedataserverui1.2-8 (>= 2.26.1), libgconf2-4 (>= 2.13.5), libglade2-0 (>= 1:2.6.1), libglib2.0-0 (>= 2.20.0), libgnome-desktop-2-11 (>= 1:2.25.90), libgnome-menu2 (>= 2.15.4), libgnome2-0 (>= 2.17.3), libgnomeui-0 (>= 2.22.0), libgtk2.0-0 (>= 2.16.0), libgweather1 (>= 2.25.5), libical0 (>= 0.30), liborbit2 (>= 1:2.14.10), libpanel-applet2-0 (>= 2.19.3), libpango1.0-0 (>= 1.18.0), libpolkit-dbus2 (>= 0.7), libpolkit2 (>= 0.7), librsvg2-2 (>= 2.22.3), libwnck22 (>= 2.22.0), libx11-6, gnome-panel-data (>= 1:2.26), gnome-panel-data (<< 1:2.27), gnome-desktop-data (>= 2.10.0-1), gnome-control-center (>= 1:2.8.2-3), gnome-menus (>= 2.11.1-1), gnome-about (>= 2.10.0-1)
Recommends: gnome-applets (>= 2.12.1-1), gnome-session, evolution-data-server, gnome-icon-theme (>= 2.18), alacarte, indicator-applet
Suggests: yelp, gnome2-user-guide, gnome-terminal | x-terminal-emulator, gnome-system-tools, nautilus, menu-xdg (>= 0.2)
Section: gnome
Priority: optional
Description: launcher and docking facility for GNOME
 The GNOME Panel is an essential part of the GNOME Desktop, providing
 toolbar-like “panels” which can be attached to the sides of your desktop.
 They are used to launch applications and embed a number of other
 functions, such as quick launch icons, the clock, the notification area,
 volume controls and the battery charge indicator, and utilities ranging
 from weather forecast to system monitoring.
Original-Maintainer: Guilherme de S. Pastore <gpastore@debian.org>


Most of this will be pretty self explanatory, but I will give a quick explanation of what some of these properties are used for.

Depends: This line determines what files the your particular package requires in order to run. In many cases a lot of these files are not actually needed, but are part of a package deal and may require some changes in order for the package to function fully and properly without them. For instance, If you were to get rid of nautilus as a dependency (which is pulled in by other dependencies like gnome-control-center) You would have to configure gnome-pane's menul to open up another file manager of your choice. Keep in mind that if you are trying to remove a particular dependency, that it can and will often times be pulled in by other dependencies that requires that same dependency to run. A couple ways you can check to see what each dependency pulls is to run

Code: Select all

apt-cache depends name-of-package-or-dependency.deb


or

Code: Select all

dpkg -I name-of-package.deb


or you can use synaptic and look at each packages dependencies by right clicking on properties.

Pre-Depends: If applicable, then this specifies the dependencies that are needed to be pre-installed before anything else related to the original package can be installed.

Recommends:
This specifies packages that would normally be installed with the original. Usually these are files that help to get the full functionability of what ever you are installing. In this case, if you did not have the gnome-applets installed then you would have a panel, but it will not be very functional without the menu, task manager, clock, etc.

Suggests:
This specifies packages that would enhance the original package.

Conflicts: This specifies packages, that if installed, will not allow the package your trying to install, to be installed . . . Got it . . . Good.

Replaces: Pretty obvious, the package you are tying to install will replace specified packages in this line.

Now that you have an idea of which each of these lines specify, you can now edit them to include or not include other packages with the one you want to install. After you have edited your control file you will need to repackage your .deb with this command.

Code: Select all

dpkg -b tmpdir new-name-of-package.deb


Now you should have a new .deb file that will only pull in the dependencies you need. If you find that when you try to install the deb that it still pulls in the packages you are trying to exclude, recheck the dependencies and make sure that their dependencies or their dependency's dependencies are not pulling in those dependencies :)

Tags: dependency debian deb ubuntu package

Husse
Level 23
Level 23
Posts: 19590
Joined: Sun Feb 11, 2007 7:22 am
Location: Near Borås Sweden

Re: How To: Change .deb Package Dependencies

Postby Husse » Sun Nov 01, 2009 6:05 pm

This is of course something you should not do :) :) - unless.....
I see above

Code: Select all

dpkg-deb

dpkg can be also be used as a front-end to dpkg-deb so I guess you could use either and it is not supposed to be a space here
Just in case...
And thanks for the guide
Image
Don't fix it if it ain't broken, don't break it if you can't fix it

piratesmack
Level 5
Level 5
Posts: 696
Joined: Mon May 26, 2008 3:08 pm

Re: How To: Change .deb Package Dependencies

Postby piratesmack » Sun Nov 01, 2009 6:42 pm

Good guide

Another way you can do it if you're using a a distro that isn't based on Debian:

Code: Select all

ar -p package.deb control.tar.gz | tar -xvzf


Edit the control file:

Code: Select all

gedit control


Compress the control file:

Code: Select all

tar -cvzf control.tar.gz control


Replace the control.tar.gz in the deb with a new one:

Code: Select all

ar -r package.deb control.tar.gz


A deb file is just an ar archive, so you don't need dpkg-deb to extract it.

Husse
Level 23
Level 23
Posts: 19590
Joined: Sun Feb 11, 2007 7:22 am
Location: Near Borås Sweden

Re: How To: Change .deb Package Dependencies

Postby Husse » Sun Nov 01, 2009 7:25 pm

Another way you can do it if you're using a a distro that isn't based on Debian:

Eh?
Image
Don't fix it if it ain't broken, don't break it if you can't fix it

piratesmack
Level 5
Level 5
Posts: 696
Joined: Mon May 26, 2008 3:08 pm

Re: How To: Change .deb Package Dependencies

Postby piratesmack » Sun Nov 01, 2009 8:22 pm

Husse wrote:
Another way you can do it if you're using a a distro that isn't based on Debian:

Eh?


Yeah, I'm not sure why I posted that.

deadlytackler
Level 1
Level 1
Posts: 26
Joined: Sat Aug 21, 2010 10:40 am

Re: How To: Change .deb Package Dependencies

Postby deadlytackler » Sun Aug 29, 2010 3:26 am

the last command is returning following:-
dpkg-deb: failed to open package info file `tempdir/DEBIAN/control' for reading: No such file or directory

what went wrong

Regards
Dean wrote:Just a quick reference guide to changing dependencies on any .deb file.

First you will need to extract the .deb to a temporary directory (tmpdir).

Code: Select all

dpkg-deb -x name-of-package.deb tmpdir


Note: Some times the package is a really long name with a bunch of random numbers and letters, especially if you are grabbing the file from /var/cache/apt/archives/. If this is the case you can either rename the .deb to something easier or you can type part of the file name then press "tab" to allow the terminal to finish the rest of the name.

Then we are going to pull the control file that is located in the tmp/DEBIAN/ folder. This is where you will make your dependency changes.

Code: Select all

dpkg-deb --control name-of-package.deb


Now to edit the file

Code: Select all

gedit tmpdir/DEBIAN/control


You should now see something like this

Code: Select all

Package: gnome-panel
Version: 1:2.26.0-0ubuntu7
Architecture: i386
Maintainer: Ubuntu Desktop Team <ubuntu-desktop@lists.ubuntu.com>
Installed-Size: 1168
Depends: libatk1.0-0 (>= 1.20.0), libbonobo2-0 (>= 2.15.0), libbonoboui2-0 (>= 2.15.1), libc6 (>= 2.4), libcairo2 (>= 1.2.4), libdbus-1-3 (>= 1.0.2), libdbus-glib-1-2 (>= 0.78), libecal1.2-7 (>= 2.26.1), libedataserver1.2-11 (>= 2.26.1), libedataserverui1.2-8 (>= 2.26.1), libgconf2-4 (>= 2.13.5), libglade2-0 (>= 1:2.6.1), libglib2.0-0 (>= 2.20.0), libgnome-desktop-2-11 (>= 1:2.25.90), libgnome-menu2 (>= 2.15.4), libgnome2-0 (>= 2.17.3), libgnomeui-0 (>= 2.22.0), libgtk2.0-0 (>= 2.16.0), libgweather1 (>= 2.25.5), libical0 (>= 0.30), liborbit2 (>= 1:2.14.10), libpanel-applet2-0 (>= 2.19.3), libpango1.0-0 (>= 1.18.0), libpolkit-dbus2 (>= 0.7), libpolkit2 (>= 0.7), librsvg2-2 (>= 2.22.3), libwnck22 (>= 2.22.0), libx11-6, gnome-panel-data (>= 1:2.26), gnome-panel-data (<< 1:2.27), gnome-desktop-data (>= 2.10.0-1), gnome-control-center (>= 1:2.8.2-3), gnome-menus (>= 2.11.1-1), gnome-about (>= 2.10.0-1)
Recommends: gnome-applets (>= 2.12.1-1), gnome-session, evolution-data-server, gnome-icon-theme (>= 2.18), alacarte, indicator-applet
Suggests: yelp, gnome2-user-guide, gnome-terminal | x-terminal-emulator, gnome-system-tools, nautilus, menu-xdg (>= 0.2)
Section: gnome
Priority: optional
Description: launcher and docking facility for GNOME
 The GNOME Panel is an essential part of the GNOME Desktop, providing
 toolbar-like “panels” which can be attached to the sides of your desktop.
 They are used to launch applications and embed a number of other
 functions, such as quick launch icons, the clock, the notification area,
 volume controls and the battery charge indicator, and utilities ranging
 from weather forecast to system monitoring.
Original-Maintainer: Guilherme de S. Pastore <gpastore@debian.org>


Most of this will be pretty self explanatory, but I will give a quick explanation of what some of these properties are used for.

Depends: This line determines what files the your particular package requires in order to run. In many cases a lot of these files are not actually needed, but are part of a package deal and may require some changes in order for the package to function fully and properly without them. For instance, If you were to get rid of nautilus as a dependency (which is pulled in by other dependencies like gnome-control-center) You would have to configure gnome-pane's menul to open up another file manager of your choice. Keep in mind that if you are trying to remove a particular dependency, that it can and will often times be pulled in by other dependencies that requires that same dependency to run. A couple ways you can check to see what each dependency pulls is to run

Code: Select all

apt-cache depends name-of-package-or-dependency.deb


or

Code: Select all

dpkg -I name-of-package.deb


or you can use synaptic and look at each packages dependencies by right clicking on properties.

Pre-Depends: If applicable, then this specifies the dependencies that are needed to be pre-installed before anything else related to the original package can be installed.

Recommends:
This specifies packages that would normally be installed with the original. Usually these are files that help to get the full functionability of what ever you are installing. In this case, if you did not have the gnome-applets installed then you would have a panel, but it will not be very functional without the menu, task manager, clock, etc.

Suggests:
This specifies packages that would enhance the original package.

Conflicts: This specifies packages, that if installed, will not allow the package your trying to install, to be installed . . . Got it . . . Good.

Replaces: Pretty obvious, the package you are tying to install will replace specified packages in this line.

Now that you have an idea of which each of these lines specify, you can now edit them to include or not include other packages with the one you want to install. After you have edited your control file you will need to repackage your .deb with this command.

Code: Select all

dpkg -b tmpdir new-name-of-package.deb


Now you should have a new .deb file that will only pull in the dependencies you need. If you find that when you try to install the deb that it still pulls in the packages you are trying to exclude, recheck the dependencies and make sure that their dependencies or their dependency's dependencies are not pulling in those dependencies :)

Tags: dependency debian deb ubuntu package
Life is an art of drawing sufficient conclusions from insufficient premises

koter84
Level 1
Level 1
Posts: 1
Joined: Tue Mar 13, 2012 9:34 am

Re: How To: Change .deb Package Dependencies

Postby koter84 » Tue Mar 26, 2013 1:59 pm

piratesmack wrote:
Husse wrote:
piratesmack wrote:Another way you can do it if you're using a a distro that isn't based on Debian:

Eh?

Yeah, I'm not sure why I posted that.

thanks for posting that :D
i currently have Fedora on my laptop, but i'm trying to fix a package for a Debian server at work...


Return to “Tutorials”

Who is online

Users browsing this forum: bartszu and 3 guests