From owner-freebsd-ports Sat Dec 21 20:30:34 2002 Delivered-To: freebsd-ports@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id BC68737B405 for ; Sat, 21 Dec 2002 20:30:05 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id DFE1C43EEA for ; Sat, 21 Dec 2002 20:30:04 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.6/8.12.6) with ESMTP id gBM4U3NS062860 for ; Sat, 21 Dec 2002 20:30:03 -0800 (PST) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.6/8.12.6/Submit) id gBM4U3WX062859; Sat, 21 Dec 2002 20:30:03 -0800 (PST) Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id AE1AC37B401 for ; Sat, 21 Dec 2002 20:27:31 -0800 (PST) Received: from mailout10.sul.t-online.com (mailout10.sul.t-online.com [194.25.134.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7A11643EDA for ; Sat, 21 Dec 2002 20:27:30 -0800 (PST) (envelope-from osgene@web.de) Received: from fwd06.sul.t-online.de by mailout10.sul.t-online.com with smtp id 18Pxi4-0001D9-01; Sun, 22 Dec 2002 05:27:28 +0100 Received: from badger.home (520018328195-0001@[80.132.113.162]) by fmrl06.sul.t-online.com with esmtp id 18Pxi0-02F8kKC; Sun, 22 Dec 2002 05:27:24 +0100 Received: (from gene@localhost) by badger.home (8.12.6/8.12.6) id gBM4Rf6T065204; Sun, 22 Dec 2002 05:27:41 +0100 (CET) (envelope-from gene) Message-Id: <200212220427.gBM4Rf6T065204@badger.home> Date: Sun, 22 Dec 2002 05:27:41 +0100 (CET) From: osgene@web.de Reply-To: osgene@web.de To: FreeBSD-gnats-submit@FreeBSD.org Cc: pelle@fukt.bth.se X-Send-Pr-Version: 3.113 Subject: ports/46457: Update x11/temperature.app to 1.4 and use FreeBSDish libfetch instead of wget Sender: owner-freebsd-ports@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >Number: 46457 >Category: ports >Synopsis: Update x11/temperature.app to 1.4 and use FreeBSDish libfetch instead of wget >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Sat Dec 21 20:30:02 PST 2002 >Closed-Date: >Last-Modified: >Originator: Eugene Ossintsev >Release: FreeBSD 4.7-STABLE i386 >Organization: >Environment: >Description: Update temperature.app to the latest release 1.4. Become independent from wget utility using the FreeBSD fetch library instead. Fix an installation error with wrong permissions for documentation directory containing README. >How-To-Repeat: >Fix: diff -ruN temperature.app.orig/Makefile temperature.app/Makefile --- temperature.app.orig/Makefile Sun Jul 22 07:39:28 2001 +++ temperature.app/Makefile Sun Dec 22 05:07:06 2002 @@ -6,24 +6,21 @@ # PORTNAME= temperature.app -PORTVERSION= 1.3 +PORTVERSION= 1.4 CATEGORIES= x11 windowmaker MASTER_SITES= http://www.fukt.bth.se/~per/temperature/ DISTNAME= Temperature.app-${PORTVERSION} MAINTAINER= pelle@fukt.bth.se -RUN_DEPENDS= wget:${PORTSDIR}/ftp/wget - USE_XPM= yes USE_X_PREFIX= yes do-install: @${INSTALL_PROGRAM} ${WRKSRC}/Temperature.app ${PREFIX}/bin .ifndef(NOPORTDOCS) - @${INSTALL} -d -o ${SHAREOWN} -g ${SHAREGRP} -m ${SHAREMODE} \ - ${PREFIX}/share/doc/${PORTNAME} - @${INSTALL_DATA} ${WRKSRC}/README ${PREFIX}/share/doc/${PORTNAME} + @${MKDIR} ${DOCSDIR} + @${INSTALL_DATA} ${WRKSRC}/README ${DOCSDIR} .endif .include diff -ruN temperature.app.orig/distinfo temperature.app/distinfo --- temperature.app.orig/distinfo Sun Jul 22 07:39:28 2001 +++ temperature.app/distinfo Sun Dec 22 04:10:33 2002 @@ -1 +1 @@ -MD5 (Temperature.app-1.3.tar.gz) = ee47fab0f27c8f5e702f95179ff6e9d8 +MD5 (Temperature.app-1.4.tar.gz) = fefedf57fb7ab799202b10a07bec2806 diff -ruN temperature.app.orig/files/patch-Makefile temperature.app/files/patch-Makefile --- temperature.app.orig/files/patch-Makefile Sun Jul 22 07:39:28 2001 +++ temperature.app/files/patch-Makefile Sun Dec 22 03:38:39 2002 @@ -1,5 +1,5 @@ ---- Makefile.orig Mon Jun 25 12:03:07 2001 -+++ Makefile Sun Jul 1 20:47:36 2001 +--- Makefile.orig Sun Dec 22 03:37:52 2002 ++++ Makefile Sun Dec 22 03:37:34 2002 @@ -3,12 +3,12 @@ # @@ -13,7 +13,7 @@ -CXXFLAGS += -Wall -pedantic -fno-rtti -fno-exceptions -O2 -I/usr/X11R6/include -LDFLAGS += -L/usr/X11R6/lib -lXpm -lXext -lX11 +CXXFLAGS += -Wall -pedantic -fno-rtti -fno-exceptions -I$(X11BASE)/include -+LDFLAGS += -L$(X11BASE)/lib -lXpm -lXext -lX11 ++LDFLAGS += -L$(X11BASE)/lib -lXpm -lXext -lX11 -lfetch OBJECTS = Main.o Temperature.o Xpm.o diff -ruN temperature.app.orig/files/patch-README temperature.app/files/patch-README --- temperature.app.orig/files/patch-README Thu Jan 1 01:00:00 1970 +++ temperature.app/files/patch-README Sun Dec 22 02:37:13 2002 @@ -0,0 +1,23 @@ +--- README.orig Sun Dec 22 02:36:22 2002 ++++ README Sun Dec 22 01:58:16 2002 +@@ -10,7 +10,7 @@ + -------------------------------------------------------------- + Temperature.app is a Window Maker dock application which + fetches local temperature information every 15 minutes from +-ftp://weather.noaa.gov and displays it (in Celsius or Fahrenheit). ++http://weather.noaa.gov and displays it (in Celsius or Fahrenheit). + + + Hints +@@ -21,10 +21,7 @@ + If successful the led will stop blinking and go green. + If unsuccessful the led will stop blinking and go red. + Also, a error message will be printed in the console, +- describing what went wrong. If the error message is +- "wget failed" and you can't figure out why, try using +- option -V, which will cause wget to be run in verbose +- mode. ++ describing what went wrong. + + Bugs + -------------------------------------------------------------- diff -ruN temperature.app.orig/files/patch-Temperature.cc temperature.app/files/patch-Temperature.cc --- temperature.app.orig/files/patch-Temperature.cc Thu Jan 1 01:00:00 1970 +++ temperature.app/files/patch-Temperature.cc Sun Dec 22 02:38:18 2002 @@ -0,0 +1,148 @@ +--- Temperature.cc.orig Sun Dec 22 02:36:30 2002 ++++ Temperature.cc Sun Dec 22 02:28:29 2002 +@@ -19,25 +19,23 @@ + // USA. + // + +-#include +-#include +-#include + #include + #include + #include + #include + #include +-#include +-#include + #include + #include +-#include ++#include ++#include + #include "Xpm.h" + #include "Temperature.h" + + #include "pixmaps/main.xpm" + #include "pixmaps/redlight.xpm" + ++const int MAX_LINE = 1024; ++ + volatile static ChildStatus childStatus; + + static void catchBrokenPipe(int sig) +@@ -61,7 +59,7 @@ + } + + if (childStatus == ChildError) { +- cerr << APPNAME << ": could not fetch temperature (wget failed), try option -V for more information" << endl; ++ cerr << APPNAME << ": could not fetch temperature" << endl; + } + } + +@@ -82,7 +80,6 @@ + mFahrenheit = false; + mShowTime = false; + mTime12HourFormat = false; +- mVerbose = false; + + // Parse command line + if (argc>1) { +@@ -119,11 +116,6 @@ + i++; + } + +- // Verbose +- else if (!strcmp(argv[i], "-V")) { +- mVerbose = true; +- } +- + // Instance name + else if (!strcmp(argv[i], "-n")) { + checkArgument(argv, argc, i); +@@ -237,7 +229,6 @@ + << " -s set station id (ICAO Location Indicator)" << endl + << " -t 12|24 display time of temperature observation (12 or 24 hour format)" << endl + << " -f display degrees in Fahrenheit" << endl +- << " -V display verbose messages from wget" << endl + << " -n set client instance name" << endl + << " -d set display" << endl + << " -v print version and exit" << endl +@@ -333,9 +324,8 @@ + sprintf(mTime, "%d:%.2d", hour, min); + } + +-bool Temperature::updateTemperture(ifstream& file) ++bool Temperature::updateTemperture(strstream& file) + { +- const int MAX_LINE = 1024; + char buffer[MAX_LINE]; + + if (mShowTime) { +@@ -398,26 +388,30 @@ + int counter = 0; + while(1) { + if (counter <= 0) { +- char tmpFile[sizeof(TMP_FILE)] = TMP_FILE; +- int fd = mkstemp(tmpFile); +- if (fd == -1) { +- cerr << APPNAME << ": could not create temporary file " << tmpFile << ": " << strerror(errno) << endl; +- exit(1); +- } +- close(fd); +- + counter = UPDATE_INTERVAL; + childStatus = ChildRunning; + signal(SIGCHLD, catchChildExit); + showLed(true); ++ int pfd[2]; ++ if (pipe(pfd) == -1) { ++ cerr << APPNAME << ": could not fetch temperature (pipe() failed)" << endl; ++ continue; ++ } + int pid = fork(); + if (pid == 0) { +- const char* verbose = (mVerbose ? "--verbose" : "--quiet"); + char* URL = new char[strlen(METAR_URL) + strlen(mStationId) + 1]; + sprintf(URL, METAR_URL, mStationId); +- execlp("wget", "wget", "--cache=off", "--tries=0", verbose, "-O", tmpFile, URL, 0); +- cerr << APPNAME << ": could not fetch temperature (wget not found in $PATH)" << endl; +- remove(tmpFile); ++ FILE *file = fetchGetURL(URL, "p"); ++ if (file == NULL) ++ exit(-1); ++ char buf[MAX_LINE]; ++ close(pfd[0]); ++ for (;;) { ++ if (fgets(buf, sizeof(buf), file) == NULL) ++ break; ++ write(pfd[1], buf, sizeof(buf)); ++ } ++ close(pfd[1]); + exit(0); + } else if (pid == -1) { + cerr << APPNAME << ": could not fetch temperature (fork() failed)" << endl; +@@ -430,15 +424,17 @@ + } + showLed(true); + if (childStatus == ChildDone) { +- ifstream file(tmpFile); +- if (file) { +- if (updateTemperture(file)) { +- showLed(false); +- } +- file.close(); ++ char buf[MAX_LINE]; ++ close(pfd[1]); ++ strstream s; ++ while (read(pfd[0], buf, sizeof(buf)) > 0) { ++ s << buf; ++ } ++ close(pfd[0]); ++ if (updateTemperture(s)) { ++ showLed(false); + } + } +- remove(tmpFile); + } + } else { + counter--; diff -ruN temperature.app.orig/files/patch-Temperature.h temperature.app/files/patch-Temperature.h --- temperature.app.orig/files/patch-Temperature.h Thu Jan 1 01:00:00 1970 +++ temperature.app/files/patch-Temperature.h Sun Dec 22 02:37:42 2002 @@ -0,0 +1,36 @@ +--- Temperature.h.orig Sun Dec 22 02:36:36 2002 ++++ Temperature.h Sun Dec 22 02:29:29 2002 +@@ -22,7 +22,7 @@ + #ifndef _TEMPERATURE_H_ + #define _TEMPERATURE_H_ + +-#include ++#include + #include + + #define APPNAME "Temperature.app" +@@ -40,7 +40,6 @@ + #define UNIT_FONT "-*-helvetica-medium-r-*-*-12-*-*-*-*-*-*-*" + #define LED_X 57 + #define LED_Y 59 +-#define TMP_FILE "/tmp/temperature.app-XXXXXX" + + enum ChildStatus + { +@@ -63,7 +62,7 @@ + void showErrorLed(bool show); + void calcTimeDiff(); + void setTime(char* utcTime); +- bool updateTemperture(ifstream& file); ++ bool updateTemperture(strstream& file); + void showLed(bool show); + + Display* mDisplay; +@@ -80,7 +79,6 @@ + bool mFahrenheit; + bool mShowTime; + bool mTime12HourFormat; +- bool mVerbose; + }; + + #endif diff -ruN temperature.app.orig/pkg-descr temperature.app/pkg-descr --- temperature.app.orig/pkg-descr Sun May 27 21:03:50 2001 +++ temperature.app/pkg-descr Sun Dec 22 01:55:51 2002 @@ -1,6 +1,6 @@ Temperature.app is a Window Maker dock application which fetches local temperature information every 15 minutes from -ftp://weather.noaa.gov and displays it (in Celsius or Fahrenheit). +http://weather.noaa.gov and displays it (in Celsius or Fahrenheit). WWW: http://www.fukt.bth.se/~per/temperature/ >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-ports" in the body of the message