diff --git a/.copr/Makefile b/.copr/Makefile index 408a8a1..adc0b4c 100644 --- a/.copr/Makefile +++ b/.copr/Makefile @@ -1 +1,11 @@ -include include/copr_srpm.mk +srpm: + dnf -y install 'dnf-command(copr)' rpmdevtools wget python2 + dnf -y --setopt=reposdir=/tmp/yum.repos.d copr enable clime/rpkg-client + dnf -y install rpkg + python setup.py sdist -d ./ + rpkg srpm --outdir=$(outdir) --spec=python-iml-agent.spec + for x in chroma-agent.service 50-chroma-agent.preset logrotate.cfg iml-storage-server.target 10-device-scanner.target.conf iml-agent-*.tar.gz; \ + do \ + rm -rf $(outdir)/$$x; \ + cp $$x $(outdir); \ + done diff --git a/.gitignore b/.gitignore index f8b9b30..7516ed4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,4 @@ MANIFEST -python-iml-agent.spec dist/ chroma_agent/.dev_config_store/ *.pyc diff --git a/.travis.yml b/.travis.yml index 76faff6..fbd9900 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,7 +16,12 @@ jobs: - stage: test name: "mock build test" script: - - ./include/travis/run_in_centos7_docker.sh include/travis/mock_build_test.sh + - docker run -dit --name mock -v "$(pwd)":/mockdir --cap-add=SYS_ADMIN --privileged imlteam/mock + - docker exec -it mock bash -xec 'yum install -y dnf' + - docker exec -it mock bash -xec 'chown root.root /mockdir/*' + - docker exec -it mock bash -xec 'mkdir -p /tmp/build' + - docker exec -it mock bash -xec 'cd /mockdir && make -f .copr/Makefile outdir=/tmp/build' + - docker exec -it mock bash -xec 'mock /tmp/build/python-iml-agent-*.el*.src.rpm -v --enable-network' - stage: test name: "Format Check" python: "3.6" @@ -25,12 +30,23 @@ jobs: script: - black --check ./ - stage: cd - git: - depth: 999999 name: "Continuous Deployment" script: - - include/travis/copr-deploy.sh prepare - - ./travis_wait "./include/travis/run_in_centos7_docker.sh include/travis/copr-deploy.sh build_srpm" + - export OWNER=managerforlustre + - export PROJECT=manager-for-lustre-devel + - export PACKAGE=python-iml-agent + - export CLONE_URL=https://github.com/whamcloud/iml-agent.git + - export SPEC=python-iml-agent.spec + - docker run -it -e OWNER="$OWNER" -e PROJECT="$PROJECT" -e PACKAGE="$PACKAGE" -e CLONE_URL="$CLONE_URL" -e SPEC="$SPEC" -e KEY="$encrypted_253525cedcf6_key" -e IV="$encrypted_253525cedcf6_iv" -v $(pwd):/build:rw imlteam/copr + - stage: deploy-copr + name: "Copr deploy" + script: + - export OWNER=managerforlustre + - export PROJECT=manager-for-lustre + - export PACKAGE=python-iml-agent + - export CLONE_URL=https://github.com/whamcloud/iml-agent.git + - export SPEC=python-iml-agent.spec + - docker run -it -e OWNER="$OWNER" -e PROJECT="$PROJECT" -e PACKAGE="$PACKAGE" -e CLONE_URL="$CLONE_URL" -e SPEC="$SPEC" -e KEY="$encrypted_253525cedcf6_key" -e IV="$encrypted_253525cedcf6_iv" -v $(pwd):/build:rw imlteam/copr - stage: deploy-pypi name: "PyPi deploy" script: skip @@ -43,17 +59,6 @@ jobs: all_branches: true distributions: sdist bdist_wheel skip_upload_docs: true - - stage: deploy-copr - name: "Copr deploy" - script: skip - before_deploy: - - include/travis/copr-deploy.sh prepare - deploy: - skip_cleanup: true - provider: script - script: ./travis_wait "./include/travis/run_in_centos7_docker.sh include/travis/copr-deploy.sh build" - on: - all_branches: true stages: - test - name: cd diff --git a/Makefile b/Makefile deleted file mode 100644 index ab30f59..0000000 --- a/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -NAME := iml-agent -SUBPACKAGES := management -TEST_DEPS := python2-tablib python2-iml-common1.4 python-netaddr \ - python2-toolz python-django -MODULE_SUBDIR = chroma_agent - -include include/python-localsrc.mk diff --git a/chroma_agent/__init__.py b/chroma_agent/__init__.py index 800c92e..9412462 100644 --- a/chroma_agent/__init__.py +++ b/chroma_agent/__init__.py @@ -25,20 +25,16 @@ raise try: - from scm_version import VERSION, PACKAGE_VERSION, IS_RELEASE, BUILD + from version import VERSION, PACKAGE_VERSION __version__ = VERSION __package_version__ = PACKAGE_VERSION - __build__ = BUILD - __is_release__ = IS_RELEASE except ImportError: from pkginfo import UnpackedSDist pkg = UnpackedSDist(".") __version__ = pkg.version __package_version__ = __version__ - __build__ = 1 - __is_release__ = False def package_version(): diff --git a/chroma_agent/scm_version.py b/chroma_agent/scm_version.py deleted file mode 100644 index b82cbc0..0000000 --- a/chroma_agent/scm_version.py +++ /dev/null @@ -1,4 +0,0 @@ -VERSION = "4.1.1-25-gc2e16cc" -PACKAGE_VERSION = "4.1.1" -BUILD = "" -IS_RELEASE = False diff --git a/chroma_agent/version.py b/chroma_agent/version.py new file mode 100644 index 0000000..e5dd505 --- /dev/null +++ b/chroma_agent/version.py @@ -0,0 +1,2 @@ +PACKAGE_VERSION = "4.1.2" +VERSION = "{}-1".format(PACKAGE_VERSION) diff --git a/include/.gitrepo b/include/.gitrepo deleted file mode 100644 index a2bf520..0000000 --- a/include/.gitrepo +++ /dev/null @@ -1,12 +0,0 @@ -; DO NOT EDIT (unless you know what you are doing) -; -; This subdirectory is a git "subrepo", and this file is maintained by the -; git-subrepo command. See https://github.com/git-commands/git-subrepo#readme -; -[subrepo] - remote = git@github.com:intel-hpdd/module-tools.git - branch = master - commit = ee34605d2abde40824d088b571963c42c53ac8f5 - parent = 4a1e428f3dae5dbed53723dd1573af187993b7ed - method = merge - cmdver = 0.4.0 diff --git a/include/LICENSE b/include/LICENSE deleted file mode 100644 index 89e8605..0000000 --- a/include/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2018 DDN - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/include/Makefile b/include/Makefile deleted file mode 100644 index 8158af7..0000000 --- a/include/Makefile +++ /dev/null @@ -1 +0,0 @@ -include githooks.mk diff --git a/include/README.md b/include/README.md deleted file mode 100644 index 9f3af75..0000000 --- a/include/README.md +++ /dev/null @@ -1,25 +0,0 @@ -# module-tools -Tools to work with and build modules - -This module can be included as a [git subrepo](https://github.com/ingydotnet/git-subrepo), imported at ``include/` in an enclosing module to provide tools to help build RPMs for the enclosing module. - -See the writeup for the [Basics of git subrepo](https://github.com/ingydotnet/git-subrepo/wiki/Basics). - -Once this module is imported to an enclosing module, the enclosing module needs a Makefile defining the enclosing module's *NAME* and optionally *PACKAGE_VERSION*, *DIST_VERSION*, *PACKAGE_RELEASE*, *TEST_DEPS* and include a _Makefile_ fragment indicating what type of package it is. Choices for example are *python-localsrc.mk* for a Python package with source local to the module. *python-pypi.mk* is used for a Python module that will be built from it's PyPI release. - -Some of the useful make targets provided are: -- githooks: Installs the hooks/ subdirectory into your git repo as it - git hooks -- rpms: Creates all of the binary RPMs for the module -- srpm: Creates the source RPM for the module -- build_test: Performs an RPM build in mock -- test: Runs any tests of the module -- tag: Generates any needed files and applies a git tag -- copr_build: Submits the RPM specfile to Copr for building in a - private repo - - this requires that a file named copr-local.mk exists - in the repo with COPR_OWNER and COPR_PROJECT defined - as the owner and project in Copr to build in -- iml_copr_repo: Submits the RPM specfile to Corp for building in - the production IML repo - diff --git a/include/common.mk b/include/common.mk deleted file mode 100644 index 9cbc1ad..0000000 --- a/include/common.mk +++ /dev/null @@ -1,15 +0,0 @@ -travis_mock_build_test: - TRAVIS=true TRAVIS_EVENT_TYPE=pull_request \ - TRAVIS_PULL_REQUEST_BRANCH=$${TRAVIS_PULL_REQUEST_BRANCH:-master} \ - include/travis/run_in_centos7_docker.sh \ - include/travis/mock_build_test.sh - -clean: - if [ -n "$(CLEAN)" ]; then \ - rm -rf $(CLEAN); \ - fi - -distclean: clean - if [ -n "$(DISTCLEAN)" ]; then \ - rm -rf $(DISTCLEAN); \ - fi diff --git a/include/copr-mfl.enc b/include/copr-mfl.enc deleted file mode 100644 index 45065e2..0000000 --- a/include/copr-mfl.enc +++ /dev/null @@ -1,3 +0,0 @@ -rtT~*l'|:E[%e(NQ&|'ڢXq/&܆K;p::.ȺOb4q۽FИ*N 98H0]g3 -%&4E_q{cA<7:N=l)24 -_%ܕ++['!2tHT%3iC`b \ No newline at end of file diff --git a/include/copr.mk b/include/copr.mk deleted file mode 100644 index 41cb94c..0000000 --- a/include/copr.mk +++ /dev/null @@ -1,82 +0,0 @@ -PREREQ := - -# default to failsafe -DRYRUN := true -ifeq ($(DRYRUN),true) - ECHO := echo -$(warning Not actually executing commands. \ -Pass DRYRUN=false to make to execute commands.) -else - ECHO := -endif - -ifneq ($(filter iml_%,$(MAKECMDGOALS)),) - COPR_CONFIG := --config include/copr-mfl - OWNER_PROJECT = managerforlustre/manager-for-lustre-devel -else - # local settings - -include copr-local.mk - - ifeq ($(COPR_PROJECT),) - PREREQ += create_copr_project - COPR_PROJECT := $(NAME) - endif - ifneq ($(filter copr_%,$(MAKECMDGOALS)),) - ifndef COPR_OWNER - $(error COPR_OWNER needs to be set in copr-local.mk) - endif - ifndef COPR_PROJECT - $(error COPR_PROJECT needs to be set in copr-local.mk) - endif - endif - OWNER_PROJECT = $(COPR_OWNER)/$(COPR_PROJECT) -endif - -ifeq ($(shell if grep -q ^%patch $(RPM_SPEC) || \ - [ "$$(grep ^Source $(RPM_SPEC) | \ - wc -l)" -gt 1 ]; then \ - echo SRPM; \ - else \ - echo SPEC; \ - fi),SRPM) - PREREQ += $(TARGET_SRPM) -else - ifeq ($(UNPUBLISHED),true) - PREREQ += $(TARGET_SRPM) - else - PREREQ += $(RPM_SPEC) - endif -endif - - -delete_copr_project: - if copr-cli list | grep $(NAME); then \ - $(ECHO) copr-cli $(COPR_CONFIG) delete $(NAME); \ - fi - -create_copr_project: delete_copr_project - $(ECHO) copr-cli $(COPR_CONFIG) create --chroot epel-7-x86_64 \ - --enable-net on $(NAME) - -ifeq ($(BUILD_METHOD),PyPI) -#copr_build: -# https://pagure.io/copr/copr/issue/207 -copr_build iml_copr_build: $(PREREQ) - # buildpypi is pretty useless right now: - # https://pagure.io/copr/copr/issue/207 - #copr-cli buildpypi --packagename $(NAME) - #$(COPR_OWNER)/$(COPR_PROJECT) - $(ECHO) copr-cli $(COPR_CONFIG) build $(OWNER_PROJECT) $(filter-out \ - create_copr_project,$^) -else ifeq ($(BUILD_METHOD),SCM) -copr_build iml_copr_build: $(PREREQ) - $(ECHO) copr-cli $(COPR_CONFIG) buildmock $(OWNER_PROJECT) \ - --scm-type git \ - --scm-url https://github.com/whamcloud/$(NAME) -else -copr_build iml_copr_build: $(PREREQ) - $(ECHO) copr-cli $(COPR_CONFIG) build $(OWNER_PROJECT) $(filter-out \ - create_copr_project,$^) -endif - -.PHONY: copr_build iml_copr_build diff --git a/include/copr_srpm.mk b/include/copr_srpm.mk deleted file mode 100644 index 9bac37f..0000000 --- a/include/copr_srpm.mk +++ /dev/null @@ -1,15 +0,0 @@ -SPECFILE := $(shell if [ -d "$(spec)" ]; then \ - ls *.spec | head -1; \ - else \ - echo "$(spec)"; \ - fi) -ifeq ($(SPECFILE),) -$(error "SPECFILE cannot be empty!") -endif - -srpm: - dnf -y install 'dnf-command(copr)' rpmdevtools wget - dnf -y --setopt=reposdir=/tmp/yum.repos.d copr enable clime/rpkg-client - dnf -y install rpkg - spectool -g $(SPECFILE) - rpkg srpm --outdir=$(outdir) --spec=$(SPECFILE) diff --git a/include/git-versioning.mk b/include/git-versioning.mk deleted file mode 100644 index cf39f8d..0000000 --- a/include/git-versioning.mk +++ /dev/null @@ -1,62 +0,0 @@ -space := -space += -SCM_COMMIT_NUMBER := $(shell git rev-list HEAD | wc -l) -ifeq ($(strip $(JOB_NAME)),) -JENKINS_BUILD_TAG := -else -JENKINS_BUILD_TAG := $(shell echo .jenkins-$(JOB_NAME)-$(BUILD_NUMBER) | \ - sed -e 's/arch=[^,-]*,\?-\?//' \ - -e 's/distro=[^,-]*,\?-\?//' \ - -e 's,[/-],_,g') -endif -SCM_DESCRIPTION := $(shell msg=$$(git log -n 1 --abbrev-commit); \ - if echo "$$msg" | \ - grep -q "^ Create-Tag:"; then \ - echo "$$msg" | \ - sed -ne '/^ Create-Tag:/s/RC[0-9]*//;s/^.*: *v//p;/^ Create-Tag:/s/P[0-9]*//'; fi) -ifeq ($(strip $(SCM_DESCRIPTION)),) -SCM_DESCRIPTION := $(subst -,$(space),$(shell git describe --tags \ - --match v[0-9]* | \ - sed -e 's/^v//' \ - -e 's/RC[0-9]*//' \ - -e 's/P[0-9]*//')) -endif - -# Stable variable names exported to packaging and code -BUILD_NUMBER := $(SCM_COMMIT_NUMBER) -VERSION := $(subst $(space),-,$(SCM_DESCRIPTION)) -PACKAGE_VERSION := $(word 1, $(SCM_DESCRIPTION)) -PACKAGE_RELEASE := $(subst $(space),.,$(wordlist 2, 10, $(SCM_DESCRIPTION))) -ifeq ($(strip $(PACKAGE_RELEASE)),) - IS_RELEASE := True - # We use the build number in a package's release field in - # order to distinguish between RCs with identical version fields. - # e.g. 2.0.0.0-2983 (RC1), 2.0.0.0-2987 (RC2) - # The important thing is that newer RCs must upgrade older ones, - # and end-users only really care about the %{version} field. - PACKAGE_RELEASE := $(BUILD_NUMBER) -else - IS_RELEASE := False - # In development, we embed the rest of the git describe output - # in order to easily understand the provenance of a package. - # The commits-since-tag number will ensure that newer packages - # are preferred, since RPM's version parsing works left-to-right. - PACKAGE_RELEASE := $(BUILD_NUMBER).$(PACKAGE_RELEASE)$(JENKINS_BUILD_TAG) - - # Display this in the UI to make ID easier in dev/test - BUILD_NUMBER := $(JENKINS_BUILD_TAG) -endif - -MODULE_SUBDIR ?= $(subst -,_,$(NAME)) - -# only overwrite scm_version.py if we have info from git -ifneq ($(strip $(PACKAGE_VERSION)),) -$(shell { echo 'VERSION = "$(VERSION)"'; \ - echo 'PACKAGE_VERSION = "$(PACKAGE_VERSION)"'; \ - echo 'BUILD = "$(BUILD_NUMBER)"'; \ - echo 'IS_RELEASE = $(IS_RELEASE)'; } > scm_version.py.tmp; \ - trap 'rm -f scm_version.py.tmp' EXIT; \ - if ! cmp scm_version.py.tmp $(MODULE_SUBDIR)/scm_version.py; then \ - cp scm_version.py.tmp $(MODULE_SUBDIR)/scm_version.py; \ - fi) -endif diff --git a/include/githooks.mk b/include/githooks.mk deleted file mode 100644 index ef10f70..0000000 --- a/include/githooks.mk +++ /dev/null @@ -1,3 +0,0 @@ -githooks: - git config --add core.hooksPath include/hooks/ - diff --git a/include/hooks/commit-msg b/include/hooks/commit-msg deleted file mode 100755 index e108b90..0000000 --- a/include/hooks/commit-msg +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash - -SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p') -if ! grep -qs "^$SOB" "$1"; then - mv "$1"{,.tmp} - trap 'rm $1.tmp' EXIT - added=false - while read -r line; do - if ! $added && [[ $line == \#* ]]; then - echo -e "\n$SOB" - added=true - fi - echo "$line" - done < "$1".tmp > "$1" - if ! $added; then - echo -e "\n$SOB" >> "$1" - fi -fi diff --git a/include/npm.mk b/include/npm.mk deleted file mode 100644 index a72e5a7..0000000 --- a/include/npm.mk +++ /dev/null @@ -1,28 +0,0 @@ -CLEAN += $(NAME)-$(PACKAGE_VERSION).tgz \ - $(subst iml-,,$(NAME)-$(PACKAGE_VERSION).tgz) targetdir - -include include/common.mk - -TARGET_RPMS = $(NAME)-$(PACKAGE_VERSION)-$(PACKAGE_RELEASE)$(RPM_DIST).noarch.rpm - -include include/rpm-common.mk -include include/copr.mk - -# these are interesting ways to try to generate the prerequisite list but -# they don't quite work since prerequisite determination is done at Makefile -# reading time, not when this recipe is evaluated, which is what needs to -# happen in order to generate the list of files *after* the .html files are -# generated -# worth keeping here for future reference -# $(shell npx npm-packlist-cli -o make 2>/dev/null) -# this one needs: -# SHELL := /bin/bash -# $(shell find | grep -v -f <(echo "\.sw."; echo ".npmignore"; echo "^.$$"; echo "^.\/.git"; sed -e 's/\/$$//' -e 's/\*/.*/g' -e 's/^/^.\//' .npmignore) | sed -e 's/^\.\///' -e 's/ /\\ /g') -$(NAME)-$(PACKAGE_VERSION).tgz: $(NPM_PREREQS) package.json LICENSE - npm pack - -$(subst iml-,,$(NAME)-$(PACKAGE_VERSION).tgz): $(NAME)-$(PACKAGE_VERSION).tgz - rm -f $@ - ln $^ $@ - -.PHONY: install_build_deps clean distclean diff --git a/include/python-common.mk b/include/python-common.mk deleted file mode 100644 index ecb3301..0000000 --- a/include/python-common.mk +++ /dev/null @@ -1,17 +0,0 @@ -RPM_SPEC := python-$(NAME).spec - -TARGET_RPMS = $(addprefix _topdir/RPMS/noarch/python-, \ - $(addsuffix -$(PACKAGE_VRD).noarch.rpm, \ - $(ALL_PKGS))) - -test_dependencies: - test_deps="$(TEST_DEPS)"; \ - if rpm --version && yum --version && \ - ! rpm -q $$test_deps >/dev/null 2>&1; then \ - echo "Some dependencies need installing..."; \ - echo "You will need sudo root privilledges for yum" \ - sudo yum -y install $$test_deps; \ - fi - -test: test_dependencies - @nosetests $(NOSE_ARGS) diff --git a/include/python-localsrc.mk b/include/python-localsrc.mk deleted file mode 100644 index d230814..0000000 --- a/include/python-localsrc.mk +++ /dev/null @@ -1,84 +0,0 @@ -include include/git-versioning.mk - -ifeq ($(strip $(VERSION)),) -VERSION := $(shell set -x; PYTHONPATH=$(MODULE_SUBDIR) python -c \ - "import scm_version; print scm_version.VERSION") -endif - -ifeq ($(strip $(PACKAGE_VERSION)),) -PACKAGE_VERSION := $(shell set -x; PYTHONPATH=$(MODULE_SUBDIR) python -c \ - "import scm_version; print scm_version.PACKAGE_VERSION") -endif - -include include/common.mk -include include/python-common.mk -include include/rpm-common.mk -include include/copr.mk - -# should always remove the tarball sources if DIST_VERSION was set -ifneq ($(DIST_VERSION),$(PACKAGE_VERSION)) - $(shell rm -f $(word 1,$(RPM_SOURCES))) -endif - -%.egg-info/SOURCES.txt: install_build_deps-stamp - python setup.py egg_info - -deps: $(subst -,_,$(NAME)).egg-info/SOURCES.txt - sed -e 's/^/dist\/python-$(NAME)-$(PACKAGE_VERSION).tar.gz: /' < $< > deps - -dist/$(NAME)-$(PACKAGE_VERSION).tar.gz: Makefile $(MODULE_SUBDIR)/__init__.py - echo "jenkins_fold:start:Make Agent Tarball" - rm -f MANIFEST - python setup.py sdist - # TODO - is this really necessary? time precedence - # of the tarball vs. the product in _topdir/ - # should simply require that any older product - # in _topdir/ will just be rebuilt - # if we made a new tarball, get rid of all previous - # build product - rm -rf _topdir - echo "jenkins_fold:end:Make Agent Tarball" - -dist: dist/$(NAME)-$(PACKAGE_VERSION).tar.gz - -ifneq ($(DIST_VERSION),$(PACKAGE_VERSION)) -$(RPM_SOURCES): # why do we want this prereq? dist/$(NAME)-$(PACKAGE_VERSION).tar.gz -# this builds the RPM from the Source(s) specified in -# the specfile. i don't think this is what we want here. -# here, we want to build an rpm from the source tree -# let's see what time tells us we want to do - if ! spectool $(RPM_DIST_VERSION_ARG) \ - -g $(RPM_SPEC); then \ - echo "Failed to fetch $@."; \ - echo "Is this an unpublished version still?"; \ - echo "Perhaps you want to assign a PR branch name" \ - "to DIST_VERSION in your make"; \ - echo "command?"; \ - exit 1; \ - fi - # uncomment this to build the tarball from the local source tree - #git archive --prefix $(NAME)-$(DIST_VERSION)/ \ - # -o $(DIST_VERSION).tar.gz HEAD -else -_topdir/SOURCES/$(NAME)-$(PACKAGE_VERSION).tar.gz: \ - dist/$(NAME)-$(PACKAGE_VERSION).tar.gz - mkdir -p _topdir/SOURCES - cp dist/$(NAME)-$(PACKAGE_VERSION).tar.gz _topdir/SOURCES -endif - -_topdir/SOURCES/%: % - mkdir -p _topdir/SOURCES - cp $< $@ - -install_build_deps: install_build_deps-stamp - -install_build_deps-stamp: - if ! rpm -q python-setuptools; then \ - yum -y install python-setuptools; \ - fi - touch $@ - -include deps - -tags: deps - ctags --python-kinds=-i -R --exclude=_topdir diff --git a/include/python-pypi.mk b/include/python-pypi.mk deleted file mode 100644 index d637e41..0000000 --- a/include/python-pypi.mk +++ /dev/null @@ -1,29 +0,0 @@ -BUILD_METHOD := PyPI -include include/common.mk -include include/python-common.mk -include include/rpm-common.mk -include include/copr.mk - -DISTCLEAN += $(NAME)-*.tar.gz - -# don't rebuild if tracked by git since this has to be manually -# updated by a developer because pyp2rpm is just not sufficient -# to produce a working specfile -ifneq ($(shell git ls-files --error-unmatch $(RPM_SPEC) 2>/dev/null),$(RPM_SPEC)) -$(RPM_SPEC): include/python-pypi.mk - #pyp2rpm $(NAME) -t epel7 | sed \ - # -e '/%check/,/^$$/d' > $@ - pyp2rpm $(NAME) | sed -e 's/python3-/python%{python3_pkgversion}-/' \ - -e '/%check/,/^$$/d' > $@ -endif - -$(RPM_SOURCES): - if ! spectool $(RPM_DIST_VERSION_ARG) \ - --define "epel 1" \ - -g $(RPM_SPEC); then \ - echo "Failed to fetch $@."; \ - exit 1; \ - fi - -install_build_deps: - echo "Nothing to install" diff --git a/include/rpm-common.mk b/include/rpm-common.mk deleted file mode 100644 index c704992..0000000 --- a/include/rpm-common.mk +++ /dev/null @@ -1,128 +0,0 @@ -RPM_SPEC ?= $(NAME).spec -RPMLINT_REQUIRED ?= true - -CLEAN += _topdir -DISTCLEAN += dist - -# I would love nothing more than to build the specfile using the -# standard %.in rule but we need it to be made before many of the -# following variable evaluations so we can't leave it to be built -# during target processing. -# So we end up having to run this every time. -$(shell if [ $(RPM_SPEC).in -nt $(RPM_SPEC) ]; then \ - sed -e "s/@VERSION@/$(PACKAGE_VERSION)/g" \ - -e "s/@RELEASE@/$(PACKAGE_RELEASE)/g" \ - < $(RPM_SPEC).in > $(RPM_SPEC); \ - fi) - -ifndef DIST_VERSION -DIST_VERSION := $(PACKAGE_VERSION) -else -RPM_DIST_VERSION_ARG := --define dist_version\ $(DIST_VERSION) -endif - -RPM_DIST=$(subst .centos,,$(shell rpm --eval %dist)) - -# probably a way to determine this from parsespec methods -ALL_PKGS := $(NAME) $(addprefix $(NAME)-,$(SUBPACKAGES)) - -PACKAGE_VRD := $(PACKAGE_VERSION)-$(PACKAGE_RELEASE)$(RPM_DIST) - -RPM_SOURCES := $(shell spectool --define version\ $(PACKAGE_VERSION) \ - $(RPM_DIST_VERSION_ARG) \ - --define "epel 1" \ - -l $(RPM_SPEC) | \ - sed -e 's/^[^:]*: *//' -e 's/.*\///') - -COMMON_RPMBUILD_ARGS += $(RPM_DIST_VERSION_ARG) \ - --define "version $(PACKAGE_VERSION)" \ - --define "package_release $(PACKAGE_RELEASE)" \ - --define "epel 1" \ - --define "%dist $(RPM_DIST)" - -RPMBUILD_ARGS += $(COMMON_RPMBUILD_ARGS) --define "_topdir $$(pwd)/_topdir" - -TARGET_SRPM := _topdir/SRPMS/$(shell rpm $(RPMBUILD_ARGS) -q \ - --qf %{name}-%{version}-%{release}\\n \ - --specfile $(RPM_SPEC) | head -1).src.rpm -all: rpms - -genfiles: $(RPM_SPEC) - -develop: - python setup.py develop - -tarball: dist/$(NAME)-$(PACKAGE_VERSION).tar.gz - -%: %.in - sed -e "s/@VERSION@/$(PACKAGE_VERSION)/g" \ - -e "s/@RELEASE@/$(PACKAGE_RELEASE)/g" < $< > $@ - -_topdir/SPECS/$(RPM_SPEC): $(RPM_SPEC) - mkdir -p _topdir/SPECS - cp $< $@ - -_topdir/SOURCES/%: % - mkdir -p _topdir/SOURCES - cp $< $@ - -srpm: $(TARGET_SRPM) - -$(TARGET_SRPM): $(addprefix _topdir/SOURCES/, $(RPM_SOURCES)) \ - _topdir/SPECS/$(RPM_SPEC) - mkdir -p _topdir/SRPMS - rpmbuild $(RPMBUILD_ARGS) -bs _topdir/SPECS/$(RPM_SPEC) - -rpms: $(TARGET_RPMS) - -# see https://stackoverflow.com/questions/2973445/ for why we subst -# the "rpm" for "%" to effectively turn this into a multiple matching -# target pattern rule -$(subst rpm,%,$(TARGET_RPMS)): \ - $(addprefix _topdir/SOURCES/, $(RPM_SOURCES)) \ - _topdir/SPECS/$(RPM_SPEC) - echo "jenkins_fold:start:Make Agent RPMS" - rm -rf $(addprefix _topdir/, BUILD RPMS) - mkdir -p $(addprefix _topdir/, BUILD $(addprefix RPMS/,noarch x86_64)) - rpmbuild $(RPMBUILD_ARGS) -bb _topdir/SPECS/$(RPM_SPEC) - echo "jenkins_fold:end:Make Agent RPMS" - -build_test: $(TARGET_SRPM) - $${TRAVIS:-false} && echo "travis_fold:start:mock" || true - mock -v $(COMMON_RPMBUILD_ARGS) $< - $${TRAVIS:-false} && echo "travis_fold:end:mock" || true - -# it's not clear yet that we need/want this -#rpm_deps: $(RPM_SPEC) -# spectool -l $(RPM_SPEC) | \ -# sed -e 's/^Source[0-9][0-9]*: \(.*\/\)\(.*\)/\2: ; curl -L -O \1\2/' > $@ -# -#include rpm_deps - -rpmlint: $(RPM_SPEC) - if ! rpmlint $<; then \ - if ! $(RPMLINT_REQUIRED); then \ - echo "rpmlint not required, skipping failure"; \ - else \ - exit 1; \ - fi; \ - fi - -.PHONY: rpms srpm test test_dependencies build_test dist develop \ - all genfiles setuphooks rpmlint - -include include/githooks.mk - -# make a release -tag: - if [ -z "$(TAG)" ]; then \ - echo "Usage: make TAG= tag"; \ - exit 1; \ - fi - make genfiles - if git status --porcelain | grep ^\ M; then \ - echo "You have uncommitted diffs that " \ - "you need to commit before you can tag"; \ - exit 1; \ - fi - git tag $(TAG) diff --git a/include/rpm.mk b/include/rpm.mk deleted file mode 100644 index 70cf2f0..0000000 --- a/include/rpm.mk +++ /dev/null @@ -1,47 +0,0 @@ -RPM_SPEC:= $(NAME).spec - -ifneq ($(REPO),) -VERSION := $(shell repoquery --disablerepo=\* --enablerepo=$(REPO) -q --qf "%{version}" $(NAME) | sed -e 's/.el7//g') -RELEASE := $(shell repoquery --disablerepo=\* --enablerepo=$(REPO) -q --qf "%{release}" $(NAME) | sed -e 's/.el7//g') -else -VERSION := $(shell rpmspec -q --srpm --qf "%{version}\n" $(RPM_SPEC)) -RELEASE := $(shell rpmspec -q --srpm --qf "%{release}\n" $(RPM_SPEC)) -endif - -PACKAGE_VERSION ?= $(VERSION) -PACKAGE_RELEASE ?= $(RELEASE).01 - -TARGET_RPMS = $(NAME)-$(PACKAGE_VERSION)-$(PACKAGE_RELEASE)$(RPM_DIST).noarch.rpm - -include include/rpm-common.mk -include include/copr.mk - -SRPM := $(NAME)-$(VERSION)-$(RELEASE).el7.src.rpm - -$(SRPM): - yumdownloader --disablerepo=\* --enablerepo=$(REPO) --source $(NAME) - -unpack: $(SRPM) - rpm2cpio < $(SRPM) | cpio -iu - -download: $(SRPM) - -$(RPM_SOURCES): - if ! spectool $(RPM_DIST_VERSION_ARG) \ - --define "epel 1" \ - -g $(RPM_SPEC); then \ - echo "Failed to fetch $@."; \ - exit 1; \ - fi - -install_build_deps: - if [ "$(REPO)" = "epel" ]; then \ - if ! rpm -q epel-release; then \ - yum -y install \ - https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm; \ - fi; \ - else \ - echo "Nothing to do"; \ - fi - -.PHONY: unpack download install_build_deps diff --git a/include/travis/copr-deploy.sh b/include/travis/copr-deploy.sh deleted file mode 100755 index 68fd252..0000000 --- a/include/travis/copr-deploy.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/bash -xe - -prepare() { - - # shellcheck disable=SC2154 - openssl aes-256-cbc -K "$encrypted_253525cedcf6_key" -iv "$encrypted_253525cedcf6_iv" -in include/copr-mfl.enc -out include/copr-mfl -d - curl -O https://raw.githubusercontent.com/m3t/travis_wait/master/travis_wait - chmod 755 travis_wait - -} - -build() { - - echo 'travis_fold:start:yum' - yum -y install epel-release - yum -y install rpm-build rpmdevtools copr-cli yum-utils git make python-setuptools npm - echo 'travis_fold:end:yum' - cd "${1:-/build}" - make DRYRUN=false iml_copr_build - -} - -build_srpm() { - echo 'travis_fold:start:yum' - yum -y install epel-release - yum -y install rpm-build rpmdevtools copr-cli yum-utils git make python-setuptools npm - echo 'travis_fold:end:yum' - cd "${1:-/build}" - make DRYRUN=false UNPUBLISHED=true iml_copr_build -} - -# default action to build for backward compatibility -action=${1:-build} - -$action diff --git a/include/travis/mock_build_test.sh b/include/travis/mock_build_test.sh deleted file mode 100755 index e08689d..0000000 --- a/include/travis/mock_build_test.sh +++ /dev/null @@ -1,64 +0,0 @@ -#!/bin/bash -xe - -# allow caller to override MAPPED_DIR, but default if they don't -MAPPED_DIR="${MAPPED_DIR:-/build}" - -echo 'travis_fold:start:yum' -yum -y install git mock rpm-build ed sudo make rpmdevtools rpmlint -echo 'travis_fold:end:yum' - -# edit per the module if specified -if [ -f mock-default.cfg.ed ]; then - cp /etc/mock/default.cfg{,.orig} - ed /etc/mock/default.cfg < mock-default.cfg.ed - diff -u /etc/mock/default.cfg{.orig,} || true -fi - -# add our repos to the mock configuration -ed <<"EOF" /etc/mock/default.cfg -$i - -[copr-be.cloud.fedoraproject.org_results_managerforlustre_manager-for-lustre-devel_epel-7-x86_64_] -name=added from: https://copr-be.cloud.fedoraproject.org/results/managerforlustre/manager-for-lustre-devel/epel-7-x86_64/ -baseurl=https://copr-be.cloud.fedoraproject.org/results/managerforlustre/manager-for-lustre-devel/epel-7-x86_64/ -enabled=1 -. -wq -EOF - -eval export "$(grep -e "^TRAVIS=" -e "^TRAVIS_EVENT_TYPE=" "$MAPPED_DIR"/travis_env)" - -if [ "$TRAVIS_EVENT_TYPE" = "push" ]; then - eval export "$(grep -e "^TRAVIS_BRANCH=" "$MAPPED_DIR"/travis_env)" - TEST_BRANCH="$TRAVIS_BRANCH" -elif [ "$TRAVIS_EVENT_TYPE" = "pull_request" ]; then - eval export "$(grep -e "^TRAVIS_PULL_REQUEST_BRANCH=" \ - "$MAPPED_DIR"/travis_env)" - TEST_BRANCH="$TRAVIS_PULL_REQUEST_BRANCH" -else - echo "Don't know how to handle TRAVIS_EVENT_TYPE $TRAVIS_EVENT_TYPE." - exit 1 -fi - -groupadd --gid "$(stat -c '%g' "$MAPPED_DIR")" mocker -useradd --uid "$(stat -c '%u' "$MAPPED_DIR")" --gid "$(stat -c '%g' "$MAPPED_DIR")" mocker -usermod -a -G mock mocker - -pushd "$MAPPED_DIR" -make install_build_deps -popd - -if ! su - mocker < travis_env - -# Run tests in Container -docker run --privileged -d -i -e "container=docker" -v /sys/fs/cgroup:/sys/fs/cgroup -v "$(pwd)":"$MAPPED_DIR":rw centos:centos7 /usr/sbin/init -DOCKER_CONTAINER_ID=$(docker ps | grep centos | awk 'NR==1{print $1}') -trap 'set -x -docker stop "$DOCKER_CONTAINER_ID" -docker rm -v "$DOCKER_CONTAINER_ID"' EXIT -docker logs "$DOCKER_CONTAINER_ID" -docker exec -i "$DOCKER_CONTAINER_ID" /bin/bash -xec "cd $MAPPED_DIR; $*" -docker ps -a diff --git a/include/travis/virus-scan.sh b/include/travis/virus-scan.sh deleted file mode 100755 index d3d6f1c..0000000 --- a/include/travis/virus-scan.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash -xe - -sudo apt-get install clamav -y -sudo freshclam -clamscan --quiet -r ./ diff --git a/python-iml-agent.spec.in b/python-iml-agent.spec similarity index 95% rename from python-iml-agent.spec.in rename to python-iml-agent.spec index cd4621d..a64e427 100644 --- a/python-iml-agent.spec.in +++ b/python-iml-agent.spec @@ -4,8 +4,8 @@ BuildRequires: systemd %define unit_name chroma-agent.service %global pypi_name iml-agent -%{?!version: %global version @VERSION@} -%{?!package_release: %global package_release @RELEASE@} +%{?!version: %global version 4.1.2} +%{?!package_release: %global package_release 1} %{?!python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; import sys; sys.stdout.write(get_python_lib())")} %{?dist_version: %global source https://github.com/whamcloud/%{pypi_name}/archive/%{dist_version}.tar.gz} @@ -29,7 +29,7 @@ Group: Development/Libraries BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot Prefix: %{_prefix} BuildArch: noarch -Vendor: whamCloud +Vendor: Whamcloud BuildRequires: python2-setuptools BuildRequires: systemd @@ -174,8 +174,11 @@ grubby --set-default=/boot/vmlinuz-$MOST_RECENT_KERNEL_VERSION %defattr(-,root,root) %changelog +* Mon Jan 7 2019 Joe Grund - 4.1.2.0-1 +- Use Docker copr image instead of module-tools + * Mon Jul 16 2018 Joe Grund - 4.1.1.0-1 -Remove old package update scan from this project. +- Remove old package update scan from this project. * Fri Dec 1 2017 Brian J. Murrell - 4.0.5.0-1 - Initial module