conditional install of optional package

46 views
Skip to first unread message

Thierry

unread,
May 25, 2020, 11:12:31 PM5/25/20
to sage-devel
Hi,

i am on the way to build a version of Sage Debian Live for 9.1. I would
like to benefit from the spkg-configure.m4 feature when installing
optional packages, as much as possible.

Say, i want to install cbc, looking at build/pkgs/cbc/distros/debian.txt
i install coinor-cbc coinor-libcbc-dev from the distro.

However, when i do

sage -i cbc

it still installs cbc from Sage spkg, which i would like to avoid. What
is the command that installs cbc (say) only if the distro replacements
are not installed on the system ?

Ciao,
Thierry

Matthias Koeppe

unread,
May 26, 2020, 12:51:20 AM5/26/20
to sage-devel
./configure --enable-cbc && make

 

Thierry

unread,
May 26, 2020, 9:46:48 AM5/26/20
to sage-...@googlegroups.com
Hi,

On Mon, May 25, 2020 at 09:51:20PM -0700, Matthias Koeppe wrote:
> ./configure --enable-cbc && make

OK thanks. I notice that if i do

./configure --enable-foo
./configure --enable-bar
make build

it seems that only bar is installed, right ?


If i want to make a progressive loop over packages, i should iterate
like that :

for i in <packages list> ; do
/configure --enable-${i}
make build
done

Correct ?

Note that i make checkpoints, since i am used encounter problems in
building/testing packages for SDL (which is 32bit) [1], and i did not
build SDL for a while so i am expecting some issues. Hence, i can not
do a single run like:

./configure --enable-foo --enable-bar [...]


Now, since ./configure --enable-foo seems to modify the following bunch
of files:

./build/make/Makefile-auto
./build/make/Makefile
./build/bin/sage-build-env-config
./build/pkgs/sage_conf/src/setup.cfg
./build/pkgs/sage_conf/src/sage_conf.py
./logs/pkgs/config.log
./config.status
./src/bin/sage-env-config
./src/Makefile

should i end with a bare

./configure

to let those file return in a kind of "default state" ?


Also, what should i do if i want to run self tests at the same time ? I
used to do:

sage -i -c foo

is there a ./configure replacement for that ?

Ciao,
Thierry

[1]
https://trac.sagemath.org/query?keywords=~sdl&col=id&col=summary&col=status&col=type&col=priority&col=milestone&col=component&order=priority

Dima Pasechnik

unread,
May 26, 2020, 11:01:33 AM5/26/20
to sage-devel
On Tue, May 26, 2020 at 2:46 PM Thierry <sage-goo...@lma.metelu.net> wrote:
>
> Hi,
>
> On Mon, May 25, 2020 at 09:51:20PM -0700, Matthias Koeppe wrote:
> > ./configure --enable-cbc && make
>
> OK thanks. I notice that if i do
>
> ./configure --enable-foo
> ./configure --enable-bar
> make build
>
> it seems that only bar is installed, right ?

yes, this is totally standard behaviour of ./configure scripts.
They don't cache parameters they are called with, more precisely, they
store them in config.status.


>
>
> If i want to make a progressive loop over packages, i should iterate
> like that :
>
> for i in <packages list> ; do
> /configure --enable-${i}
> make build
> done
>
> Correct ?
yes, this would install everything in <packages list> (assumning there
are no contradicting options
such as mpir vs gmp, no dependencies --- which is actually the biggest
problem in this, as deps can't be easilty controlled with a plain list
of packages--- etc), but would be slower than first building the
string to call ./configure with,
then calling configure once, and finally "make build" once.
It might fail at some point, but your loop might fail just as well, right?

>
> Note that i make checkpoints, since i am used encounter problems in
> building/testing packages for SDL (which is 32bit) [1], and i did not
> build SDL for a while so i am expecting some issues. Hence, i can not
> do a single run like:
>
> ./configure --enable-foo --enable-bar [...]
>
>
> Now, since ./configure --enable-foo seems to modify the following bunch
> of files:
>
> ./build/make/Makefile-auto
> ./build/make/Makefile
> ./build/bin/sage-build-env-config
> ./build/pkgs/sage_conf/src/setup.cfg
> ./build/pkgs/sage_conf/src/sage_conf.py
> ./logs/pkgs/config.log
> ./config.status
> ./src/bin/sage-env-config
> ./src/Makefile
>
> should i end with a bare
>
> ./configure
>
> to let those file return in a kind of "default state" ?

yes, or, better if foo won't build you can

./configure --disable-foo

