Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 518104 - dev-libs/mongo-cxx-driver - split off C++ client driver from dev-db/mongodb
Summary: dev-libs/mongo-cxx-driver - split off C++ client driver from dev-db/mongodb
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: Normal enhancement (vote)
Assignee: Ultrabug
URL: https://github.com/mongodb/mongo-cxx-...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-07-25 14:57 UTC by Balint SZENTE
Modified: 2015-03-26 08:41 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
dev-libs/mongo-cxx-driver-2.4.10-r1.ebuild (mongo-cxx-driver-2.4.10-r1.ebuild,2.07 KB, text/plain)
2014-07-28 14:41 UTC, Balint SZENTE
Details
dev-libs/mongo-cxx-driver-2.6.3.ebuild (mongo-cxx-driver-2.6.3.ebuild,2.01 KB, text/plain)
2014-07-29 09:05 UTC, Balint SZENTE
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Balint SZENTE 2014-07-25 14:57:09 UTC
Currently dev-db/mongodb installs both the whole server and the C++ driver library and header files. These should be split in two, like in case of any other database systems, because it is not always necessary both of them.

Upstream split already the C++ driver and server packages starting from version 2.6: http://blog.mongodb.org/post/78478565493/upcoming-changes-to-the-mongodb-cpp-driver
So we should adopt this schema as well.

I propose to have two ebuilds:

1. dev-db/mongodb - only for server, mongo client, init scripts etc
2. dev-db/mongo-cxx-driver - just libmongoclient{.so,.a} + header files for version 2.4 and newer

To keep backward compatibility (with the current situation), mongodb should depend on mongo-cxx-driver for other ebuilds that assumes mongodb will install the C++ driver as well. Starting with mongodb 2.8, this dependency will be possible to remove.

Reproducible: Always
Comment 1 Balint SZENTE 2014-07-25 14:59:40 UTC
I'm sorry, I meant to say 'dev-libs/mongo-cxx-driver' for the second ebuild and not 'dev-db'.
Comment 2 Johan Bergström 2014-07-28 11:32:05 UTC
I've been looking at this for a while. It still runs scons and is kind of ugly compared to the c driver we already have in tree (see dev-db/mongo-c-driver). We'll probably end up adding it at some point, but I don't see any consumers as of yet. If you want to help speed up the progress, feel free to pass an ebuild!

thanks.
Comment 3 Balint SZENTE 2014-07-28 14:41:34 UTC
Created attachment 381724 [details]
dev-libs/mongo-cxx-driver-2.4.10-r1.ebuild

Please find attached the working ebuild for v2.4 that installs only the C++ driver with the header files. I basically stripped down and cleaned up the mongodb ebuild and changed the targets according to the official wiki:
<https://github.com/mongodb/mongo-cxx-driver/wiki/Download%20and%20Compile>

By default it installs the static libs (as recommended upstream), but the ebuild supports the sharedclient use flag es well.
Comment 4 Balint SZENTE 2014-07-28 14:46:50 UTC
I will do also the ebuild for 2.6.x as well, but later. Basically it will be mostly the same, but the tarbal must be taken from the GitHub, releases of the "26compat" branch.

For the upcomming 2.8 release we will have to use the "legacy" branch.
Comment 5 Balint SZENTE 2014-07-29 09:05:00 UTC
Created attachment 381774 [details]
dev-libs/mongo-cxx-driver-2.6.3.ebuild
Comment 6 Balint SZENTE 2014-07-29 09:11:57 UTC
Please review the two ebuilds and add them to the portage.


* An important note:

You should remove the "--full" option from "src_install()" in the dev-db/mongodb ebuilds, in order to prevent installing of header files and libraries.
Comment 7 Ultrabug gentoo-dev 2015-03-17 11:18:10 UTC
Okay I'm glad to close this bug as my work on mongo-3.0.0 release is coming to an end.

*mongo-cxx-driver-1.0.0 (17 Mar 2015)

  17 Mar 2015; Ultrabug <ultrabug@gentoo.org> +mongo-cxx-driver-1.0.0.ebuild,
  +files/mongo-cxx-driver-1.0.0-fix-scons.patch, +metadata.xml:
  new ebuild dev-libs/mongo-cxx-driver
