Skip to content

Commit

Permalink
feat: remove linglong update
Browse files Browse the repository at this point in the history
Linglong app update transferred to deepin-app-store

Log: As title
Task: https://pms.uniontech.com/task-view-362429.html
  • Loading branch information
mhduiy committed Sep 12, 2024
1 parent 5e0be0b commit ea6dd3d
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 113 deletions.
10 changes: 0 additions & 10 deletions dcc-old/src/plugin-update/operation/updatemodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ UpdateModel::UpdateModel(QObject *parent)
, m_autoCheckUpdateCircle(0)
, m_isUpdatablePackages(false)
, m_testingChannelStatus(TestingChannelStatus::DeActive)
, m_linglongAutoUpdateActived(false)
{

qRegisterMetaType<TestingChannelStatus>("TestingChannelStatus");
Expand Down Expand Up @@ -673,12 +672,3 @@ void UpdateModel::setTestingChannelStatus(const TestingChannelStatus &status)
m_testingChannelStatus = status;
Q_EMIT TestingChannelStatusChanged(m_testingChannelStatus);
}

void UpdateModel::setLinglongAutoUpdate(const bool linglongAutoUpdate)
{
if (m_linglongAutoUpdateActived == linglongAutoUpdate) {
return;
}
m_linglongAutoUpdateActived = linglongAutoUpdate;
Q_EMIT longlongAutoUpdateChanged(m_linglongAutoUpdateActived);
}
5 changes: 0 additions & 5 deletions dcc-old/src/plugin-update/operation/updatemodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,6 @@ class UpdateModel : public QObject

int autoCheckUpdateCircle() const { return m_autoCheckUpdateCircle; }

bool linglongAutoUpdate() const { return m_linglongAutoUpdateActived; }

void setAutoCheckUpdateCircle(const int interval);
bool enterCheckUpdate();

Expand Down Expand Up @@ -219,7 +217,6 @@ class UpdateModel : public QObject
// Testing Channel
TestingChannelStatus getTestingChannelStatus() const;
void setTestingChannelStatus(const TestingChannelStatus &status);
void setLinglongAutoUpdate(const bool longlongAutoUpdate);

Q_SIGNALS:
void autoDownloadUpdatesChanged(const bool &autoDownloadUpdates);
Expand Down Expand Up @@ -326,8 +323,6 @@ class UpdateModel : public QObject
UpdateJobErrorMessage m_UnkonwUpdateJobError;

TestingChannelStatus m_testingChannelStatus;

bool m_linglongAutoUpdateActived;
};

#endif // UPDATEMODEL_H
66 changes: 0 additions & 66 deletions dcc-old/src/plugin-update/operation/updatework.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,6 @@ constexpr int ServerPlatform = 6; // 服务器版

constexpr int RecoveryBackupFailedDistFull = -2; // Not enough disk space

static const QString LINGLONG_TIMER = QStringLiteral("linglong-upgrade.timer");
static const QString LINGLONG_SERVICE = QStringLiteral("linglong-upgrade.service");

#define CHECK_JOBS_ENV "DCC_PACKAGE_CHECK_JOBS"

// NOTE: start with ii, any space, anychar, any space, anychar, at least one space, anykind of char
Expand Down Expand Up @@ -286,7 +283,6 @@ void UpdateWorker::activate()
onJobListChanged(m_updateInter->jobList());

testingChannelChangeSlot();
checkLinglongUpdateStatus();

licenseStateChangeSlot();

Expand All @@ -298,67 +294,6 @@ void UpdateWorker::activate()
SLOT(licenseStateChangeSlot()));
}

void UpdateWorker::setLinglongAutoUpdate(const bool status)
{
QProcess process;
QStringList systemdcommand;

if (status) {
systemdcommand = QStringList{ "--user", "unmask", LINGLONG_SERVICE };
process.start("systemctl", systemdcommand);
process.waitForFinished(-1);
systemdcommand = QStringList{ "--user", "unmask", LINGLONG_TIMER };
process.start("systemctl", systemdcommand);
process.waitForFinished(-1);
systemdcommand = QStringList{ "--user", "start", LINGLONG_TIMER };
process.start("systemctl", systemdcommand);
process.waitForFinished(-1);
} else {
systemdcommand = QStringList{ "--user", "stop", LINGLONG_TIMER };
process.start("systemctl", systemdcommand);
process.waitForFinished(-1);
systemdcommand = QStringList{ "--user", "mask", LINGLONG_TIMER };
process.start("systemctl", systemdcommand);
process.waitForFinished(-1);
systemdcommand = QStringList{ "--user", "stop", LINGLONG_SERVICE };
process.start("systemctl", systemdcommand);
process.waitForFinished(-1);
systemdcommand = QStringList{ "--user", "mask", LINGLONG_SERVICE };
process.start("systemctl", systemdcommand);
process.waitForFinished(-1);
}

if (status) {
tryLinglongUpdate();
}
checkLinglongUpdateStatus();
}

