Magellan Linux

Diff of /trunk/mkinitrd-magellan/busybox/archival/rpm.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 983 by niro, Fri Apr 24 18:33:46 2009 UTC revision 984 by niro, Sun May 30 11:32:42 2010 UTC
# Line 116  int rpm_main(int argc, char **argv) Line 116  int rpm_main(int argc, char **argv)
116   }   }
117   argv += optind;   argv += optind;
118   //argc -= optind;   //argc -= optind;
119   if (!argv[0]) bb_show_usage();   if (!argv[0]) {
120     bb_show_usage();
121     }
122    
123   while (*argv) {   while (*argv) {
124   rpm_fd = xopen(*argv++, O_RDONLY);   rpm_fd = xopen(*argv++, O_RDONLY);
# Line 143  int rpm_main(int argc, char **argv) Line 145  int rpm_main(int argc, char **argv)
145   if (func & rpm_query_info) {   if (func & rpm_query_info) {
146   /* Do the nice printout */   /* Do the nice printout */
147   time_t bdate_time;   time_t bdate_time;
148   struct tm *bdate;   struct tm *bdate_ptm;
149   char bdatestring[50];   char bdatestring[50];
150   printf("Name        : %-29sRelocations: %s\n", rpm_getstr(TAG_NAME, 0), rpm_getstr(TAG_PREFIXS, 0) ? rpm_getstr(TAG_PREFIXS, 0) : "(not relocateable)");   printf("Name        : %-29sRelocations: %s\n", rpm_getstr(TAG_NAME, 0), rpm_getstr(TAG_PREFIXS, 0) ? rpm_getstr(TAG_PREFIXS, 0) : "(not relocateable)");
151   printf("Version     : %-34sVendor: %s\n", rpm_getstr(TAG_VERSION, 0), rpm_getstr(TAG_VENDOR, 0) ? rpm_getstr(TAG_VENDOR, 0) : "(none)");   printf("Version     : %-34sVendor: %s\n", rpm_getstr(TAG_VERSION, 0), rpm_getstr(TAG_VENDOR, 0) ? rpm_getstr(TAG_VENDOR, 0) : "(none)");
152   bdate_time = rpm_getint(TAG_BUILDTIME, 0);   bdate_time = rpm_getint(TAG_BUILDTIME, 0);
153   bdate = localtime((time_t *) &bdate_time);   bdate_ptm = localtime(&bdate_time);
154   strftime(bdatestring, 50, "%a %d %b %Y %T %Z", bdate);   strftime(bdatestring, 50, "%a %d %b %Y %T %Z", bdate_ptm);
155   printf("Release     : %-30sBuild Date: %s\n", rpm_getstr(TAG_RELEASE, 0), bdatestring);   printf("Release     : %-30sBuild Date: %s\n", rpm_getstr(TAG_RELEASE, 0), bdatestring);
156   printf("Install date: %-30sBuild Host: %s\n", "(not installed)", rpm_getstr(TAG_BUILDHOST, 0));   printf("Install date: %-30sBuild Host: %s\n", "(not installed)", rpm_getstr(TAG_BUILDHOST, 0));
157   printf("Group       : %-30sSource RPM: %s\n", rpm_getstr(TAG_GROUP, 0), rpm_getstr(TAG_SOURCERPM, 0));   printf("Group       : %-30sSource RPM: %s\n", rpm_getstr(TAG_GROUP, 0), rpm_getstr(TAG_SOURCERPM, 0));
# Line 190  static void extract_cpio_gz(int fd) Line 192  static void extract_cpio_gz(int fd)
192   archive_handle_t *archive_handle;   archive_handle_t *archive_handle;
193   unsigned char magic[2];   unsigned char magic[2];
194  #if BB_MMU  #if BB_MMU
195   USE_DESKTOP(long long) int FAST_FUNC (*xformer)(int src_fd, int dst_fd);   IF_DESKTOP(long long) int FAST_FUNC (*xformer)(int src_fd, int dst_fd);
196   enum { xformer_prog = 0 };   enum { xformer_prog = 0 };
197  #else  #else
198   enum { xformer = 0 };   enum { xformer = 0 };
# Line 202  static void extract_cpio_gz(int fd) Line 204  static void extract_cpio_gz(int fd)
204   archive_handle->seek = seek_by_read;   archive_handle->seek = seek_by_read;
205   //archive_handle->action_header = header_list;   //archive_handle->action_header = header_list;
206   archive_handle->action_data = data_extract_all;   archive_handle->action_data = data_extract_all;
207   archive_handle->ah_flags = ARCHIVE_PRESERVE_DATE | ARCHIVE_CREATE_LEADING_DIRS   archive_handle->ah_flags = ARCHIVE_RESTORE_DATE | ARCHIVE_CREATE_LEADING_DIRS
208   /* compat: overwrite existing files.   /* compat: overwrite existing files.
209   * try "rpm -i foo.src.rpm" few times in a row -   * try "rpm -i foo.src.rpm" few times in a row -
210   * standard rpm will not complain.   * standard rpm will not complain.
211   * (TODO? real rpm creates "file;1234" and then renames it) */   * (TODO? real rpm creates "file;1234" and then renames it) */
212   | ARCHIVE_EXTRACT_UNCONDITIONAL;   | ARCHIVE_UNLINK_OLD;
213   archive_handle->src_fd = fd;   archive_handle->src_fd = fd;
214   /*archive_handle->offset = 0; - init_handle() did it */   /*archive_handle->offset = 0; - init_handle() did it */
215    
# Line 224  static void extract_cpio_gz(int fd) Line 226  static void extract_cpio_gz(int fd)
226   || magic[0] != 'B' || magic[1] != 'Z'   || magic[0] != 'B' || magic[1] != 'Z'
227   ) {   ) {
228   bb_error_msg_and_die("no gzip"   bb_error_msg_and_die("no gzip"
229   USE_FEATURE_SEAMLESS_BZ2("/bzip2")   IF_FEATURE_SEAMLESS_BZ2("/bzip2")
230   " magic");   " magic");
231   }   }
232  #if BB_MMU  #if BB_MMU
# Line 324  static char *rpm_getstr(int tag, int ite Line 326  static char *rpm_getstr(int tag, int ite
326   return NULL;   return NULL;
327   if (found[0]->type == RPM_STRING_TYPE || found[0]->type == RPM_I18NSTRING_TYPE || found[0]->type == RPM_STRING_ARRAY_TYPE) {   if (found[0]->type == RPM_STRING_TYPE || found[0]->type == RPM_I18NSTRING_TYPE || found[0]->type == RPM_STRING_ARRAY_TYPE) {
328   int n;   int n;
329   char *tmpstr = (char *) (map + found[0]->offset);   char *tmpstr = (char *) map + found[0]->offset;
330   for (n=0; n < itemindex; n++)   for (n=0; n < itemindex; n++)
331   tmpstr = tmpstr + strlen(tmpstr) + 1;   tmpstr = tmpstr + strlen(tmpstr) + 1;
332   return tmpstr;   return tmpstr;
# Line 343  static int rpm_getint(int tag, int itemi Line 345  static int rpm_getint(int tag, int itemi
345   if (!found || itemindex >= found[0]->count)   if (!found || itemindex >= found[0]->count)
346   return -1;   return -1;
347    
348   tmpint = (int *) (map + found[0]->offset);   tmpint = (int *) ((char *) map + found[0]->offset);
349    
350   if (found[0]->type == RPM_INT32_TYPE) {   if (found[0]->type == RPM_INT32_TYPE) {
351   tmpint = (int *) ((char *) tmpint + itemindex*4);   tmpint = (int *) ((char *) tmpint + itemindex*4);

Legend:
Removed from v.983  
changed lines
  Added in v.984