InternetConfigPlugin for unix - [WAS]Tips to create a plugin with specific platform dependant stuff

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

InternetConfigPlugin for unix - [WAS]Tips to create a plugin with specific platform dependant stuff

Guillermo Polito
Bump :)

I've been working last week a bit on the internet plugin to fetch some system proxy configuration in unix.

Since

- the plugin is external
- it loads gconf libraries using dlopen, so the libraries are not needed during compilation nor running
- if gconf library is not found, looks at the http-proxy and ftp-proxy env vars.

It should break nothing :P

But I'm not an expert :/.

What do you think?  Is it worth of integration?

Guille

On Mon, Apr 9, 2012 at 4:38 PM, Guillermo Polito <[hidden email]> wrote:
ok,

I did this:
- configured the plugin as external
- created

CogFamilyUnixConfig>>configureInternetConfigPlugin: maker
    super configureInternetConfigPlugin: maker.
    maker addPlatformSources: #( 'sqUnixInternetConfiguration')

and put the file attached in /platforms/unix/plugins/InternetConfigPlugin.
I finally used dlopen to load gconf dinamically and check if it is available, and if it's not, I check the env vars with getenv().

If someone can do a little review, it would be nice :).

Guille


On Sun, Apr 8, 2012 at 9:55 PM, Guillermo Polito <[hidden email]> wrote:
Haha! :)

You won me :).  I was about to reply this:

"Ok, so I talked with Esteban today :).  And thanks to him I reached the conclussion that this plugin should be external."

I'll spend some hours tomorrow to finish it.

Now, as I think it happens with the ssl plugin... Where should we put the code and what should I in order to get it easily integrated in the ci buildings? :)

Thanks!
Guille


On Sun, Apr 8, 2012 at 9:46 PM, Igor Stasenko <[hidden email]> wrote:
On 7 April 2012 17:55, Guillermo Polito <[hidden email]> wrote:
> Was playing in my weekend on the InternetConfigPlugin for ubuntu.  And
> that's the problem :), It uses gnome2 stuff to access the system
> configuration (because gnome handles it's own configuration... :/).
>
> Now, I made it work doing something like this in vmmaker:
>
> CogFamilyUnixConfig>>configureInternetConfigPlugin: maker
>     "extra rules for InternetConfigPlugin"
>
>     super configureInternetConfigPlugin: maker.
>     maker addDefinitions: '`pkg-config --libs --cflags gtk+-2.0 gconf-2.0`'.
>     maker addExternalLibrary: '/usr/lib/libgconf-2.so.4'.
>     maker addPlatformSources: #( 'sqUnixInternetConfiguration.c').
>
> And adding it in the list of internal plugins for Unix.
>
> But this should only compile and work on a system with gconf and stuff
> installed :).
>
Then don't make this plugin internal, but external instead. Because if
library is missing,
VM will refuse to start. In contrast, if your plugin will be in
external module, then module will refuse to load
if lib is missing.

> So, how does or should vmmaker and vm building process handle something like
> this?
>

The philosophy of CMake configurations is to be concrete and without
conditionals. I.E. they should
not contain "if this, do this, if that do that" , instead if you have
such choice, one should make another configuration.

There is no way to predict how different is platform on which you
building VM  from platform where it used (especially in case of unix
systems and their numerous flavors). So, what is working on your OS,
could not work on another. That's why i don't see a point to put
conditionals in build process.

In contrast, if you have a concrete configuration, which says: if you
want to build me, you should have this, this and this, and if you want
to use the built artifact you should have this, this and this
installed, then it makes things much more predictable and
straightforward.


> Guille
>
> _______________________________________________
> VM-beginners mailing list
> [hidden email]
> http://lists.squeakfoundation.org/mailman/listinfo/vm-beginners
>

--
Best regards,
Igor Stasenko.




_______________________________________________
VM-beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/vm-beginners
Reply | Threaded
Open this post in threaded view
|

Re: InternetConfigPlugin for unix - [WAS]Tips to create a plugin with specific platform dependant stuff

Guillermo Polito


On Sun, Apr 15, 2012 at 2:37 PM, Guillermo Polito <[hidden email]> wrote:
Bump :)

I've been working last week a bit on the internet plugin to fetch some system proxy configuration in unix.

Since

