[arch-commits] Commit in eclipse/trunk (PKGBUILD commonify eclipse.desktop eclipse.sh)
Jan Steffens
heftig at archlinux.org
Wed Dec 20 21:05:02 UTC 2017
Date: Wednesday, December 20, 2017 @ 21:05:01
Author: heftig
Revision: 313427
4.7.2-1
Modified:
eclipse/trunk/PKGBUILD
eclipse/trunk/commonify
Deleted:
eclipse/trunk/eclipse.desktop
eclipse/trunk/eclipse.sh
-----------------+
PKGBUILD | 70 +++++++++++++++++--------------------
commonify | 102 +++++++++++++++++++++++++++++++++++-------------------
eclipse.desktop | 9 ----
eclipse.sh | 3 -
4 files changed, 100 insertions(+), 84 deletions(-)
Modified: PKGBUILD
===================================================================
--- PKGBUILD 2017-12-20 20:54:35 UTC (rev 313426)
+++ PKGBUILD 2017-12-20 21:05:01 UTC (rev 313427)
@@ -8,9 +8,9 @@
pkgbase=eclipse
pkgname=(eclipse-{common,java,jee,cpp,php,javascript})
-pkgver=4.7.1.a
+pkgver=4.7.2
pkgrel=1
-_release=oxygen-1a
+_release=oxygen-2
pkgdesc="Highly extensible IDE"
license=(EPL)
arch=(x86_64)
@@ -17,54 +17,35 @@
url="https://eclipse.org"
makedepends=(python3)
options=(!emptydirs)
-source=(commonify eclipse.sh eclipse.desktop)
-source_i686=()
-source_x86_64=()
+source=(commonify)
noextract=()
for _pkg in ${pkgname[@]}; do
[[ $_pkg == 'eclipse-common' ]] && continue
- source_i686+=(http://ftp-stud.fht-esslingen.de/pub/Mirrors/eclipse/technology/epp/downloads/release/${_release/-//}/$_pkg-$_release-linux-gtk.tar.gz)
- source_x86_64+=(http://ftp-stud.fht-esslingen.de/pub/Mirrors/eclipse/technology/epp/downloads/release/${_release/-//}/$_pkg-$_release-linux-gtk-x86_64.tar.gz)
- noextract+=($_pkg-$_release-linux-gtk{,-x86_64}.tar.gz)
+ source+=(http://ftp-stud.fht-esslingen.de/pub/Mirrors/eclipse/technology/epp/downloads/release/${_release/-//}/$_pkg-$_release-linux-gtk-x86_64.tar.gz)
+ noextract+=($_pkg-$_release-linux-gtk-x86_64.tar.gz)
eval "package_$_pkg() { _package $_pkg; }"
done
-sha256sums=('9e5573f7b951774be3f98c69f9d391ddafbe8a3a727ce81c08dfd67d42cee503'
- '04e789fb695d5f95d09ddb994ae30397b39aee35f11997465dd91d129c41b2ed'
- '57559c2548ae463089acb3c2825ebc002ed83067ddc953b23d36a7b5a02deaf3')
-sha256sums_i686=('9ffb8980f1f5e68ee6779c9f02376040ace2dec76d8be6407e0d2c77c1c3100b'
- '9752f15435a417c03bb75313ee94a4dc3b35adcdd300af055a6f7aa9311225a5'
- 'eb8462e778034dd4c8e5fcb538d271300730fd7584fe7c2c5e2d53541ee453c8'
- 'ac6d167124aaad5fb8629802ce5e7acfa57848fc5c7854d068ecd9cd19719ca8'
- '65a536d0ce3b41a0c8471167085757eee49b4ebeb04b68929af6475ac465aa5b')
-sha256sums_x86_64=('f1b8205abec2dc9cc769941fbde96bb83007050841d7f094dcb3cb07b1696446'
- '7c6bf1640c2ed9db3717cf2c65cecd5f18c3736b46151caa09cd28397516f08b'
- 'a155afe0b305a1206efb463123f68f48be3900e694f4c7fffa0643e1424511cf'
- '6b90524ec4f075ed382f14c598c817df1764f31bebbf4b1ba9bdd4056033eaf3'
- 'af546dd94f7376dced761970ab0a0f31508fc0ec06e51282a02f5df96748918c')
+sha256sums=('da1eaf6239cb0c2b5009cd8c261e96e7b17a7536b12fe60fcb1e903f5e67dbdc'
+ '96cea8ab8ce6873d254054766f34a0b4cbdbe70c43d30148c49ee2d7917cc32f'
+ 'e35f2bc01e6e3db89e29840bd8c4cd105aec583a0177917e8455a16ff39aeb62'
+ '30e1b431c5e5ca82a72fe3f35e1b311af75671b04d0bd3120b848673325dec10'
+ '5e8c0da6b2438db8b4df546a3e1ebfa03bb6ee065b9323bfa99467782bbaf3f4'
+ '9a099b141421d09ae50ca469d162b3e2a41134a8bd7985fd4d28f284ba29757e')
prepare() {
- mkdir eclipse-common
-
for _pkg in ${pkgname[@]}; do
- [[ $_pkg == 'eclipse-common' ]] && continue
-
- if [[ $CARCH == x86_64 ]]; then
- bsdtar -xf "$_pkg-$_release-linux-gtk-x86_64.tar.gz"
- else
- bsdtar -xf "$_pkg-$_release-linux-gtk.tar.gz"
- fi
-
- mv eclipse $_pkg
+ mkdir $_pkg
+ [[ $_pkg == eclipse-common ]] && continue
+ bsdtar -xf "$_pkg-$_release-linux-gtk-x86_64.tar.gz" -C $_pkg --strip-components 1
done
}
build() {
+ mkdir eclipse-common/dropins
+ touch eclipse-common/dropins/.keep
./commonify --identical ${pkgname[@]}
-
- mkdir -p eclipse-common/dropins
- touch eclipse-common/dropins/.keep
}
package_eclipse-common() {
@@ -74,9 +55,24 @@
install -d "$pkgdir/usr/lib"
cp -a eclipse-common "$pkgdir/usr/lib/eclipse"
- install -D eclipse.sh "$pkgdir/usr/bin/eclipse"
- install -Dm644 eclipse.desktop "$pkgdir/usr/share/applications/eclipse.desktop"
+ install -D /dev/stdin "$pkgdir/usr/bin/eclipse" <<END
+#!/bin/bash
+export ECLIPSE_HOME=/usr/lib/eclipse
+exec \$ECLIPSE_HOME/eclipse "\$@"
+END
+ install -Dm644 /dev/stdin "$pkgdir/usr/share/applications/eclipse.desktop" <<END
+[Desktop Entry]
+Name=Eclipse
+Comment=A Java Development Environment
+Icon=eclipse
+Exec=eclipse
+Terminal=false
+Type=Application
+Categories=Development;IDE;Java;
+StartupNotify=true
+END
+
for _i in 16 32 48 256; do
install -Dm644 eclipse-common/plugins/org.eclipse.platform_*/eclipse${_i}.png \
"$pkgdir/usr/share/icons/hicolor/${_i}x${_i}/apps/eclipse.png"
Modified: commonify
===================================================================
--- commonify 2017-12-20 20:54:35 UTC (rev 313426)
+++ commonify 2017-12-20 21:05:01 UTC (rev 313427)
@@ -1,7 +1,8 @@
#!/usr/bin/env python3
from argparse import ArgumentParser
-from asyncio.subprocess import DEVNULL
-from asyncio import get_event_loop, gather, BoundedSemaphore, create_subprocess_exec
+from asyncio.subprocess import DEVNULL, PIPE
+from asyncio import (get_event_loop, gather, BoundedSemaphore, create_subprocess_exec,
+ IncompleteReadError)
from enum import Enum, auto
from logging import getLogger, basicConfig, INFO
from os import cpu_count
@@ -18,39 +19,53 @@
def parse_args(args=None):
- parser = ArgumentParser(description="Extract common files.")
+ parser = ArgumentParser(description='Extract common files.')
modes = parser.add_mutually_exclusive_group(required=True)
for m in Mode:
- modes.add_argument(f"--{m.name}", dest="mode", action="store_const", const=m,
- help=f"extract {m.name} common files")
+ modes.add_argument(f'--{m.name}', dest='mode', action='store_const', const=m,
+ help=f'extract {m.name} common files')
- parser.add_argument("common_dir", metavar="COMMON_DIR",
- help="common files directory to move to")
- parser.add_argument("targets", nargs="+", metavar="INPUT_DIR", help="directory to move from")
+ parser.add_argument('-n', '--dry-run', action='store_true', help='Dry run (do nothing)')
+ parser.add_argument('common_dir', metavar='COMMON_DIR',
+ help='common files directory to move to')
+ parser.add_argument('targets', nargs='+', metavar='INPUT_DIR', help='directory to move from')
return parser.parse_args(args)
-diff_semaphore = BoundedSemaphore(value=cpu_count())
+class bounded_exec:
+ semaphore = BoundedSemaphore(value=cpu_count() + 1)
+ def __init__(self, *args, **kwargs):
+ self.args = args
+ self.kwargs = kwargs
-class DiffError(RuntimeError):
- pass
+ async def __aenter__(self):
+ await self.semaphore.acquire()
+ p = self.process = await create_subprocess_exec(*self.args, **self.kwargs)
+ return p
-
-async def diff(file1, file2):
- async with diff_semaphore:
- p = await create_subprocess_exec("diff", "-q", str(file1), str(file2),
- stdin=DEVNULL, stdout=DEVNULL, stderr=DEVNULL)
- try:
- ret = await p.wait()
- except:
+ async def __aexit__(self, exc_type, exc, tb):
+ p = self.process
+ if p.returncode is None:
try:
p.kill()
except:
pass
+ await p.wait()
+ self.semaphore.release()
+
+class DiffError(RuntimeError):
+ pass
+
+
+async def diff(file1, file2):
+ async with bounded_exec('diff', '-q', str(file1), str(file2),
+ stdin=DEVNULL, stdout=DEVNULL, stderr=DEVNULL) as p:
+ ret = await p.wait()
+
if ret != 0:
raise DiffError()
@@ -77,19 +92,42 @@
f.unlink()
-async def commonify_identical(common_file, files):
+async def commonify_identical(common_file, files, *, dry_run=False):
if await identical(files):
- commonify_file(common_file, files)
+ if not dry_run:
+ commonify_file(common_file, files)
return 1
else:
- logger.info("Divergent file: %s", common_file)
+ logger.info('Divergent file: %s', common_file)
return 0
+async def find_files(path):
+ async with bounded_exec('find', str(path), '-type', 'f', '-print0',
+ stdin=DEVNULL, stdout=PIPE, stderr=DEVNULL) as p:
+ while True:
+ try:
+ line = await p.stdout.readuntil(b'\x00')
+ except IncompleteReadError as e:
+ line = e.partial
+ if not line:
+ break
+ raise
+ yield Path(line[:-1].decode())
+
+
+async def scan(target, files_targetfiles):
+ n = 0
+ async for f in find_files(target):
+ files_targetfiles.setdefault(f.relative_to(target), []).append(f)
+ n += 1
+ logger.info('%s: Found %d files', target, n)
+
+
def arg_dir(s):
p = Path(s)
if not p.is_dir():
- raise ValueError(f"{s!r} is not a directory")
+ raise ValueError(f'{s!r} is not a directory')
return p
@@ -98,27 +136,21 @@
common_dir = arg_dir(settings.common_dir)
targets = [arg_dir(t) for t in settings.targets]
- d = {}
- for t in targets:
- n = 0
- for f in t.glob("**/*"):
- if f.is_file():
- d.setdefault(f.relative_to(t), []).append(f)
- n += 1
- logger.info("%s: Found %d files", t, n)
+ files_targetfiles = {}
+ await gather(*[scan(t, files_targetfiles) for t in targets])
results = await gather(*[
- commonify_identical(common_dir / f, tf)
- for f, tf in d.items()
+ commonify_identical(common_dir / f, tf, dry_run=settings.dry_run)
+ for f, tf in files_targetfiles.items()
if ignore_len or len(tf) == len(targets)
])
- logger.info("%s: %d %s files",
+ logger.info('%s: %d %s files',
common_dir, sum(results), settings.mode.name)
return 0
-if __name__ == "__main__":
+if __name__ == '__main__':
basicConfig(level=INFO)
settings = parse_args()
loop = get_event_loop()
Deleted: eclipse.desktop
===================================================================
--- eclipse.desktop 2017-12-20 20:54:35 UTC (rev 313426)
+++ eclipse.desktop 2017-12-20 21:05:01 UTC (rev 313427)
@@ -1,9 +0,0 @@
-[Desktop Entry]
-Name=Eclipse
-Comment=A Java Development Environment
-Icon=eclipse
-Exec=eclipse
-Terminal=false
-Type=Application
-Categories=Development;IDE;Java;
-StartupNotify=true
Deleted: eclipse.sh
===================================================================
--- eclipse.sh 2017-12-20 20:54:35 UTC (rev 313426)
+++ eclipse.sh 2017-12-20 21:05:01 UTC (rev 313427)
@@ -1,3 +0,0 @@
-#!/bin/bash
-export ECLIPSE_HOME=/usr/lib/eclipse
-exec ${ECLIPSE_HOME}/eclipse "$@"
More information about the arch-commits
mailing list