Do not treat repositories with trailing '/' chars as invalid.

This commit is contained in:
Juan RP 2012-01-15 17:23:50 +01:00
parent 95804bdb77
commit 233d9f4803
3 changed files with 14 additions and 13 deletions

3
NEWS
View File

@ -1,5 +1,8 @@
xbps-0.12.0 (???): xbps-0.12.0 (???):
* Fixed registerring repositories with trailing '/' chars in
configuration file: xbps.conf.
* xbps-repo(8): the 'genindex' target now creates a plist file to cache * xbps-repo(8): the 'genindex' target now creates a plist file to cache
all files provided by binary packages in a repository. This makes all files provided by binary packages in a repository. This makes
the 'find-files' target marginally faster, because this avoids having the 'find-files' target marginally faster, because this avoids having

View File

@ -42,8 +42,8 @@
# or name will be used. # or name will be used.
# #
# By default we use the official "public" repositories. You can add # By default we use the official "public" repositories. You can add
# your own repositories by specifying the path (without the trailing # your own repositories by specifying the path to the directory
# '/' character) to the directory where the index.plist file is stored. # where the index.plist file is stored.
# #
# Repositories not matching the host architecture are simply ignored. # Repositories not matching the host architecture are simply ignored.
# #

View File

@ -27,6 +27,7 @@
#include <stdio.h> #include <stdio.h>
#include <stdbool.h> #include <stdbool.h>
#include <stdlib.h> #include <stdlib.h>
#include <libgen.h>
#include <string.h> #include <string.h>
#include <errno.h> #include <errno.h>
@ -46,21 +47,18 @@ static bool
check_repo_arch(const char *uri) check_repo_arch(const char *uri)
{ {
struct utsname un; struct utsname un;
char *p; char *p, *b;
if ((p = strdup(uri)) == NULL)
return false;
uname(&un); uname(&un);
p = strrchr(uri, '/'); b = basename(p);
if (p == NULL) free(p);
if ((strcmp(b, "noarch")) && (strcmp(b, un.machine)))
return false; return false;
p++;
if (*p == '\0')
return false;
else if (strcmp(p, "noarch") == 0)
return true;
else if (strcmp(p, un.machine) == 0)
return true;
return false; return true;
} }
int HIDDEN int HIDDEN