akabei 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,71 @@
1
+ module Akabei
2
+ module Omakase
3
+ class S3
4
+ def initialize(aws_config, shell)
5
+ if aws_config
6
+ require 'aws-sdk'
7
+ @bucket = AWS::S3.new(
8
+ access_key_id: aws_config['access_key_id'],
9
+ secret_access_key: aws_config['secret_access_key'],
10
+ region: aws_config['region'],
11
+ ).buckets[aws_config['bucket']]
12
+ @write_options = aws_config['write_options']
13
+ @shell = shell
14
+ end
15
+ end
16
+
17
+ def before!(config, arch)
18
+ download_repository(config, arch) if @bucket
19
+ end
20
+
21
+ def after!(config, arch, packages)
22
+ upload_repository(config, arch, packages) if @bucket
23
+ end
24
+
25
+ def download_repository(config, arch)
26
+ get(config.db_path(arch))
27
+ if config.repo_signer
28
+ get(Pathname.new("#{config.db_path(arch)}.sig"))
29
+ end
30
+ get(config.files_path(arch))
31
+ get(config.abs_path(arch))
32
+ end
33
+
34
+ def get(path)
35
+ @shell.say("Download #{path}", :blue)
36
+ path.open('wb') do |f|
37
+ @bucket.objects[path.to_s].read do |chunk|
38
+ f.write(chunk)
39
+ end
40
+ end
41
+ rescue AWS::S3::Errors::NoSuchKey
42
+ @shell.say("S3: #{path} not found", :red)
43
+ FileUtils.rm_f(path)
44
+ end
45
+
46
+ SIG_MIME_TYPE = 'application/pgp-signature'
47
+ GZIP_MIME_TYPE = 'application/gzip'
48
+ XZ_MIME_TYPE = 'application/x-xz'
49
+
50
+ def upload_repository(config, arch, packages)
51
+ packages.each do |package|
52
+ put(package.path, XZ_MIME_TYPE)
53
+ if config.package_signer
54
+ put(Pathname.new("#{package.path}.sig"), SIG_MIME_TYPE)
55
+ end
56
+ end
57
+ put(config.abs_path(arch), GZIP_MIME_TYPE)
58
+ put(config.files_path(arch), GZIP_MIME_TYPE)
59
+ put(config.db_path(arch), GZIP_MIME_TYPE)
60
+ if config.repo_signer
61
+ put(Pathname.new("#{config.db_path(arch)}.sig"), SIG_MIME_TYPE)
62
+ end
63
+ end
64
+
65
+ def put(path, mime_type)
66
+ @shell.say("Upload #{path}", :green)
67
+ @bucket.objects[path.to_s].write(path, @write_options.merge(content_type: mime_type))
68
+ end
69
+ end
70
+ end
71
+ end
@@ -0,0 +1,24 @@
1
+ ---
2
+ name: <%= @name %>
3
+ package_key: <%= options[:package_key] %>
4
+ repo_key: <%= options[:repo_key] %>
5
+ srcdest: sources
6
+ logdest: logs
7
+ pkgbuild: PKGBUILDs
8
+ builds:
9
+ <%- @archs.each do |arch| -%>
10
+ <%= arch %>:
11
+ makepkg: etc/makepkg.<%= arch %>.conf
12
+ pacman: etc/pacman.<%= arch %>.conf
13
+ <%- end -%>
14
+ s3:
15
+ <%- if options[:s3] -%>
16
+ access_key_id:
17
+ secret_access_key:
18
+ bucket:
19
+ region:
20
+ write_options:
21
+ # :acl: :public_read
22
+ # :reduced_redundancy: false
23
+ # :server_side_encryption: :aes256
24
+ <%- end -%>
@@ -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="i686"
27
+ CHOST="i686-pc-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=i686 -mtune=generic -O2 -pipe -fstack-protector --param=ssp-buffer-size=4"
34
+ CXXFLAGS="-march=i686 -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:
@@ -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:
@@ -0,0 +1,90 @@
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
+ # An example of a custom package repository. See the pacman manpage for
87
+ # tips on creating your own repositories.
88
+ #[custom]
89
+ #SigLevel = Optional TrustAll
90
+ #Server = file:///home/custompkgs