Commit Graph

52 Commits

Author SHA1 Message Date
John Mulligan 498214f580 implements: add rados/striper (sub)package support
Add rados/striper to the implements tool. It needs to be recognized
as a new C-API wrapping library.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2024-08-08 14:07:59 +00:00
guoguangwu 0d7e4e6347 contrib: remove refs to deprecated io/ioutil
Signed-off-by: guoguangwu <guoguangwu@magic-shield.com>
2023-07-08 14:26:48 +00:00
John Mulligan 36f65ce31d contrib: fix and simplify condition for reporting only stable apis
When generating the human-readable api-status.md document from the
JSON, the logic used to determine if a package had no Preview/Deprecated
APIs was incorrect. This change fixes and simplifies that condition.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2023-01-12 05:44:24 +00:00
John Mulligan 2d1d51b762 contrib: convert some print calls info info/warning message calls
Adds a info and a warning function that currently just wraps print.
In the future these classified print statements could be customized
for output specific to the message type.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2023-01-10 16:46:02 +00:00
John Mulligan dd95ce1437 contrib: add a specific warning to display new and unexpected stable api
Previously, apiage.py just print out a problem count when it found
an unexpected stable api in the new apis file. Now the output displays
something like this:
```
found new unexpected stable apis: API.LeakyBucket
error: 1 problems detected
```

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2023-01-10 16:46:02 +00:00
John Mulligan 76ca06826b contrib: format apiage.py with black python formatter
Ran: `black -l78 contrib/apiage.py`.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2023-01-10 16:46:02 +00:00
John Mulligan 77ad70fd0c apiage: add hooks to help automatically file an issue
Signed-off-by: John Mulligan <jmulligan@redhat.com>
2022-12-01 07:10:05 +00:00
Anoop C S 1fe5774292 apiage: Remove empty tables from API status markdown
There are instances in API status json with empty list for preview or
deprecated APIs. Due to a missing empty check we had corresponding
tables created without any content.

While adding the empty check also modify the condition which adds an
entry indicating absence of any preview/deprecated APIs to consider
empty lists.

Signed-off-by: Anoop C S <anoopcs@cryptolab.net>
2022-10-18 12:10:31 +00:00
John Mulligan 4f5281df0f contrib: fix moving all/multiple apis from preview to stable
I hadn't tested apiage well enough to see that the existing code didn't
correctly handle the case when all or many apis were becoming stable all
together. Things worked fine for a single function call, but not with
many. This fix tries to only update the JSON when needed while correctly
handling the case of multiple changes in one pkg at once.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2022-10-17 17:39:24 +00:00
John Mulligan 1b33c5fd2e contrib: fix a bug in apiage.py
Probably caused by last minute changes to the pr that added the feature,
it just needed the same initialization as the other section.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2022-10-17 17:39:24 +00:00
John Mulligan 5a7d149d50 contrib: add a api promote mode to apiage
Promote an API from preview to stable, after the build tags are removed
from the Go source code. This mode can be used to help move apis that
are now stable out of preview state in our api-status.json file.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2022-09-12 14:26:35 +00:00
John Mulligan c29eb9d7b1 contrib: only read implemments json file when needed
Signed-off-by: John Mulligan <jmulligan@redhat.com>
2022-08-30 15:41:01 +00:00
John Mulligan e5f0dbcfea contrib: teach apiage how to find and report on apis to update
Find preview apis that should become stable. Find deprecated apis that
should be removed. Have a mode to convert between the low level json
report and some markdown that could be pasted into an issue.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2022-08-30 15:41:01 +00:00
Anoop C S a79b4614d6 contrib/apiage: Do not leave empty sections for packages in markdown
For those packages without any preview/deprecated APIs we used to
include a header despite any content under it. We could instead
mention the state in a meaningful sentence.

Signed-off-by: Anoop C S <anoopcs@cryptolab.net>
2022-08-12 08:02:33 +00:00
John Mulligan d6bf51115d contrib: add new fix-versions mode to apiage.py
Fixes: #718

