GNU Octave:从目录而不是tarball构建包

时间:2015-09-03 13:46:25

标签: install octave packages

我目前正在为GNU Octave软件包开发库的接口。通常,GNU Octave中的软件包通过

安装
- (void)application:(UIApplication *)application
didReceiveRemoteNotification:(NSDictionary *)userInfo
fetchCompletionHandler:(void (^)(UIBackgroundFetchResult result))handler
{

    [PFPush handlePush:userInfo];
    NSLog(@"Received notification: %@", userInfo);
    NSString *alertString = [[userInfo objectForKey:@"aps"]valueForKey:@"alert"];


    NSLog(@"%@",alertString);
    NSString *msgType = [userInfo objectForKey:@"messageType"];
    NSString *senderId = [userInfo objectForKey:@"senderId"];
    NSString *receverId = [userInfo objectForKey:@"receverId"];
    NSString *msg = [userInfo objectForKey:@"message"];
    NSString *timeStr = [userInfo objectForKey:@"Time"];
    NSLog(@"msg type%@ senderId %@ receverId %@ message %@",msgType,senderId,receverId,msg);


    if ([AppDelegate isNetworkReachable]){
        if ([msgType isEqualToString:@"CHAT"]) {
            Chatmessage *Cmsg=[[Chatmessage alloc]init];
            Cmsg.chat_date =timeStr;
            Cmsg.chat_image =@"";
            Cmsg.chat_message = msg;
            Cmsg.chat_Receiver_Id = receverId;
            Cmsg.chat_Sender_Id = senderId;
            NSLog(@"recid%@",Cmsg.chat_Receiver_Id);

            NSMutableArray *arryMsg = [[NSMutableArray alloc]init];
            arryMsg = [[DBModelNew database]getChatMessageBasedOnTime:receverId SenId:senderId time_stamp:timeStr message:msg];

            if (arryMsg.count == 0) {
                [[DBModelNew database]insertmsg:Cmsg];
            }

            [[NSNotificationCenter defaultCenter]postNotificationName:@"receivedmessage" object:nil];

            chatHistory *chatObj = [[chatHistory alloc]init];
            chatObj.chat_meta_id = [NSString stringWithFormat:@"%@",senderId];
            chatObj.last_send_message = msg;
            NSDateFormatter* dateFormatter = [[NSDateFormatter alloc] init];
            dateFormatter.dateFormat = @"yyyy-MM-dd HH:mm:ss";
            NSString *str=[dateFormatter stringFromDate:[NSDate date]];
            chatObj.last_time_stamp = [self dateformat:str];
            PFQuery *query = [PFUser query];
            [query whereKey:@"objectId" equalTo:senderId];
            [query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) {
                if (!error) {
                    for (NSDictionary *dict in objects) {

                        [[dict objectForKey:@"ProfilePic"] getDataInBackgroundWithBlock:^(NSData *data, NSError *error) {

                            if (!error) {

                                if (data) {
                                    UIImage *image = [UIImage imageWithData:data];
                                    if (image) {
                                        chatObj.fndimage = image;
                                        chatObj.name = [dict objectForKey:@"name"];
                                        [[DBModelNew database]insertChat:chatObj];
                                        [[NSNotificationCenter defaultCenter]postNotificationName:@"receivedNewMessage" object:nil];                            
                                    }
                                }
                            }

                        }];
                    }
                }
            }];

        }
    }
}

但是,为每次测试压缩包装或多或少都是耗时的。现在我的问题是,是否可以从具有有效包结构的目录中以某种方式调用pkg install tarball_of_the_package.tar.gz 机制,就像在tarball中一样?正在运行

pkg install

从此目录中产生错误:

pkg install . 

甚至将整个路径指定为

unpack: FILETYPE must be "gunzip" for a directory

会导致同样的问题。

目前我正在使用GNU Octave 4.0.0进行开发。

1 个答案:

答案 0 :(得分:2)

大多数软件包在软件包的根目录中都有一个Makefile,其中包含install等目标,可以为您处理。例如,请参阅允许您执行的Makefile for the statistics package

$ hg clone http://hg.code.sf.net/p/octave/statistics
destination directory: statistics
requesting all changes
adding changesets
adding manifests
adding file changes
added 401 changesets with 996 changes to 172 files
updating to branch default
133 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ cd statistics/
$ make install
Creating package version 1.2.4 release ...
rm -rf "statistics-1.2.4"
hg archive --exclude ".hg*" --exclude "Makefile" --type files "statistics-1.2.4"
chmod -R a+rX,u+w,go-w "statistics-1.2.4"
tar cf - --posix "statistics-1.2.4" | gzip -9n > "statistics-1.2.4.tar.gz"
Installing package locally ...
octave --silent --eval 'pkg ("install", "statistics-1.2.4.tar.gz")'
For information about changes from previous versions of the statistics package, run 'news statistics'.

当然,没有什么可以阻止你从Octave会话本身调用make install。统计包示例更好,因为它只有m个文件。如果您的软件包还包含要编译的代码,那么该图像软件包有一个更复杂但不是很多的Makefile