rename subcommand pull to install

This commit is contained in:
SANO Masatoshi 2014-10-19 08:29:36 +09:00
parent 02b8e435d1
commit bd81721e26
8 changed files with 18 additions and 48 deletions

View file

@ -6,8 +6,8 @@ bin_PROGRAMS = ros
ros_SOURCES = lsp.c opt.c download.c util.c archive.c html.c\
cmds/version/cmd.c \
cmds/run/cmd.c cmds/run/sbcl.c\
cmds/pull/cmd.c cmds/pull/sbcl.c cmds/pull/sbcl-bin.c \
cmds/install/cmd.c cmds/install/sbcl.c cmds/install/sbcl-bin.c \
cmds/list/cmd.c \
cmds/help/cmd.c \
cmds/config/cmd.c
noinst_HEADERS = util.h opt.h cmds/pull/pull.h
noinst_HEADERS = util.h opt.h cmds/install/ros_install.h

View file

@ -1,5 +1,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <archive.h>
#include <archive_entry.h>
#ifdef HAVE_CONFIG_H
@ -8,7 +9,7 @@
#include "opt.h"
#include "util.h"
#include "pull.h"
#include "ros_install.h"
static int in_resume=0;
static char *flags =NULL;
struct install_impls *install_impl;
@ -159,48 +160,14 @@ int expand(struct install_options* param)
return 1;
}
int configure(struct install_options* param)
{
char *impl=param->impl,*version=param->version;
char* home= homedir();
char* confgcache= cat(home,"/src/",impl,"-",version,"/src/confg.cache",NULL);
char* cd;
char* configure;
int ret;
if(in_resume) {
delete_file(confgcache);
}
if(flags==NULL) {
flags=q("");
}
if(strcmp("gcl",impl)==0) {
flags=s_cat(flags,q(" --enable-ansi"));
}
if(strcmp("ecl",impl)==0 ||strcmp("ecl",impl)==0 || strcmp("clisp",impl)==0) {
flags=s_cat(flags,q(" --mandir="),q(home),q("/share/man"));
}
printf("Configuring %s/%s\n",impl,version);
cd=cat(home,"src/",impl,"-",version,NULL);
printf ("cd:%s\n",cd);
change_directory(cd);
/* pipe connect for logging cim_with_output_control */
configure=cat("./configure ",flags," --prefix=",home,"/impls/",impl,"-",version,NULL);
ret=system(configure);
s(configure);
s(cd);
s(confgcache);
s(home);
}
install_cmds install_full[]={
start,
download,
expand,
configure,
NULL
};
int cmd_pull(int argc,char **argv,struct sub_command* cmd)
int cmd_install(int argc,char **argv,struct sub_command* cmd)
{
int ret=1,k;
install_cmds *cmds=NULL;
@ -261,7 +228,7 @@ int cmd_pull(int argc,char **argv,struct sub_command* cmd)
return ret;
}
void register_cmd_pull(void)
void register_cmd_install(void)
{
top_commands=add_command(top_commands,"install" ,NULL,cmd_pull,1,1,"Install archive and build it for "PACKAGE" environment",NULL);
top_commands=add_command(top_commands,"install" ,NULL,cmd_install,1,1,"Install archive and build it for "PACKAGE" environment",NULL);
}

View file

@ -1,7 +1,7 @@
#include <stdio.h>
#include <stdlib.h>
#include "util.h"
#include "pull.h"
#include "ros_install.h"
#include "opt.h"
extern int sbcl_install(struct install_options* param);

View file

@ -2,7 +2,7 @@
#include <stdlib.h>
#include <string.h>
#include "util.h"
#include "pull.h"
#include "ros_install.h"
#include "opt.h"
int sbcl_start(struct install_options* param)

View file

@ -20,7 +20,7 @@ extern int cmd_config(int argc,char **argv,struct sub_command* cmd);
extern int cmd_help(int argc,char **argv,struct sub_command* cmd);
extern void register_cmd_run(void);
extern void register_cmd_pull(void);
extern void register_cmd_install(void);
int verbose=0;
//dummy
int cmd_notyet(int argc,char **argv,struct sub_command* cmd)
@ -29,11 +29,11 @@ int cmd_notyet(int argc,char **argv,struct sub_command* cmd)
return 1;
}
LVal top_commands =NULL;
LVal top_options =NULL;
LVal top_commands =(LVal)NULL;
LVal top_options =(LVal)NULL;
LVal top_helps =NULL;
LVal subcommand_name=NULL;
LVal top_helps =(LVal)NULL;
LVal subcommand_name=(LVal)NULL;
int proccmd(int argc,char** argv,LVal option,LVal command) {
int i;
@ -193,7 +193,7 @@ int main (int argc,char **argv) {
top_options=nreverse(top_options);
/*commands*/
register_cmd_pull();
register_cmd_install();
top_commands=add_command(top_commands,"config" ,NULL,cmd_config,1,1,"Get and set options",NULL);
/* {"list",NULL,cmd_list,1,1}, */

View file

@ -53,6 +53,7 @@ extern int verbose;
LVal add_help(LVal help,const char* name,const char* usage,LVal commands,LVal opts,const char* header,const char* footer);
LVal add_command(LVal cmd,const char* name,const char* short_name,sub_command_fnc call,int show_opt,int terminating,char* description,char* arg_example);
struct opts* load_opts(const char* path);
int save_opts(const char* path,struct opts* opt);
int set_opt(struct opts** opts,const char* name,char* value,int type);
int unset_opt(struct opts** opts,const char* name);
char* get_opt(const char* name);

View file

@ -7,6 +7,8 @@
extern char** argv_orig;
extern int argc_orig;
int download_simple (char* uri,char* path,int verbose);
typedef intptr_t LVal;
struct Cons {
LVal val;