Skip to contentSkip to conversation

gtest: retrieve package from github

PATCH Superseded Fabrice Fontaine 4 participants 10 messages Aug 31, 2016 – Sep 8, 2016 1 message not in the archive

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 6/6 gtest: retrieve package from github

https://googletest.googlecode.com/files is no more available, so update gtest.mk and gtest.hash to retrieve googletest source code as a tar.gz (and not a zip) from github as https://googletest.googlecode.com is now a redirection to https://github.com/google/googletest.

---
 package/gtest/gtest.hash | 4 ++--
 package/gtest/gtest.mk   | 9 ++-------
 2 files changed, 4 insertions(+), 9 deletions(-)
package/gtest/gtest.hash +2 -2
index 8ff79cb..79e31e4 100644
@@ -1,2 +1,2 @@
-# From http://code.google.com/p/googletest/downloads/detail?name=gtest-1.7.0.zip&can=2&q=
-sha1	f85f6d2481e2c6c4a18539e391aa4ea8ab0394af	gtest-1.7.0.zip
+# Locally computed:
+sha256	f73a6546fdf9fce9ff93a5015e0333a8af3062a152a9ad6bcb772c96687016cc	gtest-release-1.7.0.tar.gz
package/gtest/gtest.mk +2 -7
index 11aa7e9..eb30905 100644
@@ -5,9 +5,8 @@
 ################################################################################
 
 # Make sure this remains the same version as the gmock one
-GTEST_VERSION = 1.7.0
-GTEST_SOURCE = gtest-$(GTEST_VERSION).zip
-GTEST_SITE = http://googletest.googlecode.com/files
+GTEST_VERSION = release-1.7.0
+GTEST_SITE = $(call github,google,googletest,$(GTEST_VERSION))
 GTEST_INSTALL_STAGING = YES
 GTEST_INSTALL_TARGET = NO
 GTEST_LICENSE = BSD-3c
@@ -22,10 +21,6 @@ GTEST_LICENSE_FILES = LICENSE
 # the gtest sources.
 GTEST_CONF_OPTS = -DBUILD_SHARED_LIBS=OFF
 
-define GTEST_EXTRACT_CMDS
-	$(UNZIP) $(DL_DIR)/$(GTEST_SOURCE) -d $(BUILD_DIR)
-endef
-
 define GTEST_INSTALL_STAGING_CMDS
 	$(INSTALL) -D -m 0755 $(@D)/libgtest.a $(STAGING_DIR)/usr/lib/libgtest.a
 	$(INSTALL) -D -m 0755 $(@D)/libgtest_main.a $(STAGING_DIR)/usr/lib/libgtest_main.a
Signature · 1 line
2.7.4
#1 lore raw

PATCH 6/6 gtest: retrieve package from github

Quoted 53 lines

From: "Fabrice Fontaine" <[email protected]>
To: buildroot at buildroot.org
Cc: "Fabrice Fontaine" <[email protected]>
Sent: Wednesday, August 31, 2016 1:24:56 PM
Subject: [Buildroot] [PATCH 6/6] gtest: retrieve package from github

https://googletest.googlecode.com/files is no more available, so update gtest.mk and gtest.hash to retrieve googletest source code as a tar.gz (and not a zip) from github as https://googletest.googlecode.com is now a redirection to https://github.com/google/googletest.

---
package/gtest/gtest.hash | 4 ++--
package/gtest/gtest.mk | 9 ++-------

2 files changed, 4 insertions(+), 9 deletions(-)
package/gtest/gtest.hash +0 -1
index 8ff79cb..79e31e4 100644
@@ -1,2 +1,2 @@
-# From

http://code.google.com/p/googletest/downloads/detail?name=gtest-1.7.0.zip&can=2&q=

package/gtest/gtest.hash +2 -1
-sha1	f85f6d2481e2c6c4a18539e391aa4ea8ab0394af	gtest-1.7.0.zip
+# Locally computed:
+sha256	f73a6546fdf9fce9ff93a5015e0333a8af3062a152a9ad6bcb772c96687016cc
	gtest-release-1.7.0.tar.gz
