700e592
%global date 20130123
700e592
%global git_commit 98d0789
6983b55
%global packdname core-%{git_commit}
e6eb269
#last extras ext4_utils  commit without custom libselinux requirement
e6eb269
%global extras_git_commit 4ff85ad
e6eb269
%global extras_packdname extras-%{extras_git_commit}
e6eb269
6983b55
6983b55
Name:          android-tools
c7cb296
Version:       %{date}git%{git_commit}
d1a5b97
Release:       1%{?dist}
3ae268d
Summary:       Android platform tools(adb, fastboot)
6983b55
6983b55
Group:         Applications/System
0ad26c0
# The entire source code is ASL 2.0 except fastboot/ which is BSD
0ad26c0
License:       ASL 2.0 and (ASL 2.0 and BSD)
0ad26c0
URL:           http://developer.android.com/guide/developing/tools/
9e0670e
9e0670e
#  using git archive since upstream hasn't created tarballs. 
700e592
#  git archive --format=tar --prefix=%%{packdname}/ %%{git_commit} adb fastboot libzipfile libcutils libmincrypt libsparse mkbootimg include/cutils include/zipfile include/mincrypt | xz  > %%{packdname}.tar.xz
9e0670e
#  https://android.googlesource.com/platform/system/core.git
e6eb269
#  git archive --format=tar --prefix=extras/ %%{extras_git_commit} ext4_utils | xz  > %%{extras_packdname}.tar.xz
e6eb269
#  https://android.googlesource.com/platform/system/extras.git
9e0670e
9e0670e
Source0:       %{packdname}.tar.xz
e6eb269
Source1:       %{extras_packdname}.tar.xz
e6eb269
Source2:       core-Makefile
e6eb269
Source3:       adb-Makefile
e6eb269
Source4:       fastboot-Makefile
e6eb269
Source5:       51-android.rules
700e592
Source6:       adb.service
6983b55
700e592
Requires(post): systemd-units
700e592
Requires(preun): systemd-units
700e592
Requires(postun): systemd-units
6983b55
BuildRequires: zlib-devel
e6eb269
BuildRequires: openssl-devel
e6eb269
BuildRequires: libselinux-devel
700e592
BuildRequires: systemd-units
6983b55
c7cb296
Provides:      adb
c7cb296
Provides:      fastboot
c7cb296
6983b55
%description
6983b55
6983b55
The Android Debug Bridge (ADB) is used to:
6983b55
6983b55
- keep track of all Android devices and emulators instances
6983b55
  connected to or running on a given host developer machine
6983b55
03951c7
- implement various control commands (e.g. "adb shell", "adb pull", etc.)
6983b55
  for the benefit of clients (command-line users, or helper programs like
6983b55
  DDMS). These commands are what is called a 'service' in ADB.
6983b55
03951c7
Fastboot is used to manipulate the flash partitions of the Android phone. 
03951c7
It can also boot the phone using a kernel image or root filesystem image 
03951c7
which reside on the host machine rather than in the phone flash. 
03951c7
In order to use it, it is important to understand the flash partition 
03951c7
layout for the phone.
03951c7
The fastboot program works in conjunction with firmware on the phone 
03951c7
to read and write the flash partitions. It needs the same USB device 
03951c7
setup between the host and the target phone as adb.
03951c7
6983b55
%prep
e6eb269
%setup -q -b 1 -n extras
e6eb269
%setup -q -b 0 -n %{packdname}
e6eb269
cp -p %{SOURCE2} Makefile
e6eb269
cp -p %{SOURCE3} adb/Makefile
e6eb269
cp -p %{SOURCE4} fastboot/Makefile
700e592
cp -p %{SOURCE5} 51-android.rules
6983b55
6983b55
%build
6983b55
make %{?_smp_mflags}
6983b55
6983b55
%install
03951c7
install -d -m 0755 ${RPM_BUILD_ROOT}%{_bindir}
6983b55
make install DESTDIR=$RPM_BUILD_ROOT BINDIR=%{_bindir}
700e592
install -p -D -m 0644 %{SOURCE6} \
700e592
    %{buildroot}%{_unitdir}/adb.service
700e592
700e592
%post
700e592
if [ "$1" -eq "1" ] ; then 
700e592
    # Initial installation 
700e592
    /bin/systemctl daemon-reload >/dev/null 2>&1 || :
700e592
fi
700e592
700e592
%preun
700e592
if [ "$1" -eq "0" ] ; then
700e592
    # Package removal, not upgrade
700e592
    /bin/systemctl --no-reload disable adb.service > /dev/null 2>&1 || :
700e592
    /bin/systemctl stop adb.service > /dev/null 2>&1 || :
