misc: finish removing deprecated cop API 26/31626/4
authorDave Barach <dave@barachs.net>
Thu, 11 Mar 2021 20:12:29 +0000 (15:12 -0500)
committerDamjan Marion <dmarion@me.com>
Mon, 15 Mar 2021 17:34:40 +0000 (17:34 +0000)
Fix bug in crcchecker. It must be possible to remove a non-production
.api file

Type: improvement

Signed-off-by: Dave Barach <dave@barachs.net>
Change-Id: I00b953e58017cc53051e6f4d8a70403dce8219a0

extras/scripts/crcchecker.py
src/vnet/cop/cop.api [deleted file]

index fdaef21..f3021c3 100755 (executable)
@@ -23,7 +23,8 @@ def crc_from_apigen(revision, filename):
     all APIs in filename'''
     if not revision and not os.path.isfile(filename):
         print(f'skipping: {filename}', file=sys.stderr)
-        return {}
+        # Return <class 'set'> instead of <class 'dict'>
+        return {-1}
 
     if revision:
         apigen = (f'{APIGENBIN} --git-revision {revision} --includedir src '
@@ -213,10 +214,12 @@ def check_patchset():
     for filename in files:
         # Ignore files that have version < 1.0.0
         _ = crc_from_apigen(None, filename)
-        if _['_version']['major'] == '0':
-            continue
+        # Ignore removed files
+        if isinstance(_, set) == 0:
+            if isinstance(_, set) == 0 and _['_version']['major'] == '0':
+                continue
+            newcrcs.update(_)
 
-        newcrcs.update(_)
         oldcrcs.update(crc_from_apigen(revision, filename))
 
     backwards_incompatible = report(newcrcs, oldcrcs)
diff --git a/src/vnet/cop/cop.api b/src/vnet/cop/cop.api
deleted file mode 100644 (file)
index bc213c2..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Copyright (c) 2015-2020 Cisco and/or its affiliates.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-option version = "0.0.1";
-
- /*
- * Local Variables:
- * eval: (c-set-style "gnu")
- * End:
- */