1

I've a CI build process during which I install a debian package from my local reprepro.

I have a Makefile which does call aptitude to install the package from its own repository like this

sudo aptitude -y install foobar >> aptitude.log 2>&1

Now it could happen that aptitude has conflicts, which can't be resolved or the repository doesn't offer a new version for the package "foobar". In both cases aptitude wouldn't install anything. But

echo $?

after the aptitude call in the Makefile always returns 0. What way do you propose to check if aptitude actually did install anything? Grepping for the last line of the aptitude output is the only thing I can think of if the exit codes are always 0.

3

Try with dpkg-query, which print information about installed package

Exemple:

dpkg-query -W -f='${Status} ${Version}\n' foobar

Will result

No packages found matching foobar.

Run dpkg-query --help for more information

  • that's really good, I'm just going to call that command before and after the aptitude and will compare the different status and version. thank you! – Preexo Nov 5 '13 at 17:47
0

Since you want to check that an install (and not an upgrade) has gone well, you can count the number of files in /var/lib/dpkg/info before and after the aptitude run. This is not particularly robust, though.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.