forked from bifferos/bb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
consolidate_feeds.py
executable file
·68 lines (46 loc) · 1.42 KB
/
consolidate_feeds.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/usr/bin/env python
# -*- coding: windows-1258 -*-
"""
Look where the symbolic links are pointing, and convert the
feeds from links into real copies of the target files.
This converts the following
openwrt/feeds/<openwrt_packages>
openwrt/package/feeds/packages/<some_links>
into:
openwrt/feeds/<openwrt_packages>
openwrt/package/feeds/packages/<openwrt_packages>
Instructions:
- checkout openwrt
- make package/symlinks (will require make menuconfig)
- Run this script from the root of openwrt.
- Copy the package/feeds/packages dir somewhere safe
- Get openwrt again
- copy the package directory back
- Archvive the result as a fully self-contained openwrt release
resplendent with accompanying packages.
"""
import os, glob, shutil
def copy_ignore(src, names):
out = []
for i in names:
if i == ".svn":
print "Ignoring .svn in %s" % src
out.append(i)
return out
if __name__ == "__main__":
wc = "package/feeds/*/*"
for i in glob.glob(wc):
if os.path.islink(i) :
# get the directory
pkg_dir = os.path.split(i)[0]
feed_dir = os.readlink(i)
src = os.path.join(pkg_dir, feed_dir)
print "removing symbolic link:", i
os.unlink(i)
dest = i
print "moving to:", dest
shutil.copytree(src, dest, ignore=copy_ignore)
else:
print "non-link", i
#p = os.path.join(base, i)
#for i in os.listdir(p):