Help Wanted: Name-Changing Script

Recent events have convinced me that it’s important that we have a mozilla.org-blessed script which removes the “Firefox” trademark from the code. This could then be run by anyone wanting to make an “Iceweasel” browser under part 3) of the Trademark Policy, and they could be certain that they weren’t in any legal trouble. Basically, it would run over a freshly-pulled tree and change the word “Firefox” to a given string in a number of key files (such as brand.dtd) and other places.

Would anyone like to volunteer to write such a script? It would need to be in Perl, because it’s a language I know – the relicensing script was originally done in Python, and I had terrible trouble finding someone to maintain it. (I should say that the guy who I finally found is currently doing an excellent job.)

Let me know if you can help – but please don’t volunteer unless you consider yourself a reliable person ;-)

13 thoughts on “Help Wanted: Name-Changing Script

  1. I’ve used this perl script very successfully to change large amounts of text in a tree of ~1G of .php files (excuse the line wrapping & possibly crappy line wrapping):

    ————————————-
    #!/usr/bin/env perl

    use File::Find;

    find sub {
    -f $_ or return;
    # I was changing text in *.php; I’d imagine there’s some regex magic that could give you the files you wanted in this next line.
    /\.php$/ or return;
    my $file = $_;
    my $filebak = “${file}~”;
    rename $file, $filebak or die “Can’t rename $file to $filebak: $!\n”;
    open FILEBAK, $filebak or die “Can’t open $filebak: $!\n”;
    open FILE, “>$file” or die “Can’t write to $file: $!\n”;
    print “$file\n”;
    while () {

    # Replace OLD with the “search for” — a regexp
    # Replace NEW with the “replace with”
    s/OLD/NEW/g;

    print FILE $_;
    }
    }, “.”;

    # end replace.pl

    ————————————-

    It backs up files to “file~”, which is very handy.

    I’m not volunteering to maintain this – it’s not my code, I’m not a Perl hacker – but it sounded like it could be adapted to suit what you need.

  2. Ben, it’s not that easy. You can’t just change every reference of Firefox to something else. For example the string “Firefox” is used in the migration dialog to allow the import of “Firefox 0.8” profiles in “migration.dtd”

    Gerv, I can’t thank you enough for the “quicktext” extension hint, it’s so simple and quick to use, that it already saved me time handling my FOSDEM backlog.

  3. Ben, I don’t think that’s what Gerv is looking for. He only needs “Firefox” replaced in a few key files, and I guess deleting a few image files.

    I could be wrong, but it seems like a trivial excersise. Gerv, if you post the exact requirements I think I could whip something up fairly quickly.

  4. miguel: problem is, the exact requirements are not totally clear. I would hope the volunteer would be proactive and go through an iterative process to work out what was needed.

    glandium: we know; this is a bug, and needs fixing. Thanks :-)

  5. Gerv,

    This has probably been proposed many times, but I think that it would be better for the default to be devoid of brand and the script should *add* Firefox branding, not remove it. Run that script before each tinderbox build and the nightlies would still be properly branded, and regressions in the script would be noticed quickly.

    In the current scenario, I imagine it is easy for a third party to miss removing some pieces of the Firefox brand, hence the need for a highly accurate script. Presumably it would be hard to notice if the unbranding script was failing, because fewer eyes would be looking at unbranded builds.

    But this has probably been proposed elsewhere…

  6. Gerv, I would suggest fixing this “right” by moving firefox-specific strings into other-licences/branding. Since the number of occurrences of “firefox” is generally limited to the brand.dtd/properties files and a few other locations, this should not be especially difficult.

  7. My reason for not suggesting having the default be non-Firefox, and for not moving stuff into other-licenses/branding is because there’s a big difference between the way we use our logos and the way we use the name.

    The logos are for MoFo official releases and releases with partners we have a specific deal with, full stop. So they are in other-licenses/, and need to be enabled with a special option. Most people who distribute don’t use the logos in their builds.

    The “Firefox” name (or, at least, “Firefox Community Edition” or similar) is used by anyone building the default sources, or making any changes which fit within the Community Edition rules. So most people do use the name in the builds they distribute, and it makes sense for it to be the default.

    However, for those people who do want to do something wild and weird, we need a name-changing mechanism.

  8. This is actually a pretty good idea. One interesting point would be that in order to change the name of the executable, you have to change one of the targets in one of the makefiles (the makefile uses the name of the target as the name of the executable. yes, that’s kinda weird.) I’d suggest that rather than a seperate perl script, this should be done by modifying the build process to take the appropriate strings from environment variables.

  9. I like the idea given above of the default source being unbranded, and the branding applied as part of the build, either using compiler macros or file renaming as appropriate. Alternatively, if search-and-replace is to be used, the default branding should be some string like ‘$$BRANDNAME$$’ that would make it easy to write search-and-replace scripts without any false-positives. Literal “Firefox” strings needed for interoperability could then be left in the code as-is.

  10. I already have the term “IceWeasel” trademarked, so they’re going to have to get their own name. :)