[PATCH] poldek

Michal Moskal malekith w pld.org.pl
Czw, 28 Mar 2002, 12:04:45 CET


Cześć,

Załączam trzy patche na poldka. 

Pierwszy pluje do logu komunikatami w formie "INST-{OK,FAILED} pkg".
Pluje tylko do logu i tylko podczas --install-dist więc chyba nie ma problemu?
Potrzebuje tego do installera, żeby mógł się zorientować czy base zostało
poprawnie zainstalowane. Aha, --force na buggy package set ciągle mile 
widziane :)

Drugi usuwa zależność wyglądu progressbaru przy --install-dist od isatty(),
(anachronizm teraz, gdy jest opcja --log i funkcka log_tty) i nie pluje nim 
do logu (a ten "break" na końcu to na warning w gcc3).

Trzeci poprawia linkowanie statyczne i/lub --without-imode (tinfo jest 
zawsze używane w term.c).

diff -ur poldek-0.17.1/pkgset.c poldek-0.17.1-/pkgset.c
--- poldek-0.17.1/pkgset.c	Sat Mar 23 14:10:48 2002
+++ poldek-0.17.1-/pkgset.c	Wed Mar 27 21:25:58 2002
@@ -685,9 +685,13 @@
             if (inst->instflags & PKGINST_TEST)
                 continue;
             
-            if (!pkgdb_install(inst->db, pkgpath,
-                               inst->instflags | PKGINST_NODEPS)) 
+            if (pkgdb_install(inst->db, pkgpath,
+                              inst->instflags | PKGINST_NODEPS))
+		logn(LOGWARN|LOGFILE, "INST-OK %s", pkg->name);
+	    else {
+		logn(LOGERR|LOGFILE, "INST-ERR %s", pkg->name);
                 nerr++;
+	    }
 
             
             ninstalled++;
diff -ur poldek-0.17.1/rpm.c poldek-0.17.1-/rpm.c
--- poldek-0.17.1/rpm.c	Mon Mar 18 00:15:05 2002
+++ poldek-0.17.1-/rpm.c	Wed Mar 27 21:22:41 2002
@@ -432,14 +432,8 @@
  */
 static void progress(const unsigned long amount, const unsigned long total) 
 {
-    static int is_tty = -1;
     static int last_v = 0;
     
-    if (is_tty == -1) {
-        FILE *stream = log_stream();
-        is_tty = isatty(fileno(stream));
-    }
-    
     if (amount == 0) {     /* first notification */
         last_v = 0;
         
@@ -459,32 +453,16 @@
             return;
             
         n_assert(last_v < 100);
-        if (!is_tty) {
-            int k;
-            
-            k = n - last_v;
-            memset(line, '.', k);
-            line[k] = '\0';
-            msg(0, "%s", line);
-
-            if (amount && amount == total) { /* last notification */
-                msgn(0, _(" done"));
-            }
-            
-            last_v = n;
-
+	
+        memset(line, '.', n);
+        line[n] = '\0';
+        snprintf(fmt, sizeof(fmt), "%%-%ds %%5.1f%%%%", barwidth);
+        snprintf(outline, sizeof(outline), fmt, line, percent);
+    
+        if (amount && amount == total) { /* last notification */
+            msg_tty(0, "\r%s\n", outline);
         } else {
-            memset(line, '.', n);
-            line[n] = '\0';
-            snprintf(fmt, sizeof(fmt), "%%-%ds %%5.1f%%%%", barwidth);
-            snprintf(outline, sizeof(outline), fmt, line, percent);
-        
-            if (amount && amount == total) { /* last notification */
-                msg(0, "\r%s\n", outline);
-                
-            } else {
-                msg(0, "\r%s", outline);
-            }
+            msg_tty(0, "\r%s", outline);
         }
     }
 }
@@ -519,7 +497,7 @@
             break;
 
         default:
-                                /* do nothing */
+            break;                 /* do nothing */
     }
     
     return rc;
diff -ur poldek-0.17.1/configure.in poldek-0.17.1-/configure.in
--- poldek-0.17.1/configure.in	Wed Mar 27 00:24:24 2002
+++ poldek-0.17.1-/configure.in	Thu Mar 28 09:29:29 2002
@@ -48,6 +48,7 @@
 	fi
 fi
 
+AC_CHECK_LIB(tinfo, tigetstr,,AC_MSG_ERROR("tinfo not found"))
 
 AC_ARG_WITH(curl,
 [  --without-curl	compile without libcurl],
@@ -75,7 +76,7 @@
 	poldek_LDFLAGS="-static"
 
 	if test "${INTERACTIVE_MODE}." = "yes."; then
-		LIBS="$LIBS -lncurses -ltinfo"
+		LIBS="$LIBS -lncurses"
 	fi
 
 	if test "${ENABLE_VFILE_CURL}." = "yes."; then

-- 
: Michal Moskal :::::::: malekith/at/pld.org.pl :  GCS {C,UL}++++$ a? !tv
: PLD Linux ::::::: Wroclaw University, CS Dept :  {E-,w}-- {b++,e}>+++ h



Więcej informacji o liście dyskusyjnej pld-installer