-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This diff removes the build_tarballs.sh and the rpm/Makefile files and moves their logic into the main Makefile. The build system places binary files in the build directory. The release system copy those files over to the release directory, preparing it for travis to pick up. Examples: make binary_deb binary_rpm VERSION=1.0 make clean binary_tar VERSION=1.0 GOOS=linux GOARCH=amd64 make distclean release VERSION=1.0 Deleted the debian/copyright file because it was outdated; I think this could be automated with debmake but didn't spend time on it. There's other minor changes like removing trailing space from files, updating and adding documentation. Re-add copyright notice to vulndb/schema.go.
- Loading branch information
Showing
10 changed files
with
188 additions
and
407 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,154 @@ | ||
# Go parameters | ||
GOCMD=go | ||
GOBUILD=$(GOCMD) build | ||
GOCLEAN=$(GOCMD) clean | ||
GOGET=$(GOCMD) get | ||
CPE2CVE=cpe2cve | ||
CSV2CPE=csv2cpe | ||
NVDSYNC=nvdsync | ||
RPM2CPE=rpm2cpe | ||
|
||
NAME=nvdtools | ||
PKG=$(NAME)-$(VERSION) | ||
TGZ=$(PKG).tar.gz | ||
|
||
all: build | ||
build: | ||
$(GOBUILD) -o $(CPE2CVE) ./cmd/$(CPE2CVE)/cpe2cve.go | ||
$(GOBUILD) -o $(CSV2CPE) ./cmd/$(CSV2CPE)/csv2cpe.go | ||
$(GOBUILD) -o $(NVDSYNC) ./cmd/$(NVDSYNC)/main.go | ||
$(GOBUILD) -o $(RPM2CPE) ./cmd/$(RPM2CPE)/rpm2cpe.go | ||
|
||
clean: | ||
$(GOCLEAN) | ||
rm -f $(CPE2CVE) | ||
rm -f $(CSV2CPE) | ||
rm -f $(NVDSYNC) | ||
rm -f $(RPM2CPE) | ||
|
||
# Copyright (c) Facebook, Inc. and 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. | ||
|
||
NAME = nvdtools | ||
VERSION = tip | ||
|
||
TOOLS = \ | ||
cpe2cve \ | ||
csv2cpe \ | ||
fireeye2nvd \ | ||
flexera2nvd \ | ||
nvdsync \ | ||
rpm2cpe \ | ||
rustsec2nvd \ | ||
vulndb | ||
|
||
DOCS = \ | ||
CODE_OF_CONDUCT.md \ | ||
CONTRIBUTING.md \ | ||
HOWTO.md \ | ||
LICENSE \ | ||
README.md | ||
|
||
GO = go | ||
GOOS = $(shell $(GO) env GOOS) | ||
GOARCH = $(shell $(GO) env GOARCH) | ||
|
||
TAR = tar | ||
ZIP = zip | ||
INSTALL = install | ||
|
||
# Compile all tools. | ||
all: $(TOOLS) | ||
|
||
# Compile TOOLS to ./build/bin/$tool using GOOS and GOARCH. | ||
$(TOOLS): | ||
GOOS=$(GOOS) GOARCH=$(GOARCH) $(GO) build $(GOFLAGS) -o ./build/bin/$@ ./cmd/$@ | ||
|
||
# Check/fetch all dependencies. | ||
deps: | ||
GOOS=$(GOOS) GOARCH=$(GOARCH) $(GO) get -v -d ./... | ||
|
||
# install installs tools and documentation. | ||
# The install target is used by rpm and deb builders. | ||
install: | ||
install -d $(DESTDIR)/usr/bin | ||
install -p -m 0755 ./cpe2cve $(DESTDIR)/usr/bin/cpe2cve | ||
install -p -m 0755 ./csv2cpe $(DESTDIR)/usr/bin/csv2cpe | ||
install -p -m 0755 ./nvdsync $(DESTDIR)/usr/bin/nvdsync | ||
install -p -m 0755 ./rpm2cpe $(DESTDIR)/usr/bin/rpm2cpe | ||
|
||
archive: | ||
touch $(TGZ) | ||
tar czf $(TGZ) --exclude=$(TGZ) --transform s/$(NAME)/$(PKG)/ ../$(NAME) | ||
# tools | ||
$(INSTALL) -d $(DESTDIR)/usr/bin | ||
for tool in $(TOOLS); do $(INSTALL) -p -m 0755 ./build/bin/$$tool $(DESTDIR)/usr/bin/$$tool; done | ||
# docs | ||
$(INSTALL) -d $(DESTDIR)/usr/share/doc/nvdtools | ||
for doc in $(DOCS); do $(INSTALL) -p -m 0644 $$doc $(DESTDIR)/usr/share/doc/nvdtools/$$doc; done | ||
|
||
DIST_NAME = $(NAME)-$(VERSION) | ||
DIST_DIR = build/$(DIST_NAME) | ||
|
||
# binary_dist creates a local binary distribution in DIST_DIR. | ||
binary_dist: $(TOOLS) | ||
mkdir -p $(DIST_DIR)/doc | ||
cp $(DOCS) $(DIST_DIR)/doc | ||
mv build/bin $(DIST_DIR)/bin | ||
|
||
# binary_tar creates tarball of binary distribution. | ||
binary_tar: binary_dist | ||
mkdir -p build/tgz | ||
cd build && $(TAR) czf tgz/$(DIST_NAME)-$(GOOS)-$(GOARCH).tar.gz $(DIST_NAME) | ||
rm -rf $(DIST_DIR) | ||
|
||
# binary_zip creates zip of binary distribution. | ||
binary_zip: binary_dist | ||
mkdir -p build/zip | ||
cd build && $(ZIP) -r zip/$(DIST_NAME)-$(GOOS)-$(GOARCH).zip $(DIST_NAME) | ||
rm -rf $(DIST_DIR) | ||
|
||
# binary_deb creates debian package. | ||
# | ||
# Requires GOPATH and dependencies available to compile nvdtools. | ||
# Must set version to build: make binary_deb VERSION=1.0 | ||
binary_deb: | ||
VERSION=$(VERSION) dpkg-buildpackage -rfakeroot -uc -us | ||
mkdir -p build/deb | ||
mv ../$(NAME)*.deb build/deb/ | ||
|
||
# archive_tar creates tarball of the source code. | ||
archive_tar: | ||
mkdir -p build/tgz | ||
$(TAR) czf build/tgz/$(DIST_NAME).tar.gz \ | ||
--exclude=build \ | ||
--exclude=release \ | ||
--exclude=.git \ | ||
--exclude=.travis.yml \ | ||
--transform s/./$(DIST_NAME)/ \ | ||
. | ||
|
||
# binary_rpm creates rpm package. | ||
# | ||
# Requires GOPATH and dependencies available to compile nvdtools. | ||
# Must set version to build: make binary_rpm VERSION=1.0 | ||
binary_rpm: archive_tar | ||
mkdir -p build/rpm/SOURCES | ||
mv build/tgz/$(DIST_NAME).tar.gz build/rpm/SOURCES/ | ||
rpmbuild -ba \ | ||
--define="_topdir $(PWD)/build/rpm" \ | ||
--define="_version $(VERSION)" \ | ||
rpm/nvdtools.spec | ||
|
||
# release_tar creates tarball releases. | ||
release_tar: | ||
mkdir -p release | ||
make deps binary_tar GOOS=darwin GOARCH=amd64 | ||
make deps binary_tar GOOS=freebsd GOARCH=amd64 | ||
make deps binary_tar GOOS=linux GOARCH=amd64 | ||
make deps binary_tar GOOS=linux GOARCH=arm64 | ||
mv build/tgz/*.tar.gz release | ||
|
||
# release_zip creates zip releases. | ||
release_zip: | ||
mkdir -p release | ||
make deps binary_zip GOOS=windows GOARCH=386 | ||
make deps binary_zip GOOS=windows GOARCH=amd64 | ||
mv build/zip/*.zip release | ||
|
||
# release_deb creates debian releases. | ||
release_deb: binary_deb | ||
mkdir -p release | ||
mv build/deb/*.deb release | ||
|
||
# release_rpm creates rpm releases. | ||
release_rpm: binary_rpm | ||
mkdir -p release | ||
mv build/rpm/RPMS/*/*.rpm release | ||
|
||
# release creates all release packages. | ||
# Example: make distclean release VERSION=1.0 | ||
release: release_deb release_rpm release_tar release_zip | ||
|
||
# Removes build related files. | ||
clean: | ||
rm -rf build | ||
|
||
distclean: clean | ||
rm -rf release | ||
|
||
.PHONY: $(TOOLS) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
A set of tools to work with the feeds (vulnerabilities, CPE dictionary etc.) distributed by National Vulnerability Database (NVD) | ||
A set of tools to work with the feeds (vulnerabilities, CPE dictionary etc.) distributed by National Vulnerability Database (NVD). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
Source: nvdtools | ||
Section: utils | ||
Priority: extra | ||
Maintainer: Alexandre Fiori <[email protected]> | ||
Maintainer: Alexandre Fiori <[email protected]> | ||
Build-Depends: debhelper (>=9) | ||
Standards-Version: 3.9.6 | ||
Homepage: https://github.com/facebookincubator/nvdtools/ | ||
|
@@ -10,4 +10,4 @@ Package: nvdtools | |
Architecture: any | ||
Multi-Arch: foreign | ||
Depends: ${misc:Depends}, ${shlibs:Depends} | ||
Description: A set of tools to work with the feeds (vulnerabilities, CPE dictionary etc.) distributed by National Vulnerability Database (NVD) | ||
Description: A set of tools to work with the feeds (vulnerabilities, CPE dictionary etc.) distributed by National Vulnerability Database (NVD). |
Oops, something went wrong.