Gentoo Archives: gentoo-commits

From: "Fabian Groffen (grobian)" <grobian@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] portage r10283 - in main/branches/prefix: . src
Date: Sat, 10 May 2008 09:37:13
Message-Id: E1JulVt-0001Vm-RW@stork.gentoo.org
1 Author: grobian
2 Date: 2008-05-10 09:37:08 +0000 (Sat, 10 May 2008)
3 New Revision: 10283
4
5 Removed:
6 main/branches/prefix/src/tbz2tool.c
7 Modified:
8 main/branches/prefix/configure.in
9 main/branches/prefix/src/Makefile.am
10 Log:
11 Progressively nuke tbz2tool, per bug #220701, comment #4.
12
13 Modified: main/branches/prefix/configure.in
14 ===================================================================
15 --- main/branches/prefix/configure.in 2008-05-10 08:48:15 UTC (rev 10282)
16 +++ main/branches/prefix/configure.in 2008-05-10 09:37:08 UTC (rev 10283)
17 @@ -149,15 +149,6 @@
18 ]
19 )
20
21 -AC_ARG_ENABLE(tbz2tool,
22 -AC_HELP_STRING([--enable-tbz2tool],[build tbz2tool, tool for creating binpkgs (default yes)]),
23 -[case "${enableval}" in
24 - yes) enable_tbz2tool=true;;
25 - no) enable_tbz2tool=false;;
26 - *) AC_MSG_ERROR(bad value ${enableval} for --enable-tbz2tool);;
27 -esac],
28 -[enable_tbz2tool=true])
29 -
30 AC_ARG_ENABLE(just-compiled-sources,
31 AC_HELP_STRING([--enable-just-compiled-sources],[install just the bytecode, not the sources (default no)]),
32 [case "${enableval}" in
33 @@ -250,7 +241,6 @@
34 AC_SUBST(DEFAULT_PATH)
35 AC_SUBST(PORTAGE_BASE,['${exec_prefix}/lib/portage'])
36 AM_CONDITIONAL(INSTALL_PYTHON_SOURCES, test x$enable_py_sources = xtrue)
37 -AM_CONDITIONAL(BUILD_TBZ2TOOL, test x$enable_tbz2tool = xtrue)
38
39 AC_MSG_CHECKING([for a list of variables known by configure])
40 pt_configvars=`sed -n -e "/^ac_subst_vars='/,/'$/p" ${srcdir}/configure | sed -e "s/^ac_subst_vars='//" -e "s/'$//"`
41
42 Modified: main/branches/prefix/src/Makefile.am
43 ===================================================================
44 --- main/branches/prefix/src/Makefile.am 2008-05-10 08:48:15 UTC (rev 10282)
45 +++ main/branches/prefix/src/Makefile.am 2008-05-10 09:37:08 UTC (rev 10283)
46 @@ -2,12 +2,7 @@
47
48 bin_PROGRAMS = chpathtool
49 bindir = @PORTAGE_BASE@/bin
50 -if BUILD_TBZ2TOOL
51 -bin_PROGRAMS += tbz2tool
52 -endif
53
54 chpathtool_SOURCES = chpathtool.c
55
56 -tbz2tool_SOURCES = tbz2tool.c
57 -
58 MAINTAINERCLEANFILES = Makefile.in
59
60 Deleted: main/branches/prefix/src/tbz2tool.c
61 ===================================================================
62 --- main/branches/prefix/src/tbz2tool.c 2008-05-10 08:48:15 UTC (rev 10282)
63 +++ main/branches/prefix/src/tbz2tool.c 2008-05-10 09:37:08 UTC (rev 10283)
64 @@ -1,228 +0,0 @@
65 -/* $Id$ */
66 -
67 -#include <stdio.h>
68 -#include <stdlib.h>
69 -#include <sys/types.h>
70 -#include <sys/stat.h>
71 -#include <unistd.h>
72 -#include <errno.h>
73 -#include <string.h>
74 -
75 -/*buffered reading/writing size*/
76 -#define BUFLEN 262144
77 -char *myname="tbz2tool";
78 -struct stat *mystat=NULL;
79 -void *mybuf;
80 -FILE *datafile, *dbfile, *outfile, *infile;
81 -unsigned char endbuf[8];
82 -long seekto,insize;
83 -
84 -int exists(const char *myfile) {
85 - int result;
86 - result=stat(myfile,mystat);
87 - if (result==-1)
88 - return 0;
89 - return 1;
90 -}
91 -
92 -void writefile(FILE *src, FILE *dest) {
93 - int count=1;
94 - while (count) {
95 - count=fread(mybuf, 1, BUFLEN, src);
96 - fwrite(mybuf, 1, count, dest);
97 - }
98 -}
99 -
100 -void writefileto(FILE *src, FILE *dest, int endpos) {
101 - int pos=ftell(src);
102 - int thiscount;
103 - while (pos < endpos) {
104 - /* thiscount=how much to read */
105 - thiscount=endpos-pos;
106 - if (thiscount>BUFLEN)
107 - thiscount=BUFLEN;
108 - thiscount=fread(mybuf, 1, thiscount , src);
109 - /* thiscount=how much we actually did read */
110 - if (thiscount==0)
111 - /* eof -- shouldn't happen */
112 - break;
113 - /* update internal position counter */
114 - pos+=thiscount;
115 - fwrite(mybuf, 1, thiscount, dest);
116 - }
117 -}
118 -
119 -int main(int argc, char **argv) {
120 - if ((argc==2) && (!(strcmp(argv[1],"--help"))))
121 - goto usage;
122 - if (argc!=5) {
123 - printf("%s: four arguments expected\n",myname);
124 - goto error;
125 - }
126 - if (!(mystat=(struct stat *) malloc(sizeof(struct stat))))
127 - goto memalloc;
128 -
129 - if (!(mybuf=(void *) malloc(BUFLEN))) {
130 - free(mystat);
131 - goto memalloc;
132 - }
133 -
134 - /* JOIN MODE */
135 - if (!(strcmp(argv[1],"join"))) {
136 -
137 - /* check if datafile exists */
138 - if (!(exists(argv[2]))) {
139 - printf("%s: %s doesn't exist\n",myname,argv[2]);
140 - free(mystat);
141 - goto error;
142 - }
143 -
144 - /* check if dbfile exists */
145 - if (!(exists(argv[3]))) {
146 - printf("%s: %s doesn't exist\n",myname,argv[3]);
147 - free(mystat);
148 - goto error;
149 - }
150 - /* create end buffer for later use */
151 - endbuf[0]=((mystat->st_size) & 0xff000000) >> 24;
152 - endbuf[1]=((mystat->st_size) & 0x00ff0000) >> 16;
153 - endbuf[2]=((mystat->st_size) & 0x0000ff00) >> 8;
154 - endbuf[3]=(mystat->st_size) & 0x000000ff;
155 - endbuf[4]='S';
156 - endbuf[5]='T';
157 - endbuf[6]='O';
158 - endbuf[7]='P';
159 -
160 - /* if outfile exists, unlink first (safer) */
161 - if (exists(argv[4]))
162 - unlink(argv[4]);
163 -
164 - /* open datafile for reading */
165 - if ((datafile=fopen(argv[2],"r"))==NULL) {
166 - free(mybuf);
167 - free(mystat);
168 - printf("%s: Error opening %s\n",myname,argv[2]);
169 - goto error;
170 - }
171 -
172 - /* open dbfile for reading */
173 - if ((dbfile=fopen(argv[3],"r"))==NULL) {
174 - fclose(datafile);
175 - free(mybuf);
176 - free(mystat);
177 - printf("%s: Error opening %s\n",myname,argv[3]);
178 - goto error;
179 - }
180 -
181 - /* open outfile for writing */
182 - if ((outfile=fopen(argv[4],"a"))==NULL) {
183 - fclose(dbfile);
184 - fclose(datafile);
185 - free(mybuf);
186 - free(mystat);
187 - printf("%s: Error opening %s\n",myname,argv[4]);
188 - goto error;
189 - }
190 -
191 - writefile(datafile,outfile);
192 - writefile(dbfile,outfile);
193 - fwrite(endbuf,1,8,outfile);
194 - fclose(outfile);
195 - fclose(dbfile);
196 - fclose(datafile);
197 - free(mybuf);
198 - free(mystat);
199 - exit(0);
200 -
201 - /* SPLIT MODE */
202 - } else if (!(strcmp(argv[1],"split"))) {
203 -
204 - /* check if infile exists */
205 - if (!(exists(argv[2]))) {
206 - printf("%s: %s doesn't exist\n",myname,argv[2]);
207 - free(mystat);
208 - goto error;
209 - }
210 -
211 - /* store infile size for later use */
212 -
213 - insize=mystat->st_size;
214 -
215 - /* if datafile exists, unlink first (safer) */
216 - if (exists(argv[3]))
217 - unlink(argv[3]);
218 -
219 - /* if dbfile exists, unlink first (safer) */
220 - if (exists(argv[4]))
221 - unlink(argv[4]);
222 -
223 - /* open infile for reading */
224 - if ((infile=fopen(argv[2],"r"))==NULL) {
225 - free(mybuf);
226 - free(mystat);
227 - printf("%s: Error opening %s\n",myname,argv[2]);
228 - goto error;
229 - }
230 -
231 - /* read in end buffer */
232 - fseek(infile,-8,SEEK_END);
233 - fread(endbuf,1,8,infile);
234 - /* quick end buffer read and verification */
235 - if ( (endbuf[4]!='S') || (endbuf[5]!='T') || (endbuf[6]!='O') || (endbuf[7]!='P') ) {
236 - fclose(infile);
237 - free(mybuf);
238 - free(mystat);
239 - printf("%s: %s appears to be corrupt (end buffer invalid)\n",myname,argv[2]);
240 - goto error;
241 - }
242 -
243 - seekto=0;
244 - seekto=seekto+endbuf[0]*256*256*256;
245 - seekto=seekto+endbuf[1]*256*256;
246 - seekto=seekto+endbuf[2]*256;
247 - seekto=seekto+endbuf[3];
248 -
249 - /* open datafile for writing */
250 - if ((datafile=fopen(argv[3],"a"))==NULL) {
251 - fclose(infile);
252 - free(mybuf);
253 - free(mystat);
254 - printf("%s: Error opening %s\n",myname,argv[3]);
255 - goto error;
256 - }
257 -
258 - /* open dbfile for writing */
259 - if ((dbfile=fopen(argv[4],"a"))==NULL) {
260 - fclose(datafile);
261 - fclose(infile);
262 - free(mybuf);
263 - free(mystat);
264 - printf("%s: Error opening %s\n",myname,argv[4]);
265 - goto error;
266 - }
267 -
268 - rewind(infile);
269 - writefileto(infile,datafile,insize-(seekto+8));
270 - fseek(infile,-(seekto+8),SEEK_END);
271 - writefileto(infile,dbfile,insize-8);
272 - fclose(infile);
273 - fclose(dbfile);
274 - fclose(datafile);
275 - free(mybuf);
276 - free(mystat);
277 - exit(0);
278 -
279 - } else {
280 - free(mybuf);
281 - free(mystat);
282 - goto usage;
283 - }
284 -
285 - usage:
286 - printf("Usage: %s join DATAFILE DBFILE OUTFILE (datafile + dbfile -> outfile)\n %s split INFILE DATAFILE DBFILE (infile -> datafile + dbfile)\n",myname,myname);
287 -error:
288 - exit(1);
289 -memalloc:
290 - printf("%s: memory allocation error\n",myname);
291 - exit(2);
292 -}
293
294 --
295 gentoo-commits@l.g.o mailing list