The following commit has been merged in the master branch:
commit 6dc69c63307f28eb49a130b8635dbc6353eb4f4e
Author: Guillem Jover <[email protected]>
Date: Tue Nov 2 07:44:05 2010 +0100
dpkg-deb: Coalesce similar strings
Those include the ones involving control and data members, change of
directory and temporary directory creation.
diff --git a/dpkg-deb/build.c b/dpkg-deb/build.c
index 1bc0493..e4df4ff 100644
--- a/dpkg-deb/build.c
+++ b/dpkg-deb/build.c
@@ -396,7 +396,8 @@ void do_build(const char *const *argv) {
if (!c1) {
m_dup2(p1[1],1); close(p1[0]); close(p1[1]);
if (chdir(directory)) ohshite(_("failed to chdir to `%.255s'"),directory);
- if (chdir(BUILDCONTROLDIR)) ohshite(_("failed to chdir to .../DEBIAN"));
+ if (chdir(BUILDCONTROLDIR))
+ ohshite(_("failed to chdir to `%.255s'"), ".../DEBIAN");
execlp(TAR, "tar", "-cf", "-", "--format=gnu", ".", NULL);
ohshite(_("unable to execute %s (%s)"), "tar -cf", TAR);
}
@@ -405,34 +406,37 @@ void do_build(const char *const *argv) {
* our temporary file so others can't mess with it.
*/
tfbuf = path_make_temp_template("dpkg-deb");
- if ((gzfd= mkstemp(tfbuf)) == -1) ohshite(_("failed to make tmpfile
(control)"));
+ gzfd = mkstemp(tfbuf);
+ if (gzfd == -1)
+ ohshite(_("failed to make temporary file (%s)"), _("control member"));
/* make sure it's gone, the fd will remain until we close it */
- if (unlink(tfbuf)) ohshit(_("failed to unlink tmpfile (control), %s"),
- tfbuf);
+ if (unlink(tfbuf))
+ ohshit(_("failed to unlink temporary file (%s), %s"), _("control member"),
+ tfbuf);
free(tfbuf);
/* And run gzip to compress our control archive */
c2 = subproc_fork();
if (!c2) {
m_dup2(p1[0],0); m_dup2(gzfd,1); close(p1[0]); close(gzfd);
- compress_filter(&compressor_gzip, 0, 1, 9, _("control"));
+ compress_filter(&compressor_gzip, 0, 1, 9, _("control member"));
}
close(p1[0]);
subproc_wait_check(c2, "gzip -9c", 0);
subproc_wait_check(c1, "tar -cf", 0);
if (lseek(gzfd, 0, SEEK_SET))
- ohshite(_("failed to rewind tmpfile (control)"));
+ ohshite(_("failed to rewind temporary file (%s)"), _("control member"));
/* We have our first file for the ar-archive. Write a header for it to the
* package and insert it.
*/
if (oldformatflag) {
if (fstat(gzfd, &controlstab))
- ohshite(_("failed to fstat tmpfile (control)"));
+ ohshite(_("failed to stat temporary file (%s)"), _("control member"));
if (fprintf(ar, "%-8s\n%ld\n", OLDARCHIVEVERSION,
(long)controlstab.st_size) == EOF)
werr(debar);
- fd_fd_copy(gzfd, fileno(ar), -1, _("control"));
+ fd_fd_copy(gzfd, fileno(ar), -1, _("control member"));
} else {
const char deb_magic[] = ARCHIVEVERSION "\n";
@@ -448,10 +452,13 @@ void do_build(const char *const *argv) {
if (!oldformatflag) {
close(gzfd);
tfbuf = path_make_temp_template("dpkg-deb");
- if ((gzfd= mkstemp(tfbuf)) == -1) ohshite(_("failed to make tmpfile
(data)"));
+ gzfd = mkstemp(tfbuf);
+ if (gzfd == -1)
+ ohshite(_("failed to make temporary file (%s)"), _("data member"));
/* make sure it's gone, the fd will remain until we close it */
- if (unlink(tfbuf)) ohshit(_("failed to unlink tmpfile (data), %s"),
- tfbuf);
+ if (unlink(tfbuf))
+ ohshit(_("failed to unlink temporary file (%s), %s"), _("data member"),
+ tfbuf);
free(tfbuf);
}
/* Fork off a tar. We will feed it a list of filenames on stdin later.
@@ -474,7 +481,7 @@ void do_build(const char *const *argv) {
close(p1[1]);
m_dup2(p2[0],0); close(p2[0]);
m_dup2(oldformatflag ? fileno(ar) : gzfd,1);
- compress_filter(compressor, 0, 1, compress_level, _("data"));
+ compress_filter(compressor, 0, 1, compress_level, _("data member"));
}
close(p2[0]);
/* All the pipes are set, now lets run find, and start feeding
@@ -499,7 +506,8 @@ void do_build(const char *const *argv) {
add_to_filist(&symlist, &symlist_end, fi);
else {
if (write(p1[1], fi->fn, strlen(fi->fn)+1) ==- 1)
- ohshite(_("failed to write filename to tar pipe (data)"));
+ ohshite(_("failed to write filename to tar pipe (%s)"),
+ _("data member"));
file_info_free(fi);
}
close(p3[0]);
@@ -507,7 +515,7 @@ void do_build(const char *const *argv) {
for (fi= symlist;fi;fi= fi->next)
if (write(p1[1], fi->fn, strlen(fi->fn)+1) == -1)
- ohshite(_("failed to write filename to tar pipe (data)"));
+ ohshite(_("failed to write filename to tar pipe (%s)"), _("data
member"));
/* All done, clean up wait for tar and gzip to finish their job */
close(p1[1]);
free_filist(symlist);
@@ -519,7 +527,8 @@ void do_build(const char *const *argv) {
sprintf(datamember, "%s%s", DATAMEMBER, compressor->extension);
- if (lseek(gzfd,0,SEEK_SET)) ohshite(_("failed to rewind tmpfile (data)"));
+ if (lseek(gzfd, 0, SEEK_SET))
+ ohshite(_("failed to rewind temporary file (%s)"), _("data member"));
dpkg_ar_member_put_file(debar, fileno(ar), datamember, gzfd);
}
diff --git a/dpkg-deb/info.c b/dpkg-deb/info.c
index d0621a5..fb662f8 100644
--- a/dpkg-deb/info.c
+++ b/dpkg-deb/info.c
@@ -76,7 +76,7 @@ static void info_prepare(const char *const **argvp,
dbuf = mkdtemp(path_make_temp_template("dpkg-deb"));
if (!dbuf)
- ohshite(_("failed to create temporary directory"));
+ ohshite(_("unable to create temporary directory"));
*directoryp= dbuf;
push_cleanup(cu_info_prepare, -1, NULL, 0, 1, (void *)dbuf);
@@ -103,7 +103,7 @@ static void info_spew(const char *debar, const char
*directory,
fd = open(controlfile.buf, O_RDONLY);
if (fd >= 0) {
- fd_fd_copy(fd, 1, -1, _("info_spew"));
+ fd_fd_copy(fd, 1, -1, _("control file '%s'"), controlfile.buf);
close(fd);
} else if (errno == ENOENT) {
fprintf(stderr,
--
dpkg's main repository
--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]