Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/external/bsd/pkg_install/dist Update "pkg_install" to versio...
details: https://anonhg.NetBSD.org/src/rev/d72ac8396a7d
branches: trunk
changeset: 777461:d72ac8396a7d
user: tron <tron%NetBSD.org@localhost>
date: Sun Feb 19 17:46:46 2012 +0000
description:
Update "pkg_install" to version 20120128:
- pkg_install 20120128:
- Explicitly stat(2) if mkdir failed. errno detection doesn't work e.g.
on Solaris.
- Provide a stable order for package names that only differe in the base
name, not the version number.
- pkg_install 20110805:
- Fix for pkg_delete on NFS from Anthony Mallet.
diffstat:
external/bsd/pkg_install/dist/add/perform.c | 35 +++++++++++++++-------
external/bsd/pkg_install/dist/delete/pkg_delete.c | 6 +-
external/bsd/pkg_install/dist/lib/opattern.c | 8 +++-
3 files changed, 32 insertions(+), 17 deletions(-)
diffs (159 lines):
diff -r 090405a3d565 -r d72ac8396a7d external/bsd/pkg_install/dist/add/perform.c
--- a/external/bsd/pkg_install/dist/add/perform.c Sun Feb 19 17:40:46 2012 +0000
+++ b/external/bsd/pkg_install/dist/add/perform.c Sun Feb 19 17:46:46 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: perform.c,v 1.1.1.18 2011/02/18 22:32:28 aymeric Exp $ */
+/* $NetBSD: perform.c,v 1.1.1.19 2012/02/19 17:46:46 tron Exp $ */
#if HAVE_CONFIG_H
#include "config.h"
#endif
@@ -6,7 +6,7 @@
#if HAVE_SYS_CDEFS_H
#include <sys/cdefs.h>
#endif
-__RCSID("$NetBSD: perform.c,v 1.1.1.18 2011/02/18 22:32:28 aymeric Exp $");
+__RCSID("$NetBSD: perform.c,v 1.1.1.19 2012/02/19 17:46:46 tron Exp $");
/*-
* Copyright (c) 2003 Grant Beattie <grant%NetBSD.org@localhost>
@@ -42,6 +42,7 @@
*/
#include <sys/utsname.h>
+#include <sys/stat.h>
#if HAVE_ERR_H
#include <err.h>
#endif
@@ -169,16 +170,21 @@
mkdir_p(const char *path)
{
char *p, *cur_end;
- int done;
+ int done, saved_errno;
+ struct stat sb;
/*
* Handle the easy case of direct success or
* pre-existing directory first.
*/
- if (mkdir(path, 0777) == 0 || errno == EEXIST)
+ if (mkdir(path, 0777) == 0)
return 0;
- if (errno != ENOENT)
+ if (stat(path, &sb) == 0) {
+ if (S_ISDIR(sb.st_mode))
+ return 0;
+ errno = ENOTDIR;
return -1;
+ }
cur_end = p = xstrdup(path);
@@ -198,21 +204,26 @@
done = (*cur_end == '\0');
*cur_end = '\0';
- /*
- * ENOENT can only happen if something else races us,
- * in which case we should better give up.
- */
- if (mkdir(p, 0777) == -1 && errno != EEXIST) {
+ if (mkdir(p, 0777) == -1) {
+ saved_errno = errno;
+ if (stat(path, &sb) == 0) {
+ if (S_ISDIR(sb.st_mode))
+ goto pass;
+ errno = ENOTDIR;
+ } else {
+ errno = saved_errno;
+ }
free(p);
return -1;
}
+pass:
if (done)
break;
*cur_end = '/';
}
free(p);
- return 0;
+ return 0;
}
/*
@@ -382,6 +393,7 @@
free(filename);
if (fd == -1)
return 1;
+ close(fd);
if (ReplaceSame) {
struct stat sb;
@@ -411,7 +423,6 @@
warnx("package `%s' already recorded as installed",
pkg->pkgname);
}
- close(fd);
return 0;
}
diff -r 090405a3d565 -r d72ac8396a7d external/bsd/pkg_install/dist/delete/pkg_delete.c
--- a/external/bsd/pkg_install/dist/delete/pkg_delete.c Sun Feb 19 17:40:46 2012 +0000
+++ b/external/bsd/pkg_install/dist/delete/pkg_delete.c Sun Feb 19 17:46:46 2012 +0000
@@ -34,7 +34,7 @@
#if HAVE_SYS_CDEFS_H
#include <sys/cdefs.h>
#endif
-__RCSID("$NetBSD: pkg_delete.c,v 1.1.1.7 2010/02/03 14:23:46 joerg Exp $");
+__RCSID("$NetBSD: pkg_delete.c,v 1.1.1.8 2012/02/19 17:46:46 tron Exp $");
#if HAVE_ERR_H
#include <err.h>
@@ -307,7 +307,7 @@
* Packages that are marked as not for deletion are not considered as
* leaves. For all other packages it is checked if at least one package
* that depended on them is to be removed AND no depending package remains.
- * If that is the case, the package is appened to the sorted list.
+ * If that is the case, the package is appended to the sorted list.
* As this package can't have depending packages left, the topological order
* remains consistent.
*/
@@ -338,7 +338,7 @@
if (process_required_by(pkg, NULL, data->pkgs, 3) == 1) {
lpp = alloc_lpkg(pkg);
TAILQ_INSERT_TAIL(data->pkgs, lpp, lp_link);
- data->progress = 0;
+ data->progress = 1;
}
return 0;
diff -r 090405a3d565 -r d72ac8396a7d external/bsd/pkg_install/dist/lib/opattern.c
--- a/external/bsd/pkg_install/dist/lib/opattern.c Sun Feb 19 17:40:46 2012 +0000
+++ b/external/bsd/pkg_install/dist/lib/opattern.c Sun Feb 19 17:46:46 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: opattern.c,v 1.1.1.2 2009/02/02 20:44:06 joerg Exp $ */
+/* $NetBSD: opattern.c,v 1.1.1.3 2012/02/19 17:46:47 tron Exp $ */
#if HAVE_CONFIG_H
#include "config.h"
@@ -7,7 +7,7 @@
#if HAVE_SYS_CDEFS_H
#include <sys/cdefs.h>
#endif
-__RCSID("$NetBSD: opattern.c,v 1.1.1.2 2009/02/02 20:44:06 joerg Exp $");
+__RCSID("$NetBSD: opattern.c,v 1.1.1.3 2012/02/19 17:46:47 tron Exp $");
/*
* FreeBSD install - a package for the installation and maintainance
@@ -204,6 +204,10 @@
if (dewey_cmp(first_version + 1, DEWEY_GT, second_version + 1))
return 1;
+ else if (dewey_cmp(first_version + 1, DEWEY_LT, second_version + 1))
+ return 2;
+ else if (strcmp(first_pkg, second_pkg) < 0)
+ return 1;
else
return 2;
}
Home |
Main Index |
Thread Index |
Old Index