]> git.pld-linux.org Git - packages/amanda.git/blob - amanda-amstar-exclude.patch
perl 5.38.0 rebuild
[packages/amanda.git] / amanda-amstar-exclude.patch
1 --- amanda/trunk/application-src/amstar.c       2010/09/24 21:46:25     3449
2 +++ amanda/trunk/application-src/amstar.c       2010/11/10 11:22:58     3609
3 @@ -40,7 +40,8 @@
4   * IGNORE
5   * STRANGE
6   * INCLUDE-LIST                (for restore only)
7 - * EXCLUDE-LIST                (for restore only)
8 + * EXCLUDE-FILE
9 + * EXCLUDE-LIST
10   * DIRECTORY
11   */
12  
13 @@ -159,6 +160,7 @@
14      {"exclude-list"    , 1, NULL, 20},
15      {"directory"       , 1, NULL, 21},
16      {"command-options" , 1, NULL, 22},
17 +    {"exclude-file"    , 1, NULL, 23},
18      {"acl"             , 1, NULL, 24},
19      { NULL, 0, NULL, 0}
20  };
21 @@ -320,6 +322,10 @@
22         case 22: argument.command_options =
23                         g_slist_append(argument.command_options,
24                                        stralloc(optarg));
25 +       case 23: if (optarg)
26 +                    argument.dle.exclude_file =
27 +                        append_sl(argument.dle.exclude_file, optarg);
28 +                break;
29         case 24: if (optarg && strcasecmp(optarg, "NO") == 0)
30                      star_acl = 0;
31                  else if (optarg && strcasecmp(optarg, "YES") == 0)
32 @@ -417,10 +423,6 @@
33         argument->dle.include_list->nb_element >= 0) {
34         fprintf(stdout, "ERROR include-list not supported for backup\n");
35      }
36 -    if (argument->dle.exclude_list &&
37 -       argument->dle.exclude_list->nb_element >= 0) {
38 -       fprintf(stdout, "ERROR exclude-list not supported for backup\n");
39 -    }
40  
41      if (!star_path) {
42         fprintf(stdout, "ERROR STAR-PATH not defined\n");
43 @@ -486,10 +488,6 @@
44         argument->dle.include_list->nb_element >= 0) {
45         fprintf(stderr, "ERROR include-list not supported for backup\n");
46      }
47 -    if (argument->dle.exclude_list &&
48 -       argument->dle.exclude_list->nb_element >= 0) {
49 -       fprintf(stderr, "ERROR exclude-list not supported for backup\n");
50 -    }
51  
52      if (check_device(argument) == 0) {
53         return;
54 @@ -675,10 +673,6 @@
55         argument->dle.include_list->nb_element >= 0) {
56         fprintf(mesgstream, "? include-list not supported for backup\n");
57      }
58 -    if (argument->dle.exclude_list &&
59 -       argument->dle.exclude_list->nb_element >= 0) {
60 -       fprintf(mesgstream, "? exclude-list not supported for backup\n");
61 -    }
62  
63      level = GPOINTER_TO_INT(argument->level->data);
64  
65 @@ -951,6 +945,7 @@
66         g_ptr_array_add(argv_ptr, stralloc("-"));
67      }
68      g_ptr_array_add(argv_ptr, stralloc("-C"));
69 +
70  #if defined(__CYGWIN__)
71      {
72         char tmppath[PATH_MAX];
73 @@ -969,6 +964,7 @@
74      g_ptr_array_add(argv_ptr, stralloc2("tardumps=", tardumpfile));
75      if (command == CMD_BACKUP)
76         g_ptr_array_add(argv_ptr, stralloc("-wtardumps"));
77 +
78      g_ptr_array_add(argv_ptr, stralloc("-xattr"));
79      g_ptr_array_add(argv_ptr, stralloc("-acl"));
80      g_ptr_array_add(argv_ptr, stralloc("H=exustar"));
81 @@ -984,6 +980,54 @@
82      if (command == CMD_BACKUP && argument->dle.create_index)
83         g_ptr_array_add(argv_ptr, stralloc("-v"));
84  
85 +    if ((argument->dle.exclude_file &&
86 +        argument->dle.exclude_file->nb_element >= 1) ||
87 +       (argument->dle.exclude_list &&
88 +        argument->dle.exclude_list->nb_element >= 1)) {
89 +       g_ptr_array_add(argv_ptr, stralloc("-match-tree"));
90 +       g_ptr_array_add(argv_ptr, stralloc("-not"));
91 +    }
92 +    if (argument->dle.exclude_file &&
93 +       argument->dle.exclude_file->nb_element >= 1) {
94 +       sle_t *excl;
95 +       for (excl = argument->dle.exclude_file->first; excl != NULL;
96 +            excl = excl->next) {
97 +           char *ex;
98 +           if (strcmp(excl->name, "./") == 0) {
99 +               ex = g_strdup_printf("pat=%s", excl->name+2);
100 +           } else {
101 +               ex = g_strdup_printf("pat=%s", excl->name);
102 +           }
103 +           g_ptr_array_add(argv_ptr, ex);
104 +       }
105 +    }
106 +    if (argument->dle.exclude_list &&
107 +       argument->dle.exclude_list->nb_element >= 1) {
108 +       sle_t *excl;
109 +       for (excl = argument->dle.exclude_list->first; excl != NULL;
110 +            excl = excl->next) {
111 +           char *exclname = fixup_relative(excl->name, argument->dle.device);
112 +           FILE *exclude;
113 +           char *aexc;
114 +           if ((exclude = fopen(exclname, "r")) != NULL) {
115 +               while ((aexc = agets(exclude)) != NULL) {
116 +                   if (aexc[0] != '\0') {
117 +                       char *ex;
118 +                       if (strcmp(aexc, "./") == 0) {
119 +                           ex = g_strdup_printf("pat=%s", aexc+2);
120 +                       } else {
121 +                           ex = g_strdup_printf("pat=%s", aexc);
122 +                       }
123 +                       g_ptr_array_add(argv_ptr, ex);
124 +                   }
125 +                   amfree(aexc);
126 +               }
127 +           }
128 +           amfree(exclname);
129 +           fclose(exclude);
130 +       }
131 +    }
132 +
133      g_ptr_array_add(argv_ptr, stralloc("."));
134  
135      g_ptr_array_add(argv_ptr, NULL);
This page took 0.132588 seconds and 3 git commands to generate.