Apply patch for Gentoo/FreeBSD compatibility. Bug #103572.
authorDiego Elio Pettenò <flameeyes@gentoo.org>
Tue, 20 Sep 2005 18:39:54 +0000 (18:39 +0000)
committerDiego Elio Pettenò <flameeyes@gentoo.org>
Tue, 20 Sep 2005 18:39:54 +0000 (18:39 +0000)
Package-Manager: portage-2.0.52-r1

net-analyzer/gnome-netstatus/ChangeLog
net-analyzer/gnome-netstatus/Manifest
net-analyzer/gnome-netstatus/files/digest-gnome-netstatus-2.10.0-r2 [new file with mode: 0644]
net-analyzer/gnome-netstatus/files/gnome-netstatus-2.10.0-fbsd.patch [new file with mode: 0644]
net-analyzer/gnome-netstatus/gnome-netstatus-2.10.0-r2.ebuild [new file with mode: 0644]

index 7bcb2e5549c155de87c522e6afcfb286457b625e..a0b0755685c97229cfa2aaba37c70fed5db0d740 100644 (file)
@@ -1,6 +1,13 @@
 # ChangeLog for net-analyzer/gnome-netstatus
 # Copyright 2000-2005 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/net-analyzer/gnome-netstatus/ChangeLog,v 1.50 2005/09/15 21:48:19 agriffis Exp $
+# $Header: /var/cvsroot/gentoo-x86/net-analyzer/gnome-netstatus/ChangeLog,v 1.51 2005/09/20 18:39:53 flameeyes Exp $
+
+*gnome-netstatus-2.10.0-r2 (20 Sep 2005)
+
+  20 Sep 2005; Diego Pettenò <flameeyes@gentoo.org>
+  +files/gnome-netstatus-2.10.0-fbsd.patch,
+  +gnome-netstatus-2.10.0-r2.ebuild:
+  Apply patch for Gentoo/FreeBSD compatibility. Bug #103572.
 
   15 Sep 2005; Aron Griffis <agriffis@gentoo.org>
   gnome-netstatus-2.10.0-r1.ebuild:
index 26f0fb22773a38102dd11173f678fc7d9b5f5a48..8f1970e48da71ef374e9a3b6e78ae805688f9450 100644 (file)
@@ -1,9 +1,22 @@
+-----BEGIN PGP SIGNED MESSAGE-----
+Hash: SHA1
+
 MD5 c3d4b4004802c004f702ad9f0c953c4f gnome-netstatus-2.12.0.ebuild 900
-MD5 03ad2e6c4ab41244af1015a8bbb0b39f metadata.xml 158
+MD5 974946656016551b45a2d7b0d9be7e86 ChangeLog 6246
 MD5 9fc88487137b084168c8e97366c3c783 gnome-netstatus-2.10.0-r1.ebuild 791
-MD5 a487412ede9db7161a16b13cef31587d ChangeLog 6007
+MD5 03ad2e6c4ab41244af1015a8bbb0b39f metadata.xml 158
+MD5 5c018d92383163aa4e36b638afd3b60c gnome-netstatus-2.10.0-r2.ebuild 835
 MD5 97f8a858994fc26019a6d6edb1511d18 gnome-netstatus-2.10.0.ebuild 699
-MD5 1be6bc7c3c71d0d777fbef0592e7218b files/digest-gnome-netstatus-2.10.0-r1 75
 MD5 20268c12e6447722fccaf6d5178ab2b8 files/gnome-netstatus-2.10.0-amd64.patch 410
-MD5 aef863196af3a3d138148892c004c19d files/digest-gnome-netstatus-2.12.0 75
 MD5 1be6bc7c3c71d0d777fbef0592e7218b files/digest-gnome-netstatus-2.10.0 75