- the plugin is external
- it loads gconf libraries using dlopen, so the libraries are not needed during compilation nor running
- if gconf library is not found, looks at the http-proxy and ftp-proxy env vars.

It should break nothing :P

But I'm not an expert :/.

What do you think?  Is it worth of integration?

Another option is to write this using FFI, but then I'm not so sure what should be part of the core and what not.  I.e. should FFI be part of the Core?
 

Guille

On Mon, Apr 9, 2012 at 4:38 PM, Guillermo Polito <[hidden email]> wrote:
ok,

I did this:
- configured the plugin as external
- created

CogFamilyUnixConfig>>configureInternetConfigPlugin: maker
    super configureInternetConfigPlugin: maker.
    maker addPlatformSources: #( 'sqUnixInternetConfiguration')

and put the file attached in /platforms/unix/plugins/InternetConfigPlugin.
I finally used dlopen to load gconf dinamically and check if it is available, and if it's not, I check the env vars with getenv().

If someone can do a little review, it would be nice :).

Guille


On Sun, Apr 8, 2012 at 9:55 PM, Guillermo Polito <[hidden email]> wrote:
Haha! :)

You won me :).  I was about to reply this:

"Ok, so I talked with Esteban today :).  And thanks to him I reached the conclussion that this plugin should be external."

I'll spend some hours tomorrow to finish it.

Now, as I think it happens with the ssl plugin... Where should we put the code and what should I in order to get it easily integrated in the ci buildings? :)

Thanks!
Guille


On Sun, Apr 8, 2012 at 9:46 PM, Igor Stasenko <[hidden email]> wrote:
On 7 April 2012 17:55, Guillermo Polito <[hidden email]> wrote:
> Was playing in my weekend on the InternetConfigPlugin for ubuntu.  And
> that's the problem :), It uses gnome2 stuff to access the system
> configuration (because gnome handles it's own configuration... :/).
>
> Now, I made it work doing something like this in vmmaker:
>
> CogFamilyUnixConfig>>configureInternetConfigPlugin: maker
>     "extra rules for InternetConfigPlugin"
>
>     super configureInternetConfigPlugin: maker.
>     maker addDefinitions: '`pkg-config --libs --cflags gtk+-2.0 gconf-2.0`'.
>     maker addExternalLibrary: '/usr/lib/libgconf-2.so.4'.
>     maker addPlatformSources: #( 'sqUnixInternetConfiguration.c').
>
> And adding it in the list of internal plugins for Unix.
>
> But this should only compile and work on a system with gconf and stuff
> installed :).
>
Then don't make this plugin internal, but external instead. Because if
library is missing,
VM will refuse to start. In contrast, if your plugin will be in
external module, then module will refuse to load
if lib is missing.

> So, how does or should vmmaker and vm building process handle something like
> this?
>

The philosophy of CMake configurations is to be concrete and without
conditionals. I.E. they should
not contain "if this, do this, if that do that" , instead if you have
such choice, one should make another configuration.

There is no way to predict how different is platform on which you
building VM  from platform where it used (especially in case of unix
systems and their numerous flavors). So, what is working on your OS,
could not work on another. That's why i don't see a point to put
conditionals in build process.

In contrast, if you have a concrete configuration, which says: if you
want to build me, you should have this, this and this, and if you want
to use the built artifact you should have this, this and this
installed, then it makes things much more predictable and
straightforward.


> Guille
>
> _______________________________________________
> VM-beginners mailing list
> [hidden email]
> http://lists.squeakfoundation.org/mailman/listinfo/vm-beginners
>

--
Best regards,
Igor Stasenko.





_______________________________________________
VM-beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/vm-beginners
Reply | Threaded
Open this post in threaded view
|

Re: [Pharo-project] InternetConfigPlugin for unix - [WAS]Tips to create a plugin with specific platform dependant stuff

Marcus Denker-4
In reply to this post by Guillermo Polito

On Apr 15, 2012, at 3:47 PM, Guillermo Polito wrote:

>
> Another option is to write this using FFI, but then I'm not so sure what should be part of the core and what not.  I.e. should FFI be part of the Core?
>  

Yes, it should be.

        Marcus


--
Marcus Denker -- http://marcusdenker.de

_______________________________________________
VM-beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/vm-beginners
Reply | Threaded
Open this post in threaded view
|

Re: InternetConfigPlugin for unix - [WAS]Tips to create a plugin with specific platform dependant stuff

