|
|
@@ -252,12 +252,8 @@ void do_build(const char *const *argv) {
|
|
|
}
|
|
|
|
|
|
if (lseek(gzfd,0,SEEK_SET)) ohshite(_("failed to rewind tmpfile (control)"));
|
|
|
- if (!(c3= m_fork())) {
|
|
|
- m_dup2(gzfd,0); m_dup2(fileno(ar),1);
|
|
|
- execlp(CAT,"cat",(char*)0); ohshite(_("failed to exec cat (control)"));
|
|
|
- }
|
|
|
- waitsubproc(c3,"cat (control)",0);
|
|
|
-
|
|
|
+ do_fd_copy(gzfd, fileno(ar), _("control"));
|
|
|
+
|
|
|
if (!oldformatflag) {
|
|
|
fclose(gz);
|
|
|
if ((gzfd= mkstemp(tfbuf)) == -1) ohshite(_("failed to make tmpfile (data)"));
|
|
|
@@ -270,23 +266,42 @@ void do_build(const char *const *argv) {
|
|
|
strcpy(tfbuf,envbuf);
|
|
|
strcat(tfbuf,"/dpkg.XXXXXX");
|
|
|
}
|
|
|
+ m_pipe(p1);
|
|
|
+ if (!(c3= m_fork())) {
|
|
|
+ m_dup2(p1[1],1); close(p1[0]); close(p1[1]);
|
|
|
+ if (chdir(directory)) ohshite(_("failed to chdir to `%.255s'"),directory);
|
|
|
+ execlp(SAFEFILELIST,"dpkg-deb-filelist",(char*)0);
|
|
|
+ ohshite(_("failed to exec dpkg-deb-filelist"));
|
|
|
+ }
|
|
|
+ close(p1[1]);
|
|
|
m_pipe(p2);
|
|
|
if (!(c4= m_fork())) {
|
|
|
- m_dup2(p2[1],1); close(p2[0]); close(p2[1]);
|
|
|
+ m_dup2(p2[1],1); m_dup2(p1[0],0); close(p2[0]); close(p2[1]);
|
|
|
if (chdir(directory)) ohshite(_("failed to chdir to `%.255s'"),directory);
|
|
|
- execlp(TAR,"tar","--exclude",BUILDCONTROLDIR,"-cf","-",".",(char*)0);
|
|
|
+ execlp(TAR,"tar","--no-recursion", "--exclude",BUILDCONTROLDIR,"-T","-","-cf","-",(char*)0);
|
|
|
ohshite(_("failed to exec tar --exclude"));
|
|
|
}
|
|
|
close(p2[1]);
|
|
|
+ close(p1[0]);
|
|
|
if (!(c5= m_fork())) {
|
|
|
+ char *combuf;
|
|
|
m_dup2(p2[0],0); close(p2[0]);
|
|
|
m_dup2(oldformatflag ? fileno(ar) : gzfd,1);
|
|
|
- execlp(GZIP,"gzip","-9c",(char*)0);
|
|
|
+ combuf = strdup("-9c");
|
|
|
+ if(compression != NULL) {
|
|
|
+ if(*compression = '0') {
|
|
|
+ do_fd_copy(0, 1, _("no compression copy loop"));
|
|
|
+ exit(0);
|
|
|
+ }
|
|
|
+ combuf[1] = *compression;
|
|
|
+ }
|
|
|
+ execlp(GZIP,"gzip",combuf,(char*)0);
|
|
|
ohshite(_("failed to exec gzip -9c from tar --exclude"));
|
|
|
}
|
|
|
close(p2[0]);
|
|
|
waitsubproc(c5,"gzip -9c from tar --exclude",0);
|
|
|
waitsubproc(c4,"tar --exclude",0);
|
|
|
+ waitsubproc(c3,"dpkg-deb-filelist",0);
|
|
|
if (!oldformatflag) {
|
|
|
if (fstat(gzfd,&datastab)) ohshite("_(failed to fstat tmpfile (data))");
|
|
|
if (fprintf(ar,
|
|
|
@@ -298,11 +313,7 @@ void do_build(const char *const *argv) {
|
|
|
werr(debar);
|
|
|
|
|
|
if (lseek(gzfd,0,SEEK_SET)) ohshite(_("failed to rewind tmpfile (data)"));
|
|
|
- if (!(c3= m_fork())) {
|
|
|
- m_dup2(gzfd,0); m_dup2(fileno(ar),1);
|
|
|
- execlp(CAT,"cat",(char*)0); ohshite(_("failed to exec cat (data)"));
|
|
|
- }
|
|
|
- waitsubproc(c3,"cat (data)",0);
|
|
|
+ do_fd_copy(gzfd, fileno(ar), _("data"));
|
|
|
|
|
|
if (datastab.st_size & 1)
|
|
|
if (putc('\n',ar) == EOF)
|