700e592
fi
700e592
700e592
%postun
700e592
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
700e592
if [ "$1" -ge "1" ] ; then
700e592
    # Package upgrade, not uninstall
700e592
    /bin/systemctl try-restart adb.service >/dev/null 2>&1 || :
700e592
fi
6983b55
6983b55
%files
700e592
%doc adb/OVERVIEW.TXT adb/SERVICES.TXT adb/NOTICE adb/protocol.txt 51-android.rules
700e592
%{_unitdir}/adb.service
c7cb296
#ASL2.0
6983b55
%{_bindir}/adb
1584467
#ASL2.0 and BSD.
6983b55
%{_bindir}/fastboot
6983b55
6983b55
6983b55
%changelog
700e592
* Mon Jan 28 2013 Ivan Afonichev <ivan.afonichev@gmail.com> - 20130123git98d0789-1
700e592
- Update to upstream git commit 98d0789
700e592
- Resolves: rhbz 903074 Move udev rule to docs as example
700e592
- Resolves: rhbz 879585 Introduce adb.service with PrivateTmp
700e592
e6eb269
* Tue Nov 20 2012 Ivan Afonichev <ivan.afonichev@gmail.com> - 20121120git3ddc005-1
e6eb269
- Update to upstream git commit 3ddc005
e6eb269
- Added more udev devices
e6eb269
- Added ext4_utils from extras for fastboot
e6eb269
- Updated makefiles
e6eb269
- Resolves: rhbz 869624 start adb server by udev
e6eb269
3ae268d
* Thu May 10 2012 Ivan Afonichev <ivan.afonichev@gmail.com> - 20120510gitd98c87c-1
3ae268d
- Update to upstream git commit d98c87c
3ae268d
- Added more udev devices
3ae268d
- Resolves: rhbz 819292 secure udev permissions
3ae268d
030471b
* Thu Jan 12 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 20111220git1b251bd-2
030471b
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
030471b
d1a5b97
* Tue Dec 20 2011 Ivan Afonichev <ivan.afonichev@gmail.com> - 20111220git1b251bd-1
d1a5b97
- Update to upstream git commit 1b251bd
d1a5b97
0ad26c0
* Wed Nov 23 2011 Ivan Afonichev <ivan.afonichev@gmail.com> - 20111120git4a25390-3
0ad26c0
- Fix license
0ad26c0
- More specific URL
0ad26c0
1584467
* Tue Nov 22 2011 Ivan Afonichev <ivan.afonichev@gmail.com> - 20111120git4a25390-2
1584467
- Require udev
1584467
c7cb296
* Sun Nov 20 2011 Ivan Afonichev <ivan.afonichev@gmail.com> - 20111120git4a25390-1
c7cb296
- Versioning changes
c7cb296
- Use only needed sources
c7cb296
- Udev rules moved to lib
c7cb296
- More license info added
c7cb296
- adb and fastboot moved to provides from summary
c7cb296
9e0670e
* Tue Nov 15 2011 Ivan Afonichev <ivan.afonichev@gmail.com> - 20111115.4a25390-1
9e0670e
- Change upstream git repo URL
9e0670e
- Update to upstream git commit 4a25390
9e0670e
- Added more udev devices
9e0670e
2b77c2a
* Mon Oct 17 2011 Ivan Afonichev <ivan.afonichev@gmail.com> - 20110816.80d508f-3
2b77c2a
- Update udev rules (s/SYSFS/ATTR/g) 
2b77c2a
03951c7
* Sat Aug 27 2011 Ivan Afonichev <ivan.afonichev@gmail.com> - 20110816.80d508f-2
03951c7
- Remove the rm in the install section
03951c7
- Remove defattr
03951c7
- Use install command(not macro)
03951c7
- Add description of fastboot
03951c7
1e10e61
* Tue Aug 16 2011 Ivan Afonichev <ivan.afonichev@gmail.com> - 20110816.80d508f-1
1e10e61
- Update to upstream git commit 80d508f
1e10e61
- Added more udev devices
1e10e61
ef9983f
* Sun Jul 31 2011 Ivan Afonichev <ivan.afonichev@gmail.com> - 20110731.810cf41-1
b43de5f
- Update to upstream git commit 810cf41
b43de5f
- Fix License
b43de5f
- Use optflags
b43de5f
- Added more udev devices
557d0e8
- Remove Epoch
b43de5f
1e5f07d
* Tue Jul 26 2011 Ivan Afonichev <ivan.afonichev@gmail.com> - 0:20110726.212282c-1
1e5f07d
- Update to upstream git commit 212282c
1e5f07d
6d520ca
* Wed May 18 2011 Ivan Afonichev <ivan.afonichev@gmail.com> - 0:20110516.327b2b7-1
6983b55
- Initial spec
6983b55
- Initial makefiles
6d520ca
- Initial udev rule