mirror of
https://gitee.com/spark-store-project/spark-store
synced 2025-12-19 02:21:37 +08:00
Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f33386ee5c | |||
|
|
61c10944c9 | ||
|
|
6db6fe6060 | ||
|
|
14506b18b2 | ||
| 44d1041087 | |||
| dd941bcf8e | |||
| 75fc22d2a2 | |||
| ee549b91f1 | |||
| 38209d0efb |
7
debian/changelog
vendored
7
debian/changelog
vendored
@@ -1,3 +1,10 @@
|
|||||||
|
spark-store (3.0.3-10) stable; urgency=medium
|
||||||
|
|
||||||
|
* Now also compile dstore patch
|
||||||
|
|
||||||
|
-- shenmo <shenmo@spark-app.store> Mon, 17 Jan 2022 00:00:00 +0800
|
||||||
|
|
||||||
|
|
||||||
spark-store (3.0.3-9) stable; urgency=medium
|
spark-store (3.0.3-9) stable; urgency=medium
|
||||||
|
|
||||||
* Support dpkg-buildpackage
|
* Support dpkg-buildpackage
|
||||||
|
|||||||
12
debian/control
vendored
12
debian/control
vendored
@@ -11,9 +11,9 @@ Build-Depends:
|
|||||||
libqt5widgets5,
|
libqt5widgets5,
|
||||||
libqt5network5,
|
libqt5network5,
|
||||||
libqt5concurrent5,
|
libqt5concurrent5,
|
||||||
libdtkcore-dev,
|
libdtkcore-dev(>=5.4),
|
||||||
libdtkgui-dev,
|
libdtkgui-dev(>=5.4),
|
||||||
libdtkwidget-dev,
|
libdtkwidget-dev(>=5.4),
|
||||||
qttools5-private-dev,
|
qttools5-private-dev,
|
||||||
libnotify-dev,
|
libnotify-dev,
|
||||||
qtwebengine5-dev
|
qtwebengine5-dev
|
||||||
@@ -29,9 +29,9 @@ Depends:${shlibs:Depends}, ${misc:Depends},
|
|||||||
libqt5widgets5,
|
libqt5widgets5,
|
||||||
libqt5network5,
|
libqt5network5,
|
||||||
libqt5concurrent5,
|
libqt5concurrent5,
|
||||||
libdtkcore5,
|
libdtkcore5(>=5.4),
|
||||||
libdtkgui5,
|
libdtkgui5(>=5.4),
|
||||||
libdtkwidget5,
|
libdtkwidget5(>=5.4),
|
||||||
libnotify4
|
libnotify4
|
||||||
Description: Spark Store
|
Description: Spark Store
|
||||||
A community powered app store, based on DTK.
|
A community powered app store, based on DTK.
|
||||||
|
|||||||
1
debian/source/format
vendored
1
debian/source/format
vendored
@@ -1 +0,0 @@
|
|||||||
3.0 (quilt)
|
|
||||||
@@ -4,9 +4,11 @@ TEMPLATE = subdirs
|
|||||||
CONFIG += ordered
|
CONFIG += ordered
|
||||||
|
|
||||||
SUBDIRS += \
|
SUBDIRS += \
|
||||||
|
src/spark-dstore-patch \
|
||||||
third-party/QtNetworkService \
|
third-party/QtNetworkService \
|
||||||
src/spark-store.pro
|
src/spark-store.pro
|
||||||
|
|
||||||
|
|
||||||
spark-store.depends = third-party/QtNetworkService
|
spark-store.depends = third-party/QtNetworkService
|
||||||
|
|
||||||
# Update translation files
|
# Update translation files
|
||||||
|
|||||||
12
src/main.cpp
12
src/main.cpp
@@ -2,6 +2,7 @@
|
|||||||
#include <DApplicationSettings>
|
#include <DApplicationSettings>
|
||||||
#include <DWidgetUtil> // Dtk::Widget::moveToCenter(&w); 要调用它,就得引用 DWidgetUtil
|
#include <DWidgetUtil> // Dtk::Widget::moveToCenter(&w); 要调用它,就得引用 DWidgetUtil
|
||||||
|
|
||||||
|
#include <QVector>
|
||||||
#include <QScreen>
|
#include <QScreen>
|
||||||
|
|
||||||
#include "widget.h"
|
#include "widget.h"
|
||||||
@@ -11,7 +12,14 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
DApplication::loadDXcbPlugin(); // 让 bar 处在标题栏中
|
DApplication::loadDXcbPlugin(); // 让 bar 处在标题栏中
|
||||||
DApplication::setAttribute(Qt::AA_EnableHighDpiScaling); // 开启 Hidpi 支持
|
DApplication::setAttribute(Qt::AA_EnableHighDpiScaling); // 开启 Hidpi 支持
|
||||||
DApplication a(argc, argv);
|
// 程序内强制添加"-platformtheme deepin"参数喂给Qt让Qt正确使用Deepin主题修复各种奇怪样式问题
|
||||||
|
QVector<char*> fakeArgs(argc + 2);
|
||||||
|
fakeArgs[0] = argv[0];
|
||||||
|
fakeArgs[1] = "-platformtheme";
|
||||||
|
fakeArgs[2] = "deepin";
|
||||||
|
for(int i = 1; i < argc; i++) fakeArgs[i + 2] = argv[i];
|
||||||
|
int fakeArgc = argc + 2; // 为啥DApplication的argc要用引用啊?
|
||||||
|
DApplication a(fakeArgc, fakeArgs.data());
|
||||||
|
|
||||||
a.setAttribute(Qt::AA_UseHighDpiPixmaps);
|
a.setAttribute(Qt::AA_UseHighDpiPixmaps);
|
||||||
a.loadTranslator(); // 载入翻译
|
a.loadTranslator(); // 载入翻译
|
||||||
@@ -42,7 +50,7 @@ int main(int argc, char *argv[])
|
|||||||
a.setOrganizationName("spark-union");
|
a.setOrganizationName("spark-union");
|
||||||
a.setOrganizationDomain("https://www.deepinos.org/");
|
a.setOrganizationDomain("https://www.deepinos.org/");
|
||||||
a.setApplicationName("Spark Store"); //不需要翻译,否则 ~/.local/share/ 下文件夹名称也被翻译为中文
|
a.setApplicationName("Spark Store"); //不需要翻译,否则 ~/.local/share/ 下文件夹名称也被翻译为中文
|
||||||
a.setApplicationVersion(DApplication::buildVersion("3.0.3-9"));
|
a.setApplicationVersion(DApplication::buildVersion("3.0.3-10"));
|
||||||
a.setApplicationAcknowledgementPage("https://gitee.com/deepin-community-store/spark-store");
|
a.setApplicationAcknowledgementPage("https://gitee.com/deepin-community-store/spark-store");
|
||||||
a.setApplicationDescription(
|
a.setApplicationDescription(
|
||||||
QObject::tr(
|
QObject::tr(
|
||||||
|
|||||||
9
src/spark-dstore-patch/spark-dstore-patch.pro
Normal file
9
src/spark-dstore-patch/spark-dstore-patch.pro
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
TARGET = spark-dstore-patch
|
||||||
|
TEMPLATE += app
|
||||||
|
QT += widgets
|
||||||
|
SOURCES += spark-dstore-tool.cpp
|
||||||
|
|
||||||
|
# Default rules for deployment.
|
||||||
|
qnx: target.path = /tmp/spark-store/bin
|
||||||
|
else: unix:!android: target.path = /opt/durapps/spark-store/bin
|
||||||
|
!isEmpty(target.path): INSTALLS += target
|
||||||
195
src/spark-dstore-patch/spark-dstore-tool.cpp
Normal file
195
src/spark-dstore-patch/spark-dstore-tool.cpp
Normal file
@@ -0,0 +1,195 @@
|
|||||||
|
#include <QCoreApplication>
|
||||||
|
#include <QDir>
|
||||||
|
#include <QJsonObject>
|
||||||
|
#include <QJsonDocument>
|
||||||
|
#include <QDebug>
|
||||||
|
#include <QDirIterator>
|
||||||
|
#include <QProcess>
|
||||||
|
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
QList<QJsonObject> enumAppInfoList()
|
||||||
|
{
|
||||||
|
QList<QJsonObject> appInfoList;
|
||||||
|
QDir apps("/opt/apps");
|
||||||
|
auto list = apps.entryList(QDir::Dirs | QDir::NoDotAndDotDot);
|
||||||
|
for (auto &appID : list) {
|
||||||
|
auto infoPath = apps.absoluteFilePath(appID + "/info");
|
||||||
|
QFile infoFile(infoPath);
|
||||||
|
if (!infoFile.open(QIODevice::ReadOnly)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
auto doc = QJsonDocument::fromJson(infoFile.readAll());
|
||||||
|
appInfoList.push_back(doc.object());
|
||||||
|
}
|
||||||
|
return appInfoList;
|
||||||
|
}
|
||||||
|
//这段是去找appid和info,没看懂用来干啥的,在此之后info文件也没再用过
|
||||||
|
//可能以后版本的实现会用到,等官方加功能再说
|
||||||
|
void linkDir(const QString &source, const QString &target)
|
||||||
|
{
|
||||||
|
auto ensureTargetDir = [](const QString &targetFile) {
|
||||||
|
QFileInfo t(targetFile);
|
||||||
|
QDir tDir(t.dir());
|
||||||
|
tDir.mkpath(".");
|
||||||
|
};
|
||||||
|
|
||||||
|
QDir sourceDir(source);
|
||||||
|
QDir targetDir(target);
|
||||||
|
QDirIterator iter(source, QDir::Files | QDir::NoDotAndDotDot, QDirIterator::Subdirectories);
|
||||||
|
while (iter.hasNext()) {
|
||||||
|
auto sourceFile = iter.next();
|
||||||
|
auto targetFile = targetDir.absoluteFilePath(sourceDir.relativeFilePath(sourceFile));
|
||||||
|
|
||||||
|
QFileInfo tfi(targetFile);
|
||||||
|
// if (tfi.isSymLink() && (tfi.canonicalFilePath() == sourceFile)) {
|
||||||
|
//这里官方应该是写错了,否则会每触发一次就把所有软链接都删了重新创建一次
|
||||||
|
if (tfi.isSymLink() && (tfi.symLinkTarget() == sourceFile)) {
|
||||||
|
continue;
|
||||||
|
} else {
|
||||||
|
QFile::remove(targetFile);
|
||||||
|
}
|
||||||
|
|
||||||
|
ensureTargetDir(targetFile);
|
||||||
|
auto ret = symlink(sourceFile.toStdString().c_str(), targetFile.toStdString().c_str());
|
||||||
|
if (0 != ret) {
|
||||||
|
qDebug() << "link failed" << sourceFile << "=>" << targetFile << ret;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//reset Dynamic library rpath
|
||||||
|
void setRpath(const QString &file, const QString &path)
|
||||||
|
{
|
||||||
|
if (!QFileInfo::exists(path))
|
||||||
|
return;
|
||||||
|
QProcess p;
|
||||||
|
auto cmd = "patchelf " + file + " --set-rpath " + path;
|
||||||
|
p.start("bash", QStringList {"-c", cmd});
|
||||||
|
p.waitForFinished();
|
||||||
|
}
|
||||||
|
|
||||||
|
QString getGlic()
|
||||||
|
{
|
||||||
|
//get arch & glibc
|
||||||
|
QProcess p;
|
||||||
|
auto cmd = "gcc -dumpmachine";
|
||||||
|
p.start("bash", QStringList {"-c", cmd});
|
||||||
|
p.waitForFinished();
|
||||||
|
return p.readAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
void linkApp(const QJsonObject &app)
|
||||||
|
{
|
||||||
|
auto appID = app.value("appid").toString();
|
||||||
|
auto appEntriesDir = QDir("/opt/apps/" + appID + "/entries");
|
||||||
|
auto appLibsDir = QDir("/opt/apps/" + appID + "/files/lib");
|
||||||
|
auto autoStartDir = QDir(appEntriesDir.absoluteFilePath("autostart"));
|
||||||
|
|
||||||
|
bool autoStart = app.value("permissions").toObject().value("autostart").toBool();
|
||||||
|
if (autoStart) {
|
||||||
|
linkDir(appEntriesDir.absoluteFilePath("autostart"), "/etc/xdg/autostart");
|
||||||
|
}
|
||||||
|
|
||||||
|
// link application
|
||||||
|
auto sysShareDir = QDir("/usr/share");
|
||||||
|
linkDir(appEntriesDir.absoluteFilePath("applications"), sysShareDir.absoluteFilePath("applications"));
|
||||||
|
linkDir(appEntriesDir.absoluteFilePath("icons"), sysShareDir.absoluteFilePath("icons"));
|
||||||
|
linkDir(appEntriesDir.absoluteFilePath("mime"), sysShareDir.absoluteFilePath("mime"));
|
||||||
|
linkDir(appEntriesDir.absoluteFilePath("glib-2.0"), sysShareDir.absoluteFilePath("glib-2.0"));
|
||||||
|
linkDir(appEntriesDir.absoluteFilePath("services"), sysShareDir.absoluteFilePath("dbus-1/services"));
|
||||||
|
linkDir(appEntriesDir.absoluteFilePath("GConf"), sysShareDir.absoluteFilePath("GConf"));
|
||||||
|
linkDir(appEntriesDir.absoluteFilePath("help"), sysShareDir.absoluteFilePath("help"));
|
||||||
|
linkDir(appEntriesDir.absoluteFilePath("locale"), sysShareDir.absoluteFilePath("locale"));
|
||||||
|
linkDir(appEntriesDir.absoluteFilePath("fcitx"), sysShareDir.absoluteFilePath("fcitx"));
|
||||||
|
linkDir(appEntriesDir.absoluteFilePath("polkit"), sysShareDir.absoluteFilePath("polkit-1"));
|
||||||
|
linkDir(appEntriesDir.absoluteFilePath("fonts/conf"), "/etc/fonts/conf.d");
|
||||||
|
linkDir(appEntriesDir.absoluteFilePath("fonts/files"), sysShareDir.absoluteFilePath("fonts"));
|
||||||
|
|
||||||
|
|
||||||
|
//原来会导致Gtk相关应用翻译缺失,补足了
|
||||||
|
|
||||||
|
|
||||||
|
auto pluginDir = QDir(appEntriesDir.absoluteFilePath("plugins"));
|
||||||
|
if (pluginDir.exists()) {
|
||||||
|
QString arch = getGlic();
|
||||||
|
// if (pluginDir.exists()) {
|
||||||
|
// QDirIterator iter(pluginDir.absolutePath(), QDir::Files | QDir::NoDotAndDotDot, QDirIterator::Subdirectories);
|
||||||
|
// while (iter.hasNext()) {
|
||||||
|
// auto sourceFile = iter.next();
|
||||||
|
// setRpath(sourceFile, appLibsDir.absolutePath()); //set rpath
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
linkDir(appEntriesDir.absoluteFilePath("plugins/fcitx"), "/usr/lib/" + arch + "/fcitx");
|
||||||
|
linkDir(appEntriesDir.absoluteFilePath("plugins/browser"), "/usr/lib/mozilla/plugins");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void cleanLink()
|
||||||
|
{
|
||||||
|
auto cleanDirBrokenLink = [](const QString &dir) {
|
||||||
|
QProcess p;
|
||||||
|
auto cmd = "find " + dir + " -xtype l -delete";
|
||||||
|
p.start("bash", QStringList {"-c", cmd});
|
||||||
|
p.waitForFinished();
|
||||||
|
};
|
||||||
|
|
||||||
|
QString arch = getGlic();
|
||||||
|
auto sysShareDir = QDir("/usr/share");
|
||||||
|
cleanDirBrokenLink(sysShareDir.absoluteFilePath("applications"));
|
||||||
|
cleanDirBrokenLink(sysShareDir.absoluteFilePath("icons"));
|
||||||
|
cleanDirBrokenLink(sysShareDir.absoluteFilePath("mime/packages"));
|
||||||
|
cleanDirBrokenLink(sysShareDir.absoluteFilePath("glib-2.0"));
|
||||||
|
cleanDirBrokenLink(sysShareDir.absoluteFilePath("dbus-1/services"));
|
||||||
|
cleanDirBrokenLink("/etc/xdg/autostart");
|
||||||
|
cleanDirBrokenLink(sysShareDir.absoluteFilePath("fcitx"));
|
||||||
|
cleanDirBrokenLink(sysShareDir.absoluteFilePath("help"));
|
||||||
|
cleanDirBrokenLink(sysShareDir.absoluteFilePath("locale"));
|
||||||
|
cleanDirBrokenLink("/usr/lib/" + arch + "/fcitx");
|
||||||
|
cleanDirBrokenLink("/usr/lib/mozilla/plugins");
|
||||||
|
cleanDirBrokenLink(sysShareDir.absoluteFilePath("polkit-1/actions"));
|
||||||
|
cleanDirBrokenLink(sysShareDir.absoluteFilePath("fonts"));
|
||||||
|
cleanDirBrokenLink("/etc/fonts/conf.d");
|
||||||
|
}
|
||||||
|
|
||||||
|
void update()
|
||||||
|
{
|
||||||
|
QProcess p;
|
||||||
|
auto cmd = "glib-compile-schemas /usr/share/glib-2.0/schemas/";
|
||||||
|
p.start("bash", QStringList {"-c", cmd});
|
||||||
|
p.waitForFinished();
|
||||||
|
|
||||||
|
cmd = "update-icon-caches /usr/share/icons/*";
|
||||||
|
p.start("bash", QStringList {"-c", cmd});
|
||||||
|
p.waitForFinished();
|
||||||
|
|
||||||
|
cmd = "update-desktop-database -q";
|
||||||
|
p.start("bash", QStringList {"-c", cmd});
|
||||||
|
p.waitForFinished();
|
||||||
|
|
||||||
|
cmd = "update-mime-database -V /usr/share/mime";
|
||||||
|
p.start("bash", QStringList {"-c", cmd});
|
||||||
|
p.waitForFinished();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
int main(int argc, char **argv)
|
||||||
|
{
|
||||||
|
QCoreApplication app(argc, argv);
|
||||||
|
|
||||||
|
cleanLink();
|
||||||
|
|
||||||
|
for (auto &a : enumAppInfoList()) {
|
||||||
|
linkApp(a);
|
||||||
|
}
|
||||||
|
qInfo()<<"Spark dstore patch (c) The Spark Project 2022-Now. Modified from deepin-app-store-tool";
|
||||||
|
|
||||||
|
// trigger
|
||||||
|
update();
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
@@ -29,7 +29,7 @@ CONFIG += c++11 link_pkgconfig
|
|||||||
PKGCONFIG += dtkcore dtkgui dtkwidget libnotify
|
PKGCONFIG += dtkcore dtkgui dtkwidget libnotify
|
||||||
|
|
||||||
# 禁止输出 qWarning / qDebug 信息
|
# 禁止输出 qWarning / qDebug 信息
|
||||||
CONFIG(release, debug|release): DEFINES += QT_NO_WARNING_OUTPUT QT_NO_DEBUG_OUTPUT
|
#CONFIG(release, debug|release): DEFINES += QT_NO_WARNING_OUTPUT QT_NO_DEBUG_OUTPUT
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
appitem.cpp \
|
appitem.cpp \
|
||||||
|
|||||||
Binary file not shown.
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
reset
|
reset
|
||||||
|
|
||||||
echo Copyright (c) 2019-2021 The Spark Project
|
echo "Copyright (c) 2019-2021 The Spark Project"
|
||||||
|
|
||||||
if [ -x "/usr/bin/deepin-deb-installer" ] ; then
|
if [ -x "/usr/bin/deepin-deb-installer" ] ; then
|
||||||
echo "深度软件包安装器已安装,开始检测证书"
|
echo "深度软件包安装器已安装,开始检测证书"
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
reset
|
reset
|
||||||
|
|
||||||
echo Copyright (c) 2019-2021 The Spark Project
|
echo "Copyright (c) 2019-2021 The Spark Project"
|
||||||
|
|
||||||
if [ -x "/usr/bin/deepin-deb-installer" ] ; then
|
if [ -x "/usr/bin/deepin-deb-installer" ] ; then
|
||||||
echo "深度软件包安装器已安装,开始检测证书"
|
echo "深度软件包安装器已安装,开始检测证书"
|
||||||
|
|||||||
Reference in New Issue
Block a user