Commit 3637aa12 authored by Alex Iribarren's avatar Alex Iribarren
Browse files

Initial import

parents
Pipeline #1157514 passed with stages
in 5 minutes and 17 seconds
build/
*.tgz
---
variables:
KOJICI_USER: 'kojici'
KOJI_TAG: 'mytag'
BUILD_7: 'True'
BUILD_6: 'True'
# DO NOT MODIFY THIS
include: 'https://gitlab.cern.ch/linuxsupport/rpmci/raw/master/rpm-ci.yml'
# DO NOT MODIFY THIS
SPECFILE = $(shell find -maxdepth 1 -type f -name *.spec)
SPECFILE_NAME = $(shell awk '$$1 == "Name:" { print $$2 }' $(SPECFILE) )
SPECFILE_VERSION = $(shell awk '$$1 == "Version:" { print $$2 }' $(SPECFILE) )
SPECFILE_RELEASE = $(shell awk '$$1 == "Release:" { print $$2 }' $(SPECFILE) )
TARFILE = $(SPECFILE_NAME)-$(SPECFILE_VERSION).tgz
DIST ?= $(shell rpm --eval %{dist})
sources:
tar -zcvf $(TARFILE) --exclude-vcs --transform 's,^,$(SPECFILE_NAME)-$(SPECFILE_VERSION)/,' src/*
clean:
rm -rf build/ $(TARFILE)
rpm: sources
rpmbuild -bb --define 'dist $(DIST)' --define "_topdir $(PWD)/build" --define '_sourcedir $(PWD)' $(SPECFILE)
srpm: sources
rpmbuild -bs --define 'dist $(DIST)' --define "_topdir $(PWD)/build" --define '_sourcedir $(PWD)' $(SPECFILE)
Name: myrpm
Version: 1.1
Release: 1%{?dist}
Summary: Super useful program
Group: CERN/Utilities
License: CERN
URL: https://cern.ch/myrpm
Source: %{name}-%{version}.tgz
BuildRequires: gcc-c++
%define debug_package %{nil}
%description
Just try to live without this
%prep
%setup -n %{name}-%{version}
%build
rm -rf %{buildroot}
cd src/
g++ -Wall -o hello-world hello-world.cpp
%install
install -d %{buildroot}%{_bindir}
cd src/
install -m 0755 hello-world %{buildroot}%{_bindir}/hello-world
%files
%defattr(-,root,root,-)
%{_bindir}/hello-world
%doc src/README.md
%changelog
* Fri Oct 11 2019 Alex Iribarren <Alex.Iribarren@cern.ch> - 1.0-1
- Initial version
#include <stdio.h>
int main(int argc, char *argv[]) {
char *sal = (char *)"World";
if (argc>1) sal = argv[1];
printf("Hello, %s!\n", sal);
return 0;
}
\ No newline at end of file
require 'rake'
require 'rspec/core/rake_task'
task :spec => 'spec:all'
task :default => :spec
namespace :spec do
targets = []
Dir.glob('./spec/*').each do |dir|
next unless File.directory?(dir)
target = File.basename(dir)
target = "_#{target}" if target == "default"
targets << target
end
task :all => targets
task :default => :all
targets.each do |target|
original_target = target == "_default" ? target[1..-1] : target
desc "Run serverspec tests to #{original_target}"
RSpec::Core::RakeTask.new(target.to_sym) do |t|
ENV['TARGET_HOST'] = original_target
t.pattern = "spec/#{original_target}/*_spec.rb"
end
end
end
require 'spec_helper'
describe package('myrpm') do
it { should be_installed }
end
describe file('/usr/bin/hello-world') do
it { should exist }
it { should be_file }
it { should be_executable }
it { should be_owned_by 'root' }
it { should be_mode 755 }
end
describe command('/usr/bin/hello-world') do
its(:stdout) { should match /Hello, World!/ }
end
describe command('/usr/bin/hello-world handsome') do
its(:stdout) { should match /Hello, handsome!/ }
end
require 'serverspec'
set :backend, :exec
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment