Re: Build chromedriver when building chrome

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: Build chromedriver when building chrome

Jeremy Evans-5
On 11/04 06:18, Jeremy Evans wrote:

> This builds chromedriver when building chrome.  chromedriver is
> chrome's implementation of the WebDriver protocol, which allows
> for driving chrome via external software.  Most commonly this
> is used in automated testing, often with Selenium, which supports
> many different browsers and programming languages.
>
> chromedriver is about 10MB uncompressed, and considering the size
> of the chrome package, I don't think it is worth it to subpackage.
>
> Tested on amd64 using ruby with the capybara and selenium-webdriver
> libraries.  With only minor modifications to a test suite designed
> for capybara-webkit, chromedriver was able to successfully complete
> the test suite.
>
> This does require one patch so that chromedriver can find the
> chrome binary.

Last patch was broken because it used SUBST_PROGRAM instead of
SUBST_CMD.  Breakage pointed out by ian@.  Hopefully this works,
I don't want to wait 14 hours to confirm.

Thanks,
Jeremy

Index: Makefile
===================================================================
RCS file: /cvs/ports/www/chromium/Makefile,v
retrieving revision 1.345
diff -u -p -u -p -r1.345 Makefile
--- Makefile 29 Oct 2017 14:36:53 -0000 1.345
+++ Makefile 5 Nov 2017 01:22:24 -0000
@@ -10,7 +10,7 @@ DPB_PROPERTIES= parallel
 COMMENT= Chromium browser
 
 V= 62.0.3202.62
-REVISION= 0
+REVISION= 1
 
 DISTNAME= chromium-${V}
 
@@ -97,7 +97,7 @@ BUILDTYPE= Debug
 BUILDTYPE= Release
 .endif
 
-ALL_TARGET= chrome
+ALL_TARGET= chrome chromedriver
 TEST_TARGET= base_unittests
 
 CONFIGURE_STYLE=none # prevent python MODULE from overriding do-build
@@ -173,6 +173,7 @@ do-configure:
  --no-clean -s --gn-gen-args "${GN_ARGS}"
  @cd ${WRKSRC} && env -i ${CONFIGURE_ENV} ${WRKSRC}/out/Release/gn \
  gen --args="${GN_ARGS}" out/${BUILDTYPE}
+ ${SUBST_CMD} ${WRKSRC}/chrome/test/chromedriver/chrome/chrome_finder.cc
 
 do-build:
  @cd ${WRKSRC} && env -i ${MAKE_ENV} ninja \
@@ -182,6 +183,7 @@ do-install:
  ${INSTALL_DATA_DIR} ${PREFIX}/chrome
  ${INSTALL_PROGRAM} ${BUILDDIR}/chrome ${PREFIX}/chrome
  ${SUBST_PROGRAM} ${FILESDIR}/chrome ${PREFIX}/bin/chrome
