Initial support for RPM SPEC file creation

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/projectcenter/trunk@8545 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Robert Slover 2001-01-10 15:19:42 +00:00
parent e703368ff9
commit dfad5e01b4
6 changed files with 85 additions and 25 deletions

View file

@ -77,6 +77,7 @@ static PCBundleMakefileFactory *_factory = nil;
[string appendString:@"# Bundle\n"]; [string appendString:@"# Bundle\n"];
[string appendString:@"#\n\n"]; [string appendString:@"#\n\n"];
[string appendString:[NSString stringWithFormat:@"PACKAGE_NAME=%@\n",prName]];
[string appendString:[NSString stringWithFormat:@"BUNDLE_NAME=%@\n",prName]]; [string appendString:[NSString stringWithFormat:@"BUNDLE_NAME=%@\n",prName]];
[string appendString:[NSString stringWithFormat:@"BUNDLE_EXTENSION=.bundle\n"]]; [string appendString:[NSString stringWithFormat:@"BUNDLE_EXTENSION=.bundle\n"]];
[string appendString:[NSString stringWithFormat:@"BUNDLE_INSTALL_DIR=%@\n",installDir]]; [string appendString:[NSString stringWithFormat:@"BUNDLE_INSTALL_DIR=%@\n",installDir]];

View file

@ -59,6 +59,8 @@
- (void)buildDidTerminate:(NSNotification *)aNotif; - (void)buildDidTerminate:(NSNotification *)aNotif;
- (void)copyPackageTo:(NSString *)path;
@end @end
@interface PCProjectBuilder (BuildLogging) @interface PCProjectBuilder (BuildLogging)

View file

