Commit Diff
Diff:
66cce2e531aa5f9df44a5db4f6a2507608678d71
f2c943b182ec72a63f1abeee60183819a99c14df
Commit:
f2c943b182ec72a63f1abeee60183819a99c14df
Tree:
81e1030295d80560ef50c635bb909aa2e80f21a5
Author:
frédéric galusik <fredg@salixos.org>
Committer:
frédéric galusik <fredg@salixos.org>
Date:
Tue Oct 30 17:56:51 2012 UTC
Message:
add a message when file is built
blob - 9aaad63b721fc6b338d02d2f1a4b08082b0f61a9
blob + a3a380c999622cc4291e6c18d87a4f7810eded7d
--- pkgtxt2db.py
+++ pkgtxt2db.py
@@ -40,7 +40,8 @@ fields = ['name',
# Parse the CLI options
parser = argparse.ArgumentParser(
description='Convert PACKAGES.TXT to DB',
- epilog="ie Pkgtxt2db -t salix -a x86_64 -r 14.0 -o json")
+ epilog=
+ "i.e. pkgtxt2db -u -t salix -a x86_64 -r 14.0 -c json -o salix64.json")
parser.add_argument('-u', '--update', action="store_true",
default=False,
help='Download/update the PACKAGES.TXT file')
@@ -83,7 +84,7 @@ def new_pkgdct():
# Fetch PACKAGES.TXT
-def pkgtxturl(repo='32', target='salix', release='14.0', expa='/'):
+def pkgtxturl(repo='i486', target='salix', release='14.0', expa='/'):
"""
Download the slackware/salix PACKAGES.TXT.gz from a built URL and unzip it.
pkgtxturl(repo, target, release, |extra|patches)
@@ -192,18 +193,24 @@ def mkdadb(towhat):
if towhat == tocsv:
if os.path.isfile(outputfile):
os.remove(outputfile)
- print 'Updating ', outputfile
+ print outputfile, 'has been updated.'
+ else:
+ print outputfile, 'has been built.'
if towhat == tojson:
if os.path.isfile(outputfile):
os.remove(outputfile)
- print 'Updating ', outputfile
+ print outputfile, 'has been updated.'
+ else:
+ print outputfile, 'has been built.'
with open("pre.json", 'w') as j:
j.write('{\n')
j.write('"packages": [\n')
if towhat == toxml:
if os.path.isfile(outputfile):
os.remove(outputfile)
- print 'Updating ', outputfile
+ print outputfile, 'has been updated.'
+ else:
+ print outputfile, 'has been built.'
with open(outputfile, 'w') as xmlf:
xmlf.write('<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n')
xmlf.write('<packages>\n')
@@ -264,6 +271,8 @@ def mkdadb(towhat):
def main():
+ if not sys.argv[1]:
+ sys.exit('Wrong usage, use pkgtxt2db --help')
if not update and not os.path.isfile(pkgtxt):
sys.exit('No PACKAGES.TXT found, you should fetch one, aborting.')
else:
Frédéric Galusik