Revert "bin/xbps-create: process_entry_file uses dictionary instead of linked list now."
This reverts commit 61d2361646
.
This commit is contained in:
parent
e211ae21fe
commit
705a30c63c
@ -615,7 +615,7 @@ write_entry(struct archive *ar, struct archive_entry *entry)
|
|||||||
static void
|
static void
|
||||||
process_entry_file(struct archive *ar,
|
process_entry_file(struct archive *ar,
|
||||||
struct archive_entry_linkresolver *resolver,
|
struct archive_entry_linkresolver *resolver,
|
||||||
const char *filename)
|
struct xentry *xe, const char *filematch)
|
||||||
{
|
{
|
||||||
struct archive_entry *entry, *sparse_entry;
|
struct archive_entry *entry, *sparse_entry;
|
||||||
struct stat st;
|
struct stat st;
|
||||||
@ -623,14 +623,18 @@ process_entry_file(struct archive *ar,
|
|||||||
ssize_t len;
|
ssize_t len;
|
||||||
|
|
||||||
assert(ar);
|
assert(ar);
|
||||||
|
assert(xe);
|
||||||
|
|
||||||
p = xbps_xasprintf("%s/%s", destdir, filename);
|
if (filematch && strcmp(xe->file, filematch))
|
||||||
|
return;
|
||||||
|
|
||||||
|
p = xbps_xasprintf("%s/%s", destdir, xe->file);
|
||||||
if (lstat(p, &st) == -1)
|
if (lstat(p, &st) == -1)
|
||||||
die("failed to add entry (fstat) %s to archive:", filename);
|
die("failed to add entry (fstat) %s to archive:", xe->file);
|
||||||
|
|
||||||
entry = archive_entry_new();
|
entry = archive_entry_new();
|
||||||
assert(entry);
|
assert(entry);
|
||||||
archive_entry_set_pathname(entry, filename);
|
archive_entry_set_pathname(entry, xe->file);
|
||||||
if (st.st_uid == geteuid())
|
if (st.st_uid == geteuid())
|
||||||
st.st_uid = 0;
|
st.st_uid = 0;
|
||||||
if (st.st_gid == getegid())
|
if (st.st_gid == getegid())
|
||||||
@ -649,7 +653,7 @@ process_entry_file(struct archive *ar,
|
|||||||
len = readlink(p, buf, st.st_size+1);
|
len = readlink(p, buf, st.st_size+1);
|
||||||
if (len < 0 || len > st.st_size)
|
if (len < 0 || len > st.st_size)
|
||||||
die("failed to add entry %s (readlink) to archive:",
|
die("failed to add entry %s (readlink) to archive:",
|
||||||
filename);
|
xe->file);
|
||||||
buf[len] = '\0';
|
buf[len] = '\0';
|
||||||
archive_entry_set_symlink(entry, buf);
|
archive_entry_set_symlink(entry, buf);
|
||||||
}
|
}
|
||||||
@ -670,17 +674,14 @@ process_archive(struct archive *ar,
|
|||||||
struct archive_entry_linkresolver *resolver,
|
struct archive_entry_linkresolver *resolver,
|
||||||
const char *pkgver, bool quiet)
|
const char *pkgver, bool quiet)
|
||||||
{
|
{
|
||||||
|
struct xentry *xe;
|
||||||
char *xml;
|
char *xml;
|
||||||
const char *filepath, *p;
|
|
||||||
xbps_object_iterator_t iter;
|
|
||||||
xbps_object_t filepathk;
|
|
||||||
xbps_dictionary_t fileinfo;
|
|
||||||
|
|
||||||
/* Add INSTALL/REMOVE metadata scripts first */
|
/* Add INSTALL/REMOVE metadata scripts first */
|
||||||
if (xbps_dictionary_get(all_filesd, "./INSTALL"))
|
TAILQ_FOREACH(xe, &xentry_list, entries) {
|
||||||
process_entry_file(ar, resolver, "./INSTALL");
|
process_entry_file(ar, resolver, xe, "./INSTALL");
|
||||||
if (xbps_dictionary_get(all_filesd, "./REMOVE"))
|
process_entry_file(ar, resolver, xe, "./REMOVE");
|
||||||
process_entry_file(ar, resolver, "./REMOVE");
|
}
|
||||||
/*
|
/*
|
||||||
* Add the installed-size object.
|
* Add the installed-size object.
|
||||||
*/
|
*/
|
||||||
@ -702,23 +703,18 @@ process_archive(struct archive *ar,
|
|||||||
free(xml);
|
free(xml);
|
||||||
|
|
||||||
/* Add all package data files and release resources */
|
/* Add all package data files and release resources */
|
||||||
iter = xbps_dictionary_iterator(all_filesd);
|
while ((xe = TAILQ_FIRST(&xentry_list)) != NULL) {
|
||||||
assert(iter);
|
TAILQ_REMOVE(&xentry_list, xe, entries);
|
||||||
while ((filepathk = xbps_object_iterator_next(iter))) {
|
if ((strcmp(xe->type, "metadata") == 0) ||
|
||||||
filepath = xbps_dictionary_keysym_cstring_nocopy(filepathk);
|
(strcmp(xe->type, "dirs") == 0))
|
||||||
fileinfo = xbps_dictionary_get_keysym(all_filesd, filepathk);
|
|
||||||
if (xbps_string_equals_cstring(xbps_dictionary_get(fileinfo, "type"), "metadata") ||
|
|
||||||
xbps_string_equals_cstring(xbps_dictionary_get(fileinfo, "type"), "dirs"))
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!quiet) {
|
if (!quiet) {
|
||||||
xbps_dictionary_get_cstring_nocopy(fileinfo, "file", &p);
|
printf("%s: adding `%s' ...\n", pkgver, xe->file);
|
||||||
printf("%s: adding `%s' ...\n", pkgver, p);
|
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
}
|
}
|
||||||
process_entry_file(ar, resolver, filepath);
|
process_entry_file(ar, resolver, xe, NULL);
|
||||||
}
|
}
|
||||||
xbps_object_iterator_release(iter);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
Loading…
Reference in New Issue
Block a user