+ ${INSTALL_PROGRAM} ${BUILDDIR}/chromedriver ${PREFIX}/bin/chromedriver
  ${INSTALL_MAN} ${BUILDDIR}/chrome.1 ${PREFIX}/man/man1
 
  ${INSTALL_DATA} ${BUILDDIR}/*.pak ${PREFIX}/chrome
Index: patches/patch-chrome_test_chromedriver_chrome_chrome_finder_cc
===================================================================
RCS file: patches/patch-chrome_test_chromedriver_chrome_chrome_finder_cc
diff -N patches/patch-chrome_test_chromedriver_chrome_chrome_finder_cc
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-chrome_test_chromedriver_chrome_chrome_finder_cc 4 Nov 2017 11:56:05 -0000
@@ -0,0 +1,24 @@
+$OpenBSD: patch-chrome_app_chrome_command_ids_h,v 1.3 2017/06/25 21:53:56 robert Exp $
+Index: chrome/test/chromedriver/chrome/chrome_finder.cc
+--- chrome/test/chromedriver/chrome/chrome_finder.cc.orig Fri Nov  3 15:00:28 2017
++++ chrome/test/chromedriver/chrome/chrome_finder.cc Fri Nov  3 15:01:35 2017
+@@ -45,6 +45,10 @@
+         installation_locations[i].Append(L"Chromium\\Application"));
+   }
+ }
++#elif 1
++void GetApplicationDirs(std::vector<base::FilePath>* locations) {
++  locations->push_back(base::FilePath("${PREFIX}/bin"));
++}
+ #elif defined(OS_LINUX)
+ void GetApplicationDirs(std::vector<base::FilePath>* locations) {
+   locations->push_back(base::FilePath("/opt/google/chrome"));
+@@ -102,7 +106,7 @@
+       base::FilePath("chromium-browser")
+ #else
+       // it will compile but won't work on other OSes
+-      base::FilePath()
++      base::FilePath("chrome"),
+ #endif
+   };
+
Index: pkg/PLIST
===================================================================
RCS file: /cvs/ports/www/chromium/pkg/PLIST,v
retrieving revision 1.72
diff -u -p -u -p -r1.72 PLIST
--- pkg/PLIST 25 Oct 2017 13:47:07 -0000 1.72
+++ pkg/PLIST 3 Nov 2017 20:34:41 -0000
@@ -1,6 +1,7 @@
 @comment $OpenBSD: PLIST,v 1.72 2017/10/25 13:47:07 robert Exp $
 @pkgpath www/chromium,proprietary
 bin/chrome
+@bin bin/chromedriver
 chrome/
 @bin chrome/chrome
 chrome/chrome_100_percent.pak

Reply | Threaded
Open this post in threaded view
|

Re: Build chromedriver when building chrome

Robert Nagy

On (2017-11-04 18:27), Jeremy Evans wrote:

> On 11/04 06:18, Jeremy Evans wrote:
> > This builds chromedriver when building chrome.  chromedriver is
> > chrome's implementation of the WebDriver protocol, which allows
> > for driving chrome via external software.  Most commonly this
> > is used in automated testing, often with Selenium, which supports
> > many different browsers and programming languages.
> >
> > chromedriver is about 10MB uncompressed, and considering the size
> > of the chrome package, I don't think it is worth it to subpackage.
> >
> > Tested on amd64 using ruby with the capybara and selenium-webdriver
> > libraries.  With only minor modifications to a test suite designed
> > for capybara-webkit, chromedriver was able to successfully complete
> > the test suite.
> >
> > This does require one patch so that chromedriver can find the
> > chrome binary.
>
> Last patch was broken because it used SUBST_PROGRAM instead of
> SUBST_CMD.  Breakage pointed out by ian@.  Hopefully this works,
> I don't want to wait 14 hours to confirm.
>

You don't need that part at all, there is LINUX code to use there,
so we can just use that on OpenBSD and it should work.
Please remove the SUBST_CMD from the Makefile and try with this patch
instead:

Index: Makefile
===================================================================
RCS file: /cvs/ports/www/chromium/Makefile,v
retrieving revision 1.345
diff -u -p -u -r1.345 Makefile
--- Makefile 29 Oct 2017 14:36:53 -0000 1.345
+++ Makefile 5 Nov 2017 09:27:45 -0000
@@ -10,7 +10,7 @@ DPB_PROPERTIES= parallel
 COMMENT= Chromium browser
 
 V= 62.0.3202.62
-REVISION= 0
+REVISION= 1
 
 DISTNAME= chromium-${V}
 
@@ -97,7 +97,7 @@ BUILDTYPE= Debug
 BUILDTYPE= Release
 .endif
 
-ALL_TARGET= chrome
+ALL_TARGET= chrome chromedriver
 TEST_TARGET= base_unittests
 
 CONFIGURE_STYLE=none # prevent python MODULE from overriding do-build
@@ -182,6 +182,7 @@ do-install:
  ${INSTALL_DATA_DIR} ${PREFIX}/chrome
  ${INSTALL_PROGRAM} ${BUILDDIR}/chrome ${PREFIX}/chrome
  ${SUBST_PROGRAM} ${FILESDIR}/chrome ${PREFIX}/bin/chrome
+ ${INSTALL_PROGRAM} ${BUILDDIR}/chromedriver ${PREFIX}/bin/chromedriver
  ${INSTALL_MAN} ${BUILDDIR}/chrome.1 ${PREFIX}/man/man1
 
  ${INSTALL_DATA} ${BUILDDIR}/*.pak ${PREFIX}/chrome
Index: patches/patch-chrome_test_chromedriver_chrome_chrome_finder_cc
===================================================================
RCS file: patches/patch-chrome_test_chromedriver_chrome_chrome_finder_cc
diff -N patches/patch-chrome_test_chromedriver_chrome_chrome_finder_cc
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-chrome_test_chromedriver_chrome_chrome_finder_cc 5 Nov 2017 09:27:45 -0000
@@ -0,0 +1,23 @@
+$OpenBSD$
+
+Index: chrome/test/chromedriver/chrome/chrome_finder.cc
+--- chrome/test/chromedriver/chrome/chrome_finder.cc.orig
++++ chrome/test/chromedriver/chrome/chrome_finder.cc
+@@ -45,7 +45,7 @@ void GetApplicationDirs(std::vector<base::FilePath>* l
+         installation_locations[i].Append(L"Chromium\\Application"));
+   }
+ }
+-#elif defined(OS_LINUX)
++#elif defined(OS_LINUX) || defined(OS_BSD)
+ void GetApplicationDirs(std::vector<base::FilePath>* locations) {
+   locations->push_back(base::FilePath("/opt/google/chrome"));
+   locations->push_back(base::FilePath("/usr/local/bin"));
+@@ -95,7 +95,7 @@ bool FindChrome(base::FilePath* browser_exe) {
+ #elif defined(OS_MACOSX)
+       base::FilePath("Google Chrome.app/Contents/MacOS/Google Chrome"),
+       base::FilePath("Chromium.app/Contents/MacOS/Chromium")
+-#elif defined(OS_LINUX)
++#elif defined(OS_LINUX) || defined(OS_BSD)
+       base::FilePath("google-chrome"),
+       base::FilePath("chrome"),
+       base::FilePath("chromium"),
Index: pkg/PLIST
===================================================================
RCS file: /cvs/ports/www/chromium/pkg/PLIST,v
retrieving revision 1.72
diff -u -p -u -r1.72 PLIST
--- pkg/PLIST 25 Oct 2017 13:47:07 -0000 1.72
+++ pkg/PLIST 5 Nov 2017 09:27:46 -0000
@@ -1,6 +1,7 @@
 @comment $OpenBSD: PLIST,v 1.72 2017/10/25 13:47:07 robert Exp $
 @pkgpath www/chromium,proprietary
 bin/chrome
+@bin bin/chromedriver
 chrome/
 @bin chrome/chrome
 chrome/chrome_100_percent.pak