Hello community,

here is the log from the commit of package linuxrc for openSUSE:Factory checked 
in at 2017-12-03 10:07:43
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/linuxrc (Old)
 and      /work/SRC/openSUSE:Factory/.linuxrc.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "linuxrc"

Sun Dec  3 10:07:43 2017 rev:250 rq:546018 version:5.1.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/linuxrc/linuxrc.changes  2017-11-18 
00:19:26.051176216 +0100
+++ /work/SRC/openSUSE:Factory/.linuxrc.new/linuxrc.changes     2017-12-03 
10:07:44.767369057 +0100
@@ -1,0 +2,7 @@
+Mon Nov 27 13:35:21 UTC 2017 - [email protected]
+
+- merge gh#openSUSE/linuxrc#159
+- try harder to find a suitable network interface (bsc#1068336)
+- 5.1.0
+
+--------------------------------------------------------------------

Old:
----
  linuxrc-5.0.116.tar.xz

New:
----
  linuxrc-5.1.0.tar.xz

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

Other differences:
------------------
++++++ linuxrc.spec ++++++
--- /var/tmp/diff_new_pack.BjtENO/_old  2017-12-03 10:07:46.303313214 +0100
+++ /var/tmp/diff_new_pack.BjtENO/_new  2017-12-03 10:07:46.307313068 +0100
@@ -17,7 +17,7 @@
 
 
 Name:           linuxrc
-Version:        5.0.116
+Version:        5.1.0
 Release:        0
 Summary:        SUSE Installation Program
 License:        GPL-3.0+

++++++ linuxrc-5.0.116.tar.xz -> linuxrc-5.1.0.tar.xz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/linuxrc-5.0.116/VERSION new/linuxrc-5.1.0/VERSION
--- old/linuxrc-5.0.116/VERSION 2017-11-17 14:58:23.000000000 +0100
+++ new/linuxrc-5.1.0/VERSION   2017-11-27 14:35:21.000000000 +0100
@@ -1 +1 @@
-5.0.116
+5.1.0
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/linuxrc-5.0.116/changelog new/linuxrc-5.1.0/changelog
--- old/linuxrc-5.0.116/changelog       2017-11-17 14:58:23.000000000 +0100
+++ new/linuxrc-5.1.0/changelog 2017-11-27 14:35:21.000000000 +0100
@@ -1,3 +1,7 @@
+2017-11-27:    5.1.0
+       - merge gh#openSUSE/linuxrc#159
+       - try harder to find a suitable network interface (bsc#1068336)
+
 2017-11-17:    5.0.116
        - merge gh#openSUSE/linuxrc#158
        - squashfs.ko might depend on zstd_decompress
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/linuxrc-5.0.116/url.c new/linuxrc-5.1.0/url.c
--- old/linuxrc-5.0.116/url.c   2017-11-17 14:58:23.000000000 +0100
+++ new/linuxrc-5.1.0/url.c     2017-11-27 14:35:21.000000000 +0100
@@ -65,6 +65,9 @@
 static char *url_instsys_config(char *path);
 static char *url_config_get_path(char *entry);
 static slist_t *url_config_get_file_list(char *entry);
+static hd_t *find_parent_in_list(hd_t *hd_list, hd_t *hd);
+static hd_t *relink_array(hd_t *hd_array[]);
+static void log_hd_list(char *label, hd_t *hd);
 static hd_t *sort_a_bit(hd_t *hd_list);
 static int link_detected(hd_t *hd);
 static char *url_print_zypp(url_t *url);
@@ -1437,7 +1440,7 @@
   hd_t *hd;
   hd_res_t *res;
   char *hwaddr;
-  hd_hw_item_t hw_item = hw_network_ctrl;
+  hd_hw_item_t *hw_items = (hd_hw_item_t[]) { hw_network_ctrl, hw_network, 0 };
   str_list_t *sl;
   char *url_device;
 
@@ -1455,15 +1458,15 @@
   if(!url->is.network) {
     switch(url->scheme) {
       case inst_cdrom:
-        hw_item = hw_cdrom;
+        hw_items = (hd_hw_item_t[]) { hw_cdrom, 0 };
         break;
 
       case inst_floppy:
-        hw_item = hw_floppy;
+        hw_items = (hd_hw_item_t[]) { hw_floppy, 0 };
         break;
 
       default:
-        hw_item = hw_block;
+        hw_items = (hd_hw_item_t[]) { hw_block, 0 };
         break;
     }
   }
@@ -1471,7 +1474,7 @@
   url_device = url->device;
   if(!url_device) url_device = url->is.network ? config.ifcfg.manual->device : 
config.device;
 
-  for(found = 0, hd = sort_a_bit(fix_device_names(hd_list(config.hd_data, 
hw_item, 0, NULL))); hd; hd = hd->next) {
+  for(found = 0, hd = sort_a_bit(fix_device_names(hd_list2(config.hd_data, 
hw_items, 0))); hd; hd = hd->next) {
     for(hwaddr = NULL, res = hd->res; res; res = res->next) {
       if(res->any.type == res_hwaddr) {
         hwaddr = res->hwaddr.addr;
@@ -1522,6 +1525,10 @@
     }
   }
 
+  if(!found) {
+    log_info("device not found (err = %d): %s\n", err, url_device ?: "");
+  }
+
   /*
    * should not happen, but anyway: device name was not in our list
    *
@@ -2077,6 +2084,7 @@
   char *hwaddr;
   str_list_t *sl;
   char *url_device;
+  hd_hw_item_t hw_items[] = { hw_network_ctrl, hw_network, 0 };
 
   if(!url || !url->is.network || config.ifcfg.if_up) return url_read_file(url, 
dir, src, dst, label, flags);
 
@@ -2093,7 +2101,7 @@
   if(config.hd_data) {
     url_device = url->device ?: config.ifcfg.manual->device;
 
-    for(found = 0, hd = sort_a_bit(hd_list(config.hd_data, hw_network_ctrl, 0, 
NULL)); hd; hd = hd->next) {
+    for(found = 0, hd = sort_a_bit(hd_list2(config.hd_data, hw_items, 0)); hd; 
hd = hd->next) {
       for(hwaddr = NULL, res = hd->res; res; res = res->next) {
         if(res->any.type == res_hwaddr) {
           hwaddr = res->hwaddr.addr;
@@ -2938,6 +2946,54 @@
 
 
 /*
+ * Look up the parent device of hd in hd_list.
+ *
+ * Return NULL if none exists.
+ */
+hd_t *find_parent_in_list(hd_t *hd_list, hd_t *hd)
+{
+  unsigned idx;
+
+  if(!hd || !hd_list) return NULL;
+
+  for(idx = hd->attached_to; hd_list; hd_list = hd_list->next) {
+    if(hd_list->idx == idx) return hd_list;
+  }
+
+  return NULL;
+}
+
+
+/*
+ * Turn hd_array elements into a linked list, in order.
+ *
+ * Last element in hd_array must be NULL.
+ *
+ * Return linked list.
+ */
+hd_t *relink_array(hd_t *hd_array[])
+{
+  hd_t **hdp = hd_array;
+
+  for(; *hdp; hdp++) (*hdp)->next = hdp[1];
+
+  return *hd_array;
+}
+
+
+/*
+ * Log hardware list in abbreviated form (just device name + class).
+ */
+void log_hd_list(char *label, hd_t *hd)
+{
+  log_info("hd list (%s)\n", label);
+  for(; hd; hd = hd->next) {
+    log_info("  %s (%s)\n", hd->unix_dev_name, hd_hw_item_name(hd->hw_class));
+  }
+}
+
+
+/*
  * Re-sort hardware list to make some people happy.
  */
 hd_t *sort_a_bit(hd_t *hd_list)
@@ -2949,21 +3005,35 @@
 
   if(hds) {
     hd_t *hd_array[hds + 1];
-    unsigned u = 0;
+    unsigned u;
 
-    /* cards with link first */
+    if(config.debug >= 2) log_hd_list("before", hd_list);
 
-    for(hd = hd_list; hd; hd = hd->next) {
+    /* 1. drop network interfaces if there's also a corresponding card  */
+    for(u = 0, hd = hd_list; hd; hd = hd->next) {
+      if(
+        !(hd->hw_class == hw_network && find_parent_in_list(hd_list, hd))
+      ) {
+        hd_array[u++] = hd;
+      }
+    }
+    hd_array[u] = NULL;
+
+    hd_list = relink_array(hd_array);
+
+    /* 2. cards with link first */
+
+    for(u = 0, hd = hd_list; hd; hd = hd->next) {
       if(link_detected(hd)) hd_array[u++] = hd;
     }
     for(hd = hd_list; hd; hd = hd->next) {
       if(!link_detected(hd)) hd_array[u++] = hd;
     }
-    hd_array[hds] = NULL;
-    for(u = 0; u < hds; u++) hd_array[u]->next = hd_array[u + 1];
-    hd_list = hd_array[0];
+    hd_array[u] = NULL;
+
+    hd_list = relink_array(hd_array);
 
-    /* wlan cards last */
+    /* 3. wlan cards last */
 
     for(u = 0, hd = hd_list; hd; hd = hd->next) {
       if(!hd->is.wlan) hd_array[u++] = hd;
@@ -2971,9 +3041,23 @@
     for(hd = hd_list; hd; hd = hd->next) {
       if(hd->is.wlan) hd_array[u++] = hd;
     }
-    hd_array[hds] = NULL;
-    for(u = 0; u < hds; u++) hd_array[u]->next = hd_array[u + 1];
-    hd_list = hd_array[0];
+    hd_array[u] = NULL;
+
+    hd_list = relink_array(hd_array);
+
+    /* 4. network interfaces last */
+
+    for(u = 0, hd = hd_list; hd; hd = hd->next) {
+      if(hd->hw_class != hw_network) hd_array[u++] = hd;
+    }
+    for(hd = hd_list; hd; hd = hd->next) {
+      if(hd->hw_class == hw_network) hd_array[u++] = hd;
+    }
+    hd_array[u] = NULL;
+
+    hd_list = relink_array(hd_array);
+
+    if(config.debug >= 1) log_hd_list("after", hd_list);
   }
 
   return hd_list;


Reply via email to