update version to 1.1.0

Signed-off-by: wangyaoyong <yaoyong.oerv@isrc.iscas.ac.cn>
This commit is contained in:
wangyaoyong 2024-05-08 16:34:55 +08:00
parent 86accfbb68
commit e9b4a4b418
10 changed files with 6 additions and 381 deletions

View File

@ -1,129 +0,0 @@
From 98a7de479aa6da2d499b893fb1b5e5bfc598ab40 Mon Sep 17 00:00:00 2001
From: chenjiayi <chenjiayi22@huawei.com>
Date: Fri, 26 Jan 2024 15:27:03 +0800
Subject: [PATCH] feature(devmaster): add net_driver builtin to be compatible
with systemd-udev 255
The net_driver builtin is added to be compatible with systemd-udev 255.
Otherwise devmaster would crash when encounterring net_driver builtin in udev rules.
---
exts/devmaster/src/lib/builtin/mod.rs | 12 ++++-
exts/devmaster/src/lib/builtin/net_driver.rs | 56 ++++++++++++++++++++
2 files changed, 66 insertions(+), 2 deletions(-)
create mode 100644 exts/devmaster/src/lib/builtin/net_driver.rs
diff --git a/exts/devmaster/src/lib/builtin/mod.rs b/exts/devmaster/src/lib/builtin/mod.rs
index 259ebd13..30ad9031 100644
--- a/exts/devmaster/src/lib/builtin/mod.rs
+++ b/exts/devmaster/src/lib/builtin/mod.rs
@@ -34,6 +34,7 @@ pub mod hwdb;
pub mod input_id;
pub mod keyboard;
pub mod kmod;
+pub mod net_driver;
pub mod net_id;
pub mod net_setup_link;
pub mod path_id;
@@ -108,8 +109,9 @@ pub enum BuiltinCommand {
PathId = 8,
Uaccess = 9,
UsbId = 10,
- Example = 11,
- Max = 12,
+ NetDriver = 11,
+ Example = 12,
+ Max = 13,
}
impl FromStr for BuiltinCommand {
@@ -135,6 +137,7 @@ impl FromStr for BuiltinCommand {
"path_id" => Ok(BuiltinCommand::PathId),
"uaccess" => Ok(BuiltinCommand::Uaccess),
"usb_id" => Ok(BuiltinCommand::UsbId),
+ "net_driver" => Ok(BuiltinCommand::NetDriver),
"example" => Ok(BuiltinCommand::Example),
_ => Err(Error::BuiltinCommandError {
msg: "invalid builtin command".to_string(),
@@ -157,6 +160,7 @@ impl Display for BuiltinCommand {
BuiltinCommand::PathId => "path_id",
BuiltinCommand::Uaccess => "uaccess",
BuiltinCommand::UsbId => "usb_id",
+ BuiltinCommand::NetDriver => "net_driver",
BuiltinCommand::Example => "example",
_ => "invalid",
};
@@ -190,6 +194,10 @@ impl BuiltinManager {
builtins.insert(BuiltinCommand::PathId, Box::new(path_id::PathId {}));
builtins.insert(BuiltinCommand::Uaccess, Box::new(uaccess::Uaccess {}));
builtins.insert(BuiltinCommand::UsbId, Box::new(usb_id::UsbId {}));
+ builtins.insert(
+ BuiltinCommand::NetDriver,
+ Box::new(net_driver::NetDriver {}),
+ );
builtins.insert(BuiltinCommand::Example, Box::new(example::Example {}));
BuiltinManager { builtins }
diff --git a/exts/devmaster/src/lib/builtin/net_driver.rs b/exts/devmaster/src/lib/builtin/net_driver.rs
new file mode 100644
index 00000000..83e6398e
--- /dev/null
+++ b/exts/devmaster/src/lib/builtin/net_driver.rs
@@ -0,0 +1,56 @@
+// Copyright (c) 2022 Huawei Technologies Co.,Ltd. All rights reserved.
+//
+// sysMaster is licensed under Mulan PSL v2.
+// You can use this software according to the terms and conditions of the Mulan
+// PSL v2.
+// You may obtain a copy of Mulan PSL v2 at:
+// http://license.coscl.org.cn/MulanPSL2
+// THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY
+// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
+// NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
+// See the Mulan PSL v2 for more details.
+
+//! net_driver builtin
+//!
+//! Todo: compatible with udev
+
+use crate::builtin::Builtin;
+use crate::error::Result;
+use crate::rules::exec_unit::ExecuteUnit;
+
+/// btrfs builtin command
+pub struct NetDriver;
+
+impl Builtin for NetDriver {
+ /// builtin command
+ fn cmd(
+ &self,
+ _exec_unit: &ExecuteUnit,
+ _argc: i32,
+ _argv: Vec<String>,
+ _test: bool,
+ ) -> Result<bool> {
+ Ok(true)
+ }
+
+ /// builtin init function
+ fn init(&self) {}
+
+ /// builtin exit function
+ fn exit(&self) {}
+
+ /// check whether builtin command should reload
+ fn should_reload(&self) -> bool {
+ false
+ }
+
+ /// the help of builtin command
+ fn help(&self) -> String {
+ "detect network interface driver".to_string()
+ }
+
+ /// whether the builtin command can only run once
+ fn run_once(&self) -> bool {
+ false
+ }
+}
--
Gitee

View File

@ -1,42 +0,0 @@
From 5ce27d9ee552ffe24ffdc234467ae4b817b956d1 Mon Sep 17 00:00:00 2001
From: chenjiayi <chenjiayi22@huawei.com>
Date: Fri, 19 Apr 2024 03:16:26 +0800
Subject: [PATCH 1/1] fix(devmaster): add device property when cmdline
parameter has no value
If cmdline parameter has no value, assign "1" to it and add property
to the device.
---
exts/devmaster/src/lib/rules/exec_mgr.rs | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/exts/devmaster/src/lib/rules/exec_mgr.rs b/exts/devmaster/src/lib/rules/exec_mgr.rs
index 54e0093e..4dd15a00 100644
--- a/exts/devmaster/src/lib/rules/exec_mgr.rs
+++ b/exts/devmaster/src/lib/rules/exec_mgr.rs
@@ -908,11 +908,20 @@ impl ExecuteManager {
return Ok(token.read().unwrap().as_ref().unwrap().op == OperatorType::Nomatch);
}
- let value = cmdline.get_param(&token_value);
+ let value = match cmdline.get_param(&token_value) {
+ Some(v) => {
+ if v.is_empty() {
+ "1".to_string()
+ } else {
+ v
+ }
+ }
+ None => "1".to_string(),
+ };
execute_err!(
token.read().unwrap().as_ref().unwrap(),
- device.add_property(&token_value, &value.unwrap_or_default())
+ device.add_property(&token_value, &value)
)?;
Ok(token.read().unwrap().as_ref().unwrap().op == OperatorType::Match)
--
2.33.0

View File

@ -1,36 +0,0 @@
From 78e39ccc831dcc3e2ceb365df492a544ae84ff5f Mon Sep 17 00:00:00 2001
From: chenjiayi <chenjiayi22@huawei.com>
Date: Tue, 9 Apr 2024 19:27:45 +0800
Subject: [PATCH 1/3] fix(devmaster): correct the database path
The database is not cleaned up after remove uevent, as the database
path is incorrect.
---
exts/devmaster/src/lib/utils/commons.rs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/exts/devmaster/src/lib/utils/commons.rs b/exts/devmaster/src/lib/utils/commons.rs
index 700caf2d..80e37b3a 100644
--- a/exts/devmaster/src/lib/utils/commons.rs
+++ b/exts/devmaster/src/lib/utils/commons.rs
@@ -19,7 +19,7 @@ use std::{
use crate::{error::*, log_dev, rules::FormatSubstitutionType, utils::trie::*};
use basic::{error::errno_is_privilege, IN_SET};
-use device::{Device, DB_BASE_DIR};
+use device::{Device, DB_BASE_DIR, DEFAULT_BASE_DIR};
use lazy_static::lazy_static;
use nix::{errno::Errno, unistd::unlink};
use snafu::ResultExt;
@@ -575,7 +575,7 @@ pub(crate) fn device_update_tag(
pub(crate) fn cleanup_db(dev: Rc<Device>) -> Result<()> {
let id = dev.get_device_id().context(DeviceSnafu)?;
- let db_path = format!("{}{}", DB_BASE_DIR, id);
+ let db_path = format!("{}/{}/{}", DEFAULT_BASE_DIR, DB_BASE_DIR, id);
match unlink(db_path.as_str()) {
Ok(_) => log_dev!(debug, dev, format!("unlinked '{}'", db_path)),
--
2.33.0

View File

@ -1,43 +0,0 @@
From 90bab54b6648407577082c6baf80e766a6ad8c61 Mon Sep 17 00:00:00 2001
From: chenjiayi <chenjiayi22@huawei.com>
Date: Wed, 17 Apr 2024 18:41:39 +0800
Subject: [PATCH 2/3] fix(devmaster): fix incorrect cmdline parameter value due
to previous refactor
Previous 87234aafd1ab7a82588e45b8d104bda2d708ef90 changed the procedure on how to
get a cmdline parameter. The logic in devmaster was not modified synchronously.
---
exts/devmaster/src/lib/rules/exec_mgr.rs | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/exts/devmaster/src/lib/rules/exec_mgr.rs b/exts/devmaster/src/lib/rules/exec_mgr.rs
index 22b9a2ad..54e0093e 100644
--- a/exts/devmaster/src/lib/rules/exec_mgr.rs
+++ b/exts/devmaster/src/lib/rules/exec_mgr.rs
@@ -903,20 +903,16 @@ impl ExecuteManager {
}
MatchImportCmdline => {
let cmdline = basic::cmdline::Cmdline::default();
- let s = cmdline.get_param(&token_value);
- if s.is_none() {
+ if !cmdline.has_param(&token_value) {
return Ok(token.read().unwrap().as_ref().unwrap().op == OperatorType::Nomatch);
}
- let value = match s.as_ref().unwrap().split_once('=') {
- Some(ret) => ret.1,
- None => "",
- };
+ let value = cmdline.get_param(&token_value);
execute_err!(
token.read().unwrap().as_ref().unwrap(),
- device.add_property(&token_value, if value.is_empty() { "1" } else { value })
+ device.add_property(&token_value, &value.unwrap_or_default())
)?;
Ok(token.read().unwrap().as_ref().unwrap().op == OperatorType::Match)
--
2.33.0

View File

@ -1,27 +0,0 @@
From c486f1c60dbf56fc174f3c488484fc6e0a8b903d Mon Sep 17 00:00:00 2001
From: chenjiayi <chenjiayi22@huawei.com>
Date: Wed, 17 Apr 2024 18:52:58 +0800
Subject: [PATCH 3/3] fix(devmaster): supply log messages on loading .link
config files
Supply missed log messages.
---
exts/devmaster/src/lib/config/netif_conf.rs | 2 ++
1 file changed, 2 insertions(+)
diff --git a/exts/devmaster/src/lib/config/netif_conf.rs b/exts/devmaster/src/lib/config/netif_conf.rs
index 9c593902..44ae7f72 100644
--- a/exts/devmaster/src/lib/config/netif_conf.rs
+++ b/exts/devmaster/src/lib/config/netif_conf.rs
@@ -132,6 +132,8 @@ impl NetifConfigCtx {
if name.ends_with(".link") {
let conf_path = dir_path.join(&name);
+ log::debug!("loading .link config: {:?}", conf_path);
+
let s = match std::fs::read_to_string(&conf_path) {
Ok(content) => content,
Err(e) => {
--
2.33.0

View File

@ -1,27 +0,0 @@
From 9fc2f5912a3fa2fa5a61c62f85a8a81e459f2965 Mon Sep 17 00:00:00 2001
From: zhangyao2022 <zhangyao108@huawei.com>
Date: Wed, 10 Apr 2024 17:16:04 +0800
Subject: [PATCH] fix: read pid cmdline incorrect
---
libs/basic/src/cmdline.rs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libs/basic/src/cmdline.rs b/libs/basic/src/cmdline.rs
index 52cdf5c3..952ec34f 100644
--- a/libs/basic/src/cmdline.rs
+++ b/libs/basic/src/cmdline.rs
@@ -48,8 +48,8 @@ impl Cmdline {
if let Ok(mut file) = File::open(path) {
let mut data = String::new();
if file.read_to_string(&mut data).is_ok() {
- *cmdline = data.clone();
- for item in data.split_whitespace() {
+ *cmdline = data.replace("\0", " ").trim().to_string();
+ for item in cmdline.split_whitespace() {
let mut parts = item.splitn(2, '=');
let key = parts.next().unwrap_or_default().to_string();
let value = parts.next().map(|v| v.to_string());
--
2.33.0

View File

@ -1,38 +0,0 @@
From 0f2708a50893911bd650e3b855e7b470b6c316a9 Mon Sep 17 00:00:00 2001
From: zhangyao2022 <zhangyao108@huawei.com>
Date: Mon, 15 Apr 2024 08:14:58 +0800
Subject: [PATCH] fix: resolve not mount home
---
exts/fstab/src/main.rs | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/exts/fstab/src/main.rs b/exts/fstab/src/main.rs
index 09d7dd34..4eea27dd 100644
--- a/exts/fstab/src/main.rs
+++ b/exts/fstab/src/main.rs
@@ -136,7 +136,7 @@ fn watch_devices(fstab_items: &[FSTabItem]) -> (Inotify, HashSet<String>) {
file_path.file_name().unwrap().to_str().unwrap(),
));
inotify
- .add_watch(dir_path, WatchMask::CREATE)
+ .add_watch(dir_path, WatchMask::CREATE | WatchMask::MOVED_TO)
.expect("Failed to add watch.");
}
(inotify, watch_set)
@@ -171,8 +171,10 @@ fn main() {
.read_events_blocking(&mut buffer)
.expect("Failed to read events.");
for event in events {
- if event.mask == EventMask::CREATE {
- log::debug!("File created: {:?}", event.name.unwrap());
+ if event.mask == EventMask::CREATE || event.mask == EventMask::MOVED_TO {
+ if let Some(name) = event.name {
+ log::debug!("File created or moved: {:?}", name);
+ }
watch_updated = true;
}
}
--
2.33.0

View File

@ -1,27 +0,0 @@
From f2d77666e409dd9ae47c36680e9380900f02b6b9 Mon Sep 17 00:00:00 2001
From: zhangyao2022 <zhangyao108@huawei.com>
Date: Tue, 9 Apr 2024 16:04:45 +0800
Subject: [PATCH] fix: resolve wantedby invalid
---
core/sysmaster/src/manager/pre_install.rs | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/core/sysmaster/src/manager/pre_install.rs b/core/sysmaster/src/manager/pre_install.rs
index 69823478..7032117c 100644
--- a/core/sysmaster/src/manager/pre_install.rs
+++ b/core/sysmaster/src/manager/pre_install.rs
@@ -543,9 +543,7 @@ impl Install {
let mut paths: Vec<PathBuf> = Vec::new();
for p in &self.lookup_path.search_path {
- let mut path = String::new();
- path = path + p + &unit_install.name();
- paths.push(PathBuf::from(path));
+ paths.push(Path::new(p).join(&unit_install.name()));
}
let configer = match UeConfigData::load_config(paths, &unit_install.name()) {
--
2.33.0

View File

@ -11,24 +11,15 @@
%global _cargo_build /usr/bin/env CARGO_HOME=.cargo RUSTC_BOOTSTRAP=1 %{_bindir}/cargo build %__cargo_common_opts
Name: sysmaster
Version: 1.0.0
Release: 7
Version: 1.1.0
Release: 1
Summary: redesign and reimplement process1.
License: Mulan PSL v2
URL: https://gitee.com/openeuler/sysmaster
Source0: %{name}-%{version}.tar.xz
Patch0: backport-feature-devmaster-add-net_driver-builtin-to-be-compa.patch
Patch1: backport-fix-resolve-wantedby-invalid.patch
Patch2: backport-fix-read-pid-cmdline-incorrect.patch
Patch3: backport-fix-resolve-not-mount-home.patch
Patch4: backport-fix-devmaster-correct-the-database-path.patch
Patch5: backport-fix-devmaster-fix-incorrect-cmdline-parameter-value-.patch
Patch6: backport-fix-devmaster-supply-log-messages-on-loading-.link-c.patch
Patch7: backport-fix-devmaster-add-device-property-when-cmdline-param.patch
ExclusiveArch: x86_64 aarch64
ExclusiveArch: x86_64 aarch64 riscv64
BuildRequires: rust cargo rust-packaging
BuildRequires: gcc clang openssl-libs
@ -168,6 +159,9 @@ if [ $1 -eq 0 ] ; then
fi
%changelog
* Wed May 8 2024 wangyaoyong <yaoyong.oerv@isrc.iscas.ac.cn> - 1.1.0-1
- update version to 1.1.0
* Tue Apr 23 2024 chenjiayi<chenjiayi22@huawei.com> - 1.0.0-7
- sync patches from upstream