From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 9A9A7138334 for ; Sat, 28 Sep 2019 13:06:11 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id D40CDE08C4; Sat, 28 Sep 2019 13:06:10 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id BCB62E08C4 for ; Sat, 28 Sep 2019 13:06:10 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id D539B34B6A0 for ; Sat, 28 Sep 2019 13:06:09 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 266137E7 for ; Sat, 28 Sep 2019 13:06:08 +0000 (UTC) From: "Fabian Groffen" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Fabian Groffen" Message-ID: <1569675913.03912c73fb68cdfe6f45f26fc4f5efd099e41262.grobian@gentoo> Subject: [gentoo-commits] proj/portage-utils:master commit in: / X-VCS-Repository: proj/portage-utils X-VCS-Files: qpkg.c X-VCS-Directories: / X-VCS-Committer: grobian X-VCS-Committer-Name: Fabian Groffen X-VCS-Revision: 03912c73fb68cdfe6f45f26fc4f5efd099e41262 X-VCS-Branch: master Date: Sat, 28 Sep 2019 13:06:08 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: a14a9798-90a6-4cf4-8c62-7d80d66c8d38 X-Archives-Hash: 1c3101ac78380e5ad75fd7947c83a72a commit: 03912c73fb68cdfe6f45f26fc4f5efd099e41262 Author: Fabian Groffen gentoo org> AuthorDate: Sat Sep 28 13:05:13 2019 +0000 Commit: Fabian Groffen gentoo org> CommitDate: Sat Sep 28 13:05:13 2019 +0000 URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=03912c73 qpkg: fix tbz2 xpak generation The xpak footer was missing causing files not to contain their metadata (even though present in the file). Signed-off-by: Fabian Groffen gentoo.org> qpkg.c | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/qpkg.c b/qpkg.c index 85e0940..0ac6e92 100644 --- a/qpkg.c +++ b/qpkg.c @@ -105,12 +105,11 @@ qpkg_clean_dir(char *dirp, set *vdb) if ((st.st_size / KILOBYTE) > 1000) disp_units = MEGABYTE; num_all_bytes += st.st_size; - qprintf(" %s[%s%s %3s %s %s%s]%s %s%s/%s%s\n", - DKBLUE, NORM, GREEN, + qprintf(" %s[%s %3s %s %s] %s%s%s\n", + DKBLUE, GREEN, make_human_readable_str(st.st_size, 1, disp_units), - disp_units == MEGABYTE ? "M" : "K", - NORM, DKBLUE, NORM, CYAN, - basename(dirp), fnames[i]->d_name, NORM); + disp_units == MEGABYTE ? "MiB" : "KiB", + DKBLUE, BLUE, fnames[i]->d_name, NORM); } if (!pretend) unlink(buf); @@ -211,6 +210,7 @@ qpkg_make(depend_atom *atom) char filelist[BUFSIZE + 32]; char tbz2[BUFSIZE + 32]; size_t buflen; + size_t xpaksize; char *buf; int i; char *xpak_argv[2]; @@ -286,12 +286,25 @@ qpkg_make(depend_atom *atom) } pclose(fp); + /* get offset where xpak will start */ + stat(tbz2, &st); + xpaksize = st.st_size; + snprintf(buf, buflen, "%s/%s/%s", portvdb, atom->CATEGORY, atom_to_pvr(atom)); xpak_argv[0] = buf; xpak_argv[1] = NULL; xpak_create(AT_FDCWD, tbz2, 1, xpak_argv, 1, verbose); + stat(tbz2, &st); + + /* save tbz2 tail: OOOOSTOP */ + fp = fopen(tbz2, "a"); + WRITE_BE_INT32(buf, st.st_size - xpaksize); + fwrite(buf, 1, 4, fp); + fwrite("STOP", 1, 4, fp); + fclose(fp); + unlink(filelist); snprintf(buf, buflen, "%s/%s.tbz2", qpkg_bindir, atom_to_pvr(atom));