Date: Wednesday, December 20, 2017 @ 22:12:33 Author: heftig Revision: 313434
archrelease: copy trunk to extra-x86_64 Added: eclipse/repos/extra-x86_64/PKGBUILD (from rev 313433, eclipse/trunk/PKGBUILD) eclipse/repos/extra-x86_64/commonify (from rev 313433, eclipse/trunk/commonify) Deleted: eclipse/repos/extra-x86_64/PKGBUILD eclipse/repos/extra-x86_64/commonify eclipse/repos/extra-x86_64/eclipse.desktop eclipse/repos/extra-x86_64/eclipse.sh -----------------+ PKGBUILD | 196 ++++++++++++++++++------------------- commonify | 282 ++++++++++++++++++++++++++++++------------------------ eclipse.desktop | 9 - eclipse.sh | 3 4 files changed, 253 insertions(+), 237 deletions(-) Deleted: PKGBUILD =================================================================== --- PKGBUILD 2017-12-20 21:50:29 UTC (rev 313433) +++ PKGBUILD 2017-12-20 22:12:33 UTC (rev 313434) @@ -1,100 +0,0 @@ -# $Id$ -# Maintainer: Jan Alexander Steffens (heftig) <jan.steff...@gmail.com> -# Contributor: Ionut Biru <ib...@archlinux.org> -# Contributor: Paul Mattal <p...@archlinux.org> -# Contributor: Andrew Wright <andr...@photism.org> -# Contributor: Andreas W. Hauser <andy-...@splashground.de> -# Contributor: Marco Crosio <marco.cro...@gmail.com> - -pkgbase=eclipse -pkgname=(eclipse-{common,java,jee,cpp,php,javascript}) -pkgver=4.7.1.a -pkgrel=1 -_release=oxygen-1a -pkgdesc="Highly extensible IDE" -license=(EPL) -arch=(i686 x86_64) -url="https://eclipse.org" -makedepends=(python3) -options=(!emptydirs) -source=(commonify eclipse.sh eclipse.desktop) -source_i686=() -source_x86_64=() -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) - 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') - -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 - done -} - -build() { - ./commonify --identical ${pkgname[@]} - - mkdir -p eclipse-common/dropins - touch eclipse-common/dropins/.keep -} - -package_eclipse-common() { - pkgdesc+=" (common files)" - depends=("java-environment>=8" webkit2gtk unzip) - - 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" - - 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" - done -} - -_package() { - _variant=${1#eclipse-} - pkgdesc+=" (${_variant^^} variant)" - depends=(eclipse-common) - provides=("eclipse=$pkgver-$pkgrel") - conflicts=(eclipse) - - case $_variant in - java) replaces=(eclipse) ;; - cpp) replaces=(eclipse-cdt) ;; - esac - - install -d "$pkgdir/usr/lib" - cp -a $1 "$pkgdir/usr/lib/eclipse" -} Copied: eclipse/repos/extra-x86_64/PKGBUILD (from rev 313433, eclipse/trunk/PKGBUILD) =================================================================== --- PKGBUILD (rev 0) +++ PKGBUILD 2017-12-20 22:12:33 UTC (rev 313434) @@ -0,0 +1,96 @@ +# $Id$ +# Maintainer: Jan Alexander Steffens (heftig) <jan.steff...@gmail.com> +# Contributor: Ionut Biru <ib...@archlinux.org> +# Contributor: Paul Mattal <p...@archlinux.org> +# Contributor: Andrew Wright <andr...@photism.org> +# Contributor: Andreas W. Hauser <andy-...@splashground.de> +# Contributor: Marco Crosio <marco.cro...@gmail.com> + +pkgbase=eclipse +pkgname=(eclipse-{common,java,jee,cpp,php,javascript}) +pkgver=4.7.2 +pkgrel=1 +_release=oxygen-2 +pkgdesc="Highly extensible IDE" +license=(EPL) +arch=(x86_64) +url="https://eclipse.org" +makedepends=(python3) +options=(!emptydirs) +source=(commonify) +noextract=() + +for _pkg in ${pkgname[@]}; do + [[ $_pkg == 'eclipse-common' ]] && continue + 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=('da1eaf6239cb0c2b5009cd8c261e96e7b17a7536b12fe60fcb1e903f5e67dbdc' + '96cea8ab8ce6873d254054766f34a0b4cbdbe70c43d30148c49ee2d7917cc32f' + 'e35f2bc01e6e3db89e29840bd8c4cd105aec583a0177917e8455a16ff39aeb62' + '30e1b431c5e5ca82a72fe3f35e1b311af75671b04d0bd3120b848673325dec10' + '5e8c0da6b2438db8b4df546a3e1ebfa03bb6ee065b9323bfa99467782bbaf3f4' + '9a099b141421d09ae50ca469d162b3e2a41134a8bd7985fd4d28f284ba29757e') + +prepare() { + for _pkg in ${pkgname[@]}; do + 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[@]} +} + +package_eclipse-common() { + pkgdesc+=" (common files)" + depends=("java-environment>=8" webkit2gtk unzip) + + install -d "$pkgdir/usr/lib" + cp -a eclipse-common "$pkgdir/usr/lib/eclipse" + + 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" + done +} + +_package() { + _variant=${1#eclipse-} + pkgdesc+=" (${_variant^^} variant)" + depends=(eclipse-common) + provides=("eclipse=$pkgver-$pkgrel") + conflicts=(eclipse) + + case $_variant in + java) replaces=(eclipse) ;; + cpp) replaces=(eclipse-cdt) ;; + esac + + install -d "$pkgdir/usr/lib" + cp -a $1 "$pkgdir/usr/lib/eclipse" +} Deleted: commonify =================================================================== --- commonify 2017-12-20 21:50:29 UTC (rev 313433) +++ commonify 2017-12-20 22:12:33 UTC (rev 313434) @@ -1,125 +0,0 @@ -#!/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 enum import Enum, auto -from logging import getLogger, basicConfig, INFO -from os import cpu_count -from pathlib import Path -from sys import exit - - -logger = getLogger(__name__) - - -class Mode(Enum): - identical = auto() - nonconflicting = auto() - - -def parse_args(args=None): - 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") - - 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 DiffError(RuntimeError): - pass - - -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: - try: - p.kill() - except: - pass - - if ret != 0: - raise DiffError() - - -async def identical(files): - if len(files) < 2: - return True - first, *rest = files - fut = gather(*[diff(first, f) for f in rest]) - try: - await fut - except DiffError as e: - return False - else: - return True - finally: - fut.cancel() - -def commonify_file(common_file, files): - common_file.parent.mkdir(parents=True, exist_ok=True) - first, *rest = files - first.rename(common_file) - for f in rest: - f.unlink() - - -async def commonify_identical(common_file, files): - if await identical(files): - commonify_file(common_file, files) - return 1 - else: - logger.info("Divergent file: %s", common_file) - return 0 - - -def arg_dir(s): - p = Path(s) - if not p.is_dir(): - raise ValueError(f"{s!r} is not a directory") - return p - - -async def main(settings): - ignore_len = settings.mode == Mode.nonconflicting - 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) - - results = await gather(*[ - commonify_identical(common_dir / f, tf) - for f, tf in d.items() - if ignore_len or len(tf) == len(targets) - ]) - - logger.info("%s: %d %s files", - common_dir, sum(results), settings.mode.name) - return 0 - - -if __name__ == "__main__": - basicConfig(level=INFO) - settings = parse_args() - loop = get_event_loop() - exit(loop.run_until_complete(main(settings))) Copied: eclipse/repos/extra-x86_64/commonify (from rev 313433, eclipse/trunk/commonify) =================================================================== --- commonify (rev 0) +++ commonify 2017-12-20 22:12:33 UTC (rev 313434) @@ -0,0 +1,157 @@ +#!/usr/bin/env python3 +from argparse import ArgumentParser +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 +from pathlib import Path +from sys import exit + + +logger = getLogger(__name__) + + +class Mode(Enum): + identical = auto() + nonconflicting = auto() + + +def parse_args(args=None): + 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') + + 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) + + +class bounded_exec: + semaphore = BoundedSemaphore(value=cpu_count() + 1) + + def __init__(self, *args, **kwargs): + self.args = args + self.kwargs = kwargs + + async def __aenter__(self): + await self.semaphore.acquire() + p = self.process = await create_subprocess_exec(*self.args, **self.kwargs) + return p + + 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() + + +async def identical(files): + if len(files) < 2: + return True + first, *rest = files + fut = gather(*[diff(first, f) for f in rest]) + try: + await fut + except DiffError as e: + return False + else: + return True + finally: + fut.cancel() + +def commonify_file(common_file, files): + common_file.parent.mkdir(parents=True, exist_ok=True) + first, *rest = files + first.rename(common_file) + for f in rest: + f.unlink() + + +async def commonify_identical(common_file, files, *, dry_run=False): + if await identical(files): + if not dry_run: + commonify_file(common_file, files) + return 1 + else: + 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') + return p + + +async def main(settings): + ignore_len = settings.mode == Mode.nonconflicting + common_dir = arg_dir(settings.common_dir) + targets = [arg_dir(t) for t in settings.targets] + + files_targetfiles = {} + await gather(*[scan(t, files_targetfiles) for t in targets]) + + results = await gather(*[ + 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', + common_dir, sum(results), settings.mode.name) + return 0 + + +if __name__ == '__main__': + basicConfig(level=INFO) + settings = parse_args() + loop = get_event_loop() + exit(loop.run_until_complete(main(settings))) Deleted: eclipse.desktop =================================================================== --- eclipse.desktop 2017-12-20 21:50:29 UTC (rev 313433) +++ eclipse.desktop 2017-12-20 22:12:33 UTC (rev 313434) @@ -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 21:50:29 UTC (rev 313433) +++ eclipse.sh 2017-12-20 22:12:33 UTC (rev 313434) @@ -1,3 +0,0 @@ -#!/bin/bash -export ECLIPSE_HOME=/usr/lib/eclipse -exec ${ECLIPSE_HOME}/eclipse "$@"