Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package mirrorsorcerer for openSUSE:Factory 
checked in at 2022-04-19 09:58:46
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/mirrorsorcerer (Old)
 and      /work/SRC/openSUSE:Factory/.mirrorsorcerer.new.1941 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "mirrorsorcerer"

Tue Apr 19 09:58:46 2022 rev:6 rq:970650 version:0.1.0~13

Changes:
--------
--- /work/SRC/openSUSE:Factory/mirrorsorcerer/mirrorsorcerer.changes    
2022-03-20 20:55:36.394531467 +0100
+++ /work/SRC/openSUSE:Factory/.mirrorsorcerer.new.1941/mirrorsorcerer.changes  
2022-04-19 09:59:46.339681877 +0200
@@ -1,0 +2,7 @@
+Tue Apr 19 02:48:10 UTC 2022 - william.br...@suse.com
+
+- Update to version 0.1.0~13:
+  * Fix issue with dns resolving
+  * Improve consistency
+
+-------------------------------------------------------------------

Old:
----
  mirrorsorcerer-0.1.0~11.tar.xz

New:
----
  mirrorsorcerer-0.1.0~13.tar.xz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ mirrorsorcerer.spec ++++++
--- /var/tmp/diff_new_pack.O76Ypa/_old  2022-04-19 09:59:47.523683416 +0200
+++ /var/tmp/diff_new_pack.O76Ypa/_new  2022-04-19 09:59:47.527683421 +0200
@@ -17,7 +17,7 @@
 
 
 Name:           mirrorsorcerer
-Version:        0.1.0~11
+Version:        0.1.0~13
 Release:        0
 Summary:        Mirror Sorcerer tool to magically make OpenSUSE mirror sources 
more magic-er
 License:        (Apache-2.0 OR BSL-1.0) AND (Apache-2.0 OR MIT) AND 
(Apache-2.0 OR MIT OR Zlib) AND (MIT OR Unlicense) AND (Apache-2.0 OR Zlib OR 
MIT) AND BSD-3-Clause AND MIT AND MPL-2.0

++++++ mirrorsorcerer-0.1.0~11.tar.xz -> mirrorsorcerer-0.1.0~13.tar.xz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/mirrorsorcerer-0.1.0~11/Cargo.toml 
new/mirrorsorcerer-0.1.0~13/Cargo.toml
--- old/mirrorsorcerer-0.1.0~11/Cargo.toml      2022-03-20 04:44:22.000000000 
+0100
+++ new/mirrorsorcerer-0.1.0~13/Cargo.toml      2022-04-19 04:46:48.000000000 
+0200
@@ -26,4 +26,5 @@
 users = "0.11"
 
 notify = "4.0.17"
+crc32c = "0.6"
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/mirrorsorcerer-0.1.0~11/packman.json 
new/mirrorsorcerer-0.1.0~13/packman.json
--- old/mirrorsorcerer-0.1.0~11/packman.json    1970-01-01 01:00:00.000000000 
+0100
+++ new/mirrorsorcerer-0.1.0~13/packman.json    2022-04-19 04:46:48.000000000 
+0200
@@ -0,0 +1,9 @@
+{
+  "replaceable": [],
+  "mirrors": [
+                    "http://ftp.fau.de";,
+    "http://ftp.halifax.rwth-aachen.de";,
+    "http://ftp.gwdg.de/pub/linux/misc";,
+  "http://mirror.karneval.cz/pub/linux";
+  ]
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/mirrorsorcerer-0.1.0~11/src/main.rs 
new/mirrorsorcerer-0.1.0~13/src/main.rs
--- old/mirrorsorcerer-0.1.0~11/src/main.rs     2022-03-20 04:44:22.000000000 
+0100
+++ new/mirrorsorcerer-0.1.0~13/src/main.rs     2022-04-19 04:46:48.000000000 
+0200
@@ -12,6 +12,10 @@
 use tracing_subscriber::{fmt, EnvFilter};
 use url::Url;
 
+use std::fs::File;
+use std::io::BufRead;
+use std::io::Seek;
+
 use notify::{watcher, DebouncedEvent, RecursiveMode, Watcher};
 use std::sync::mpsc::{channel, Receiver};
 
@@ -37,7 +41,10 @@
 
     let mut addrs: Vec<_> = format!("{}:443", h)
         .to_socket_addrs()
-        .unwrap()
+        .map_err(|_e| {
+            warn!("Unable to resolve {} to an ip address.", h);
+        })
+        .ok()?
         .map(|sa| sa.ip())
         .collect();
 
@@ -138,6 +145,41 @@
     }
 }
 
