Changeset 4475


Ignore:
Timestamp:
06/04/08 17:34:52 (5 years ago)
Author:
thomas
Message:

opkg: remove unused code

Location:
trunk/src/target/opkg/libopkg
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/target/opkg/libopkg/libopkg.c

    r4473 r4475  
    2929opkg_status_callback opkg_cb_status = NULL; 
    3030opkg_list_callback opkg_cb_list = NULL; 
    31  
    32  
    33 int 
    34 opkg_init (opkg_message_callback mcall,  
    35            opkg_response_callback rcall, 
    36            args_t * args) 
    37 { 
    38         opkg_cb_message = mcall; 
    39         opkg_cb_response = rcall; 
    40  
    41         args_init (args); 
    42  
    43         return 0; 
    44 } 
    45  
    46  
    47 int 
    48 opkg_deinit (args_t * args) 
    49 { 
    50         args_deinit (args); 
    51         opkg_cb_message = NULL; 
    52         opkg_cb_response = NULL; 
    53  
    54         /* place other cleanup stuff here */ 
    55  
    56         return 0; 
    57 } 
    58  
    59  
    60 int 
    61 opkg_packages_list(args_t *args,  
    62                    const char *packages,  
    63                    opkg_list_callback cblist, 
    64                    void *userdata) 
    65 { 
    66         opkg_cmd_t *cmd; 
    67         opkg_conf_t opkg_conf; 
    68         int err; 
    69  
    70         err = opkg_conf_init (&opkg_conf, args); 
    71         if (err) 
    72         { 
    73                 return err; 
    74         } 
    75  
    76         opkg_cb_list = cblist; 
    77         /* we need to do this because of static declarations,  
    78          * maybe a good idea to change */ 
    79         cmd = opkg_cmd_find ("list"); 
    80         if (packages) 
    81                 err = opkg_cmd_exec (cmd, &opkg_conf, 1, &packages, userdata); 
    82         else 
    83                 err = opkg_cmd_exec (cmd, &opkg_conf, 0, NULL, userdata); 
    84         opkg_cb_list = NULL; 
    85         opkg_conf_deinit (&opkg_conf); 
    86         return (err); 
    87 } 
    88  
    89  
    90 int 
    91 opkg_packages_status(args_t *args, 
    92                      const char *packages, 
    93                      opkg_status_callback cbstatus, 
    94                      void *userdata) 
    95 { 
    96         opkg_cmd_t *cmd; 
    97         opkg_conf_t opkg_conf; 
    98         int err; 
    99  
    100         err = opkg_conf_init (&opkg_conf, args); 
    101         if (err) 
    102         { 
    103                 return err; 
    104         } 
    105  
    106         opkg_cb_status = cbstatus; 
    107  
    108         /* we need to do this because of static declarations, 
    109          * maybe a good idea to change */ 
    110         cmd = opkg_cmd_find ("status"); 
    111         if (packages) 
    112                 err = opkg_cmd_exec (cmd, &opkg_conf, 1, &packages, userdata); 
    113         else 
    114                 err = opkg_cmd_exec (cmd, &opkg_conf, 0, NULL, userdata); 
    115  
    116         opkg_cb_status = NULL; 
    117         opkg_conf_deinit (&opkg_conf); 
    118         return (err); 
    119 } 
    120  
    121  
    122 int 
    123 opkg_packages_info(args_t *args, 
    124                    const char *packages, 
    125                    opkg_status_callback cbstatus, 
    126                    void *userdata) 
    127 { 
    128         opkg_cmd_t *cmd; 
    129         opkg_conf_t opkg_conf; 
    130         int err; 
    131  
    132         err = opkg_conf_init (&opkg_conf, args); 
    133         if (err) 
    134         { 
    135                 return err; 
    136         } 
    137  
    138         opkg_cb_status = cbstatus; 
    139  
    140         /* we need to do this because of static declarations, 
    141          * maybe a good idea to change */ 
    142         cmd = opkg_cmd_find ("info"); 
    143         if (packages) 
    144                 err = opkg_cmd_exec (cmd, &opkg_conf, 1, &packages, userdata); 
    145         else 
    146                 err = opkg_cmd_exec (cmd, &opkg_conf, 0, NULL, userdata); 
    147  
    148         opkg_cb_status = NULL; 
    149         opkg_conf_deinit (&opkg_conf); 
    150         return (err); 
    151 } 
    152  
    153  
    154 int 
    155 opkg_packages_install (args_t * args, const char *name) 
    156 { 
    157         opkg_cmd_t *cmd; 
    158         opkg_conf_t opkg_conf; 
    159         int err; 
    160  
    161         /* this error should be handled in application */ 
    162         if (!name || !strlen (name)) 
    163                 return (-1); 
    164  
    165         err = opkg_conf_init (&opkg_conf, args); 
    166         if (err) 
    167         { 
    168                 return err; 
    169         } 
    170  
    171         /* we need to do this because of static declarations, 
    172          * maybe a good idea to change */ 
    173         cmd = opkg_cmd_find ("install"); 
    174         err = opkg_cmd_exec (cmd, &opkg_conf, 1, &name, NULL); 
    175  
    176         opkg_conf_deinit(&opkg_conf); 
    177         return (err); 
    178 } 
    179  
    180  
    181 int 
    182 opkg_packages_remove(args_t *args, const char *name, int purge) 
    183 { 
    184         opkg_cmd_t *cmd; 
    185         opkg_conf_t opkg_conf; 
    186         int err; 
    187  
    188         /* this error should be handled in application */ 
    189         if (!name || !strlen (name)) 
    190                 return (-1); 
    191  
    192         err = opkg_conf_init (&opkg_conf, args); 
    193         if (err) 
    194         { 
    195                 return err; 
    196         } 
    197  
    198         /* we need to do this because of static declarations,  
    199          * maybe a good idea to change */ 
    200         if (purge) 
    201                 cmd = opkg_cmd_find ("purge"); 
    202         else 
    203                 cmd = opkg_cmd_find ("remove"); 
    204  
    205         err = opkg_cmd_exec (cmd, &opkg_conf, 1, &name, NULL); 
    206          
    207         opkg_conf_deinit(&opkg_conf); 
    208         return (err); 
    209 } 
    210  
    211  
    212 int  
    213 opkg_lists_update(args_t *args) 
    214 { 
    215         opkg_cmd_t *cmd; 
    216         opkg_conf_t opkg_conf; 
    217         int err; 
    218  
    219         err = opkg_conf_init (&opkg_conf, args); 
    220         if (err) 
    221         { 
    222                 return err; 
    223         } 
    224  
    225         /* we need to do this because of static declarations,  
    226          * maybe a good idea to change */ 
    227         cmd = opkg_cmd_find ("update"); 
    228  
    229         err = opkg_cmd_exec (cmd, &opkg_conf, 0, NULL, NULL); 
    230          
    231         opkg_conf_deinit(&opkg_conf); 
    232         return (err); 
    233 } 
    234  
    235  
    236 int  
    237 opkg_packages_upgrade(args_t *args) 
    238 { 
    239         opkg_cmd_t *cmd; 
    240         opkg_conf_t opkg_conf; 
    241         int err; 
    242  
    243         err = opkg_conf_init (&opkg_conf, args); 
    244         if (err) 
    245         { 
    246                 return err; 
    247         } 
    248  
    249         /* we need to do this because of static declarations,  
    250          * maybe a good idea to change */ 
    251         cmd = opkg_cmd_find ("upgrade"); 
    252  
    253         err = opkg_cmd_exec (cmd, &opkg_conf, 0, NULL, NULL); 
    254          
    255         opkg_conf_deinit(&opkg_conf); 
    256         return (err); 
    257 } 
    258  
    259  
    260 int 
    261 opkg_packages_download (args_t * args, const char *name) 
    262 { 
    263         opkg_cmd_t *cmd; 
    264         opkg_conf_t opkg_conf; 
    265         int err; 
    266  
    267         /* this error should be handled in application */ 
    268         if (!name || !strlen (name)) 
    269                 return (-1); 
    270  
    271         err = opkg_conf_init (&opkg_conf, args); 
    272         if (err) 
    273         { 
    274                 opkg_print_error_list (&opkg_conf); 
    275                 return err; 
    276         } 
    277  
    278         /* we need to do this because of static declarations, 
    279          * maybe a good idea to change */ 
    280         cmd = opkg_cmd_find ("download"); 
    281         err = opkg_cmd_exec (cmd, &opkg_conf, 1, &name, NULL); 
    282  
    283         opkg_conf_deinit(&opkg_conf); 
    284         return (err); 
    285 } 
    286  
    287  
    288 int 
    289 opkg_package_files(args_t *args,  
    290                    const char *name,  
    291                    opkg_list_callback cblist, 
    292                    void *userdata) 
    293 { 
    294         opkg_cmd_t *cmd; 
    295         opkg_conf_t opkg_conf; 
    296         int err; 
    297  
    298         /* this error should be handled in application */ 
    299         if (!name || !strlen (name)) 
    300                 return (-1); 
    301  
    302         err = opkg_conf_init (&opkg_conf, args); 
    303         if (err) 
    304         { 
    305                 return err; 
    306         } 
    307  
    308         opkg_cb_list = cblist; 
    309          
    310         /* we need to do this because of static declarations,  
    311          * maybe a good idea to change */ 
    312         cmd = opkg_cmd_find ("files"); 
    313  
    314         err = opkg_cmd_exec (cmd, &opkg_conf, 1, &name, userdata); 
    315          
    316         opkg_cb_list = NULL; 
    317         opkg_conf_deinit(&opkg_conf); 
    318         return (err); 
    319 } 
    320  
    321  
    322 int  
    323 opkg_file_search(args_t *args,  
    324                 const char *file, 
    325                                 opkg_list_callback cblist, 
    326                 void *userdata) 
    327 { 
    328         opkg_cmd_t *cmd; 
    329         opkg_conf_t opkg_conf; 
    330         int err; 
    331          
    332         /* this error should be handled in application */ 
    333         if (!file || !strlen (file)) 
    334                 return (-1); 
    335  
    336         err = opkg_conf_init (&opkg_conf, args); 
    337         if (err) 
    338         { 
    339                 return err; 
    340         } 
    341  
    342         opkg_cb_list = cblist; 
    343  
    344         /* we need to do this because of static declarations,  
    345          * maybe a good idea to change */ 
    346         cmd = opkg_cmd_find ("search"); 
    347         err = opkg_cmd_exec (cmd, &opkg_conf, 1, &file, userdata); 
    348          
    349         opkg_cb_list = NULL; 
    350         opkg_conf_deinit(&opkg_conf); 
    351         return(err); 
    352 } 
    353  
    354  
    355 int  
    356 opkg_file_what(args_t *args, const char *file, const char* command) 
    357 { 
    358         opkg_cmd_t *cmd; 
    359         opkg_conf_t opkg_conf; 
    360         int err; 
    361          
    362         /* this error should be handled in application */ 
    363         if (!file || !strlen (file)) 
    364                 return (-1); 
    365  
    366         err = opkg_conf_init (&opkg_conf, args); 
    367         if (err) 
    368         { 
    369                 return err; 
    370         } 
    371  
    372         /* we need to do this because of static declarations,  
    373          * maybe a good idea to change */ 
    374         cmd = opkg_cmd_find (command); 
    375         err = opkg_cmd_exec (cmd, &opkg_conf, 1, &file, NULL); 
    376          
    377         opkg_conf_deinit(&opkg_conf); 
    378         return(err); 
    379 } 
    380  
    381 #define opkg_package_whatdepends(args,file) opkg_file_what(args,file,"whatdepends") 
    382 #define opkg_package_whatrecommends(args, file) opkg_file_what(args,file,"whatrecommends") 
    383 #define opkg_package_whatprovides(args, file) opkg_file_what(args,file,"whatprovides") 
    384 #define opkg_package_whatconflicts(args, file) opkg_file_what(args,file,"whatconflicts") 
    385 #define opkg_package_whatreplaces(args, file) opkg_file_what(args,file,"whatreplaces") 
    386  
    38731 
    38832int default_opkg_message_callback(opkg_conf_t *conf, message_level_t level,  
  • trunk/src/target/opkg/libopkg/libopkg.h

    r4357 r4475  
    3737        pkg_state_status_t status, void *userdata); 
    3838typedef void (*opkg_progress_callback)(int complete, int total, void *userdata); 
    39  
    4039extern int opkg_op(int argc, char *argv[]); /* opkglib.c */ 
    41 extern int opkg_init (opkg_message_callback mcall,  
    42                       opkg_response_callback rcall, 
    43                                           args_t * args); 
    44  
    45 extern int opkg_deinit (args_t *args); 
    46 extern int opkg_packages_list(args_t *args,  
    47                               const char *packages,  
    48                               opkg_list_callback cblist, 
    49                               void *userdata); 
    50 extern int opkg_packages_status(args_t *args,  
    51                                 const char *packages,  
    52                                 opkg_status_callback cbstatus, 
    53                                                                 void *userdata); 
    54 extern int opkg_packages_info(args_t *args, 
    55                               const char *packages, 
    56                               opkg_status_callback cbstatus, 
    57                               void *userdata); 
    58 extern int opkg_packages_install(args_t *args, const char *name); 
    59 extern int opkg_packages_remove(args_t *args, const char *name, int purge); 
    60 extern int opkg_lists_update(args_t *args); 
    61 extern int opkg_packages_upgrade(args_t *args); 
    62 extern int opkg_packages_download(args_t *args, const char *name); 
    63 extern int opkg_package_files(args_t *args, 
    64                               const char *name, 
    65                                                           opkg_list_callback cblist, 
    66                                                           void *userdata); 
    67 extern int opkg_file_search(args_t *args, 
    68                             const char *file, 
    69                                                         opkg_list_callback cblist, 
    70                                                         void *userdata); 
    71 extern int opkg_package_whatdepends(args_t *args, const char *file); 
    72 extern int opkg_package_whatrecommends(args_t *args, const char *file); 
    73 extern int opkg_package_whatprovides(args_t *args, const char *file); 
    74 extern int opkg_package_whatconflicts(args_t *args, const char *file); 
    75 extern int opkg_package_whatreplaces(args_t *args, const char *file); 
    7640 
    7741extern opkg_message_callback opkg_cb_message; /* opkg_message.c */ 
     
    8145extern opkg_download_progress_callback opkg_cb_download_progress; /* opkg_download.c */ 
    8246extern opkg_state_changed_callback opkg_cb_state_changed; /* opkg_state.c */ 
    83  
    8447#endif 
  • trunk/src/target/opkg/libopkg/opkg_cmd.c

    r4473 r4475  
    7373static int opkg_print_architecture_cmd(opkg_conf_t *conf, int argc, char **argv); 
    7474static int opkg_configure_cmd(opkg_conf_t *conf, int argc, char **argv); 
     75static int pkg_mark_provides(pkg_t *pkg); 
    7576 
    7677/* XXX: CLEANUP: The usage strings should be incorporated into this 
     
    301302 
    302303 
    303 /* scan the args passed and cache the local filenames of the packages */ 
    304 int opkg_multiple_files_scan(opkg_conf_t *conf, int argc, char **argv) 
    305 { 
    306      int i; 
    307      int err; 
    308      
    309      /*  
    310       * First scan through package names/urls 
    311       * For any urls, download the packages and install in database. 
    312       * For any files, install package info in database. 
    313       */ 
    314      for (i = 0; i < argc; i ++) { 
    315           char *filename = argv [i]; 
    316           //char *tmp = basename (tmp); 
    317           //int tmplen = strlen (tmp); 
    318  
    319           //if (strcmp (tmp + (tmplen - strlen (OPKG_PKG_EXTENSION)), OPKG_PKG_EXTENSION) != 0) 
    320           //     continue; 
    321           //if (strcmp (tmp + (tmplen - strlen (DPKG_PKG_EXTENSION)), DPKG_PKG_EXTENSION) != 0) 
    322           //     continue; 
    323          
    324           opkg_message(conf, OPKG_DEBUG2, "Debug mfs: %s  \n",filename ); 
    325  
    326           err = opkg_prepare_url_for_install(conf, filename, &argv[i]); 
    327           if (err) 
    328             return err; 
    329      } 
    330      return 0; 
    331 } 
    332  
    333304struct opkg_intercept 
    334305{ 
     
    339310typedef struct opkg_intercept *opkg_intercept_t; 
    340311 
    341 opkg_intercept_t opkg_prep_intercepts(opkg_conf_t *conf) 
     312static opkg_intercept_t opkg_prep_intercepts(opkg_conf_t *conf) 
    342313{ 
    343314    opkg_intercept_t ctx; 
     
    368339} 
    369340 
    370 int opkg_finalize_intercepts(opkg_intercept_t ctx) 
     341static int opkg_finalize_intercepts(opkg_intercept_t ctx) 
    371342{ 
    372343    char *cmd; 
     
    416387   pkg_vec ordered will finally contain the ordered set of packages. 
    417388*/ 
    418 int opkg_recurse_pkgs_in_order(opkg_conf_t *conf, pkg_t *pkg, pkg_vec_t *all, 
     389static int opkg_recurse_pkgs_in_order(opkg_conf_t *conf, pkg_t *pkg, pkg_vec_t *all, 
    419390                               pkg_vec_t *visited, pkg_vec_t *ordered) 
    420391{ 
     
    498469} 
    499470 
    500 int opkg_configure_packages(opkg_conf_t *conf, char *pkg_name) 
     471static int opkg_configure_packages(opkg_conf_t *conf, char *pkg_name) 
    501472{ 
    502473    pkg_vec_t *all, *ordered, *visited; 
     
    13301301} 
    13311302 
    1332 int pkg_mark_provides(pkg_t *pkg) 
     1303static int pkg_mark_provides(pkg_t *pkg) 
    13331304{ 
    13341305     int provides_count = pkg->provides_count; 
  • trunk/src/target/opkg/libopkg/opkg_cmd.h

    r4473 r4475  
    3232int opkg_cmd_exec(opkg_cmd_t *cmd, opkg_conf_t *conf, int argc,  
    3333                  const char **argv, void *userdata); 
    34 int opkg_multiple_files_scan (opkg_conf_t *conf, int argc, char *argv[]); 
    35 /* install any packges with state_want == SW_INSTALL */ 
    36 int opkg_install_wanted_packages(opkg_conf_t *conf); 
    37 /* ensure that all dependences are satisfied */ 
    38 int opkg_configure_packages(opkg_conf_t *conf, char *pkg_name); 
    39  
    40 int pkg_mark_provides(pkg_t *pkg); 
    4134void opkg_print_error_list (opkg_conf_t *conf); 
    4235 
  • trunk/src/target/opkg/libopkg/opkg_conf.c

    r4473 r4475  
    139139     } 
    140140 
    141  
    142141     if (args->tmp_dir) 
    143142          tmp_dir_base = args->tmp_dir; 
     
    153152          return OPKG_CONF_ERR_TMP_DIR; 
    154153     } 
    155  
    156      conf->force_depends = 0; 
    157      conf->force_defaults = 0; 
    158      conf->force_overwrite = 0; 
    159      conf->force_downgrade = 0; 
    160      conf->force_reinstall = 0; 
    161      conf->force_space = 0; 
    162      conf->force_removal_of_essential_packages = 0; 
    163      conf->force_removal_of_dependent_packages = 0; 
    164      conf->nodeps = 0; 
    165      conf->offline_root = NULL; 
    166      conf->offline_root_pre_script_cmd = NULL; 
    167      conf->offline_root_post_script_cmd = NULL; 
    168      conf->verbosity = 1; 
    169      conf->noaction = 0; 
    170  
    171      conf->http_proxy = NULL; 
    172      conf->ftp_proxy = NULL; 
    173      conf->no_proxy = NULL; 
    174      conf->proxy_user = NULL; 
    175      conf->proxy_passwd = NULL; 
    176154 
    177155     pkg_hash_init("pkg-hash", &conf->pkg_hash, OPKG_CONF_DEFAULT_HASH_LEN); 
Note: See TracChangeset for help on using the changeset viewer.