Use our own extractor for .pax binaries
This commit is contained in:
parent
97950b5096
commit
df18a075fb
1
.gitignore
vendored
1
.gitignore
vendored
@ -339,6 +339,7 @@ paludis-*.*.*.tar.bz2
|
||||
/paludis/repositories/e/ebuild/utils/prepman
|
||||
/paludis/repositories/e/ebuild/utils/prepstrip
|
||||
/paludis/repositories/e/ebuild/utils/print_exports
|
||||
/paludis/repositories/e/ebuild/utils/unpaxinate
|
||||
/paludis/repositories/e/exndbam_repository_TEST
|
||||
/paludis/repositories/e/fetch_visitor_TEST
|
||||
/paludis/repositories/e/fix_locked_dependencies_TEST
|
||||
|
@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
# vim: set sw=4 sts=4 et :
|
||||
|
||||
# Copyright (c) 2008 Ciaran McCreesh
|
||||
# Copyright (c) 2008, 2010 Ciaran McCreesh
|
||||
#
|
||||
# This file is part of the Paludis package manager. Paludis is free software;
|
||||
# you can redistribute it and/or modify it under the terms of the GNU General
|
||||
@ -18,8 +18,15 @@
|
||||
|
||||
builtin_installbin()
|
||||
{
|
||||
echo tar jvxpf "${!PALUDIS_BINARY_DISTDIR_VARIABLE}"/${!PALUDIS_ARCHIVES_VAR} -C "${IMAGE}"/ --exclude PBIN 1>&2
|
||||
tar jvxpf "${!PALUDIS_BINARY_DISTDIR_VARIABLE}"/${!PALUDIS_ARCHIVES_VAR} -C "${IMAGE}"/ --exclude PBIN || die "Couldn't extract image"
|
||||
if [[ ${!PALUDIS_ARCHIVES_VAR%.tar.bz2} != ${!PALUDIS_ARCHIVES_VAR} ]] ; then
|
||||
echo tar jvxpf "${!PALUDIS_BINARY_DISTDIR_VARIABLE}"/${!PALUDIS_ARCHIVES_VAR} -C "${IMAGE}"/ --exclude PBIN 1>&2
|
||||
tar jvxpf "${!PALUDIS_BINARY_DISTDIR_VARIABLE}"/${!PALUDIS_ARCHIVES_VAR} -C "${IMAGE}"/ --exclude PBIN || die "Couldn't extract image"
|
||||
elif [[ ${!PALUDIS_ARCHIVES_VAR%.pax.bz2} != ${!PALUDIS_ARCHIVES_VAR} ]] ; then
|
||||
echo unpaxinate img "${!PALUDIS_BINARY_DISTDIR_VARIABLE}"/${!PALUDIS_ARCHIVES_VAR} "${IMAGE}" 1>&2
|
||||
unpaxinate img "${!PALUDIS_BINARY_DISTDIR_VARIABLE}"/${!PALUDIS_ARCHIVES_VAR} "${IMAGE}" || die "Couldn't extract image"
|
||||
else
|
||||
die "Unrecognised extension for '${!PALUDIS_ARCHIVES_VAR}'"
|
||||
fi
|
||||
}
|
||||
|
||||
generic_internal_installbin()
|
||||
|
@ -21,8 +21,16 @@ builtin_pivotbin()
|
||||
[[ ! -d "${!PALUDIS_TEMP_DIR_VAR}" ]] && die "Can't use \${${PALUDIS_TEMP_DIR_VAR}}=${!PALUDIS_TEMP_DIR_VAR}"
|
||||
|
||||
ebuild_section "Extracting package environment"
|
||||
echo tar jxvf "${!PALUDIS_BINARY_DISTDIR_VARIABLE}"/${!PALUDIS_ARCHIVES_VAR} -C "${!PALUDIS_TEMP_DIR_VAR}" --strip-components 1 PBIN/environment 1>&2
|
||||
tar jxvf "${!PALUDIS_BINARY_DISTDIR_VARIABLE}"/${!PALUDIS_ARCHIVES_VAR} -C "${!PALUDIS_TEMP_DIR_VAR}" --strip-components 1 PBIN/environment || die "Couldn't extract env"
|
||||
|
||||
if [[ ${!PALUDIS_ARCHIVES_VAR%.tar.bz2} != ${!PALUDIS_ARCHIVES_VAR} ]] ; then
|
||||
echo tar jxvf "${!PALUDIS_BINARY_DISTDIR_VARIABLE}"/${!PALUDIS_ARCHIVES_VAR} -C "${!PALUDIS_TEMP_DIR_VAR}" --strip-components 1 PBIN/environment 1>&2
|
||||
tar jxvf "${!PALUDIS_BINARY_DISTDIR_VARIABLE}"/${!PALUDIS_ARCHIVES_VAR} -C "${!PALUDIS_TEMP_DIR_VAR}" --strip-components 1 PBIN/environment || die "Couldn't extract env"
|
||||
elif [[ ${!PALUDIS_ARCHIVES_VAR%.pax.bz2} != ${!PALUDIS_ARCHIVES_VAR} ]] ; then
|
||||
echo unpaxinate env "${!PALUDIS_BINARY_DISTDIR_VARIABLE}"/${!PALUDIS_ARCHIVES_VAR} "${!PALUDIS_TEMP_DIR_VAR}" 1>&2
|
||||
unpaxinate env "${!PALUDIS_BINARY_DISTDIR_VARIABLE}"/${!PALUDIS_ARCHIVES_VAR} "${!PALUDIS_TEMP_DIR_VAR}" || die "Couldn't extract env"
|
||||
else
|
||||
die "Unrecognised extension for '${!PALUDIS_ARCHIVES_VAR}'"
|
||||
fi
|
||||
|
||||
ebuild_section "Switching to package environment"
|
||||
export BINARY_REPOSITORY="${REPOSITORY}"
|
||||
|
@ -61,6 +61,16 @@ libexecbin_PROGRAMS = \
|
||||
print_exports \
|
||||
locked_pipe_command
|
||||
|
||||
if ENABLE_PBINS
|
||||
libexecbin_PROGRAMS += \
|
||||
unpaxinate
|
||||
|
||||
unpaxinate_SOURCES = unpaxinate.cc
|
||||
unpaxinate_CXXFLAGS = $(AM_CXXFLAGS)
|
||||
unpaxinate_LDADD = -larchive
|
||||
|
||||
endif
|
||||
|
||||
print_exports_SOURCES = print_exports.cc
|
||||
locked_pipe_command_SOURCES = locked_pipe_command.cc
|
||||
|
||||
|
76
paludis/repositories/e/ebuild/utils/unpaxinate.cc
Normal file
76
paludis/repositories/e/ebuild/utils/unpaxinate.cc
Normal file
@ -0,0 +1,76 @@
|
||||
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <cstdlib>
|
||||
|
||||
#include <archive.h>
|
||||
#include <archive_entry.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "config.h"
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
if (argc != 4)
|
||||
return EXIT_FAILURE;
|
||||
|
||||
bool want_env(false);
|
||||
if (argv[1] == std::string("env"))
|
||||
want_env = true;
|
||||
else if (argv[1] == std::string("img"))
|
||||
want_env = false;
|
||||
else
|
||||
return EXIT_FAILURE;
|
||||
|
||||
std::string archive_file(argv[2]);
|
||||
|
||||
if (0 != chdir(argv[3]))
|
||||
return EXIT_FAILURE;
|
||||
|
||||
archive * archive(archive_read_new());
|
||||
archive_read_support_compression_all(archive);
|
||||
archive_read_support_format_all(archive);
|
||||
|
||||
if (ARCHIVE_OK != archive_read_open_filename(archive, archive_file.c_str(), 10240))
|
||||
{
|
||||
std::cerr << "Could not open '" << archive_file << "'" << std::endl;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
archive_entry * entry;
|
||||
while (ARCHIVE_OK == archive_read_next_header(archive, &entry))
|
||||
{
|
||||
std::string archive_filename(archive_entry_pathname(entry));
|
||||
std::string out_filename;
|
||||
if (archive_filename == "PBIN/environment" && want_env)
|
||||
out_filename = "environment";
|
||||
else if ((! want_env) && (0 != archive_filename.compare(0, 5, "PBIN/", 0, 5)))
|
||||
out_filename = archive_filename;
|
||||
else
|
||||
{
|
||||
archive_read_data_skip(archive);
|
||||
continue;
|
||||
}
|
||||
|
||||
std::cout << out_filename << std::endl;
|
||||
archive_entry_set_pathname(entry, out_filename.c_str());
|
||||
|
||||
if (ARCHIVE_OK != archive_read_extract(archive, entry, ARCHIVE_EXTRACT_OWNER |
|
||||
ARCHIVE_EXTRACT_PERM | ARCHIVE_EXTRACT_TIME | ARCHIVE_EXTRACT_ACL |
|
||||
ARCHIVE_EXTRACT_FFLAGS | ARCHIVE_EXTRACT_XATTR | ARCHIVE_EXTRACT_SECURE_NODOTDOT))
|
||||
{
|
||||
std::cerr << "Could not extract '" << out_filename << "' from '" << archive_file << "'" << std::endl;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
if (ARCHIVE_OK != archive_read_finish(archive))
|
||||
{
|
||||
std::cerr << "Could not finish reading '" << archive_file << "'" << std::endl;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user