Date: Thursday, December 20, 2018 @ 04:52:32 Author: heftig Revision: 416847
archrelease: copy trunk to community-x86_64 Added: eclipse/repos/community-x86_64/PKGBUILD (from rev 416846, eclipse/trunk/PKGBUILD) eclipse/repos/community-x86_64/commonify (from rev 416846, eclipse/trunk/commonify) Deleted: eclipse/repos/community-x86_64/PKGBUILD eclipse/repos/community-x86_64/commonify -----------+ PKGBUILD | 220 ++++++++++++++++++------------------- commonify | 356 +++++++++++++++++++++++++++++++----------------------------- 2 files changed, 295 insertions(+), 281 deletions(-) Deleted: PKGBUILD =================================================================== --- PKGBUILD 2018-12-20 04:50:37 UTC (rev 416846) +++ PKGBUILD 2018-12-20 04:52:32 UTC (rev 416847) @@ -1,109 +0,0 @@ -# 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,rust}) -pkgver=4.9 -pkgrel=1 -_release=2018-09 -pkgdesc="Highly extensible IDE" -license=(EPL) -arch=(x86_64) -url="https://eclipse.org" -makedepends=(python3) -source=(commonify) -noextract=() - -_sourcename() { - case $1 in - eclipse-common) return 1 ;; - eclipse-rust ) echo $1-$_release-incubation-linux-gtk-x86_64.tar.gz ;; - * ) echo $1-$_release-linux-gtk-x86_64.tar.gz ;; - esac -} - -for _pkg in ${pkgname[@]}; do - _src=$(_sourcename $_pkg) || continue - source+=(http://ftp-stud.fht-esslingen.de/pub/Mirrors/eclipse/technology/epp/downloads/release/$_release/R/$_src) - noextract+=($_src) - eval "package_$_pkg() { _package $_pkg; }" -done - -sha256sums=('70ae1934385b0b7c25e5a76bfcd6d092bfd8d19ce451c3d909afa3cf2448452e' - '7f5264ab51477deed9f28a4d3f92209846fa9caa3b311f60d540543c7e172748' - '9d1375f45fb9a37f471db71da07ef67d45c6e36bdd1c6fea9652a19ab388ed0c' - 'f18e533650ab1961651cb3ebdcf38d6fb78d983e1edb175da1afe5b06bebc9e0' - '8fca8efa9f63291efacc0205dd85fc35a109c9518cf0f603cf632b534d01ed7e' - '9197060e3e133d5033b7fcbe856ede5c0cb8f831ba5f0835d6ca2579bce22c3f' - 'adca1e695d0e6adb6fcf11a595c6d2d6b3c01436ab6cb02f99b63ae5cfecfbdd') - -prepare() { - local pkg src - for pkg in ${pkgname[@]}; do - mkdir $pkg - src=$(_sourcename $pkg) || continue - bsdtar -xf $src -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)" - - install -d "$pkgdir/usr/lib" - cp -a eclipse-common "$pkgdir/usr/lib/eclipse" -} - -_package() { - local variant i - - case ${1#eclipse-} in - java ) variant=Java; replaces=(eclipse) ;; - jee ) variant=JEE ;; - cpp ) variant=C++; replaces=(eclipse-cdt) ;; - php ) variant=PHP ;; - javascript) variant=JavaScript ;; - rust ) variant=Rust ;; - * ) return 1 ;; - esac - - pkgdesc+=" for $variant" - depends=(eclipse-common "java-environment>=8" webkit2gtk unzip) - provides=("eclipse=$pkgver-$pkgrel") - conflicts=(eclipse) - - install -d "$pkgdir/usr/lib" - cp -a $1 "$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=$variant Development Environment -Icon=eclipse -Exec=eclipse -Terminal=false -Type=Application -Categories=Development;IDE;$variant; -StartupNotify=true -END - - for i in 16 22 24 32 48 64 128 256 512 1024; do - install -Dm644 eclipse-common/plugins/org.eclipse.platform_*/eclipse$i.png \ - "$pkgdir/usr/share/icons/hicolor/${i}x$i/apps/eclipse.png" - done -} Copied: eclipse/repos/community-x86_64/PKGBUILD (from rev 416846, eclipse/trunk/PKGBUILD) =================================================================== --- PKGBUILD (rev 0) +++ PKGBUILD 2018-12-20 04:52:32 UTC (rev 416847) @@ -0,0 +1,111 @@ +# 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,rust}) +pkgver=4.10 +pkgrel=1 +_release=2018-12/R +pkgdesc="Highly extensible IDE" +license=(EPL) +arch=(x86_64) +url="https://eclipse.org" +makedepends=(python3) +source=(commonify) +sha256sums=('a68cccdf182449dfb4aef595ab26fe6542902421aef42a79672483865cbbd0ea') + +_sourcename() { + case $1 in + eclipse-common) return 1 ;; + eclipse-rust ) echo $1-${_release//\//-}-incubation-linux-gtk-x86_64.tar.gz ;; + * ) echo $1-${_release//\//-}-linux-gtk-x86_64.tar.gz ;; + esac +} + +source_x86_64=() +noextract=() + +for _pkg in ${pkgname[@]}; do + _src=$(_sourcename $_pkg) || continue + source_x86_64+=(http://ftp-stud.fht-esslingen.de/pub/Mirrors/eclipse/technology/epp/downloads/release/$_release/$_src) + noextract+=($_src) + eval "package_$_pkg() { _package $_pkg; }" +done + +sha256sums_x86_64=('d3bcf5e428de4d123eea4349f70a53180cc1aba4985c99018172340b9d54e2b7' + 'bfa929e417562d8ef41562c78fd492b5e20e05c039c9e177888dc688878dfcff' + 'ec936dcba42a4b4affe0d6deb8dbc62d68ea3cc4c6fcf0eb534b45ca1c990bbf' + '5f2c7a456c7c357f98ed1b976d00048f846592c21221e60c76bb263597704543' + '1bd80dfc177326183af0334f018bff48b4c70331bd0a62f907428faa267932f2' + '65ff32a9e26da7df64777c80fa426cc723e2ad922647c2047bcd9a869074fcfb') + +prepare() { + local pkg src + for pkg in ${pkgname[@]}; do + mkdir $pkg + src=$(_sourcename $pkg) || continue + bsdtar -xf $src -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)" + + install -d "$pkgdir/usr/lib" + cp -a eclipse-common "$pkgdir/usr/lib/eclipse" +} + +_package() { + local variant i + + case ${1#eclipse-} in + java ) variant=Java; replaces=(eclipse) ;; + jee ) variant=JEE ;; + cpp ) variant=C++; replaces=(eclipse-cdt) ;; + php ) variant=PHP ;; + javascript) variant=JavaScript ;; + rust ) variant=Rust ;; + * ) return 1 ;; + esac + + pkgdesc+=" for $variant" + depends=(eclipse-common "java-environment>=8" webkit2gtk unzip) + provides=("eclipse=$pkgver-$pkgrel") + conflicts=(eclipse) + + install -d "$pkgdir/usr/lib" + cp -a $1 "$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=$variant Development Environment +Icon=eclipse +Exec=eclipse +Terminal=false +Type=Application +Categories=Development;IDE;$variant; +StartupNotify=true +END + + for i in 16 22 24 32 48 64 128 256 512 1024; do + install -Dm644 eclipse-common/plugins/org.eclipse.platform_*/eclipse$i.png \ + "$pkgdir/usr/share/icons/hicolor/${i}x$i/apps/eclipse.png" + done +} Deleted: commonify =================================================================== --- commonify 2018-12-20 04:50:37 UTC (rev 416846) +++ commonify 2018-12-20 04:52:32 UTC (rev 416847) @@ -1,172 +0,0 @@ -#!/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, DEBUG -from os import cpu_count, renames, remove, removedirs -from os.path import isdir, join as pjoin, split as psplit, relpath -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('-v', '--verbose', action='store_true', help='Raise verbosity') - 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.prog, 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', file1, 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 removes(path): - remove(path) - head, tail = psplit(path) - if head and tail: - try: - removedirs(head) - except OSError: - pass - - -def commonify_file(common_file, files): - first, *rest = files - renames(first, common_file) - for f in rest: - removes(f) - - -async def find_files(path): - async with bounded_exec('find', 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 line[:-1].decode() - - -async def scan_one(target, files): - n = 0 - async for f in find_files(target): - files.setdefault(relpath(f, target), []).append(target) - n += 1 - logger.info('Found %d files in %r', n, target) - - -async def scan(targets): - files = {} - await gather(*[scan_one(t, files) for t in targets]) - return files - - -def arg_dir(s): - if not isdir(s): - raise ValueError(f'{s!r} is not a directory') - return s - - -async def commonify(settings, common_file, targets): - files = [pjoin(t, common_file) for t in targets] - - if not await identical(files): - logger.info("Divergent file %r", common_file) - return False - - if len(files) == len(settings.targets): - logger.debug("Identical file %r", common_file) - elif settings.mode == Mode.nonconflicting: - logger.debug("Nonconflicting file %r in %r", common_file, targets) - else: - logger.debug("Partly identical file %r in %r", common_file, targets) - return False - - if not settings.dry_run: - commonify_file(pjoin(settings.common_dir, common_file), files) - - return True - - -async def main(settings): - files = await scan(arg_dir(t) for t in settings.targets) - results = await gather(*[commonify(settings, *ft) for ft in files.items()]) - logger.info('%d %s files in %r', sum(results), settings.mode.name, settings.common_dir) - return 0 - - -if __name__ == '__main__': - prog, settings = parse_args() - basicConfig(level=DEBUG if settings.verbose else INFO, format=f"{prog}: %(message)s") - loop = get_event_loop() - exit(loop.run_until_complete(main(settings))) Copied: eclipse/repos/community-x86_64/commonify (from rev 416846, eclipse/trunk/commonify) =================================================================== --- commonify (rev 0) +++ commonify 2018-12-20 04:52:32 UTC (rev 416847) @@ -0,0 +1,184 @@ +#!/usr/bin/env python3 +from argparse import ArgumentParser +from asyncio import ( + BoundedSemaphore, + IncompleteReadError, + create_subprocess_exec, + gather, + get_running_loop, + run, +) +from asyncio.subprocess import DEVNULL, PIPE +from contextlib import asynccontextmanager +from enum import Enum, auto +from logging import DEBUG, INFO, basicConfig, getLogger +from os import cpu_count, remove, removedirs, renames +from os.path import isdir, join as pjoin, relpath, split as psplit +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("-v", "--verbose", action="store_true", help="Raise verbosity") + 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.prog, parser.parse_args(args) + + +@asynccontextmanager +async def bounded_exec(*args, **kwargs): + loop = get_running_loop() + + try: + semaphore = loop.__bounded_exec_semaphore + except AttributeError: + semaphore = loop.__bounded_exec_semaphore = BoundedSemaphore(value=cpu_count() + 1) + + async with semaphore: + process = await create_subprocess_exec(*args, **kwargs) + try: + yield process + finally: + if process.returncode is None: + try: + process.kill() + except OSError: + pass + await process.wait() + + +class DiffError(RuntimeError): + pass + + +async def diff(file1, file2): + async with bounded_exec( + "diff", "-q", file1, 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: + return False + else: + return True + finally: + fut.cancel() + + +def removes(path): + remove(path) + head, tail = psplit(path) + if head and tail: + try: + removedirs(head) + except OSError: + pass + + +def commonify_file(common_file, files): + first, *rest = files + renames(first, common_file) + for f in rest: + removes(f) + + +async def find_files(path): + async with bounded_exec( + "find", 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 line[:-1].decode() + + +async def scan_one(target, files): + n = 0 + async for f in find_files(target): + files.setdefault(relpath(f, target), []).append(target) + n += 1 + logger.info("Found %d files in %r", n, target) + + +async def scan(targets): + files = {} + await gather(*[scan_one(t, files) for t in targets]) + return files + + +def arg_dir(s): + if not isdir(s): + raise ValueError(f"{s!r} is not a directory") + return s + + +async def commonify(settings, common_file, targets): + files = [pjoin(t, common_file) for t in targets] + + if not await identical(files): + logger.info("Divergent file %r", common_file) + return False + + if len(files) == len(settings.targets): + logger.debug("Identical file %r", common_file) + elif settings.mode == Mode.nonconflicting: + logger.debug("Nonconflicting file %r in %r", common_file, targets) + else: + logger.debug("Partly identical file %r in %r", common_file, targets) + return False + + if not settings.dry_run: + commonify_file(pjoin(settings.common_dir, common_file), files) + + return True + + +async def main(settings): + files = await scan(arg_dir(t) for t in settings.targets) + results = await gather(*[commonify(settings, *ft) for ft in files.items()]) + logger.info("%d %s files in %r", sum(results), settings.mode.name, settings.common_dir) + return 0 + + +if __name__ == "__main__": + prog, settings = parse_args() + basicConfig(level=DEBUG if settings.verbose else INFO, format=f"{prog}: %(message)s") + exit(run(main(settings), debug=settings.verbose))