From owner-freebsd-ports-bugs@FreeBSD.ORG Tue Mar 22 09:53:07 2011 Return-Path: Delivered-To: freebsd-ports-bugs@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3AC03106566C; Tue, 22 Mar 2011 09:53:07 +0000 (UTC) (envelope-from shurd@sasktel.net) Received: from neutron.sasknet.sk.ca (neutron.sasknet.sk.ca [142.165.20.180]) by mx1.freebsd.org (Postfix) with ESMTP id 0158D8FC25; Tue, 22 Mar 2011 09:53:06 +0000 (UTC) Received: from pps.filterd (neutron [127.0.0.1]) by neutron.sasknet.sk.ca (8.14.3/8.14.3) with SMTP id p2M9dHwR003611; Tue, 22 Mar 2011 03:39:17 -0600 Received: from bgmpomr1.sasknet.sk.ca (bgmpOMR1.sasknet.sk.ca [142.165.72.22]) by neutron.sasknet.sk.ca with ESMTP id v6pbcy524-1; Tue, 22 Mar 2011 03:39:17 -0600 Received: from stephen.hurd.local (outgoing.bbsdev.net [76.202.204.46]) by bgmpomr1.sasknet.sk.ca (SaskTel eMessaging Service) with ESMTPA id <0LIG00EE7DHGK310@bgmpomr1.sasknet.sk.ca>; Tue, 22 Mar 2011 03:39:17 -0600 (CST) Date: Tue, 22 Mar 2011 02:39:15 -0700 From: Stephen Hurd In-reply-to: <201103220440.p2M4e03i051801@freefall.freebsd.org> To: FreeBSD-gnats-submit@FreeBSD.org, freebsd-ports-bugs@FreeBSD.org Message-id: <4D886E43.6000201@sasktel.net> MIME-version: 1.0 Content-type: multipart/mixed; boundary="Boundary_(ID_d+jmEuefIMMOrp7/KsZHRg)" References: <201103220440.p2M4e03i051801@freefall.freebsd.org> User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.9.1.15) Gecko/20101130 SeaMonkey/2.0.10 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.2.15, 1.0.148, 0.0.0000 definitions=2011-03-22_04:2011-03-16, 2011-03-22, 1970-01-01 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=default score=0 spamscore=0 ipscore=0 suspectscore=8 phishscore=0 bulkscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx engine=5.0.0-1012030000 definitions=main-1103220017 Cc: Subject: Re: ports/155771: [Maintainer Update] ports-mgmt/pkg_cleanup broken on -CURRENT X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Mar 2011 09:53:07 -0000 This is a multi-part message in MIME format. --Boundary_(ID_d+jmEuefIMMOrp7/KsZHRg) Content-type: text/plain; charset=ISO-8859-1; format=flowed Content-transfer-encoding: 7BIT FreeBSD-gnats-submit@FreeBSD.org wrote: > Synopsis: [Maintainer Update] ports-mgmt/pkg_cleanup broken on -CURRENT Updated patch attached... this one works with the new libdialog rather than simply marking as broken. --Boundary_(ID_d+jmEuefIMMOrp7/KsZHRg) Content-type: text/plain; name=pkg_cleanup-patch.txt Content-transfer-encoding: 7BIT Content-disposition: attachment; filename=pkg_cleanup-patch.txt diff -ur ports-mgmt/pkg_cleanup.orig/Makefile ports-mgmt/pkg_cleanup/Makefile --- ports-mgmt/pkg_cleanup.orig/Makefile 2011-03-18 20:44:09.000000000 -0700 +++ ports-mgmt/pkg_cleanup/Makefile 2011-03-22 02:37:03.000000000 -0700 @@ -6,8 +6,7 @@ # PORTNAME= pkg_cleanup -PORTVERSION= 1.0 -PORTREVISION= 2 +PORTVERSION= 1.1 CATEGORIES= ports-mgmt DISTFILES= diff -ur ports-mgmt/pkg_cleanup.orig/files/Makefile ports-mgmt/pkg_cleanup/files/Makefile --- ports-mgmt/pkg_cleanup.orig/files/Makefile 2011-03-18 20:44:09.000000000 -0700 +++ ports-mgmt/pkg_cleanup/files/Makefile 2011-03-21 22:28:45.000000000 -0700 @@ -1,5 +1,6 @@ # $FreeBSD: ports/ports-mgmt/pkg_cleanup/files/Makefile,v 1.1 2008/01/04 13:28:51 pav Exp $ +LDLIBS += -lncursesw LDLIBS += -ldialog pkg_cleanup: pkg_cleanup.c diff -ur ports-mgmt/pkg_cleanup.orig/files/pkg_cleanup.c ports-mgmt/pkg_cleanup/files/pkg_cleanup.c --- ports-mgmt/pkg_cleanup.orig/files/pkg_cleanup.c 2011-03-18 20:44:09.000000000 -0700 +++ ports-mgmt/pkg_cleanup/files/pkg_cleanup.c 2011-03-22 02:32:21.000000000 -0700 @@ -15,8 +15,27 @@ #include #include +#if __FreeBSD_version < 900030 +#define OLD_DIALOG +#endif + static glob_t gl; /* A cached list of all files in /var/db/pkg */ -dialogMenuItem *menu=NULL; +#ifdef OLD_DIALOG +typedef dialogMenuItem ListItem; +#else +typedef DIALOG_LISTITEM ListItem; +#endif +ListItem *menu; +#ifdef OLD_DIALOG +#define ITEM_DATA data +#define ITEM_PROMPT prompt +#define ITEM_CHECKED aux +#else +#define ITEM_DATA help +#define ITEM_PROMPT name +#define ITEM_CHECKED state +#endif + int menulen=0; void free_menu(void) @@ -25,13 +44,13 @@ if(menu) { for(i=0; iaux) @@ -80,22 +100,23 @@ return(TRUE); return(FALSE); } +#endif /* Read +COMMENT, add to menu and blacklist */ int add_item(char *path) { - char *p; - char comment[80]; - FILE *comment_file; - char comment_path[MAXPATHLEN+1]; - dialogMenuItem *newmenu; + char *p; + char comment[80]; + FILE *file; + char newpath[MAXPATHLEN+1]; + ListItem *newmenu; if(blacklist(path,FIND)) return(0); blacklist(path,ENTER); comment[0]=0; - newmenu=(dialogMenuItem*)realloc(menu, sizeof(dialogMenuItem)*(menulen+1)); + newmenu=(ListItem *)realloc(menu, sizeof(ListItem)*(menulen+1)); if(newmenu==NULL) return(-1); menu=newmenu; @@ -104,7 +125,9 @@ if(p==NULL) /* Not possible */ return(-1); - menu[menulen].prompt=strdup(p+1); + menu[menulen].ITEM_PROMPT=strdup(p+1); + menu[menulen].ITEM_CHECKED=0; +#ifdef OLD_DIALOG menu[menulen].title=""; menu[menulen].checked=checked; menu[menulen].fire=fire; @@ -112,14 +135,16 @@ menu[menulen].lbra='['; menu[menulen].mark='X'; menu[menulen].rbra=']'; - menu[menulen].aux=0; +#else + menu[menulen].text=""; +#endif /* Read +COMMENT */ - sprintf(comment_path,"%s/+COMMENT",path); - comment_file=fopen(comment_path,"r"); - if(comment_file) { - fgets(comment, sizeof(comment), comment_file); - fclose(comment_file); + sprintf(newpath,"%s/+COMMENT",path); + file=fopen(newpath,"r"); + if(file) { + fgets(comment, sizeof(comment), file); + fclose(file); /* Remove trailing whitespace */ for(p=strchr(comment,0)-1; p>=comment; p--) { if(isspace(*p)) @@ -128,22 +153,75 @@ break; } } - menu[menulen].data=strdup(comment); + menu[menulen].ITEM_DATA=strdup(comment); menulen++; return(0); } +void do_init_dialog(void) +{ +#ifdef OLD_DIALOG + init_dialog(); + use_shadow=FALSE; +#else + init_dialog(stdin, stdout); + dialog_state.use_shadow=FALSE; +#endif +} + int display_menu(void) { int ret=0; - int maxx,maxy; + int maxx,maxy; + int curr; - init_dialog(); - use_shadow=FALSE; + do_init_dialog(); getmaxyx(stdscr, maxy, maxx); +#ifdef OLD_DIALOG if(dialog_checklist("Welcome to pkg_cleanup.", "These are the leaf packages installed on your system\nChose the packages to deinstall. F1 will display the package description.\n\n\n", maxy, maxx, maxy-11, 0-menulen, menu, NULL)) ret=-1; +#else + dialog_vars.help_button=1; + dialog_vars.item_help=1; +loop: + switch(ret=dlg_checklist("Welcome to pkg_cleanup.", "These are the leaf packages installed on your system\nChose the packages to deinstall. Help will display the package description.", maxy-1, maxx, maxy-9, menulen, menu, " X", FLAG_CHECK, &curr)) { + case DLG_EXIT_HELP: { + char *p; + char newpath[MAXPATHLEN+1]; + FILE *file; + struct stat sb; + + /* READ +DESC */ + sprintf(newpath,"/var/db/pkg/%s/+DESC",menu[curr].ITEM_PROMPT); + file=fopen(newpath, "r"); + if(file) { + if(fstat(fileno(file), &sb)==0) { + p=(char *)malloc(sb.st_size+1); + if(p) { + if(fread(p, sb.st_size, 1, file)==1) { + p[sb.st_size]=0; + dialog_vars.help_button=0; + dialog_msgbox(menu[curr].ITEM_DATA, p, maxy-4, maxx-4, TRUE); + dialog_vars.help_button=1; + } + free(p); + } + } + fclose(file); + } + goto loop; + } + case 0: + ret=0; + break; + default: + ret=-1; + break; + } + dialog_vars.help_button=0; + dialog_vars.item_help=0; +#endif end_dialog(); return(ret); } @@ -157,13 +235,38 @@ int maxx,maxy; int lastgauge=-1; int gauge; +#ifndef OLD_DIALOG + int pipepair[2]; + FILE *read_pipe; + FILE *write_pipe; +#endif - init_dialog(); + do_init_dialog(); getmaxyx(stdscr, maxy, maxx); for(p=0;p