diff options
-rw-r--r-- | Build.PL | 1 | ||||
-rw-r--r-- | Changelog | 6 | ||||
-rw-r--r-- | Dockerfile | 23 | ||||
-rw-r--r-- | README | 1 | ||||
-rwxr-xr-x | bin/hafas-m | 4 | ||||
-rw-r--r-- | cpanfile | 17 | ||||
-rw-r--r-- | lib/Travel/Status/DE/DeutscheBahn.pm | 4 | ||||
-rw-r--r-- | lib/Travel/Status/DE/HAFAS.pm | 67 | ||||
-rw-r--r-- | lib/Travel/Status/DE/HAFAS/Result.pm | 4 | ||||
-rw-r--r-- | lib/Travel/Status/DE/HAFAS/StopFinder.pm | 4 | ||||
-rwxr-xr-x | scripts/check-hafas-urls | 20 | ||||
-rwxr-xr-x | scripts/makedeb-docker | 11 | ||||
-rwxr-xr-x | scripts/makedeb-docker-helper | 34 |
13 files changed, 157 insertions, 39 deletions
@@ -27,6 +27,7 @@ Module::Build->new( 'List::MoreUtils' => 0, 'List::Util' => 0, 'LWP::UserAgent' => 0, + 'LWP::Protocol::https' => 0, 'POSIX' => 0, 'XML::LibXML' => '1.70', }, @@ -1,3 +1,9 @@ +Travel::Status::DE::DeutscheBahn 2.05 - Sun May 03 2020 + + * Document LWP::Protocol::https dependency + * Remove BVG (Berliner Verkehrsgesellschaft) and SBB + (Schweizerische Bundesbahnen) services + Travel::Status::DE::DeutscheBahn 2.04 - Sun Dec 30 2018 * Handle invalid XML when using the VBB backend diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..0313f62 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,23 @@ +FROM perl:5.30-slim + +COPY bin/ /app/bin/ +COPY lib/ /app/lib/ +COPY Build.PL cpanfile* /app/ + +WORKDIR /app + +ARG DEBIAN_FRONTEND=noninteractive +ARG APT_LISTCHANGES_FRONTEND=none + +RUN apt-get update \ + && apt-get -y --no-install-recommends install ca-certificates curl gcc libc6-dev libssl1.1 libssl-dev libxml2 libxml2-dev make zlib1g-dev \ + && cpanm -n --no-man-pages --installdeps . \ + && perl Build.PL \ + && perl Build \ + && rm -rf ~/.cpanm \ + && apt-get -y purge curl gcc libc6-dev libssl-dev libxml2-dev make zlib1g-dev \ + && apt-get -y autoremove \ + && apt-get -y clean \ + && rm -rf /var/cache/apt/* /var/lib/apt/lists/* + +ENTRYPOINT ["perl", "-Ilib", "bin/hafas-m"] @@ -15,6 +15,7 @@ Dependencies * JSON * List::MoreUtils * LWP::UserAgent (usually shipped by libwww-perl) + * LWP::Protocol::https * XML::LibXML Installation diff --git a/bin/hafas-m b/bin/hafas-m index 66ef99d..2b91146 100755 --- a/bin/hafas-m +++ b/bin/hafas-m @@ -3,7 +3,7 @@ use strict; use warnings; use 5.014; -our $VERSION = '2.04'; +our $VERSION = '2.05'; use Encode qw(decode); use Getopt::Long qw(:config no_ignore_case); @@ -212,7 +212,7 @@ B<hafas-m> [B<-d> I<date>] [B<-t> I<time>] [B<-m> I<motlist>] =head1 VERSION -version 2.04 +version 2.05 =head1 DESCRIPTION diff --git a/cpanfile b/cpanfile new file mode 100644 index 0000000..a03b77d --- /dev/null +++ b/cpanfile @@ -0,0 +1,17 @@ +requires 'Class::Accessor'; +requires 'DateTime'; +requires 'DateTime::Format::Strptime'; +requires 'Getopt::Long'; +requires 'JSON'; +requires 'List::MoreUtils'; +requires 'List::Util'; +requires 'LWP::UserAgent'; +requires 'LWP::Protocol::https'; +requires 'POSIX'; +requires 'XML::LibXML'; + +on test => sub { + requires 'Test::Compile'; + requires 'Test::More'; + requires 'Test::Pod'; +}; diff --git a/lib/Travel/Status/DE/DeutscheBahn.pm b/lib/Travel/Status/DE/DeutscheBahn.pm index 66f16a1..baca059 100644 --- a/lib/Travel/Status/DE/DeutscheBahn.pm +++ b/lib/Travel/Status/DE/DeutscheBahn.pm @@ -6,7 +6,7 @@ use 5.014; use parent 'Travel::Status::DE::HAFAS'; -our $VERSION = '2.04'; +our $VERSION = '2.05'; sub new { my ( $class, %opt ) = @_; @@ -49,7 +49,7 @@ monitor operated by Deutsche Bahn =head1 VERSION -version 2.04 +version 2.05 =head1 DESCRIPTION diff --git a/lib/Travel/Status/DE/HAFAS.pm b/lib/Travel/Status/DE/HAFAS.pm index 234887b..0dccb99 100644 --- a/lib/Travel/Status/DE/HAFAS.pm +++ b/lib/Travel/Status/DE/HAFAS.pm @@ -16,64 +16,69 @@ use Travel::Status::DE::HAFAS::Result; use Travel::Status::DE::HAFAS::StopFinder; use XML::LibXML; -our $VERSION = '2.04'; +our $VERSION = '2.05'; my %hafas_instance = ( - BVG => { - url => 'http://bvg.hafas.de/bin/stboard.exe', - stopfinder => 'http://bvg.hafas.de/bin/ajax-getstop.exe', - name => 'Berliner Verkehrsgesellschaft', - productbits => [qw[s u tram bus ferry ice regio ondemand]], - }, + + #BVG => { + # url => 'https://bvg.hafas.de/bin/stboard.exe', + # stopfinder => 'https://bvg.hafas.de/bin/ajax-getstop.exe', + # name => 'Berliner Verkehrsgesellschaft', + # productbits => [qw[s u tram bus ferry ice regio ondemand]], + #}, DB => { - url => 'https://reiseauskunft.bahn.de/bin/bhftafel.exe', - stopfinder => 'https://reiseauskunft.bahn.de/bin/ajax-getstop.exe', - name => 'Deutsche Bahn', + url => 'https://reiseauskunft.bahn.de/bin/bhftafel.exe', + stopfinder => 'https://reiseauskunft.bahn.de/bin/ajax-getstop.exe', + trainsearch => 'https://reiseauskunft.bahn.de/bin/trainsearch.exe', + traininfo => 'https://reiseauskunft.bahn.de/bin/traininfo.exe', + name => 'Deutsche Bahn', productbits => [qw[ice ic_ec d regio s bus ferry u tram ondemand x x x x]], }, NAHSH => { - url => 'http://nah.sh.hafas.de/bin/stboard.exe', - stopfinder => 'http://nah.sh.hafas.de/bin/ajax-getstop.exe', + url => 'https://nah.sh.hafas.de/bin/stboard.exe', + stopfinder => 'https://nah.sh.hafas.de/bin/ajax-getstop.exe', name => 'Nahverkehrsverbund Schleswig-Holstein', productbits => [qw[ice ice ice regio s bus ferry u tram ondemand]], }, NASA => { - url => 'http://reiseauskunft.insa.de/bin/stboard.exe', - stopfinder => 'http://reiseauskunft.insa.de/bin/ajax-getstop.exe', + url => 'https://reiseauskunft.insa.de/bin/stboard.exe', + stopfinder => 'https://reiseauskunft.insa.de/bin/ajax-getstop.exe', name => 'Nahverkehrsservice Sachsen-Anhalt', productbits => [qw[ice ice regio regio regio tram bus ondemand]], }, NVV => { - url => 'http://auskunft.nvv.de/auskunft/bin/jp/stboard.exe', - stopfinder => 'http://auskunft.nvv.de/auskunft/bin/jp/ajax-getstop.exe', - name => 'Nordhessischer VerkehrsVerbund', + url => 'https://auskunft.nvv.de/auskunft/bin/jp/stboard.exe', + stopfinder => + 'https://auskunft.nvv.de/auskunft/bin/jp/ajax-getstop.exe', + name => 'Nordhessischer VerkehrsVerbund', productbits => [qw[ice ic_ec regio s u tram bus bus ferry ondemand regio regio]], }, 'ÖBB' => { - url => 'http://fahrplan.oebb.at/bin/stboard.exe', - stopfinder => 'http://fahrplan.oebb.at/bin/ajax-getstop.exe', + url => 'https://fahrplan.oebb.at/bin/stboard.exe', + stopfinder => 'https://fahrplan.oebb.at/bin/ajax-getstop.exe', name => 'Österreichische Bundesbahnen', productbits => [qw[ice ice ice regio regio s bus ferry u tram ice ondemand ice]], }, RSAG => { - url => 'http://fahrplan.rsag-online.de/hafas/stboard.exe', - stopfinder => 'http://fahrplan.rsag-online.de/hafas/ajax-getstop.exe', + url => 'https://fahrplan.rsag-online.de/hafas/stboard.exe', + stopfinder => 'https://fahrplan.rsag-online.de/hafas/ajax-getstop.exe', name => 'Rostocker Straßenbahn AG', productbits => [qw[ice ice ice regio s bus ferry u tram ondemand]], }, - SBB => { - url => 'http://fahrplan.sbb.ch/bin/stboard.exe', - stopfinder => 'http://fahrplan.sbb.ch/bin/ajax-getstop.exe', - name => 'Schweizerische Bundesbahnen', - productbits => - [qw[ice ice regio regio ferry s bus cablecar regio tram]], - }, + + #SBB => { + # url => 'https://fahrplan.sbb.ch/bin/stboard.exe', + # stopfinder => 'https://fahrplan.sbb.ch/bin/ajax-getstop.exe', + # name => 'Schweizerische Bundesbahnen', + # productbits => + # [qw[ice ice regio regio ferry s bus cablecar regio tram]], + #}, VBB => { - url => 'http://fahrinfo.vbb.de/bin/stboard.exe', - stopfinder => 'http://fahrinfo.vbb.de/bin/ajax-getstop.exe', + url => 'https://fahrinfo.vbb.de/bin/stboard.exe', + stopfinder => 'https://fahrinfo.vbb.de/bin/ajax-getstop.exe', name => 'Verkehrsverbund Berlin-Brandenburg', productbits => [qw[s u tram bus ferry ice regio]], }, @@ -425,7 +430,7 @@ monitors =head1 VERSION -version 2.04 +version 2.05 =head1 DESCRIPTION diff --git a/lib/Travel/Status/DE/HAFAS/Result.pm b/lib/Travel/Status/DE/HAFAS/Result.pm index bdc1340..2950736 100644 --- a/lib/Travel/Status/DE/HAFAS/Result.pm +++ b/lib/Travel/Status/DE/HAFAS/Result.pm @@ -8,7 +8,7 @@ no if $] >= 5.018, warnings => 'experimental::smartmatch'; use parent 'Class::Accessor'; -our $VERSION = '2.04'; +our $VERSION = '2.05'; Travel::Status::DE::HAFAS::Result->mk_ro_accessors( qw(date datetime info raw_e_delay raw_delay time train route_end)); @@ -190,7 +190,7 @@ arrival/departure received by Travel::Status::DE::HAFAS =head1 VERSION -version 2.04 +version 2.05 =head1 DESCRIPTION diff --git a/lib/Travel/Status/DE/HAFAS/StopFinder.pm b/lib/Travel/Status/DE/HAFAS/StopFinder.pm index c472c97..d99ee2f 100644 --- a/lib/Travel/Status/DE/HAFAS/StopFinder.pm +++ b/lib/Travel/Status/DE/HAFAS/StopFinder.pm @@ -12,7 +12,7 @@ use Encode qw(decode); use JSON; use LWP::UserAgent; -our $VERSION = '2.04'; +our $VERSION = '2.05'; sub new { my ( $obj, %conf ) = @_; @@ -123,7 +123,7 @@ finder services =head1 VERSION -version 2.04 +version 2.05 =head1 DESCRIPTION diff --git a/scripts/check-hafas-urls b/scripts/check-hafas-urls new file mode 100755 index 0000000..9c77e37 --- /dev/null +++ b/scripts/check-hafas-urls @@ -0,0 +1,20 @@ +#!/usr/bin/env zsh + +export PERL5LIB=lib + +checks="DB Berlin Jannowitzbrücke +NAHSH Flensburg Solitüde +NASA Wernigerode Hbf +NVV Kassel Hbf +ÖBB Wien Praterstern +RSAG Rostock Hbf +VBB Berlin Jannowitzbrücke +VBN Diepholz" + +echo $checks | while read service stop; do + echo -n "${service} ... " + if bin/hafas-m -s $service $stop > /dev/null; then + echo OK + fi +done + diff --git a/scripts/makedeb-docker b/scripts/makedeb-docker new file mode 100755 index 0000000..6c06971 --- /dev/null +++ b/scripts/makedeb-docker @@ -0,0 +1,11 @@ +#!/bin/sh + +mkdir -p out + +docker run --rm -v "${PWD}:/orig:ro" -v "${PWD}/scripts:/scripts:ro" \ + -v "${PWD}/out:/out" -e USER=$(id -u) -e GROUP=$(id -g) \ + -e "DEBEMAIL=${DEBEMAIL}" -e "DEBFULLNAME=${DEBFULLNAME}" \ + -e "LOGNAME=${LOGNAME}" -e "VERSION=$(git describe --dirty)-1" \ + debian:buster /scripts/makedeb-docker-helper + +echo "Debian package has been written to $(pwd)/out" diff --git a/scripts/makedeb-docker-helper b/scripts/makedeb-docker-helper new file mode 100755 index 0000000..970a9a0 --- /dev/null +++ b/scripts/makedeb-docker-helper @@ -0,0 +1,34 @@ +#!/bin/sh + +set -e + +export DEBIAN_FRONTEND=noninteractive +export APT_LISTCHANGES_FRONTEND=none + +apt-get update +apt-get -y install \ + apt-file dh-make-perl libmodule-build-perl \ + libclass-accessor-perl libdatetime-perl libdatetime-format-strptime-perl \ + liblwp-protocol-https-perl libjson-perl libjson-xs-perl \ + liblist-moreutils-perl \ + libwww-perl libxml-libxml-perl \ + libtest-compile-perl libtest-pod-perl \ + libtest-simple-perl + +apt-file update +apt-cache dumpavail | dpkg --merge-avail + +mkdir -p /src/app +cp -a /orig/Build.PL /orig/Changelog /orig/README /src/app +cp -a /orig/bin /orig/lib /orig/t /src/app +cd /src/app + +sed -i 's/sign *=> *1/sign => 0/' Build.PL +perl Build.PL +perl Build +perl Build manifest +perl Build dist +mv Travel-Status-DE-DeutscheBahn-*.tar.gz ../app.tar.gz +dh-make-perl --build --version "${VERSION}" +chown ${USER}:${GROUP} ../*.deb +mv -v ../*.deb /out |