Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 217424 Details for
Bug 301360
app-portage/portage-utils: add a qcheck option for ignoring changed .la files
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Adds --skip <arg> option to ignore files matching regular expression
portage-utils-0.3.1-qcheck.patch (text/plain), 4.51 KB, created by
Darren Smith
on 2010-01-25 22:49:14 UTC
(
hide
)
Description:
Adds --skip <arg> option to ignore files matching regular expression
Filename:
MIME Type:
Creator:
Darren Smith
Created:
2010-01-25 22:49:14 UTC
Size:
4.51 KB
patch
obsolete
>diff -ru portage-utils-0.3.1.orig/qcheck.c portage-utils-0.3.1/qcheck.c >--- portage-utils-0.3.1.orig/qcheck.c 2010-01-24 13:18:19.937115493 -0600 >+++ portage-utils-0.3.1/qcheck.c 2010-01-25 04:30:29.262777252 -0600 >@@ -9,25 +9,27 @@ > > #ifdef APPLET_qcheck > >-#define QCHECK_FLAGS "eauAHTB" COMMON_FLAGS >+#define QCHECK_FLAGS "aes:uABHT" COMMON_FLAGS > static struct option const qcheck_long_opts[] = { >- {"exact", no_argument, NULL, 'e'}, > {"all", no_argument, NULL, 'a'}, >+ {"exact", no_argument, NULL, 'e'}, >+ {"skip", a_argument, NULL, 's'}, > {"update", no_argument, NULL, 'u'}, > {"noafk", no_argument, NULL, 'A'}, >+ {"badonly", no_argument, NULL, 'B'}, > {"nohash", no_argument, NULL, 'H'}, > {"nomtime", no_argument, NULL, 'T'}, >- {"badonly", no_argument, NULL, 'B'}, > COMMON_LONG_OPTS > }; > static const char *qcheck_opts_help[] = { >- "Exact match (only CAT/PN or PN without PV)", > "List all packages", >+ "Exact match (only CAT/PN or PN without PV)", >+ "Ignore files matching the regular expression <arg>", > "Update missing files, chksum and mtimes for packages", > "Ignore missing files", >+ "Only print pkgs containing bad files", > "Ignore differing/unknown file chksums", > "Ignore differing file mtimes", >- "Only print pkgs containing bad files excluding /etc.", > COMMON_OPTS_HELP > }; > static const char qcheck_rcsid[] = "$Id: qcheck.c,v 1.42 2010/01/13 18:17:23 vapier Exp $"; >@@ -36,6 +38,19 @@ > short bad_only = 0; > #define qcprintf(fmt, args...) if (!bad_only) printf( _( fmt ), ## args) > >+static void qcheck_cleanup(regex_t **regex_head, const size_t regex_count) >+{ >+ size_t i; >+ if (regex_head == NULL) { >+ return; >+ } >+ for (i = 0; i < regex_count; i++) { >+ regfree(regex_head[i]); >+ free(regex_head[i]); >+ } >+ free(regex_head); >+} >+ > int qcheck_main(int argc, char **argv) > { > DIR *dir, *dirp; >@@ -50,6 +65,8 @@ > size_t num_files, num_files_ok, num_files_unknown, num_files_ignored; > char buf[_Q_PATH_MAX], filename[_Q_PATH_MAX]; > char buffer[_Q_PATH_MAX]; >+ regex_t **regex_head = NULL; >+ size_t regex_count = 0; > > DBG("argc=%d argv[0]=%s argv[1]=%s", > argc, argv[0], argc > 1 ? argv[1] : "NULL?"); >@@ -57,22 +74,47 @@ > while ((i = GETOPT_LONG(QCHECK, qcheck, "")) != -1) { > switch (i) { > COMMON_GETOPTS_CASES(qcheck) >- case 'e': exact = 1; break; > case 'a': search_all = 1; break; >+ case 'e': exact = 1; break; >+ case 's': { >+ int regex_val; >+ regex_head = (regex_t **) xrealloc(regex_head, >+ (regex_count + 1) * sizeof(regex_t *)); >+ regex_head[regex_count] = (regex_t *) xmalloc(sizeof(regex_t)); >+ regex_val = regcomp(regex_head[regex_count], optarg, >+ REG_EXTENDED|REG_NOSUB); >+ if (regex_val != 0) { >+ char errbuf[256]; >+ if (regerror(regex_val, regex_head[regex_count], errbuf, >+ sizeof(errbuf))) { >+ qcheck_cleanup(regex_head, regex_count + 1); >+ err("Invalid regexp: %s -- %s\n", optarg, errbuf); >+ } else { >+ qcheck_cleanup(regex_head, regex_count + 1); >+ err("Invalid regexp: %s\n", optarg); >+ } >+ } >+ regex_count++; >+ } >+ break; > case 'u': qc_update = 1; break; > case 'A': chk_afk = 0; break; >+ case 'B': bad_only = 1; break; > case 'H': chk_hash = 0; break; > case 'T': chk_mtime = 0; break; >- case 'B': bad_only = 1; break; > } > } >- if ((argc == optind) && !search_all) >+ if ((argc == optind) && !search_all) { >+ qcheck_cleanup(regex_head, regex_count); > qcheck_usage(EXIT_FAILURE); >+ } > > xchdir(portroot); > xchdir(portvdb); >- if ((dir = opendir(".")) == NULL) >+ if ((dir = opendir(".")) == NULL) { >+ qcheck_cleanup(regex_head, regex_count); > return EXIT_FAILURE; >+ } > > /* open /var/db/pkg */ > while ((dentry = q_vdb_get_next_dir(dir))) { >@@ -138,9 +180,6 @@ > e = contents_parse_line(buf); > if (!e) > continue; >- if (bad_only && strncmp(e->name, "/etc", 4) == 0) { >- continue; >- } > if (strcmp(portroot, "/") != 0) { > snprintf(filename, sizeof(filename), "%s%s", portroot, e->name); > e->name = filename; >@@ -148,6 +187,21 @@ > > /* run our little checks */ > ++num_files; >+ if (regex_count > 0) { >+ char match = 0; >+ size_t j; >+ for (j = 0; j < regex_count; j++) { >+ if (regexec(regex_head[j], e->name, 0, NULL, 0) == 0) { >+ match = 1; >+ break; >+ } >+ } >+ if (match == 1) { >+ --num_files; >+ ++num_files_ignored; >+ continue; >+ } >+ } > if (lstat(e->name, &st)) { > /* make sure file exists */ > if (chk_afk) { >@@ -302,6 +356,7 @@ > xchdir(".."); > } > >+ qcheck_cleanup(regex_head, regex_count); > return EXIT_SUCCESS; > } >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 301360
:
217267
| 217424