+MD5 88d1f80ce7cb33d57313ac602cf40ae6 files/gnome-netstatus-2.10.0-fbsd.patch 7116
+MD5 1be6bc7c3c71d0d777fbef0592e7218b files/digest-gnome-netstatus-2.10.0-r1 75
+MD5 1be6bc7c3c71d0d777fbef0592e7218b files/digest-gnome-netstatus-2.10.0-r2 75
+MD5 aef863196af3a3d138148892c004c19d files/digest-gnome-netstatus-2.12.0 75
+-----BEGIN PGP SIGNATURE-----
+Version: GnuPG v1.4.2 (GNU/Linux)
+
+iD8DBQFDMFe5j5H05b2HAEkRAnKNAJ9yDgjERujk+fioLq2NwyWtrTEMzQCeIXmB
+E/9sHC+ZPFbomcHDvGg/jzA=
+=z0KM
+-----END PGP SIGNATURE-----
diff --git a/net-analyzer/gnome-netstatus/files/digest-gnome-netstatus-2.10.0-r2 b/net-analyzer/gnome-netstatus/files/digest-gnome-netstatus-2.10.0-r2
new file mode 100644 (file)
index 0000000..46a235d
--- /dev/null
@@ -0,0 +1 @@
+MD5 b1a044cfbe3299e00d514d966d4766e8 gnome-netstatus-2.10.0.tar.bz2 510277
diff --git a/net-analyzer/gnome-netstatus/files/gnome-netstatus-2.10.0-fbsd.patch b/net-analyzer/gnome-netstatus/files/gnome-netstatus-2.10.0-fbsd.patch
new file mode 100644 (file)
index 0000000..094d375
--- /dev/null
@@ -0,0 +1,270 @@
+--- src/netstatus-iface.c.orig Tue Nov 30 18:35:23 2004
++++ src/netstatus-iface.c      Tue Nov 30 18:35:43 2004
+@@ -33,6 +33,7 @@
+ 
+ #include <libgnome/gnome-i18n.h>
+ 
++#include <sys/types.h>
+ #include <sys/ioctl.h>
+ #ifdef HAVE_SYS_SOCKIO_H
+ #include <sys/sockio.h>
+@@ -41,6 +42,7 @@
+ #include <sys/socket.h>
+ #include <net/if.h>
+ #include <net/if_arp.h>
++#include <netinet/in.h>
+ #include <arpa/inet.h>
+ #include <errno.h>
+ #include <unistd.h>
+--- src/netstatus-sysdeps.c.orig       Fri Jul 30 04:21:30 2004
++++ src/netstatus-sysdeps.c    Thu Mar  3 03:04:41 2005
+@@ -35,6 +35,16 @@
+ #include <glib.h>
+ #include <libgnome/gnome-i18n.h>
+ 
++#ifdef __FreeBSD__
++#include <sys/types.h>
++#include <sys/socket.h>
++#include <sys/ioctl.h>
++#include <net/if.h>
++#include <net/if_var.h>
++#include <dev/an/if_aironet_ieee.h>
++#include <dev/wi/if_wavelan_ieee.h>
++#endif
++
+ static inline gboolean
+ parse_stats (char    *buf,
+            int      prx_idx,
+@@ -384,6 +394,173 @@
+      }
+ }
+ 
++static inline gboolean
++wireless_getval (const char    *iface,
++               gpointer       req,
++               unsigned long  req_type,
++               char          **error)
++{
++  struct ifreq ifr;
++  int s;
++
++  memset (&ifr, 0, sizeof (ifr));
++
++  strlcpy (ifr.ifr_name, iface, sizeof (ifr.ifr_name));
++  ifr.ifr_data = (caddr_t) req;
++
++  s = socket (AF_INET, SOCK_DGRAM, 0);
++
++  if (s == -1)
++    {
++      *error = g_strdup_printf (_("Could not connect to interface, '%s'"), iface);
++      return FALSE;
++    }
++
++  if (ioctl (s, req_type, &ifr) == -1)
++    {
++      *error = g_strdup_printf (_("Could not send ioctl to interface, '%s'"), iface);
++      close (s);
++      return FALSE;
++    }
++
++  close (s);
++  return TRUE;
++}
++
++static inline char*
++get_an_data (const char *iface,
++           int        *signal_strength)
++{
++  struct an_req areq;
++  struct an_ltv_status *sts;
++#ifdef AN_RID_RSSI_MAP
++  struct an_ltv_rssi_map an_rssimap;
++#endif
++  int level;
++  char *error = NULL;
++  gboolean rssimap_valid = FALSE;
++
++#ifdef AN_RID_RSSI_MAP
++  an_rssimap.an_len = sizeof (an_rssimap);
++  an_rssimap.an_type = AN_RID_RSSI_MAP;
++  rssimap_valid = wireless_getval (iface, (gpointer) &an_rssimap, SIOCGAIRONET, &error);
++#endif
++
++  areq.an_len = sizeof (areq);
++  areq.an_type = AN_RID_STATUS;
++
++  if (!wireless_getval (iface, (gpointer) &areq, SIOCGAIRONET, &error))
++    return error;
++
++  sts = (struct an_ltv_status *)&areq;
++#ifdef AN_RID_RSSI_MAP
++  if (rssimap_valid)
++    level = (int) (an_rssimap.an_entries[sts->an_normalized_strength].an_rss_pct);
++  else
++    level = (int) (sts->an_normalized_strength);
++#else
++  level = (int) (sts->an_normalized_rssi);
++#endif
++  memcpy (signal_strength, &level, sizeof (signal_strength));
++
++  return error;
++}
++
++static inline char*
++get_wi_data (const char *iface,
++           int        *signal_strength)
++{
++  struct wi_req wreq;
++  int level;
++  char *error = NULL;
++
++  memset (&wreq, 0, sizeof (wreq));
++
++  wreq.wi_len  = WI_MAX_DATALEN;
++  wreq.wi_type = WI_RID_COMMS_QUALITY;
++
++  if (!wireless_getval (iface, (gpointer) &wreq, SIOCGWAVELAN, &error))
++    return error;
++
++  level = (int) (wreq.wi_val[1]);
++
++#ifdef WI_RID_READ_APS
++  if (signal_strength <= 0)
++    {
++      /* we fail to get signal strength by usual means, try another way */
++      static time_t last_scan;
++      static long int cached;
++      time_t now = time (NULL);
++
++      /* XXX: this is long operation, and we will scan station not often then one in 5 secs */
++      if (now > last_scan + 5)
++        {
++          struct wi_apinfo *w;
++          int nstations;
++
++          bzero ((char *)&wreq, sizeof(wreq));
++          wreq.wi_len = WI_MAX_DATALEN;
++          wreq.wi_type = WI_RID_READ_APS;
++          if (!wireless_getval (iface, (gpointer) &wreq, SIOCGWAVELAN, &error))
++            return error;
++          nstations = *(int *)wreq.wi_val;
++          if (nstations > 0)
++          {
++              w = (struct wi_apinfo *)(((char *)&wreq.wi_val) + sizeof(int));
++              signal_strength = (long int)w->signal;
++            }
++
++            cached = signal_strength;
++            last_scan = now;
++          }
++        else
++        {
++            signal_strength = cached;
++          }
++    }
++#endif
++
++  memcpy (signal_strength, &level, sizeof (signal_strength));
++
++  return error;
++}
++
++char *
++netstatus_sysdeps_read_iface_wireless_details (const char *iface,
++                                             gboolean   *is_wireless,
++                                             int        *signal_strength)
++{
++  char *error_message = NULL;
++
++  g_return_val_if_fail (iface != NULL, NULL);
++  g_return_val_if_fail (is_wireless != NULL, NULL);
++  g_return_val_if_fail (signal_strength != NULL, NULL);
++
++  if (is_wireless)
++    *is_wireless = FALSE;
++  if (signal_strength)
++    *signal_strength = 0;
++
++  if (g_strncasecmp (iface, "an", 2) && g_strncasecmp (iface, "wi", 2) &&
++    g_strncasecmp (iface, "ath", 3) && g_strncasecmp (iface, "ndis", 4) &&
++    g_strncasecmp (iface, "ipw", 3) && g_strncasecmp (iface, "iwi", 3) &&
++    g_strncasecmp (iface, "acx", 3))
++    return error_message;
++
++  if (g_strncasecmp (iface, "an", 2) == 0)
++    {
++      error_message = get_an_data (iface, signal_strength);
++      *is_wireless = TRUE;
++    }
++  else
++    {
++      error_message = get_wi_data (iface, signal_strength);
++      *is_wireless = TRUE;
++    }
++
++  return error_message;
++}
++
+ char *
+ netstatus_sysdeps_read_iface_statistics (const char *iface,
+                                        gulong     *in_packets,
+@@ -413,11 +590,11 @@
+   if (!g_shell_parse_argv (command_line, NULL, &argv, &error))
+     {
+       error_message = g_strdup_printf (_("Could not parse command line '%s': %s"),
+-                                     command_line,
+-                                     error->message);
++        command_line,
++        error->message);
+       g_error_free (error);
+       g_free (command_line);
+-      
++
+       return error_message;
+     }
+   g_free (command_line);
+@@ -456,8 +633,8 @@
+       g_io_channel_read_line (channel, &buf, NULL, NULL, NULL);
+ 
+       if (!parse_stats (buf,
+-                      prx_idx, ptx_idx, in_packets, out_packets,
+-                      brx_idx, btx_idx, in_bytes, out_bytes))
++      prx_idx, ptx_idx, in_packets, out_packets,
++      brx_idx, btx_idx, in_bytes, out_bytes))
+       {
+         error_message = g_strdup_printf (_("Could not parse interface statistics from '%s'. "
+                                            "prx_idx = %d; ptx_idx = %d; brx_idx = %d; btx_idx = %d;"),
+@@ -477,7 +654,7 @@
+     }
+   else
+     {
+-      error_message = g_strdup_printf ("Error running /usr/bin/netstat for '%s': %s", 
++      error_message = g_strdup_printf ("Error running /usr/bin/netstat for '%s': %s",
+                                      iface, error->message);
+       g_error_free (error);
+     }
+@@ -485,23 +662,6 @@
+   g_strfreev (argv);
+ 
+   return error_message;
+-}
+-
+-char *
+-netstatus_sysdeps_read_iface_wireless_details (const char *iface,
+-                                             gboolean   *is_wireless,
+-                                             int        *signal_strength)
+-{
+-  g_return_val_if_fail (iface != NULL, NULL);
+-  g_return_val_if_fail (is_wireless != NULL, NULL);
+-  g_return_val_if_fail (signal_strength_wireless != NULL, NULL);
+-
+-  if (is_wireless)
+-    *is_wireless = FALSE;
+-  if (signal_strength)
+-    *signal_strength = 0;
+-
+-  return NULL;
+ }
+ 
+ #endif /* !defined(__FreeBSD__) */
diff --git a/net-analyzer/gnome-netstatus/gnome-netstatus-2.10.0-r2.ebuild b/net-analyzer/gnome-netstatus/gnome-netstatus-2.10.0-r2.ebuild
new file mode 100644 (file)
index 0000000..fa17506
--- /dev/null
@@ -0,0 +1,33 @@
+# Copyright 1999-2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-analyzer/gnome-netstatus/gnome-netstatus-2.10.0-r2.ebuild,v 1.1 2005/09/20 18:39:54 flameeyes Exp $
+
+inherit gnome2 eutils
+
+DESCRIPTION="Network interface information applet"
+HOMEPAGE="http://www.gnome.org/"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86"
+IUSE=""
+
+RDEPEND=">=x11-libs/gtk+-2.3.1
+       >=gnome-base/libglade-2
+       >=gnome-base/libgnomeui-2.5.2
+       >=gnome-base/gnome-panel-2
+       >=gnome-base/gconf-2"
+
+DEPEND="${RDEPEND}
+       >=dev-util/intltool-0.29
+       dev-util/pkgconfig"
+
+DOCS="AUTHORS ChangeLog NEWS README TODO MAINTAINERS"
+
+src_unpack() {
+       unpack ${A}
+
+       cd ${S}
+       epatch ${FILESDIR}/${P}-amd64.patch
+       epatch ${FILESDIR}/${P}-fbsd.patch
+}