akabei 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/.rspec +2 -0
- data/.travis.yml +10 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +55 -0
- data/Rakefile +14 -0
- data/akabei.gemspec +29 -0
- data/bin/akabei +9 -0
- data/lib/akabei.rb +5 -0
- data/lib/akabei/abs.rb +60 -0
- data/lib/akabei/archive_utils.rb +75 -0
- data/lib/akabei/attr_path.rb +20 -0
- data/lib/akabei/builder.rb +108 -0
- data/lib/akabei/chroot_tree.rb +81 -0
- data/lib/akabei/cli.rb +172 -0
- data/lib/akabei/error.rb +4 -0
- data/lib/akabei/package.rb +174 -0
- data/lib/akabei/package_entry.rb +110 -0
- data/lib/akabei/package_info.rb +68 -0
- data/lib/akabei/repository.rb +156 -0
- data/lib/akabei/signer.rb +75 -0
- data/lib/akabei/thor_handler.rb +14 -0
- data/lib/akabei/version.rb +3 -0
- data/spec/akabei/abs_spec.rb +95 -0
- data/spec/akabei/archive_utils_spec.rb +44 -0
- data/spec/akabei/builder_spec.rb +129 -0
- data/spec/akabei/chroot_tree_spec.rb +108 -0
- data/spec/akabei/cli_spec.rb +5 -0
- data/spec/akabei/package_entry_spec.rb +70 -0
- data/spec/akabei/package_info_spec.rb +17 -0
- data/spec/akabei/package_spec.rb +54 -0
- data/spec/akabei/repository_spec.rb +157 -0
- data/spec/akabei/signer_spec.rb +5 -0
- data/spec/data/input/abs.tar.gz +0 -0
- data/spec/data/input/htop-vi.tar.gz +0 -0
- data/spec/data/input/makepkg.x86_64.conf +140 -0
- data/spec/data/input/nkf-2.1.3-1-x86_64.pkg.tar.xz +0 -0
- data/spec/data/input/nkf.PKGINFO +22 -0
- data/spec/data/input/nkf.tar.gz +0 -0
- data/spec/data/input/pacman.x86_64.conf +99 -0
- data/spec/data/input/ruby.PKGINFO +38 -0
- data/spec/data/input/test.db +0 -0
- data/spec/data/input/test.files +0 -0
- data/spec/integration/build_spec.rb +105 -0
- data/spec/spec_helper.rb +110 -0
- metadata +225 -0
Binary file
|
Binary file
|
@@ -0,0 +1,140 @@
|
|
1
|
+
#
|
2
|
+
# /etc/makepkg.conf
|
3
|
+
#
|
4
|
+
|
5
|
+
#########################################################################
|
6
|
+
# SOURCE ACQUISITION
|
7
|
+
#########################################################################
|
8
|
+
#
|
9
|
+
#-- The download utilities that makepkg should use to acquire sources
|
10
|
+
# Format: 'protocol::agent'
|
11
|
+
DLAGENTS=('ftp::/usr/bin/curl -fC - --ftp-pasv --retry 3 --retry-delay 3 -o %o %u'
|
12
|
+
'http::/usr/bin/curl -fLC - --retry 3 --retry-delay 3 -o %o %u'
|
13
|
+
'https::/usr/bin/curl -fLC - --retry 3 --retry-delay 3 -o %o %u'
|
14
|
+
'rsync::/usr/bin/rsync --no-motd -z %u %o'
|
15
|
+
'scp::/usr/bin/scp -C %u %o')
|
16
|
+
|
17
|
+
# Other common tools:
|
18
|
+
# /usr/bin/snarf
|
19
|
+
# /usr/bin/lftpget -c
|
20
|
+
# /usr/bin/wget
|
21
|
+
|
22
|
+
#########################################################################
|
23
|
+
# ARCHITECTURE, COMPILE FLAGS
|
24
|
+
#########################################################################
|
25
|
+
#
|
26
|
+
CARCH="x86_64"
|
27
|
+
CHOST="x86_64-unknown-linux-gnu"
|
28
|
+
|
29
|
+
#-- Compiler and Linker Flags
|
30
|
+
# -march (or -mcpu) builds exclusively for an architecture
|
31
|
+
# -mtune optimizes for an architecture, but builds for whole processor family
|
32
|
+
CPPFLAGS="-D_FORTIFY_SOURCE=2"
|
33
|
+
CFLAGS="-march=x86-64 -mtune=generic -O2 -pipe -fstack-protector --param=ssp-buffer-size=4"
|
34
|
+
CXXFLAGS="-march=x86-64 -mtune=generic -O2 -pipe -fstack-protector --param=ssp-buffer-size=4"
|
35
|
+
LDFLAGS="-Wl,-O1,--sort-common,--as-needed,-z,relro"
|
36
|
+
#-- Make Flags: change this for DistCC/SMP systems
|
37
|
+
#MAKEFLAGS="-j2"
|
38
|
+
#-- Debugging flags
|
39
|
+
DEBUG_CFLAGS="-g -fvar-tracking-assignments"
|
40
|
+
DEBUG_CXXFLAGS="-g -fvar-tracking-assignments"
|
41
|
+
|
42
|
+
#########################################################################
|
43
|
+
# BUILD ENVIRONMENT
|
44
|
+
#########################################################################
|
45
|
+
#
|
46
|
+
# Defaults: BUILDENV=(fakeroot !distcc color !ccache check !sign)
|
47
|
+
# A negated environment option will do the opposite of the comments below.
|
48
|
+
#
|
49
|
+
#-- fakeroot: Allow building packages as a non-root user
|
50
|
+
#-- distcc: Use the Distributed C/C++/ObjC compiler
|
51
|
+
#-- color: Colorize output messages
|
52
|
+
#-- ccache: Use ccache to cache compilation
|
53
|
+
#-- check: Run the check() function if present in the PKGBUILD
|
54
|
+
#-- sign: Generate PGP signature file
|
55
|
+
#
|
56
|
+
BUILDENV=(fakeroot !distcc color !ccache check !sign)
|
57
|
+
#
|
58
|
+
#-- If using DistCC, your MAKEFLAGS will also need modification. In addition,
|
59
|
+
#-- specify a space-delimited list of hosts running in the DistCC cluster.
|
60
|
+
#DISTCC_HOSTS=""
|
61
|
+
#
|
62
|
+
#-- Specify a directory for package building.
|
63
|
+
#BUILDDIR=/tmp/makepkg
|
64
|
+
|
65
|
+
#########################################################################
|
66
|
+
# GLOBAL PACKAGE OPTIONS
|
67
|
+
# These are default values for the options=() settings
|
68
|
+
#########################################################################
|
69
|
+
#
|
70
|
+
# Default: OPTIONS=(strip docs !libtool !staticlibs emptydirs zipman purge !upx !debug)
|
71
|
+
# A negated option will do the opposite of the comments below.
|
72
|
+
#
|
73
|
+
#-- strip: Strip symbols from binaries/libraries
|
74
|
+
#-- docs: Save doc directories specified by DOC_DIRS
|
75
|
+
#-- libtool: Leave libtool (.la) files in packages
|
76
|
+
#-- staticlibs: Leave static library (.a) files in packages
|
77
|
+
#-- emptydirs: Leave empty directories in packages
|
78
|
+
#-- zipman: Compress manual (man and info) pages in MAN_DIRS with gzip
|
79
|
+
#-- purge: Remove files specified by PURGE_TARGETS
|
80
|
+
#-- upx: Compress binary executable files using UPX
|
81
|
+
#-- debug: Add debugging flags as specified in DEBUG_* variables
|
82
|
+
#
|
83
|
+
OPTIONS=(strip docs !libtool !staticlibs emptydirs zipman purge !upx !debug)
|
84
|
+
|
85
|
+
#-- File integrity checks to use. Valid: md5, sha1, sha256, sha384, sha512
|
86
|
+
INTEGRITY_CHECK=(md5)
|
87
|
+
#-- Options to be used when stripping binaries. See `man strip' for details.
|
88
|
+
STRIP_BINARIES="--strip-all"
|
89
|
+
#-- Options to be used when stripping shared libraries. See `man strip' for details.
|
90
|
+
STRIP_SHARED="--strip-unneeded"
|
91
|
+
#-- Options to be used when stripping static libraries. See `man strip' for details.
|
92
|
+
STRIP_STATIC="--strip-debug"
|
93
|
+
#-- Manual (man and info) directories to compress (if zipman is specified)
|
94
|
+
MAN_DIRS=({usr{,/local}{,/share},opt/*}/{man,info})
|
95
|
+
#-- Doc directories to remove (if !docs is specified)
|
96
|
+
DOC_DIRS=(usr/{,local/}{,share/}{doc,gtk-doc} opt/*/{doc,gtk-doc})
|
97
|
+
#-- Files to be removed from all packages (if purge is specified)
|
98
|
+
PURGE_TARGETS=(usr/{,share}/info/dir .packlist *.pod)
|
99
|
+
|
100
|
+
#########################################################################
|
101
|
+
# PACKAGE OUTPUT
|
102
|
+
#########################################################################
|
103
|
+
#
|
104
|
+
# Default: put built package and cached source in build directory
|
105
|
+
#
|
106
|
+
#-- Destination: specify a fixed directory where all packages will be placed
|
107
|
+
#PKGDEST=/home/packages
|
108
|
+
#-- Source cache: specify a fixed directory where source files will be cached
|
109
|
+
#SRCDEST=/home/sources
|
110
|
+
#-- Source packages: specify a fixed directory where all src packages will be placed
|
111
|
+
#SRCPKGDEST=/home/srcpackages
|
112
|
+
#-- Log files: specify a fixed directory where all log files will be placed
|
113
|
+
#LOGDEST=/home/makepkglogs
|
114
|
+
#-- Packager: name/email of the person or organization building packages
|
115
|
+
#PACKAGER="John Doe <john@doe.com>"
|
116
|
+
#-- Specify a key to use for package signing
|
117
|
+
#GPGKEY=""
|
118
|
+
|
119
|
+
#########################################################################
|
120
|
+
# COMPRESSION DEFAULTS
|
121
|
+
#########################################################################
|
122
|
+
#
|
123
|
+
COMPRESSGZ=(gzip -c -f -n)
|
124
|
+
COMPRESSBZ2=(bzip2 -c -f)
|
125
|
+
COMPRESSXZ=(xz -c -z -)
|
126
|
+
COMPRESSLRZ=(lrzip -q)
|
127
|
+
COMPRESSLZO=(lzop -q)
|
128
|
+
COMPRESSZ=(compress -c -f)
|
129
|
+
|
130
|
+
#########################################################################
|
131
|
+
# EXTENSION DEFAULTS
|
132
|
+
#########################################################################
|
133
|
+
#
|
134
|
+
# WARNING: Do NOT modify these variables unless you know what you are
|
135
|
+
# doing.
|
136
|
+
#
|
137
|
+
PKGEXT='.pkg.tar.xz'
|
138
|
+
SRCEXT='.src.tar.gz'
|
139
|
+
|
140
|
+
# vim: set ft=sh ts=2 sw=2 et:
|
Binary file
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# Generated by makepkg 4.1.2
|
2
|
+
# using fakeroot version 1.20
|
3
|
+
# Fri Jan 17 07:28:52 UTC 2014
|
4
|
+
pkgname = nkf
|
5
|
+
pkgver = 2.1.3-1
|
6
|
+
pkgdesc = A yet another kanji code converter among networks, hosts and terminals
|
7
|
+
url = http://sourceforge.jp/projects/nkf/
|
8
|
+
builddate = 1389943732
|
9
|
+
packager = Unknown Packager
|
10
|
+
size = 273408
|
11
|
+
arch = x86_64
|
12
|
+
license = custom:zlib
|
13
|
+
depend = glibc
|
14
|
+
makepkgopt = strip
|
15
|
+
makepkgopt = docs
|
16
|
+
makepkgopt = !libtool
|
17
|
+
makepkgopt = !staticlibs
|
18
|
+
makepkgopt = emptydirs
|
19
|
+
makepkgopt = zipman
|
20
|
+
makepkgopt = purge
|
21
|
+
makepkgopt = !upx
|
22
|
+
makepkgopt = !debug
|
Binary file
|
@@ -0,0 +1,99 @@
|
|
1
|
+
#
|
2
|
+
# /etc/pacman.conf
|
3
|
+
#
|
4
|
+
# See the pacman.conf(5) manpage for option and repository directives
|
5
|
+
|
6
|
+
#
|
7
|
+
# GENERAL OPTIONS
|
8
|
+
#
|
9
|
+
[options]
|
10
|
+
# The following paths are commented out with their default values listed.
|
11
|
+
# If you wish to use different paths, uncomment and update the paths.
|
12
|
+
#RootDir = /
|
13
|
+
#DBPath = /var/lib/pacman/
|
14
|
+
#CacheDir = /var/cache/pacman/pkg/
|
15
|
+
#LogFile = /var/log/pacman.log
|
16
|
+
#GPGDir = /etc/pacman.d/gnupg/
|
17
|
+
HoldPkg = pacman glibc
|
18
|
+
#XferCommand = /usr/bin/curl -C - -f %u > %o
|
19
|
+
#XferCommand = /usr/bin/wget --passive-ftp -c -O %o %u
|
20
|
+
#CleanMethod = KeepInstalled
|
21
|
+
#UseDelta = 0.7
|
22
|
+
Architecture = auto
|
23
|
+
|
24
|
+
# Pacman won't upgrade packages listed in IgnorePkg and members of IgnoreGroup
|
25
|
+
#IgnorePkg =
|
26
|
+
#IgnoreGroup =
|
27
|
+
|
28
|
+
#NoUpgrade =
|
29
|
+
#NoExtract =
|
30
|
+
|
31
|
+
# Misc options
|
32
|
+
#UseSyslog
|
33
|
+
#Color
|
34
|
+
#TotalDownload
|
35
|
+
CheckSpace
|
36
|
+
#VerbosePkgLists
|
37
|
+
|
38
|
+
# By default, pacman accepts packages signed by keys that its local keyring
|
39
|
+
# trusts (see pacman-key and its man page), as well as unsigned packages.
|
40
|
+
SigLevel = Required DatabaseOptional
|
41
|
+
LocalFileSigLevel = Optional
|
42
|
+
#RemoteFileSigLevel = Required
|
43
|
+
|
44
|
+
# NOTE: You must run `pacman-key --init` before first using pacman; the local
|
45
|
+
# keyring can then be populated with the keys of all official Arch Linux
|
46
|
+
# packagers with `pacman-key --populate archlinux`.
|
47
|
+
|
48
|
+
#
|
49
|
+
# REPOSITORIES
|
50
|
+
# - can be defined here or included from another file
|
51
|
+
# - pacman will search repositories in the order defined here
|
52
|
+
# - local/custom mirrors can be added here or in separate files
|
53
|
+
# - repositories listed first will take precedence when packages
|
54
|
+
# have identical names, regardless of version number
|
55
|
+
# - URLs will have $repo replaced by the name of the current repo
|
56
|
+
# - URLs will have $arch replaced by the name of the architecture
|
57
|
+
#
|
58
|
+
# Repository entries are of the format:
|
59
|
+
# [repo-name]
|
60
|
+
# Server = ServerName
|
61
|
+
# Include = IncludePath
|
62
|
+
#
|
63
|
+
# The header [repo-name] is crucial - it must be present and
|
64
|
+
# uncommented to enable the repo.
|
65
|
+
#
|
66
|
+
|
67
|
+
# The testing repositories are disabled by default. To enable, uncomment the
|
68
|
+
# repo name header and Include lines. You can add preferred servers immediately
|
69
|
+
# after the header, and they will be used before the default mirrors.
|
70
|
+
|
71
|
+
#[testing]
|
72
|
+
#Include = /etc/pacman.d/mirrorlist
|
73
|
+
|
74
|
+
[core]
|
75
|
+
Include = /etc/pacman.d/mirrorlist
|
76
|
+
|
77
|
+
[extra]
|
78
|
+
Include = /etc/pacman.d/mirrorlist
|
79
|
+
|
80
|
+
#[community-testing]
|
81
|
+
#Include = /etc/pacman.d/mirrorlist
|
82
|
+
|
83
|
+
[community]
|
84
|
+
Include = /etc/pacman.d/mirrorlist
|
85
|
+
|
86
|
+
# If you want to run 32 bit applications on your x86_64 system,
|
87
|
+
# enable the multilib repositories as required here.
|
88
|
+
|
89
|
+
#[multilib-testing]
|
90
|
+
#Include = /etc/pacman.d/mirrorlist
|
91
|
+
|
92
|
+
#[multilib]
|
93
|
+
#Include = /etc/pacman.d/mirrorlist
|
94
|
+
|
95
|
+
# An example of a custom package repository. See the pacman manpage for
|
96
|
+
# tips on creating your own repositories.
|
97
|
+
#[custom]
|
98
|
+
#SigLevel = Optional TrustAll
|
99
|
+
#Server = file:///home/custompkgs
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# Generated by makepkg 4.1.2
|
2
|
+
# using fakeroot version 1.20
|
3
|
+
# Fri Jan 10 19:12:37 UTC 2014
|
4
|
+
pkgname = ruby
|
5
|
+
pkgbase = ruby
|
6
|
+
pkgver = 2.1.0-2
|
7
|
+
pkgdesc = An object-oriented language for quick and easy programming
|
8
|
+
url = http://www.ruby-lang.org/en/
|
9
|
+
builddate = 1389381157
|
10
|
+
packager = Thomas Dziedzic <gostrc@gmail.com>
|
11
|
+
size = 19100672
|
12
|
+
arch = x86_64
|
13
|
+
license = BSD
|
14
|
+
license = custom
|
15
|
+
conflict = rake
|
16
|
+
provides = rubygems
|
17
|
+
provides = rake
|
18
|
+
backup = etc/gemrc
|
19
|
+
depend = gdbm
|
20
|
+
depend = openssl
|
21
|
+
depend = libffi
|
22
|
+
depend = libyaml
|
23
|
+
optdepend = ruby-docs: Ruby documentation
|
24
|
+
makedepend = gdbm
|
25
|
+
makedepend = openssl
|
26
|
+
makedepend = libffi
|
27
|
+
makedepend = doxygen
|
28
|
+
makedepend = graphviz
|
29
|
+
makedepend = libyaml
|
30
|
+
makepkgopt = strip
|
31
|
+
makepkgopt = docs
|
32
|
+
makepkgopt = !libtool
|
33
|
+
makepkgopt = staticlibs
|
34
|
+
makepkgopt = !emptydirs
|
35
|
+
makepkgopt = zipman
|
36
|
+
makepkgopt = purge
|
37
|
+
makepkgopt = !upx
|
38
|
+
makepkgopt = !debug
|
Binary file
|
Binary file
|
@@ -0,0 +1,105 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'build subcommand', :archlinux do
|
4
|
+
let(:pkg_dir) { test_dest('nkf') }
|
5
|
+
let(:repo_dir) { test_dest('repo').tap(&:mkpath) }
|
6
|
+
let(:base_command) {
|
7
|
+
[
|
8
|
+
'build',
|
9
|
+
'--repo-name', 'test',
|
10
|
+
'--repo-dir', repo_dir.to_s,
|
11
|
+
'--arch', 'x86_64',
|
12
|
+
'--pacman-config', test_input('pacman.x86_64.conf').to_s,
|
13
|
+
'--makepkg-config', test_input('makepkg.x86_64.conf').to_s,
|
14
|
+
pkg_dir.to_s,
|
15
|
+
]
|
16
|
+
}
|
17
|
+
|
18
|
+
before do
|
19
|
+
tar('xf', test_input('nkf.tar.gz').to_s, '-C', pkg_dir.parent.to_s)
|
20
|
+
end
|
21
|
+
|
22
|
+
context 'with new repository' do
|
23
|
+
it 'creates a new package and repository database with files' do
|
24
|
+
expect(akabei(*base_command)).to eq(true)
|
25
|
+
|
26
|
+
db_path = repo_dir.join('test.db')
|
27
|
+
expect(db_path).to be_file
|
28
|
+
db_files = tar('tf', db_path.to_s)
|
29
|
+
expect(db_files).to include('nkf-2.1.3-1/desc')
|
30
|
+
expect(db_files).not_to include('nkf-2.1.3-1/files')
|
31
|
+
|
32
|
+
files_path = repo_dir.join('test.files')
|
33
|
+
expect(files_path).to be_file
|
34
|
+
files_files = tar('tf', files_path.to_s)
|
35
|
+
expect(files_files).to include('nkf-2.1.3-1/desc')
|
36
|
+
expect(files_files).to include('nkf-2.1.3-1/files')
|
37
|
+
|
38
|
+
pkg_path = repo_dir.join('nkf-2.1.3-1-x86_64.pkg.tar.xz')
|
39
|
+
expect(pkg_path).to be_file
|
40
|
+
expect(tar('tf', pkg_path.to_s)).to include('usr/bin/nkf')
|
41
|
+
|
42
|
+
abs_path = repo_dir.join('test.abs.tar.gz')
|
43
|
+
expect(abs_path).to be_file
|
44
|
+
expect(tar('tf', abs_path.to_s)).to include('test/nkf/PKGBUILD')
|
45
|
+
end
|
46
|
+
|
47
|
+
context 'with --srcdest' do
|
48
|
+
let(:srcdest) { test_dest('sources').tap(&:mkpath) }
|
49
|
+
let(:build_command) { base_command + ['--srcdest', srcdest.to_s] }
|
50
|
+
|
51
|
+
it 'stores sources' do
|
52
|
+
expect(akabei(*build_command)).to eq(true)
|
53
|
+
expect(srcdest.join('nkf-2.1.3.tar.gz')).to be_file
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
context 'with --logdest' do
|
58
|
+
let(:logdest) { test_dest('logs').tap(&:mkpath) }
|
59
|
+
let(:build_command) { base_command + ['--logdest', logdest.to_s] }
|
60
|
+
|
61
|
+
it 'stores logs' do
|
62
|
+
expect(akabei(*build_command)).to eq(true)
|
63
|
+
expect(logdest.join('nkf-2.1.3-1-x86_64-build.log')).to be_file
|
64
|
+
expect(logdest.join('nkf-2.1.3-1-x86_64-package.log')).to be_file
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
context 'with existing repository' do
|
70
|
+
let(:db_path) { repo_dir.join('test.db') }
|
71
|
+
let(:files_path) { repo_dir.join('test.files') }
|
72
|
+
let(:abs_path) { repo_dir.join('test.abs.tar.gz') }
|
73
|
+
|
74
|
+
before do
|
75
|
+
FileUtils.cp(test_input('test.db'), db_path)
|
76
|
+
FileUtils.cp(test_input('test.files'), files_path)
|
77
|
+
FileUtils.cp(test_input('abs.tar.gz'), abs_path)
|
78
|
+
end
|
79
|
+
|
80
|
+
it 'adds a new package' do
|
81
|
+
expect(akabei(*base_command)).to eq(true)
|
82
|
+
|
83
|
+
expect(db_path).to be_file
|
84
|
+
db_files = tar('tf', db_path.to_s)
|
85
|
+
expect(db_files).to include('htop-vi-1.0.2-4/desc')
|
86
|
+
expect(db_files).to include('nkf-2.1.3-1/depends')
|
87
|
+
expect(db_files).not_to include('nkf-2.1.3-1/files')
|
88
|
+
|
89
|
+
expect(files_path).to be_file
|
90
|
+
files_files = tar('tf', files_path.to_s)
|
91
|
+
expect(files_files).to include('htop-vi-1.0.2-4/desc')
|
92
|
+
expect(files_files).to include('nkf-2.1.3-1/depends')
|
93
|
+
expect(files_files).to include('htop-vi-1.0.2-4/files')
|
94
|
+
expect(files_files).to include('nkf-2.1.3-1/files')
|
95
|
+
d = test_dest('files-dest').tap(&:mkpath)
|
96
|
+
tar('xf', files_path.to_s, '-C', d.to_s)
|
97
|
+
expect(d.join('nkf-2.1.3-1', 'files').read).to include('usr/bin/nkf')
|
98
|
+
|
99
|
+
expect(abs_path).to be_file
|
100
|
+
abs_files = tar('tf', abs_path.to_s)
|
101
|
+
expect(abs_files).to include('test/htop-vi/PKGBUILD')
|
102
|
+
expect(abs_files).to include('test/nkf/PKGBUILD')
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,110 @@
|
|
1
|
+
# This file was generated by the `rspec --init` command. Conventionally, all
|
2
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
3
|
+
# Require this file using `require "spec_helper"` to ensure that it is only
|
4
|
+
# loaded once.
|
5
|
+
#
|
6
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
7
|
+
|
8
|
+
require 'coveralls'
|
9
|
+
require 'pathname'
|
10
|
+
require 'simplecov'
|
11
|
+
|
12
|
+
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
|
13
|
+
SimpleCov::Formatter::HTMLFormatter,
|
14
|
+
Coveralls::SimpleCov::Formatter,
|
15
|
+
]
|
16
|
+
SimpleCov.start do
|
17
|
+
add_filter Bundler.bundle_path.to_s
|
18
|
+
add_filter File.dirname(__FILE__)
|
19
|
+
end
|
20
|
+
|
21
|
+
module TestDataHelpers
|
22
|
+
ROOT = Pathname.new(__FILE__).parent.join('data')
|
23
|
+
INPUT_ROOT = ROOT.join('input')
|
24
|
+
DEST_ROOT = ROOT.join('dest')
|
25
|
+
|
26
|
+
def test_input(path)
|
27
|
+
INPUT_ROOT.join(path)
|
28
|
+
end
|
29
|
+
|
30
|
+
def test_dest(path)
|
31
|
+
DEST_ROOT.join(path)
|
32
|
+
end
|
33
|
+
|
34
|
+
def self.prepare_dest
|
35
|
+
DEST_ROOT.mkpath
|
36
|
+
end
|
37
|
+
|
38
|
+
def self.clean_dest
|
39
|
+
DEST_ROOT.rmtree
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
module OutputHelpers
|
44
|
+
def capture_stdout(&block)
|
45
|
+
orig = $stdout
|
46
|
+
stdout = StringIO.new
|
47
|
+
$stdout = stdout
|
48
|
+
block.call
|
49
|
+
stdout.string
|
50
|
+
ensure
|
51
|
+
$stdout = orig
|
52
|
+
end
|
53
|
+
|
54
|
+
def capture_stderr(&block)
|
55
|
+
orig = $stdout
|
56
|
+
stderr = StringIO.new
|
57
|
+
$stderr = stderr
|
58
|
+
block.call
|
59
|
+
stderr.string
|
60
|
+
ensure
|
61
|
+
$stderr = orig
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
require 'open3'
|
66
|
+
module TarHelpers
|
67
|
+
def tar(*args)
|
68
|
+
cmd = ['tar'] + args
|
69
|
+
out, status = Open3.capture2(*cmd)
|
70
|
+
if status.success?
|
71
|
+
out.each_line.map(&:chomp)
|
72
|
+
else
|
73
|
+
raise "capture2 failed: #{status}: #{cmd.join(' ')}"
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
module IntegrationSpecHelper
|
79
|
+
def akabei(*cmd)
|
80
|
+
system(File.expand_path('../../bin/akabei', __FILE__), *cmd)
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
RSpec.configure do |config|
|
85
|
+
config.filter_run :focus
|
86
|
+
if ENV['AKABEI_ARCH_SPEC']
|
87
|
+
config.filter_run_including :archlinux
|
88
|
+
else
|
89
|
+
config.filter_run_excluding :archlinux
|
90
|
+
end
|
91
|
+
config.run_all_when_everything_filtered = true
|
92
|
+
|
93
|
+
# Run specs in random order to surface order dependencies. If you find an
|
94
|
+
# order dependency and want to debug it, you can fix the order by providing
|
95
|
+
# the seed, which is printed after each run.
|
96
|
+
# --seed 1234
|
97
|
+
config.order = 'random'
|
98
|
+
|
99
|
+
config.include TestDataHelpers
|
100
|
+
config.before(:each) do
|
101
|
+
TestDataHelpers.prepare_dest
|
102
|
+
end
|
103
|
+
config.after(:each) do
|
104
|
+
TestDataHelpers.clean_dest
|
105
|
+
end
|
106
|
+
|
107
|
+
config.include OutputHelpers
|
108
|
+
config.include TarHelpers
|
109
|
+
config.include IntegrationSpecHelper
|
110
|
+
end
|