void UpdateWorker::tryLinglongUpdate()
{
QProcess *process = new QProcess;
process->start("systemctl", { "--user", "start", LINGLONG_SERVICE });
connect(process, &QProcess::errorOccurred, this, [process](QProcess::ProcessError error) {
qCWarning(DccUpdateWork) << "Linglong update Error:" << error;
process->deleteLater();
});
connect(process,
static_cast<void (QProcess::*)(int, QProcess::ExitStatus)>(&QProcess::finished),
this,
[process](int, QProcess::ExitStatus) {
process->deleteLater();
});
}

void UpdateWorker::checkLinglongUpdateStatus()
{
QProcess process;
process.start("systemctl", { "--user", "is-active", LINGLONG_TIMER });
process.waitForFinished();
QString text = process.readAllStandardOutput().trimmed();
m_model->setLinglongAutoUpdate(text == "active");
}

void UpdateWorker::deactivate() { }

void UpdateWorker::checkForUpdates()
Expand Down Expand Up @@ -753,7 +688,6 @@ void UpdateWorker::distUpgrade(ClassifyUpdateType updateType)
m_backupStatus = BackupStatus::Backuped;
downloadAndInstallUpdates(updateType);
}
tryLinglongUpdate();
}

void UpdateWorker::setAutoCheckUpdates(const bool autoCheckUpdates)
Expand Down
4 changes: 0 additions & 4 deletions dcc-old/src/plugin-update/operation/updatework.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,6 @@ public Q_SLOTS:
void setTestingChannelEnable(const bool &enable);
void checkTestingChannelStatus();

void setLinglongAutoUpdate(const bool status);
void checkLinglongUpdateStatus();
void tryLinglongUpdate();

private Q_SLOTS:
void setCheckUpdatesJob(const QString &jobPath);
void onJobListChanged(const QList<QDBusObjectPath> &jobs);
Expand Down
28 changes: 0 additions & 28 deletions dcc-old/src/plugin-update/window/updatesettingsmodule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,34 +135,6 @@ void UpdateSettingsModule::initModuleList()
m_model->getAutoCheckThirdpartyUpdates());
}));
}
appendChild(new WidgetModule<SwitchWidget>(
"Linglong update",
tr("linglong update"),
[this](SwitchWidget *lingLongUpdateBtn) {
lingLongUpdateBtn->addBackground();
connect(m_model,
&UpdateModel::longlongAutoUpdateChanged,
lingLongUpdateBtn,
&SwitchWidget::setChecked);
connect(lingLongUpdateBtn,
&SwitchWidget::checkedChanged,
m_work,
&UpdateWorker::setLinglongAutoUpdate);
lingLongUpdateBtn->setChecked(m_model->linglongAutoUpdate());
lingLongUpdateBtn->setTitle(tr("Linglong Package Update"));
}));
auto linglongUpdateTip = new WidgetModule<DTipLabel>(
"LinglongUpdateTip",
"",
[](DTipLabel *lingLongUpdateLabel) {
lingLongUpdateLabel->setWordWrap(true);
lingLongUpdateLabel->setAlignment(Qt::AlignLeft);
lingLongUpdateLabel->setContentsMargins(10, 0, 10, 0);
lingLongUpdateLabel->setText(tr(
"If there is update for linglong package, system will update it for you"));
});
appendChild(linglongUpdateTip);

// 其他设置
appendChild(new UpdateTitleModule("otherSettings", tr("Other settings")));
m_autoCheckUpdateModule = new WidgetModule<SwitchWidget>(
Expand Down

0 comments on commit ea6dd3d

Please sign in to comment.