Sophie

Sophie

distrib > Mageia > 7 > x86_64 > by-pkgid > 871dd45f69e4cb9d75b4d11aab793c31 > files > 5

mongo-tools-4.1.4-1.mga7.src.rpm

%global with_devel 1
%global with_bundled 1
%global with_debug 0

%if 0%{?with_debug}
# https://bugzilla.redhat.com/show_bug.cgi?id=995136#c12
%global _dwz_low_mem_die_limit 0
%else
%global debug_package   %{nil}
%endif
%global provider        github
%global provider_tld    com
%global project         mongodb
%global repo            mongo-tools
# https://github.com/mongodb/mongo-tools
%global import_path     %{provider}.%{provider_tld}/%{project}/%{repo}
%global commit          d6c691f3ed621e087db9f064c5ca872fbb7096ca
%global shortcommit     %(c=%{commit}; echo ${c:0:7})

# Git hash in https://github.com/mongodb/mongo which corresponds to Version
%global mongohash 2f4b5918497b09a226a3ec5dcff930edd52ea1e9

Name:           %{repo}
# DO NOT USE LATER VERSIONS
# 4.1.4 is the last version which was AGPL3.  Later versions are SSPL
# which has been deemed to be a non-free license.
Version:        4.1.4
Release:        %mkrel 1
Summary:        MongoDB Tools
License:        ASL 2.0
Group:          Databases
URL:            https://%{import_path}
Source0:        https://%{import_path}/archive/%{commit}/%{repo}-%{shortcommit}.tar.gz
# Mongo-tools does not contain man files yet
# - see https://groups.google.com/forum/#!topic/mongodb-dev/t6Sd2Bki12I
Source1:        https://github.com/mongodb/mongo/raw/%{mongohash}/debian/bsondump.1
Source2:        https://github.com/mongodb/mongo/raw/%{mongohash}/debian/mongodump.1
Source3:        https://github.com/mongodb/mongo/raw/%{mongohash}/debian/mongoexport.1
Source4:        https://github.com/mongodb/mongo/raw/%{mongohash}/debian/mongofiles.1
Source5:        https://github.com/mongodb/mongo/raw/%{mongohash}/debian/mongoimport.1
Source7:        https://github.com/mongodb/mongo/raw/%{mongohash}/debian/mongorestore.1
Source8:        https://github.com/mongodb/mongo/raw/%{mongohash}/debian/mongostat.1
Source9:        https://github.com/mongodb/mongo/raw/%{mongohash}/debian/mongotop.1
Source10:       https://github.com/mongodb/mongo/raw/%{mongohash}/APACHE-2.0.txt
Patch0:         change-import-path.patch
%if ! 0%{?with_bundled}
BuildRequires:  golang >= 1.2.1-3
BuildRequires:  golang(github.com/howeyc/gopass)
BuildRequires:  golang(github.com/jessevdk/go-flags)
BuildRequires:  golang(github.com/smartystreets/goconvey/convey)
BuildRequires:  golang(github.com/10gen/openssl)
BuildRequires:  golang(golang.org/x/crypto/ssh/terminal)
BuildRequires:  golang(gopkg.in/mgo.v2)
BuildRequires:  golang(gopkg.in/mgo.v2/bson)
BuildRequires:  golang(gopkg.in/tomb.v2)
%endif

Conflicts:      mongodb < 3.0.0

%description
The MongoDB tools provides import, export, and diagnostic capabilities.

%if 0%{?with_devel}
%package devel
Summary:       %{summary}

BuildRequires: golang >= 1.2.1-3
BuildRequires: golang(github.com/howeyc/gopass)
BuildRequires: golang(github.com/jessevdk/go-flags)
BuildRequires: golang(github.com/smartystreets/goconvey/convey)
BuildRequires: golang(github.com/10gen/openssl)
BuildRequires: golang(golang.org/x/crypto/ssh/terminal)
BuildRequires: golang(gopkg.in/mgo.v2)
BuildRequires: golang(gopkg.in/mgo.v2/bson)
BuildRequires: golang(gopkg.in/tomb.v2)

Requires:      golang(github.com/howeyc/gopass)
Requires:      golang(github.com/jessevdk/go-flags)
Requires:      golang(github.com/smartystreets/goconvey/convey)
Requires:      golang(github.com/10gen/openssl)
Requires:      golang(golang.org/x/crypto/ssh/terminal)
Requires:      golang(gopkg.in/mgo.v2)
Requires:      golang(gopkg.in/mgo.v2/bson)
Requires:      golang(gopkg.in/tomb.v2)

