Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions cross/diesel/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
PKG_NAME = diesel
PKG_VERS = 2.1.6
PKG_VERS = 2.2.12
PKG_EXT = tar.gz
PKG_DIST_NAME = v$(PKG_VERS).$(PKG_EXT)
PKG_DIST_SITE = https://github.com/diesel-rs/diesel/archive
Expand All @@ -23,12 +23,15 @@ CARGO_BUILD_ARGS += --features=mysql
# we support MariaDB 10 only
# we must define the mysql db socket, since the rust binaries (mysqlclient-sys)
# do not read settings from bin/mysql_conf
export "MYSQL_DB_SOCKET=/run/mysqld/mysqld10.sock"
export MYSQL_DB_SOCKET=/run/mysqld/mysqld10.sock

# Point to MariaDB library and include directories
ENV += MYSQLCLIENT_LIB_DIR=$(STAGING_INSTALL_PREFIX)/lib
ENV += MYSQLCLIENT_INCLUDE_DIR=$(STAGING_INSTALL_PREFIX)/include/mariadb

# pass mysql client version for non-x86 archs
ENV += MYSQLCLIENT_VERSION=$(lastword $(subst -, ,$(wildcard $(WORK_DIR)/mariadb-connector-c-[0-9]*)))

# let ./configure find mysql_config (it is a script and works for cross compile)
ENV += "PATH=$(PATH):$(STAGING_INSTALL_PREFIX)/bin"

Expand Down
6 changes: 3 additions & 3 deletions cross/diesel/digests
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
diesel-2.1.6.tar.gz SHA1 ddb02dcb75dbfe03c8ab9cf905599390ae62d329
diesel-2.1.6.tar.gz SHA256 60775915f615d41b65f31861ed01e467961677b7e430c6cc58d22c0b9bc17baf
diesel-2.1.6.tar.gz MD5 294d6e5a841aaa4ec54ecf786f0e8993
diesel-2.2.12.tar.gz SHA1 75ff812a934b333442a50fccc33a77e82e5268a8
diesel-2.2.12.tar.gz SHA256 583f2d71a14b2bb318222474bd1f26f93e945a3e98dcf1b892c67463abe13897
diesel-2.2.12.tar.gz MD5 000359985389abee7ceed4561ae52432
5 changes: 4 additions & 1 deletion cross/syncstorage-rs/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
PKG_NAME = syncstorage-rs
PKG_VERS = 0.20.1
PKG_VERS = 0.21.1
PKG_EXT = tar.gz
PKG_DIST_NAME = $(PKG_NAME)-$(PKG_VERS).$(PKG_EXT)
PKG_DIST_SITE = https://github.com/mozilla-services/$(PKG_NAME)/archive/${PKG_VERS}
Expand Down Expand Up @@ -33,6 +33,9 @@ ENV += MYSQLCLIENT_LIB_DIR=$(STAGING_INSTALL_PREFIX)/lib
# to find dependencies of libmysqlclient (libz)
ENV += RUSTFLAGS="-Clink-arg=-Wl,--rpath,$(INSTALL_PREFIX)/lib -Clink-arg=-Wl,--rpath-link,$(STAGING_INSTALL_PREFIX)/lib"

# pass mysql client version for non-x86 archs
ENV += MYSQLCLIENT_VERSION=$(lastword $(subst -, ,$(wildcard $(WORK_DIR)/mariadb-connector-c-[0-9]*)))

POST_INSTALL_TARGET = syncstorage-rs_post_install

