summaryrefslogtreecommitdiffstats
path: root/libopkg/pkg.c
diff options
context:
space:
mode:
authorP. J. McDermott <pj@pehjota.net>2014-07-04 19:11:12 (EDT)
committer P. J. McDermott <pj@pehjota.net>2014-07-04 23:34:10 (EDT)
commit1f351455e2cf55306a6b0d200595b9f4ef076b6b (patch)
treead6667416e4e718ea9295e1f0fd9e74860ead46a /libopkg/pkg.c
parent9df48d61ef3d1654763a1142a96a7cd796f6622d (diff)
Add architecture to package control file names
Diffstat (limited to 'libopkg/pkg.c')
-rw-r--r--libopkg/pkg.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/libopkg/pkg.c b/libopkg/pkg.c
index bf39b10..97966a1 100644
--- a/libopkg/pkg.c
+++ b/libopkg/pkg.c
@@ -461,7 +461,11 @@ set_flags_from_control(pkg_t *pkg){
char *file_name;
FILE *fp;
+#ifdef HAVE_MULTIARCH
+ sprintf_alloc(&file_name,"%s/%s:%s.control", pkg->dest->info_dir, pkg->name, pkg->architecture);
+#else
sprintf_alloc(&file_name,"%s/%s.control", pkg->dest->info_dir, pkg->name);
+#endif
fp = fopen(file_name, "r");
if (fp == NULL) {
@@ -1105,8 +1109,14 @@ pkg_get_installed_files(pkg_t *pkg)
file. In other words, change deb_extract so that it can
simply return the file list as a char *[] rather than
insisting on writing it to a FILE * as it does now. */
+#ifdef HAVE_MULTIARCH
+ sprintf_alloc(&list_file_name, "%s/%s:%s.list.XXXXXX",
+ conf->tmp_dir, pkg->name,
+ pkg->architecture);
+#else
sprintf_alloc(&list_file_name, "%s/%s.list.XXXXXX",
conf->tmp_dir, pkg->name);
+#endif
fd = mkstemp(list_file_name);
if (fd == -1) {
opkg_perror(ERROR, "Failed to make temp file %s.",
@@ -1136,8 +1146,13 @@ pkg_get_installed_files(pkg_t *pkg)
}
rewind(list_file);
} else {
+#ifdef HAVE_MULTIARCH
+ sprintf_alloc(&list_file_name, "%s/%s:%s.list",
+ pkg->dest->info_dir, pkg->name, pkg->architecture);
+#else
sprintf_alloc(&list_file_name, "%s/%s.list",
pkg->dest->info_dir, pkg->name);
+#endif
list_file = fopen(list_file_name, "r");
if (list_file == NULL) {
opkg_perror(ERROR, "Failed to open %s",
@@ -1219,8 +1234,13 @@ pkg_remove_installed_files_list(pkg_t *pkg)
{
char *list_file_name;
+#ifdef HAVE_MULTIARCH
+ sprintf_alloc(&list_file_name, "%s/%s:%s.list",
+ pkg->dest->info_dir, pkg->name, pkg->architecture);
+#else
sprintf_alloc(&list_file_name, "%s/%s.list",
pkg->dest->info_dir, pkg->name);
+#endif
if (!conf->noaction)
(void)unlink(list_file_name);
@@ -1273,7 +1293,11 @@ pkg_run_script(pkg_t *pkg, const char *script, const char *args)
pkg->name);
return -1;
}
+#ifdef HAVE_MULTIARCH
+ sprintf_alloc(&path, "%s/%s:%s.%s", pkg->dest->info_dir, pkg->name, pkg->architecture, script);
+#else
sprintf_alloc(&path, "%s/%s.%s", pkg->dest->info_dir, pkg->name, script);
+#endif
} else {
if (pkg->tmp_unpack_dir == NULL) {
opkg_msg(ERROR, "Internal error: %s has a NULL tmp_unpack_dir.\n",
@@ -1383,8 +1407,13 @@ pkg_write_filelist(pkg_t *pkg)
struct pkg_write_filelist_data data;
char *list_file_name;
+#ifdef HAVE_MULTIARCH
+ sprintf_alloc(&list_file_name, "%s/%s:%s.list",
+ pkg->dest->info_dir, pkg->name, pkg->architecture);
+#else
sprintf_alloc(&list_file_name, "%s/%s.list",
pkg->dest->info_dir, pkg->name);
+#endif
opkg_msg(INFO, "Creating %s file for pkg %s.\n",
list_file_name, pkg->name);