diff options
author | Tudor Florea <tudor.florea@enea.com> | 2014-10-16 03:05:19 +0200 |
---|---|---|
committer | Tudor Florea <tudor.florea@enea.com> | 2014-10-16 03:05:19 +0200 |
commit | c527fd1f14c27855a37f2e8ac5346ce8d940ced2 (patch) | |
tree | bb002c1fdf011c41dbd2f0927bed23ecb5f83c97 /scripts/opkg-query-helper.py | |
download | poky-c527fd1f14c27855a37f2e8ac5346ce8d940ced2.tar.gz |
initial commit for Enea Linux 4.0-140929daisy-140929
Migrated from the internal git server on the daisy-enea-point-release branch
Signed-off-by: Tudor Florea <tudor.florea@enea.com>
Diffstat (limited to 'scripts/opkg-query-helper.py')
-rwxr-xr-x | scripts/opkg-query-helper.py | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/scripts/opkg-query-helper.py b/scripts/opkg-query-helper.py new file mode 100755 index 0000000000..2fb1a78970 --- /dev/null +++ b/scripts/opkg-query-helper.py | |||
@@ -0,0 +1,85 @@ | |||
1 | #!/usr/bin/env python | ||
2 | |||
3 | # OpenEmbedded opkg query helper utility | ||
4 | # | ||
5 | # Written by: Paul Eggleton <paul.eggleton@linux.intel.com> | ||
6 | # | ||
7 | # Copyright 2012 Intel Corporation | ||
8 | # | ||
9 | # This program is free software; you can redistribute it and/or modify | ||
10 | # it under the terms of the GNU General Public License version 2 as | ||
11 | # published by the Free Software Foundation. | ||
12 | # | ||
13 | # This program is distributed in the hope that it will be useful, | ||
14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
16 | # GNU General Public License for more details. | ||
17 | # | ||
18 | # You should have received a copy of the GNU General Public License along | ||
19 | # with this program; if not, write to the Free Software Foundation, Inc., | ||
20 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
21 | # | ||
22 | # | ||
23 | |||
24 | |||
25 | import sys | ||
26 | import fileinput | ||
27 | import re | ||
28 | |||
29 | archmode = False | ||
30 | filemode = False | ||
31 | vermode = False | ||
32 | |||
33 | args = [] | ||
34 | for arg in sys.argv[1:]: | ||
35 | if arg == '-a': | ||
36 | archmode = True | ||
37 | elif arg == '-f': | ||
38 | filemode = True | ||
39 | elif arg == '-v': | ||
40 | vermode = True | ||
41 | else: | ||
42 | args.append(arg) | ||
43 | |||
44 | # Regex for removing version specs after dependency items | ||
45 | verregex = re.compile(' \([=<>]* [^ )]*\)') | ||
46 | |||
47 | pkg = "" | ||
48 | ver = "" | ||
49 | for line in fileinput.input(args): | ||
50 | line = line.rstrip() | ||
51 | if ': ' in line: | ||
52 | if line.startswith("Package:"): | ||
53 | pkg = line.split(": ")[1] | ||
54 | ver = "" | ||
55 | else: | ||
56 | if archmode: | ||
57 | if line.startswith("Architecture:"): | ||
58 | arch = line.split(": ")[1] | ||
59 | print("%s %s" % (pkg,arch)) | ||
60 | elif filemode: | ||
61 | if line.startswith("Version:"): | ||
62 | ver = line.split(": ")[1] | ||
63 | elif line.startswith("Architecture:"): | ||
64 | arch = line.split(": ")[1] | ||
65 | print("%s %s_%s_%s.ipk %s" % (pkg,pkg,ver,arch,arch)) | ||
66 | elif vermode: | ||
67 | if line.startswith("Version:"): | ||
68 | ver = line.split(": ")[1] | ||
69 | elif line.startswith("Architecture:"): | ||
70 | arch = line.split(": ")[1] | ||
71 | print("%s %s %s" % (pkg,arch,ver)) | ||
72 | else: | ||
73 | if line.startswith("Depends:"): | ||
74 | depval = line.split(": ")[1] | ||
75 | deps = depval.split(", ") | ||
76 | for dep in deps: | ||
77 | dep = verregex.sub('', dep) | ||
78 | print("%s|%s" % (pkg,dep)) | ||
79 | elif line.startswith("Recommends:"): | ||
80 | recval = line.split(": ")[1] | ||
81 | recs = recval.split(", ") | ||
82 | for rec in recs: | ||
83 | rec = verregex.sub('', rec) | ||
84 | print("%s|%s [REC]" % (pkg, rec)) | ||
85 | |||