X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=pkgs.py;h=495369b22ec8b25fec4e8ec5e167381502e34fcb;hb=ecccf42212763984a10ae10ab2780139d08dcba5;hp=bec6519a5577e09acbcf3972dbabaec8e3efae1b;hpb=3439c3321aacf03d24052f310f8eabf7242efcca;p=build.git diff --git a/pkgs.py b/pkgs.py index bec6519a..495369b2 100755 --- a/pkgs.py +++ b/pkgs.py @@ -34,10 +34,12 @@ import re default_arch='x86_64' known_arch = ['i386','x86_64'] default_fcdistro='f12' -known_fcdistros = [ 'centos5','centos6','f8', 'f9','f10','f11','f12', 'f13', 'f14', 'sl6'] +known_fcdistros = [ 'centos5','centos6','f8', 'f9','f10','f11','f12', 'f13', 'f14', 'f16', 'sl6'] default_pldistro='onelab' -known_keywords=['groupname', 'groupdesc', 'kexclude', 'package', 'group', 'precious', 'junk', 'mirror', ] +known_keywords=['groupname', 'groupdesc', + 'nodeyumexclude', 'plcyumexclude', + 'yumexclude', 'package', 'group', 'precious', 'junk', 'mirror', ] m_fcdistro_cutter = re.compile('([a-z]+)([0-9]+)') @@ -163,12 +165,14 @@ class PkgsParser: included += i excluded += e ok = ok and o - results = list (set(included).difference(set(excluded))) + # avoid set operations that would not preserve order + results = [ x for x in included if x not in excluded ] results = [ x.replace('@arch@',self.arch).\ replace('@fcdistro@',self.fcdistro).\ replace('@pldistro@',self.pldistro) for x in results] - results.sort() + if self.options.sort_results: + results.sort() # default is space-separated if not self.options.new_line: print " ".join(results) @@ -181,7 +185,7 @@ def main (): usage="Usage: %prog [options] keyword input[...]" parser=OptionParser (usage=usage) parser.add_option ('-a','--arch',dest='arch',action='store',default=default_arch, - help='target arch, e.g. i386 or x86_64') + help='target arch, e.g. i386 or x86_64, default=%s'%default_arch) parser.add_option ('-f','--fcdistro',dest='fcdistro',action='store', default=default_fcdistro, help='fcdistro, e.g. f12 or centos5') parser.add_option ('-d','--pldistro',dest='pldistro',action='store', default=default_pldistro, @@ -190,6 +194,8 @@ def main (): help='verbose when using qualifiers') parser.add_option ('-n', '--new-line',dest='new_line',action='store_true',default=False, help='print outputs separated with newlines rather than with a space') + parser.add_option ('-u', '--no-sort',dest='sort_results',default=True,action='store_false', + help='keep results in the same order as in the inputs') (options,args) = parser.parse_args() if len(args) <=1 : @@ -208,9 +214,10 @@ def main (): pkgs = PkgsParser (options.arch,options.fcdistro,options.pldistro,keyword,inputs,options) - pkgs.run() - - sys.exit(0) + if pkgs.run(): + sys.exit(0) + else: + sys.exit(1) if __name__ == '__main__': if main():