/install_extension.pl
Perl | 66 lines | 49 code | 11 blank | 6 comment | 9 complexity | ad78e9641ee4421903fff14eaff4424c MD5 | raw file
Possible License(s): MPL-2.0-no-copyleft-exception
- #!/usr/bin/perl -w
- # -*- coding: utf-8 -*-
- # Wrzuca po prostu najnowszÄ
wersjÄ. Nadawanie numerka wersji
- # itp jest w build_extension.
- use strict;
- use warnings;
- use FindBin;
- use Path::Tiny;
- use IPC::System::Simple qw(systemx capturex);
- use autodie qw ':all';
- my $top_path = path($FindBin::Bin);
- my $ext_path = $top_path->child("firefox-sdk");
- chdir $ext_path;
- my @newest = (0, 0, 0);
- my @taglines = capturex("hg", "tags");
- foreach (@taglines) {
- if(/^(\d+)\.(\d+)\.(\d+)\b/x) {
- if( $1 > $newest[0]
- || ($1 == $newest[0]
- && ($2 > $newest[1]
- || ($2 == $newest[1] && $3 > $newest[2])))) {
- @newest = ($1, $2, $3);
- }
- }
- }
- my $version = join('.', @newest);
- # Radosny jpm sign czasem robi -an+fx a czasem -fx+an
- my @xpi_candidates = (
- path('schemingmind_tuning-' . $version . '-an+fx.xpi'),
- path('schemingmind_tuning-' . $version . '-fx+an.xpi'),
- );
- my $xpi_file;
- foreach my $cnd (@xpi_candidates) {
- if($cnd->is_file) {
- $xpi_file = $cnd;
- last;
- }
- }
- unless($xpi_file) {
- die "Signed xpi not found. Looked for: " . join(", ", @xpi_candidates) . "\n";
- }
- my $rdf_file = path ('@smtuning-' . $version . '.update.rdf');
- foreach my $f (($rdf_file)) {
- unless($f->is_file) {
- die "File $f does not exist. jpm failed? build not made?\n";
- }
- }
- print "Installing $version\n";
- my $remote_xpi_name = "smtuning-$version.xpi";
- my $remote_rdf_name = "update-$version.xpi";
- systemx("scp", $xpi_file, "linode.mekk.waw.pl:www_download/smtuning/$remote_xpi_name");
- systemx("scp", $rdf_file, "linode.mekk.waw.pl:www_download/smtuning/$remote_rdf_name");
- systemx("ssh", "linode.mekk.waw.pl", "cd www_download/smtuning/; ln -sf $remote_xpi_name smtuning.xpi; ln -sf $remote_rdf_name update.rdf");
- #system("hg push bitbucket");
- systemx("hg", "push", "bitssh");