Closed Bug 224503 Opened 21 years ago Closed 19 years ago

Simplify repetitions of values in install.js

Categories

(Other Applications :: ChatZilla, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: omgs, Assigned: Gijs)

Details

(Whiteboard: [cz-0.9.71])

Attachments

(10 obsolete files)

User-Agent:       Mozilla/5.0 (X11; U; Linux i686; es-ES; rv:1.4) Gecko/20030625
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; es-ES; rv:1.4) Gecko/20030625

In the install.js, the references for the file "chatzilla.jar", (in the example,
"chatzillaeses.jar") when building the xpi for a localization, it is needed to
make several changes that are really the same thing, and this could be
parametrizable. Actually:


    registerChrome(PACKAGE | DELAYED_CHROME,
getFolder("Chrome","chatzillaeses.jar"), "content/chatzilla/");
    registerChrome(SKIN | DELAYED_CHROME,
getFolder("Chrome","chatzillaeses.jar"), "skin/modern/chatzilla/");
    registerChrome(LOCALE | DELAYED_CHROME,
getFolder("Chrome","chatzillaeses.jar"), "locale/es-ES/chatzilla/");



Reproducible: Always

Steps to Reproduce:




I'll provide a patch next
Attached patch Diff from actual to newer file (obsolete) — Splinter Review
The patch is the result of "diff install.js installnew.js>patch-install.js",
being install.js the packaged file, and installnew.js the new generated file.
The whole new file, for a full overview:

// Global varibles for product name and version
var product = "chatzilla"

// Need a function to automatically change first letter
var Product = "Chatzilla"
var version = "0.9.46"

// For "chatzilla.jar", leave blank where appropiate
var lang_ab = "" // Leave blank for "en"
var lang_cd = "" // Leave blank for "US", use lowercase
var lang_CD = "US" // Original = US. DONT LEAVE BLANK!!!!
var product_file = product + lang_ab + lang_cd + ".jar"


// this function verifies disk space in kilobytes
function verifyDiskSpace(dirPath, spaceRequired)
{
  var spaceAvailable;

  // Get the available disk space on the given path
  spaceAvailable = fileGetDiskSpaceAvailable(dirPath);

  // Convert the available disk space into kilobytes
  spaceAvailable = parseInt(spaceAvailable / 1024);

  // do the verification
  if(spaceAvailable < spaceRequired)
  {
    logComment("Insufficient disk space: " + dirPath);
    logComment("  required : " + spaceRequired + " K");
    logComment("  available: " + spaceAvailable + " K");
    return(false);
  }

  return(true);
}
var srDest = 110;

var err = initInstall(Product + " " + version, Product, version);
logComment("initInstall: " + err);

if (verifyDiskSpace(getFolder("Program"), srDest))
{
    addFile(Product + " service",
            version,
            "bin/components/chatzilla-service.js",
            getFolder("Components"),
            product + "-service.js",
            true);

    addFile(Product + " Chrome",
            "bin/chrome/" + product_file, // jar source folder
            getFolder("Chrome"),        // target folder
            "");                        // target subdir

    // Values for overriding default empty values, in order to
    // set the right locale directory
    if (lang_ab=="")
        lang_ab="en";

    registerChrome(PACKAGE | DELAYED_CHROME, getFolder("Chrome", product_file),
"content/" + product + "/");
    registerChrome(SKIN | DELAYED_CHROME, getFolder("Chrome",product_file),
"skin/modern/" + product + "/");
    registerChrome(LOCALE | DELAYED_CHROME, getFolder("Chrome",product_file),
"locale/" + lang_ab + "-" + lang_CD + "/" + product + "/");

    if (err==SUCCESS)
        performInstall();
    else
        cancelInstall(err);
}
else
    cancelInstall(INSUFFICIENT_DISK_SPACE);
Product: Core → Other Applications
You can't just modify install.js as it comes with ChatZilla xpi's. If you would
want to make this change, you'd have to adjust the original, as found in CVS,
and you would probably also need to make changes to both the bash script that
generates the xpi and static.js, where version information is taken from. In
this state, the diff is rather useless.
OS: Linux → All
Hardware: PC → All
why are you renaming the jar file?
To simplify things a bit for people modifying our jar directly after it has been preprocessed, I've put the jar name, the version and the locale as parameters. I've added a comment clarifying this for localizers. I've put them at the top of the file so it is easy to find them :)
Attachment #134674 - Attachment is obsolete: true
Attachment #204584 - Flags: review?(samuel)
I think a better solution for this bug would be to provide an alternate install.js , makexpi.sh, or whatever other files are necessary for localizers to create addon .xpis instead of including the entire chatzilla source for each translations.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Okay, if we're going for a more extensive approach, here we go.
This patch just does a tiny fix to makexpi.sh to make the done's line up (nit ;) ) and to not make a spelling mistake on the very first output line ;).

