diff options
-rw-r--r-- | Changelog | 5 | ||||
-rw-r--r-- | Dockerfile | 23 | ||||
-rwxr-xr-x | bin/hafas | 4 | ||||
-rw-r--r-- | lib/Travel/Routing/DE/HAFAS.pm | 2 | ||||
-rw-r--r-- | lib/Travel/Routing/DE/HAFAS/Connection.pm | 2 | ||||
-rw-r--r-- | lib/Travel/Routing/DE/HAFAS/Connection/Section.pm | 3 | ||||
-rw-r--r-- | lib/Travel/Routing/DE/HAFAS/Location.pm | 2 | ||||
-rwxr-xr-x | scripts/makedeb-docker | 13 | ||||
-rwxr-xr-x | scripts/makedeb-docker-helper | 37 |
9 files changed, 84 insertions, 7 deletions
diff --git a/Changelog b/Changelog new file mode 100644 index 0000000..b2546d7 --- /dev/null +++ b/Changelog @@ -0,0 +1,5 @@ +Travel::Routing::DE::HAFAS 0.01 - Thu Nov 16 2023 + + * Initial release + * Supports itinerary queries using Deutschen Bahn's mgate.exe interface + * No stable API yet diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..1002fec --- /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 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 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"] @@ -3,7 +3,7 @@ use strict; use warnings; use 5.014; -our $VERSION = '0.00'; +our $VERSION = '0.01'; use utf8; use DateTime; @@ -384,7 +384,7 @@ B<hafas> [B<-d> I<date>] [B<-t> I<time>] [B<-m> I<motlist>] =head1 VERSION -version 0.00 +version 0.01 =head1 DESCRIPTION diff --git a/lib/Travel/Routing/DE/HAFAS.pm b/lib/Travel/Routing/DE/HAFAS.pm index f6cf6a1..32eb6f0 100644 --- a/lib/Travel/Routing/DE/HAFAS.pm +++ b/lib/Travel/Routing/DE/HAFAS.pm @@ -18,7 +18,7 @@ use Travel::Routing::DE::HAFAS::Connection; use Travel::Routing::DE::HAFAS::Location; use Travel::Status::DE::HAFAS::Message; -our $VERSION = '0.00'; +our $VERSION = '0.01'; # {{{ Endpoint Definition diff --git a/lib/Travel/Routing/DE/HAFAS/Connection.pm b/lib/Travel/Routing/DE/HAFAS/Connection.pm index ffb9702..bc587fc 100644 --- a/lib/Travel/Routing/DE/HAFAS/Connection.pm +++ b/lib/Travel/Routing/DE/HAFAS/Connection.pm @@ -11,7 +11,7 @@ use DateTime::Duration; use Travel::Routing::DE::HAFAS::Utils; use Travel::Routing::DE::HAFAS::Connection::Section; -our $VERSION = '0.00'; +our $VERSION = '0.01'; Travel::Routing::DE::HAFAS::Connection->mk_ro_accessors( qw(changes duration sched_dep rt_dep sched_arr rt_arr dep arr dep_platform arr_platform dep_loc arr_loc dep_cancelled arr_cancelled is_cancelled load) diff --git a/lib/Travel/Routing/DE/HAFAS/Connection/Section.pm b/lib/Travel/Routing/DE/HAFAS/Connection/Section.pm index b3f2273..f4ddb35 100644 --- a/lib/Travel/Routing/DE/HAFAS/Connection/Section.pm +++ b/lib/Travel/Routing/DE/HAFAS/Connection/Section.pm @@ -10,7 +10,7 @@ use parent 'Class::Accessor'; use DateTime::Duration; use Travel::Routing::DE::HAFAS::Utils; -our $VERSION = '0.00'; +our $VERSION = '0.01'; Travel::Routing::DE::HAFAS::Connection::Section->mk_ro_accessors( qw(type schep_dep rt_dep sched_arr rt_arr dep arr arr_delay dep_delay journey distance duration transfer_duration dep_loc arr_loc @@ -125,7 +125,6 @@ sub new { my @stops; for my $stop ( @{ $journey->{stopL} // [] } ) { my $loc = $locs->[ $stop->{locX} ]; - say $loc->name; } } elsif ( $sec->{type} eq 'WALK' ) { diff --git a/lib/Travel/Routing/DE/HAFAS/Location.pm b/lib/Travel/Routing/DE/HAFAS/Location.pm index aef6a52..a852a55 100644 --- a/lib/Travel/Routing/DE/HAFAS/Location.pm +++ b/lib/Travel/Routing/DE/HAFAS/Location.pm @@ -6,7 +6,7 @@ use 5.014; use parent 'Class::Accessor'; -our $VERSION = '0.00'; +our $VERSION = '0.01'; Travel::Routing::DE::HAFAS::Location->mk_ro_accessors( qw(lid type name eva state coordinate)); diff --git a/scripts/makedeb-docker b/scripts/makedeb-docker new file mode 100755 index 0000000..241393c --- /dev/null +++ b/scripts/makedeb-docker @@ -0,0 +1,13 @@ +#!/bin/sh + +set -e + +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..830deb0 --- /dev/null +++ b/scripts/makedeb-docker-helper @@ -0,0 +1,37 @@ +#!/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 \ + libtest-compile-perl libtest-pod-perl \ + libtest-simple-perl wget + +wget https://lib.finalrewind.org/deb/libtravel-status-de-deutschebahn-perl_4.19-1_all.deb +dpkg -i libtravel-status-de-deutschebahn-perl_4.19-1_all.deb + +apt-file update +apt-cache dumpavail | dpkg --merge-avail + +mkdir -p /src/app +cp -a /orig/Build.PL /orig/Changelog /orig/README.md /src/app +cp -a /orig/bin /orig/lib /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-Routing-DE-HAFAS-*.tar.gz ../app.tar.gz +dh-make-perl --build --version "${VERSION}" +chown ${USER}:${GROUP} ../*.deb +mv -v ../*.deb /out |