ipkindex: Add tool to index an ipk mirror
Signed-off-by: Thomas Klaehn <tkl@blackfinn.de>
This commit is contained in:
commit
5f7041dcb1
36
ipkindex
Executable file
36
ipkindex
Executable file
@ -0,0 +1,36 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
# Just a wrapper around opkg-utils.
|
||||
#
|
||||
# git clone https://github.com/shr-project/opkg-utils.git
|
||||
# cd opkg-utils
|
||||
# make install
|
||||
#
|
||||
|
||||
import argparse
|
||||
import os
|
||||
import re
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("base_folder", help="Base folder to be indexed.")
|
||||
args = parser.parse_args()
|
||||
|
||||
abs_base_folder = os.path.abspath(args.base_folder)
|
||||
index_folders = list()
|
||||
|
||||
for root, _, files in os.walk(abs_base_folder, topdown=False):
|
||||
for name in files:
|
||||
if re.match(r".*.ipk$", name) and not root in index_folders:
|
||||
index_folders.append(root)
|
||||
break
|
||||
|
||||
for folder in index_folders:
|
||||
cmd = "opkg-make-index -p Packages".split()
|
||||
cmd.append(folder)
|
||||
print("processing folder {}".format(folder))
|
||||
subprocess.call(cmd, cwd=folder)
|
||||
|
||||
sys.exit(0)
|
||||
|
Loading…
Reference in New Issue
Block a user