Bert Freudenberg
In reply to this post by Guillermo Polito

On 15.04.2012, at 06:47, Guillermo Polito wrote:



On Sun, Apr 15, 2012 at 2:37 PM, Guillermo Polito <[hidden email]> wrote:
Bump :)

I've been working last week a bit on the internet plugin to fetch some system proxy configuration in unix.

Since

- the plugin is external
- it loads gconf libraries using dlopen, so the libraries are not needed during compilation nor running
- if gconf library is not found, looks at the http-proxy and ftp-proxy env vars.

It should break nothing :P

But I'm not an expert :/.

What do you think?  Is it worth of integration?

I have not looked at your code yet, but it sounds good.

Another option is to write this using FFI, but then I'm not so sure what should be part of the core and what not.  I.e. should FFI be part of the Core?

Not for Squeak. A plugin is the Right Thing because it abstracts over the platform differences. And since we have the Mac plugin already it just makes sense having on the other platforms too. Thanks for working on this!

- Bert -


Guille

On Mon, Apr 9, 2012 at 4:38 PM, Guillermo Polito <[hidden email]> wrote:
ok,

I did this:
- configured the plugin as external
- created

CogFamilyUnixConfig>>configureInternetConfigPlugin: maker
    super configureInternetConfigPlugin: maker.
    maker addPlatformSources: #( 'sqUnixInternetConfiguration')

and put the file attached in /platforms/unix/plugins/InternetConfigPlugin.
I finally used dlopen to load gconf dinamically and check if it is available, and if it's not, I check the env vars with getenv().

If someone can do a little review, it would be nice :).

Guille


On Sun, Apr 8, 2012 at 9:55 PM, Guillermo Polito <[hidden email]> wrote:
Haha! :)

You won me :).  I was about to reply this:

"Ok, so I talked with Esteban today :).  And thanks to him I reached the conclussion that this plugin should be external."

I'll spend some hours tomorrow to finish it.

Now, as I think it happens with the ssl plugin... Where should we put the code and what should I in order to get it easily integrated in the ci buildings? :)

Thanks!
Guille


On Sun, Apr 8, 2012 at 9:46 PM, Igor Stasenko <[hidden email]> wrote:
On 7 April 2012 17:55, Guillermo Polito <[hidden email]> wrote:
> Was playing in my weekend on the InternetConfigPlugin for ubuntu.  And
> that's the problem :), It uses gnome2 stuff to access the system
> configuration (because gnome handles it's own configuration... :/).
>
> Now, I made it work doing something like this in vmmaker:
>
> CogFamilyUnixConfig>>configureInternetConfigPlugin: maker
>     "extra rules for InternetConfigPlugin"
>
>     super configureInternetConfigPlugin: maker.
>     maker addDefinitions: '`pkg-config --libs --cflags gtk+-2.0 gconf-2.0`'.
>     maker addExternalLibrary: '/usr/lib/libgconf-2.so.4'.
>     maker addPlatformSources: #( 'sqUnixInternetConfiguration.c').
>
> And adding it in the list of internal plugins for Unix.
>
> But this should only compile and work on a system with gconf and stuff
> installed :).
>
Then don't make this plugin internal, but external instead. Because if
library is missing,
VM will refuse to start. In contrast, if your plugin will be in
external module, then module will refuse to load
if lib is missing.

> So, how does or should vmmaker and vm building process handle something like
> this?
>

The philosophy of CMake configurations is to be concrete and without
conditionals. I.E. they should
not contain "if this, do this, if that do that" , instead if you have
such choice, one should make another configuration.

There is no way to predict how different is platform on which you
building VM  from platform where it used (especially in case of unix
systems and their numerous flavors). So, what is working on your OS,
could not work on another. That's why i don't see a point to put
conditionals in build process.

In contrast, if you have a concrete configuration, which says: if you
want to build me, you should have this, this and this, and if you want
to use the built artifact you should have this, this and this
installed, then it makes things much more predictable and
straightforward.


> Guille
>
> _______________________________________________
> VM-beginners mailing list
> [hidden email]
> http://lists.squeakfoundation.org/mailman/listinfo/vm-beginners
>

--
Best regards,
Igor Stasenko.




_______________________________________________
VM-beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/vm-beginners



_______________________________________________
VM-beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/vm-beginners