15

I have a package that I've been building using checkinstall for a while now, and I wanted to automate it (pass the values in via command line instead of typing the selection, pasting the value in, etc...)

I am not sure if this is a checkinstall bug, or not, but how can I include multiple packages via the command line --requires option. It seems to barf if I include the minimum version of a package (for exmple --requires="libvte9 (>= 0.28.2)"), or multiple packages at once (for example --requires "libvte9, libc6")

Has anyone had better success with the command line arguments for multiple packages? Am I doing something wrong, or is this a bug.

Note: If I run the script, and choose the requires option (10), and paste my entire line with multiple packages and minimum versions (such as libvte9 (>= 0.28.2), libc6 (>= 2.13), it works fine, it just seems to be on the command line that it's having issues. Also this is with building a debian package, using the -D option.

1
  • Using 1.6.2 I can't seem to get the >= to be working, = is fine. Feb 12, 2016 at 10:12

4 Answers 4

25

After reading Aleks-Daniel Jakimenko-A.'s answer, Reallumpi's one and doing some tests on a real life case, here is what you should do:

  1. use , (comma) without spaces to separate required packages ;
  2. escape ( and ) parenthesis when specifying package's version ;
  3. escape > (greater sign) when specifying package's version ;

Example

make && sudo -k checkinstall \
    --pkgsource="https://github.com/raboof/nethogs/" \
    --pkglicense="GPL2" \
    --deldesc=no \
    --nodoc \
    --maintainer="$USER\\<$USER@$HOSTNAME\\>" \
    --pkgarch=$(dpkg \
    --print-architecture) \
    --pkgversion="0.8.1" \
    --pkgrelease="SNAPSHOT" \
    --pkgname=nethogs \
    --requires="libc6 \(\>= 2.4\),libgcc1 \(\>= 1:4.1.1\),libncurses5 \(\>= 5.5-5~\),libpcap0.8 \(\>= 0.9.8\),libstdc++6 \(\>= 4.1.1\),libtinfo5" \
    make install

Output

*****************************************
**** Debian package creation selected ***
*****************************************

This package will be built according to these values:

0 -  Maintainer: [ elopez<elopez@> ]
1 -  Summary: [ Net top tool grouping bandwidth per process ]
2 -  Name:    [ nethogs ]
3 -  Version: [ 0.8.1 ]
4 -  Release: [ SNAPSHOT ]
5 -  License: [ GPL2 ]
6 -  Group:   [ checkinstall ]
7 -  Architecture: [ amd64 ]
8 -  Source location: [ https://github.com/raboof/nethogs/ ]
9 -  Alternate source location: [  ]
10 - Requires: [ libc6 (>= 2.4),libgcc1 (>= 1:4.1.1),libncurses5 (>= 5.5-5~),libpcap0.8 (>= 0.9.8),libstdc++6 (>= 4.1.1),libtinfo5 ]
11 - Provides: [ nethogs ]
12 - Conflicts: [  ]
13 - Replaces: [  ]
12

checkinstall uses , to separate multiple packages. That's it, a comma, without any spaces around it.

1
  • 1
    Yep, that solved my issue with multiple dependencies, but I still am unable to specify the minimum version for those dependencies via the --requires option. Aug 21, 2013 at 19:21
7

You need to escape brackets, e.g. --requires "package \(= 1.0\)"

1

This answer elaborates on how to properly format punctuation, within a shell script, to get multiple package dependencies for checkinstall to work.

PAK_USER='. , ? ! : + - ^ _ { } = $ % @ [ ] / ; # & * ~ ( ) < > \ |'
PAK_NEEDS='. , ? ! : + - ^ _ { } = $ % @ [ ] / ; # & * ~ ( ) < > \ |'
PAK_NEEDS=$(echo "$PAK_NEEDS" | perl -pe 's/([[:punct:]])/\\\1/g')

0 -  Maintainer: [ . , ? ! : + - ^ _ { } = $ % @ [ ] / ]
1 -  Summary: [ This is a punctuation escape test. ]
10 - Requires: [ . , ? ! : + - ^ _ { } = $ % @ [ ] / ; # & * ~ ( ) < > \ | ]

The ones that needs escaping appear to be shell operators ; # & * ~ ( ) < > \ | Some will return a value * ~ terminate the line ; # or wipe everything out ( ) < > | & while \ disappears since it's the escape character.

The regex perl -pe 's/([[:punct:]])/\\\1/g' escapes all the punctuation characters which is overkill but works quite well. Single and Double Quotes are already problematic, along with $, which will expand unless surrounded by single-quotes.

If you don't want to think about escaping, use the regex and caution with ' " $.

PAK_NEEDS="libasound2 (>= 1.0.16), libavcodec57 (>= 7:3.4.2) | libavcodec-extra57 (>= 7:3.4.2), libavformat57 (>= 7:3.4.2), libavutil55 (>= 7:3.4.2), libboost-filesystem1.65.1, libboost-system1.65.1, libc6 (>= 2.27), libcurl4 (>= 7.16.2), libexpat1 (>= 2.0.1), libgcc1 (>= 1:3.0), libgl1, libglu1-mesa | libglu1, libmad0 (>= 0.15.1b-3), libsdl2-2.0-0 (>= 2.0.8), libsdl2-image-2.0-0 (>= 2.0.2), libsdl2-net-2.0-0 (>= 2.0.1), libsdl2-ttf-2.0-0 (>= 2.0.14), libsndfile1 (>= 1.0.20), libspeex1 (>= 1.2~beta3-1), libspeexdsp1 (>= 1.2~beta3.2-1), libstdc++6 (>= 5.2), libswscale4 (>= 7:3.4.2), libvorbisfile3 (>= 1.1.2), libzzip-0-13 (>= 0.13.56), zlib1g (>= 1:1.1.4)"
PAK_NEEDS=$(echo "$PAK_NEEDS" | perl -pe 's/([[:punct:]])/\\\1/g')
10 - Requires: [ libasound2 (>= 1.0.16), libavcodec57 (>= 7:3.4.2) | libavcodec-extra57 (>= 7:3.4.2), libavformat57 (>= 7:3.4.2), libavutil55 (>= 7:3.4.2), libboost-filesystem1.65.1, libboost-system1.65.1, libc6 (>= 2.27), libcurl4 (>= 7.16.2), libexpat1 (>= 2.0.1), libgcc1 (>= 1:3.0), libgl1, libglu1-mesa | libglu1, libmad0 (>= 0.15.1b-3), libsdl2-2.0-0 (>= 2.0.8), libsdl2-image-2.0-0 (>= 2.0.2), libsdl2-net-2.0-0 (>= 2.0.1), libsdl2-ttf-2.0-0 (>= 2.0.14), libsndfile1 (>= 1.0.20), libspeex1 (>= 1.2~beta3-1), libspeexdsp1 (>= 1.2~beta3.2-1), libstdc++6 (>= 5.2), libswscale4 (>= 7:3.4.2), libvorbisfile3 (>= 1.1.2), libzzip-0-13 (>= 0.13.56), zlib1g (>= 1:1.1.4) ]

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.