@ -38,6 +38,8 @@
#define NOTIFICATION_CENTER [NSNotificationCenter defaultCenter] #define NOTIFICATION_CENTER [NSNotificationCenter defaultCenter]
#endif #endif
#define DEFAULT_RPM_PATH @"/usr/src/redhat/SOURCES/"
@interface PCProjectBuilder (CreateUI) @interface PCProjectBuilder (CreateUI)
- (void)_createComponentView; - (void)_createComponentView;
@ -67,7 +69,7 @@
logOutput = [[NSTextView alloc] initWithFrame:NSMakeRect(0,0,516,32)]; logOutput = [[NSTextView alloc] initWithFrame:NSMakeRect(0,0,516,32)];
[logOutput setMaxSize:NSMakeSize(1e7, 1e7)]; [logOutput setMaxSize:NSMakeSize(1e7, 1e7)];
[logOutput setMinSize:NSMakeSize(516, 48)]; // [logOutput setMinSize:NSMakeSize(516, 48)];
[logOutput setRichText:NO]; [logOutput setRichText:NO];
[logOutput setEditable:NO]; [logOutput setEditable:NO];
[logOutput setSelectable:YES]; [logOutput setSelectable:YES];
@ -82,7 +84,6 @@
[scrollView1 setHasVerticalScroller: YES]; [scrollView1 setHasVerticalScroller: YES];
[scrollView1 setBorderType: NSBezelBorder]; [scrollView1 setBorderType: NSBezelBorder];
[scrollView1 setAutoresizingMask:(NSViewWidthSizable | NSViewHeightSizable)]; [scrollView1 setAutoresizingMask:(NSViewWidthSizable | NSViewHeightSizable)];
[scrollView1 autorelease];
/* /*
* *
@ -90,7 +91,7 @@
errorOutput = [[NSTextView alloc] initWithFrame:NSMakeRect(0,0,516,80)]; errorOutput = [[NSTextView alloc] initWithFrame:NSMakeRect(0,0,516,80)];
[errorOutput setMaxSize:NSMakeSize(1e7, 1e7)]; [errorOutput setMaxSize:NSMakeSize(1e7, 1e7)];
[errorOutput setMinSize:NSMakeSize(516, 48)]; //[errorOutput setMinSize:NSMakeSize(516, 48)];
[errorOutput setRichText:NO]; [errorOutput setRichText:NO];
[errorOutput setEditable:NO]; [errorOutput setEditable:NO];
[errorOutput setSelectable:YES]; [errorOutput setSelectable:YES];
@ -105,7 +106,6 @@
[scrollView2 setHasVerticalScroller:YES]; [scrollView2 setHasVerticalScroller:YES];
[scrollView2 setBorderType: NSBezelBorder]; [scrollView2 setBorderType: NSBezelBorder];
[scrollView2 setAutoresizingMask:(NSViewWidthSizable | NSViewHeightSizable)]; [scrollView2 setAutoresizingMask:(NSViewWidthSizable | NSViewHeightSizable)];
[scrollView2 autorelease];
split = [[NSSplitView alloc] initWithFrame:NSMakeRect(0,0,540,188)]; split = [[NSSplitView alloc] initWithFrame:NSMakeRect(0,0,540,188)];
[split setAutoresizingMask: (NSViewWidthSizable | NSViewHeightSizable)]; [split setAutoresizingMask: (NSViewWidthSizable | NSViewHeightSizable)];
@ -114,18 +114,21 @@
[split adjustSubviews]; [split adjustSubviews];
[componentView addSubview:split]; [componentView addSubview:split];
[split autorelease];
RELEASE(scrollView1);
RELEASE(scrollView2);
RELEASE(split);
/* /*
* 5 build Buttons * 6 build Buttons
*/ */
_w_frame = NSMakeRect(0,194,224,44); _w_frame = NSMakeRect(0,194,272,44);
matrix = [[[NSMatrix alloc] initWithFrame: _w_frame matrix = [[NSMatrix alloc] initWithFrame: _w_frame
mode: NSHighlightModeMatrix mode: NSHighlightModeMatrix
prototype: buttonCell prototype: buttonCell
numberOfRows: 1 numberOfRows:1
numberOfColumns: 5] autorelease]; numberOfColumns:6];
[matrix sizeToCells]; [matrix sizeToCells];
[matrix setSelectionByRect:YES]; [matrix setSelectionByRect:YES];
[matrix setAutoresizingMask: (NSViewMaxXMargin | NSViewMinYMargin)]; [matrix setAutoresizingMask: (NSViewMaxXMargin | NSViewMinYMargin)];
@ -133,6 +136,8 @@
[matrix setAction:@selector(build:)]; [matrix setAction:@selector(build:)];
[componentView addSubview:matrix]; [componentView addSubview:matrix];
RELEASE(matrix);
button = [matrix cellAtRow:0 column:0]; button = [matrix cellAtRow:0 column:0];
[button setTag:0]; [button setTag:0];
[button setImagePosition:NSImageOnly]; [button setImagePosition:NSImageOnly];
@ -168,11 +173,18 @@
[button setButtonType:NSMomentaryPushButton]; [button setButtonType:NSMomentaryPushButton];
[button setTitle:@"Install"]; [button setTitle:@"Install"];
button = [matrix cellAtRow:0 column:5];
[button setTag:5];
[button setImagePosition:NSImageOnly];
[button setImage:IMAGE(@"ProjectCenter_rpm")];
[button setButtonType:NSMomentaryPushButton];
[button setTitle:@"Packaging"];
/* /*
* Status * Status
*/ */
textField = [[NSTextField alloc] initWithFrame:NSMakeRect(256,220,48,15)]; textField = [[NSTextField alloc] initWithFrame:NSMakeRect(288,220,48,15)];
[textField setAlignment: NSRightTextAlignment]; [textField setAlignment: NSRightTextAlignment];
[textField setBordered: NO]; [textField setBordered: NO];
[textField setEditable: NO]; [textField setEditable: NO];
@ -181,13 +193,15 @@
[textField setStringValue:@"Status:"]; [textField setStringValue:@"Status:"];
[textField setAutoresizingMask: (NSViewMaxXMargin | [textField setAutoresizingMask: (NSViewMaxXMargin |
NSViewMinYMargin)]; NSViewMinYMargin)];
[componentView addSubview:[textField autorelease]]; [componentView addSubview:textField];
RELEASE(textField);
/* /*
* Status message * Status message
*/ */
buildStatusField = [[NSTextField alloc] initWithFrame:NSMakeRect(308,220,104,15)]; buildStatusField = [[NSTextField alloc] initWithFrame:NSMakeRect(340,220,104,15)];
[buildStatusField setAlignment: NSLeftTextAlignment]; [buildStatusField setAlignment: NSLeftTextAlignment];
[buildStatusField setBordered: NO]; [buildStatusField setBordered: NO];
[buildStatusField setEditable: NO]; [buildStatusField setEditable: NO];
@ -197,13 +211,15 @@
[buildStatusField setAutoresizingMask: (NSViewMaxXMargin | [buildStatusField setAutoresizingMask: (NSViewMaxXMargin |
NSViewWidthSizable | NSViewWidthSizable |
NSViewMinYMargin)]; NSViewMinYMargin)];
[componentView addSubview:[buildStatusField autorelease]]; [componentView addSubview:buildStatusField];
RELEASE(buildStatusField);
/* /*
* Target * Target
*/ */
textField = [[NSTextField alloc] initWithFrame:NSMakeRect(256,196,48,15)]; textField = [[NSTextField alloc] initWithFrame:NSMakeRect(288,196,48,15)];
[textField setAlignment: NSRightTextAlignment]; [textField setAlignment: NSRightTextAlignment];
[textField setBordered: NO]; [textField setBordered: NO];
[textField setBezeled: NO]; [textField setBezeled: NO];
@ -212,13 +228,15 @@
[textField setStringValue:@"Target:"]; [textField setStringValue:@"Target:"];
[textField setAutoresizingMask: (NSViewMaxXMargin | [textField setAutoresizingMask: (NSViewMaxXMargin |
NSViewMinYMargin)]; NSViewMinYMargin)];
[componentView addSubview:[textField autorelease]]; [componentView addSubview:textField];
RELEASE(textField);
/* /*
* Target message * Target message
*/ */
targetField = [[NSTextField alloc] initWithFrame:NSMakeRect(308,196,104,15)]; targetField = [[NSTextField alloc] initWithFrame:NSMakeRect(340,196,104,15)];
[targetField setAlignment: NSLeftTextAlignment]; [targetField setAlignment: NSLeftTextAlignment];
[targetField setBordered: NO]; [targetField setBordered: NO];
[targetField setEditable: NO]; [targetField setEditable: NO];
@ -228,7 +246,9 @@
[targetField setAutoresizingMask: (NSViewMaxXMargin | [targetField setAutoresizingMask: (NSViewMaxXMargin |
NSViewWidthSizable | NSViewWidthSizable |
NSViewMinYMargin)]; NSViewMinYMargin)];
[componentView addSubview:[targetField autorelease]]; [componentView addSubview:targetField];
RELEASE(targetField);
} }
@end @end
@ -273,6 +293,7 @@
NSDictionary *optionDict; NSDictionary *optionDict;
NSString *status; NSString *status;
NSString *target; NSString *target;
SEL postProcess = NULL;
logPipe = [NSPipe pipe]; logPipe = [NSPipe pipe];
readHandle = [[logPipe fileHandleForReading] retain]; readHandle = [[logPipe fileHandleForReading] retain];
@ -296,7 +317,7 @@
} }
status = [NSString stringWithString:@"Cleaning..."]; status = [NSString stringWithString:@"Cleaning..."];
target = [NSString stringWithString:@"Clean"]; target = [NSString stringWithString:@"Clean"];
[args addObject:@"clean"]; [args addObject:@"distclean"];
break; break;
case 2: case 2:
status = [NSString stringWithString:@"Building..."]; status = [NSString stringWithString:@"Building..."];
@ -314,6 +335,14 @@
target = [NSString stringWithString:@"Install"]; target = [NSString stringWithString:@"Install"];
[args addObject:@"install"]; [args addObject:@"install"];
break; break;
case 5:
status = [NSString stringWithString:@"Packaging..."];
target = [NSString stringWithString:@"Making RPM"];
[args addObject:@"specfile"];
postProcess = @selector(copyPackageTo:);
NSRunAlertPanel(@"Creating RPM SPEC",@"After creating the RPM SPEC file you have to invoke \"rpm -ba %@.spec\" in the project directory.\nThis only works if you made a \"make install\" before!",@"OK",nil,nil,[currentProject projectName]);
break;
} }
[buildStatusField setStringValue:status]; [buildStatusField setStringValue:status];
@ -350,6 +379,10 @@
[makeTask launch]; [makeTask launch];
[makeTask waitUntilExit]; [makeTask waitUntilExit];
if (postProcess) {
[self performSelector:postProcess];
}
[buildStatusField setStringValue:@"Waiting..."]; [buildStatusField setStringValue:@"Waiting..."];
[targetField setStringValue:@""]; [targetField setStringValue:@""];
@ -365,9 +398,10 @@
name:NSTaskDidTerminateNotification name:NSTaskDidTerminateNotification
object:makeTask]; object:makeTask];
[readHandle release]; RELEASE(readHandle);
[errorReadHandle release]; RELEASE(errorReadHandle);
[makeTask autorelease];
AUTORELEASE(makeTask);
} }
- (void)logStdOut:(NSNotification *)aNotif - (void)logStdOut:(NSNotification *)aNotif
@ -405,6 +439,28 @@
} }
} }
- (void)copyPackageTo:(NSString *)path
{
NSString *dest;
NSString *source = nil;
if (!path) {
dest = [NSString stringWithString:DEFAULT_RPM_PATH];
}
else {
dest = path;
}
// Create the tar.gz package
// Copy it
if (source) {
[[NSFileManager defaultManager] copyPath:source toPath:dest handler:nil];
}
// Copy the package to path
postProcess = NULL;
}
@end @end
@implementation PCProjectBuilder (BuildLogging) @implementation PCProjectBuilder (BuildLogging)

View file

@ -41,6 +41,7 @@ ProjectCenter_RESOURCE_FILES= \
FileIcon_.m.tiff \ FileIcon_.m.tiff \
FileIcon_rtf.tiff \ FileIcon_rtf.tiff \
ProjectCenter_make.tiff \ ProjectCenter_make.tiff \
ProjectCenter_rpm.tiff \
ProjectCenter_clean.tiff \ ProjectCenter_clean.tiff \
ProjectCenter_debug.tiff \ ProjectCenter_debug.tiff \
ProjectCenter_profile.tiff \ ProjectCenter_profile.tiff \

Binary file not shown.

View file

@ -7,6 +7,6 @@ GCC_VERSION=2.8.0
# The version number of this release. # The version number of this release.
MAJOR_VERSION=0 MAJOR_VERSION=0
MINOR_VERSION=2 MINOR_VERSION=2
SUBMINOR_VERSION=0 SUBMINOR_VERSION=2
PC_VERSION=${MAJOR_VERSION}.${MINOR_VERSION}.${SUBMINOR_VERSION} PC_VERSION=${MAJOR_VERSION}.${MINOR_VERSION}.${SUBMINOR_VERSION}
VERSION=${PC_VERSION} VERSION=${PC_VERSION}