• Skip to sidebar navigation
  • Skip to content

Bitbucket

  • More
    ProjectsRepositories
  • Help
    • Online help
    • Learn Git
    • Welcome to Bitbucket
    • Keyboard shortcuts
  • Log In
Alexander Dahl
  1. Alexander Dahl

buildroot

Public
Actions
  • Clone
  • Compare

Learn more about cloning repositories

You have read-only access

Navigation
  • Source
  • Commits
  • Branches
  • All Branches Graph
  • Forks
  1. Alexander Dahl
  2. buildroot

Source

buildroot/support/scripts/expunge-gconv-modules
Bjørn ForsmanBjørn Forsman committed acc76a6ef9f21 Oct 2014
Raw file
Source viewDiff to previous
 
1
#!/usr/bin/env bash
2
​
3
# This script is used to generate a gconv-modules file that takes into
4
# account only the gconv modules installed by Buildroot. It receives
5
# on its standard input the original complete gconv-modules file from
6
# the toolchain, and as arguments the list of gconv modules that were
7
# actually installed, and writes on its standard output the new
8
# gconv-modules file.
9
​
10
# The format of gconv-modules is precisely documented in the
11
# file itself. It consists of two different directives:
12
#   module  FROMSET  TOSET  FILENAME  COST
13
#   alias   ALIAS  REALNAME
14
# and that's what this script parses and generates.
15
#
16
# There are two kinds of 'module' directives:
17
#   - the first defines conversion of a charset to/from INTERNAL representation
18
#   - the second defines conversion of a charset to/from another charset
19
# we handle each with slightly different code, since the second never has
20
# associated aliases.
21
​
22
gawk -v files="${1}" '
23
$1 == "alias" {
24
    aliases[$3] = aliases[$3] " " $2;
25
}
26
$1 == "module" && $2 != "INTERNAL" && $3 == "INTERNAL" {
27
    file2internals[$4] = file2internals[$4] " " $2;
28
    mod2cost[$2] = $5;
29
}
30
$1 == "module" && $2 != "INTERNAL" && $3 != "INTERNAL" {
31
    file2cset[$4] = file2cset[$4] " " $2 ":" $3;
32
    mod2cost[$2] = $5;
33
}
34
​
35
END {
36
    nb_files = split(files, all_files);
37
    for(f = 1; f <= nb_files; f++) {
38
        file = all_files[f];
39
        printf("# Modules and aliases for: %s\n", file);
40
        nb_mods = split(file2internals[file], mods);
41
        for(i = 1; i <= nb_mods; i++) {
42
            nb_aliases = split(aliases[mods[i]], mod_aliases);
43
            for(j = 1; j <= nb_aliases; j++) {
44
                printf("alias\t%s\t%s\n", mod_aliases[j], mods[i]);
45
            }
46
            printf("module\t%s\t%s\t%s\t%d\n", mods[i], "INTERNAL", file, mod2cost[mods[i]]);
47
            printf("module\t%s\t%s\t%s\t%d\n", "INTERNAL", mods[i], file, mod2cost[mods[i]]);
48
            printf("\n" );
49
        }
50
        printf("%s", nb_mods != 0 ? "\n" : "");
51
        nb_csets = split(file2cset[file], csets);
52
        for(i = 1; i <= nb_csets; i++) {
53
            split(csets[i], cs, ":");
54
            printf("module\t%s\t%s\t%s\t%d\n", cs[1], cs[2], file, mod2cost[cs[1]]);
55
        }
56
        printf("%s", nb_csets != 0 ? "\n\n" : "");
57
    }
58
}
59
'
  • Git repository management for enterprise teams powered by Atlassian Bitbucket
  • Atlassian Bitbucket v6.7.2
  • Documentation
  • Request a feature
  • About
  • Contact Atlassian
Atlassian

Everything looks good. We'll let you know here if there's anything you should know about.