xbps-bin: do not mark package as broken if the any task in the check
target failed, just print the info. --HG-- extra : convert_revision : xtraeme%40gmail.com-20091005220111-m2xkbbeupq2v7ccn
This commit is contained in:
parent
c0c9a8dfc0
commit
042084b306
@ -43,9 +43,6 @@
|
|||||||
* o Check the hash for all installed files, except
|
* o Check the hash for all installed files, except
|
||||||
* configuration files (which is expected if they are modified).
|
* configuration files (which is expected if they are modified).
|
||||||
* o Check for missing run time dependencies.
|
* o Check for missing run time dependencies.
|
||||||
*
|
|
||||||
* If any of these checks fail, the package will change its
|
|
||||||
* state to 'broken'.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
@ -58,7 +55,7 @@ xbps_check_pkg_integrity(const char *pkgname)
|
|||||||
const char *rootdir, *file, *sha256, *reqpkg;
|
const char *rootdir, *file, *sha256, *reqpkg;
|
||||||
char *path;
|
char *path;
|
||||||
int rv = 0;
|
int rv = 0;
|
||||||
bool files_broken = false, broken = false;
|
bool files_broken = false;
|
||||||
|
|
||||||
assert(pkgname != NULL);
|
assert(pkgname != NULL);
|
||||||
|
|
||||||
@ -85,19 +82,16 @@ xbps_check_pkg_integrity(const char *pkgname)
|
|||||||
printf("%s: unexistent %s metadata file.\n", pkgname,
|
printf("%s: unexistent %s metadata file.\n", pkgname,
|
||||||
XBPS_PKGPROPS);
|
XBPS_PKGPROPS);
|
||||||
rv = errno;
|
rv = errno;
|
||||||
broken = true;
|
|
||||||
goto out;
|
goto out;
|
||||||
} else if (prop_object_type(propsd) != PROP_TYPE_DICTIONARY) {
|
} else if (prop_object_type(propsd) != PROP_TYPE_DICTIONARY) {
|
||||||
printf("%s: invalid %s metadata file.\n", pkgname,
|
printf("%s: invalid %s metadata file.\n", pkgname,
|
||||||
XBPS_PKGPROPS);
|
XBPS_PKGPROPS);
|
||||||
rv = EINVAL;
|
rv = EINVAL;
|
||||||
broken = true;
|
|
||||||
goto out1;
|
goto out1;
|
||||||
} else if (prop_dictionary_count(propsd) == 0) {
|
} else if (prop_dictionary_count(propsd) == 0) {
|
||||||
printf("%s: incomplete %s metadata file.\n", pkgname,
|
printf("%s: incomplete %s metadata file.\n", pkgname,
|
||||||
XBPS_PKGPROPS);
|
XBPS_PKGPROPS);
|
||||||
rv = EINVAL;
|
rv = EINVAL;
|
||||||
broken = true;
|
|
||||||
goto out1;
|
goto out1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -117,19 +111,16 @@ xbps_check_pkg_integrity(const char *pkgname)
|
|||||||
printf("%s: unexistent %s metadata file.\n", pkgname,
|
printf("%s: unexistent %s metadata file.\n", pkgname,
|
||||||
XBPS_PKGPROPS);
|
XBPS_PKGPROPS);
|
||||||
rv = ENOENT;
|
rv = ENOENT;
|
||||||
broken = true;
|
|
||||||
goto out1;
|
goto out1;
|
||||||
} else if (prop_object_type(filesd) != PROP_TYPE_DICTIONARY) {
|
} else if (prop_object_type(filesd) != PROP_TYPE_DICTIONARY) {
|
||||||
printf("%s: invalid %s metadata file.\n", pkgname,
|
printf("%s: invalid %s metadata file.\n", pkgname,
|
||||||
XBPS_PKGFILES);
|
XBPS_PKGFILES);
|
||||||
rv = EINVAL;
|
rv = EINVAL;
|
||||||
broken = true;
|
|
||||||
goto out2;
|
goto out2;
|
||||||
} else if (prop_dictionary_count(filesd) == 0) {
|
} else if (prop_dictionary_count(filesd) == 0) {
|
||||||
printf("%s: incomplete %s metadata file.\n", pkgname,
|
printf("%s: incomplete %s metadata file.\n", pkgname,
|
||||||
XBPS_PKGFILES);
|
XBPS_PKGFILES);
|
||||||
rv = EINVAL;
|
rv = EINVAL;
|
||||||
broken = true;
|
|
||||||
goto out2;
|
goto out2;
|
||||||
} else if (((array = prop_dictionary_get(filesd, "files")) == NULL) ||
|
} else if (((array = prop_dictionary_get(filesd, "files")) == NULL) ||
|
||||||
((array = prop_dictionary_get(filesd, "links")) == NULL) ||
|
((array = prop_dictionary_get(filesd, "links")) == NULL) ||
|
||||||
@ -137,7 +128,6 @@ xbps_check_pkg_integrity(const char *pkgname)
|
|||||||
printf("%s: incomplete %s metadata file.\n", pkgname,
|
printf("%s: incomplete %s metadata file.\n", pkgname,
|
||||||
XBPS_PKGFILES);
|
XBPS_PKGFILES);
|
||||||
rv = EINVAL;
|
rv = EINVAL;
|
||||||
broken = true;
|
|
||||||
goto out2;
|
goto out2;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -170,13 +160,11 @@ xbps_check_pkg_integrity(const char *pkgname)
|
|||||||
printf("%s: unexistent file %s.\n",
|
printf("%s: unexistent file %s.\n",
|
||||||
pkgname, file);
|
pkgname, file);
|
||||||
files_broken = true;
|
files_broken = true;
|
||||||
broken = true;
|
|
||||||
break;
|
break;
|
||||||
case ERANGE:
|
case ERANGE:
|
||||||
printf("%s: hash mismatch for %s.\n",
|
printf("%s: hash mismatch for %s.\n",
|
||||||
pkgname, file);
|
pkgname, file);
|
||||||
files_broken = true;
|
files_broken = true;
|
||||||
broken = true;
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
printf("%s: unexpected error for %s (%s)\n",
|
printf("%s: unexpected error for %s (%s)\n",
|
||||||
@ -213,7 +201,6 @@ xbps_check_pkg_integrity(const char *pkgname)
|
|||||||
if (errno == ENOENT) {
|
if (errno == ENOENT) {
|
||||||
printf("%s: unexistent file %s\n",
|
printf("%s: unexistent file %s\n",
|
||||||
pkgname, file);
|
pkgname, file);
|
||||||
broken = true;
|
|
||||||
} else
|
} else
|
||||||
printf("%s: unexpected error for "
|
printf("%s: unexpected error for "
|
||||||
"%s (%s)\n", pkgname, file,
|
"%s (%s)\n", pkgname, file,
|
||||||
@ -242,7 +229,6 @@ xbps_check_pkg_integrity(const char *pkgname)
|
|||||||
rv = ENOENT;
|
rv = ENOENT;
|
||||||
printf("%s: dependency not satisfied: %s\n",
|
printf("%s: dependency not satisfied: %s\n",
|
||||||
pkgname, reqpkg);
|
pkgname, reqpkg);
|
||||||
broken = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
prop_object_iterator_release(iter);
|
prop_object_iterator_release(iter);
|
||||||
@ -257,18 +243,6 @@ out1:
|
|||||||
prop_object_release(propsd);
|
prop_object_release(propsd);
|
||||||
out:
|
out:
|
||||||
prop_object_release(pkgd);
|
prop_object_release(pkgd);
|
||||||
|
|
||||||
if (broken) {
|
|
||||||
rv = xbps_set_pkg_state_installed(pkgname,
|
|
||||||
XBPS_PKG_STATE_BROKEN);
|
|
||||||
if (rv == 0)
|
|
||||||
printf("%s: changed package state to broken.\n",
|
|
||||||
pkgname);
|
|
||||||
else
|
|
||||||
printf("%s: can't change package state (%s).\n",
|
|
||||||
pkgname, strerror(rv));
|
|
||||||
}
|
|
||||||
|
|
||||||
xbps_release_regpkgdb_dict();
|
xbps_release_regpkgdb_dict();
|
||||||
|
|
||||||
return rv;
|
return rv;
|
||||||
|
Loading…
Reference in New Issue
Block a user