[pbs-devel] [PATCH proxmox 1/2] section-config: make ReST dump reproducible

Fabian Grünbichler f.gruenbichler at proxmox.com
Tue Dec 13 14:37:54 CET 2022


HashMaps are not ordered, so each package build containing a section config
dump would have the documentation ordered randomly.

Signed-off-by: Fabian Grünbichler <f.gruenbichler at proxmox.com>
---
tested PBS build with the resulting proxmox-section-config crate, the -docs
package is now reproducible ;)

 proxmox-section-config/src/lib.rs | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/proxmox-section-config/src/lib.rs b/proxmox-section-config/src/lib.rs
index 1706718..51f6770 100644
--- a/proxmox-section-config/src/lib.rs
+++ b/proxmox-section-config/src/lib.rs
@@ -1110,10 +1110,13 @@ token: asdf at pbs!asdftoken
 pub fn dump_section_config(config: &SectionConfig) -> String {
     let mut res = String::new();
 
+    let mut plugins: Vec<&String> = config.plugins().keys().collect();
+    plugins.sort_unstable();
+
     let plugin_count = config.plugins().len();
 
-    for plugin in config.plugins().values() {
-        let name = plugin.type_name();
+    for name in plugins {
+        let plugin = config.plugins().get(name).unwrap();
         let properties = plugin.properties();
         let skip = match plugin.id_property() {
             Some(id) => vec![id],
-- 
2.30.2






More information about the pbs-devel mailing list