package/gtest/gtest.mk +2 -3
index 11aa7e9..eb30905 100644
@@ -5,9 +5,8 @@
 ################################################################################
 
 # Make sure this remains the same version as the gmock one
-GTEST_VERSION = 1.7.0
-GTEST_SOURCE = gtest-$(GTEST_VERSION).zip
-GTEST_SITE = http://googletest.googlecode.com/files
+GTEST_VERSION = release-1.7.0
+GTEST_SITE = $(call github,google,googletest,$(GTEST_VERSION))

GTEST_INSTALL_STAGING = YES
GTEST_INSTALL_TARGET = NO
GTEST_LICENSE = BSD-3c

package/gtest/gtest.mk +0 -0
@@ -22,10 +21,6 @@ GTEST_LICENSE_FILES = LICENSE
 # the gtest sources.

GTEST_CONF_OPTS = -DBUILD_SHARED_LIBS=OFF

package/gtest/gtest.mk +0 -4
-define GTEST_EXTRACT_CMDS
-	$(UNZIP) $(DL_DIR)/$(GTEST_SOURCE) -d $(BUILD_DIR)
-endef
-

define GTEST_INSTALL_STAGING_CMDS

Quoted 5 lines
	$(INSTALL) -D -m 0755 $(@D)/libgtest.a $(STAGING_DIR)/usr/lib/libgtest.a
	$(INSTALL) -D -m 0755 $(@D)/libgtest_main.a
	$(STAGING_DIR)/usr/lib/libgtest_main.a

--
2.7.4

