From 50ca9f6c7334da63aa416f9302d8cc242167ef04 Mon Sep 17 00:00:00 2001 From: P. J. McDermott Date: Fri, 04 Jul 2014 19:11:12 -0400 Subject: Add architecture to package control file names Signed-off-by: P. J. McDermott --- (limited to 'libopkg') diff --git a/libopkg/opkg_configure.c b/libopkg/opkg_configure.c index 169828d..90e9d50 100644 --- a/libopkg/opkg_configure.c +++ b/libopkg/opkg_configure.c @@ -15,6 +15,8 @@ General Public License for more details. */ +#include "config.h" + #include #include "sprintf_alloc.h" @@ -36,9 +38,17 @@ opkg_configure(pkg_t *pkg) err = pkg_run_script(pkg, "postinst", "configure"); if (err) { if (!conf->offline_root) +#ifdef HAVE_MULTIARCH + opkg_msg(ERROR, "%s:%s.postinst returned %d.\n", pkg->name, pkg->architecture, err); +#else opkg_msg(ERROR, "%s.postinst returned %d.\n", pkg->name, err); +#endif else +#ifdef HAVE_MULTIARCH + opkg_msg(NOTICE, "%s:%s.postinst returned %d, marking as unpacked only, configuration required on target.\n", pkg->name, pkg->architecture, err); +#else opkg_msg(NOTICE, "%s.postinst returned %d, marking as unpacked only, configuration required on target.\n", pkg->name, err); +#endif return err; } diff --git a/libopkg/opkg_install.c b/libopkg/opkg_install.c index 0ff7705..f850b4c 100644 --- a/libopkg/opkg_install.c +++ b/libopkg/opkg_install.c @@ -1046,7 +1046,11 @@ install_maintainer_scripts(pkg_t *pkg, pkg_t *old_pkg) int ret; char *prefix; +#ifdef HAVE_MULTIARCH + sprintf_alloc(&prefix, "%s:%s.", pkg->name, pkg->architecture); +#else sprintf_alloc(&prefix, "%s.", pkg->name); +#endif ret = pkg_extract_control_files_to_dir_with_prefix(pkg, pkg->dest->info_dir, prefix); 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); -- cgit v0.9.1