Provides:      golang(%{import_path}/bsondump) = %{version}-%{release}
Provides:      golang(%{import_path}/common) = %{version}-%{release}
Provides:      golang(%{import_path}/common/archive) = %{version}-%{release}
Provides:      golang(%{import_path}/common/auth) = %{version}-%{release}
Provides:      golang(%{import_path}/common/bsonutil) = %{version}-%{release}
Provides:      golang(%{import_path}/common/db) = %{version}-%{release}
Provides:      golang(%{import_path}/common/db/kerberos) = %{version}-%{release}
Provides:      golang(%{import_path}/common/db/openssl) = %{version}-%{release}
Provides:      golang(%{import_path}/common/intents) = %{version}-%{release}
Provides:      golang(%{import_path}/common/json) = %{version}-%{release}
Provides:      golang(%{import_path}/common/log) = %{version}-%{release}
Provides:      golang(%{import_path}/common/options) = %{version}-%{release}
Provides:      golang(%{import_path}/common/password) = %{version}-%{release}
Provides:      golang(%{import_path}/common/progress) = %{version}-%{release}
Provides:      golang(%{import_path}/common/signals) = %{version}-%{release}
Provides:      golang(%{import_path}/common/testutil) = %{version}-%{release}
Provides:      golang(%{import_path}/common/text) = %{version}-%{release}
Provides:      golang(%{import_path}/common/util) = %{version}-%{release}
Provides:      golang(%{import_path}/mongodump) = %{version}-%{release}
Provides:      golang(%{import_path}/mongoexport) = %{version}-%{release}
Provides:      golang(%{import_path}/mongofiles) = %{version}-%{release}
Provides:      golang(%{import_path}/mongoimport) = %{version}-%{release}
Provides:      golang(%{import_path}/mongoimport/csv) = %{version}-%{release}
Provides:      golang(%{import_path}/mongorestore) = %{version}-%{release}
Provides:      golang(%{import_path}/mongostat) = %{version}-%{release}
Provides:      golang(%{import_path}/mongotop) = %{version}-%{release}

ExcludeArch:   armv5tl

%description devel
This package contains library source intended for
building other packages which use %{project}/%{repo}.
%endif


%prep
%setup -q -n %{repo}-%{commit}
%if ! 0%{?with_bundled}
%patch0 -p1
%endif

%build
# Make link for etcd itself
mkdir -p ./_build/src/github.com/mongodb
ln -s $(pwd) ./_build/src/github.com/mongodb/mongo-tools

%if 0%{?with_debug}
function gobuild { go build -a -ldflags "-B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \n')" -v -x "$@"; }
%else
function gobuild { go build -a "$@"; }
%endif

%if 0%{?with_bundled}
export GOPATH=$(pwd)/vendor:$(pwd)/_build:%{gopath}
%else
export GOPATH=$(pwd)/_build:%{gopath}
%endif

%if ! 0%{?gobuild:1}
%define gobuild(o:) go build -ldflags "${LDFLAGS:-} -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \\n')" -a -v -x %{?**}; 
%endif

mkdir bin
binaries=(bsondump mongostat mongofiles mongoexport mongoimport mongorestore mongodump mongotop)
for bin in "${binaries[@]}"; do
  %gobuild -o bin/${bin} \-tags ssl ${bin}/main/${bin}.go
done

# Copy Apache license
cp %{SOURCE10} $(basename %{SOURCE10})