GMock needs to be fixed too. I attempted to do this before (http://patchwork.ozlabs.org/patch/586130/) but it was refused, unfortunately.

Carlos Santos (Casantos)
DATACOM, P&D

#2 lore raw

PATCH 6/6 gtest: retrieve package from github

Quoted 12 lines · Carlos Santos
Quoted 12 lines

From: "Fabrice Fontaine" <[email protected]>
To: buildroot at buildroot.org
Cc: "Fabrice Fontaine" <[email protected]>
Sent: Wednesday, August 31, 2016 1:24:56 PM
Subject: [Buildroot] [PATCH 6/6] gtest: retrieve package from github

https://googletest.googlecode.com/files is no more available, so update gtest.mk and gtest.hash to retrieve googletest source code as a tar.gz (and not a zip) from github as https://googletest.googlecode.com is now a redirection to https://github.com/google/googletest.

[snip]

Quoted 1 line

GMock needs to be fixed too. I attempted to do this before (http://patchwork.ozlabs.org/patch/586130/) but it was refused, unfortunately.

Quoting Yann from that patchwork entry:

Quoted 5 lines

As I understand it, gtest and gmock are being phased out as separate packages, and are to be replaced with the googletest package.

So why don't we directly add "googletest" and get rid of gtest and gmock, rather than fix them to eventually get rid of them?

In that contet, I think it's a sane idea to have this commit as a first step,
and do the bump to v1.8.0 (which implies merging gtest and gmock) in a second step.

Fabrice, care to work on that? If you do, here are some tips:

- GMOCK should become a suboption of GTEST: BR2_PACKAGE_GTEST_GMOCK.
- A legacy entry should be added for it.
- gmock now has a usable cmake and builds gtest implicitly.
- host-gmock is tricky - but perhaps it's no longer needed.

Regards,
Arnout

Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF

A message that is not in the archive (sent off-list or not yet received): 29481_1473259225_57D026D9_29481_7433_1_EEB3FED4859B6C488DDDEC4B2D3DE92B0FCC280F@OPEXCLILM23.corporate.adroot.infra.ftgroup

#4 lore raw

PATCH 6/6 gtest: retrieve package from github

Quoted 7 lines

From: "fabrice fontaine" <[email protected]>
To: "Arnout Vandecappelle" <[email protected]>, "Carlos Santos" <[email protected]>, "Fabrice Fontaine" <[email protected]>
Cc: buildroot at buildroot.org
Sent: Wednesday, September 7, 2016 11:40:24 AM
Subject: RE: [Buildroot] [PATCH 6/6] gtest: retrieve package from github

Quoted 6 lines

Dear Arnout,

I sent a new patch merging gmock inside gtest.
However, I did not quite understand what is a "legacy entry", did you mean that we should keep a package/gmock/Config.in with a BR2_PACKAGE_GMOCK that should enable BR2_PACKAGE_GTEST_GMOCK?

A legacy entry would be an entry in Config.in.legacy, Read the description at the beginning of that file.

Carlos Santos (Casantos)
DATACOM, P&D

#5 lore raw

PATCH 6/6 gtest: retrieve package from github

In reply to Arnout Vandecappelle
Quoted 27 lines

From: "Arnout Vandecappelle" <[email protected]>
To: "Carlos Santos" <[email protected]>, "Fabrice Fontaine" <[email protected]>
Cc: "Fabrice Fontaine" <[email protected]>, buildroot at buildroot.org
Sent: Tuesday, September 6, 2016 5:40:58 PM
Subject: Re: [Buildroot] [PATCH 6/6] gtest: retrieve package from github

Quoted 12 lines · Carlos Santos
Quoted 12 lines

From: "Fabrice Fontaine" <[email protected]>
To: buildroot at buildroot.org
Cc: "Fabrice Fontaine" <[email protected]>
Sent: Wednesday, August 31, 2016 1:24:56 PM
Subject: [Buildroot] [PATCH 6/6] gtest: retrieve package from github

https://googletest.googlecode.com/files is no more available, so update gtest.mk and gtest.hash to retrieve googletest source code as a tar.gz (and not a zip) from github as https://googletest.googlecode.com is now a redirection to https://github.com/google/googletest.

[snip]

Quoted 2 lines

GMock needs to be fixed too. I attempted to do this before
(http://patchwork.ozlabs.org/patch/586130/) but it was refused, unfortunately.

Quoting Yann from that patchwork entry:

Quoted 3 lines

As I understand it, gtest and gmock are being phased out as separate packages, and are to be replaced with the googletest package.

Quoted 6 lines
Quoted 2 lines

So why don't we directly add "googletest" and get rid of gtest and gmock, rather than fix them to eventually get rid of them?

In that contet, I think it's a sane idea to have this commit as a first step, and do the bump to v1.8.0 (which implies merging gtest and gmock) in a second step.

It can be done, even though I don't think it's really necessary to do this.

Quoted 6 lines

Fabrice, care to work on that? If you do, here are some tips:

- GMOCK should become a suboption of GTEST: BR2_PACKAGE_GTEST_GMOCK.
- A legacy entry should be added for it.
- gmock now has a usable cmake and builds gtest implicitly.
- host-gmock is tricky - but perhaps it's no longer needed.

I just sent an updated patch with a proposed solution for the gmock host-gmock packages using virtual packages, so no legacy entry is necessary.

Carlos Santos (Casantos)
DATACOM, P&D

#6 lore raw

PATCH 1/1 gmock: download from github and convert to a cmake-package

https://googlemock.googlecode.com/files is no more available, so update gmock.mk and gmock.hash to retrieve googlemock source code as a tar.gz (and not a zip) from github as https://googlemock.googlecode.com is now a redirection to https://github.com/google/googlemock.

The new tarball does not contain autotools stuff, so gmock was converted to a cmake package, using a trick to find the gtest build directory. It would be possible to extract the gtest source in the gmock directory or somewhere under $(STAGING_DIR) but this trick would be even uglier.

Based on the work by Fabrice Fontaine on gtest and on comments made by Thomas Petazzoni and Arnout Vandecappelle.

---
 package/gmock/0001-force-use-python2.patch |  4 ++--
 package/gmock/0002-fix-gtest-path.patch    | 15 ++++++++++++
 package/gmock/Config.in                    |  2 +-
 package/gmock/gmock.hash                   |  2 +-
 package/gmock/gmock.mk                     | 37 +++++++++++-------------------
 5 files changed, 32 insertions(+), 28 deletions(-)
 create mode 100644 package/gmock/0002-fix-gtest-path.patch
package/gmock/0001-force-use-python2.patch +2 -2
index 5dcb231..12f7c23 100644
@@ -2,8 +2,8 @@ Force use of Python 2 even when Python 3 is the default Python interpreter.
 
 Signed-off-by: Carlos Santos <[email protected]>
 
---- ./gtest/scripts/fuse_gtest_files.py.orig	2013-09-18 14:48:30.000000000 -0300
-+++ ./gtest/scripts/fuse_gtest_files.py	2015-07-22 15:42:53.291591205 -0300
+--- ./scripts/fuse_gmock_files.py.orig	2013-09-18 14:48:30.000000000 -0300
++++ ./scripts/fuse_gmock_files.py	2015-07-22 15:42:53.291591205 -0300
 @@ -1,4 +1,4 @@
 -#!/usr/bin/env python
 +#!/usr/bin/env python2
package/gmock/0002-fix-gtest-path.patch new file +15 -0
new file mode 100644
index 0000000..4314270
@@ -0,0 +1,15 @@
+Help the GMock build to locate the GTest source code
+
+Signed-off-by: Carlos Santos <[email protected]>
+
+--- ./CMakeLists.txt.orig	2013-09-18 21:32:04.000000000 -0300
++++ ./CMakeLists.txt	2016-09-08 11:10:51.519780433 -0300
+@@ -15,7 +15,7 @@
+ if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/gtest/CMakeLists.txt")
+   set(gtest_dir gtest)
+ else()
+-  set(gtest_dir ../gtest)
++  set(gtest_dir ../gtest-${GTEST_VERSION})
+ endif()
+ 
+ # Defines pre_project_set_up_hermetic_build() and set_up_hermetic_build().
package/gmock/Config.in +1 -1
index ec3eb92..895fbc9 100644
@@ -20,7 +20,7 @@ config BR2_PACKAGE_GMOCK
 	    * works on Linux, Mac OS X, Windows, Windows Mobile, minGW, and
 	      Symbian.
 
-	    http://code.google.com/p/googlemock/
+	    https://github.com/google/googlemock/
 
 	  There are both host and target packages. The target one has include
 	  files required to compile the tests and the static libraries required
package/gmock/gmock.hash +1 -1
index 2b71739..5f9befc 100644
@@ -1,2 +1,2 @@
 # Locally computed
-sha256 26fcbb5925b74ad5fc8c26b0495dfc96353f4d553492eb97e85a8a6d2f43095b  gmock-1.7.0.zip
+sha256 3f20b6acb37e5a98e8c4518165711e3e35d47deb6cdb5a4dd4566563b5efd232  gmock-release-1.7.0.tar.gz
package/gmock/gmock.mk +13 -24
index 4f04422..e317e91 100644
@@ -5,9 +5,8 @@
 ################################################################################
 
 # Make sure this remains the same version as the gtest one
-GMOCK_VERSION = 1.7.0
-GMOCK_SOURCE = gmock-$(GMOCK_VERSION).zip
-GMOCK_SITE = http://googlemock.googlecode.com/files
+GMOCK_VERSION = release-1.7.0
+GMOCK_SITE = $(call github,google,googlemock,$(GMOCK_VERSION))
 GMOCK_INSTALL_STAGING = YES
 GMOCK_INSTALL_TARGET = NO
 GMOCK_LICENSE = BSD-3c
@@ -24,41 +23,31 @@ HOST_GMOCK_PYTHONPATH=$(HOST_DIR)/usr/lib/python$(PYTHON_VERSION_MAJOR)/site-pac
 #   "Google Mock can be used as a DLL, but the same DLL must contain Google
 #    Test as well.  See Google Test's README file for instructions on how to
 #    set up necessary compiler settings".
-GMOCK_CONF_OPTS = --enable-static --disable-shared
+GMOCK_CONF_OPTS = -DBUILD_SHARED_LIBS=OFF
 
-define GMOCK_EXTRACT_CMDS
-	$(UNZIP) $(DL_DIR)/$(GMOCK_SOURCE) -d $(BUILD_DIR)
-endef
+# This is used to help the GMock build to find the GTest source code. Passing
+# GTEST_VERSION covers the case in which GTEST_OVERRIDE_SRCDIR is set, because
+# GTEST_VERSION will be "custom" instead of "release-1.7.0".
+GMOCK_CONF_OPTS += -DGTEST_VERSION=$(GTEST_VERSION)
 
-# We can't use the default rule for autotools-package staging because it fails
-# because it tries to rebuild/install gtest stuff and fails after this error:
-#    "'make install' is dangerous and not supported. Instead, see README for
-#      how to integrate Google Test into your build system."
+# We can't use the default install rule for cmake-package because there is no
+# 'install' target in the CMake-based build.
 define GMOCK_INSTALL_STAGING_CMDS
-	$(INSTALL) -D -m 0755 $(@D)/lib/.libs/libgmock.a $(STAGING_DIR)/usr/lib/libgmock.a
-	$(INSTALL) -D -m 0755 $(@D)/lib/.libs/libgmock_main.a $(STAGING_DIR)/usr/lib/libgmock_main.a
+	$(INSTALL) -D -m 0755 $(@D)/libgmock.a $(STAGING_DIR)/usr/lib/libgmock.a
+	$(INSTALL) -D -m 0755 $(@D)/libgmock_main.a $(STAGING_DIR)/usr/lib/libgmock_main.a
 	$(INSTALL) -d -m 0755 $(STAGING_DIR)/usr/include/gmock/
 	cp -rp $(@D)/include/gmock/* $(STAGING_DIR)/usr/include/gmock/
 	$(INSTALL) -D -m 0755 package/gmock/gmock.pc \
 		$(STAGING_DIR)/usr/lib/pkgconfig/gmock.pc
 endef
 
-# Unzipping inside $(@D) and moving everything from the created subdirectory is
-# required because unzipping directly in $(BUILD_DIR) would cause host-gmock to
-# overwrite the gmock subdir instead of unzipping in a host-gmock subdir.
-define HOST_GMOCK_EXTRACT_CMDS
-	$(UNZIP) $(DL_DIR)/$(GMOCK_SOURCE) -d $(@D)
-	mv $(@D)/gmock-$(GMOCK_VERSION)/* $(@D)
-	rmdir $(@D)/gmock-$(GMOCK_VERSION)
-endef
-
 define HOST_GMOCK_INSTALL_CMDS
 	$(INSTALL) -D -m 0755 $(@D)/scripts/generator/gmock_gen.py $(HOST_DIR)/usr/bin/gmock_gen.py
 	ln -sf gmock_gen.py $(HOST_DIR)/usr/bin/gmock_gen
 	cp -rp $(@D)/scripts/generator/cpp $(HOST_GMOCK_PYTHONPATH)
 endef
 
-$(eval $(autotools-package))
+$(eval $(cmake-package))
 # The host package does not build anything, just installs gmock_gen stuff, so
-# it does not need to be a host-autotools-package.
+# it does not need to be a host-cmake-package.
 $(eval $(host-generic-package))
Signature · 1 line
2.7.4
#7 lore raw

PATCH 1/1 gmock: download from github and convert to a cmake-package

Hello,

Quoted 8 lines · Carlos Santos

+--- ./CMakeLists.txt.orig 2013-09-18 21:32:04.000000000 -0300
++++ ./CMakeLists.txt 2016-09-08 11:10:51.519780433 -0300
+@@ -15,7 +15,7 @@
+ if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/gtest/CMakeLists.txt")
+ set(gtest_dir gtest)
+ else()

+-  set(gtest_dir ../gtest)
++  set(gtest_dir ../gtest-${GTEST_VERSION})

So you make the assumption that you have the following code organization:

output/build/gmock-1.7.0
output/build/gtest-1.7.0

i.e, during its build process, gmock needs to access the gtest source code?

Why is it the case? As far as I'm aware, it's not currently the case with the existing packaging.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
#8 lore raw

PATCH 1/1 gmock: download from github and convert to a cmake-package

Quoted 20 lines

From: "Thomas Petazzoni" <[email protected]>
To: "Carlos Santos" <[email protected]>
Cc: buildroot at buildroot.org, "fabrice fontaine" <[email protected]>, "fontaine fabrice" <[email protected]>
Sent: Thursday, September 8, 2016 4:20:33 PM
Subject: Re: [Buildroot] [PATCH] gmock: download from github and convert to a cmake-package

Hello,

Quoted 8 lines · Carlos Santos

+--- ./CMakeLists.txt.orig 2013-09-18 21:32:04.000000000 -0300
++++ ./CMakeLists.txt 2016-09-08 11:10:51.519780433 -0300
+@@ -15,7 +15,7 @@
+ if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/gtest/CMakeLists.txt")
+ set(gtest_dir gtest)
+ else()

+-  set(gtest_dir ../gtest)
++  set(gtest_dir ../gtest-${GTEST_VERSION})
Quoted 8 lines

So you make the assumption that you have the following code organization:

output/build/gmock-1.7.0
output/build/gtest-1.7.0

i.e, during its build process, gmock needs to access the gtest source code?

Right.

Quoted 2 lines

Why is it the case? As far as I'm aware, it's not currently the case with the existing packaging.

Because the old gmock distribution (gmock-1.7.0.zip) contained the gtest code, while the new one (gmock-release-1.7.0.tar.gz) does not.

Carlos Santos (Casantos)
DATACOM, P&D

#9 lore raw

PATCH 1/1 gmock: download from github and convert to a cmake-package

Hello,

Quoted 5 lines · Carlos Santos
Quoted 2 lines

Why is it the case? As far as I'm aware, it's not currently the case with the existing packaging.

Because the old gmock distribution (gmock-1.7.0.zip) contained the gtest code, while the new one (gmock-release-1.7.0.tar.gz) does not.

If the old gmock distribution contained the gtest code, why do we have two separate packages for gmock and gtest ?

In any case, I guess this is a transitional solution, since the final goal is to have a single package, right ?

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
#10 lore raw

PATCH 1/1 gmock: download from github and convert to a cmake-package

Quoted 11 lines

From: "Thomas Petazzoni" <[email protected]>
To: "Carlos Santos" <[email protected]>
Cc: "fabrice fontaine" <[email protected]>, "fontaine fabrice" <[email protected]>, buildroot at buildroot.org
Sent: Thursday, September 8, 2016 5:14:32 PM
Subject: Re: [Buildroot] [PATCH] gmock: download from github and convert to a cmake-package

Hello,

On Thu, 8 Sep 2016 17:11:48 -0300 (BRT), Carlos Santos wrote:

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

Why is it the case? As far as I'm aware, it's not currently the case with the existing packaging.

Because the old gmock distribution (gmock-1.7.0.zip) contained the gtest code, while the new one (gmock-release-1.7.0.tar.gz) does not.

If the old gmock distribution contained the gtest code, why do we have two separate packages for gmock and gtest ?

In the beginning there was gtest, only. We (DATACOM) added gmock last year, due to the need to support more than a hundred packages in which we use it to run unit tests.

Quoted 2 lines

In any case, I guess this is a transitional solution, since the final goal is to have a single package, right ?

Yes, I think that starting in gtest v. 1.8.0 it will be possible to get rid of the separated packages.

Carlos Santos (Casantos)
DATACOM, P&D