Comment 8 Balint SZENTE 2015-03-17 12:36:30 UTC
Do you know whether mongo-cxx-driver-1.0.0 is compatible with mongo server 2.6.x? If it is not compatible, than adding mongo-cxx-driver-2.6.x ebuild to the portage would be necessary, because IIRC mongodb-2.6.x does not build the c++ driver anymore. Thanks.
Comment 9 Ultrabug gentoo-dev 2015-03-17 12:43:04 UTC
(In reply to Balint SZENTE from comment #8)
> Do you know whether mongo-cxx-driver-1.0.0 is compatible with mongo server
> 2.6.x? If it is not compatible, than adding mongo-cxx-driver-2.6.x ebuild to
> the portage would be necessary, because IIRC mongodb-2.6.x does not build
> the c++ driver anymore. Thanks.

https://github.com/mongodb/mongo-cxx-driver/wiki/Breaking%20changes%20between%2026compat%20and%20legacy

Looks like it's (just) a matter of branch mate instead. Maybe you could just try out the current 1.0.0 and see if it works plz ?
Comment 10 Balint SZENTE 2015-03-18 15:30:38 UTC
Unfortunately there are API breaks (renamed functions, types etc.). So legacy-1.0.0 is not really an in place replacement for 26compat-2.6.7. Projects that use(d) <=2.6.7 driver must be updated to compile with legacy-1.0.0.

For this reason, it would be necessary to add the 26compat-2.6.7 driver as well, because the main mongodb-2.6.7 package does not install the header files and the libmongoclient anymore. And 2.6.x will stay for a while, I guess.

Bumping the 2.6.3 ebuild works for me. Perhaps it would be better to:
1. use the mongo-cxx-driver-0.0-26compat-2.6.7.ebuild file name
2. change the sharedclient USE flag to static-libs, to be in concordance with 1.0.0

Could you please add this ebuild to the portage?
Comment 11 Ultrabug gentoo-dev 2015-03-23 09:52:42 UTC
(In reply to Balint SZENTE from comment #10)
> Could you please add this ebuild to the portage?

done, mate ;)

+*mongo-cxx-driver-0.0.2.6.7 (23 Mar 2015)
+
+  23 Mar 2015; Ultrabug <ultrabug@gentoo.org>
+  +mongo-cxx-driver-0.0.2.6.7.ebuild,
+  +files/mongo-cxx-driver-26compat-fix-scons.patch:
+  add 26compat branch ebuild thx to Balint SZENTE fix #518104
+
Comment 12 Balint SZENTE 2015-03-23 10:40:41 UTC
I think there is a typo in the ebuild at the following condition:

if use static-libs; then
        scons_opts+=" --sharedclient"

Should be:

if ! use static-libs; then

You changed the use flag, but forgot to negate the condition.
Could you please check it? Thanks!
Comment 13 Balint SZENTE 2015-03-23 11:04:04 UTC
I found other issues as well:

1. dev-libs/snowball-stemmer and net-libs/libpcap dependencies are not required. They are necessary only for the server. Adding this two package to /etc/portage/profile/package.provided does not prevent the package to compile.

2. The else branch of the pkg_preinst() function actually deletes the libs. On my system NO libmongoclient.{a,so} is installed (with USE="ssl -kerberos -static-libs").

Can you please check these issues as well? Thank you.
Comment 14 Ultrabug gentoo-dev 2015-03-23 11:07:49 UTC
(In reply to Balint SZENTE from comment #13)
> I found other issues as well:
> 
> 1. dev-libs/snowball-stemmer and net-libs/libpcap dependencies are not
> required. They are necessary only for the server. Adding this two package to
> /etc/portage/profile/package.provided does not prevent the package to
> compile.
> 

Compile no indeed, but I could not tell if it was required at runtime tho ?

I added it because it seems it's used during compilation if I dont set the use-system-stemmer flag (its then using third party provided one)

> 2. The else branch of the pkg_preinst() function actually deletes the libs.
> On my system NO libmongoclient.{a,so} is installed (with USE="ssl -kerberos
> -static-libs").
> 
> Can you please check these issues as well? Thank you.

I'll look into it, sorry
Comment 15 Ultrabug gentoo-dev 2015-03-23 11:28:03 UTC
(In reply to Balint SZENTE from comment #13)
> 2. The else branch of the pkg_preinst() function actually deletes the libs.
> On my system NO libmongoclient.{a,so} is installed (with USE="ssl -kerberos
> -static-libs").
> 
> Can you please check these issues as well? Thank you.

fixed, no revbump fyi
Comment 16 Balint SZENTE 2015-03-24 11:51:14 UTC
(In reply to Ultrabug from comment #14)
> (In reply to Balint SZENTE from comment #13)
> > 1. dev-libs/snowball-stemmer and net-libs/libpcap dependencies are not
> > required. They are necessary only for the server. Adding this two package to
> > /etc/portage/profile/package.provided does not prevent the package to
> > compile.
> > 
> 
> Compile no indeed, but I could not tell if it was required at runtime tho ?
> 
> I added it because it seems it's used during compilation if I dont set the
> use-system-stemmer flag (its then using third party provided one)

I checked the source code for dependencies:

* dev-libs/snowball-stemmer: used only for mongod server (mongodb:/src/mongo/db/fts), not used in client. You can safely enable/disable system-stemmer, it does not have any effect on the C++ driver. Stemmer is not present in the mongo-cxx-driver source code.

* net-libs/libpcap: used only for mongosniff, tool i.e. only for the mongodb package (mongodb:/src/mongo/tools). It is not used in mongo-cxx-driver at all.

SConscript file is the one borrowed from the mongodb package, and it was not cleaned up from unnecessary things.

So in my opinion it is safe to remove these two dependencies, as they are not used in any way in the C++ driver, so we can keep dependencies at the minimum.

Could you please confirm this? Thanks.
Comment 17 Ultrabug gentoo-dev 2015-03-24 17:26:21 UTC
(In reply to Balint SZENTE from comment #16)
> (In reply to Ultrabug from comment #14)
> > (In reply to Balint SZENTE from comment #13)
> > > 1. dev-libs/snowball-stemmer and net-libs/libpcap dependencies are not
> > > required. They are necessary only for the server. Adding this two package to
> > > /etc/portage/profile/package.provided does not prevent the package to
> > > compile.
> > > 
> > 
> > Compile no indeed, but I could not tell if it was required at runtime tho ?
> > 
> > I added it because it seems it's used during compilation if I dont set the
> > use-system-stemmer flag (its then using third party provided one)
> 
> I checked the source code for dependencies:
> 
> * dev-libs/snowball-stemmer: used only for mongod server
> (mongodb:/src/mongo/db/fts), not used in client. You can safely
> enable/disable system-stemmer, it does not have any effect on the C++
> driver. Stemmer is not present in the mongo-cxx-driver source code.
> 
> * net-libs/libpcap: used only for mongosniff, tool i.e. only for the mongodb
> package (mongodb:/src/mongo/tools). It is not used in mongo-cxx-driver at
> all.
> 
> SConscript file is the one borrowed from the mongodb package, and it was not
> cleaned up from unnecessary things.
> 
> So in my opinion it is safe to remove these two dependencies, as they are
> not used in any way in the C++ driver, so we can keep dependencies at the
> minimum.
> 
> Could you please confirm this? Thanks.

Yes, ok. So I stripped them from the SConstruct for QA and revbumped.

+*mongo-cxx-driver-0.0.2.6.7-r1 (24 Mar 2015)
+
+  24 Mar 2015; Ultrabug <ultrabug@gentoo.org>
+  -mongo-cxx-driver-0.0.2.6.7.ebuild, +mongo-cxx-driver-0.0.2.6.7-r1.ebuild:
+  strip useless deps on compat26 ebuild thx to Balint SZENTE
+
Comment 18 Balint SZENTE 2015-03-26 08:32:19 UTC
There is one last unused dependency, that I overlooked in your ebuild: dev-cpp/yaml-cpp
It is used only for compiling the server, the C++ Driver does not use it.

Please excuse me, for not observing this earlier. I realize it is annoying to fix the ebuild so often, but could you please remove this as well to keep the ebuild "clean"? Thank you very much for your work!
Comment 19 Balint SZENTE 2015-03-26 08:41:06 UTC
(In reply to Balint SZENTE from comment #18)
> There is one last unused dependency, that I overlooked in your ebuild:
> dev-cpp/yaml-cpp
> It is used only for compiling the server, the C++ Driver does not use it.
> 
> Please excuse me, for not observing this earlier. I realize it is annoying
> to fix the ebuild so often, but could you please remove this as well to keep
> the ebuild "clean"? Thank you very much for your work!

And this line should be deleted as well:
    scons_opts+=" --use-system-yaml"

I'm not sure about the yaml sed command in prepare, but I guess it is not necessary as well.

Thanks!