Add update all option to OXP manager (#381)

Closes #341
master
tsoj 2021-02-22 16:16:33 +01:00 committed by GitHub
parent 74c532c761
commit 31939ba721
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 70 additions and 25 deletions

View File

@ -73,8 +73,8 @@ particular, you need the SDL_Mixer library, which doesn't always come with the
base SDL development kit.
Then just type `make`, or, if you're using GNU make,
`make -f Makefile`. On some systems, such as Gentoo, you may need to run
`make -f Makefile OBJCFLAGS=-fobjc-exceptions`.
`make -f Makefile release`. On some systems, such as Gentoo, you may need to run
`make -f Makefile release OBJCFLAGS=-fobjc-exceptions`.
If you get errors like `make[1]: *** No rule to make target '/objc.make'. Stop.` it might help if you run `source /usr/share/GNUstep/Makefiles/GNUstep.sh` (the exact path to `GNUstep.sh` might differ).
If you have problems with missing textures you can try to delete `deps/Linux-deps/include/png.h` and `deps/Linux-deps/include/pngconf.h` before compiling.

View File

@ -1335,6 +1335,8 @@
"oolite-oxzmanager-install" = "Install expansion pack";
"oolite-oxzmanager-installed" = "List installed expansion packs";
"oolite-oxzmanager-remove" = "Remove expansion pack";
"oolite-oxzmanager-update-all" = "Update installed expansion packs";
"oolite-oxzmanager-firstrun" = "Before Oolite can install your requested expansions automatically, it needs to retrieve the expansions list. You will need to be connected to the internet for this to work. Use the 'Download expansions list' option when you are ready, or 'Return to Menu' if you do not have internet access now or would rather download and install expansions yourself.\n\nImportant: if you have old expansion packs installed in the OXP format, Oolite will not be able to automatically detect that they are the same pack as a new release. When downloading an expansion through this manager, you must first uninstall any old OXP versions of the same expansion to avoid problems.";
"oolite-oxzmanager-secondrun" = "Your expansion list may be out of date. Do you want to download the latest list now?\n\nIf you keep the old list, some installations may fail as the expansion pack is no longer available at that location or for that version. However, if you only want to uninstall expansion packs, you do not need to update the list.\n\nIf you need to update the list later, you can do this by selecting 'Update expansions list' from the menu.";
"oolite-oxzmanager-intro" = "Oolite can automatically install some expansions for you if you are connected to the internet. Use the 'Update expansions list' option to retrieve the latest expansions list, and the 'Install expansions' and 'Remove expansions' options to add and remove expansion packs.\n\nThere are also many more expansion packs not available through the automatic installer.\n\nImportant: if you have old expansion packs installed in the OXP format, Oolite will not be able to automatically detect that they are the same pack as a new release. When downloading an expansion through this manager, you must first uninstall any old OXP versions of the same expansion to avoid problems.\n\nIf an expansion pack requires other expansion packs to run, Oolite will automatically download those other expansion packs for you, if they are available.";

View File

@ -93,13 +93,14 @@ enum {
OXZ_GUI_ROW_LISTSTART = 2,
OXZ_GUI_NUM_LISTROWS = 10,
OXZ_GUI_ROW_LISTNEXT = 12,
OXZ_GUI_ROW_LISTFILTER = 22,
OXZ_GUI_ROW_LISTSTATUS = 14,
OXZ_GUI_ROW_LISTDESC = 16,
OXZ_GUI_ROW_LISTINFO1 = 20,
OXZ_GUI_ROW_LISTINFO2 = 21,
OXZ_GUI_ROW_INSTALL = 23,
OXZ_GUI_ROW_INSTALLED = 24,
OXZ_GUI_ROW_LISTINFO1 = 19,
OXZ_GUI_ROW_LISTINFO2 = 20,
OXZ_GUI_ROW_LISTFILTER = 21,
OXZ_GUI_ROW_INSTALL = 22,
OXZ_GUI_ROW_INSTALLED = 23,
OXZ_GUI_ROW_UPDATE_ALL = 24,
OXZ_GUI_ROW_REMOVE = 25,
OXZ_GUI_ROW_PROCEED = 25,
OXZ_GUI_ROW_UPDATE = 26,
@ -147,6 +148,7 @@ static OOOXZManager *sSingleton = nil;
- (void) setProgressStatus:(NSString *)newStatus;
- (BOOL) installOXZ:(NSUInteger)item;
- (BOOL) updateAllOXZ;
- (BOOL) removeOXZ:(NSUInteger)item;
- (NSArray *) installOptions;
- (NSArray *) removeOptions;
@ -799,10 +801,11 @@ static OOOXZManager *sSingleton = nil;
foreach (requirement, tempStack)
{
OOLog(kOOOXZDebugLog,@"Dependency stack: checking %@",[requirement oo_stringForKey:kOOManifestRelationIdentifier]);
if (![ResourceManager manifest:downloadedManifest HasUnmetDependency:requirement logErrors:NO])
if (![ResourceManager manifest:downloadedManifest HasUnmetDependency:requirement logErrors:NO]
&& requires != nil && [requires containsObject:requirement])
{
// it was unmet, but now it's met
[progress appendFormat:DESC(@"oolite-oxzmanager-progress-now-has-@"),[requirement oo_stringForKey:kOOManifestRelationDescription defaultValue:[requirement oo_stringForKey:kOOManifestRelationIdentifier]]];
// it was unmet, but now it's met
[_dependencyStack removeObject:requirement];
OOLog(kOOOXZDebugLog, @"%@", @"Dependency stack: requirement met");
} else if ([[requirement oo_stringForKey:kOOManifestRelationIdentifier] isEqualToString:[downloadedManifest oo_stringForKey:kOOManifestIdentifier]]) {
@ -996,25 +999,27 @@ static OOOXZManager *sSingleton = nil;
{
return OXZ_INSTALLABLE_CONFLICTS;
}
if ([ResourceManager manifestHasMissingDependencies:manifest logErrors:NO])
if (installed != nil)
{
NSString *availableVersion = [manifest oo_stringForKey:kOOManifestAvailableVersion];
if (availableVersion == nil)
{
availableVersion = [manifest oo_stringForKey:kOOManifestVersion];
}
NSString *installedVersion = [installed oo_stringForKey:kOOManifestVersion];
OOLog(@"version.debug",@"%@ mv:%@ mav:%@",identifier,installedVersion,availableVersion);
if (CompareVersions(ComponentsFromVersionString(installedVersion),ComponentsFromVersionString(availableVersion)) == NSOrderedDescending)
{
// the installed copy is more recent than the server copy
return OXZ_UNINSTALLABLE_NOREMOTE;
}
return OXZ_INSTALLABLE_UPDATE;
}
if ([ResourceManager manifestHasMissingDependencies:manifest logErrors:NO])
{
return OXZ_INSTALLABLE_DEPENDENCIES;
}
else
{
if (installed != nil)
{
OOLog(@"version.debug",@"%@ mv:%@ mav:%@",identifier,[installed oo_stringForKey:kOOManifestVersion],[manifest oo_stringForKey:kOOManifestVersion]);
// if (CompareVersions(ComponentsFromVersionString([installed oo_stringForKey:kOOManifestVersion]),ComponentsFromVersionString([installed oo_stringForKey:kOOManifestAvailableVersion])) == NSOrderedDescending)
if (CompareVersions(ComponentsFromVersionString([installed oo_stringForKey:kOOManifestVersion]),ComponentsFromVersionString([manifest oo_stringForKey:kOOManifestVersion])) == NSOrderedDescending)
{
// the installed copy is more recent than the server copy
return OXZ_UNINSTALLABLE_NOREMOTE;
}
return OXZ_INSTALLABLE_UPDATE;
}
return OXZ_INSTALLABLE_OKAY;
}
return OXZ_INSTALLABLE_OKAY;
}
@ -1140,6 +1145,8 @@ static OOOXZManager *sSingleton = nil;
[gui setKey:@"_REMOVE" forRow:OXZ_GUI_ROW_REMOVE];
[gui setText:DESC(@"oolite-oxzmanager-update-list") forRow:OXZ_GUI_ROW_UPDATE align:GUI_ALIGN_CENTER];
[gui setKey:@"_UPDATE" forRow:OXZ_GUI_ROW_UPDATE];
[gui setText:DESC(@"oolite-oxzmanager-update-all") forRow:OXZ_GUI_ROW_UPDATE_ALL align:GUI_ALIGN_CENTER];
[gui setKey:@"_UPDATE_ALL" forRow:OXZ_GUI_ROW_UPDATE_ALL];
startRow = OXZ_GUI_ROW_INSTALL;
break;
@ -1408,6 +1415,11 @@ static OOOXZManager *sSingleton = nil;
_interfaceState = OXZ_STATE_PICK_REMOVE;
}
}
else if (selection == OXZ_GUI_ROW_UPDATE_ALL)
{
OOLog(kOOOXZDebugLog, @"Trying to update all managed OXPs");
[self updateAllOXZ];
}
else if (selection == OXZ_GUI_ROW_LISTPREV)
{
[self processOptionsPrev];
@ -1632,6 +1644,37 @@ static OOOXZManager *sSingleton = nil;
}
- (BOOL) updateAllOXZ
{
[_dependencyStack removeAllObjects];
_downloadAllDependencies = YES;
[self setFilteredList:_oxzList];
NSDictionary *manifest = nil;
foreach (manifest,_oxzList)
{
if ([self installableState:manifest] == OXZ_INSTALLABLE_UPDATE)
{
OOLog(kOOOXZDebugLog, @"Queuing in for update: %@", manifest);
[_dependencyStack addObject:manifest];
}
}
NSDictionary *first = [_dependencyStack anyObject];
NSString* identifier = [first oo_stringForKey:kOOManifestRelationIdentifier];
NSUInteger item = NSUIntegerMax;
NSDictionary *availableDownload = nil;
foreach (availableDownload, _oxzList)
{
if ([[availableDownload oo_stringForKey:kOOManifestIdentifier] isEqualToString:identifier])
{
item = [_oxzList indexOfObject:availableDownload];
break;
}
}
return [self installOXZ:item];
}
- (NSArray *) installOptions
{
NSUInteger start = _offset;