forked from Mirrors/flatpak-builder
source archive: Add 7zip support
parent
f690e204c1
commit
9ce6025f3a
|
@ -648,7 +648,7 @@
|
|||
<term><option>archive-type</option> (string)</term>
|
||||
<listitem><para>
|
||||
The type of archive if it cannot be guessed from the path. Possible values are "rpm", "tar",
|
||||
"tar-gzip", "tar-compress", "tar-bzip2", "tar-lzip", "tar-lzma", "tar-lzop", "tar-xz" and "zip".
|
||||
"tar-gzip", "tar-compress", "tar-bzip2", "tar-lzip", "tar-lzma", "tar-lzop", "tar-xz", "zip" and "7z".
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
|
|
|
@ -83,7 +83,8 @@ typedef enum {
|
|||
TAR_LZMA,
|
||||
TAR_LZOP,
|
||||
TAR_XZ,
|
||||
ZIP
|
||||
ZIP,
|
||||
SEVENZ,
|
||||
} BuilderArchiveType;
|
||||
|
||||
static gboolean
|
||||
|
@ -463,6 +464,19 @@ unzip (GFile *dir,
|
|||
return res;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
un7z (GFile *dir,
|
||||
const char *sevenz_path,
|
||||
GError **error)
|
||||
{
|
||||
gboolean res;
|
||||
const gchar *argv[] = { "7z", "x", sevenz_path, NULL };
|
||||
|
||||
res = flatpak_spawnv (dir, NULL, 0, error, argv);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
unrpm (GFile *dir,
|
||||
const char *rpm_path,
|
||||
|
@ -657,6 +671,7 @@ get_type_from_prop (BuilderSourceArchive *self)
|
|||
{ "tar-lzma", TAR_LZMA },
|
||||
{ "tar-xz", TAR_XZ },
|
||||
{ "zip", ZIP },
|
||||
{ "7z", SEVENZ },
|
||||
};
|
||||
guint i;
|
||||
|
||||
|
@ -722,6 +737,23 @@ builder_source_archive_extract (BuilderSource *source,
|
|||
return FALSE;
|
||||
}
|
||||
}
|
||||
else if (type == SEVENZ)
|
||||
{
|
||||
g_autoptr(GFile) sevenz_dest = NULL;
|
||||
|
||||
sevenz_dest = create_uncompress_directory (self, dest, error);
|
||||
if (sevenz_dest == NULL)
|
||||
return FALSE;
|
||||
|
||||
if (!un7z (sevenz_dest, archive_path, error))
|
||||
return FALSE;
|
||||
|
||||
if (self->strip_components > 0)
|
||||
{
|
||||
if (!strip_components_into (dest, sevenz_dest, self->strip_components, error))
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
else if (type == RPM)
|
||||
{
|
||||
g_autoptr(GFile) rpm_dest = NULL;
|
||||
|
|
Loading…
Reference in New Issue