grub-devel.gnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Fix grub-shell to avoid breaking "make distcheck"
@ 2013-11-29 14:12 Colin Watson
  2013-12-02  5:40 ` Vladimir 'φ-coder/phcoder' Serbinenko
  0 siblings, 1 reply; 3+ messages in thread
From: Colin Watson @ 2013-11-29 14:12 UTC (permalink / raw)
  To: grub-devel

Copying the themes directory in grub-shell isn't
parallel-test-friendly and breaks on the second test when the source
directory is read-only (as in "make distcheck").  Instead, add a
--themes-directory option to grub-mkrescue et al, and use it in
grub-shell.
---
 ChangeLog                   |  8 ++++++++
 include/grub/util/install.h |  4 ++++
 tests/util/grub-shell.in    |  5 +++--
 util/grub-install-common.c  | 20 ++++++++++++++++++--
 4 files changed, 33 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index ad83563..7b55a7a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2013-11-29  Colin Watson  <cjwatson@ubuntu.com>
 
+	Copying the themes directory in grub-shell isn't
+	parallel-test-friendly and breaks on the second test when the source
+	directory is read-only (as in "make distcheck").  Instead, add a
+	--themes-directory option to grub-mkrescue et al, and use it in
+	grub-shell.
+
+2013-11-29  Colin Watson  <cjwatson@ubuntu.com>
+
 	* docs/grub-dev.texi (Font Metrics): Exclude @image command from DVI
 	builds, since we don't have an EPS version of font_char_metrics.png.
 	Add leading dot to image extension per the Texinfo documentation.
diff --git a/include/grub/util/install.h b/include/grub/util/install.h
index 5cb33fc..891d170 100644
--- a/include/grub/util/install.h
+++ b/include/grub/util/install.h
@@ -50,6 +50,9 @@
   { "locale-directory", GRUB_INSTALL_OPTIONS_LOCALE_DIRECTORY,		\
       N_("DIR"), 0,							\
     N_("use translations under DIR [default=%s]"), 1 },			\
+  { "themes-directory", GRUB_INSTALL_OPTIONS_THEMES_DIRECTORY,		\
+      N_("DIR"), 0,							\
+    N_("use themes under DIR [default=%s]"), 1 },			\
   { "grub-mkimage", GRUB_INSTALL_OPTIONS_GRUB_MKIMAGE,		\
       "FILE", OPTION_HIDDEN, 0, 1 },					\
     /* TRANSLATORS: "embed" is a verb (command description).  "*/	\
@@ -106,6 +109,7 @@ enum grub_install_options {
   GRUB_INSTALL_OPTIONS_INSTALL_COMPRESS,
   GRUB_INSTALL_OPTIONS_DIRECTORY2,
   GRUB_INSTALL_OPTIONS_LOCALE_DIRECTORY,
+  GRUB_INSTALL_OPTIONS_THEMES_DIRECTORY,
   GRUB_INSTALL_OPTIONS_GRUB_MKIMAGE
 };
 
diff --git a/tests/util/grub-shell.in b/tests/util/grub-shell.in
index 5f20b64..d9a5253 100644
--- a/tests/util/grub-shell.in
+++ b/tests/util/grub-shell.in
@@ -347,9 +347,10 @@ if test -z "$debug"; then
 fi
 
 if [ x$boot != xnet ] && [ x$boot != xemu ]; then
-    cp -R "@srcdir@/themes" "@builddir@"
     pkgdatadir="@builddir@" "@builddir@/grub-mkrescue" "--output=${isofile}" "--override-directory=${builddir}/grub-core" \
-	--rom-directory="${rom_directory}" $mkimage_extra_arg ${mkrescue_args} \
+	--rom-directory="${rom_directory}" \
+	--themes-directory="@srcdir@/themes" \
+	$mkimage_extra_arg ${mkrescue_args} \
 	"/boot/grub/grub.cfg=${cfgfile}" "/boot/grub/testcase.cfg=${source}" \
 	${files} >/dev/null 2>&1
 fi
diff --git a/util/grub-install-common.c b/util/grub-install-common.c
index 91b558e..3204bc4 100644
--- a/util/grub-install-common.c
+++ b/util/grub-install-common.c
@@ -60,6 +60,8 @@ grub_install_help_filter (int key, const char *text,
       return xasprintf(text, grub_util_get_pkglibdir ());      
     case GRUB_INSTALL_OPTIONS_LOCALE_DIRECTORY:
       return xasprintf(text, grub_util_get_localedir ());
+    case GRUB_INSTALL_OPTIONS_THEMES_DIRECTORY:
+      return grub_util_path_concat (2, grub_util_get_pkgdatadir (), "themes");
     default:
       return (char *) text;
     }
@@ -220,6 +222,7 @@ struct install_list install_fonts = { 1, 0, 0, 0 };
 struct install_list install_themes = { 1, 0, 0, 0 };
 char *grub_install_source_directory = NULL;
 char *grub_install_locale_directory = NULL;
+char *grub_install_themes_directory = NULL;
 
 void
 grub_install_push_module (const char *val)
@@ -320,6 +323,10 @@ grub_install_parse (int key, char *arg)
       free (grub_install_locale_directory);
       grub_install_locale_directory = xstrdup (arg);
       return 1;
+    case GRUB_INSTALL_OPTIONS_THEMES_DIRECTORY:
+      free (grub_install_themes_directory);
+      grub_install_themes_directory = xstrdup (arg);
+      return 1;
     case GRUB_INSTALL_OPTIONS_INSTALL_MODULES:
       handle_install_list (&install_modules, arg, 0);
       return 1;
@@ -666,6 +673,7 @@ grub_install_copy_files (const char *src,
 {
   char *dst_platform, *dst_locale, *dst_fonts;
   const char *pkgdatadir = grub_util_get_pkgdatadir ();
+  char *themes_dir;
 
   {
     char *platform;
@@ -780,14 +788,20 @@ grub_install_copy_files (const char *src,
       install_themes.entries[1] = NULL;
     }
 
+  if (grub_install_themes_directory)
+    themes_dir = xstrdup (grub_install_themes_directory);
+  else
+    themes_dir = grub_util_path_concat (2, grub_util_get_pkgdatadir (),
+					"themes");
+
   for (i = 0; i < install_themes.n_entries; i++)
     {
-      char *srcf = grub_util_path_concat (4, pkgdatadir, "themes",
+      char *srcf = grub_util_path_concat (3, themes_dir,
 					install_themes.entries[i],
 					"theme.txt");
       if (grub_util_is_regular (srcf))
 	{
-	  char *srcd = grub_util_path_concat (3, pkgdatadir, "themes",
+	  char *srcd = grub_util_path_concat (2, themes_dir,
 					    install_themes.entries[i]);
 	  char *dstd = grub_util_path_concat (3, dst, "themes",
 					    install_themes.entries[i]);
@@ -799,6 +813,8 @@ grub_install_copy_files (const char *src,
       free (srcf);
     }
 
+  free (themes_dir);
+
   if (install_fonts.is_default)
     {
       install_fonts.is_default = 0;
-- 
1.8.4.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] Fix grub-shell to avoid breaking "make distcheck"
  2013-11-29 14:12 [PATCH] Fix grub-shell to avoid breaking "make distcheck" Colin Watson
@ 2013-12-02  5:40 ` Vladimir 'φ-coder/phcoder' Serbinenko
  2013-12-04 13:37   ` Colin Watson
  0 siblings, 1 reply; 3+ messages in thread
From: Vladimir 'φ-coder/phcoder' Serbinenko @ 2013-12-02  5:40 UTC (permalink / raw)
  To: The development of GNU GRUB

[-- Attachment #1: Type: text/plain, Size: 6042 bytes --]

On 29.11.2013 15:12, Colin Watson wrote:
> Copying the themes directory in grub-shell isn't
> parallel-test-friendly and breaks on the second test when the source
> directory is read-only (as in "make distcheck").  Instead, add a
> --themes-directory option to grub-mkrescue et al, and use it in
> grub-shell.
I agree with the patch but I'm unsure whether --themes-idrectory has to
be a hidden option or appear in --help.
> ---
>  ChangeLog                   |  8 ++++++++
>  include/grub/util/install.h |  4 ++++
>  tests/util/grub-shell.in    |  5 +++--
>  util/grub-install-common.c  | 20 ++++++++++++++++++--
>  4 files changed, 33 insertions(+), 4 deletions(-)
> 
> diff --git a/ChangeLog b/ChangeLog
> index ad83563..7b55a7a 100644
> --- a/ChangeLog
> +++ b/ChangeLog
> @@ -1,5 +1,13 @@
>  2013-11-29  Colin Watson  <cjwatson@ubuntu.com>
>  
> +	Copying the themes directory in grub-shell isn't
> +	parallel-test-friendly and breaks on the second test when the source
> +	directory is read-only (as in "make distcheck").  Instead, add a
> +	--themes-directory option to grub-mkrescue et al, and use it in
> +	grub-shell.
> +
> +2013-11-29  Colin Watson  <cjwatson@ubuntu.com>
> +
>  	* docs/grub-dev.texi (Font Metrics): Exclude @image command from DVI
>  	builds, since we don't have an EPS version of font_char_metrics.png.
>  	Add leading dot to image extension per the Texinfo documentation.
> diff --git a/include/grub/util/install.h b/include/grub/util/install.h
> index 5cb33fc..891d170 100644
> --- a/include/grub/util/install.h
> +++ b/include/grub/util/install.h
> @@ -50,6 +50,9 @@
>    { "locale-directory", GRUB_INSTALL_OPTIONS_LOCALE_DIRECTORY,		\
>        N_("DIR"), 0,							\
>      N_("use translations under DIR [default=%s]"), 1 },			\
> +  { "themes-directory", GRUB_INSTALL_OPTIONS_THEMES_DIRECTORY,		\
> +      N_("DIR"), 0,							\
> +    N_("use themes under DIR [default=%s]"), 1 },			\
>    { "grub-mkimage", GRUB_INSTALL_OPTIONS_GRUB_MKIMAGE,		\
>        "FILE", OPTION_HIDDEN, 0, 1 },					\
>      /* TRANSLATORS: "embed" is a verb (command description).  "*/	\
> @@ -106,6 +109,7 @@ enum grub_install_options {
>    GRUB_INSTALL_OPTIONS_INSTALL_COMPRESS,
>    GRUB_INSTALL_OPTIONS_DIRECTORY2,
>    GRUB_INSTALL_OPTIONS_LOCALE_DIRECTORY,
> +  GRUB_INSTALL_OPTIONS_THEMES_DIRECTORY,
>    GRUB_INSTALL_OPTIONS_GRUB_MKIMAGE
>  };
>  
> diff --git a/tests/util/grub-shell.in b/tests/util/grub-shell.in
> index 5f20b64..d9a5253 100644
> --- a/tests/util/grub-shell.in
> +++ b/tests/util/grub-shell.in
> @@ -347,9 +347,10 @@ if test -z "$debug"; then
>  fi
>  
>  if [ x$boot != xnet ] && [ x$boot != xemu ]; then
> -    cp -R "@srcdir@/themes" "@builddir@"
>      pkgdatadir="@builddir@" "@builddir@/grub-mkrescue" "--output=${isofile}" "--override-directory=${builddir}/grub-core" \
> -	--rom-directory="${rom_directory}" $mkimage_extra_arg ${mkrescue_args} \
> +	--rom-directory="${rom_directory}" \
> +	--themes-directory="@srcdir@/themes" \
> +	$mkimage_extra_arg ${mkrescue_args} \
>  	"/boot/grub/grub.cfg=${cfgfile}" "/boot/grub/testcase.cfg=${source}" \
>  	${files} >/dev/null 2>&1
>  fi
> diff --git a/util/grub-install-common.c b/util/grub-install-common.c
> index 91b558e..3204bc4 100644
> --- a/util/grub-install-common.c
> +++ b/util/grub-install-common.c
> @@ -60,6 +60,8 @@ grub_install_help_filter (int key, const char *text,
>        return xasprintf(text, grub_util_get_pkglibdir ());      
>      case GRUB_INSTALL_OPTIONS_LOCALE_DIRECTORY:
>        return xasprintf(text, grub_util_get_localedir ());
> +    case GRUB_INSTALL_OPTIONS_THEMES_DIRECTORY:
> +      return grub_util_path_concat (2, grub_util_get_pkgdatadir (), "themes");
>      default:
>        return (char *) text;
>      }
> @@ -220,6 +222,7 @@ struct install_list install_fonts = { 1, 0, 0, 0 };
>  struct install_list install_themes = { 1, 0, 0, 0 };
>  char *grub_install_source_directory = NULL;
>  char *grub_install_locale_directory = NULL;
> +char *grub_install_themes_directory = NULL;
>  
>  void
>  grub_install_push_module (const char *val)
> @@ -320,6 +323,10 @@ grub_install_parse (int key, char *arg)
>        free (grub_install_locale_directory);
>        grub_install_locale_directory = xstrdup (arg);
>        return 1;
> +    case GRUB_INSTALL_OPTIONS_THEMES_DIRECTORY:
> +      free (grub_install_themes_directory);
> +      grub_install_themes_directory = xstrdup (arg);
> +      return 1;
>      case GRUB_INSTALL_OPTIONS_INSTALL_MODULES:
>        handle_install_list (&install_modules, arg, 0);
>        return 1;
> @@ -666,6 +673,7 @@ grub_install_copy_files (const char *src,
>  {
>    char *dst_platform, *dst_locale, *dst_fonts;
>    const char *pkgdatadir = grub_util_get_pkgdatadir ();
> +  char *themes_dir;
>  
>    {
>      char *platform;
> @@ -780,14 +788,20 @@ grub_install_copy_files (const char *src,
>        install_themes.entries[1] = NULL;
>      }
>  
> +  if (grub_install_themes_directory)
> +    themes_dir = xstrdup (grub_install_themes_directory);
> +  else
> +    themes_dir = grub_util_path_concat (2, grub_util_get_pkgdatadir (),
> +					"themes");
> +
>    for (i = 0; i < install_themes.n_entries; i++)
>      {
> -      char *srcf = grub_util_path_concat (4, pkgdatadir, "themes",
> +      char *srcf = grub_util_path_concat (3, themes_dir,
>  					install_themes.entries[i],
>  					"theme.txt");
>        if (grub_util_is_regular (srcf))
>  	{
> -	  char *srcd = grub_util_path_concat (3, pkgdatadir, "themes",
> +	  char *srcd = grub_util_path_concat (2, themes_dir,
>  					    install_themes.entries[i]);
>  	  char *dstd = grub_util_path_concat (3, dst, "themes",
>  					    install_themes.entries[i]);
> @@ -799,6 +813,8 @@ grub_install_copy_files (const char *src,
>        free (srcf);
>      }
>  
> +  free (themes_dir);
> +
>    if (install_fonts.is_default)
>      {
>        install_fonts.is_default = 0;
> 



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 291 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Fix grub-shell to avoid breaking "make distcheck"
  2013-12-02  5:40 ` Vladimir 'φ-coder/phcoder' Serbinenko
@ 2013-12-04 13:37   ` Colin Watson
  0 siblings, 0 replies; 3+ messages in thread
From: Colin Watson @ 2013-12-04 13:37 UTC (permalink / raw)
  To: grub-devel

On Mon, Dec 02, 2013 at 06:40:58AM +0100, Vladimir 'φ-coder/phcoder' Serbinenko wrote:
> On 29.11.2013 15:12, Colin Watson wrote:
> > Copying the themes directory in grub-shell isn't
> > parallel-test-friendly and breaks on the second test when the source
> > directory is read-only (as in "make distcheck").  Instead, add a
> > --themes-directory option to grub-mkrescue et al, and use it in
> > grub-shell.
> 
> I agree with the patch but I'm unsure whether --themes-idrectory has to
> be a hidden option or appear in --help.

I made it a hidden option, merged, and pushed.  Thanks.

-- 
Colin Watson                                       [cjwatson@ubuntu.com]


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-12-04 13:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-29 14:12 [PATCH] Fix grub-shell to avoid breaking "make distcheck" Colin Watson
2013-12-02  5:40 ` Vladimir 'φ-coder/phcoder' Serbinenko
2013-12-04 13:37   ` Colin Watson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).