to get rid of exactly the request to build foo.
So in your loop you may have a check for the condition of
`make build` and call
./configure --disable-${i}
if it failed.



there is also a funtionality of tox available fot testing things, but
I am not familiar with it.

HTH
Dima



>
>
> Also, what should i do if i want to run self tests at the same time ? I
> used to do:
>
> sage -i -c foo
>
> is there a ./configure replacement for that ?

no, but there is always

export SAGE_CHECK=yes

to effect package's self-tests
> --
> You received this message because you are subscribed to the Google Groups "sage-devel" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/20200526134643.p7z3gxhirpr5e5ds%40metelu.net.

Matthias Koeppe

unread,
May 26, 2020, 11:46:42 AM5/26/20
to sage-devel
On Tuesday, May 26, 2020 at 6:46:48 AM UTC-7, Thierry (sage-googlesucks@xxx) wrote:

On Mon, May 25, 2020 at 09:51:20PM -0700, Matthias Koeppe wrote:
> ./configure --enable-cbc && make

OK thanks. I notice that if i do

   ./configure --enable-foo
   ./configure --enable-bar
   make build

it seems that only bar is installed, right ?

That's correct.

In standard configure scripts, one would have to do "./configure --enable-foo --enable-bar". 
 
If i want to make a progressive loop over packages, i should iterate
like that :

    for i in <packages list> ; do
        /configure --enable-${i}
        make build
    done

Correct ?

Yes, that will work for Sage because of a particular feature: Packages that are already installed in the prefix are automatically enabled.

In general, to add a configure option, you can always do the following:

  ./configure $(./config.status --config) --enable-bar

Matthias


Thierry

unread,
May 27, 2020, 3:31:25 AM5/27/20
to sage-...@googlegroups.com
Hi,

On Tue, May 26, 2020 at 08:46:42AM -0700, Matthias Koeppe wrote:
> In general, to add a configure option, you can always do the following:
>
> ./configure $(./config.status --config) --enable-bar

Nice tip, tanks !

Thierry


>
> Matthias
>
>
> --
> You received this message because you are subscribed to the Google Groups "sage-devel" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/d0d81021-58da-45ec-a2e7-cf5cc69f58a8%40googlegroups.com.

Thierry

unread,
May 27, 2020, 3:31:25 AM5/27/20
to sage-...@googlegroups.com
Hi,

thanks for the answer.

On Tue, May 26, 2020 at 04:01:15PM +0100, Dima Pasechnik wrote:
[...]
> yes, this would install everything in <packages list> (assumning there
> are no contradicting options
> such as mpir vs gmp, no dependencies --- which is actually the biggest
> problem in this, as deps can't be easilty controlled with a plain list
> of packages--- etc), but would be slower than first building the
> string to call ./configure with,
> then calling configure once, and finally "make build" once.

I am not sure to understand: the build/pkgs/*/dependencies files are not
taken into account in that build process ? What wrong could happen with
dependencies ?

> It might fail at some point, but your loop might fail just as well, right?

Yes, i want the procedure to stop when there is a failure, while keeping
what was done until then, i do not want parallel build for optional
packages.

> yes, or, better if foo won't build you can
>
> ./configure --disable-foo
>
> to get rid of exactly the request to build foo.
> So in your loop you may have a check for the condition of
> `make build` and call
> ./configure --disable-${i}
> if it failed.
>

OK, i will disable packages once they are built.

Ciao,
Thierry

>
> there is also a funtionality of tox available fot testing things, but
> I am not familiar with it.
>
> HTH
> Dima
>
>
>
> >
> >
> > Also, what should i do if i want to run self tests at the same time ? I
> > used to do:
> >
> > sage -i -c foo
> >
> > is there a ./configure replacement for that ?
>
> no, but there is always
>
> export SAGE_CHECK=yes
>
> to effect package's self-tests
>
>
> >
> > Ciao,
> > Thierry
> >
> > [1]
> > https://trac.sagemath.org/query?keywords=~sdl&col=id&col=summary&col=status&col=type&col=priority&col=milestone&col=component&order=priority
> >
> > --
> > You received this message because you are subscribed to the Google Groups "sage-devel" group.
> > To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+...@googlegroups.com.
> > To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/20200526134643.p7z3gxhirpr5e5ds%40metelu.net.
>
> --
> You received this message because you are subscribed to the Google Groups "sage-devel" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/CAAWYfq0pCH0dhxqTAQ-R_HS0v7ZEE36jMLFCY%2B--EhdzF7mA-A%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages