Mailinglist Archive: yast-commit (723 mails)

< Previous Next >
[yast-commit] r47391 - in /trunk/network: VERSION package/yast2-network.changes src/lan/hardware.ycp src/modules/LanItems.ycp
  • From: mzugec@xxxxxxxxxxxxxxxx
  • Date: Fri, 09 May 2008 08:20:18 -0000
  • Message-id: <20080509082019.100DF2DD97@xxxxxxxxxxxxxxxx>
Author: mzugec
Date: Fri May 9 10:20:18 2008
New Revision: 47391

URL: http://svn.opensuse.org/viewcvs/yast?rev=47391&view=rev
Log:
just edit udev rules, not replace them (bnc#383320)

Modified:
trunk/network/VERSION
trunk/network/package/yast2-network.changes
trunk/network/src/lan/hardware.ycp
trunk/network/src/modules/LanItems.ycp

Modified: trunk/network/VERSION
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/network/VERSION?rev=47391&r1=47390&r2=47391&view=diff
==============================================================================
--- trunk/network/VERSION (original)
+++ trunk/network/VERSION Fri May 9 10:20:18 2008
@@ -1 +1 @@
-2.16.40
+2.16.41

Modified: trunk/network/package/yast2-network.changes
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/network/package/yast2-network.changes?rev=47391&r1=47390&r2=47391&view=diff
==============================================================================
--- trunk/network/package/yast2-network.changes (original)
+++ trunk/network/package/yast2-network.changes Fri May 9 10:20:18 2008
@@ -1,4 +1,10 @@
-------------------------------------------------------------------
+Fri May 9 07:35:15 CEST 2008 - mzugec@xxxxxxx
+
+- just edit udev rules, not replace them (bnc#383320)
+- 2.16.41
+
+-------------------------------------------------------------------
Mon Apr 21 15:15:53 CEST 2008 - mzugec@xxxxxxx

- improved algorithm to require gnome/kde version of NetworkManager

Modified: trunk/network/src/lan/hardware.ycp
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/network/src/lan/hardware.ycp?rev=47391&r1=47390&r2=47391&view=diff
==============================================================================
--- trunk/network/src/lan/hardware.ycp (original)
+++ trunk/network/src/lan/hardware.ycp Fri May 9 10:20:18 2008
@@ -228,7 +228,7 @@
UI::ChangeWidget(`id(`device_name), `Enabled, false);
// UI::ChangeWidget(`id(`options), `Enabled, false);

- UI::ChangeWidget(`id(`device_name), `Value, LanItems::GetItemUdev()[1]:"");
+ UI::ChangeWidget(`id(`device_name), `Value, LanItems::GetItemUdev("NAME"));

if (!hw_standalone) ChangeWidgetIfExists(`id(`dev), `Enabled,false);
ChangeWidgetIfExists(`id(`num), `ValidChars,
NetworkInterfaces::ValidCharsIfcfg ());
@@ -435,7 +435,7 @@
`Left(
`HBox(
`CheckBox(`id(`change_dev_name), `opt(`notify), _("Change
DeviceName"), false),
- `InputField(`id(`dev_name), "", LanItems::GetItemUdev()[1]:"")
+ `InputField(`id(`dev_name), "", LanItems::GetItemUdev("NAME"))
)
),
`VSpacing(0.5),
@@ -445,10 +445,9 @@
)

);
- string rule = splitstring(LanItems::GetItemUdev()[0]:"", "==")[0]:"";
- if (rule=="ATTR{address}") UI::ChangeWidget(`id(`udev_type),
`CurrentButton, `mac);
- else if (rule=="KERNELS") UI::ChangeWidget(`id(`udev_type),
`CurrentButton, `busid);
- else y2error("Unknown udev rule : %1", LanItems::GetItemUdev()[0]:"");
+ if (size(LanItems::GetItemUdev("ATTR{address}"))>0)
UI::ChangeWidget(`id(`udev_type), `CurrentButton, `mac);
+ else if (size(LanItems::GetItemUdev("KERNELS"))>0)
UI::ChangeWidget(`id(`udev_type), `CurrentButton, `busid);
+ else y2error("Unknown udev rule ");
UI::ChangeWidget(`dev_name, `Enabled, false);
any ret = nil;
while(ret!=`cancel && ret!=`ok){
@@ -456,23 +455,38 @@
if (ret == `change_dev_name) UI::ChangeWidget(`dev_name, `Enabled,
(boolean)UI::QueryWidget(`change_dev_name, `Value));
}
if (ret == `ok){
- string old_name = LanItems::GetItemUdev()[1]:"";
+ string old_name = LanItems::GetItemUdev("NAME");
// write new udev rule
- LanItems::Items[LanItems::current, "udev", "net"]=["SUBSYSTEM==\"net\"",
- "DRIVERS==\"?*\"",
- UI::QueryWidget(`udev_type, `CurrentButton)==`mac ?
sformat("ATTR{address}==\"%1\"", LanItems::getCurrentItem()["hwinfo",
"mac"]:"") : sformat("KERNELS==\"%1\"", LanItems::getCurrentItem()["hwinfo",
"busid"]:""),
- sformat("NAME==\"%1\"", ((boolean)UI::QueryWidget(`change_dev_name,
`Value))?UI::QueryWidget(`dev_name, `Value):LanItems::GetItemUdev()[1]:"")
+/*
+ string rule_key = UI::QueryWidget(`udev_type, `CurrentButton)==`mac ?
sformat("ATTR{address}==\"%1\"",
+ LanItems::getCurrentItem()["hwinfo", "mac"]:"") :
sformat("KERNELS==\"%1\"", LanItems::getCurrentItem()["hwinfo", "busid"]:"");
+*/
+ string rule_key = UI::QueryWidget(`udev_type, `CurrentButton)==`mac ?
"ATTR{address}" : "KERNELS";
+ string rule_value = UI::QueryWidget(`udev_type, `CurrentButton)==`mac ?
LanItems::getCurrentItem()["hwinfo", "mac"]:"" :
LanItems::getCurrentItem()["hwinfo", "busid"]:"";
+// LanItems::Items[LanItems::current, "udev", "net"]=
+y2internal("LanItems::GetReplacedItemUdev(%1, %2) %3",rule_key, rule_value,
LanItems::GetReplacedItemUdev(rule_key, rule_value));
+ if ((boolean)UI::QueryWidget(`change_dev_name, `Value)){
+ y2internal("LanItems::GetReplacedItemUdev2 %1",
LanItems::GetReplacedItemUdev("NAME", (string)UI::QueryWidget(`dev_name,
`Value)));
+ }
+/*
+ LanItems::Items[LanItems::current, "udev", "net"]=
+ ["SUBSYSTEM==\"net\"",
+ "DRIVERS==\"?*\"",
+ UI::QueryWidget(`udev_type, `CurrentButton)==`mac ?
sformat("ATTR{address}==\"%1\"",
+ LanItems::getCurrentItem()["hwinfo", "mac"]:"") :
sformat("KERNELS==\"%1\"", LanItems::getCurrentItem()["hwinfo", "busid"]:""),
+ sformat("NAME==\"%1\"", ((boolean)UI::QueryWidget(`change_dev_name,
`Value))?UI::QueryWidget(`dev_name, `Value):LanItems::GetItemUdev("NAME"))
];
+*/
// when dev_name changed, rename ifcfg (both in NetworkInterfaces and
LanItems)
- if (LanItems::GetItemUdev()[1]:""!=old_name){
+ if (LanItems::GetItemUdev("NAME")!=old_name){
NetworkInterfaces::Delete2(old_name);
// NetworkInterfaces::Commit();
- LanItems::Items[LanItems::current, "ifcfg"]=LanItems::GetItemUdev()[1]:"";
+ LanItems::Items[LanItems::current, "ifcfg"]=LanItems::GetItemUdev("NAME");
// LanItems::Items[LanItems::current, "hwinfo",
"dev_name"]=LanItems::GetItemUdev()[1]:"";
}
}
UI::CloseDialog();
- UI::ChangeWidget(`device_name, `Value, LanItems::GetItemUdev()[1]:"");
+ UI::ChangeWidget(`device_name, `Value, LanItems::GetItemUdev("NAME"));
}
return nil;
}

