Is there a command to upgrade a package and all its dependencies without upgrading all packages?
We have a meta-package, similar to ubuntu-desktop, that requires a bunch of dependencies to run some internal, not-yet-packaged code. Currently we are updating the meta-package so that it requires >= the current version every time we repackage it so that its dependencies will be upgraded when it is installed. However, if there was a way to upgrade a package and all its dependencies without upgrading all packages then that would be much simpler. Is that possible?
Not directly, as far as I know. You can use a little shell snippet to generate the list of dependencies of the package and upgrade these (assuming you aren't interested in recursive dependencies):
apt-get install our-metapackage $(dpkg-query -Wf '${Depends}' our-metapackage | sed 's/ *\(([^()]*)\)\? *[,|] */\n/g')
An alternative approach would be to supply your packages through a repository with a unique origin. Write an APT preferences file that specifies only your repository as having a normal priority and everything else as having too low a priority to be installed automatically. (See APT pinning in the APT manual for explanations.) I won't go into details about making the repository (this would be material for a separate question, which may well exist already). To specify that packages from your repository get upgraded and others don't, write the following file as /etc/apt/preferences.nnutter
:
Package: *
Pin: release o=nnutter
Pin-Priority: 500
Package: *
Pin-Prority: 100
500 is the normal priority. 100 causes packages not to be upgraded, though the package will be installed if required by dependencies. Run apt-get upgrade
or apt-get dist-upgrade
with this APT preferences file when you only want to upgrade packages from the nnutter repository:
apt-get -o Dir::Etc::Preferences=/etc/apt/preferences.nnutter -o Dir::Etc::PreferencesParts=/etc/apt/preferences.nnutter.d upgrade