1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-10-18 17:31:57 +08:00

FreeBSD: drop support for libpkg before 1.17

All supported FreeBSD versions are now using 1.17 or later
This commit is contained in:
Adriaan de Groot
2022-07-05 11:42:00 +02:00
parent acf3fe632c
commit 57e8cd1a81

View File

@@ -23,8 +23,6 @@
// Suffix used to tell libpkg what compression to use
static const char FreeBSDPackageCompression[] = "txz";
// Resulting package file-suffix, for < 1.17 and >= 1.17 versions of libpkg
static const char FreeBSDPackageSuffix_10[] = ".txz";
static const char FreeBSDPackageSuffix_17[] = ".pkg";
cmCPackFreeBSDGenerator::cmCPackFreeBSDGenerator()
@@ -416,42 +414,17 @@ int cmCPackFreeBSDGenerator::PackageFiles()
return 0;
}
// Specifically looking for packages suffixed with the TAG, either extension
std::string broken_suffix_10 =
cmStrCat('-', var_lookup("CPACK_TOPLEVEL_TAG"), FreeBSDPackageSuffix_10);
// Specifically looking for packages suffixed with the TAG
std::string broken_suffix_17 =
cmStrCat('-', var_lookup("CPACK_TOPLEVEL_TAG"), FreeBSDPackageSuffix_17);
for (std::string& name : packageFileNames) {
cmCPackLogger(cmCPackLog::LOG_DEBUG, "Packagefile " << name << std::endl);
if (cmHasSuffix(name, broken_suffix_10)) {
name.replace(name.size() - broken_suffix_10.size(), std::string::npos,
FreeBSDPackageSuffix_10);
break;
}
if (cmHasSuffix(name, broken_suffix_17)) {
name.replace(name.size() - broken_suffix_17.size(), std::string::npos,
FreeBSDPackageSuffix_17);
break;
}
}
// If the name uses a *new* style name, which doesn't exist, but there
// is an *old* style name, then use that instead. This indicates we used
// an older libpkg, which still creates .txz instead of .pkg files.
for (std::string& name : packageFileNames) {
if (cmHasSuffix(name, FreeBSDPackageSuffix_17) &&
!cmSystemTools::FileExists(name)) {
const std::string badSuffix(FreeBSDPackageSuffix_17);
const std::string goodSuffix(FreeBSDPackageSuffix_10);
std::string repairedName(name);
repairedName.replace(repairedName.size() - badSuffix.size(),
std::string::npos, goodSuffix);
if (cmSystemTools::FileExists(repairedName)) {
name = repairedName;
cmCPackLogger(cmCPackLog::LOG_DEBUG,
"Repaired packagefile " << name << std::endl);
}
}
}
return 1;
}