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:@"#\n\n"];
[string appendString:[NSString stringWithFormat:@"PACKAGE_NAME=%@\n",prName]];
[string appendString:[NSString stringWithFormat:@"BUNDLE_NAME=%@\n",prName]];
[string appendString:[NSString stringWithFormat:@"BUNDLE_EXTENSION=.bundle\n"]];
[string appendString:[NSString stringWithFormat:@"BUNDLE_INSTALL_DIR=%@\n",installDir]];

View file

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

View file

@ -38,6 +38,8 @@
#define NOTIFICATION_CENTER [NSNotificationCenter defaultCenter]
#endif
#define DEFAULT_RPM_PATH @"/usr/src/redhat/SOURCES/"
@interface PCProjectBuilder (CreateUI)
- (void)_createComponentView;
@ -67,7 +69,7 @@
logOutput = [[NSTextView alloc] initWithFrame:NSMakeRect(0,0,516,32)];
[logOutput setMaxSize:NSMakeSize(1e7, 1e7)];
[logOutput setMinSize:NSMakeSize(516, 48)];
// [logOutput setMinSize:NSMakeSize(516, 48)];
[logOutput setRichText:NO];
[logOutput setEditable:NO];
[logOutput setSelectable:YES];
@ -82,7 +84,6 @@
[scrollView1 setHasVerticalScroller: YES];
[scrollView1 setBorderType: NSBezelBorder];
[scrollView1 setAutoresizingMask:(NSViewWidthSizable | NSViewHeightSizable)];
[scrollView1 autorelease];
/*
*
@ -90,7 +91,7 @@
errorOutput = [[NSTextView alloc] initWithFrame:NSMakeRect(0,0,516,80)];
[errorOutput setMaxSize:NSMakeSize(1e7, 1e7)];
[errorOutput setMinSize:NSMakeSize(516, 48)];
//[errorOutput setMinSize:NSMakeSize(516, 48)];
[errorOutput setRichText:NO];
[errorOutput setEditable:NO];
[errorOutput setSelectable:YES];
@ -105,7 +106,6 @@
[scrollView2 setHasVerticalScroller:YES];
[scrollView2 setBorderType: NSBezelBorder];
[scrollView2 setAutoresizingMask:(NSViewWidthSizable | NSViewHeightSizable)];
[scrollView2 autorelease];
split = [[NSSplitView alloc] initWithFrame:NSMakeRect(0,0,540,188)];
[split setAutoresizingMask: (NSViewWidthSizable | NSViewHeightSizable)];
@ -114,18 +114,21 @@
[split adjustSubviews];
[componentView addSubview:split];
[split autorelease];
RELEASE(scrollView1);
RELEASE(scrollView2);
RELEASE(split);
/*
* 5 build Buttons
* 6 build Buttons
*/
_w_frame = NSMakeRect(0,194,224,44);
matrix = [[[NSMatrix alloc] initWithFrame: _w_frame
mode: NSHighlightModeMatrix
prototype: buttonCell
numberOfRows: 1
numberOfColumns: 5] autorelease];
_w_frame = NSMakeRect(0,194,272,44);
matrix = [[NSMatrix alloc] initWithFrame: _w_frame
mode: NSHighlightModeMatrix
prototype: buttonCell
numberOfRows:1
numberOfColumns:6];
[matrix sizeToCells];
[matrix setSelectionByRect:YES];
[matrix setAutoresizingMask: (NSViewMaxXMargin | NSViewMinYMargin)];
@ -133,6 +136,8 @@
[matrix setAction:@selector(build:)];
[componentView addSubview:matrix];
RELEASE(matrix);
button = [matrix cellAtRow:0 column:0];
[button setTag:0];
[button setImagePosition:NSImageOnly];
@ -168,11 +173,18 @@
[button setButtonType:NSMomentaryPushButton];
[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
*/
textField = [[NSTextField alloc] initWithFrame:NSMakeRect(256,220,48,15)];
textField = [[NSTextField alloc] initWithFrame:NSMakeRect(288,220,48,15)];
[textField setAlignment: NSRightTextAlignment];
[textField setBordered: NO];
[textField setEditable: NO];
@ -181,13 +193,15 @@
[textField setStringValue:@"Status:"];
[textField setAutoresizingMask: (NSViewMaxXMargin |
NSViewMinYMargin)];
[componentView addSubview:[textField autorelease]];
[componentView addSubview:textField];
RELEASE(textField);
/*
* Status message
*/
buildStatusField = [[NSTextField alloc] initWithFrame:NSMakeRect(308,220,104,15)];
buildStatusField = [[NSTextField alloc] initWithFrame:NSMakeRect(340,220,104,15)];
[buildStatusField setAlignment: NSLeftTextAlignment];
[buildStatusField setBordered: NO];
[buildStatusField setEditable: NO];
@ -197,13 +211,15 @@
[buildStatusField setAutoresizingMask: (NSViewMaxXMargin |
NSViewWidthSizable |
NSViewMinYMargin)];
[componentView addSubview:[buildStatusField autorelease]];
[componentView addSubview:buildStatusField];
RELEASE(buildStatusField);
/*
* Target
*/
textField = [[NSTextField alloc] initWithFrame:NSMakeRect(256,196,48,15)];
textField = [[NSTextField alloc] initWithFrame:NSMakeRect(288,196,48,15)];
[textField setAlignment: NSRightTextAlignment];
[textField setBordered: NO];
[textField setBezeled: NO];
@ -212,13 +228,15 @@
[textField setStringValue:@"Target:"];
[textField setAutoresizingMask: (NSViewMaxXMargin |
NSViewMinYMargin)];
[componentView addSubview:[textField autorelease]];
[componentView addSubview:textField];
RELEASE(textField);
/*
* Target message
*/
targetField = [[NSTextField alloc] initWithFrame:NSMakeRect(308,196,104,15)];
targetField = [[NSTextField alloc] initWithFrame:NSMakeRect(340,196,104,15)];
[targetField setAlignment: NSLeftTextAlignment];
[targetField setBordered: NO];
[targetField setEditable: NO];
@ -228,7 +246,9 @@
[targetField setAutoresizingMask: (NSViewMaxXMargin |
NSViewWidthSizable |
NSViewMinYMargin)];
[componentView addSubview:[targetField autorelease]];
[componentView addSubview:targetField];
RELEASE(targetField);
}
@end
@ -273,6 +293,7 @@
NSDictionary *optionDict;
NSString *status;
NSString *target;
SEL postProcess = NULL;
logPipe = [NSPipe pipe];
readHandle = [[logPipe fileHandleForReading] retain];
@ -296,7 +317,7 @@
}
status = [NSString stringWithString:@"Cleaning..."];
target = [NSString stringWithString:@"Clean"];
[args addObject:@"clean"];
[args addObject:@"distclean"];
break;
case 2:
status = [NSString stringWithString:@"Building..."];
@ -314,6 +335,14 @@
target = [NSString stringWithString:@"Install"];
[args addObject:@"install"];
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];
@ -350,6 +379,10 @@
[makeTask launch];
[makeTask waitUntilExit];
if (postProcess) {
[self performSelector:postProcess];
}
[buildStatusField setStringValue:@"Waiting..."];
[targetField setStringValue:@""];
@ -365,9 +398,10 @@
name:NSTaskDidTerminateNotification
object:makeTask];
[readHandle release];
[errorReadHandle release];
[makeTask autorelease];
RELEASE(readHandle);
RELEASE(errorReadHandle);
AUTORELEASE(makeTask);
}
- (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
@implementation PCProjectBuilder (BuildLogging)

View file

@ -41,6 +41,7 @@ ProjectCenter_RESOURCE_FILES= \
FileIcon_.m.tiff \
FileIcon_rtf.tiff \
ProjectCenter_make.tiff \
ProjectCenter_rpm.tiff \
ProjectCenter_clean.tiff \
ProjectCenter_debug.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.
MAJOR_VERSION=0
MINOR_VERSION=2
SUBMINOR_VERSION=0
SUBMINOR_VERSION=2
PC_VERSION=${MAJOR_VERSION}.${MINOR_VERSION}.${SUBMINOR_VERSION}
VERSION=${PC_VERSION}