Modified: trunk/network/src/modules/LanItems.ycp
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/network/src/modules/LanItems.ycp?rev=47391&r1=47390&r2=47391&view=diff
==============================================================================
--- trunk/network/src/modules/LanItems.ycp (original)
+++ trunk/network/src/modules/LanItems.ycp Fri May 9 10:20:18 2008
@@ -181,8 +181,20 @@
return true;
}

-global list<string> GetItemUdev(){
+global string GetItemUdev(string key){
+ string value="";
+ foreach(string row, Items[current, "udev", "net"]:[], {
+ if(issubstring(row, key)){
+
+ list items = filter(string s, splitstring(row, "="), { return (size(s)>0);
});
+ if (size(items)==2 && items[0]:""==key){
+ value=deletechars(items[1]:"", "\"");
+ } else y2warning("udev items %1 doesn't match the key %2", items, key);
+ }
+ });
+ return value;
// column: 0 mens rule, 1 means NAME
+/*
list<string> udevs=["", ""];
if (size(Items[current, "udev", "net"]:[])>3)
{
@@ -193,9 +205,21 @@
});
}
return udevs;
+*/
}

+global list<string> GetReplacedItemUdev(string r_key, string r_val){
+ list <string> new_rules=[];
+ foreach(string row, Items[current, "udev", "net"]:[], {
+ if (r_key=="NAME"){
+ if (issubstring(row, "NAME")) row = sformat("NAME=\"%1\"", r_val);
+ } else if (issubstring(row, "ATTR{address}") || issubstring(row, "KERNELS"))
row = sformat("%1==\"%2\"", r_key, r_val);

+ new_rules = add(new_rules, row);
+ });
+ Items[current, "udev", "net"]=new_rules;
+ return new_rules;
+}

global void WriteUdevDriverRules(){
map<string, any> udev_drivers_rules = $[];
@@ -212,14 +236,15 @@
if (size(Items[key, "udev", "net"]:[])>0) {
string dev_name = Items[key, "hwinfo", "dev_name"]:"";
current=key;
- net_rules = add(net_rules, sformat("SUBSYSTEM==\"net\", DRIVERS==\"?*\",
%1, NAME=\"%2\"",
- GetItemUdev()[0]:"",
GetItemUdev()[1]:""));
- if (dev_name!=GetItemUdev()[1]:"") {
+// net_rules = add(net_rules, sformat("SUBSYSTEM==\"net\", DRIVERS==\"?*\",
%1, NAME=\"%2\"", GetItemUdev("ATTR{address}"), GetItemUdev("NAME")));
+ net_rules = add(net_rules, mergestring(Items[key, "udev", "net"]:[], ",
"));
+ if (dev_name!=GetItemUdev("NAME")) {
changed_devices = add(changed_devices, dev_name);
force_restart=true;
}
}
});
+y2internal("udev net_rules %1", net_rules);
SCR::Write(.udev_persistent.rules, net_rules);
SCR::Write(.udev_persistent.nil, []);
foreach(string dev, changed_devices, {
@@ -882,7 +907,7 @@
// nm_name = NetworkModules::GetFreeName("static-");

// TODO: instead of udev use hwinfo dev_name
- NetworkInterfaces::Name = GetItemUdev()[1]:"";
+ NetworkInterfaces::Name = GetItemUdev("NAME");
if (size(Items)<current) Items[current] =
$["ifcfg":NetworkInterfaces::Name];
else Items[current, "ifcfg"] = NetworkInterfaces::Name;


--
To unsubscribe, e-mail: yast-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages