forked from gofed/gofed
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gofed.spec
164 lines (144 loc) · 5.35 KB
/
gofed.spec
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
%define copying() \
%if 0%{?fedora} >= 21 || 0%{?rhel} >= 7 \
%license %{*} \
%else \
%doc %{*} \
%endif
%global _dwz_low_mem_die_limit 0
%global provider github
%global provider_tld com
%global project ingvagabund
%global repo gofed
%global provider_prefix %{provider}.%{provider_tld}/%{project}/%{repo}
%global commit 2a3a173bd9c964efa848d6563b2aebe0f68d7e58
%global shortcommit %(c=%{commit}; echo ${c:0:7})
Name: gofed
Version: 0.0.8
Release: 0.1.git%{shortcommit}%{?dist}
Summary: Tool for development of golang devel packages
License: GPLv2+
URL: https://github.com/%{project}/%{repo}
Source0: https://github.com/%{project}/%{repo}/archive/%{commit}/%{repo}-%{shortcommit}.tar.gz
ExclusiveArch: %{ix86} x86_64 %{arm}
BuildRequires: golang, python >= 2.7.5, python-lxml
Requires: python >= 2.7.5, bash, wget, rpmdevtools, rpmlint
Requires: fedpkg, koji, coreutils, rpm-build, openssh-clients, tar
Requires: bash-completion
Requires: python-lxml
%description
Tool to automize packaging of golang devel source codes.
The main goal is to automatize packaging, i.e. provide spec file generators,
discovery of tests, imported and provided packages,
check of up-to-date state of dependencies,
preparation of review and
check of spec file (gofed lint).
%package scan
Summary: Set of commands for scanning golang projects
Requires: %{name} = %{version}-%{release}
Requires: graphviz
BuildArch: noarch
%description scan
Subpackage providing commands for scanning of golang project, i.e.
comparison of APIs of two golang projects,
generator of xml files representing exported symbols and
scan of golang packages and generator of dependency graph.
%package build
Summary: Set of commands for building golang projects
Requires: %{name} = %{version}-%{release}
BuildArch: noarch
%description build
Subpackage providing commands for scratch builds, builds,
pulls, pushes, updates, overrides and other commands
that can be used for package maitainance.
The commands support running one command on multiple branches at once.
%prep
%setup -q -n %{repo}-%{commit}
%build
function gobuild { go build -a -ldflags "-B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \n')" -v -x "$@"; }
gobuild parseGo.go
%install
# copy plugins
mkdir -p %{buildroot}/usr/share/%{name}/plugins
cp -pav plugins/*.json %{buildroot}/usr/share/%{name}/plugins
# copy bash completition
mkdir -p %{buildroot}%{_sysconfdir}/bash_completion.d/
python ./gen_bash_completion.py %{name} %{buildroot}/usr/share/%{name}/plugins "%{_sysconfdir}/bash_completion.d" plugins > %{buildroot}%{_sysconfdir}/bash_completion.d/%{name}
cp -pav plugins/*_bash_completion %{buildroot}%{_sysconfdir}/bash_completion.d/.
# copy man page
mkdir -p %{buildroot}%{_mandir}/man1
cp man/gofed-help.1 %{buildroot}/%{_mandir}/man1/gofed.1
# copy scripts
mkdir -p %{buildroot}/usr/share/%{name}
cp *.py %{buildroot}/usr/share/%{name}/.
cp -r modules %{buildroot}/usr/share/%{name}/.
cp parseGo %{buildroot}/usr/share/%{name}/.
# copy config
mkdir -p %{buildroot}%{_sysconfdir}/
cp config/gofed.conf %{buildroot}%{_sysconfdir}/.
# copy the tool script
cp %{name} %{buildroot}/usr/share/%{name}/.
# directory for local database
mkdir -p %{buildroot}%{_sharedstatedir}/%{name}
install -m 755 -d %{buildroot}/%{_sharedstatedir}/%{name}
install -m 755 -d %{buildroot}/usr/bin
# copy golang list and native imports
cp -r data %{buildroot}%{_sharedstatedir}/%{name}/.
ln -s /usr/share/%{name}/%{name} %{buildroot}/usr/bin/%{name}
# symlinks
cp build gcp pull push scratch-build update bbobranches %{buildroot}/usr/share/%{name}/.
# create directory for local repositories
install -m 0755 -d %{buildroot}%{_sharedstatedir}/%{name}/packages
%pre
getent group gofed >/dev/null || groupadd -r gofed
getent passwd gofed >/dev/null || useradd -r -g gofed -d / -s /sbin/nologin \
-c "Gofed user" gofed
%files
%copying LICENSE
%doc *.md
%config(noreplace) /etc/gofed.conf
%{_sysconfdir}/bash_completion.d/%{name}
%{_sysconfdir}/bash_completion.d/gofed-base_bash_completion
%attr(0775, -, gofed) %{_sharedstatedir}/%{name}/packages
/usr/share/%{name}/plugins/gofed-base.json
/usr/share/%{name}/modules
/usr/share/%{name}/*.py*
/usr/share/%{name}/bbobranches
/usr/share/%{name}/build
/usr/share/%{name}/gcp
/usr/share/%{name}/gofed
/usr/share/%{name}/parseGo
/usr/share/%{name}/pull
/usr/share/%{name}/push
/usr/share/%{name}/scratch-build
/usr/share/%{name}/update
%{_mandir}/man1/gofed.1.gz
%{_sharedstatedir}/%{name}/data/golang.*
%{_sharedstatedir}/%{name}/data/repo.hints
/usr/bin/%{name}
%files scan
%{_sysconfdir}/bash_completion.d/gofed-scan_bash_completion
%{_sharedstatedir}/%{name}/data/pkgdb
%{_sharedstatedir}/%{name}/data/im_pr.packages
/usr/share/%{name}/plugins/gofed-scan.json
%files build
%{_sysconfdir}/bash_completion.d/gofed-build_bash_completion
/usr/share/%{name}/plugins/gofed-build.json
%check
export GOFED_TEST_CONFIG_FILE="1"
function gofed { %{buildroot}/usr/share/%{name}/%{name} "$@" --dry; }
gofed scratch-build
gofed build
gofed pull
gofed push
gofed update
gofed gcpmaster
gofed tools --git-reset
gofed tools --bbo --dry test
gofed tools --bbo --wait --dry test
gofed tools --waitbbo --dry test
gofed wizard --scratch --dry
%changelog
* Thu Aug 20 2015 jchaloup <jchaloup@redhat.com> - 0.0.8-0.1.git2a3a173
- Bump to upstream 2a3a173bd9c964efa848d6563b2aebe0f68d7e58
* Sat Jul 11 2015 jchaloup <jchaloup@redhat.com> - 0.0.5-0.1.giteb25be8
- Initial commit for Fedora