mshogin
mshogin

Reputation: 21

apt: automatcally upgrade dependend on package while installing new version off package

The situation is next:

We have package B and A(depends B). In repository we have next picture:

A
  version table
    0.0.1 (depends B=0.1.1) 
    0.0.2 (depends B=0.1.2)
    0.0.3 (depends B=0.1.3)
B 
  version table
    0.1.1
    0.1.2
    0.1.3
    0.1.4

On server we have installed A=0.0.1. Next time when we want to upgrade package A on the server, we don't want to upgrade package B manually (just run apt-get install A=0.0.2). With current configuration it doesn't seem like possible.

We tried next configuration: instead of creation next version of B, we started to create new packages for each version, like B-1, B-2

A
  version table
    0.0.1 (depends B-1) 
    0.0.2 (depends B-2)
    0.0.3 (depends B-3)
B-1 
B-2 (provides B-1)
B-3 (provides B-2)

This configuration didn't work.

Is there any configuration which will work for our us?

Thanks

Upvotes: 1

Views: 48

Answers (1)

Dmitry A. Kulakov
Dmitry A. Kulakov

Reputation: 11

Necessary packages fields

  • ./aa_0.0.1/debian/control

    • Package: aa
    • Depends: bb-1
  • ./aa_0.0.2/debian/control

    • Package: aa
    • Depends: bb-2
  • ./bb_0.1.1/debian/control

    • Package: bb-1
  • ./bb_0.1.2/debian/control

    • Package: bb-2
    • Conflicts: bb-1

A script to build and test you packages using the local repository

#!/bin/bash

# Rebuild packages
d=`pwd`
repo_name=mydebs
mydebs=${d}/${repo_name}
list=/etc/apt/sources.list.d/${repo_name}.list

rm -rf {aa,bb}*.{build,deb,changes,dsc,tar.gz} $mydebs
for i in ${d}/{aa_0.0.1,aa_0.0.2,bb_0.1.1,bb_0.1.2}
do
  cd $i
  debuild -us -uc
  rm -rf debian/{aa,bb-*,aa.*,bb.*} debian/files
done
cd $d

# Rebuild the repository
type dpkg-scanpackages >/dev/null 2>&1 || sudo apt-get install dpkg-dev

mkdir -p $mydebs
cp *.deb ${mydebs}/
cd $mydebs
dpkg-scanpackages --multiversion . /dev/null | gzip -9c > Packages.gz

echo "deb file:${mydebs} ./" | sudo tee $list
sudo apt-get update

# Return
cd $d

Testing

~debian_packaging$ sudo apt-get install aa=0.0.1-1
The following extra packages will be installed:
  bb-1
The following NEW packages will be installed:
  aa bb-1
0 upgraded, 2 newly installed and 0 to remove.
Setting up bb-1 (0.1.1-1) ...
Setting up aa (0.0.1-1) ...
​
~debian_packaging$ sudo apt-get install aa=0.0.2-1
The following extra packages will be installed:
  bb-2
The following packages will be REMOVED:
  bb-1
The following NEW packages will be installed:
  bb-2
The following packages will be upgraded:
  aa
1 upgraded, 1 newly installed and 1 to remove.
Removing bb-1 (0.1.1-1) ...
Setting up bb-2 (0.1.2-1) ...
Setting up aa (0.0.2-1) ...

Upvotes: 1

Related Questions