Beispiel #1
0
 def testFilenamesGood(self):
     fc = file_set_checker.FileSetChecker()
     files = [
         '/home/experimental/maciej/'
         'nspr-4.8.6,REV=2010.10.16-SunOS5.9-all-CSW.pkg.gz'
     ]
     files_with_metadata = fc._FilesWithMetadata(files)
     self.assertEqual([], fc._CheckFilenames(files_with_metadata))
Beispiel #2
0
 def testFilenames(self):
     fc = file_set_checker.FileSetChecker()
     expected = [
         tag.CheckpkgTag(None, 'bad-filename', 'filename=csw-upload-pkg'),
     ]
     files = ['csw-upload-pkg']
     files_with_metadata = fc._FilesWithMetadata(files)
     self.assertEqual(expected, fc._CheckFilenames(files_with_metadata))
 def testBadInput(self):
     fc = file_set_checker.FileSetChecker()
     expected = [
         tag.CheckpkgTag(None, 'bad-arch-or-os-release',
                         'csw-upload-pkg arch=pkg osrel=unspecified'),
         tag.CheckpkgTag(
             None, 'bad-vendor-tag',
             'filename=csw-upload-pkg expected=CSW actual=UNKN'),
     ]
     files = ['csw-upload-pkg']
     self.assertEqual(expected, fc.CheckFiles(files))
 def testMissingArchitectureWithOsrel(self):
     files = [
         'foo-1.0,REV=2011.03.30-SunOS5.9-i386-CSW.pkg.gz',
         'foo-1.0,REV=2011.03.30-SunOS5.9-sparc-CSW.pkg.gz',
         'foo-1.0,REV=2011.03.30-SunOS5.10-i386-CSW.pkg.gz',
         # Intentionally missing
         # 'foo-1.0,REV=2011.03.30-SunOS5.10-sparc-CSW.pkg.gz',
     ]
     fc = file_set_checker.FileSetChecker()
     expected = [tag.CheckpkgTag(None, 'sparc-SunOS5.10-missing', 'foo')]
     self.assertEqual(expected, fc.CheckFiles(files))
Beispiel #5
0
 def testBadInput(self):
     fc = file_set_checker.FileSetChecker()
     expected = [
         tag.CheckpkgTag(
             None, 'bad-vendor-tag',
             'filename=csw-upload-pkg expected=CSW actual=UNKN')
     ]
     expected_2 = [
         tag.CheckpkgTag(None, 'bad-arch-or-os-release',
                         'csw-upload-pkg arch=pkg osrel=unspecified'),
     ]
     files = ['csw-upload-pkg']
     files_with_metadata = fc._FilesWithMetadata(files)
     self.assertEqual(expected, fc._CheckUncommitted(files_with_metadata))
     self.assertEqual(expected_2,
                      fc._CheckMissingArchs(files_with_metadata))
 def testUncommitted(self):
     fc = file_set_checker.FileSetChecker()
     expected = [
         tag.CheckpkgTag(
             None, 'bad-vendor-tag',
             'filename=nspr_devel-4.8.6,REV=2010.10.16-SunOS5.9-sparc-UNCOMMITTED.pkg.gz expected=CSW actual=UNCOMMITTED'
         ),
         tag.CheckpkgTag(
             None, 'bad-vendor-tag',
             'filename=nspr_devel-4.8.6,REV=2010.10.16-SunOS5.9-i386-UNCOMMITTED.pkg.gz expected=CSW actual=UNCOMMITTED'
         ),
     ]
     files = [
         '/home/experimental/maciej/'
         'nspr_devel-4.8.6,REV=2010.10.16-SunOS5.9-sparc-UNCOMMITTED.pkg.gz',
         '/home/experimental/maciej/'
         'nspr_devel-4.8.6,REV=2010.10.16-SunOS5.9-i386-UNCOMMITTED.pkg.gz'
     ]
     self.assertEqual(expected, fc.CheckFiles(files))
Beispiel #7
0
    else:
        logging.basicConfig(level=logging.INFO)
    logging.debug("args: %s", args)
    hostname = socket.gethostname()
    if not hostname.startswith('login'):
        logging.warning("This script is meant to be run on the login host.")
    os_release = options.os_release
    if os_release:
        os_release = struct_util.OsReleaseToLong(os_release)

    if not args:
        parser.print_usage()
        sys.exit(1)

    # Check the file set.
    fc = file_set_checker.FileSetChecker()
    error_tags = fc.CheckFiles(args)
    if error_tags:
        print "There is a problem with the presented file list."
        for error_tag in error_tags:
            print "*", error_tag
        if options.filename_check:
            sys.exit(1)
        else:
            print "Continuing anyway."

    if os_release and os_release not in common_constants.OS_RELS:
        raise DataError("OS release %r is not valid. Valid values: %r" %
                        (os_release, common_constants.OS_RELS))

    username, password = rest.GetUsernameAndPassword()
Beispiel #8
0
 def testMissingArchitecture(self):
     fc = file_set_checker.FileSetChecker()
     expected = [tag.CheckpkgTag(None, 'i386-SunOS5.9-missing', 'libnspr4')]
     files_with_metadata = fc._FilesWithMetadata(SAMPLE_FILES)
     self.assertEqual(expected, fc._CheckMissingArchs(files_with_metadata))
 def testMissingArchitecture(self):
     fc = file_set_checker.FileSetChecker()
     expected = [tag.CheckpkgTag(None, 'i386-SunOS5.9-missing', 'libnspr4')]
     self.assertEqual(expected, fc.CheckFiles(SAMPLE_FILES))