Magellan Linux

Contents of /trunk/xarchiver/patches/xarchiver-0.5.2-rpm2cpio-support.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1581 - (show annotations) (download)
Mon Nov 28 20:22:05 2011 UTC (12 years, 5 months ago) by niro
File size: 3211 byte(s)
-adding xarchiver patches
1 diff -up ./src/rpm.c.rpm2cpio ./src/rpm.c
2 --- ./src/rpm.c.rpm2cpio 2008-10-24 13:43:04.000000000 +0200
3 +++ ./src/rpm.c 2011-03-27 03:14:20.225742237 +0200
4 @@ -23,11 +23,8 @@ extern gboolean batch_mode;
5
6 void xa_open_rpm (XArchive *archive)
7 {
8 - unsigned char bytes[8];
9 unsigned short int i;
10 - int dl,il,sigsize,offset,response;
11 - gchar *ibs,*executable;
12 - gchar *gzip_tmp = NULL;
13 + int response;
14 GSList *list = NULL;
15 FILE *stream;
16 gboolean result;
17 @@ -56,66 +53,14 @@ void xa_open_rpm (XArchive *archive)
18 archive->column_types[i] = types[i];
19
20 xa_create_liststore (archive,names);
21 - if (fseek ( stream, 104 , SEEK_CUR ) )
22 - {
23 - fclose (stream);
24 - response = xa_show_message_dialog (GTK_WINDOW (xa_main_window),GTK_DIALOG_MODAL,GTK_MESSAGE_ERROR,GTK_BUTTONS_OK,_("Can't fseek to position 104:"),g_strerror(errno));
25 - return;
26 - }
27 - if ( fread ( bytes, 1, 8, stream ) == 0 )
28 - {
29 - fclose ( stream );
30 - response = xa_show_message_dialog (GTK_WINDOW (xa_main_window),GTK_DIALOG_MODAL,GTK_MESSAGE_ERROR,GTK_BUTTONS_OK,_("Can't read data from file:"),g_strerror(errno));
31 - return;
32 - }
33 - il = 256 * ( 256 * ( 256 * bytes[0] + bytes[1]) + bytes[2] ) + bytes[3];
34 - dl = 256 * ( 256 * ( 256 * bytes[4] + bytes[5]) + bytes[6] ) + bytes[7];
35 - sigsize = 8 + 16 * il + dl;
36 - offset = 104 + sigsize + ( 8 - ( sigsize % 8 ) ) % 8 + 8;
37 - if (fseek ( stream, offset , SEEK_SET ) )
38 - {
39 - fclose (stream);
40 - response = xa_show_message_dialog (GTK_WINDOW (xa_main_window),GTK_DIALOG_MODAL,GTK_MESSAGE_ERROR,GTK_BUTTONS_OK,_("Can't fseek in file:"),g_strerror(errno));
41 - return;
42 - }
43 - if ( fread ( bytes, 1, 8, stream ) == 0 )
44 - {
45 - fclose ( stream );
46 - response = xa_show_message_dialog (GTK_WINDOW (xa_main_window),GTK_DIALOG_MODAL,GTK_MESSAGE_ERROR,GTK_BUTTONS_OK,_("Can't read data from file:"),g_strerror(errno));
47 - return;
48 - }
49 - il = 256 * ( 256 * ( 256 * bytes[0] + bytes[1]) + bytes[2] ) + bytes[3];
50 - dl = 256 * ( 256 * ( 256 * bytes[4] + bytes[5]) + bytes[6] ) + bytes[7];
51 - sigsize = 8 + 16 * il + dl;
52 - offset = offset + sigsize;
53 - fclose (stream);
54
55 /* Create a unique temp dir in /tmp */
56 result = xa_create_temp_directory (archive);
57 if (!result)
58 return;
59
60 - gzip_tmp = g_strconcat (archive->tmp,"/file.gz_bz",NULL);
61 - ibs = g_strdup_printf ( "%u" , offset );
62 -
63 /* Now I run dd to have the bzip2 / gzip compressed cpio archive in /tmp */
64 - gchar *command = g_strconcat ( "dd if=",archive->escaped_path," ibs=",ibs," skip=1 of=",gzip_tmp,NULL);
65 - g_free (ibs);
66 - list = g_slist_append(list,command);
67 - batch_mode = TRUE;
68 - result = xa_run_command (archive,list);
69 - if (result == FALSE)
70 - {
71 - g_free (gzip_tmp);
72 - return;
73 - }
74 - if (xa_detect_archive_type (gzip_tmp) == XARCHIVETYPE_GZIP)
75 - executable = "gzip -dc ";
76 - else
77 - executable = "bzip2 -dc ";
78 -
79 - command = g_strconcat("sh -c \"",executable,gzip_tmp," > ",archive->tmp,"/file.cpio\"",NULL);
80 - g_free(gzip_tmp);
81 + gchar *command = g_strconcat ( "sh -c \"rpm2cpio ",archive->escaped_path," > ",archive->tmp, "/file.cpio\"",NULL);
82 list = NULL;
83 list = g_slist_append(list,command);
84 result = xa_run_command (archive,list);