Skip to content

Commit 47cd144

Browse files
committed
chore: run pre-commit on all files
Signed-off-by: ComixHe <ComixHe1895@outlook.com>
1 parent 44670b5 commit 47cd144

83 files changed

Lines changed: 652 additions & 758 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.pre-commit-config.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ exclude: |
1212
misc/image/|
1313
po/|
1414
tools/quicktype/|
15-
tools/openapi-c-libcurl-client/
15+
tools/openapi-c-libcurl-client/|
16+
.obs/|
17+
misc/share/linglong/builder/templates/
1618
)
1719
1820
ci:

.tx/config

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,3 @@ file_filter = po/<lang>.po
66
source_file = po/en_US.po
77
source_lang = en_US
88
type = PO
9-

apps/ll-builder-utils/patch/libfuse.patch

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ index 6ed4444..b592ade 100644
55
@@ -46,7 +46,6 @@
66
#define umount2(mnt, flags) unmount(mnt, (flags == 2) ? MNT_FORCE : 0)
77
#endif
8-
8+
99
-#define FUSERMOUNT_PROG "fusermount3"
1010
#define FUSE_COMMFD_ENV "_FUSE_COMMFD"
1111
#define FUSE_COMMFD2_ENV "_FUSE_COMMFD2"
12-
12+
1313
@@ -121,6 +120,34 @@ static const struct fuse_opt fuse_mount_opts[] = {
1414
FUSE_OPT_END
1515
};
16-
16+
1717
+/**
1818
+ * Returns FUSERMOUNT_PROG path from environment variable.
1919
+ *
@@ -51,9 +51,9 @@ index 6ed4444..b592ade 100644
5151
{
5252
- const char *full_path = FUSERMOUNT_DIR "/" FUSERMOUNT_PROG;
5353
pid_t pid;
54-
54+
5555
/* See man 7 environ for the global environ pointer */
56-
56+
5757
- /* first try the install path */
5858
- int status = posix_spawn(&pid, full_path, action, NULL,
5959
+ int status = posix_spawn(&pid, fusermountProg(), action, NULL,
@@ -63,27 +63,27 @@ index 6ed4444..b592ade 100644
6363
- status = posix_spawnp(&pid, FUSERMOUNT_PROG, action, NULL,
6464
- (char * const *) argv, environ);
6565
- }
66-
66+
6767
if (status != 0) {
6868
fuse_log(FUSE_LOG_ERR,
6969
@@ -160,12 +180,12 @@ static int fusermount_posix_spawn(posix_spawn_file_actions_t *action,
70-
70+
7171
void fuse_mount_version(void)
7272
{
7373
- char const *const argv[] = {FUSERMOUNT_PROG, "--version", NULL};
7474
+ char const *const argv[] = {fusermountProg(), "--version", NULL};
7575
int status = fusermount_posix_spawn(NULL, argv, NULL);
76-
76+
7777
if(status != 0)
7878
fuse_log(FUSE_LOG_ERR, "Running '%s --version' failed",
7979
- FUSERMOUNT_PROG);
8080
+ fusermountProg());
8181
}
82-
82+
8383
struct mount_flags {
8484
@@ -337,12 +357,12 @@ void fuse_kern_unmount(const char *mountpoint, int fd)
8585
return;
86-
86+
8787
char const * const argv[] =
8888
- { FUSERMOUNT_PROG, "--unmount", "--quiet", "--lazy",
8989
+ { fusermountProg(), "--unmount", "--quiet", "--lazy",
@@ -98,7 +98,7 @@ index 6ed4444..b592ade 100644
9898
}
9999
@@ -378,7 +398,7 @@ static int setup_auto_unmount(const char *mountpoint, int quiet)
100100
setenv(FUSE_COMMFD2_ENV, arg_fd_entry, 1);
101-
101+
102102
char const *const argv[] = {
103103
- FUSERMOUNT_PROG,
104104
+ fusermountProg(),
@@ -113,10 +113,10 @@ index 6ed4444..b592ade 100644
113113
+ fusermountProg(), strerror(errno));
114114
return -1;
115115
}
116-
116+
117117
@@ -451,7 +471,7 @@ static int fuse_mount_fusermount(const char *mountpoint, struct mount_opts *mo,
118118
setenv(FUSE_COMMFD2_ENV, arg_fd_entry, 1);
119-
119+
120120
char const *const argv[] = {
121121
- FUSERMOUNT_PROG,
122122
+ fusermountProg(),
@@ -131,4 +131,3 @@ index 6ed4444..b592ade 100644
131131
+ fusermountProg(), strerror(-status));
132132
return -1;
133133
}
134-

apps/ll-driver-detect/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,4 +117,4 @@ make ll-driver-detect
117117

118118
## 许可证
119119

120-
本项目遵循 LGPL-3.0-or-later 许可证。
120+
本项目遵循 LGPL-3.0-or-later 许可证。

apps/ll-driver-detect/src/application_singleton.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include "linglong/utils/log/log.h"
88

99
#include <filesystem>
10+
1011
namespace linglong::driver::detect {
1112

1213
ApplicationSingleton::ApplicationSingleton(const std::string &lockFilePath)

apps/ll-driver-detect/src/dbus_notifier.cpp

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ DBusNotifier::sendInteractiveNotification(const NotificationRequest &request)
5858
bool userInteracted = false;
5959
QEventLoop loop;
6060

61-
struct SignalGuard {
61+
struct SignalGuard
62+
{
6263
QMetaObject::Connection closeConn;
6364
QMetaObject::Connection actionConn;
6465

@@ -67,27 +68,29 @@ DBusNotifier::sendInteractiveNotification(const NotificationRequest &request)
6768
QObject::disconnect(closeConn);
6869
QObject::disconnect(actionConn);
6970
}
70-
} signalGuard{{}, {}};
71+
} signalGuard{ {}, {} };
7172

7273
// 连接信号处理函数
73-
signalGuard.closeConn = QObject::connect(this,
74-
&DBusNotifier::notificationClosed,
75-
[&](quint32 id, quint32 closeReason) {
76-
if (notificationID != 0 && id == notificationID) {
77-
LogD("Notification {} closed with reason: {}", id, closeReason);
78-
loop.quit();
79-
}
80-
});
81-
82-
signalGuard.actionConn = QObject::connect(this,
83-
&DBusNotifier::actionInvoked,
84-
[&](quint32 id, const QString &actionKey) {
85-
if (notificationID != 0 && id == notificationID) {
86-
LogD("Notification {} action invoked: {}", id, actionKey.toStdString());
87-
choice = actionKey;
88-
userInteracted = true;
89-
}
90-
});
74+
signalGuard.closeConn =
75+
QObject::connect(this,
76+
&DBusNotifier::notificationClosed,
77+
[&](quint32 id, quint32 closeReason) {
78+
if (notificationID != 0 && id == notificationID) {
79+
LogD("Notification {} closed with reason: {}", id, closeReason);
80+
loop.quit();
81+
}
82+
});
83+
84+
signalGuard.actionConn = QObject::connect(
85+
this,
86+
&DBusNotifier::actionInvoked,
87+
[&](quint32 id, const QString &actionKey) {
88+
if (notificationID != 0 && id == notificationID) {
89+
LogD("Notification {} action invoked: {}", id, actionKey.toStdString());
90+
choice = actionKey;
91+
userInteracted = true;
92+
}
93+
});
9194

9295
// 检查信号连接是否成功
9396
if (!signalGuard.closeConn || !signalGuard.actionConn) {

apps/ll-driver-detect/src/driver_detection_manager.h

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,9 @@ struct DriverDetectionResult
1818

1919
bool hasAvailableDrivers() const
2020
{
21-
return std::any_of(detectedDrivers.begin(),
22-
detectedDrivers.end(),
23-
[](const auto &driver) {
24-
return !driver.isInstalled;
25-
});
21+
return std::any_of(detectedDrivers.begin(), detectedDrivers.end(), [](const auto &driver) {
22+
return !driver.isInstalled;
23+
});
2624
}
2725
};
2826

apps/ll-driver-detect/src/nvidia_driver_detector.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,9 @@ NVIDIADriverDetector::checkPackageInstalled(const std::string &packageName)
7676
linglong::utils::command::Cmd("ll-cli").exec({ "info", packageName.c_str() });
7777

7878
if (!listResult) {
79-
LogD("Can not get package info with `ll-cli info`, maybe the package is not installed: {}",
80-
listResult.error().message());
79+
LogD(
80+
"Can not get package info with `ll-cli info`, maybe the package is not installed: {}",
81+
listResult.error().message());
8182
return false;
8283
}
8384

libs/linglong/tests/ll-tests/data/demo/app.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,4 @@ permissions:
3838

3939
namespaces:
4040
- type: pid
41-
- type: uts
41+
- type: uts

0 commit comments

Comments
 (0)