Zypp Commits
Threads by month
- ----- 2024 -----
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
June 2007
- 7 participants
- 204 discussions
[zypp-commit] r5849 - in /branches/tmp/tgoettlicher/usersaver: make net/ net/1header net/SNNS_NET.c net/SNNS_NET.h net/SNNS_NET.net net/hectic net/idle net/noclue net/patterns.pat net/reading net/type usersaver.c
by tgoettlicher@svn.opensuse.org 27 Jun '07
by tgoettlicher@svn.opensuse.org 27 Jun '07
27 Jun '07
Author: tgoettlicher
Date: Wed Jun 27 16:13:21 2007
New Revision: 5849
URL: http://svn.opensuse.org/viewcvs/zypp?rev=5849&view=rev
Log:
Initial checkin
Added:
branches/tmp/tgoettlicher/usersaver/make (with props)
branches/tmp/tgoettlicher/usersaver/net/
branches/tmp/tgoettlicher/usersaver/net/1header
branches/tmp/tgoettlicher/usersaver/net/SNNS_NET.c
branches/tmp/tgoettlicher/usersaver/net/SNNS_NET.h
branches/tmp/tgoettlicher/usersaver/net/SNNS_NET.net
branches/tmp/tgoettlicher/usersaver/net/hectic
branches/tmp/tgoettlicher/usersaver/net/idle
branches/tmp/tgoettlicher/usersaver/net/noclue
branches/tmp/tgoettlicher/usersaver/net/patterns.pat
branches/tmp/tgoettlicher/usersaver/net/reading
branches/tmp/tgoettlicher/usersaver/net/type
branches/tmp/tgoettlicher/usersaver/usersaver.c
Added: branches/tmp/tgoettlicher/usersaver/make
URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/tgoettlicher/usersaver/ma…
==============================================================================
--- branches/tmp/tgoettlicher/usersaver/make (added)
+++ branches/tmp/tgoettlicher/usersaver/make Wed Jun 27 16:13:21 2007
@@ -0,0 +1,2 @@
+ gcc -o usersaver usersaver.c net/SNNS_NET.c -lX11 -lm
+
Added: branches/tmp/tgoettlicher/usersaver/net/1header
URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/tgoettlicher/usersaver/ne…
==============================================================================
--- branches/tmp/tgoettlicher/usersaver/net/1header (added)
+++ branches/tmp/tgoettlicher/usersaver/net/1header Wed Jun 27 16:13:21 2007
@@ -0,0 +1,9 @@
+Pattern file:
+SNNS pattern definition file V4.1
+generated at Mon Jun 27 13:11:53 CDT 2007
+
+
+No. of patterns : 34
+No. of input units : 9
+No. of output units : 5
+
Added: branches/tmp/tgoettlicher/usersaver/net/SNNS_NET.c
URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/tgoettlicher/usersaver/ne…
==============================================================================
--- branches/tmp/tgoettlicher/usersaver/net/SNNS_NET.c (added)
+++ branches/tmp/tgoettlicher/usersaver/net/SNNS_NET.c Wed Jun 27 16:13:21 2007
@@ -0,0 +1,256 @@
+/*********************************************************
+ SNNS_NET.c
+ --------------------------------------------------------
+ generated at Wed Jun 27 13:18:57 2007
+ by snns2c ( Bernward Kett 1995 )
+*********************************************************/
+
+#include <math.h>
+
+#define Act_Logistic(sum, bias) ( (sum+bias<10000.0) ? ( 1.0/(1.0 + exp(-sum-bias) ) ) : 0.0 )
+#define NULL (void *)0
+
+typedef struct UT {
+ float act; /* Activation */
+ float Bias; /* Bias of the Unit */
+ int NoOfSources; /* Number of predecessor units */
+ struct UT **sources; /* predecessor units */
+ float *weights; /* weights from predecessor units */
+ } UnitType, *pUnit;
+
+ /* Forward Declaration for all unit types */
+ static UnitType Units[26];
+ /* Sources definition section */
+ static pUnit Sources[] = {
+Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, Units + 6, Units + 7, Units + 8, Units + 9, Units + 10,
+Units + 11, Units + 12,
+Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, Units + 6, Units + 7, Units + 8, Units + 9, Units + 10,
+Units + 11, Units + 12,
+Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, Units + 6, Units + 7, Units + 8, Units + 9, Units + 10,
+Units + 11, Units + 12,
+Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, Units + 6, Units + 7, Units + 8, Units + 9, Units + 10,
+Units + 11, Units + 12,
+Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, Units + 6, Units + 7, Units + 8, Units + 9, Units + 10,
+Units + 11, Units + 12,
+Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, Units + 6, Units + 7, Units + 8, Units + 9, Units + 10,
+Units + 11, Units + 12,
+Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, Units + 6, Units + 7, Units + 8, Units + 9, Units + 10,
+Units + 11, Units + 12,
+Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, Units + 6, Units + 7, Units + 8, Units + 9, Units + 10,
+Units + 11, Units + 12,
+Units + 13, Units + 14, Units + 15, Units + 16, Units + 17, Units + 18, Units + 19, Units + 20,
+Units + 13, Units + 14, Units + 15, Units + 16, Units + 17, Units + 18, Units + 19, Units + 20,
+Units + 13, Units + 14, Units + 15, Units + 16, Units + 17, Units + 18, Units + 19, Units + 20,
+Units + 13, Units + 14, Units + 15, Units + 16, Units + 17, Units + 18, Units + 19, Units + 20,
+Units + 13, Units + 14, Units + 15, Units + 16, Units + 17, Units + 18, Units + 19, Units + 20,
+
+ };
+
+ /* Weigths definition section */
+ static float Weights[] = {
+1.976180, 4.981460, 4.674400, -0.902710, 0.328080, -1.099730, 2.588670, -0.126200, 0.719820, 0.051680,
+-0.149180, -0.185040,
+1.976180, 4.981460, 4.674400, -0.902710, 0.328080, -1.099730, 2.588670, -0.126200, 0.719820, 0.051680,
+-0.149180, -0.185040,
+1.976180, 4.981460, 4.674400, -0.902710, 0.328080, -1.099730, 2.588670, -0.126200, 0.719820, 0.051680,
+-0.149180, -0.185040,
+1.976180, 4.981460, 4.674400, -0.902710, 0.328080, -1.099730, 2.588670, -0.126200, 0.719820, 0.051680,
+-0.149180, -0.185040,
+1.976180, 4.981460, 4.674400, -0.902710, 0.328080, -1.099730, 2.588670, -0.126200, 0.719820, 0.051680,
+-0.149180, -0.185040,
+1.976180, 4.981460, 4.674400, -0.902710, 0.328080, -1.099730, 2.588670, -0.126200, 0.719820, 0.051680,
+-0.149180, -0.185040,
+1.976180, 4.981460, 4.674400, -0.902710, 0.328080, -1.099730, 2.588670, -0.126200, 0.719820, 0.051680,
+-0.149180, -0.185040,
+1.976180, 4.981460, 4.674400, -0.902710, 0.328080, -1.099730, 2.588670, -0.126200, 0.719820, 0.051680,
+-0.149180, -0.185040,
+-11.027530, -11.027530, -11.027530, -11.027530, -11.027530, -11.027530, -11.027530, -11.027530,
+3.092150, 3.092150, 3.092150, 3.092150, 3.092150, 3.092150, 3.092150, 3.092150,
+-0.297600, -0.297600, -0.297600, -0.297600, -0.297600, -0.297600, -0.297600, -0.297600,
+0.439710, 0.439710, 0.439710, 0.439710, 0.439710, 0.439710, 0.439710, 0.439710,
+-0.112350, -0.112350, -0.112350, -0.112350, -0.112350, -0.112350, -0.112350, -0.112350,
+
+ };
+
+ /* unit definition section (see also UnitType) */
+ static UnitType Units[26] =
+ {
+ { 0.0, 0.0, 0, NULL , NULL },
+ { /* unit 1 (Old: 1) */
+ 0.0, 0.000000, 0,
+ &Sources[0] ,
+ &Weights[0] ,
+ },
+ { /* unit 2 (Old: 2) */
+ 0.0, 0.000000, 0,
+ &Sources[0] ,
+ &Weights[0] ,
+ },
+ { /* unit 3 (Old: 3) */
+ 0.0, 0.000000, 0,
+ &Sources[0] ,
+ &Weights[0] ,
+ },
+ { /* unit 4 (Old: 4) */
+ 0.0, 0.000000, 0,
+ &Sources[0] ,
+ &Weights[0] ,
+ },
+ { /* unit 5 (Old: 5) */
+ 0.0, 0.000000, 0,
+ &Sources[0] ,
+ &Weights[0] ,
+ },
+ { /* unit 6 (Old: 6) */
+ 0.0, 0.000000, 0,
+ &Sources[0] ,
+ &Weights[0] ,
+ },
+ { /* unit 7 (Old: 7) */
+ 0.0, 0.000000, 0,
+ &Sources[0] ,
+ &Weights[0] ,
+ },
+ { /* unit 8 (Old: 8) */
+ 0.0, 0.000000, 0,
+ &Sources[0] ,
+ &Weights[0] ,
+ },
+ { /* unit 9 (Old: 9) */
+ 0.0, 0.000000, 0,
+ &Sources[0] ,
+ &Weights[0] ,
+ },
+ { /* unit 10 (Old: 10) */
+ 0.0, 0.000000, 0,
+ &Sources[0] ,
+ &Weights[0] ,
+ },
+ { /* unit 11 (Old: 11) */
+ 0.0, 0.000000, 0,
+ &Sources[0] ,
+ &Weights[0] ,
+ },
+ { /* unit 12 (Old: 12) */
+ 0.0, 0.000000, 0,
+ &Sources[0] ,
+ &Weights[0] ,
+ },
+ { /* unit 13 (Old: 13) */
+ 0.0, -3.226190, 12,
+ &Sources[0] ,
+ &Weights[0] ,
+ },
+ { /* unit 14 (Old: 14) */
+ 0.0, -3.226190, 12,
+ &Sources[12] ,
+ &Weights[12] ,
+ },
+ { /* unit 15 (Old: 15) */
+ 0.0, -3.226190, 12,
+ &Sources[24] ,
+ &Weights[24] ,
+ },
+ { /* unit 16 (Old: 16) */
+ 0.0, -3.226190, 12,
+ &Sources[36] ,
+ &Weights[36] ,
+ },
+ { /* unit 17 (Old: 17) */
+ 0.0, -3.226190, 12,
+ &Sources[48] ,
+ &Weights[48] ,
+ },
+ { /* unit 18 (Old: 18) */
+ 0.0, -3.226190, 12,
+ &Sources[60] ,
+ &Weights[60] ,
+ },
+ { /* unit 19 (Old: 19) */
+ 0.0, -3.226190, 12,
+ &Sources[72] ,
+ &Weights[72] ,
+ },
+ { /* unit 20 (Old: 20) */
+ 0.0, -3.226190, 12,
+ &Sources[84] ,
+ &Weights[84] ,
+ },
+ { /* unit 21 (Old: 21) */
+ 0.0, 6.856470, 8,
+ &Sources[96] ,
+ &Weights[96] ,
+ },
+ { /* unit 22 (Old: 22) */
+ 0.0, -22.882820, 8,
+ &Sources[104] ,
+ &Weights[104] ,
+ },
+ { /* unit 23 (Old: 23) */
+ 0.0, -0.429900, 8,
+ &Sources[112] ,
+ &Weights[112] ,
+ },
+ { /* unit 24 (Old: 24) */
+ 0.0, -2.819950, 8,
+ &Sources[120] ,
+ &Weights[120] ,
+ },
+ { /* unit 25 (Old: 25) */
+ 0.0, -0.751220, 8,
+ &Sources[128] ,
+ &Weights[128] ,
+ }
+
+ };
+
+
+
+int SNNS_NET(float *in, float *out, int init)
+{
+ int member, source;
+ float sum;
+ enum{OK, Error, Not_Valid};
+ pUnit unit;
+
+
+ /* layer definition section (names & member units) */
+
+ static pUnit Input[12] = {Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, Units + 6, Units + 7, Units + 8, Units + 9, Units + 10, Units + 11, Units + 12}; /* members */
+
+ static pUnit Hidden1[8] = {Units + 13, Units + 14, Units + 15, Units + 16, Units + 17, Units + 18, Units + 19, Units + 20}; /* members */
+
+ static pUnit Output1[5] = {Units + 21, Units + 22, Units + 23, Units + 24, Units + 25}; /* members */
+
+ static int Output[5] = {21, 22, 23, 24, 25};
+
+ for(member = 0; member < 12; member++) {
+ Input[member]->act = in[member];
+ }
+
+ for (member = 0; member < 8; member++) {
+ unit = Hidden1[member];
+ sum = 0.0;
+ for (source = 0; source < unit->NoOfSources; source++) {
+ sum += unit->sources[source]->act
+ * unit->weights[source];
+ }
+ unit->act = Act_Logistic(sum, unit->Bias);
+ };
+
+ for (member = 0; member < 5; member++) {
+ unit = Output1[member];
+ sum = 0.0;
+ for (source = 0; source < unit->NoOfSources; source++) {
+ sum += unit->sources[source]->act
+ * unit->weights[source];
+ }
+ unit->act = Act_Logistic(sum, unit->Bias);
+ };
+
+ for(member = 0; member < 5; member++) {
+ out[member] = Units[Output[member]].act;
+ }
+
+ return(OK);
+}
Added: branches/tmp/tgoettlicher/usersaver/net/SNNS_NET.h
URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/tgoettlicher/usersaver/ne…
==============================================================================
--- branches/tmp/tgoettlicher/usersaver/net/SNNS_NET.h (added)
+++ branches/tmp/tgoettlicher/usersaver/net/SNNS_NET.h Wed Jun 27 16:13:21 2007
@@ -0,0 +1,14 @@
+/*********************************************************
+ SNNS_NET.h
+ --------------------------------------------------------
+ generated at Wed Jun 27 13:18:57 2007
+ by snns2c ( Bernward Kett 1995 )
+*********************************************************/
+
+extern int SNNS_NET(float *in, float *out, int init);
+
+static struct {
+ int NoOfInput; /* Number of Input Units */
+ int NoOfOutput; /* Number of Output Units */
+ int(* propFunc)(float *, float*, int);
+} SNNS_NETREC = {12,5,SNNS_NET};
Added: branches/tmp/tgoettlicher/usersaver/net/SNNS_NET.net
URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/tgoettlicher/usersaver/ne…
==============================================================================
--- branches/tmp/tgoettlicher/usersaver/net/SNNS_NET.net (added)
+++ branches/tmp/tgoettlicher/usersaver/net/SNNS_NET.net Wed Jun 27 16:13:21 2007
@@ -0,0 +1,81 @@
+SNNS network definition file V1.4-3D
+generated at Wed Jun 27 13:16:33 2007
+
+network name : SNNS_NET
+source files :
+no. of units : 25
+no. of connections : 136
+no. of unit types : 0
+no. of site types : 0
+
+
+learning function : Std_Backpropagation
+update function : Topological_Order
+
+
+unit default section :
+
+act | bias | st | subnet | layer | act func | out func
+---------|----------|----|--------|-------|--------------|-------------
+ 0.00000 | 0.00000 | h | 0 | 1 | Act_Logistic | Out_Identity
+---------|----------|----|--------|-------|--------------|-------------
+
+
+unit definition section :
+
+no. | typeName | unitName | act | bias | st | position | act func | out func | sites
+----|----------|----------|----------|----------|----|----------|----------|----------|-------
+ 1 | | | 0.51419 | 0.00000 | i | 2, 2,32472 |||
+ 2 | | | 0.52476 | 0.00000 | i | 2, 3,32472 |||
+ 3 | | | 0.26983 | 0.00000 | i | 2, 4,32472 |||
+ 4 | | | 0.51419 | 0.00000 | i | 2, 5,32472 |||
+ 5 | | | 0.52476 | 0.00000 | i | 2, 6,32472 |||
+ 6 | | | 0.26983 | 0.00000 | i | 2, 7,32472 |||
+ 7 | | | 0.51419 | 0.00000 | i | 2, 8,32472 |||
+ 8 | | | 0.52476 | 0.00000 | i | 2, 9,32472 |||
+ 9 | | | 0.26983 | 0.00000 | i | 2,10,32472 |||
+ 10 | | | 0.00000 | 0.00000 | i | 2,11,32472 |||
+ 11 | | | 0.00000 | 0.00000 | i | 2,12,32472 |||
+ 12 | | | 0.00000 | 0.00000 | i | 2,13,32472 |||
+ 13 | | | 0.41555 | -3.22619 | h | 5, 2,32472 |||
+ 14 | | | 0.41555 | -3.22619 | h | 5, 3,32472 |||
+ 15 | | | 0.41555 | -3.22619 | h | 5, 4,32472 |||
+ 16 | | | 0.41555 | -3.22619 | h | 5, 5,32472 |||
+ 17 | | | 0.41555 | -3.22619 | h | 5, 6,32472 |||
+ 18 | | | 0.41555 | -3.22619 | h | 5, 7,32472 |||
+ 19 | | | 0.41555 | -3.22619 | h | 5, 8,32472 |||
+ 20 | | | 0.41555 | -3.22619 | h | 5, 9,32472 |||
+ 21 | | | 0.00000 | 6.85647 | o | 8, 2,32472 |||
+ 22 | | | 1.00000 | -22.88282 | o | 8, 3,32472 |||
+ 23 | | | 0.00000 | -0.42990 | o | 8, 4,32472 |||
+ 24 | | | 0.00000 | -2.81995 | o | 8, 5,32472 |||
+ 25 | | | 0.00000 | -0.75122 | o | 8, 6,32472 |||
+----|----------|----------|----------|----------|----|----------|----------|----------|-------
+
+
+connection definition section :
+
+target | site | source:weight
+-------|------|---------------------------------------------------------------------------------------------------------------------
+ 13 | | 1: 1.97618, 2: 4.98146, 3: 4.67440, 4:-0.90271, 5: 0.32808, 6:-1.09973, 7: 2.58867, 8:-0.12620, 9: 0.71982,
+ 10: 0.05168, 11:-0.14918, 12:-0.18504
+ 14 | | 1: 1.97618, 2: 4.98146, 3: 4.67440, 4:-0.90271, 5: 0.32808, 6:-1.09973, 7: 2.58867, 8:-0.12620, 9: 0.71982,
+ 10: 0.05168, 11:-0.14918, 12:-0.18504
+ 15 | | 1: 1.97618, 2: 4.98146, 3: 4.67440, 4:-0.90271, 5: 0.32808, 6:-1.09973, 7: 2.58867, 8:-0.12620, 9: 0.71982,
+ 10: 0.05168, 11:-0.14918, 12:-0.18504
+ 16 | | 1: 1.97618, 2: 4.98146, 3: 4.67440, 4:-0.90271, 5: 0.32808, 6:-1.09973, 7: 2.58867, 8:-0.12620, 9: 0.71982,
+ 10: 0.05168, 11:-0.14918, 12:-0.18504
+ 17 | | 1: 1.97618, 2: 4.98146, 3: 4.67440, 4:-0.90271, 5: 0.32808, 6:-1.09973, 7: 2.58867, 8:-0.12620, 9: 0.71982,
+ 10: 0.05168, 11:-0.14918, 12:-0.18504
+ 18 | | 1: 1.97618, 2: 4.98146, 3: 4.67440, 4:-0.90271, 5: 0.32808, 6:-1.09973, 7: 2.58867, 8:-0.12620, 9: 0.71982,
+ 10: 0.05168, 11:-0.14918, 12:-0.18504
+ 19 | | 1: 1.97618, 2: 4.98146, 3: 4.67440, 4:-0.90271, 5: 0.32808, 6:-1.09973, 7: 2.58867, 8:-0.12620, 9: 0.71982,
+ 10: 0.05168, 11:-0.14918, 12:-0.18504
+ 20 | | 1: 1.97618, 2: 4.98146, 3: 4.67440, 4:-0.90271, 5: 0.32808, 6:-1.09973, 7: 2.58867, 8:-0.12620, 9: 0.71982,
+ 10: 0.05168, 11:-0.14918, 12:-0.18504
+ 21 | | 13:-11.02753, 14:-11.02753, 15:-11.02753, 16:-11.02753, 17:-11.02753, 18:-11.02753, 19:-11.02753, 20:-11.02753
+ 22 | | 13: 3.09215, 14: 3.09215, 15: 3.09215, 16: 3.09215, 17: 3.09215, 18: 3.09215, 19: 3.09215, 20: 3.09215
+ 23 | | 13:-0.29760, 14:-0.29760, 15:-0.29760, 16:-0.29760, 17:-0.29760, 18:-0.29760, 19:-0.29760, 20:-0.29760
+ 24 | | 13: 0.43971, 14: 0.43971, 15: 0.43971, 16: 0.43971, 17: 0.43971, 18: 0.43971, 19: 0.43971, 20: 0.43971
+ 25 | | 13:-0.11235, 14:-0.11235, 15:-0.11235, 16:-0.11235, 17:-0.11235, 18:-0.11235, 19:-0.11235, 20:-0.11235
+-------|------|---------------------------------------------------------------------------------------------------------------------
Added: branches/tmp/tgoettlicher/usersaver/net/hectic
URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/tgoettlicher/usersaver/ne…
==============================================================================
--- branches/tmp/tgoettlicher/usersaver/net/hectic (added)
+++ branches/tmp/tgoettlicher/usersaver/net/hectic Wed Jun 27 16:13:21 2007
@@ -0,0 +1,24 @@
+#input pattern hectic1
+0.514189 0.524762 0.269827 0.514189 0.524762 0.269827 0.514189 0.524762 0.269827 0.000000 0.000000 0.000000
+#output pattern hectic1
+0 1 0 0 0
+#input pattern hectic2
+0.592568 0.804762 0.476876 0.592568 0.804762 0.476876 0.592568 0.804762 0.476876 0.000000 0.000000 0.000000
+#output pattern hectic2
+0 1 0 0 0
+#input pattern hectic3
+0.657770 0.505714 0.332644 0.657770 0.804762 0.529348 0.657770 0.804762 0.529348 0.000000 0.000000 0.000000
+#output pattern hectic3
+0 1 0 0 0
+#input pattern hectic4
+0.328716 0.658095 0.216327 0.851351 0.806667 0.686757 0.851351 0.806667 0.686757 0.000000 0.000000 0.000000
+#output pattern hectic4
+0 1 0 0 0
+#input pattern hectic5
+0.462162 0.957143 0.442355 0.851351 0.957143 0.814865 0.851351 0.957143 0.814865 0.000000 0.000000 0.000000
+#output pattern hectic5
+0 1 0 0 0
+#input pattern hectic6
+0.753716 0.822857 0.620201 0.797297 0.957143 0.763127 0.851351 0.957143 0.814865 0.000000 0.000000 0.000000
+#output pattern hectic6
+0 1 0 0 0
Added: branches/tmp/tgoettlicher/usersaver/net/idle
URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/tgoettlicher/usersaver/ne…
==============================================================================
--- branches/tmp/tgoettlicher/usersaver/net/idle (added)
+++ branches/tmp/tgoettlicher/usersaver/net/idle Wed Jun 27 16:13:21 2007
@@ -0,0 +1,28 @@
+#input pattern idle1
+0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
+#output pattern idle1
+1 0 0 0 0
+#input pattern idle2
+0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
+#output pattern idle2
+1 0 0 0 0
+#input pattern idle3
+0.035135 0.072381 0.002543 0.035135 0.072381 0.002543 0.035135 0.072381 0.002543 0.000000 0.000000 0.000000
+#output pattern idle3
+1 0 0 0 0
+#input pattern idle4
+0.035135 0.072381 0.002543 0.035135 0.072381 0.002543 0.035135 0.072381 0.002543 0.000000 0.000000 0.000000
+#output pattern idle4
+1 0 0 0 0
+#input pattern idle5
+0.005068 0.026667 0.000135 0.035135 0.072381 0.002543 0.035135 0.072381 0.002543 0.000000 0.000000 0.000000
+#output pattern idle5
+1 0 0 0 0
+#input pattern idle6
+0.075338 0.011429 0.000861 0.075676 0.038095 0.002883 0.105743 0.072381 0.007654 0.000000 0.000000 0.000000
+#output pattern idle6
+1 0 0 0 0
+#input pattern idle7
+0.075338 0.011429 0.000861 0.075676 0.038095 0.002883 0.105743 0.072381 0.007654 0.000000 0.000000 0.000000
+#output pattern idle7
+1 0 0 0 0
Added: branches/tmp/tgoettlicher/usersaver/net/noclue
URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/tgoettlicher/usersaver/ne…
==============================================================================
--- branches/tmp/tgoettlicher/usersaver/net/noclue (added)
+++ branches/tmp/tgoettlicher/usersaver/net/noclue Wed Jun 27 16:13:21 2007
@@ -0,0 +1,36 @@
+#input pattern noclue1
+0.054054 0.121905 0.006589 0.054054 0.121905 0.006589 0.054054 0.121905 0.006589 0.000000 0.000000 0.000000
+#output pattern noclue1
+0 0 0 1 0
+#input pattern noclue2
+0.645270 0.142857 0.092181 0.645270 0.142857 0.092181 0.645270 0.142857 0.092181 0.000000 0.000000 0.000000
+#output pattern noclue2
+0 0 0 1 0
+#input pattern noclue3
+0.025338 0.741905 0.018798 0.670608 0.768571 0.515410 0.670608 0.768571 0.515410 0.000000 0.000000 0.000000
+#output pattern noclue3
+0 0 0 1 0
+#input pattern noclue4
+0.026014 0.741905 0.019300 0.616216 0.752381 0.463629 0.671284 0.768571 0.515930 0.000000 0.000000 0.000000
+#output pattern noclue4
+0 0 0 1 0
+#input pattern noclue5
+0.259459 0.386667 0.100324 0.259459 0.741905 0.192494 0.671284 0.768571 0.515930 0.000000 0.000000 0.000000
+#output pattern noclue5
+0 0 0 1 0
+#input pattern noclue6
+0.685811 0.330476 0.226644 0.706757 0.741905 0.524346 0.706757 0.768571 0.543193 0.000000 0.000000 0.000000
+#output pattern noclue6
+0 0 0 1 0
+#input pattern noclue7
+0.018919 0.685714 0.012973 0.685811 0.726667 0.498356 0.706757 0.782857 0.553290 0.000000 0.000000 0.000000
+#output pattern noclue7
+0 0 0 1 0
+#input pattern noclue8
+0.531081 0.685714 0.364170 0.531081 0.686667 0.364676 0.706757 0.782857 0.553290 0.000000 0.000000 0.000000
+#output pattern noclue8
+0 0 0 1 0
+#input pattern noclue9
+0.526014 0.281905 0.148286 0.531081 0.685714 0.364170 0.706757 0.782857 0.553290 0.000000 0.000000 0.000000
+#output pattern noclue9
+0 0 0 1 0
Added: branches/tmp/tgoettlicher/usersaver/net/patterns.pat
URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/tgoettlicher/usersaver/ne…
==============================================================================
--- branches/tmp/tgoettlicher/usersaver/net/patterns.pat (added)
+++ branches/tmp/tgoettlicher/usersaver/net/patterns.pat Wed Jun 27 16:13:21 2007
@@ -0,0 +1,160 @@
+SNNS pattern definition file V3.2
+generated at Mon Jun 27 13:11:53 CDT 2007
+
+
+No. of patterns : 38
+No. of input units : 12
+No. of output units : 5
+
+#input pattern hectic1
+0.514189 0.524762 0.269827 0.514189 0.524762 0.269827 0.514189 0.524762 0.269827 0.000000 0.000000 0.000000
+#output pattern hectic1
+0 1 0 0 0
+#input pattern hectic2
+0.592568 0.804762 0.476876 0.592568 0.804762 0.476876 0.592568 0.804762 0.476876 0.000000 0.000000 0.000000
+#output pattern hectic2
+0 1 0 0 0
+#input pattern hectic3
+0.657770 0.505714 0.332644 0.657770 0.804762 0.529348 0.657770 0.804762 0.529348 0.000000 0.000000 0.000000
+#output pattern hectic3
+0 1 0 0 0
+#input pattern hectic4
+0.328716 0.658095 0.216327 0.851351 0.806667 0.686757 0.851351 0.806667 0.686757 0.000000 0.000000 0.000000
+#output pattern hectic4
+0 1 0 0 0
+#input pattern hectic5
+0.462162 0.957143 0.442355 0.851351 0.957143 0.814865 0.851351 0.957143 0.814865 0.000000 0.000000 0.000000
+#output pattern hectic5
+0 1 0 0 0
+#input pattern hectic6
+0.753716 0.822857 0.620201 0.797297 0.957143 0.763127 0.851351 0.957143 0.814865 0.000000 0.000000 0.000000
+#output pattern hectic6
+0 1 0 0 0
+#input pattern idle1
+0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
+#output pattern idle1
+1 0 0 0 0
+#input pattern idle2
+0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
+#output pattern idle2
+1 0 0 0 0
+#input pattern idle3
+0.035135 0.072381 0.002543 0.035135 0.072381 0.002543 0.035135 0.072381 0.002543 0.000000 0.000000 0.000000
+#output pattern idle3
+1 0 0 0 0
+#input pattern idle4
+0.035135 0.072381 0.002543 0.035135 0.072381 0.002543 0.035135 0.072381 0.002543 0.000000 0.000000 0.000000
+#output pattern idle4
+1 0 0 0 0
+#input pattern idle5
+0.005068 0.026667 0.000135 0.035135 0.072381 0.002543 0.035135 0.072381 0.002543 0.000000 0.000000 0.000000
+#output pattern idle5
+1 0 0 0 0
+#input pattern idle6
+0.075338 0.011429 0.000861 0.075676 0.038095 0.002883 0.105743 0.072381 0.007654 0.000000 0.000000 0.000000
+#output pattern idle6
+1 0 0 0 0
+#input pattern idle7
+0.075338 0.011429 0.000861 0.075676 0.038095 0.002883 0.105743 0.072381 0.007654 0.000000 0.000000 0.000000
+#output pattern idle7
+1 0 0 0 0
+#input pattern noclue1
+0.054054 0.121905 0.006589 0.054054 0.121905 0.006589 0.054054 0.121905 0.006589 0.000000 0.000000 0.000000
+#output pattern noclue1
+0 0 0 1 0
+#input pattern noclue2
+0.645270 0.142857 0.092181 0.645270 0.142857 0.092181 0.645270 0.142857 0.092181 0.000000 0.000000 0.000000
+#output pattern noclue2
+0 0 0 1 0
+#input pattern noclue3
+0.025338 0.741905 0.018798 0.670608 0.768571 0.515410 0.670608 0.768571 0.515410 0.000000 0.000000 0.000000
+#output pattern noclue3
+0 0 0 1 0
+#input pattern noclue4
+0.026014 0.741905 0.019300 0.616216 0.752381 0.463629 0.671284 0.768571 0.515930 0.000000 0.000000 0.000000
+#output pattern noclue4
+0 0 0 1 0
+#input pattern noclue5
+0.259459 0.386667 0.100324 0.259459 0.741905 0.192494 0.671284 0.768571 0.515930 0.000000 0.000000 0.000000
+#output pattern noclue5
+0 0 0 1 0
+#input pattern noclue6
+0.685811 0.330476 0.226644 0.706757 0.741905 0.524346 0.706757 0.768571 0.543193 0.000000 0.000000 0.000000
+#output pattern noclue6
+0 0 0 1 0
+#input pattern noclue7
+0.018919 0.685714 0.012973 0.685811 0.726667 0.498356 0.706757 0.782857 0.553290 0.000000 0.000000 0.000000
+#output pattern noclue7
+0 0 0 1 0
+#input pattern noclue8
+0.531081 0.685714 0.364170 0.531081 0.686667 0.364676 0.706757 0.782857 0.553290 0.000000 0.000000 0.000000
+#output pattern noclue8
+0 0 0 1 0
+#input pattern noclue9
+0.526014 0.281905 0.148286 0.531081 0.685714 0.364170 0.706757 0.782857 0.553290 0.000000 0.000000 0.000000
+#output pattern noclue9
+0 0 0 1 0
+#input pattern reading1
+0.244257 0.418095 0.102123 0.245608 0.418095 0.102688 0.245608 0.418095 0.102688 0.000000 0.000000 0.000000
+#output pattern reading1
+0 0 1 0 0
+#input pattern reading2
+0.202703 0.107619 0.021815 0.244257 0.420952 0.102820 0.245608 0.420952 0.103389 0.000000 0.000000 0.000000
+#output pattern reading2
+0 0 1 0 0
+#input pattern reading3
+0.222297 0.045714 0.010162 0.263851 0.456190 0.120366 0.265203 0.456190 0.120983 0.000000 0.000000 0.000000
+#output pattern reading3
+0 0 1 0 0
+#input pattern reading4
+0.221959 0.060952 0.013529 0.222297 0.168571 0.037473 0.265203 0.481905 0.127802 0.000000 0.000000 0.000000
+#output pattern reading4
+0 0 1 0 0
+#input pattern reading5
+0.207432 0.043810 0.009088 0.221959 0.104762 0.023253 0.265203 0.525714 0.139421 0.000000 0.000000 0.000000
+#output pattern reading5
+0 0 1 0 0
+#input pattern reading6
+0.212838 0.043810 0.009324 0.218243 0.069524 0.015173 0.265203 0.525714 0.139421 0.000000 0.000000 0.000000
+#output pattern reading6
+0 0 1 0 0
+#input pattern reading7
+0.220946 0.013333 0.002946 0.220946 0.046667 0.010311 0.265203 0.528571 0.140179 0.000000 0.000000 0.000000
+#output pattern reading7
+0 0 1 0 0
+#input pattern reading8
+0.211824 0.025714 0.005447 0.220946 0.059048 0.013046 0.263851 0.540952 0.142731 0.000000 0.000000 0.000000
+#output pattern reading8
+0 0 1 0 0
+#input pattern typing1
+0.193243 0.114286 0.022085 0.193243 0.114286 0.022085 0.193243 0.114286 0.022085 0.003000 0.003000 0.003000
+#output pattern typing1
+0 0 0 0 1
+#input pattern typing2
+0.209459 0.114286 0.023938 0.209459 0.114286 0.023938 0.209459 0.114286 0.023938 0.009000 0.009000 0.009000
+#output pattern typing2
+0 0 0 0 1
+#input pattern typing3
+0.412500 0.093333 0.038500 0.535473 0.166667 0.089245 0.535473 0.166667 0.089245 0.014000 0.017000 0.017000
+#output pattern typing3
+0 0 0 0 1
+#input pattern typing4
+0.397635 0.220952 0.087858 0.507095 0.220952 0.112044 0.535473 0.220952 0.118314 0.003000 0.017000 0.020000
+#output pattern typing4
+0 0 0 0 1
+#input pattern typing5
+0.397635 0.220952 0.087858 0.507095 0.220952 0.112044 0.535473 0.220952 0.118314 0.013000 0.021000 0.030000
+#output pattern typing5
+0 0 0 0 1
+#input pattern typing6
+0.000000 0.000000 0.000000 0.397635 0.220952 0.087858 0.535473 0.220952 0.118314 0.030000 0.033000 0.050000
+#output pattern typing6
+0 0 0 0 1
+#input pattern typing7
+0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.535473 0.220952 0.118314 0.004000 0.034000 0.054000
+#output pattern typing7
+0 0 0 0 1
+#input pattern typing8
+0.169595 0.215238 0.036503 0.169595 0.215238 0.036503 0.535473 0.220952 0.118314 0.011000 0.031000 0.061000
+#output pattern typing8
+0 0 0 0 1
Added: branches/tmp/tgoettlicher/usersaver/net/reading
URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/tgoettlicher/usersaver/ne…
==============================================================================
--- branches/tmp/tgoettlicher/usersaver/net/reading (added)
+++ branches/tmp/tgoettlicher/usersaver/net/reading Wed Jun 27 16:13:21 2007
@@ -0,0 +1,32 @@
+#input pattern reading1
+0.244257 0.418095 0.102123 0.245608 0.418095 0.102688 0.245608 0.418095 0.102688 0.000000 0.000000 0.000000
+#output pattern reading1
+0 0 1 0 0
+#input pattern reading2
+0.202703 0.107619 0.021815 0.244257 0.420952 0.102820 0.245608 0.420952 0.103389 0.000000 0.000000 0.000000
+#output pattern reading2
+0 0 1 0 0
+#input pattern reading3
+0.222297 0.045714 0.010162 0.263851 0.456190 0.120366 0.265203 0.456190 0.120983 0.000000 0.000000 0.000000
+#output pattern reading3
+0 0 1 0 0
+#input pattern reading4
+0.221959 0.060952 0.013529 0.222297 0.168571 0.037473 0.265203 0.481905 0.127802 0.000000 0.000000 0.000000
+#output pattern reading4
+0 0 1 0 0
+#input pattern reading5
+0.207432 0.043810 0.009088 0.221959 0.104762 0.023253 0.265203 0.525714 0.139421 0.000000 0.000000 0.000000
+#output pattern reading5
+0 0 1 0 0
+#input pattern reading6
+0.212838 0.043810 0.009324 0.218243 0.069524 0.015173 0.265203 0.525714 0.139421 0.000000 0.000000 0.000000
+#output pattern reading6
+0 0 1 0 0
+#input pattern reading7
+0.220946 0.013333 0.002946 0.220946 0.046667 0.010311 0.265203 0.528571 0.140179 0.000000 0.000000 0.000000
+#output pattern reading7
+0 0 1 0 0
+#input pattern reading8
+0.211824 0.025714 0.005447 0.220946 0.059048 0.013046 0.263851 0.540952 0.142731 0.000000 0.000000 0.000000
+#output pattern reading8
+0 0 1 0 0
Added: branches/tmp/tgoettlicher/usersaver/net/type
URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/tgoettlicher/usersaver/ne…
==============================================================================
--- branches/tmp/tgoettlicher/usersaver/net/type (added)
+++ branches/tmp/tgoettlicher/usersaver/net/type Wed Jun 27 16:13:21 2007
@@ -0,0 +1,32 @@
+#input pattern typing1
+0.193243 0.114286 0.022085 0.193243 0.114286 0.022085 0.193243 0.114286 0.022085 0.003000 0.003000 0.003000
+#output pattern typing1
+0 0 0 0 1
+#input pattern typing2
+0.209459 0.114286 0.023938 0.209459 0.114286 0.023938 0.209459 0.114286 0.023938 0.009000 0.009000 0.009000
+#output pattern typing2
+0 0 0 0 1
+#input pattern typing3
+0.412500 0.093333 0.038500 0.535473 0.166667 0.089245 0.535473 0.166667 0.089245 0.014000 0.017000 0.017000
+#output pattern typing3
+0 0 0 0 1
+#input pattern typing4
+0.397635 0.220952 0.087858 0.507095 0.220952 0.112044 0.535473 0.220952 0.118314 0.003000 0.017000 0.020000
+#output pattern typing4
+0 0 0 0 1
+#input pattern typing5
+0.397635 0.220952 0.087858 0.507095 0.220952 0.112044 0.535473 0.220952 0.118314 0.013000 0.021000 0.030000
+#output pattern typing5
+0 0 0 0 1
+#input pattern typing6
+0.000000 0.000000 0.000000 0.397635 0.220952 0.087858 0.535473 0.220952 0.118314 0.030000 0.033000 0.050000
+#output pattern typing6
+0 0 0 0 1
+#input pattern typing7
+0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.535473 0.220952 0.118314 0.004000 0.034000 0.054000
+#output pattern typing7
+0 0 0 0 1
+#input pattern typing8
+0.169595 0.215238 0.036503 0.169595 0.215238 0.036503 0.535473 0.220952 0.118314 0.011000 0.031000 0.061000
+#output pattern typing8
+0 0 0 0 1
Added: branches/tmp/tgoettlicher/usersaver/usersaver.c
URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/tgoettlicher/usersaver/us…
==============================================================================
--- branches/tmp/tgoettlicher/usersaver/usersaver.c (added)
+++ branches/tmp/tgoettlicher/usersaver/usersaver.c Wed Jun 27 16:13:21 2007
@@ -0,0 +1,266 @@
+/*
+ * Compile: gcc -o usersaver usersaver.c -lX11 -lm
+ *
+ * Run: usersaver displayname:0
+ *
+ * Code borrowed from xkey.c
+ *
+ */
+#include <time.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <X11/X.h>
+#include <X11/Xlib.h>
+#include <X11/Intrinsic.h>
+#include <X11/StringDefs.h>
+#include <X11/Xutil.h>
+#include <X11/Shell.h>
+#include "net/SNNS_NET.h"
+
+
+typedef struct {
+ int x;
+ int y;
+ int time;
+} MousePosition;
+
+typedef struct {
+ int keycode;
+ int time;
+} KeyStroke;
+
+
+
+
+void analyze();
+int analyzeKeyStrokes(int interval);
+void analyzeMouseMoves(int interval, int *x, int *y, int *a);
+void handleEvent(XEvent xev);
+Display *d;
+
+MousePosition mouseHistory[1000];
+int mouseHistoryMarker = 0;
+
+KeyStroke keyHistory[1000];
+int keyHistoryMarker = 0;
+
+
+
+static int ErrorHandler(Display *d, XErrorEvent *e)
+{
+ // do nothing;
+}
+
+
+
+void snoop_all_windows(Window root, unsigned long type)
+{
+ static int level = 0;
+ Window parent, *children, *child2;
+ unsigned int nchildren;
+ int stat, i,j,k;
+
+ level++;
+
+ stat = XQueryTree(d, root, &root, &parent, &children, &nchildren);
+ if (stat == FALSE)
+ return;
+
+ if (nchildren == 0)
+ return;
+
+ XSelectInput(d, root, type);
+
+ for(i=0; i < nchildren; i++)
+ {
+ XSelectInput(d, children[i], type);
+ snoop_all_windows(children[i], type);
+ }
+
+ XFree((char *)children);
+}
+
+
+int main(int argc, char **argv)
+{
+ char *hostname;
+ char *string;
+ XEvent xev;
+
+ if (argv[1] == NULL)
+ hostname = ":0";
+ else
+ hostname = argv[1];
+
+ d = XOpenDisplay(hostname);
+ if (d == NULL)
+ {
+ fprintf(stderr, "Can't open display: %s\n", hostname);
+ exit(10);
+ }
+
+
+ printf("Usersaver\n");
+
+ XSetErrorHandler(ErrorHandler);
+
+ while(1)
+ {
+ snoop_all_windows(DefaultRootWindow(d), KeyPressMask | PointerMotionMask );
+
+ while ( XCheckMaskEvent(d, KeyPressMask | PointerMotionMask, &xev) )
+ handleEvent(xev);
+
+ analyze();
+
+ }
+}
+
+void analyze()
+{
+ int x1, y1, x3, y3, x10, y10, a1, a3, a10;
+ int k1, k3, k10;
+ int i;
+ float max_emo=0;
+ int emo=0;
+ char *emos[]={ "idle","hectic","reading","no clue", "typing" };
+
+
+ float input[12];
+ float output[5];
+
+ float width=2960.0, height=1050.0;
+
+ analyzeMouseMoves(1, &x1, &y1, &a1);
+ analyzeMouseMoves(3, &x3, &y3, &a3);
+ analyzeMouseMoves(10, &x10, &y10, &a10);
+
+ k1 = analyzeKeyStrokes(1);
+ k3 = analyzeKeyStrokes(3);
+ k10 = analyzeKeyStrokes(10);
+
+/*
+ printf("%f %f %f ", x1 / width , y1 / height , a1 / width / height);
+ printf("%f %f %f ", x3 / width , y3 / height , a3 / width / height);
+ printf("%f %f %f ", x10 / width , y10 / height , a10 / width / height);
+ printf("%f %f %f\n", k1/1000.0, k3/1000.0, k10/1000.0);
+*/
+
+ input[ 0]=x1/width;
+ input[ 1]=y1/height;
+ input[ 2]=a1/height/width;
+ input[ 3]=x3/width;
+ input[ 4]=y3/height;
+ input[ 5]=a3/height/width;
+ input[ 6]=x10/width;
+ input[ 7]=y10/height;
+ input[ 8]=a10/height/width;
+ input[ 9]=k1/1000.0;
+ input[10]=k3/1000.0;
+ input[11]=k10/1000.0;
+
+ SNNS_NET ( input, output , 0);
+
+
+
+
+ for (i=0; i <5 ; ++i)
+ {
+ if (output[i] > max_emo)
+ {
+ max_emo=output[i];
+ emo=i;
+ }
+ }
+
+ printf ("%f\t%f\t%f\t%f\t%f\t[%s] \r", output[0], output[1], output[2], output[3], output[4], emos[emo]);
+
+ fflush(stdout);
+
+}
+
+
+int analyzeKeyStrokes(int interval)
+{
+ int k=0;
+ int now=time(0);
+ int i=0;
+
+ for (i=0; i<1000; ++i)
+ {
+ if (keyHistory[i].time >= now - interval)
+ k++;
+ }
+ return k;
+}
+
+
+
+void analyzeMouseMoves(int interval, int *x, int *y, int *a)
+{
+
+ int max_x=0, max_y=0;
+ int min_x=99999999, min_y=9999999; // why does MAX_INT not work
+ int i=0;
+ int now=time(0);
+
+ int delta_x = 0;
+ int delta_y = 0;
+ int delta_a = 0;
+
+ for (i=0; i<1000; ++i)
+ {
+ if (mouseHistory[i].time >= now - interval)
+ {
+ if (mouseHistory[i].x > max_x)
+ max_x = mouseHistory[i].x;
+ if (mouseHistory[i].y > max_y)
+ max_y = mouseHistory[i].y;
+ if (mouseHistory[i].x < min_x)
+ min_x = mouseHistory[i].x;
+ if (mouseHistory[i].y < min_y)
+ min_y = mouseHistory[i].y;
+ }
+ }
+
+ delta_x = max_x - min_x;
+ delta_y = max_y - min_y;
+
+ if (delta_x < 0) delta_x = 0;
+ if (delta_y < 0) delta_y = 0;
+
+
+ *x = delta_x;
+ *y = delta_y;
+ *a = delta_x* delta_y;
+
+
+
+}
+
+
+
+void handleEvent(XEvent xev)
+{
+ switch (xev.type)
+ {
+ case KeyPress:
+ keyHistory[keyHistoryMarker].keycode = xev.xkey.keycode;
+ keyHistory[keyHistoryMarker].time = time(0);
+
+ keyHistoryMarker++;
+ keyHistoryMarker%=1000;
+
+ break;
+
+ case MotionNotify:
+ mouseHistory[mouseHistoryMarker].x = xev.xkey.x_root;
+ mouseHistory[mouseHistoryMarker].y = xev.xkey.y_root;
+ mouseHistory[mouseHistoryMarker].time = time(0);
+
+ mouseHistoryMarker++;
+ mouseHistoryMarker%=1000;
+
+ break;
+ }
+}
--
To unsubscribe, e-mail: zypp-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: zypp-commit+help(a)opensuse.org
1
0
[zypp-commit] r5848 - /branches/tmp/tgoettlicher/usersaver/
by tgoettlicher@svn.opensuse.org 27 Jun '07
by tgoettlicher@svn.opensuse.org 27 Jun '07
27 Jun '07
Author: tgoettlicher
Date: Wed Jun 27 16:11:24 2007
New Revision: 5848
URL: http://svn.opensuse.org/viewcvs/zypp?rev=5848&view=rev
Log:
Hackweek project
Added:
branches/tmp/tgoettlicher/usersaver/
--
To unsubscribe, e-mail: zypp-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: zypp-commit+help(a)opensuse.org
1
0
[zypp-commit] r5847 - in /branches/REFACTORING-10_3/libzypp/zypp/solver/detail: InstallOrder.cc InstallOrder.h
by mlandres@svn.opensuse.org 27 Jun '07
by mlandres@svn.opensuse.org 27 Jun '07
27 Jun '07
Author: mlandres
Date: Wed Jun 27 13:57:22 2007
New Revision: 5847
URL: http://svn.opensuse.org/viewcvs/zypp?rev=5847&view=rev
Log:
InstallOrder: log only 1st occurrence of a dependency loop
Modified:
branches/REFACTORING-10_3/libzypp/zypp/solver/detail/InstallOrder.cc
branches/REFACTORING-10_3/libzypp/zypp/solver/detail/InstallOrder.h
Modified: branches/REFACTORING-10_3/libzypp/zypp/solver/detail/InstallOrder.cc
URL: http://svn.opensuse.org/viewcvs/zypp/branches/REFACTORING-10_3/libzypp/zypp…
==============================================================================
--- branches/REFACTORING-10_3/libzypp/zypp/solver/detail/InstallOrder.cc (original)
+++ branches/REFACTORING-10_3/libzypp/zypp/solver/detail/InstallOrder.cc Wed Jun 27 13:57:22 2007
@@ -296,7 +296,14 @@
{
if (must_visit != item)
{
- WAR << "** dependency loop: " << ITEMNAME(item) << " -> " << ITEMNAME(must_visit) << endl;
+ // log only the 1st occurrence.
+ std::string lstr( ITEMNAME(item) );
+ lstr += " -> ";
+ lstr += ITEMNAME(must_visit);
+ if ( _logset.insert( lstr ).second )
+ {
+ WAR << "** dependency loop: " << lstr << endl;
+ }
}
}
else
Modified: branches/REFACTORING-10_3/libzypp/zypp/solver/detail/InstallOrder.h
URL: http://svn.opensuse.org/viewcvs/zypp/branches/REFACTORING-10_3/libzypp/zypp…
==============================================================================
--- branches/REFACTORING-10_3/libzypp/zypp/solver/detail/InstallOrder.h (original)
+++ branches/REFACTORING-10_3/libzypp/zypp/solver/detail/InstallOrder.h Wed Jun 27 13:57:22 2007
@@ -30,8 +30,10 @@
#ifndef ZYPP_SOLVER_DETAIL_INSTALLORDER_H
#define ZYPP_SOLVER_DETAIL_INSTALLORDER_H
+#include <string>
#include <list>
#include <map>
+#include <set>
#include "zypp/PoolItem.h"
#include "zypp/ResPool.h"
@@ -98,6 +100,8 @@
unsigned _numrun;
+ std::set<std::string> _logset;
+
private:
void rdfsvisit (PoolItem_Ref item);
--
To unsubscribe, e-mail: zypp-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: zypp-commit+help(a)opensuse.org
1
0
[zypp-commit] r5846 - in /branches/REFACTORING-10_3/libzypp/devel/devel.ma: Parse.cc Tools.h
by mlandres@svn.opensuse.org 26 Jun '07
by mlandres@svn.opensuse.org 26 Jun '07
26 Jun '07
Author: mlandres
Date: Tue Jun 26 14:29:19 2007
New Revision: 5846
URL: http://svn.opensuse.org/viewcvs/zypp?rev=5846&view=rev
Log:
backup
Modified:
branches/REFACTORING-10_3/libzypp/devel/devel.ma/Parse.cc
branches/REFACTORING-10_3/libzypp/devel/devel.ma/Tools.h
Modified: branches/REFACTORING-10_3/libzypp/devel/devel.ma/Parse.cc
URL: http://svn.opensuse.org/viewcvs/zypp/branches/REFACTORING-10_3/libzypp/deve…
==============================================================================
--- branches/REFACTORING-10_3/libzypp/devel/devel.ma/Parse.cc (original)
+++ branches/REFACTORING-10_3/libzypp/devel/devel.ma/Parse.cc Tue Jun 26 14:29:19 2007
@@ -6,8 +6,8 @@
#include "zypp/ZYppFactory.h"
#include "zypp/ResPoolProxy.h"
-#include <zypp/SourceManager.h>
-#include <zypp/SourceFactory.h>
+//#include <zypp/SourceManager.h>
+//#include <zypp/SourceFactory.h>
#include "zypp/ZYppCallbacks.h"
#include "zypp/NVRAD.h"
@@ -21,7 +21,6 @@
#include "zypp/NameKindProxy.h"
#include "zypp/pool/GetResolvablesToInsDel.h"
-#include "zypp/parser/tagfile/TagFileParser.h"
#include "zypp/parser/TagParser.h"
#include "zypp/parser/susetags/PackagesFileReader.h"
#include "zypp/parser/susetags/PackagesLangFileReader.h"
@@ -31,12 +30,13 @@
#include "zypp/parser/susetags/RepoParser.h"
#include "zypp/cache/CacheStore.h"
+#include "zypp/RepoManager.h"
+#include "zypp/RepoInfo.h"
using namespace std;
using namespace zypp;
using namespace zypp::functor;
-using zypp::parser::tagfile::TagFileParser;
using zypp::parser::TagParser;
///////////////////////////////////////////////////////////////////
@@ -45,6 +45,96 @@
///////////////////////////////////////////////////////////////////
+struct SetTransactValue
+{
+ SetTransactValue( ResStatus::TransactValue newVal_r, ResStatus::TransactByValue causer_r )
+ : _newVal( newVal_r )
+ , _causer( causer_r )
+ {}
+
+ ResStatus::TransactValue _newVal;
+ ResStatus::TransactByValue _causer;
+
+ bool operator()( const PoolItem & pi ) const
+ {
+ bool ret = pi.status().setTransactValue( _newVal, _causer );
+ if ( ! ret )
+ ERR << _newVal << _causer << " " << pi << endl;
+ return ret;
+ }
+};
+
+struct StatusReset : public SetTransactValue
+{
+ StatusReset()
+ : SetTransactValue( ResStatus::KEEP_STATE, ResStatus::USER )
+ {}
+};
+
+struct StatusInstall : public SetTransactValue
+{
+ StatusInstall()
+ : SetTransactValue( ResStatus::TRANSACT, ResStatus::USER )
+ {}
+};
+
+inline bool selectForTransact( const NameKindProxy & nkp, Arch arch = Arch() )
+{
+ if ( nkp.availableEmpty() )
+ {
+ ERR << "No Item to select: " << nkp << endl;
+ return false;
+ ZYPP_THROW( Exception("No Item to select") );
+ }
+
+ if ( arch != Arch() )
+ {
+ typeof( nkp.availableBegin() ) it = nkp.availableBegin();
+ for ( ; it != nkp.availableEnd(); ++it )
+ {
+ if ( (*it)->arch() == arch )
+ return (*it).status().setTransact( true, ResStatus::USER );
+ }
+ }
+
+ return nkp.availableBegin()->status().setTransact( true, ResStatus::USER );
+}
+
+///////////////////////////////////////////////////////////////////
+
+bool solve( bool establish = false )
+{
+ if ( establish )
+ {
+ bool eres = false;
+ {
+ zypp::base::LogControl::TmpLineWriter shutUp;
+ eres = getZYpp()->resolver()->establishPool();
+ }
+ if ( ! eres )
+ {
+ ERR << "establish " << eres << endl;
+ return false;
+ }
+ MIL << "establish " << eres << endl;
+ }
+
+ bool rres = false;
+ {
+ zypp::base::LogControl::TmpLineWriter shutUp;
+ rres = getZYpp()->resolver()->resolvePool();
+ }
+ if ( ! rres )
+ {
+ ERR << "resolve " << rres << endl;
+ return false;
+ }
+ MIL << "resolve " << rres << endl;
+ return true;
+}
+
+///////////////////////////////////////////////////////////////////
+
struct ConvertDbReceive : public callback::ReceiveReport<target::ScriptResolvableReport>
{
virtual void start( const Resolvable::constPtr & script_r,
@@ -82,7 +172,7 @@
struct MediaChangeReceive : public callback::ReceiveReport<media::MediaChangeReport>
{
- virtual Action requestMedia( Source_Ref source
+ virtual Action requestMedia( Repository source
, unsigned mediumNr
, Error error
, const std::string & description )
@@ -109,7 +199,7 @@
struct AddResolvables
{
- bool operator()( const Source_Ref & src ) const
+ bool operator()( const Repository & src ) const
{
getZYpp()->addResolvables( src.resolvables() );
return true;
@@ -198,90 +288,74 @@
//zypp::base::LogControl::instance().logfile( "log.restrict" );
INT << "===[START]==========================================" << endl;
- Pathname dbdir( "store" );
- Pathname reporoot( "lmd" );
+ RepoManager repoManager;
+ RepoInfoList repos = repoManager.knownRepositories();
- cache::CacheStore store( dbdir );
- data::RecordId repositoryId = store.lookupOrAppendRepository( "foosource" );
+ if ( repos.empty() )
{
- Measure x( "XXXXXXXXXXXXX" );
-
- parser::susetags::RepoParser repo( repositoryId, store );
- repo.parse( reporoot );
-
- store.commit();
+ RepoInfo nrepo;
+ nrepo
+ .setAlias( "factorytest" )
+ .setName( "Test Repo for factory." )
+ .setEnabled( true )
+ .setAutorefresh( false )
+ .addBaseUrl( Url("ftp://dist.suse.de/install/stable-x86/") );
+
+ repoManager.addRepository( nrepo );
+ repos = repoManager.knownRepositories();
+ SEC << "refreshMetadat" << endl;
+ repoManager.refreshMetadata( nrepo );
+ SEC << "buildCache" << endl;
+ repoManager.buildCache( nrepo );
+ SEC << "------" << endl;
}
+ ResPool pool( getZYpp()->pool() );
+ vdumpPoolStats( USR << "Initial pool:" << endl,
+ pool.begin(),
+ pool.end() ) << endl;
-#if 0
- ContentFileReader tp;
- tp.setProductConsumer( consumeProd );
- tp.setRepoIndexConsumer( consumeIndex );
- //tp.setSrcPkgConsumer( consumeSrcPkg );
- tp.parse( p );
-
-
- //try
+ for ( RepoInfoList::iterator it = repos.begin(); it != repos.end(); ++it )
{
- //Pathname dbdir( "/Local/ma/zypp-TRUNK/BUILD/libzypp/devel/devel.ma/store" );
-
-
- Pathname dbdir( "store" );
- Pathname metadir( "lmd" );
-
- cache::CacheStore store( dbdir );
- data::RecordId repositoryId = store.lookupOrAppendRepository( Url("http://www.google.com"), "/" );
-
- RepoParser( metadir, repositoryId, store );
-
- }
+ RepoInfo & nrepo( *it );
- try
+ if ( 0 )
{
- ZYpp::Ptr z = getZYpp();
-
- Pathname dbfile( "data.db" );
- cache::CacheStore store(getenv("PWD"));
-
- data::RecordId repository_id = store.lookupOrAppendRepository( Url("http://www.google.com"), "/");
-
- PackagesParser parser( repository_id, store);
- Measure m;
- parser.start(argv[1], &progress_function);
- m.elapsed();
+ SEC << "cleanCache" << endl;
+ repoManager.cleanCache( nrepo );
+ SEC << "buildCache" << endl;
+ repoManager.buildCache( nrepo );
}
- catch ( const Exception &e )
- {
- cout << "ups! " << e.msg() << std::endl;
- }
-#endif
+ SEC << nrepo << endl;
+ Repository nrep( repoManager.createFromCache( nrepo ) );
+ const zypp::ResStore & store( nrep.resolvables() );
+ dumpPoolStats( SEC << "Store: " << endl,
+ store.begin(), store.end() ) << endl;
+ getZYpp()->addResolvables( store );
+ }
- INT << "===[END]============================================" << endl << endl;
- zypp::base::LogControl::instance().logNothing();
- return 0;
+ USR << "pool: " << pool << endl;
- Pathname proot( "lmd/suse/setup/descr" );
+ ///////////////////////////////////////////////////////////////////
+ // define transaction
+ ///////////////////////////////////////////////////////////////////
+ if ( 1 )
+ {
+ for_each( pool.byKindBegin<Product>(), pool.byKindEnd<Product>(), StatusInstall() );
+ }
- pPackages( proot/"packages" );
- //pPackages( proot/"packages.gz" );
- pPackagesLang( proot/"packages.de", Locale("de") );
- //pPackagesLang( proot/"packages.de.gz", Locale("de") );
- pPattern( proot/"base-10.3-30.x86_64.pat" );
-
- if ( 0 )
- {
- Measure x( "lmd.idx" );
- std::ifstream fIndex( "lmd.idx" );
- for( iostr::EachLine in( fIndex ); in; in.next() )
- {
- Measure x( *in );
- std::ifstream fIn( (*in).c_str() );
- for( iostr::EachLine l( fIn ); l; l.next() )
- {
- ;
- }
- }
+ ///////////////////////////////////////////////////////////////////
+ // solve
+ ///////////////////////////////////////////////////////////////////
+ if ( 1 )
+ {
+ solve();
}
+
+ vdumpPoolStats( USR << "Transacting:"<< endl,
+ make_filter_begin<resfilter::ByTransact>(pool),
+ make_filter_end<resfilter::ByTransact>(pool) ) << endl;
+
INT << "===[END]============================================" << endl << endl;
zypp::base::LogControl::instance().logNothing();
return 0;
Modified: branches/REFACTORING-10_3/libzypp/devel/devel.ma/Tools.h
URL: http://svn.opensuse.org/viewcvs/zypp/branches/REFACTORING-10_3/libzypp/deve…
==============================================================================
--- branches/REFACTORING-10_3/libzypp/devel/devel.ma/Tools.h (original)
+++ branches/REFACTORING-10_3/libzypp/devel/devel.ma/Tools.h Tue Jun 26 14:29:19 2007
@@ -17,8 +17,7 @@
#include <zypp/ResObject.h>
#include <zypp/pool/PoolStats.h>
-#include <zypp/SourceFactory.h>
-#include <zypp/source/susetags/SuseTagsImpl.h>
+#include <zypp/Repository.h>
using namespace zypp;
using zypp::debug::Measure;
@@ -91,9 +90,10 @@
}
///////////////////////////////////////////////////////////////////
-inline Source_Ref createSource( const Url & url_r, const std::string & alias_r = std::string() )
+inline Repository createSource( const Url & url_r, const std::string & alias_r = std::string() )
{
- Source_Ref ret;
+ Repository ret;
+#if 0
Measure x( "createSource: " + url_r.asString() );
try
{
@@ -109,7 +109,7 @@
}
catch ( const Exception & )
{
- return Source_Ref::noSource;
+ return Repository::noSource;
}
x.start( "parseSource: " + url_r.asString() );
{
@@ -120,10 +120,10 @@
MIL << "Content " << ret << "{" << endl;
rstats( ret.resolvables() );
MIL << "}" << endl;
-
+#endif
return ret;
}
-inline Source_Ref createSource( const std::string & url_r, const std::string & alias_r = std::string() )
+inline Repository createSource( const std::string & url_r, const std::string & alias_r = std::string() )
{
try
{
@@ -131,7 +131,7 @@
}
catch ( const Exception & )
{
- return Source_Ref::noSource;
+ return Repository::noRepository;
}
}
--
To unsubscribe, e-mail: zypp-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: zypp-commit+help(a)opensuse.org
1
0
[zypp-commit] r5845 - in /branches/REFACTORING-10_3/libzypp/zypp: parser/susetags/RepoParser.cc repo/cached/RepoImpl.cc
by mlandres@svn.opensuse.org 26 Jun '07
by mlandres@svn.opensuse.org 26 Jun '07
26 Jun '07
Author: mlandres
Date: Tue Jun 26 14:01:02 2007
New Revision: 5845
URL: http://svn.opensuse.org/viewcvs/zypp?rev=5845&view=rev
Log:
fix cached Repository to provide Product data
Modified:
branches/REFACTORING-10_3/libzypp/zypp/parser/susetags/RepoParser.cc
branches/REFACTORING-10_3/libzypp/zypp/repo/cached/RepoImpl.cc
Modified: branches/REFACTORING-10_3/libzypp/zypp/parser/susetags/RepoParser.cc
URL: http://svn.opensuse.org/viewcvs/zypp/branches/REFACTORING-10_3/libzypp/zypp…
==============================================================================
--- branches/REFACTORING-10_3/libzypp/zypp/parser/susetags/RepoParser.cc (original)
+++ branches/REFACTORING-10_3/libzypp/zypp/parser/susetags/RepoParser.cc Tue Jun 26 14:01:02 2007
@@ -69,6 +69,7 @@
void consumeProd( const data::Product_Ptr & data_r )
{
MIL << "[Product] " << data_r << endl;
+ ++_stats.prod;
_prodData = data_r;
_consumer.consumeProduct( _repositoryId, data_r );
}
@@ -76,18 +77,21 @@
void consumePkg( const data::Package_Ptr & data_r )
{
//SEC << "[Package]" << data_r << endl;
+ ++_stats.pack;
_consumer.consumePackage( _repositoryId, data_r );
}
void consumeSrcPkg( const data::SrcPackage_Ptr & data_r )
{
//SEC << "[SrcPackage]" << data_r << endl;
+ ++_stats.srcp;
_consumer.consumeSourcePackage( _repositoryId, data_r );
}
void consumePat( const data::Pattern_Ptr & data_r )
{
//SEC << "[Pattern]" << data_r << endl;
+ ++_stats.patt;
_consumer.consumePattern( _repositoryId, data_r );
}
//@}
@@ -166,6 +170,14 @@
/** Translations processed by \ref parseLocaleIf so far.*/
std::set<Locale> _parsedLocales;
+
+ struct Stats {
+ DefaultIntegral<unsigned,0> prod;
+ DefaultIntegral<unsigned,0> patt;
+ DefaultIntegral<unsigned,0> pack;
+ DefaultIntegral<unsigned,0> srcp;
+ };
+ Stats _stats;
};
///////////////////////////////////////////////////////////////////
@@ -238,6 +250,12 @@
// Done
if ( ! _ticks.toMax() )
ZYPP_THROW( AbortRequestException() );
+
+ MIL << "DONE " << reporoot_r << "("
+ << _stats.prod << " products, "
+ << _stats.patt << " patterns, "
+ << _stats.pack << " packages, "
+ << _stats.srcp << " srcpackages)" << endl;
}
///////////////////////////////////////////////////////////////////
//
Modified: branches/REFACTORING-10_3/libzypp/zypp/repo/cached/RepoImpl.cc
URL: http://svn.opensuse.org/viewcvs/zypp/branches/REFACTORING-10_3/libzypp/zypp…
==============================================================================
--- branches/REFACTORING-10_3/libzypp/zypp/repo/cached/RepoImpl.cc (original)
+++ branches/REFACTORING-10_3/libzypp/zypp/repo/cached/RepoImpl.cc Tue Jun 26 14:01:02 2007
@@ -19,6 +19,7 @@
#include "zypp/Package.h"
#include "zypp/SrcPackage.h"
+#include "zypp/Product.h"
#include "zypp/Pattern.h"
#include "zypp/Patch.h"
#include "zypp/Message.h"
@@ -28,6 +29,7 @@
#include "zypp/repo/cached/RepoImpl.h"
#include "zypp/repo/cached/PackageImpl.h"
#include "zypp/repo/cached/SrcPackageImpl.h"
+#include "zypp/repo/cached/ProductImpl.h"
#include "zypp/repo/cached/PatternImpl.h"
#include "zypp/repo/cached/PatchImpl.h"
#include "zypp/repo/cached/MessageImpl.h"
@@ -111,43 +113,49 @@
{
ResImplTraits<cached::PackageImpl>::Ptr impl = new cached::PackageImpl(it->first, this);
Package::Ptr package = detail::makeResolvableFromImpl( it->second.second, impl );
- _store.insert (package);
+ _store.insert( package );
}
else if ( it->second.first == ResTraits<SrcPackage>::kind )
{
ResImplTraits<cached::SrcPackageImpl>::Ptr impl = new cached::SrcPackageImpl(it->first, this);
SrcPackage::Ptr srcpackage = detail::makeResolvableFromImpl( it->second.second, impl );
- _store.insert (srcpackage);
+ _store.insert( srcpackage );
+ }
+ else if ( it->second.first == ResTraits<Product>::kind )
+ {
+ ResImplTraits<cached::ProductImpl>::Ptr impl = new cached::ProductImpl(it->first, this);
+ Product::Ptr product = detail::makeResolvableFromImpl( it->second.second, impl );
+ _store.insert( product );
}
else if ( it->second.first == ResTraits<Pattern>::kind )
{
ResImplTraits<cached::PatternImpl>::Ptr impl = new cached::PatternImpl(it->first, this);
Pattern::Ptr pattern = detail::makeResolvableFromImpl( it->second.second, impl );
- _store.insert (pattern);
+ _store.insert( pattern );
}
else if ( it->second.first == ResTraits<Patch>::kind )
{
ResImplTraits<cached::PatchImpl>::Ptr impl = new cached::PatchImpl(it->first, this);
Patch::Ptr patch = detail::makeResolvableFromImpl( it->second.second, impl );
- _store.insert (patch);
+ _store.insert( patch );
}
else if ( it->second.first == ResTraits<Message>::kind )
{
ResImplTraits<cached::MessageImpl>::Ptr impl = new cached::MessageImpl(it->first, this);
Message::Ptr message = detail::makeResolvableFromImpl( it->second.second, impl );
- _store.insert (message);
+ _store.insert( message );
}
else if ( it->second.first == ResTraits<Script>::kind )
{
ResImplTraits<cached::ScriptImpl>::Ptr impl = new cached::ScriptImpl(it->first, this);
Script::Ptr script = detail::makeResolvableFromImpl( it->second.second, impl );
- _store.insert (script);
+ _store.insert( script );
}
else if ( it->second.first == ResTraits<Atom>::kind )
{
ResImplTraits<cached::AtomImpl>::Ptr impl = new cached::AtomImpl(it->first, this);
Atom::Ptr atom = detail::makeResolvableFromImpl( it->second.second, impl );
- _store.insert (atom);
+ _store.insert( atom );
}
}
con.executenonquery("COMMIT;");
--
To unsubscribe, e-mail: zypp-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: zypp-commit+help(a)opensuse.org
1
0
[zypp-commit] r5844 - in /branches/REFACTORING-10_3/libzypp/zypp: ./ cache/ parser/susetags/ repo/cached/
by mlandres@svn.opensuse.org 26 Jun '07
by mlandres@svn.opensuse.org 26 Jun '07
26 Jun '07
Author: mlandres
Date: Tue Jun 26 13:33:44 2007
New Revision: 5844
URL: http://svn.opensuse.org/viewcvs/zypp?rev=5844&view=rev
Log:
fix cache Store and Repository to offer SourcePackages (its attributes are still missing)
Modified:
branches/REFACTORING-10_3/libzypp/zypp/CMakeLists.txt
branches/REFACTORING-10_3/libzypp/zypp/cache/CacheStore.cc
branches/REFACTORING-10_3/libzypp/zypp/parser/susetags/RepoParser.cc
branches/REFACTORING-10_3/libzypp/zypp/repo/cached/AtomImpl.h
branches/REFACTORING-10_3/libzypp/zypp/repo/cached/MessageImpl.h
branches/REFACTORING-10_3/libzypp/zypp/repo/cached/PackageImpl.h
branches/REFACTORING-10_3/libzypp/zypp/repo/cached/PatchImpl.h
branches/REFACTORING-10_3/libzypp/zypp/repo/cached/PatternImpl.h
branches/REFACTORING-10_3/libzypp/zypp/repo/cached/ProductImpl.h
branches/REFACTORING-10_3/libzypp/zypp/repo/cached/RepoImpl.cc
branches/REFACTORING-10_3/libzypp/zypp/repo/cached/RepoImpl.h
branches/REFACTORING-10_3/libzypp/zypp/repo/cached/ScriptImpl.h
branches/REFACTORING-10_3/libzypp/zypp/repo/cached/SrcPackageImpl.cc
branches/REFACTORING-10_3/libzypp/zypp/repo/cached/SrcPackageImpl.h
Modified: branches/REFACTORING-10_3/libzypp/zypp/CMakeLists.txt
URL: http://svn.opensuse.org/viewcvs/zypp/branches/REFACTORING-10_3/libzypp/zypp…
==============================================================================
--- branches/REFACTORING-10_3/libzypp/zypp/CMakeLists.txt (original)
+++ branches/REFACTORING-10_3/libzypp/zypp/CMakeLists.txt Tue Jun 26 13:33:44 2007
@@ -944,6 +944,7 @@
SET( zypp_repo_cached_SRCS
repo/cached/RepoImpl.cc
repo/cached/PackageImpl.cc
+ repo/cached/SrcPackageImpl.cc
repo/cached/PatchImpl.cc
repo/cached/PatternImpl.cc
repo/cached/ProductImpl.cc
@@ -955,6 +956,7 @@
SET( zypp_repo_cached_HEADERS
repo/cached/RepoImpl.h
repo/cached/PackageImpl.h
+ repo/cached/SrcPackageImpl.h
repo/cached/PatchImpl.h
repo/cached/PatternImpl.h
repo/cached/ProductImpl.h
Modified: branches/REFACTORING-10_3/libzypp/zypp/cache/CacheStore.cc
URL: http://svn.opensuse.org/viewcvs/zypp/branches/REFACTORING-10_3/libzypp/zypp…
==============================================================================
--- branches/REFACTORING-10_3/libzypp/zypp/cache/CacheStore.cc (original)
+++ branches/REFACTORING-10_3/libzypp/zypp/cache/CacheStore.cc Tue Jun 26 13:33:44 2007
@@ -250,7 +250,7 @@
RecordId id = appendResolvable( repository_id, ResTraits<SrcPackage>::kind,
NVRA( package->name, package->edition, package->arch ), package->deps );
appendResObjectAttributes( id, package );
- appendPackageBaseAttributes( id, package );
+ //appendPackageBaseAttributes( id, package );
#warning TBD WRONG IMPLEMENTATION
return id;
}
@@ -431,8 +431,7 @@
_pimpl->insert_resolvable_in_repository_cmd->bind(":resolvable_id", id);
_pimpl->insert_resolvable_in_repository_cmd->executenonquery();*/
- return static_cast<RecordId>(id);
- return 1;
+ return id;
}
void CacheStore::appendDependencies( const RecordId &resolvable_id, const data::Dependencies &deps )
Modified: branches/REFACTORING-10_3/libzypp/zypp/parser/susetags/RepoParser.cc
URL: http://svn.opensuse.org/viewcvs/zypp/branches/REFACTORING-10_3/libzypp/zypp…
==============================================================================
--- branches/REFACTORING-10_3/libzypp/zypp/parser/susetags/RepoParser.cc (original)
+++ branches/REFACTORING-10_3/libzypp/zypp/parser/susetags/RepoParser.cc Tue Jun 26 13:33:44 2007
@@ -62,32 +62,32 @@
//@{
void consumeIndex( const RepoIndex_Ptr & data_r )
{
- SEC << "[Index]" << data_r << endl;
+ //SEC << "[Index]" << data_r << endl;
_repoIndex = data_r;
}
void consumeProd( const data::Product_Ptr & data_r )
{
- SEC << "[Prod]" << data_r << endl;
+ MIL << "[Product] " << data_r << endl;
_prodData = data_r;
_consumer.consumeProduct( _repositoryId, data_r );
}
void consumePkg( const data::Package_Ptr & data_r )
{
- SEC << "[Package]" << data_r << endl;
+ //SEC << "[Package]" << data_r << endl;
_consumer.consumePackage( _repositoryId, data_r );
}
void consumeSrcPkg( const data::SrcPackage_Ptr & data_r )
{
- SEC << "[SrcPackage]" << data_r << endl;
+ //SEC << "[SrcPackage]" << data_r << endl;
_consumer.consumeSourcePackage( _repositoryId, data_r );
}
void consumePat( const data::Pattern_Ptr & data_r )
{
- SEC << "[Pattern]" << data_r << endl;
+ //SEC << "[Pattern]" << data_r << endl;
_consumer.consumePattern( _repositoryId, data_r );
}
//@}
@@ -141,6 +141,8 @@
// ...or parse
_parsedLocales.insert( toParse ); // don't try again.
+#warning DISABLED PACKAGES.LANG PARSING
+ return;
PackagesLangFileReader reader;
reader.setLocale( toParse );
reader.setPkgConsumer( bind( &Impl::consumePkg, this, _1 ) );
Modified: branches/REFACTORING-10_3/libzypp/zypp/repo/cached/AtomImpl.h
URL: http://svn.opensuse.org/viewcvs/zypp/branches/REFACTORING-10_3/libzypp/zypp…
==============================================================================
--- branches/REFACTORING-10_3/libzypp/zypp/repo/cached/AtomImpl.h (original)
+++ branches/REFACTORING-10_3/libzypp/zypp/repo/cached/AtomImpl.h Tue Jun 26 13:33:44 2007
@@ -47,7 +47,7 @@
virtual Repository repository() const;
- protected:
+ private:
repo::cached::RepoImpl::Ptr _repository;
data::RecordId _id;
};
Modified: branches/REFACTORING-10_3/libzypp/zypp/repo/cached/MessageImpl.h
URL: http://svn.opensuse.org/viewcvs/zypp/branches/REFACTORING-10_3/libzypp/zypp…
==============================================================================
--- branches/REFACTORING-10_3/libzypp/zypp/repo/cached/MessageImpl.h (original)
+++ branches/REFACTORING-10_3/libzypp/zypp/repo/cached/MessageImpl.h Tue Jun 26 13:33:44 2007
@@ -51,7 +51,7 @@
virtual Repository repository() const;
- protected:
+ private:
repo::cached::RepoImpl::Ptr _repository;
data::RecordId _id;
};
Modified: branches/REFACTORING-10_3/libzypp/zypp/repo/cached/PackageImpl.h
URL: http://svn.opensuse.org/viewcvs/zypp/branches/REFACTORING-10_3/libzypp/zypp…
==============================================================================
--- branches/REFACTORING-10_3/libzypp/zypp/repo/cached/PackageImpl.h (original)
+++ branches/REFACTORING-10_3/libzypp/zypp/repo/cached/PackageImpl.h Tue Jun 26 13:33:44 2007
@@ -71,7 +71,7 @@
virtual Repository repository() const;
- protected:
+ private:
repo::cached::RepoImpl::Ptr _repository;
data::RecordId _id;
};
Modified: branches/REFACTORING-10_3/libzypp/zypp/repo/cached/PatchImpl.h
URL: http://svn.opensuse.org/viewcvs/zypp/branches/REFACTORING-10_3/libzypp/zypp…
==============================================================================
--- branches/REFACTORING-10_3/libzypp/zypp/repo/cached/PatchImpl.h (original)
+++ branches/REFACTORING-10_3/libzypp/zypp/repo/cached/PatchImpl.h Tue Jun 26 13:33:44 2007
@@ -56,7 +56,7 @@
virtual Repository repository() const;
- protected:
+ private:
repo::cached::RepoImpl::Ptr _repository;
data::RecordId _id;
};
Modified: branches/REFACTORING-10_3/libzypp/zypp/repo/cached/PatternImpl.h
URL: http://svn.opensuse.org/viewcvs/zypp/branches/REFACTORING-10_3/libzypp/zypp…
==============================================================================
--- branches/REFACTORING-10_3/libzypp/zypp/repo/cached/PatternImpl.h (original)
+++ branches/REFACTORING-10_3/libzypp/zypp/repo/cached/PatternImpl.h Tue Jun 26 13:33:44 2007
@@ -59,7 +59,7 @@
virtual Repository repository() const;
- protected:
+ private:
repo::cached::RepoImpl::Ptr _repository;
data::RecordId _id;
};
Modified: branches/REFACTORING-10_3/libzypp/zypp/repo/cached/ProductImpl.h
URL: http://svn.opensuse.org/viewcvs/zypp/branches/REFACTORING-10_3/libzypp/zypp…
==============================================================================
--- branches/REFACTORING-10_3/libzypp/zypp/repo/cached/ProductImpl.h (original)
+++ branches/REFACTORING-10_3/libzypp/zypp/repo/cached/ProductImpl.h Tue Jun 26 13:33:44 2007
@@ -57,7 +57,7 @@
virtual Edition distributionEdition() const;
virtual Repository repository() const;
- protected:
+ private:
repo::cached::RepoImpl::Ptr _repository;
data::RecordId _id;
};
Modified: branches/REFACTORING-10_3/libzypp/zypp/repo/cached/RepoImpl.cc
URL: http://svn.opensuse.org/viewcvs/zypp/branches/REFACTORING-10_3/libzypp/zypp…
==============================================================================
--- branches/REFACTORING-10_3/libzypp/zypp/repo/cached/RepoImpl.cc (original)
+++ branches/REFACTORING-10_3/libzypp/zypp/repo/cached/RepoImpl.cc Tue Jun 26 13:33:44 2007
@@ -18,6 +18,7 @@
#include "zypp/CapFactory.h"
#include "zypp/Package.h"
+#include "zypp/SrcPackage.h"
#include "zypp/Pattern.h"
#include "zypp/Patch.h"
#include "zypp/Message.h"
@@ -26,6 +27,7 @@
#include "zypp/repo/cached/RepoImpl.h"
#include "zypp/repo/cached/PackageImpl.h"
+#include "zypp/repo/cached/SrcPackageImpl.h"
#include "zypp/repo/cached/PatternImpl.h"
#include "zypp/repo/cached/PatchImpl.h"
#include "zypp/repo/cached/MessageImpl.h"
@@ -111,6 +113,12 @@
Package::Ptr package = detail::makeResolvableFromImpl( it->second.second, impl );
_store.insert (package);
}
+ else if ( it->second.first == ResTraits<SrcPackage>::kind )
+ {
+ ResImplTraits<cached::SrcPackageImpl>::Ptr impl = new cached::SrcPackageImpl(it->first, this);
+ SrcPackage::Ptr srcpackage = detail::makeResolvableFromImpl( it->second.second, impl );
+ _store.insert (srcpackage);
+ }
else if ( it->second.first == ResTraits<Pattern>::kind )
{
ResImplTraits<cached::PatternImpl>::Ptr impl = new cached::PatternImpl(it->first, this);
Modified: branches/REFACTORING-10_3/libzypp/zypp/repo/cached/RepoImpl.h
URL: http://svn.opensuse.org/viewcvs/zypp/branches/REFACTORING-10_3/libzypp/zypp…
==============================================================================
--- branches/REFACTORING-10_3/libzypp/zypp/repo/cached/RepoImpl.h (original)
+++ branches/REFACTORING-10_3/libzypp/zypp/repo/cached/RepoImpl.h Tue Jun 26 13:33:44 2007
@@ -56,7 +56,7 @@
cache::ResolvableQuery resolvableQuery();
void createResolvables();
void createPatchAndDeltas();
- protected:
+ private:
void read_capabilities( sqlite3x::sqlite3_connection &con, std::map<data::RecordId, std::pair<Resolvable::Kind, NVRAD> > &nvras );
Pathname _dbdir;
cache::CacheTypes _type_cache;
Modified: branches/REFACTORING-10_3/libzypp/zypp/repo/cached/ScriptImpl.h
URL: http://svn.opensuse.org/viewcvs/zypp/branches/REFACTORING-10_3/libzypp/zypp…
==============================================================================
--- branches/REFACTORING-10_3/libzypp/zypp/repo/cached/ScriptImpl.h (original)
+++ branches/REFACTORING-10_3/libzypp/zypp/repo/cached/ScriptImpl.h Tue Jun 26 13:33:44 2007
@@ -52,7 +52,7 @@
virtual Repository repository() const;
- protected:
+ private:
repo::cached::RepoImpl::Ptr _repository;
data::RecordId _id;
};
Modified: branches/REFACTORING-10_3/libzypp/zypp/repo/cached/SrcPackageImpl.cc
URL: http://svn.opensuse.org/viewcvs/zypp/branches/REFACTORING-10_3/libzypp/zypp…
==============================================================================
--- branches/REFACTORING-10_3/libzypp/zypp/repo/cached/SrcPackageImpl.cc (original)
+++ branches/REFACTORING-10_3/libzypp/zypp/repo/cached/SrcPackageImpl.cc Tue Jun 26 13:33:44 2007
@@ -6,12 +6,10 @@
| /_____||_| |_| |_| |
| |
\---------------------------------------------------------------------*/
-/** \file zmd/backend/dbsource/SrcPackageImpl.h
- *
+/** \file zypp/repo/cached/SrcPackageImpl.cc
*/
#include "SrcPackageImpl.h"
-#include "zypp/source/SourceImpl.h"
#include "zypp/TranslatedText.h"
#include "zypp/base/String.h"
#include "zypp/base/Logger.h"
@@ -32,66 +30,14 @@
#warning STILL A DUMMY IMPLEMENTATION
/** Default ctor
*/
-SrcPackageImpl::SrcPackageImpl (Repository repo)
- : _repository(repo)
- , _install_only(false)
- , _size_installed(0)
- , _size_archive(0)
- , _data_loaded(false)
+SrcPackageImpl::SrcPackageImpl ( const data::RecordId & id, repo::cached::RepoImpl::Ptr repository_r )
+ : _repository( repository_r )
+ , _id( id )
{}
-Repository
-SrcPackageImpl::repository() const
+Repository SrcPackageImpl::repository() const
{
- return _repository;
-}
-
-/** Package summary */
-TranslatedText SrcPackageImpl::summary() const
-{
- return _summary;
-}
-
-/** Package description */
-TranslatedText SrcPackageImpl::description() const
-{
- return _description;
-}
-
-PackageGroup SrcPackageImpl::group() const
-{
- return _group;
-}
-
-Pathname SrcPackageImpl::location() const
-{
- return _location;
-}
-
-ByteCount SrcPackageImpl::size() const
-{
- return _size_installed;
-}
-
-/** */
-ByteCount SrcPackageImpl::archivesize() const
-{
- return _size_archive;
-}
-
-bool SrcPackageImpl::installOnly() const
-{
- return _install_only;
-}
-
-unsigned SrcPackageImpl::mediaNr() const
-{
- return _media_nr;
-}
-
-Vendor SrcPackageImpl::vendor() const
-{
- return "suse";
+ return _repository->selfRepository();
}
/////////////////////////////////////////////////////////////////
Modified: branches/REFACTORING-10_3/libzypp/zypp/repo/cached/SrcPackageImpl.h
URL: http://svn.opensuse.org/viewcvs/zypp/branches/REFACTORING-10_3/libzypp/zypp…
==============================================================================
--- branches/REFACTORING-10_3/libzypp/zypp/repo/cached/SrcPackageImpl.h (original)
+++ branches/REFACTORING-10_3/libzypp/zypp/repo/cached/SrcPackageImpl.h Tue Jun 26 13:33:44 2007
@@ -10,50 +10,31 @@
#ifndef CachedRepoSrcPackageImpl_H
#define CachedRepoSrcPackageImpl_H
-#include "zypp/detail/PackageImpl.h"
-#include "zypp/Repository.h"
-//#include <sqlite3.h>
+#include "zypp/detail/SrcPackageImpl.h"
+#include "zypp/repo/cached/RepoImpl.h"
///////////////////////////////////////////////////////////////////
namespace zypp
{ /////////////////////////////////////////////////////////////////
namespace repo
-{
+{ /////////////////////////////////////////////////////////////////
namespace cached
{
///////////////////////////////////////////////////////////////////
//
- // CLASS NAME : CachedSourcePackageImpl
+ // CLASS NAME : SourcePackageImpl
//
class SrcPackageImpl : public detail::SrcPackageImplIf
{
public:
- SrcPackageImpl( Repository repo );
-
- virtual TranslatedText summary() const;
- virtual TranslatedText description() const;
- virtual ByteCount size() const;
- virtual PackageGroup group() const;
- virtual ByteCount archivesize() const;
- virtual Pathname location() const;
- virtual bool installOnly() const;
- virtual unsigned mediaNr() const;
- virtual Vendor vendor() const;
-
- protected:
- TranslatedText _summary;
- TranslatedText _description;
- PackageGroup _group;
- Pathname _location;
- bool _install_only;
- unsigned _media_nr;
+ SrcPackageImpl( const data::RecordId &id, repo::cached::RepoImpl::Ptr repository_r );
- ByteCount _size_installed;
- ByteCount _size_archive;
+ virtual Repository repository() const;
- bool _data_loaded;
- Repository repo;
+ private:
+ repo::cached::RepoImpl::Ptr _repository;
+ data::RecordId _id;
};
/////////////////////////////////////////////////////////////////
} // ns cached
--
To unsubscribe, e-mail: zypp-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: zypp-commit+help(a)opensuse.org
1
0
[zypp-commit] r5843 - /branches/REFACTORING-10_3/libzypp/zypp/source/
by mlandres@svn.opensuse.org 26 Jun '07
by mlandres@svn.opensuse.org 26 Jun '07
26 Jun '07
Author: mlandres
Date: Tue Jun 26 12:01:06 2007
New Revision: 5843
URL: http://svn.opensuse.org/viewcvs/zypp?rev=5843&view=rev
Log:
remove source dir
Removed:
branches/REFACTORING-10_3/libzypp/zypp/source/
--
To unsubscribe, e-mail: zypp-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: zypp-commit+help(a)opensuse.org
1
0
[zypp-commit] r5842 - /branches/REFACTORING-10_3/libzypp/zypp/RepoManager.cc
by mlandres@svn.opensuse.org 26 Jun '07
by mlandres@svn.opensuse.org 26 Jun '07
26 Jun '07
Author: mlandres
Date: Tue Jun 26 11:29:40 2007
New Revision: 5842
URL: http://svn.opensuse.org/viewcvs/zypp?rev=5842&view=rev
Log:
Fixes to autoprobing and path to Url consversion
Modified:
branches/REFACTORING-10_3/libzypp/zypp/RepoManager.cc
Modified: branches/REFACTORING-10_3/libzypp/zypp/RepoManager.cc
URL: http://svn.opensuse.org/viewcvs/zypp/branches/REFACTORING-10_3/libzypp/zypp…
==============================================================================
--- branches/REFACTORING-10_3/libzypp/zypp/RepoManager.cc (original)
+++ branches/REFACTORING-10_3/libzypp/zypp/RepoManager.cc Tue Jun 26 11:29:40 2007
@@ -51,7 +51,7 @@
// CLASS NAME : RepoManagerOptions
//
///////////////////////////////////////////////////////////////////
-
+
RepoManagerOptions::RepoManagerOptions()
{
ZConfig globalConfig;
@@ -78,12 +78,12 @@
{
MIL << endl;
}
-
+
~RepoCollector()
{
MIL << endl;
}
-
+
bool collect( const RepoInfo &repo )
{
//MIL << "here in collector: " << repo.alias() << endl;
@@ -91,12 +91,12 @@
//MIL << "added: " << repo.alias() << endl;
return true;
}
-
+
RepoInfoList repos;
};
-
+
////////////////////////////////////////////////////////////////////////////
-
+
/**
* Reads RepoInfo's from a repo file.
*
@@ -115,20 +115,20 @@
std::list<RepoInfo> readRepoFile(const Url & repo_file)
{
// no interface to download a specific file, using workaround:
- //! \todo add MediaManager::provideFile(Url file_url) to easily access any file URLs? (no need for media access id or media_nr)
+ //! \todo add MediaManager::provideFile(Url file_url) to easily access any file URLs? (no need for media access id or media_nr)
Url url(repo_file);
Pathname path(url.getPathName());
url.setPathName ("/");
MediaSetAccess access(url);
Pathname local = access.provideFile(path);
-
+
DBG << "reading repo file " << repo_file << ", local path: " << local << endl;
-
+
return repositories_in_file(local);
}
////////////////////////////////////////////////////////////////////////////
-
+
/**
* \short List of RepoInfo's from a directory
*
@@ -144,10 +144,10 @@
list<Pathname> entries;
if ( filesystem::readdir( entries, Pathname(dir), false ) != 0 )
ZYPP_THROW(Exception("failed to read directory"));
-
+
for ( list<Pathname>::const_iterator it = entries.begin(); it != entries.end(); ++it )
{
- list<RepoInfo> tmp = repositories_in_file( *it );
+ list<RepoInfo> tmp = repositories_in_file( *it );
repos.insert( repos.end(), tmp.begin(), tmp.end() );
//std::copy( collector.repos.begin(), collector.repos.end(), std::back_inserter(repos));
@@ -157,23 +157,23 @@
}
////////////////////////////////////////////////////////////////////////////
-
+
static void assert_alias( const RepoInfo &info )
{
if (info.alias().empty())
ZYPP_THROW(RepoNoAliasException());
}
-
+
////////////////////////////////////////////////////////////////////////////
-
+
static void assert_urls( const RepoInfo &info )
{
if (info.baseUrls().empty())
ZYPP_THROW(RepoNoUrlException());
}
-
+
////////////////////////////////////////////////////////////////////////////
-
+
/**
* \short Calculates the raw cache path for a repository
*/
@@ -188,7 +188,7 @@
// CLASS NAME : RepoManager::Impl
//
///////////////////////////////////////////////////////////////////
-
+
/**
* \short RepoManager implementation.
*/
@@ -197,16 +197,16 @@
Impl( const RepoManagerOptions &opt )
: options(opt)
{
-
+
}
-
+
Impl()
{
-
+
}
-
+
RepoManagerOptions options;
-
+
public:
/** Offer default Impl. */
static shared_ptr<Impl> nullimpl()
@@ -240,10 +240,10 @@
{}
////////////////////////////////////////////////////////////////////////////
-
+
RepoManager::~RepoManager()
{}
-
+
////////////////////////////////////////////////////////////////////////////
std::list<RepoInfo> RepoManager::knownRepositories() const
@@ -254,22 +254,23 @@
}
////////////////////////////////////////////////////////////////////////////
-
+
RepoStatus RepoManager::rawMetadataStatus( const RepoInfo &info )
{
Pathname rawpath = rawcache_path_for_repoinfo( _pimpl->options, info );
RepoType repokind = info.type();
RepoStatus status;
+
switch ( repokind.toEnum() )
{
case RepoType::NONE_e:
// unknown, probe the local metadata
- repokind = probe(Url(rawpath.asString()));
+ repokind = probe(rawpath.asUrl());
break;
default:
break;
}
-
+
switch ( repokind.toEnum() )
{
case RepoType::RPMMD_e :
@@ -277,6 +278,7 @@
status = RepoStatus( rawpath + "/repodata/repomd.xml");
}
break;
+
case RepoType::YAST2_e :
{
status = RepoStatus( rawpath + "/content");
@@ -284,23 +286,27 @@
case RepoType::RPMPLAINDIR_e :
{
if ( PathInfo(Pathname(rawpath + "/cookie")).isExist() )
- status = RepoStatus( rawpath + "/content");
+ status = RepoStatus( rawpath + "/cookie");
}
break;
- default:
- ZYPP_THROW(RepoUnknownTypeException());
+
+ case RepoType::NONE_e :
+ // Return default RepoStatus in case of RepoType::NONE
+ // indicating it should be created?
+ // ZYPP_THROW(RepoUnknownTypeException());
+ break;
}
return status;
}
-
-
+
+
void RepoManager::refreshMetadata( const RepoInfo &info,
RawMetadataRefreshPolicy policy,
const ProgressData::ReceiverFnc & progress )
{
assert_alias(info);
assert_urls(info);
-
+
RepoStatus oldstatus;
RepoStatus newstatus;
// try urls one by one
@@ -310,9 +316,9 @@
{
Url url(*it);
filesystem::TmpDir tmpdir;
-
+
repo::RepoType repokind = info.type();
-
+
// if the type is unknown, try probing.
switch ( repokind.toEnum() )
{
@@ -323,16 +329,16 @@
default:
break;
}
-
+
Pathname rawpath = rawcache_path_for_repoinfo( _pimpl->options, info );
oldstatus = rawMetadataStatus(info);
-
+
switch ( repokind.toEnum() )
{
case RepoType::RPMMD_e :
{
yum::Downloader downloader( url, "/" );
-
+
RepoStatus newstatus = downloader.status();
bool refresh = false;
if ( oldstatus.checksum() == newstatus.checksum() )
@@ -348,7 +354,7 @@
{
refresh = true;
}
-
+
if ( refresh )
downloader.download(tmpdir.path());
else
@@ -359,7 +365,7 @@
case RepoType::YAST2_e :
{
susetags::Downloader downloader( url, "/" );
-
+
RepoStatus newstatus = downloader.status();
bool refresh = false;
if ( oldstatus.checksum() == newstatus.checksum() )
@@ -375,7 +381,7 @@
{
refresh = true;
}
-
+
if ( refresh )
downloader.download(tmpdir.path());
else
@@ -399,7 +405,7 @@
{
refresh = true;
}
-
+
if ( refresh )
{
std::ofstream file(( tmpdir.path() + "/cookie").c_str());
@@ -408,7 +414,7 @@
}
file << url << endl;
file << newstatus.checksum() << endl;
-
+
file.close();
}
else
@@ -419,7 +425,7 @@
default:
ZYPP_THROW(RepoUnknownTypeException());
}
-
+
// ok we have the metadata, now exchange
// the contents
TmpDir oldmetadata;
@@ -439,17 +445,17 @@
ERR << "No more urls..." << endl;
ZYPP_THROW(RepoException("Cant refresh metadata"));
}
-
+
////////////////////////////////////////////////////////////////////////////
-
+
void RepoManager::cleanMetadata( const RepoInfo &info,
const ProgressData::ReceiverFnc & progress )
{
filesystem::recursive_rmdir(rawcache_path_for_repoinfo(_pimpl->options, info));
}
-
+
////////////////////////////////////////////////////////////////////////////
-
+
void RepoManager::buildCache( const RepoInfo &info,
CacheBuildPolicy policy,
const ProgressData::ReceiverFnc & progressrcv )
@@ -459,9 +465,9 @@
progress.toMin();
assert_alias(info);
Pathname rawpath = rawcache_path_for_repoinfo(_pimpl->options, info);
-
+
cache::CacheStore store(_pimpl->options.repoCachePath);
-
+
RepoStatus raw_metadata_status = rawMetadataStatus(info);
if ( store.isCached( info.alias() ) )
{
@@ -477,27 +483,28 @@
return;
}
else {
- MIL << "Build cache is forced" << endl;
+ MIL << info.alias() << " cache rebuild is forced" << endl;
}
}
store.cleanRepository(id);
}
-
+
+ MIL << info.alias() << " building cache..." << endl;
data::RecordId id = store.lookupOrAppendRepository(info.alias());
// do we have type?
repo::RepoType repokind = info.type();
-
+
// if the type is unknown, try probing.
switch ( repokind.toEnum() )
{
case RepoType::NONE_e:
// unknown, probe the local metadata
- repokind = probe(Url(rawpath.asString()));
+ repokind = probe(rawpath.asUrl());
break;
default:
break;
}
-
+
switch ( repokind.toEnum() )
{
case RepoType::RPMMD_e :
@@ -526,25 +533,32 @@
default:
ZYPP_THROW(RepoUnknownTypeException());
}
-
+
// update timestamp and checksum
store.updateRepositoryStatus(id, raw_metadata_status);
-
+
MIL << "Commit cache.." << endl;
store.commit();
progress.toMax();
}
-
+
////////////////////////////////////////////////////////////////////////////
-
+
repo::RepoType RepoManager::probe( const Url &url )
{
+ if ( url.getScheme() == "dir" && ! PathInfo( url.getPathName() ).isDir() )
+ {
+ // Handle non existing local directory in advance, as
+ // MediaSetAccess does not support it.
+ return repo::RepoType::NONE;
+ }
+
MediaSetAccess access(url);
if ( access.doesFileExist("/repodata/repomd.xml") )
return repo::RepoType::RPMMD;
if ( access.doesFileExist("/content") )
return repo::RepoType::YAST2;
-
+
// if it is a local url of type dir
if ( (! media::MediaManager::downloads(url)) && ( url.getScheme() == "dir" ) )
{
@@ -555,12 +569,12 @@
return repo::RepoType::RPMPLAINDIR;
}
}
-
- return repo::RepoType("UNKNOWN");
+
+ return repo::RepoType::NONE;
}
-
+
////////////////////////////////////////////////////////////////////////////
-
+
void RepoManager::cleanCache( const RepoInfo &info,
const ProgressData::ReceiverFnc & progressrcv )
{
@@ -573,25 +587,25 @@
store.cleanRepository(id);
store.commit();
}
-
+
////////////////////////////////////////////////////////////////////////////
-
+
bool RepoManager::isCached( const RepoInfo &info ) const
{
cache::CacheStore store(_pimpl->options.repoCachePath);
return store.isCached(info.alias());
}
-
+
Repository RepoManager::createFromCache( const RepoInfo &info,
const ProgressData::ReceiverFnc & progress )
{
cache::CacheStore store(_pimpl->options.repoCachePath);
-
+
if ( ! store.isCached( info.alias() ) )
ZYPP_THROW(RepoNotCachedException());
-
+
MIL << "Repository " << info.alias() << " is cached" << endl;
-
+
data::RecordId id = store.lookupRepository(info.alias());
repo::cached::RepoImpl::Ptr repoimpl =
new repo::cached::RepoImpl( info, _pimpl->options.repoCachePath, id );
@@ -599,9 +613,9 @@
repoimpl->createResolvables();
return Repository(repoimpl);
}
-
+
////////////////////////////////////////////////////////////////////////////
-
+
/**
* Generate a non existing filename in a directory, using a base
* name. For example if a directory contains 3 files
@@ -610,7 +624,7 @@
* |-- foo
* `-- moo
*
- * If you try to generate a unique filename for this directory,
+ * If you try to generate a unique filename for this directory,
* based on "ruu" you will get "ruu", but if you use the base
* "foo" you will get "foo_1"
*
@@ -629,14 +643,14 @@
}
return dir + Pathname(final_filename);
}
-
+
////////////////////////////////////////////////////////////////////////////
void RepoManager::addRepository( const RepoInfo &info,
const ProgressData::ReceiverFnc & progressrcv )
{
assert_alias(info);
-
+
std::list<RepoInfo> repos = knownRepositories();
for ( std::list<RepoInfo>::const_iterator it = repos.begin();
it != repos.end();
@@ -645,21 +659,21 @@
if ( info.alias() == (*it).alias() )
ZYPP_THROW(RepoAlreadyExistsException(info.alias()));
}
-
+
Pathname repofile = generate_non_existing_name(_pimpl->options.knownReposPath,
Pathname(info.alias()).extend(".repo").asString());
// now we have a filename that does not exists
MIL << "Saving repo in " << repofile << endl;
-
+
std::ofstream file(repofile.c_str());
if (!file) {
ZYPP_THROW (Exception( "Can't open " + repofile.asString() ) );
}
-
+
info.dumpRepoOn(file);
MIL << "done" << endl;
}
-
+
void RepoManager::addRepositories( const Url &url,
const ProgressData::ReceiverFnc & progressrcv )
{
@@ -681,21 +695,21 @@
}
}
}
-
+
string filename = Pathname(url.getPathName()).basename();
-
+
if ( filename == Pathname() )
ZYPP_THROW(RepoException("Invalid repo file name at " + url.asString() ));
-
+
Pathname repofile = generate_non_existing_name(_pimpl->options.knownReposPath, filename);
// now we have a filename that does not exists
MIL << "Saving " << repos.size() << " repo" << ( repos.size() ? "s" : "" ) << " in " << repofile << endl;
-
+
std::ofstream file(repofile.c_str());
if (!file) {
ZYPP_THROW (Exception( "Can't open " + repofile.asString() ) );
}
-
+
for ( std::list<RepoInfo>::const_iterator it = repos.begin();
it != repos.end();
++it )
@@ -705,9 +719,9 @@
}
MIL << "done" << endl;
}
-
+
////////////////////////////////////////////////////////////////////////////
-
+
void RepoManager::removeRepository( const RepoInfo & info,
const ProgressData::ReceiverFnc & progressrcv)
{
@@ -721,9 +735,9 @@
// then skip
if ( (!info.alias().empty()) && ( info.alias() != (*it).alias() ) )
continue;
-
+
// TODO match by url
-
+
// we have a matcing repository, now we need to know
// where it does come from.
RepoInfo todelete = *it;
@@ -762,31 +776,31 @@
if ( (*fit).alias() != todelete.alias() )
(*fit).dumpRepoOn(file);
}
-
+
cache::CacheStore store(_pimpl->options.repoCachePath);
-
+
if ( store.isCached( todelete.alias() ) ) {
MIL << "repository was cached. cleaning cache" << endl;
store.cleanRepository(todelete.alias());
}
-
+
return;
}
} // else filepath is empty
-
+
}
// should not be reached on a sucess workflow
ZYPP_THROW(RepoNotFoundException(info));
}
-
+
////////////////////////////////////////////////////////////////////////////
-
+
void RepoManager::modifyRepository( const std::string &alias,
const RepoInfo & newinfo,
const ProgressData::ReceiverFnc & progressrcv )
{
RepoInfo toedit = getRepositoryInfo(alias);
-
+
if (toedit.filepath().empty())
{
ZYPP_THROW(RepoException("Can't figure where the repo is stored"));
@@ -818,9 +832,9 @@
}
}
}
-
+
////////////////////////////////////////////////////////////////////////////
-
+
RepoInfo RepoManager::getRepositoryInfo( const std::string &alias,
const ProgressData::ReceiverFnc & progressrcv )
{
@@ -836,9 +850,9 @@
info.setAlias(info.alias());
ZYPP_THROW(RepoNotFoundException(info));
}
-
+
////////////////////////////////////////////////////////////////////////////
-
+
std::ostream & operator<<( std::ostream & str, const RepoManager & obj )
{
return str << *obj._pimpl;
--
To unsubscribe, e-mail: zypp-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: zypp-commit+help(a)opensuse.org
1
0
[zypp-commit] r5841 - in /branches/REFACTORING-10_3/libzypp/zypp/repo: RepoType.cc RepoType.h
by mlandres@svn.opensuse.org 26 Jun '07
by mlandres@svn.opensuse.org 26 Jun '07
26 Jun '07
Author: mlandres
Date: Tue Jun 26 11:21:38 2007
New Revision: 5841
URL: http://svn.opensuse.org/viewcvs/zypp?rev=5841&view=rev
Log:
added const RepoType RepoType::NONE
Modified:
branches/REFACTORING-10_3/libzypp/zypp/repo/RepoType.cc
branches/REFACTORING-10_3/libzypp/zypp/repo/RepoType.h
Modified: branches/REFACTORING-10_3/libzypp/zypp/repo/RepoType.cc
URL: http://svn.opensuse.org/viewcvs/zypp/branches/REFACTORING-10_3/libzypp/zypp…
==============================================================================
--- branches/REFACTORING-10_3/libzypp/zypp/repo/RepoType.cc (original)
+++ branches/REFACTORING-10_3/libzypp/zypp/repo/RepoType.cc Tue Jun 26 11:21:38 2007
@@ -22,7 +22,7 @@
const RepoType RepoType::RPMMD(RepoType::RPMMD_e);
const RepoType RepoType::YAST2(RepoType::YAST2_e);
const RepoType RepoType::RPMPLAINDIR(RepoType::RPMPLAINDIR_e);
- //const RepoType RepoType::NONE(RepoType::NONE_e);
+ const RepoType RepoType::NONE(RepoType::NONE_e);
RepoType::RepoType(const std::string & strval_r)
: _type(parse(strval_r))
Modified: branches/REFACTORING-10_3/libzypp/zypp/repo/RepoType.h
URL: http://svn.opensuse.org/viewcvs/zypp/branches/REFACTORING-10_3/libzypp/zypp…
==============================================================================
--- branches/REFACTORING-10_3/libzypp/zypp/repo/RepoType.h (original)
+++ branches/REFACTORING-10_3/libzypp/zypp/repo/RepoType.h Tue Jun 26 11:21:38 2007
@@ -17,7 +17,7 @@
{
namespace repo
{
-
+
/**
* \short Repository type enumeration
*
@@ -29,8 +29,8 @@
static const RepoType RPMMD;
static const RepoType YAST2;
static const RepoType RPMPLAINDIR;
- //static const RepoType NONE;
-
+ static const RepoType NONE;
+
enum Type
{
NONE_e,
@@ -40,13 +40,13 @@
};
RepoType() : _type(NONE_e) {}
-
+
RepoType(Type type) : _type(type) {}
explicit RepoType(const std::string & strval_r);
const Type toEnum() const { return _type; }
-
+
RepoType::Type parse(const std::string & strval_r);
const std::string & asString() const;
--
To unsubscribe, e-mail: zypp-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: zypp-commit+help(a)opensuse.org
1
0
[zypp-commit] r5840 - in /branches/REFACTORING-10_3/libzypp/zypp: Pathname.cc Pathname.h
by mlandres@svn.opensuse.org 26 Jun '07
by mlandres@svn.opensuse.org 26 Jun '07
26 Jun '07
Author: mlandres
Date: Tue Jun 26 11:08:20 2007
New Revision: 5840
URL: http://svn.opensuse.org/viewcvs/zypp?rev=5840&view=rev
Log:
Added Pathname::asUrl()
Modified:
branches/REFACTORING-10_3/libzypp/zypp/Pathname.cc
branches/REFACTORING-10_3/libzypp/zypp/Pathname.h
Modified: branches/REFACTORING-10_3/libzypp/zypp/Pathname.cc
URL: http://svn.opensuse.org/viewcvs/zypp/branches/REFACTORING-10_3/libzypp/zypp…
==============================================================================
--- branches/REFACTORING-10_3/libzypp/zypp/Pathname.cc (original)
+++ branches/REFACTORING-10_3/libzypp/zypp/Pathname.cc Tue Jun 26 11:08:20 2007
@@ -12,6 +12,7 @@
#include <iostream>
#include "zypp/Pathname.h"
+#include "zypp/Url.h"
using std::string;
@@ -229,6 +230,18 @@
///////////////////////////////////////////////////////////////////
//
+ // METHOD NAME : Pathname::asUrl
+ // METHOD TYPE : Url
+ //
+ Url Pathname::asUrl() const
+ {
+ Url ret( "dir:///" );
+ ret.setPathName( asString() );
+ return ret;
+ }
+
+ ///////////////////////////////////////////////////////////////////
+ //
// METHOD NAME : Pathname::extension
// METHOD TYPE : string
//
Modified: branches/REFACTORING-10_3/libzypp/zypp/Pathname.h
URL: http://svn.opensuse.org/viewcvs/zypp/branches/REFACTORING-10_3/libzypp/zypp…
==============================================================================
--- branches/REFACTORING-10_3/libzypp/zypp/Pathname.h (original)
+++ branches/REFACTORING-10_3/libzypp/zypp/Pathname.h Tue Jun 26 11:08:20 2007
@@ -18,6 +18,9 @@
///////////////////////////////////////////////////////////////////
namespace zypp
{ /////////////////////////////////////////////////////////////////
+
+ class Url;
+
///////////////////////////////////////////////////////////////////
namespace filesystem
{ /////////////////////////////////////////////////////////////////
@@ -77,6 +80,9 @@
const std::string & asString() const
{ return name_t; }
+ /** Url representation using \c dir schema. */
+ Url asUrl() const;
+
/** String representation. */
const char * c_str() const
{ return name_t.c_str(); }
--
To unsubscribe, e-mail: zypp-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: zypp-commit+help(a)opensuse.org
1
0