Problems with xml-i18n-prepare and .directory files



After running xml-i18n-prepare in gnome-core I noticed that it didn't
make the neccesary changes to Makefile.am in the directories containing
.directory files. Somehow the script gets confused in there.

Not sure if it's related to the .directory file handling itself of if
it's Makefile.am that has too many special cases to make the script bail
out.

After looking at xml-i18n-prepare.in it seems to me that .directory
files are treated as equal to .desktop, .keys and .soundlist files.

my $desktop_extension = "(desktop|soundlist|keys|directory)+";
my $desktop_find_regex = ".*desktop\\|soundlist\\|keys\\|directory";

(look for keywords)

my $keywords = "Name|Comment|description";

so the main() in the script does this:

&find_desktop_files; (this should be all of the above)
&append_keywords;
&add_to_potfiles;
&perform_resque;
&add_to_cvsignore; #So far so good, but
&fix_makefiles;    #<- this fails for .directory files for some reason
&generate_empty;

fix_makefiles() does this:

sub fix_makefiles
{
    my $file;
    foreach $file (@desktop_files) {
        my ($makefile, $line);

        $file =~ /^(.*\/)*(.*?\.$desktop_extension$)$/;
        if ($1) {
            $makefile = "$1Makefile.am";
        } else {
            $makefile = "Makefile.am";
        }
        my $basename = $2;
        print "Fixing $basename entry in $makefile\n" if $VERBOSE;

        open MAKE, $makefile;
        open NEWMAKE, ">$makefile.new";
        my $extra = 0;
        while ($line = <MAKE>) {
            $extra = 1 if $line =~ /^EXTRA_DIST/;
            if ($extra) {
                if (($line =~ /$basename/) &&
                    !($line =~ /$basename\.in/)) {
                    $line =~ s/$basename/$basename\.in/;
                }
                $extra = 0 unless $line =~ /\\\s*$/
            } else {
                if ($line =~ /^(\w+)_DATA\s*=\s*$basename\s*$/) {
                    my $name = $1;
                    $line =~ s/^$name\_DATA/$name\_in_files/;
                    $line =~ s/$basename/$basename\.in/;
                    $basename =~ /.*\.($desktop_extension)$/;
                    my $ext = $1;
                    $line .= "$name\_DATA =
\$($name\_in_files:.$ext.in=.$ext)\n";
                    $ext =~ tr/a-z/A-Z/;
                    if (!contains($makefile,
"\@XML_I18N_MERGE_$ext\_RULE\@")) {
                        $line .= "\@XML_I18N_MERGE_$ext\_RULE\@\n";
                    }
                    elsif (!contains($makefile,
'@XML_I18N_MERGE_DESKTOP_RULE@')) {
                        $line .= "\@XML_I18N_MERGE_DESKTOP_RULE\@\n";
                    }
                }
            }
            print NEWMAKE $line;
        }
        close NEWMAKE;
        rename "$makefile.new", $makefile;
    }
}


And this doesn't generate anything in Makefile.am for .directory files.

>From the changed Makefile.am in gnome-core/desktop-links:

gnew_in_files = GIMP.desktop.in
gnew_DATA = $(gnew_in_files:.desktop.in=.desktop)
@XML_I18N_MERGE_DESKTOP_RULE@

This was the only thing added by the script. This leaves out a bunch of
.desktop files and all of the .directory.in files.

Also just adding @XML_I18N_MERGE_DIRECTORY_RULE@ doesn't do anything for
me. After checking in nautilus where Alex did the same thing I see that
.directory files aren't generated there either. So this makes it build
by just ignoring the files :)

What next? Can someone explain how to change Makefile.am by hand to make
it work? Do we need to fix the script?

Please advice.

Cheers
Kjartan






[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]