include ../../mk/spksrc.cross-rust.mk
Expand Down
6 changes: 3 additions & 3 deletions cross/syncstorage-rs/digests
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
syncstorage-rs-0.20.1.tar.gz SHA1 2b58d7a1f951d54e4ba39012c0d3391c15ae94a0
syncstorage-rs-0.20.1.tar.gz SHA256 4b5dc27d3b47fcd760301f084c1249777d53eb9db3d010c052a5ba539d3b9811
syncstorage-rs-0.20.1.tar.gz MD5 7f3fed27e447f89bc8765d9b3f831266
syncstorage-rs-0.21.1.tar.gz SHA1 c212b320af0374609e7e19b23638fa03ed739144
syncstorage-rs-0.21.1.tar.gz SHA256 6ddcff79d62970df9d4fd6233ce79a4f92272c6582ced747de98ab24a1baba67
syncstorage-rs-0.21.1.tar.gz MD5 0a71295bc9d3c770cb6fbb488ef43355
66 changes: 66 additions & 0 deletions cross/syncstorage-rs/patches/001_fix_mariadb_compatibility.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
--- syncstorage-mysql/src/diesel_ext.rs 2025-09-23 16:12:34
+++ syncstorage-mysql/src/diesel_ext.rs.new 2025-11-18 08:04:47
@@ -3,11 +3,44 @@
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)
+/// This is required for MariaDB which does not provide that alias.
+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>(
--- syncstorage-mysql/src/models.rs 2025-09-23 16:12:34
+++ syncstorage-mysql/src/models.rs.new 2025-11-18 08:07:49
@@ -26,6 +26,7 @@
use super::{
batch,
error::DbError,
+ diesel_ext::LockInShareModeDsl,
pool::CollectionCache,
schema::{bso, collections, user_collections},
DbResult,
@@ -178,7 +179,7 @@
.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 {
6 changes: 3 additions & 3 deletions spk/ffsync/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
SPK_NAME = ffsync
SPK_VERS = 0.20.1
SPK_REV = 8
SPK_VERS = 0.21.1
SPK_REV = 9
SPK_ICON = src/ffsync.png

DEPENDS = cross/syncstorage-rs cross/diesel
Expand All @@ -18,7 +18,7 @@ REQUIRED_MIN_SRM = 3.0
MAINTAINER = SynoCommunity
DESCRIPTION = An implementation of the Mozilla Sync-1.5 Server protocol used by the sync service in Firefox 29 and later. You can use Mozilla Sync Server to exchange browser data \(bookmarks, history, open tabs, passwords, add-ons, and the like\) between \'clients\' in a manner that respects a user\'s security and privacy. The service runs on port 8132.
DISPLAY_NAME = Mozilla Sync Server
CHANGELOG = "1. Update Mozilla Sync Server package to v0.20.1."
CHANGELOG = "1. Update Mozilla Sync Server package to v0.21.1."

HOMEPAGE = https://mozilla-services.readthedocs.io/en/latest/howtos/run-sync-1.5.html
LICENSE = MPL 2.0
Expand Down
8 changes: 4 additions & 4 deletions spk/ffsync/src/requirements-crossenv.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Generated using the requirements script on September 12, 2025
# Generated using the requirements script on November 16, 2025

cffi==2.0.0
charset_normalizer==3.4.3
cryptography==44.0.2
charset_normalizer==3.4.4
cryptography==44.0.3
#greenlet ==> supported version depends on gcc version
mysqlclient==2.1.1
SQLAlchemy==1.4.46
zope_interface==8.0
zope_interface==8.1.1
8 changes: 4 additions & 4 deletions spk/ffsync/src/requirements-pure.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# Generated using the requirements script on September 12, 2025
# Generated using the requirements script on November 16, 2025

backoff==2.2.1
boto==2.49.0
#certifi ==> python312
datadog==0.52.1
hawkauthlib==2.0.0
hupper==1.12.1
idna==3.10
iniconfig==2.1.0
idna==3.11
iniconfig==2.3.0
packaging==25.0
PasteDeploy==3.1.0
#pip ==> python312
Expand All @@ -22,7 +22,7 @@ pyramid==1.10.8
pytest==8.3.5
requests==2.32.5
#setuptools ==> python312
testfixtures==9.1.0
testfixtures==10.0.0
tokenlib==2.0.0
translationstring==1.4
urllib3==2.5.0
Expand Down
59 changes: 54 additions & 5 deletions spk/ffsync/src/service-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@ SYNCSERVER="${SYNOPKG_PKGDEST}/bin/syncserver"
DIESEL="${SYNOPKG_PKGDEST}/bin/diesel"
CFG_FILE="${SYNOPKG_PKGVAR}/local.toml"

SERVICE_COMMAND="${SYNCSERVER} --config=${CFG_FILE}"
# enhance logging
ENV="RUST_LOG=debug RUST_BACKTRACE=full"

SERVICE_COMMAND="env ${ENV} ${SYNCSERVER} --config=${CFG_FILE}"
SVC_BACKGROUND=y
SVC_WRITE_PID=y

# enhance logging
export RUST_LOG=debug
export RUST_BACKTRACE=full

DBUSER=ffsync
DBSERVER="localhost"
DBSOCKET="/run/mysqld/mysqld10.sock"

percent_encode ()
{
Expand Down Expand Up @@ -134,11 +134,60 @@ EOF
-e "s|{{SQL_USER}}|${DBUSER}|g" \
-e "s|{{SQL_PASS}}|${DBPASS_ENC}|g" \
-e "s|{{DB_SERVER}}|${DBSERVER}|g" \
-e "s|{{DB_SOCKET}}|${DBSOCKET}|g" \
-e "s|{{METRICS_HASH_SECRET}}|${METRICS_HASH_SECRET}|g" \
-i "${CFG_FILE}"
fi
}

service_postupgrade ()
{
# Verify socket suffix when upgrading existing configs
if [ ! -f "${CFG_FILE}" ]; then
return
fi

echo "Verify database URLs for socket parameter"

sync_before=0
token_before=0
if grep -q '^syncstorage\.database_url[[:space:]]*=.*\?socket=' "${CFG_FILE}"; then
sync_before=1
fi
if grep -q '^tokenserver\.database_url[[:space:]]*=.*\?socket=' "${CFG_FILE}"; then
token_before=1
fi

escaped_socket=$(printf '%s' "$DBSOCKET" | sed -e 's/[\/&|]/\\&/g')

sed -i \
-e "/^syncstorage\.database_url[[:space:]]*=/ { /\?socket=/! s|\"$|?socket=${escaped_socket}\"| }" \
-e "/^tokenserver\.database_url[[:space:]]*=/ { /\?socket=/! s|\"$|?socket=${escaped_socket}\"| }" \
"${CFG_FILE}"

sync_after=0
token_after=0
if grep -q '^syncstorage\.database_url[[:space:]]*=.*\?socket=' "${CFG_FILE}"; then
sync_after=1
fi
if grep -q '^tokenserver\.database_url[[:space:]]*=.*\?socket=' "${CFG_FILE}"; then
token_after=1
fi

if [ "$sync_before" -eq 0 ] && [ "$sync_after" -eq 1 ]; then
echo "Added socket parameter to syncstorage.database_url"
fi
if [ "$token_before" -eq 0 ] && [ "$token_after" -eq 1 ]; then
echo "Added socket parameter to tokenserver.database_url"
fi

if [ "$sync_after" -eq 1 ] && [ "$token_after" -eq 1 ]; then
echo "Database URLs now include socket parameter"
else
echo "Warning: unable to ensure socket parameter for both database URLs" >&2
fi
}

validate_preuninst ()
{
# Check database
Expand Down
4 changes: 2 additions & 2 deletions spk/ffsync/src/var/local.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ host = "0.0.0.0"
# defined by SynoCommunity Package
port = {{TCP_PORT}}

syncstorage.database_url = "mysql://{{SQL_USER}}:{{SQL_PASS}}@{{DB_SERVER}}/syncstorage_rs"
syncstorage.database_url = "mysql://{{SQL_USER}}:{{SQL_PASS}}@{{DB_SERVER}}/syncstorage_rs?socket={{DB_SOCKET}}"
syncstorage.enable_quota = 0
syncstorage.enabled = true
syncstorage.limits.max_total_records = 1666 # See issues #298/#333

# token
tokenserver.database_url = "mysql://{{SQL_USER}}:{{SQL_PASS}}@{{DB_SERVER}}/tokenserver_rs"
tokenserver.database_url = "mysql://{{SQL_USER}}:{{SQL_PASS}}@{{DB_SERVER}}/tokenserver_rs?socket={{DB_SOCKET}}"
tokenserver.enabled = true
tokenserver.fxa_email_domain = "api.accounts.firefox.com"
tokenserver.fxa_metrics_hash_secret = "{{METRICS_HASH_SECRET}}"
Expand Down