8
0
Stephan Kulow
2016-11-08 09:20:12 +00:00
committed by Git OBS Bridge
commit ef02464f6f
6 changed files with 180 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
.osc

3
Mojo-SQLite-1.000.tar.gz Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:3da93a6002c61b386d690482a52d593b070d99000af1e0a7a21fb9ccec25543c
size 41559

24
cpanspec.yml Normal file
View File

@@ -0,0 +1,24 @@
---
#description_paragraphs: 3
#no_testing: broken upstream
#sources:
# - source1
# - source2
#patches:
# foo.patch: -p1
# bar.patch:
#preamble: |-
# BuildRequires: gcc-c++
#post_prep: |-
# hunspell=`pkg-config --libs hunspell | sed -e 's,-l,,; s, *,,g'`
# sed -i -e "s,hunspell-X,$hunspell," t/00-prereq.t Makefile.PL
#post_install: |-
# sed on %{name}.files
#license: SUSE-NonFree
#skip_noarch: 1
#custom_build: |-
#./Build build flags=%{?_smp_mflags} --myflag
#custom_test: |-
#startserver && make test
#ignore_requires: Bizarre::Module

5
perl-Mojo-SQLite.changes Normal file
View File

@@ -0,0 +1,5 @@
-------------------------------------------------------------------
Mon Nov 07 14:16:00 CET 2016 - sriedel@suse.de
- initial version (1.000)

124
perl-Mojo-SQLite.spec Normal file
View File

@@ -0,0 +1,124 @@
#
# spec file for package perl-Mojo-SQLite
#
# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
Name: perl-Mojo-SQLite
Version: 1.000
Release: 0
%define cpan_name Mojo-SQLite
Summary: Tiny Mojolicious Wrapper for Sqlite
License: Artistic-2.0
Group: Development/Libraries/Perl
Url: https://metacpan.org/release/Mojo-SQLite
Source0: http://www.cpan.org/authors/id/D/DB/DBOOK/%{cpan_name}-%{version}.tar.gz
BuildArch: noarch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: perl
BuildRequires: perl-macros
BuildRequires: perl(DBD::SQLite) >= 1.50
BuildRequires: perl(DBI) >= 1.627
BuildRequires: perl(Module::Build::Tiny) >= 0.034
BuildRequires: perl(Mojolicious) >= 6.14
BuildRequires: perl(Test::More) >= 0.88
BuildRequires: perl(URI) >= 1.69
BuildRequires: perl(URI::db) >= 0.15
BuildRequires: perl(URI::file) >= 4.21
Requires: perl(DBD::SQLite) >= 1.50
Requires: perl(DBI) >= 1.627
Requires: perl(Mojolicious) >= 6.14
Requires: perl(URI) >= 1.69
Requires: perl(URI::db) >= 0.15
Requires: perl(URI::file) >= 4.21
%{perl_requires}
%description
Mojo::SQLite is a tiny wrapper around DBD::SQLite that makes at
https://www.sqlite.org/ a lot of fun to use with the at https://mojolico.us
real-time web framework.
Database and statement handles are cached automatically, so they can be
reused transparently to increase performance. And you can handle connection
timeouts gracefully by holding on to them only for short amounts of time.
use Mojolicious::Lite;
use Mojo::SQLite;
helper sqlite => sub { state $sql = Mojo::SQLite->new('sqlite:sqlite.db') };
get '/' => sub {
my $c = shift;
my $db = $c->sqlite->db;
$c->render(json => $db->query('select datetime("now","localtime") as now')->hash);
};
app->start;
All I/O and queries are performed synchronously. However, the "Write-Ahead
Log" journal is enabled for all connections, allowing multiple processes to
read and write concurrently to the same database file (but only one can
write at a time). See http://sqlite.org/wal.html for more information.
# Performed concurrently
my $pid = fork || die $!;
say $sql->db->query('select datetime("now","localtime") as time')->hash->{time};
exit unless $pid;
All cached database handles will be reset automatically if a new process
has been forked, this allows multiple processes to share the same
Mojo::SQLite object safely.
Any database errors will throw an exception as 'RaiseError' is
automatically enabled, so use 'eval' or Try::Tiny to catch them. This makes
transactions with Mojo::SQLite::Database/"begin" easy.
While passing a file path of ':memory:' (or a custom "dsn" with
'mode=memory') will create a temporary database, in-memory databases cannot
be shared between connections, so subsequent calls to "db" may return
connections to completely different databases. For a temporary database
that can be shared between connections and processes, pass a file path of
':temp:' to store the database in a temporary directory (this is the
default), or consider constructing a temporary directory yourself with
File::Temp if you need to reuse the filename. A temporary directory allows
SQLite to create at https://www.sqlite.org/tempfiles.html safely.
use File::Spec::Functions 'catfile';
use File::Temp;
use Mojo::SQLite;
my $tempdir = File::Temp->newdir; # Deleted when object goes out of scope
my $tempfile = catfile $tempdir, 'sqlite.db';
my $sql = Mojo::SQLite->new->from_filename($tempfile);
%prep
%setup -q -n %{cpan_name}-%{version}
find . -type f ! -name \*.pl -print0 | xargs -0 chmod 644
%build
%{__perl} Build.PL --installdirs=vendor
./Build build --flags=%{?_smp_mflags}
%check
./Build test
%install
./Build install --destdir=%{buildroot} --create_packlist=0
%perl_gen_filelist
%files -f %{name}.files
%defattr(-,root,root,755)
%doc Changes examples LICENSE README
%changelog