Fix grub-shell to avoid breaking "make distcheck"

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
hidden --themes-directory option to grub-mkrescue et al, and use it
in grub-shell.
This commit is contained in:
Colin Watson 2013-12-04 13:35:39 +00:00
parent e3046431da
commit 3a82f8bb48
4 changed files with 33 additions and 4 deletions

View file

@ -1,3 +1,11 @@
2013-12-04 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
hidden --themes-directory option to grub-mkrescue et al, and use it
in grub-shell.
2013-12-04 Vladimir Serbinenko <phcoder@gmail.com> 2013-12-04 Vladimir Serbinenko <phcoder@gmail.com>
* conf/Makefile.common (CFLAGS_GNULIB): Remove -Wno-old-style-definition * conf/Makefile.common (CFLAGS_GNULIB): Remove -Wno-old-style-definition

View file

@ -50,6 +50,9 @@
{ "locale-directory", GRUB_INSTALL_OPTIONS_LOCALE_DIRECTORY, \ { "locale-directory", GRUB_INSTALL_OPTIONS_LOCALE_DIRECTORY, \
N_("DIR"), 0, \ N_("DIR"), 0, \
N_("use translations under DIR [default=%s]"), 1 }, \ N_("use translations under DIR [default=%s]"), 1 }, \
{ "themes-directory", GRUB_INSTALL_OPTIONS_THEMES_DIRECTORY, \
N_("DIR"), OPTION_HIDDEN, \
N_("use themes under DIR [default=%s]"), 1 }, \
{ "grub-mkimage", GRUB_INSTALL_OPTIONS_GRUB_MKIMAGE, \ { "grub-mkimage", GRUB_INSTALL_OPTIONS_GRUB_MKIMAGE, \
"FILE", OPTION_HIDDEN, 0, 1 }, \ "FILE", OPTION_HIDDEN, 0, 1 }, \
/* TRANSLATORS: "embed" is a verb (command description). "*/ \ /* TRANSLATORS: "embed" is a verb (command description). "*/ \
@ -107,6 +110,7 @@ enum grub_install_options {
GRUB_INSTALL_OPTIONS_INSTALL_COMPRESS, GRUB_INSTALL_OPTIONS_INSTALL_COMPRESS,
GRUB_INSTALL_OPTIONS_DIRECTORY2, GRUB_INSTALL_OPTIONS_DIRECTORY2,
GRUB_INSTALL_OPTIONS_LOCALE_DIRECTORY, GRUB_INSTALL_OPTIONS_LOCALE_DIRECTORY,
GRUB_INSTALL_OPTIONS_THEMES_DIRECTORY,
GRUB_INSTALL_OPTIONS_GRUB_MKIMAGE GRUB_INSTALL_OPTIONS_GRUB_MKIMAGE
}; };

View file

@ -347,9 +347,10 @@ if test -z "$debug"; then
fi fi
if [ x$boot != xnet ] && [ x$boot != xemu ]; then 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" \ 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}" \ "/boot/grub/grub.cfg=${cfgfile}" "/boot/grub/testcase.cfg=${source}" \
${files} >/dev/null 2>&1 ${files} >/dev/null 2>&1
fi fi

View file

@ -60,6 +60,8 @@ grub_install_help_filter (int key, const char *text,
return xasprintf(text, grub_util_get_pkglibdir ()); return xasprintf(text, grub_util_get_pkglibdir ());
case GRUB_INSTALL_OPTIONS_LOCALE_DIRECTORY: case GRUB_INSTALL_OPTIONS_LOCALE_DIRECTORY:
return xasprintf(text, grub_util_get_localedir ()); 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: default:
return (char *) text; 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 }; struct install_list install_themes = { 1, 0, 0, 0 };
char *grub_install_source_directory = NULL; char *grub_install_source_directory = NULL;
char *grub_install_locale_directory = NULL; char *grub_install_locale_directory = NULL;
char *grub_install_themes_directory = NULL;
void void
grub_install_push_module (const char *val) grub_install_push_module (const char *val)
@ -320,6 +323,10 @@ grub_install_parse (int key, char *arg)
free (grub_install_locale_directory); free (grub_install_locale_directory);
grub_install_locale_directory = xstrdup (arg); grub_install_locale_directory = xstrdup (arg);
return 1; 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: case GRUB_INSTALL_OPTIONS_INSTALL_MODULES:
handle_install_list (&install_modules, arg, 0); handle_install_list (&install_modules, arg, 0);
return 1; return 1;
@ -667,6 +674,7 @@ grub_install_copy_files (const char *src,
{ {
char *dst_platform, *dst_locale, *dst_fonts; char *dst_platform, *dst_locale, *dst_fonts;
const char *pkgdatadir = grub_util_get_pkgdatadir (); const char *pkgdatadir = grub_util_get_pkgdatadir ();
char *themes_dir;
{ {
char *platform; char *platform;
@ -781,14 +789,20 @@ grub_install_copy_files (const char *src,
install_themes.entries[1] = NULL; 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++) 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], install_themes.entries[i],
"theme.txt"); "theme.txt");
if (grub_util_is_regular (srcf)) 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]); install_themes.entries[i]);
char *dstd = grub_util_path_concat (3, dst, "themes", char *dstd = grub_util_path_concat (3, dst, "themes",
install_themes.entries[i]); install_themes.entries[i]);
@ -800,6 +814,8 @@ grub_install_copy_files (const char *src,
free (srcf); free (srcf);
} }
free (themes_dir);
if (install_fonts.is_default) if (install_fonts.is_default)
{ {
install_fonts.is_default = 0; install_fonts.is_default = 0;