+fn crc32c_path(p: &Path) -> Option<u32> {
+    let mut file = File::open(p).ok()?;
+
+    file.seek(std::io::SeekFrom::Start(0))
+        .map_err(|e| {
+            error!("Unable to seek tempfile -> {:?}", e);
+        })
+        .ok()?;
+
+    let mut buf_file = BufReader::with_capacity(8192, file);
+    let mut crc = 0;
+    loop {
+        match buf_file.fill_buf() {
+            Ok(buffer) => {
+                let length = buffer.len();
+                if length == 0 {
+                    // We are done!
+                    break;
+                } else {
+                    // we have content, proceed.
+                    crc = crc32c::crc32c_append(crc, &buffer);
+                    buf_file.consume(length);
+                }
+            }
+            Err(e) => {
+                error!("Bufreader error -> {:?}", e);
+                return None;
+            }
+        }
+    }
+    debug!("crc32c is: {:x}", crc);
+
+    Some(crc)
+}
+
 fn rewrite_mirror(p: &Path, m: &Url, known_m: &[Url]) {
     if p.extension().and_then(|s| s.to_str()) != Some("repo") {
         debug!(?p, "Ignoring");
@@ -146,6 +188,24 @@
         debug!("Inspecting {:?} ...", p);
     }
 
+    let backup = p.with_extension("msbak");
+    if !backup.exists() {
+        if let Err(e) = fs::copy(p, &backup) {
+            error!(?e, "Unable to backup {:?} original.", p);
+            return;
+        } else {
+            info!("Backed up {:?} -> {:?}", p, backup);
+        }
+    }
+
+    let crc_pre = match crc32c_path(p) {
+        Some(c) => c,
+        None => {
+            error!("Unable to verify {:?} original.", p);
+            return;
+        }
+    };
+
     let mut repo = match ini::Ini::load_from_file(p) {
         Ok(r) => {
             let mut dump: Vec<u8> = Vec::new();
@@ -212,6 +272,22 @@
         sect.insert("baseurl", baseurl);
     }
 
+    let crc_post = match crc32c_path(p) {
+        Some(c) => c,
+        None => {
+            error!("Unable to verify {:?} original.", p);
+            return;
+        }
+    };
+
+    if crc_pre != crc_post {
+        error!(
+            "File changed while we were reading it! {} != {}",
+            crc_pre, crc_post
+        );
+        return;
+    }
+
     if let Err(e) = repo.write_to_file(p) {
         warn!(?e, ?p, "Unable to write repo configuration");
     }
@@ -361,7 +437,7 @@
     // wait, if we have files to change, update them.
 
     let (tx, rx) = channel();
-    let mut watcher = match watcher(tx, Duration::from_millis(250)) {
+    let mut watcher = match watcher(tx, Duration::from_secs(2)) {
         Ok(w) => w,
         Err(e) => {
             error!(?e, "Unable to create inotify watcher");

++++++ vendor.tar.xz ++++++
/work/SRC/openSUSE:Factory/mirrorsorcerer/vendor.tar.xz 
/work/SRC/openSUSE:Factory/.mirrorsorcerer.new.1941/vendor.tar.xz differ: char 
27, line 1

Reply via email to