Package-helpers: config doesn't properly parse dependencies with "or"

Category:bug report
Status:patch (needs review)

I'm exploring Trisquel's package helpers.

I found that the "config" script doesn't properly parse the dependencies needed for compiling. It gathers the dependencies from the file "debian/control". When a line of dependencies is in the format "package-1 (>= 1) | package-2", it parses it as "package-1", truncating package-2.

The package firefox has this dependency line:

        yasm-1 (>= 1.1) | yasm (>= 1.1),

The package yasm-1 doesn't exist in the repo, but yasm does, yet it won't be installed.

The line that parses the dependences is:

    DEPENDS=$(/bin/sed -n '/Build-Dep/,/^[a-zA-W0-9]/ p' debian/control | head -n -1 | /bin/sed 's/.*://; s/(.*)//; s/,//g' |xargs echo -n)

Maybe it should be:

    DEPENDS=$(/bin/sed -n '/Build-Dep/,/^[a-zA-W0-9]/ p' debian/control | head -n -1 | /bin/sed 's/.*://; s/([^)]*)//g; s/|//g; s/,//g' | xargs echo -n)

What I've changed is "s/(.*)//" to "s/([^)]*)//g; s/|//g". This will try to install yasm-1 and yasm.

What I don't understand in the "config" script is how apt-get deals with missing packages. When building firefox, it seems to me that it should fail when it tries to install "yasm" for firefox. It fails on my system.

I don't think my proposition fixes the issue completely. Also, I don't know what will happen if both package-1 and package-2 exists, but they conflict.