diff options
-rw-r--r-- | debian/changelog | 5 | ||||
-rw-r--r-- | man/install-xpi.1 | 5 | ||||
-rwxr-xr-x | src/install-xpi | 39 |
3 files changed, 31 insertions, 18 deletions
diff --git a/debian/changelog b/debian/changelog index b4a7971..a586270 100644 --- a/debian/changelog +++ b/debian/changelog @@ -57,6 +57,9 @@ mozilla-devscripts (0.19) UNRELEASED; urgency=low - wrote man page for install-xpi - add man/install-xpi.1 - update src/Makefile + - add --install-dir parameter to install-xpi + - update man/install-xpi.1 + - update src/install-xpi * packaging: - add homepage field - update debian/control @@ -69,7 +72,7 @@ mozilla-devscripts (0.19) UNRELEASED; urgency=low - update src/dh_xul-ext - update debian/control - -- Benjamin Drung <bdrung@ubuntu.com> Thu, 07 Jan 2010 14:37:50 +0100 + -- Benjamin Drung <bdrung@ubuntu.com> Fri, 08 Jan 2010 01:46:53 +0100 mozilla-devscripts (0.18) unstable; urgency=low diff --git a/man/install-xpi.1 b/man/install-xpi.1 index 1db95d1..c6b4109 100644 --- a/man/install-xpi.1 +++ b/man/install-xpi.1 @@ -41,6 +41,11 @@ this parameter several times. \fB\-h\fR, \fB\-\-help\fR Display a brief help message. .TP +\fB\-i\fR \fIdirectory\fP, \fB\-\-install-dir\fR=\fIdirectory\fP +The xpi file will be installed in the specified directory. +.I directory +must be an absolute path. Use this parameter with care. +.TP \fB\-l\fR \fIdirectory\fP, \fB\-\-link\fR=\fIdirectory\fP An additional link from the \fIdirectory\fP to the installation directory of the extension will be created. You can use this parameter several times. diff --git a/src/install-xpi b/src/install-xpi index 071507c..31c5f00 100755 --- a/src/install-xpi +++ b/src/install-xpi @@ -68,7 +68,7 @@ def get_mode(filename): mode = st[stat.ST_MODE] return mode & 0777 -def install_xpi(script_name, package, xpi_file, exclude, links, correct_permissions, remove_licenses, verbose=False): +def install_xpi(script_name, package, xpi_file, exclude, install_dir, links, correct_permissions, remove_licenses, verbose=False): # get xpi file content list if not os.path.isfile(xpi_file): print >> sys.stderr, "%s: Error: xpi file %s does not exist." % (script_name, xpi_file) @@ -77,11 +77,13 @@ def install_xpi(script_name, package, xpi_file, exclude, links, correct_permissi xpi_content = zfobj.namelist() # determine installation directory - if get_arch(package) == "all": - lib_share_dir = "share" - else: - lib_share_dir = "lib" - install_dir = os.path.join("debian", package, "usr", lib_share_dir, package) + if install_dir is None: + if get_arch(package) == "all": + lib_share_dir = "share" + else: + lib_share_dir = "lib" + install_dir = os.path.join("debian", package, "usr", lib_share_dir, package) + copy_dir = os.path.join("debian", package, install_dir.strip("/")) if verbose: print "%s: install directory: %s" % (script_name, install_dir) @@ -95,9 +97,9 @@ def install_xpi(script_name, package, xpi_file, exclude, links, correct_permissi print "%s: exclude license file %s" % (script_name, name) # create directory and extract xpi file - if not os.path.isdir(install_dir): - os.makedirs(install_dir) - command = ["unzip", "-o", "-d", install_dir, xpi_file] + if not os.path.isdir(copy_dir): + os.makedirs(copy_dir) + command = ["unzip", "-o", "-d", copy_dir, xpi_file] if len(exclude) > 0: command.append("-x") command.extend(exclude) @@ -107,7 +109,7 @@ def install_xpi(script_name, package, xpi_file, exclude, links, correct_permissi # correct permissons of files to 644 and directories to 755 if correct_permissions: for name in xpi_content: - filename = os.path.join(install_dir, name) + filename = os.path.join(copy_dir, name) if os.path.exists(filename): mode = get_mode(filename) if os.path.isdir(filename) and mode != 0755: @@ -125,16 +127,15 @@ def install_xpi(script_name, package, xpi_file, exclude, links, correct_permissi os.chmod(filename, 0755) # get symlinks list - extension_id = get_extension_id(os.path.join(install_dir, "install.rdf")) - target_applications = get_target_applications(script_name, os.path.join(install_dir, "install.rdf")) + extension_id = get_extension_id(os.path.join(copy_dir, "install.rdf")) + target_applications = get_target_applications(script_name, os.path.join(copy_dir, "install.rdf")) for target_application in target_applications: destination = os.path.join("/usr/lib/mozilla/extensions/", target_application, extension_id) links.add(destination) # create symlinks - source = os.path.join("/usr", lib_share_dir, package) for link in links: - command = ["dh_link", "-p" + package, source, link] + command = ["dh_link", "-p" + package, install_dir, link] print " ".join(command) subprocess.call(command) @@ -149,6 +150,7 @@ def usage(output): Options: -x, --exclude=<file> do not install specified file + -i, --install-dir=<value> install extension into the specified directory -l, --link=<directory> link from directory to extension directory -p, --package=<value> install the extension into specified package --preserve-permissions do not adjust the file permissions @@ -162,9 +164,9 @@ See %s(1) for more info.""" % (sys.argv[0], os.path.basename(sys.argv[0])) if __name__ == "__main__": try: - long_opts = ["exclude", "help", "link", "package", + long_opts = ["exclude", "help", "install-dir", "link", "package", "preserve-permissions", "remove-license-files", "verbose"] - opts, args = getopt.gnu_getopt(sys.argv[1:], "hl:p:rvx:", long_opts) + opts, args = getopt.gnu_getopt(sys.argv[1:], "hi:l:p:rvx:", long_opts) except getopt.GetoptError, e: # print help information and exit: print >> sys.stderr, str(e) # will print something like "option -a not recognized" @@ -172,6 +174,7 @@ if __name__ == "__main__": sys.exit(COMMAND_LINE_SYNTAX_ERROR) correct_permissions = True + install_dir = None links = set() package = None remove_licenses = False @@ -184,6 +187,8 @@ if __name__ == "__main__": elif o in ("-h", "--help"): usage(sys.stdout) sys.exit() + elif o in ("-i", "--install-dir"): + install_dir = a elif o in ("-l", "--link"): links.add(a) elif o in ("-p", "--package"): @@ -212,4 +217,4 @@ if __name__ == "__main__": if verbose: print script_name + ": Install %s into package %s." % (args[0], package) - install_xpi(script_name, package, args[0], exclude, links, correct_permissions, remove_licenses, verbose) + install_xpi(script_name, package, args[0], exclude, install_dir, links, correct_permissions, remove_licenses, verbose) |