Compare commits
36 commits
main
...
packages/f
| Author | SHA1 | Date | |
|---|---|---|---|
| ed0e78669a | |||
| ebbc6c5bda | |||
| c6d1536210 | |||
| 0d8bd70eb1 | |||
| 4763d493c9 | |||
| ae8213c53f | |||
| 393c40e1d5 | |||
| 413b00c196 | |||
| e0bc737802 | |||
| 056498d21a | |||
| 6413109dc4 | |||
| 145eb6dfec | |||
| 93496f9c7f | |||
| 11bc0efca1 | |||
| eba1c23557 | |||
| 7b650bbfd9 | |||
| 84003676a8 | |||
| 461d5a7a51 | |||
| 38f8363b4d | |||
| 3ca5bb7dc8 | |||
| 839c29e22a | |||
| 8fe6bba7f8 | |||
| cf904747d9 | |||
| cea596070c | |||
| 635d63542c | |||
| d7b0f56062 | |||
| 74f9710b01 | |||
| f75c16b264 | |||
| 93ce8e761f | |||
| d0cdf4e43b | |||
| 313a33c639 | |||
| 13a01485f4 | |||
| 85b60c75a1 | |||
| adb881f525 | |||
| 0420c2f230 | |||
| d615fb661b |
3 changed files with 96 additions and 16 deletions
15
.SRCINFO
15
.SRCINFO
|
|
@ -1,6 +1,6 @@
|
||||||
pkgbase = firefox-syncstorage
|
pkgbase = firefox-syncstorage
|
||||||
pkgdesc = Sync storage server with built-in token server for running a self-hosted firefox sync server
|
pkgdesc = Sync storage server with built-in token server for running a self-hosted firefox sync server
|
||||||
pkgver = 0.12.4
|
pkgver = 0.21.1
|
||||||
pkgrel = 1
|
pkgrel = 1
|
||||||
url = https://github.com/mozilla-services/syncstorage-rs
|
url = https://github.com/mozilla-services/syncstorage-rs
|
||||||
install = firefox-syncstorage.install
|
install = firefox-syncstorage.install
|
||||||
|
|
@ -10,19 +10,20 @@ pkgbase = firefox-syncstorage
|
||||||
arch = armv6h
|
arch = armv6h
|
||||||
arch = armv7h
|
arch = armv7h
|
||||||
arch = aarch64
|
arch = aarch64
|
||||||
license = MPL2
|
license = MPL-2.0
|
||||||
makedepends = rust
|
makedepends = rust
|
||||||
makedepends = cmake
|
makedepends = cmake
|
||||||
makedepends = pkgconf
|
makedepends = pkgconf
|
||||||
makedepends = mariadb-libs
|
makedepends = mariadb-libs
|
||||||
depends = openssl
|
depends = openssl
|
||||||
depends = python-fxa
|
|
||||||
depends = python-tokenlib
|
|
||||||
optdepends = mysql: for use with a local database server
|
optdepends = mysql: for use with a local database server
|
||||||
|
options = !lto
|
||||||
backup = etc/firefox-syncstorage.toml
|
backup = etc/firefox-syncstorage.toml
|
||||||
source = https://github.com/mozilla-services/syncstorage-rs/archive/0.12.4.tar.gz
|
source = https://github.com/mozilla-services/syncstorage-rs/archive/0.21.1/syncstorage-rs-0.21.1.tar.gz
|
||||||
source = firefox-syncstorage.service
|
source = firefox-syncstorage.service
|
||||||
sha256sums = 05817b02e74fb4f45a10b1b2583bf353616624a1c776cf72c185f9e89189590b
|
source = mariadb-compat.patch
|
||||||
sha256sums = 609e057cd835ea54b06b32b98e210cd946255f652e7754c9160fd7c94379a83d
|
sha512sums = dcf10d5d6e286dea69faaabdf6ad2f60e7d4e0563ec30dc113318c809d4224e05289423ed688080c7d74d97e5236176047ec889f96829ceb8dfc4aa9991e2d7e
|
||||||
|
sha512sums = 4c5fbb99160613ba3fb0fedce97f04f63b92699fe79c6edd899d4ec5f297c5a98c0c211df3eb9a6579c12c57f4c63513747ed8944a60fc76e32f1e0c0f5e3a95
|
||||||
|
sha512sums = fc24c504defb2961388833a5d6f96d883c533f58476de595f697ff5d42daabd21f8ce3c52e3f1897e089fcd8f2791d93ecc42eeee49f0100a17fd1689fa112c7
|
||||||
|
|
||||||
pkgname = firefox-syncstorage
|
pkgname = firefox-syncstorage
|
||||||
|
|
|
||||||
28
PKGBUILD
28
PKGBUILD
|
|
@ -1,36 +1,46 @@
|
||||||
# Maintainer: Manuel Hüsers <aur@huesers.de>
|
# Maintainer: Manuel Hüsers <aur@huesers.de>
|
||||||
|
# Contributor: Matthieu Valleton <mvalleton@seos.fr>
|
||||||
# Contributor: jewelux <jewelux.aur@prejo.de>
|
# Contributor: jewelux <jewelux.aur@prejo.de>
|
||||||
|
|
||||||
# Based off the firefox-syncstorage-git PKGBUILD from jewelux
|
# Based off the firefox-syncstorage-git PKGBUILD from jewelux
|
||||||
|
|
||||||
pkgname=firefox-syncstorage
|
pkgname=firefox-syncstorage
|
||||||
_pkgname=syncstorage-rs
|
_pkgname=syncstorage-rs
|
||||||
pkgver=0.12.4
|
pkgver=0.21.1
|
||||||
pkgrel=1
|
pkgrel=1
|
||||||
pkgdesc='Sync storage server with built-in token server for running a self-hosted firefox sync server'
|
pkgdesc='Sync storage server with built-in token server for running a self-hosted firefox sync server'
|
||||||
arch=('i686' 'x86_64' 'arm' 'armv6h' 'armv7h' 'aarch64')
|
arch=('i686' 'x86_64' 'arm' 'armv6h' 'armv7h' 'aarch64')
|
||||||
url="https://github.com/mozilla-services/${_pkgname}"
|
url="https://github.com/mozilla-services/${_pkgname}"
|
||||||
license=('MPL2')
|
license=('MPL-2.0')
|
||||||
depends=('openssl' 'python-fxa' 'python-tokenlib')
|
depends=('openssl')
|
||||||
makedepends=('rust' 'cmake' 'pkgconf' 'mariadb-libs')
|
makedepends=('rust' 'cmake' 'pkgconf' 'mariadb-libs')
|
||||||
optdepends=('mysql: for use with a local database server')
|
optdepends=('mysql: for use with a local database server')
|
||||||
|
options=('!lto')
|
||||||
install="${pkgname}.install"
|
install="${pkgname}.install"
|
||||||
source=("https://github.com/mozilla-services/${_pkgname}/archive/${pkgver}.tar.gz"
|
source=("https://github.com/mozilla-services/${_pkgname}/archive/${pkgver}/${_pkgname}-${pkgver}.tar.gz"
|
||||||
"${pkgname}.service")
|
"${pkgname}.service"
|
||||||
sha256sums=('05817b02e74fb4f45a10b1b2583bf353616624a1c776cf72c185f9e89189590b'
|
"mariadb-compat.patch")
|
||||||
'609e057cd835ea54b06b32b98e210cd946255f652e7754c9160fd7c94379a83d')
|
sha512sums=('dcf10d5d6e286dea69faaabdf6ad2f60e7d4e0563ec30dc113318c809d4224e05289423ed688080c7d74d97e5236176047ec889f96829ceb8dfc4aa9991e2d7e'
|
||||||
|
'4c5fbb99160613ba3fb0fedce97f04f63b92699fe79c6edd899d4ec5f297c5a98c0c211df3eb9a6579c12c57f4c63513747ed8944a60fc76e32f1e0c0f5e3a95'
|
||||||
|
'fc24c504defb2961388833a5d6f96d883c533f58476de595f697ff5d42daabd21f8ce3c52e3f1897e089fcd8f2791d93ecc42eeee49f0100a17fd1689fa112c7')
|
||||||
backup=("etc/${pkgname}.toml")
|
backup=("etc/${pkgname}.toml")
|
||||||
|
|
||||||
|
# Patch for MariaDB compatibility, cf. https://github.com/mozilla-services/syncstorage-rs/issues/1753
|
||||||
|
prepare() {
|
||||||
|
cd ${_pkgname}-${pkgver}
|
||||||
|
patch -p1 -i "${srcdir}/mariadb-compat.patch"
|
||||||
|
}
|
||||||
|
|
||||||
build() {
|
build() {
|
||||||
cd "${_pkgname}-${pkgver}"
|
cd "${_pkgname}-${pkgver}"
|
||||||
cargo build --release --features grpcio/openssl
|
cargo build --release --no-default-features --features=syncstorage-db/mysql
|
||||||
}
|
}
|
||||||
|
|
||||||
package() {
|
package() {
|
||||||
cd "${_pkgname}-${pkgver}"
|
cd "${_pkgname}-${pkgver}"
|
||||||
|
|
||||||
# Installing manually
|
# Installing manually
|
||||||
install -Dm 755 target/release/syncstorage "${pkgdir}"/usr/bin/"${pkgname}"
|
install -Dm 755 target/release/syncserver "${pkgdir}"/usr/bin/"${pkgname}"
|
||||||
install -Dm 644 config/local.example.toml "${pkgdir}"/etc/"${pkgname}".toml
|
install -Dm 644 config/local.example.toml "${pkgdir}"/etc/"${pkgname}".toml
|
||||||
install -Dm 644 "${srcdir}/${pkgname}".service "${pkgdir}"/usr/lib/systemd/system/"${pkgname}".service
|
install -Dm 644 "${srcdir}/${pkgname}".service "${pkgdir}"/usr/lib/systemd/system/"${pkgname}".service
|
||||||
}
|
}
|
||||||
|
|
|
||||||
69
mariadb-compat.patch
Normal file
69
mariadb-compat.patch
Normal file
|
|
@ -0,0 +1,69 @@
|
||||||
|
idiff --git a/syncstorage-mysql/src/diesel_ext.rs b/syncstorage-mysql/src/diesel_ext.rs
|
||||||
|
index 18abb4a..fe52470 100644
|
||||||
|
--- a/syncstorage-mysql/src/diesel_ext.rs
|
||||||
|
+++ b/syncstorage-mysql/src/diesel_ext.rs
|
||||||
|
@@ -3,11 +3,43 @@ use std::{fmt::Debug, marker::PhantomData};
|
||||||
|
use diesel::{
|
||||||
|
backend::Backend,
|
||||||
|
insertable::CanInsertInSingleQuery,
|
||||||
|
+ mysql::Mysql,
|
||||||
|
query_builder::{AstPass, InsertStatement, QueryFragment, QueryId},
|
||||||
|
+ query_dsl::methods::LockingDsl,
|
||||||
|
result::QueryResult,
|
||||||
|
Expression, QuerySource, RunQueryDsl,
|
||||||
|
};
|
||||||
|
|
||||||
|
+/// Emit MySQL <= 5.7's `LOCK IN SHARE MODE`
|
||||||
|
+///
|
||||||
|
+/// MySQL 8 supports `FOR SHARE` as an alias (which diesel natively supports)
|
||||||
|
+pub trait LockInShareModeDsl {
|
||||||
|
+ type Output;
|
||||||
|
+
|
||||||
|
+ fn lock_in_share_mode(self) -> Self::Output;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+impl<T> LockInShareModeDsl for T
|
||||||
|
+where
|
||||||
|
+ T: LockingDsl<LockInShareMode>,
|
||||||
|
+{
|
||||||
|
+ type Output = <T as LockingDsl<LockInShareMode>>::Output;
|
||||||
|
+
|
||||||
|
+ fn lock_in_share_mode(self) -> Self::Output {
|
||||||
|
+ self.with_lock(LockInShareMode)
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+#[derive(Debug, Clone, Copy, QueryId)]
|
||||||
|
+pub struct LockInShareMode;
|
||||||
|
+
|
||||||
|
+impl QueryFragment<Mysql> for LockInShareMode {
|
||||||
|
+ fn walk_ast<'b>(&'b self, mut out: AstPass<'_, 'b, Mysql>) -> QueryResult<()> {
|
||||||
|
+ out.push_sql(" LOCK IN SHARE MODE");
|
||||||
|
+ Ok(())
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
#[allow(dead_code)] // Not really dead, Rust can't see it.
|
||||||
|
#[derive(Debug, Clone)]
|
||||||
|
pub struct OnDuplicateKeyUpdate<T, U, Op, Ret, DB, X>(
|
||||||
|
diff --git a/syncstorage-mysql/src/models.rs b/syncstorage-mysql/src/models.rs
|
||||||
|
index 1114f21..fb54649 100644
|
||||||
|
--- a/syncstorage-mysql/src/models.rs
|
||||||
|
+++ b/syncstorage-mysql/src/models.rs
|
||||||
|
@@ -25,6 +25,7 @@ use syncstorage_settings::{Quota, DEFAULT_MAX_TOTAL_RECORDS};
|
||||||
|
|
||||||
|
use super::{
|
||||||
|
batch,
|
||||||
|
+ diesel_ext::LockInShareModeDsl,
|
||||||
|
error::DbError,
|
||||||
|
pool::{CollectionCache, Conn},
|
||||||
|
schema::{bso, collections, user_collections},
|
||||||
|
@@ -179,7 +180,7 @@ impl MysqlDb {
|
||||||
|
.select(user_collections::modified)
|
||||||
|
.filter(user_collections::user_id.eq(user_id))
|
||||||
|
.filter(user_collections::collection_id.eq(collection_id))
|
||||||
|
- .for_share()
|
||||||
|
+ .lock_in_share_mode()
|
||||||
|
.first(&mut *self.conn.write()?)
|
||||||
|
.optional()?;
|
||||||
|
if let Some(modified) = modified {
|
||||||
Loading…
Add table
Add a link
Reference in a new issue