This change adds a new "fix-versions" mode to apiage.py, as well as the
ability to set placeholder version values when adding a new API. The
fix-versions mode replaces placeholder versions with real version
numbers. When fixing versions, the --fix-filter-pkg & --fix-filter-func
options can be used to narrow down what APIs will be fixed in case not
all version placeholder should be fixed to the same values.

Note that the placeholders being with a '$' character and look a bit
like a shell variable. However, the text is simply a reminder - only the
'$' prefix is significant. This indicates that the field is a
placeholder.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2022-08-08 10:35:43 +00:00
Sven Anderson 423c7ca899 implements: use ceph_preview tag instead of PREVIEW comment
Signed-off-by: Sven Anderson <sven@redhat.com>
2022-06-06 14:42:04 +00:00
John Mulligan a54c6e74e3 implements: a public function's type must be exported too
Signed-off-by: John Mulligan <jmulligan@redhat.com>
2022-04-28 02:50:10 +00:00
Sven Anderson 4ef3865bb3 implements: analyze all but internal packages
Signed-off-by: Sven Anderson <sven@redhat.com>
2022-04-12 17:53:06 +00:00
Sven Anderson f6eeb68e33 contrib/implements: move into independent module
Signed-off-by: Sven Anderson <sven@redhat.com>
2022-02-21 14:45:42 +00:00
Sven Anderson cf77731927 contrib/implements: remove some linter noise
Signed-off-by: Sven Anderson <sven@redhat.com>
2022-02-21 14:45:42 +00:00
Sven Anderson 0b907cf04f contrib/implements: replace castxml with cc library
Signed-off-by: Sven Anderson <sven@redhat.com>
2022-02-21 14:45:42 +00:00
John Mulligan f27408f8bf contrib: add common/admin/manager to implements
Signed-off-by: John Mulligan <jmulligan@redhat.com>
2022-02-08 15:55:02 +00:00
John Mulligan 689ee58bf8 contrib: have apiage fail if no source data is available
It is kind of pointless to let the tool run if no source data is
present, so treat empty/missing source as an error.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2021-11-09 02:02:08 +00:00
John Mulligan 0d5ae4da1f contrib: add support for using the most recent tag for basing updates
Signed-off-by: John Mulligan <jmulligan@redhat.com>
2021-11-09 02:02:08 +00:00
Sven Anderson cee047149f tools: update implements tool to new deprecated/preview style
Signed-off-by: Sven Anderson <sven@redhat.com>
2021-10-04 18:58:35 +00:00
Sven Anderson 97630486ee contrib: implements tool prints stderr if castxml fails
Signed-off-by: Sven Anderson <sven@redhat.com>
2021-10-04 15:49:43 +00:00
John Mulligan 5d41b671df contrib: add apiage.py - a script to help track the "aging" of apis
This tool can be run as part of our CI as a mechanism to check that
(some) of the policy requirements are being met. It can also be run by
humans as part of the process to update the tracked API information.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2021-09-30 13:27:01 +00:00
John Mulligan f986a965ca implements: always include the ceph_preview build tag
Signed-off-by: John Mulligan <jmulligan@redhat.com>
2021-09-30 13:27:01 +00:00
John Mulligan 3590347f60 implements: add support for scanning the api of the "admin" subpackages
Signed-off-by: John Mulligan <jmulligan@redhat.com>
2021-09-30 13:27:01 +00:00
John Mulligan 961ff19bfd implements: don't panic if no counts for C functions are avaiable
Signed-off-by: John Mulligan <jmulligan@redhat.com>
2021-09-30 13:27:01 +00:00
John Mulligan 29c18bcfd0 implements: report on stable functions in json output
Because there will be a lot of stable functions we only report on them
in the json report as the text report is more meant for summaries.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2021-09-30 13:27:01 +00:00
John Mulligan d1aa76c613 implements: track all public functions, including stable ones
The go source (ast) visitor will now keep track of all public functions it
finds putting them into lists by category: deprecated, preview, stable.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2021-09-30 13:27:01 +00:00
John Mulligan 2ebd4bc1d5 implements: ignore some C package calls that are just noise
Signed-off-by: John Mulligan <jmulligan@redhat.com>
2021-09-30 13:27:01 +00:00
John Mulligan 18a134b535 implements: gather more per-api-function stats into a struct
Do more than collect names, because we're going to need more information
to feed to the eventual check tool.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2021-09-30 13:27:01 +00:00
John Mulligan 12e7178bc0 implements: teach the implements tool to detect deprecated/preview funcs
Teach the implements tool how to detect functions marked deprecated and
marked preview in the go-ceph codebase. Especially helpful will be the
JSON output which can, in the future, be added to a tool-chain that
helps track when deprecated functions are to be removed and when preview
functions should become stable.

Note that this change ONLY implements the detection of
preview/deprecated based on the doc comments.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2021-09-30 13:27:01 +00:00
John Mulligan 6856f9efa2 implements: naming conventions: remove underscores from c stub vars
Fix up variable names that don't meet Go standards.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2021-09-13 15:13:53 +00:00
John Mulligan c1e544b8c3 implements: naming conventions: Xml -> XML
Fix up variable names that don't meet Go standards.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2021-09-13 15:13:53 +00:00
John Mulligan a4785fceb6 implements: add cli arguments to run multiple reports if requested
Add new arguments to 'implements' that allow for specifying one or more
report type and either a dash ('-' meaning stdout) or a file name to
control where the report is written.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-06-05 11:35:03 -04:00
John Mulligan 3e15044962 implements: add io.Writer argument when creating text report
This io.Writer will be the destination for writes from the report.
This better matches with what the JSON report was doing.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-06-05 11:35:03 -04:00
John Mulligan fa21b454ab implements: add brief description to build and use the tool
This is a dev tool mainly for just those of us who work on the project,
so this is mainly just a quick-start type description.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-05-17 11:26:46 -04:00
John Mulligan fb7c0f6561 implements: renamed "covered" to "found"
To be clearer about what the tool detects, rename "covered" to "found"
such as not to indicate an undocumented but used function is considered
"covered". Future arguments about what "covered" really means to be
scheduled at a later date. :-)

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-05-17 11:26:46 -04:00
John Mulligan 3ad6ad0473 implements: drop --annotate option
Currently, annotating the functions (are they documented, deprecated,
etc) in the function listing is not very costly and there are very
few situations where that extra information would be unwanted. Just
annotate the listing every time when running the tool.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-05-17 11:26:46 -04:00
John Mulligan 141cd73223 implements: add implements cli interface
Add a main.go file to complete the `implements` cli tool.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-05-17 11:26:46 -04:00
John Mulligan 2d41cc93ca implements: add a JSON based report output
Allowing the tool to generate a JSON report makes it easier to add
additional tools later to make use of this data, without hand parsing
the text output.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-05-17 11:26:46 -04:00
John Mulligan 58745462e5 implements: add a textual report
Add simple reporting functionality to the implements package that is
intended to mimic the output of the current contrib/apicompare.py
script.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-05-17 11:26:46 -04:00
John Mulligan 49ac91b5b9 implements: process C sources use castxml
Add a file for processing C sources using the `castxml` tool. This tool
produces XML describing a C AST. This file adds go code for invoking the
tool and minimal processing of the XML it generates.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-05-17 11:26:46 -04:00
John Mulligan 18d8083de3 implements: add initial code for process Go sources
This code makes use of Go's native AST processing packages and allows us
to analyze our source code using the go-ceph conventions.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-05-17 11:26:46 -04:00
John Mulligan ce7911ea35 implements: stub in the initial support for functions pulled from C
These types will be used to track what C functions are expected to be
implemented.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-05-17 11:26:46 -04:00
John Mulligan 80300e4e5a implements: initialize the internal package with minimal logging support
This log.go file establishes the ability for the package's user to hand
it any logger that meets the very minimal interface.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-05-17 11:26:46 -04:00
John Mulligan f082075f26 implmements: introduce the implements tool
Mostly just a stub at the moment. Details to follow.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-05-17 11:26:46 -04:00