diff options
Diffstat (limited to 'meta-linaro-integration/recipes-devtools/opkg/files/0003-opkg_download-Use-md5sum-of-src-URI-as-cache-file-na.patch')
-rw-r--r-- | meta-linaro-integration/recipes-devtools/opkg/files/0003-opkg_download-Use-md5sum-of-src-URI-as-cache-file-na.patch | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/meta-linaro-integration/recipes-devtools/opkg/files/0003-opkg_download-Use-md5sum-of-src-URI-as-cache-file-na.patch b/meta-linaro-integration/recipes-devtools/opkg/files/0003-opkg_download-Use-md5sum-of-src-URI-as-cache-file-na.patch new file mode 100644 index 00000000..c7e5cdb9 --- /dev/null +++ b/meta-linaro-integration/recipes-devtools/opkg/files/0003-opkg_download-Use-md5sum-of-src-URI-as-cache-file-na.patch @@ -0,0 +1,51 @@ +From 2ba39321c686547588745a8ff7d35c6e1965c734 Mon Sep 17 00:00:00 2001 +From: Paul Barker <pa...@paulbarker.me.uk> +Date: Sat, 24 Oct 2015 20:15:19 +0100 +Subject: [PATCH 3/3] opkg_download: Use md5sum of src URI as cache file name + +Source URIs can be very long. The cache directory itself may already have a very +long path, especially if we're installing packages into an offline rootfs. +Therefore it's not a good idea to simply tag the source URI onto the cache +directory path to create a cache file name. + +To create shorter cache file names which are deterministic and very likely to be +unique, we use the md5sum of the source URI. + +Signed-off-by: Paul Barker <pa...@paulbarker.me.uk> +--- + libopkg/opkg_download.c | 11 ++++++----- + 1 file changed, 6 insertions(+), 5 deletions(-) + +diff --git a/libopkg/opkg_download.c b/libopkg/opkg_download.c +index e9b86a5..d270074 100644 +--- a/libopkg/opkg_download.c ++++ b/libopkg/opkg_download.c +@@ -29,6 +29,7 @@ + #include "opkg_verify.h" + #include "opkg_utils.h" + ++#include "md5.h" + #include "sprintf_alloc.h" + #include "file_util.h" + #include "xfuncs.h" +@@ -135,12 +136,12 @@ int opkg_download_internal(const char *src, const char *dest, + */ + char *get_cache_location(const char *src) + { +- char *cache_name = xstrdup(src); +- char *cache_location, *p; ++ unsigned char md5sum_bin[16]; ++ char *cache_name; ++ char *cache_location; + +- for (p = cache_name; *p; p++) +- if (*p == '/') +- *p = '_'; ++ md5_buffer(src, strlen(src), md5sum_bin); ++ cache_name = md5_to_string(md5sum_bin); + + sprintf_alloc(&cache_location, "%s/%s", opkg_config->cache_dir, cache_name); + free(cache_name); +-- +2.6.1 + |