Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add dependencies reporting batch #126

Merged
merged 1 commit into from
Mar 12, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions devtools/3rd_party/dependency_report.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
@echo off
rem
rem Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
rem or more contributor license agreements. Licensed under the Elastic License;
rem you may not use this file except in compliance with the Elastic License.
rem

rem
rem Create a CSV file listing the information about our 3rd party dependencies
rem that is required for the stack-wide list.
rem
rem Usage:
rem dependency_report.bat --csv <output_file>
rem
rem The format is that defined in https://github.com/elastic/release-manager/issues/207,
rem i.e. a CSV file with the following fields:
rem
rem name,version,revision,url,license,copyright
rem
rem The way this script works, each component must have its own CSV file with
rem those fields, and this script simply combines them into a single CSV file.
rem Because of this, the field order is important - in each per-component CSV
rem file the fields must be in the order shown above.

setlocal EnableExtensions EnableDelayedExpansion

if /i [%1] == [--csv] (
set OUTPUT_FILE=%2
)

if [%OUTPUT_FILE%] == [] (
echo Usage: %~0 --csv ^<output_file^>
exit /b 1
)

cd %~dp0

rem IMPORTANT: this assumes all the *INFO.csv files have the following header:
rem
rem name,version,revision,url,license,copyright

set FIRST=yes
for %%i in (licenses\*INFO.csv) do (
if [!FIRST!] == [yes] (
set FIRST=no
rem "|| rem": set errorlevel
type %~dp0\%%i > %OUTPUT_FILE% || rem
if ERRORLEVEL 1 (
exit /b 1
)
) else (
findstr /v "^name," %~dp0\%%i >> %OUTPUT_FILE%
)
)

endlocal