It also makes sure that the xpi-trees for the locale xpi's don't get taken to mean anything to do with cvs.
Assignee: rginda → gijskruitbosch+bugs
Attachment #204584 - Attachment is obsolete: true
Status: NEW → ASSIGNED
Attachment #204701 - Flags: review?(samuel)
Attachment #204584 - Flags: review?(samuel)
Attached file [checked in] makelocalexpi.sh (obsolete) —
This script needs a LOCALE env. variable set, or one argument designating the locale. 
It assumes locale-jar.mn exists in mozilla/extensions/irc, and creates an ab-CD-jar.mn file for each locale it is passed. 
It also  assumes that mozilla/extensions/irc/xpi/locale-resources/ab-CD/ contains an install.js and install.rdf file for that locale.

These three files will be provided next (the install.* files can be put in the main /locale-resources/ subdirectory, they have instructions to copy them to the subdirectories)
Attached file [checked in] locale-jar.mn (obsolete) —
This gets 'preprocessed' by the makelocalexpi.sh script.
Attached file [checked in] install.rdf (obsolete) —
Attached patch Patch to existing xpi files (obsolete) — Splinter Review
Patch for new install.js, install.rdf and makelocalexpi.sh files from original ones (and makexpi.sh) used for the normal xpi, to provide clarity about what changed for the locale xpi we're generating this way.
Comment on attachment 204706 [details]
[checked in] locale-jar.mn

locale-jar.mn:
white space is different, two lines use spaces instead of tabs.
Comment on attachment 204708 [details]
[checked in] install.rdf

install.rdf:
maybe you should make the uuid invalid to ensure that the localizer changes it.
Attachment #204701 - Flags: review?(samuel) → review+
looks good.  we also need a FAQ entry or, better yet, a localization instructions page.
Attachment #204705 - Attachment description: makelocalexpi.sh - bash script to generate a locale xpi → [checked in] makelocalexpi.sh
Attachment #204705 - Attachment is obsolete: true
Attachment #204701 - Attachment description: Patch for existing files → [checked in] Patch for existing files
Attachment #204701 - Attachment is obsolete: true
Attachment #204706 - Attachment description: locale-jar.mn → [checked in] locale-jar.mn
Attachment #204706 - Attachment is obsolete: true
Attachment #204707 - Attachment description: install.js - for installing a localization in Suite → [checked in] install.js - for installing a localization in Suite
Attachment #204707 - Attachment is obsolete: true
Attachment #204708 - Attachment description: install.rdf - for installing the localization in Toolkit apps → [checked in] install.rdf
Attachment #204708 - Attachment is obsolete: true
Attachment #204712 - Attachment is obsolete: true
Attached file [checked in] Localization guide (obsolete) —
Localization guide for the hacksrus homepage (would be checked into cvs, I believe? (mozilla-org/html/projects/rt-messaging/chatzilla/development/) )
Attachment #210263 - Flags: review?
Attachment #210263 - Flags: review? → review?(samuel)
Comment on attachment 210263 [details]
[checked in] Localization guide

"feel free to drop by on #chatzilla on moznet and ask" -> "feel free to drop by the IRC channel #chatzilla on moznet and ask"
Attachment #210263 - Flags: review?(samuel) → review+
Patch for the FAQ (includes changing all newsgroup references). Also patches site.js to know about the new localization guide and not bork the whole thing when it eventually goes up :-).
Attachment #210340 - Flags: review?
+  Yes.  The newsgroup is <b>mozilla.development.apps.chatzilla</b> and can be found on
Should obviously be:
+  Yes.  The newsgroup is <b>mozilla.dev.apps.chatzilla</b> and can be found on

Sorry for bugspam.
Attachment #210340 - Flags: review? → review+
Attachment #210340 - Attachment description: Patch for FAQ and site.js to know about the localization guide → [checked in] Patch for FAQ and site.js to know about the localization guide
Attachment #210340 - Attachment is obsolete: true
Attachment #210263 - Attachment description: Localization guide → [checked in] Localization guide
Attachment #210263 - Attachment is obsolete: true
Documentation is now on the website --> FIXED.
Status: ASSIGNED → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
Whiteboard: [cz-0.9.71]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: