diff options
author | Alex Talker | 2016-11-06 19:59:36 +0300 |
---|---|---|
committer | Alex Talker | 2016-11-06 19:59:36 +0300 |
commit | 8719685eba8317ac173612907f0d05800baf4b7a (patch) | |
tree | 04b719b5497d309a0636be966ed2ad574127099d | |
parent | bf9eaf3b276007759928e2387da47ee68d25f7ff (diff) | |
download | aur-8719685eba8317ac173612907f0d05800baf4b7a.tar.gz |
Add generator.pl
-rw-r--r-- | .SRCINFO | 18 | ||||
-rw-r--r-- | PKGBUILD.template | 61 | ||||
-rw-r--r-- | generator.pl | 104 | ||||
-rw-r--r-- | thunderbird-earlybird-ru.desktop (renamed from thunderbird-earlybird.desktop) | 4 | ||||
-rw-r--r-- | thunderbird-earlybird-ru.install (renamed from thunderbird-earlybird.install) | 0 |
5 files changed, 178 insertions, 9 deletions
@@ -1,9 +1,11 @@ +# Generated by mksrcinfo v8 +# Sun Nov 6 16:59:21 UTC 2016 pkgbase = thunderbird-earlybird-ru - pkgdesc = Standalone Mail/News reader - Earlybird channel - pkgver = 43.0a2.20151019004005 + pkgdesc = Standalone Mail/News reader - Earlybird channel [ ru ] + pkgver = 51.0a2.20161106004006 pkgrel = 1 url = http://www.mozilla.org/thunderbird/channel - install = thunderbird-earlybird.install + install = thunderbird-earlybird-ru.install arch = i686 arch = x86_64 license = MPL @@ -32,10 +34,12 @@ pkgbase = thunderbird-earlybird-ru depends = startup-notification optdepends = libcanberra: for sound support replaces = thunderbird-aurora - source = thunderbird-earlybird.desktop - source = http://ftp.mozilla.org/pub/thunderbird/nightly/latest-comm-aurora-l10n/thunderbird-43.0a2.ru.linux-.tar.bz2 - sha512sums = c6b9266b52e0328f1ff69e1d2dd3683d2904d85ea1b0f903e5781ea7a1347d0a079e4bfa01e2414498c1fe90e2aef2cc896d394ac7546155617eabeecf3dba30 - sha512sums = + source = thunderbird-earlybird-ru.desktop + sha512sums = d7c8c55e006b619cc9a78ab0ae0a89cbf5000b54a588dd4d14f7a961fff912069ea30b9c839121667549c086ffd21392abe3bade3abd1debdd5845d2da158538 + source_i686 = http://ftp.mozilla.org/pub/thunderbird/nightly/2016/11/2016-11-06-00-40-06-comm-aurora-l10n/thunderbird-51.0a2.ru.linux-i686.tar.bz2 + sha512sums_i686 = f45fa1ca49a36a6e69015319d3123f2ec2fd459769ee0745ae0bf442313ed517175eb0c14d219cb25fa73ac9a28dbd926a4c15252924347ba7693fc9aebbfb21 + source_x86_64 = http://ftp.mozilla.org/pub/thunderbird/nightly/2016/11/2016-11-06-00-40-06-comm-aurora-l10n/thunderbird-51.0a2.ru.linux-x86_64.tar.bz2 + sha512sums_x86_64 = 7416242cc0c4017e9eade724d3bbd1cb96e32685569c8a86822e9f4d368bce07aad86020e561e00d9bcfdec43184f8dc9994fb3ee31caecfdf4d108c9a84d4f4 pkgname = thunderbird-earlybird-ru diff --git a/PKGBUILD.template b/PKGBUILD.template new file mode 100644 index 000000000000..c908f9cf4b63 --- /dev/null +++ b/PKGBUILD.template @@ -0,0 +1,61 @@ +# Maintainer: Alex Talker ( alextalker at openmailbox dot org ) +# Contributor: py_crash <agustin.ferrario@hotmail.com.ar> +# Based on kang's thunderbird-aurora +_name=thunderbird +_channel=earlybird +_milestone=[% version %].0a2 +_lang=ru + +_release_year=[% year %] +_release_month=[% month %] +_release_day=[% day %] +_release_time=$_release_year-$_release_month-$_release_day-[% hour %]-[% minute %]-[% second %] +_buildid=[% year %][% month %][% day %][% hour %][% minute %][% second %] + +pkgname=$_name-$_channel-$_lang +pkgver=[% version %].0a2.$_buildid +pkgrel=1 +pkgdesc="Standalone Mail/News reader - Earlybird channel [ $_lang ]" +url="http://www.mozilla.org/${_name}/channel" +license=('MPL' 'GPL' 'LGPL') + +arch=('i686' 'x86_64') +depends=('alsa-lib' 'cairo' 'dbus-glib' 'desktop-file-utils' 'fontconfig' + 'freetype2' 'gtk3' 'hicolor-icon-theme' 'hunspell' 'libevent' + 'libjpeg' 'libmng' 'libpng' 'libvpx' 'libxt' 'mozilla-common' + 'nspr' 'nss' 'shared-mime-info' 'sqlite3' 'startup-notification') +optdepends=('libcanberra: for sound support') + +replaces=("${_name}-aurora") +install="${pkgname}.install" + +source=("${pkgname}.desktop") + +_base_url="http://ftp.mozilla.org/pub/thunderbird/nightly/$_release_year/$_release_month/$_release_time-comm-aurora-l10n" +source_i686=("$_base_url/thunderbird-[% version %].0a2.$_lang.linux-i686.tar.bz2") +source_x86_64=("$_base_url/thunderbird-[% version %].0a2.$_lang.linux-x86_64.tar.bz2") + +sha512sums=('d7c8c55e006b619cc9a78ab0ae0a89cbf5000b54a588dd4d14f7a961fff912069ea30b9c839121667549c086ffd21392abe3bade3abd1debdd5845d2da158538') +sha512sums_i686=('[% sha512sums_i686 %]') +sha512sums_x86_64=('[% sha512sums_x86_64 %]') + +pkgver() { + cd "${_name}" + echo "${_milestone}.$(cat platform.ini|grep BuildID|cut -d "=" -f2 )" +} + +package() { + install -d "${pkgdir}"/{usr/bin,opt} + + cp -a ${_name} "${pkgdir}/opt/${pkgname}" + ln -s /opt/${pkgname}/${_name} "${pkgdir}/usr/bin/${pkgname}" + + for i in 16x16 22x22 24x24 32x32 48x48 256x256; do + install -Dm644 ${_name}/chrome/icons/default/default${i/x*/}.png "${pkgdir}/usr/share/icons/hicolor/${i}/apps/${pkgname}.png" + done + + install -Dm644 ${pkgname}.desktop "${pkgdir}/usr/share/applications/${pkgname}.desktop" + + rm -rf "${pkgdir}/opt/${pkgname}/dictionaries" + ln -sf /usr/share/hunspell "${pkgdir}/opt/${pkgname}/dictionaries" +} diff --git a/generator.pl b/generator.pl new file mode 100644 index 000000000000..9a657a70eae0 --- /dev/null +++ b/generator.pl @@ -0,0 +1,104 @@ +#!/usr/bin/perl +use v5.10; +use strict; +use warnings; +use experimental 'smartmatch'; +use Tie::File; +use Template; +use LWP::UserAgent; +use HTML::TreeBuilder; +use List::Util qw(maxstr); + +use constant { + ROOT => 'http://ftp.mozilla.org/pub/thunderbird/nightly/', +}; + +sub _find_max { + my ($tree, $filter) = @_; + + my @values = map { $_->as_text } $tree->find('a'); + @values = grep { $_ ~~ $filter } @values if defined $filter; + + unless(@values) { + say "No values can be extracted."; + exit 1; + } + + return maxstr @values; +} + +sub _get_tree { + my ($ua, $url) = @_; + + my $req = HTTP::Request->new(GET => $url); + my $res = $ua->request($req); + + if ( $res->is_success ) { + my $tree = HTML::TreeBuilder->new_from_content($res->content); + return $tree; + } + else { + say "Request $url is failed"; + exit 2; + } +} + +sub _get_part { + my ($ua, $uri, $filter) = @_; + + return _find_max(_get_tree($ua, $uri), $filter); +} + +sub _get_data { + my ($ua, $lang) = @_; + $lang //= 'en-US'; + my $uri = ROOT; + my $is_num = qr/^\d+/; + my $data = {}; + + my $year = _get_part($ua,$uri, $is_num); + $uri .= $year; + $year =~ s:/::; + $data->{year} = $year; + + my $month = _get_part($ua, $uri, $is_num); + $uri .= $month; + $month =~ s:/::; + $data->{month} = $month; + + my $release = _get_part($ua, $uri, qr(aurora-l10n/$)); + $uri .= $release; + $release =~ /^\d{4}-\d{2}-(?<day>\d+)-(?<hour>\d+)-(?<minute>\d+)-(?<second>\d+)/; + $data = { %$data, %+ }; + + my $package_i686 = _get_part($ua, $uri, qr($lang.linux-i686.tar.bz2$)); + my $package_i686_sums = _get_part($ua, $uri, qr($lang.linux-i686.checksums$)); + $data->{sha512sums_i686} = _get_hashsum($ua, $uri . $package_i686_sums, $package_i686); + + my $package_x86_64 = _get_part($ua, $uri, qr($lang.linux-x86_64.tar.bz2$)); + my $package_x86_64_sums = _get_part($ua, $uri, qr($lang.linux-x86_64.checksums$)); + $data->{sha512sums_x86_64} = _get_hashsum($ua, $uri . $package_x86_64_sums, $package_x86_64); + + $data->{version} = $1 if $package_x86_64 =~ /thunderbird-(\d+)/; + + return $data; +} + +sub _get_hashsum { + my ($ua, $uri, $file) = @_; + + my $req = HTTP::Request->new(GET => $uri); + my $res = $ua->request($req); + if ( $res->is_success ) { + $res->content =~ /(?<sum>[0-9a-f]+) sha512 [\d]+ $file/m; + return $+{sum}; + } +} + +my $ua = LWP::UserAgent->new; +my $data = _get_data($ua, 'ru'); + +my $t = Template->new(RELATIVE => 1); + +say "Generate PKGBUILD for version $data->{version}..."; +$t->process('PKGBUILD.template', $data, 'PKGBUILD') || die $t->error(); diff --git a/thunderbird-earlybird.desktop b/thunderbird-earlybird-ru.desktop index 7fef66359b35..5c63f6531602 100644 --- a/thunderbird-earlybird.desktop +++ b/thunderbird-earlybird-ru.desktop @@ -3,9 +3,9 @@ Version=1.0 Name=Earlybird Comment=Mail & News Reader GenericName=Mail Client & News Reader -Exec=thunderbird %u +Exec=thunderbird-earlybird-ru %u TryExec=thunderbird -Icon=thunderbird-earlybird +Icon=thunderbird-earlybird-ru Terminal=false Type=Application Categories=Network;Email; diff --git a/thunderbird-earlybird.install b/thunderbird-earlybird-ru.install index 4d4a283dba5c..4d4a283dba5c 100644 --- a/thunderbird-earlybird.install +++ b/thunderbird-earlybird-ru.install |