%install
# main package binary
install -d -p %{buildroot}%{_bindir}
install -p -m 0755 bin/* %{buildroot}%{_bindir}

%if 0%{?with_devel}
install -d -p %{buildroot}/%{gopath}/src/%{import_path}/

# copy directories
for file in ./* ; do
    if [ -d $file ]; then
        cp -rpav $file %{buildroot}%{gopath}/src/%{import_path}/
    fi
done

rm -rf %{buildroot}%{gopath}/src/%{import_path}/bin
rm -rf %{buildroot}%{gopath}/src/%{import_path}/vendor
rm -rf %{buildroot}%{gopath}/src/%{import_path}/test
rm -rf %{buildroot}%{gopath}/src/%{import_path}/_build
rm -rf %{buildroot}%{gopath}/src/%{import_path}/mongorestore/testdata
rm -rf %{buildroot}%{gopath}/src/%{import_path}/common/db/openssl/testdata
%endif

install -d -m 755            %{buildroot}%{_mandir}/man1
install -p -m 644 %{SOURCE1} %{buildroot}%{_mandir}/man1/
install -p -m 644 %{SOURCE2} %{buildroot}%{_mandir}/man1/
install -p -m 644 %{SOURCE3} %{buildroot}%{_mandir}/man1/
install -p -m 644 %{SOURCE4} %{buildroot}%{_mandir}/man1/
install -p -m 644 %{SOURCE5} %{buildroot}%{_mandir}/man1/
install -p -m 644 %{SOURCE7} %{buildroot}%{_mandir}/man1/
install -p -m 644 %{SOURCE8} %{buildroot}%{_mandir}/man1/
install -p -m 644 %{SOURCE9} %{buildroot}%{_mandir}/man1/


%check
%if 0%{?with_bundled}
export GOPATH=%{buildroot}%{gopath}:$(pwd)/vendor:$(pwd)/_build:%{gopath}
%else
export GOPATH=%{buildroot}%{gopath}:$(pwd)/_build:%{gopath}
%endif

%if 0
go test %{import_path}/common/bsonutil
go test %{import_path}/common/db
go test %{import_path}/common/intents
# redeclaration of C
#go test {import_path}/common/json
# import cycle not allowed in test
#go test {import_path}/common/log
go test %{import_path}/common/progress
go test %{import_path}/common/text
go test %{import_path}/common/util
go test %{import_path}/mongodump
go test %{import_path}/mongoexport
go test %{import_path}/mongofiles
#go test {import_path}/mongoimport
# problems getting to test data
#go test %{import_path}/mongorestore
go test %{import_path}/mongostat
%endif

%files
%doc LICENSE.md APACHE-2.0.txt
%doc Godeps README.md CONTRIBUTING.md THIRD-PARTY-NOTICES
%{_bindir}/*
%{_mandir}/man1/*

%if 0%{?with_devel}
%files devel
%doc LICENSE.md
%doc Godeps README.md CONTRIBUTING.md THIRD-PARTY-NOTICES
%dir %{gopath}/src/%{provider}.%{provider_tld}/%{project}
%{gopath}/src/%{import_path}
%endif


%changelog
* Thu Jan 17 2019 joequant <joequant> 4.1.4-1.mga7
+ Revision: 1357771
- downgrade to 4.1.4 to deal with licensing

* Wed Dec 05 2018 joequant <joequant> 4.1.6-1.mga7
+ Revision: 1338470
- upgrade to 4.1.6
- upgrade to 4.1.6

* Wed Dec 05 2018 joequant <joequant> 4.0.4-1.mga7
+ Revision: 1338464
- upgrade to 4.0.4

* Sun Sep 23 2018 umeabot <umeabot> 3.4.10-3.mga7
+ Revision: 1299589
- Mageia 7 Mass Rebuild

* Wed Nov 22 2017 tv <tv> 3.4.10-2.mga7
+ Revision: 1178694
- rebuild for new openssl

* Wed Nov 08 2017 joequant <joequant> 3.4.10-1.mga7
+ Revision: 1176543
- upgrade to 3.4.10

* Wed Nov 08 2017 joequant <joequant> 3.2.17-1.mga7
+ Revision: 1176534
- upgrade to 3.2.17
- copy fedora
- rebuild
- upgrade to 3.2.1

* Fri Oct 06 2017 joequant <joequant> 3.0.4-0.4.mga7
+ Revision: 1169715
- rebuild with new stack

* Thu Mar 31 2016 pterjan <pterjan> 3.0.4-0.3.mga6
+ Revision: 996987
- Exclude from armv5tl which does not have mongodb

* Sun Mar 20 2016 luigiwalser <luigiwalser> 3.0.4-0.2.mga6
+ Revision: 993141
- mga6 mass rebuild and switch to numerical release tag

* Sat Aug 01 2015 joequant <joequant> 3.0.4-0.1.gitefe71bf.mga6
+ Revision: 860219
- remove tests for now
- don't remove tests
- remove mongorestore from tests
- fix archs
- fix group
- imported package mongo-tools