From 86eaf5e03289e45a95514b4f6011157972016e9d Mon Sep 17 00:00:00 2001 From: fuzzyray Date: Thu, 30 Apr 2009 21:52:45 +0000 Subject: Tagging the gentoolkit-0.2.4 release svn path=/tags/gentoolkit-0.2.4/; revision=564 --- AUTHORS | 6 + COPYING | 340 +++++ ChangeLog | 776 ++++++++++ Makefile | 85 ++ NEWS | 0 README | 46 + README.Developer | 65 + TODO | 40 + makedefs.mak | 20 + release.sh | 89 ++ src/99gentoolkit-env | 1 + src/change/AUTHORS | 5 + src/change/ChangeLog | 7 + src/change/README | 20 + src/change/change | 343 +++++ src/change/change.1 | 0 src/dep-clean/AUTHORS | 9 + src/dep-clean/ChangeLog | 13 + src/dep-clean/README | 4 + src/dep-clean/dep-clean | 164 +++ src/dep-clean/dep-clean.1 | 194 +++ src/dev-scripts/README | 2 + src/dev-scripts/included_headers.sh | 159 ++ src/dev-scripts/linking_libs.sh | 204 +++ src/distfiles-clean/AUTHORS | 6 + src/distfiles-clean/ChangeLog | 2 + src/distfiles-clean/TODO | 0 src/distfiles-clean/distfiles-clean | 78 + src/ebump/AUTHORS | 5 + src/ebump/ChangeLog | 8 + src/ebump/Makefile | 20 + src/ebump/README | 18 + src/ebump/TODO | 0 src/ebump/ebump | 356 +++++ src/ebump/ebump.1 | 110 ++ src/echangelog/AUTHORS | 1 + src/echangelog/ChangeLog | 84 ++ src/echangelog/Makefile | 23 + src/echangelog/README | 11 + src/echangelog/TODO | 0 src/echangelog/echangelog | 493 +++++++ src/echangelog/echangelog.1 | 275 ++++ src/echangelog/echangelog.pod | 136 ++ src/eclean/AUTHORS | 1 + src/eclean/ChangeLog | 27 + src/eclean/Makefile | 24 + src/eclean/THANKS | 7 + src/eclean/TODO | 16 + src/eclean/distfiles.exclude | 5 + src/eclean/eclean | 807 +++++++++++ src/eclean/eclean.1 | 176 +++ src/eclean/packages.exclude | 4 + src/ego/AUTHOR | 1 + src/ego/AUTHORS | 1 + src/ego/ChangeLog | 2 + src/ego/Makefile | 18 + src/ego/README | 2 + src/ego/TODO | 0 src/ego/ego | 86 ++ src/ekeyword/AUTHORS | 1 + src/ekeyword/ChangeLog | 37 + src/ekeyword/Makefile | 24 + src/ekeyword/README | 20 + src/ekeyword/TODO | 0 src/ekeyword/ekeyword | 114 ++ src/ekeyword/ekeyword.pod | 74 + src/epkginfo/Makefile | 17 + src/epkginfo/epkginfo | 210 +++ src/epkginfo/epkginfo.1 | 34 + src/epkgmove/AUTHORS | 2 + src/epkgmove/ChangeLog | 20 + src/epkgmove/Makefile | 20 + src/epkgmove/README | 16 + src/epkgmove/TODO | 0 src/epkgmove/epkgmove | 895 ++++++++++++ src/equery/AUTHORS | 3 + src/equery/Makefile | 20 + src/equery/README | 0 src/equery/TODO | 63 + src/equery/equery | 1846 ++++++++++++++++++++++++ src/equery/equery.1 | 278 ++++ src/equery/tests/common-functions.sh | 52 + src/equery/tests/run-all-tests.sh | 12 + src/equery/tests/test-belongs-help.out | 11 + src/equery/tests/test-belongs.sh | 24 + src/equery/tests/test-changes-help.out | 0 src/equery/tests/test-check-help.out | 3 + src/equery/tests/test-check.sh | 39 + src/equery/tests/test-depends-help.out | 8 + src/equery/tests/test-depends.sh | 27 + src/equery/tests/test-depgraph-help.out | 7 + src/equery/tests/test-depgraph.sh | 27 + src/equery/tests/test-files-help.out | 11 + src/equery/tests/test-files.sh | 61 + src/equery/tests/test-glsa-help.out | 0 src/equery/tests/test-hasuses-help.out | 9 + src/equery/tests/test-help.out | 21 + src/equery/tests/test-help.sh | 105 ++ src/equery/tests/test-list-help.out | 9 + src/equery/tests/test-list.sh | 40 + src/equery/tests/test-size-help.out | 6 + src/equery/tests/test-size.sh | 27 + src/equery/tests/test-stats-help.out | 0 src/equery/tests/test-uses-help.out | 7 + src/equery/tests/test-uses.sh | 39 + src/equery/tests/test-which-help.out | 3 + src/equery/tests/test-which.sh | 22 + src/eread/AUTHORS | 2 + src/eread/Makefile | 20 + src/eread/eread | 94 ++ src/eread/eread.1 | 12 + src/etc-update/AUTHORS | 0 src/etc-update/ChangeLog | 0 src/etc-update/Makefile | 20 + src/etc-update/README | 0 src/etc-update/etc-update | 165 +++ src/etc-update/etc-update.1 | 12 + src/etcat/AUTHORS | 5 + src/etcat/ChangeLog | 36 + src/etcat/Makefile | 18 + src/etcat/README | 2 + src/etcat/TODO | 0 src/etcat/etcat | 688 +++++++++ src/etcat/etcat.1 | 79 + src/euse/AUTHORS | 2 + src/euse/ChangeLog | 9 + src/euse/Makefile | 20 + src/euse/euse | 544 +++++++ src/euse/euse.1 | 102 ++ src/eviewcvs/AUTHORS | 1 + src/eviewcvs/Makefile | 22 + src/eviewcvs/README | 11 + src/eviewcvs/eviewcvs | 95 ++ src/eviewcvs/eviewcvs.pod | 48 + src/genpkgindex/Makefile | 18 + src/genpkgindex/genpkgindex | 336 +++++ src/genpkgindex/genpkgindex.1 | 59 + src/gensync/AUTHORS | 5 + src/gensync/ChangeLog | 12 + src/gensync/Makefile | 24 + src/gensync/README | 16 + src/gensync/TODO | 4 + src/gensync/bmg-gnome-current.syncsource | 18 + src/gensync/bmg-main.syncsource | 18 + src/gensync/gensync | 226 +++ src/gensync/gensync.1 | 75 + src/gensync/gensync.conf | 8 + src/gentoolkit/AUTHORS | 2 + src/gentoolkit/Makefile | 22 + src/gentoolkit/README | 17 + src/gentoolkit/TODO | 0 src/gentoolkit/__init__.py | 59 + src/gentoolkit/errors.py | 14 + src/gentoolkit/helpers.py | 162 +++ src/gentoolkit/package.py | 241 ++++ src/gentoolkit/pprinter.py | 116 ++ src/glsa-check/Makefile | 20 + src/glsa-check/glsa-check | 364 +++++ src/glsa-check/glsa-check.1 | 57 + src/glsa-check/glsa.py | 644 +++++++++ src/lintool/AUTHORS | 1 + src/lintool/COPYING | 340 +++++ src/lintool/ChangeLog | 71 + src/lintool/NEWS | 0 src/lintool/README | 23 + src/lintool/lintool.1 | 41 + src/lintool/lintool.py | 320 ++++ src/lintool/lintool/__init__.py | 3 + src/lintool/lintool/changelog.py | 105 ++ src/lintool/lintool/digest.py | 28 + src/lintool/lintool/ebuild.py | 349 +++++ src/lintool/lintool/test.py | 30 + src/moo/AUTHORS | 1 + src/moo/README | 0 src/moo/TODO | 0 src/moo/moo | 244 ++++ src/moo/moo.1 | 12 + src/old-scripts/Makefile | 32 + src/old-scripts/dep-clean | 272 ++++ src/old-scripts/dep-clean.1 | 190 +++ src/old-scripts/ewhich | 44 + src/old-scripts/ewhich.1 | 24 + src/old-scripts/mkebuild | 216 +++ src/old-scripts/mkebuild.1 | 20 + src/old-scripts/pkg-clean | 107 ++ src/old-scripts/pkg-clean.1 | 20 + src/old-scripts/pkg-size | 63 + src/old-scripts/pkg-size.1 | 11 + src/pkg-clean/AUTHORS | 5 + src/pkg-clean/ChangeLog | 0 src/pkg-clean/README | 0 src/pkg-clean/pkg-clean | 99 ++ src/pkg-clean/pkg-clean.1 | 20 + src/pkg-size/pkg-size | 66 + src/qpkg/AUTHORS | 0 src/qpkg/ChangeLog | 5 + src/qpkg/Makefile | 19 + src/qpkg/README | 0 src/qpkg/TODO | 0 src/qpkg/qpkg | 581 ++++++++ src/qpkg/qpkg.1 | 112 ++ src/qpkg/qpkg.sh | 520 +++++++ src/revdep-rebuild/99revdep-rebuild | 21 + src/revdep-rebuild/AUTHORS | 2 + src/revdep-rebuild/ChangeLog | 9 + src/revdep-rebuild/Makefile | 23 + src/revdep-rebuild/README | 4 + src/revdep-rebuild/TODO | 7 + src/revdep-rebuild/find_pkgs.py | 22 + src/revdep-rebuild/revdep-rebuild | 1094 ++++++++++++++ src/revdep-rebuild/revdep-rebuild-old | 720 +++++++++ src/revdep-rebuild/revdep-rebuild-sh | 332 +++++ src/revdep-rebuild/revdep-rebuild.1 | 101 ++ src/useflag/AUTHORS | 0 src/useflag/ChangeLog | 0 src/useflag/README | 0 src/useflag/useflag | 610 ++++++++ src/useflag/useflag.1 | 69 + trunk/AUTHORS | 6 - trunk/COPYING | 340 ----- trunk/ChangeLog | 776 ---------- trunk/Makefile | 85 -- trunk/NEWS | 0 trunk/README | 46 - trunk/README.Developer | 65 - trunk/TODO | 40 - trunk/makedefs.mak | 20 - trunk/release.sh | 89 -- trunk/src/99gentoolkit-env | 1 - trunk/src/change/AUTHORS | 5 - trunk/src/change/ChangeLog | 7 - trunk/src/change/README | 20 - trunk/src/change/change | 343 ----- trunk/src/change/change.1 | 0 trunk/src/dep-clean/AUTHORS | 9 - trunk/src/dep-clean/ChangeLog | 13 - trunk/src/dep-clean/README | 4 - trunk/src/dep-clean/dep-clean | 164 --- trunk/src/dep-clean/dep-clean.1 | 194 --- trunk/src/dev-scripts/README | 2 - trunk/src/dev-scripts/included_headers.sh | 159 -- trunk/src/dev-scripts/linking_libs.sh | 204 --- trunk/src/distfiles-clean/AUTHORS | 6 - trunk/src/distfiles-clean/ChangeLog | 2 - trunk/src/distfiles-clean/TODO | 0 trunk/src/distfiles-clean/distfiles-clean | 78 - trunk/src/ebump/AUTHORS | 5 - trunk/src/ebump/ChangeLog | 8 - trunk/src/ebump/Makefile | 20 - trunk/src/ebump/README | 18 - trunk/src/ebump/TODO | 0 trunk/src/ebump/ebump | 356 ----- trunk/src/ebump/ebump.1 | 110 -- trunk/src/echangelog/AUTHORS | 1 - trunk/src/echangelog/ChangeLog | 84 -- trunk/src/echangelog/Makefile | 23 - trunk/src/echangelog/README | 11 - trunk/src/echangelog/TODO | 0 trunk/src/echangelog/echangelog | 493 ------- trunk/src/echangelog/echangelog.1 | 275 ---- trunk/src/echangelog/echangelog.pod | 136 -- trunk/src/eclean/AUTHORS | 1 - trunk/src/eclean/ChangeLog | 27 - trunk/src/eclean/Makefile | 24 - trunk/src/eclean/THANKS | 7 - trunk/src/eclean/TODO | 16 - trunk/src/eclean/distfiles.exclude | 5 - trunk/src/eclean/eclean | 807 ----------- trunk/src/eclean/eclean.1 | 176 --- trunk/src/eclean/packages.exclude | 4 - trunk/src/ego/AUTHOR | 1 - trunk/src/ego/AUTHORS | 1 - trunk/src/ego/ChangeLog | 2 - trunk/src/ego/Makefile | 18 - trunk/src/ego/README | 2 - trunk/src/ego/TODO | 0 trunk/src/ego/ego | 86 -- trunk/src/ekeyword/AUTHORS | 1 - trunk/src/ekeyword/ChangeLog | 37 - trunk/src/ekeyword/Makefile | 24 - trunk/src/ekeyword/README | 20 - trunk/src/ekeyword/TODO | 0 trunk/src/ekeyword/ekeyword | 114 -- trunk/src/ekeyword/ekeyword.pod | 74 - trunk/src/epkginfo/Makefile | 17 - trunk/src/epkginfo/epkginfo | 210 --- trunk/src/epkginfo/epkginfo.1 | 34 - trunk/src/epkgmove/AUTHORS | 2 - trunk/src/epkgmove/ChangeLog | 20 - trunk/src/epkgmove/Makefile | 20 - trunk/src/epkgmove/README | 16 - trunk/src/epkgmove/TODO | 0 trunk/src/epkgmove/epkgmove | 895 ------------ trunk/src/equery/AUTHORS | 3 - trunk/src/equery/Makefile | 20 - trunk/src/equery/README | 0 trunk/src/equery/TODO | 63 - trunk/src/equery/equery | 1846 ------------------------ trunk/src/equery/equery.1 | 278 ---- trunk/src/equery/tests/common-functions.sh | 52 - trunk/src/equery/tests/run-all-tests.sh | 12 - trunk/src/equery/tests/test-belongs-help.out | 11 - trunk/src/equery/tests/test-belongs.sh | 24 - trunk/src/equery/tests/test-changes-help.out | 0 trunk/src/equery/tests/test-check-help.out | 3 - trunk/src/equery/tests/test-check.sh | 39 - trunk/src/equery/tests/test-depends-help.out | 8 - trunk/src/equery/tests/test-depends.sh | 27 - trunk/src/equery/tests/test-depgraph-help.out | 7 - trunk/src/equery/tests/test-depgraph.sh | 27 - trunk/src/equery/tests/test-files-help.out | 11 - trunk/src/equery/tests/test-files.sh | 61 - trunk/src/equery/tests/test-glsa-help.out | 0 trunk/src/equery/tests/test-hasuses-help.out | 9 - trunk/src/equery/tests/test-help.out | 21 - trunk/src/equery/tests/test-help.sh | 105 -- trunk/src/equery/tests/test-list-help.out | 9 - trunk/src/equery/tests/test-list.sh | 40 - trunk/src/equery/tests/test-size-help.out | 6 - trunk/src/equery/tests/test-size.sh | 27 - trunk/src/equery/tests/test-stats-help.out | 0 trunk/src/equery/tests/test-uses-help.out | 7 - trunk/src/equery/tests/test-uses.sh | 39 - trunk/src/equery/tests/test-which-help.out | 3 - trunk/src/equery/tests/test-which.sh | 22 - trunk/src/eread/AUTHORS | 2 - trunk/src/eread/Makefile | 20 - trunk/src/eread/eread | 94 -- trunk/src/eread/eread.1 | 12 - trunk/src/etc-update/AUTHORS | 0 trunk/src/etc-update/ChangeLog | 0 trunk/src/etc-update/Makefile | 20 - trunk/src/etc-update/README | 0 trunk/src/etc-update/etc-update | 165 --- trunk/src/etc-update/etc-update.1 | 12 - trunk/src/etcat/AUTHORS | 5 - trunk/src/etcat/ChangeLog | 36 - trunk/src/etcat/Makefile | 18 - trunk/src/etcat/README | 2 - trunk/src/etcat/TODO | 0 trunk/src/etcat/etcat | 688 --------- trunk/src/etcat/etcat.1 | 79 - trunk/src/euse/AUTHORS | 2 - trunk/src/euse/ChangeLog | 9 - trunk/src/euse/Makefile | 20 - trunk/src/euse/euse | 544 ------- trunk/src/euse/euse.1 | 102 -- trunk/src/eviewcvs/AUTHORS | 1 - trunk/src/eviewcvs/Makefile | 22 - trunk/src/eviewcvs/README | 11 - trunk/src/eviewcvs/eviewcvs | 95 -- trunk/src/eviewcvs/eviewcvs.pod | 48 - trunk/src/genpkgindex/Makefile | 18 - trunk/src/genpkgindex/genpkgindex | 336 ----- trunk/src/genpkgindex/genpkgindex.1 | 59 - trunk/src/gensync/AUTHORS | 5 - trunk/src/gensync/ChangeLog | 12 - trunk/src/gensync/Makefile | 24 - trunk/src/gensync/README | 16 - trunk/src/gensync/TODO | 4 - trunk/src/gensync/bmg-gnome-current.syncsource | 18 - trunk/src/gensync/bmg-main.syncsource | 18 - trunk/src/gensync/gensync | 226 --- trunk/src/gensync/gensync.1 | 75 - trunk/src/gensync/gensync.conf | 8 - trunk/src/gentoolkit/AUTHORS | 2 - trunk/src/gentoolkit/Makefile | 22 - trunk/src/gentoolkit/README | 17 - trunk/src/gentoolkit/TODO | 0 trunk/src/gentoolkit/__init__.py | 59 - trunk/src/gentoolkit/errors.py | 14 - trunk/src/gentoolkit/helpers.py | 162 --- trunk/src/gentoolkit/package.py | 241 ---- trunk/src/gentoolkit/pprinter.py | 116 -- trunk/src/glsa-check/Makefile | 20 - trunk/src/glsa-check/glsa-check | 364 ----- trunk/src/glsa-check/glsa-check.1 | 57 - trunk/src/glsa-check/glsa.py | 644 --------- trunk/src/lintool/AUTHORS | 1 - trunk/src/lintool/COPYING | 340 ----- trunk/src/lintool/ChangeLog | 71 - trunk/src/lintool/NEWS | 0 trunk/src/lintool/README | 23 - trunk/src/lintool/lintool.1 | 41 - trunk/src/lintool/lintool.py | 320 ---- trunk/src/lintool/lintool/__init__.py | 3 - trunk/src/lintool/lintool/changelog.py | 105 -- trunk/src/lintool/lintool/digest.py | 28 - trunk/src/lintool/lintool/ebuild.py | 349 ----- trunk/src/lintool/lintool/test.py | 30 - trunk/src/moo/AUTHORS | 1 - trunk/src/moo/README | 0 trunk/src/moo/TODO | 0 trunk/src/moo/moo | 244 ---- trunk/src/moo/moo.1 | 12 - trunk/src/old-scripts/Makefile | 32 - trunk/src/old-scripts/dep-clean | 272 ---- trunk/src/old-scripts/dep-clean.1 | 190 --- trunk/src/old-scripts/ewhich | 44 - trunk/src/old-scripts/ewhich.1 | 24 - trunk/src/old-scripts/mkebuild | 216 --- trunk/src/old-scripts/mkebuild.1 | 20 - trunk/src/old-scripts/pkg-clean | 107 -- trunk/src/old-scripts/pkg-clean.1 | 20 - trunk/src/old-scripts/pkg-size | 63 - trunk/src/old-scripts/pkg-size.1 | 11 - trunk/src/pkg-clean/AUTHORS | 5 - trunk/src/pkg-clean/ChangeLog | 0 trunk/src/pkg-clean/README | 0 trunk/src/pkg-clean/pkg-clean | 99 -- trunk/src/pkg-clean/pkg-clean.1 | 20 - trunk/src/pkg-size/pkg-size | 66 - trunk/src/qpkg/AUTHORS | 0 trunk/src/qpkg/ChangeLog | 5 - trunk/src/qpkg/Makefile | 19 - trunk/src/qpkg/README | 0 trunk/src/qpkg/TODO | 0 trunk/src/qpkg/qpkg | 581 -------- trunk/src/qpkg/qpkg.1 | 112 -- trunk/src/qpkg/qpkg.sh | 520 ------- trunk/src/revdep-rebuild/99revdep-rebuild | 21 - trunk/src/revdep-rebuild/AUTHORS | 2 - trunk/src/revdep-rebuild/ChangeLog | 9 - trunk/src/revdep-rebuild/Makefile | 23 - trunk/src/revdep-rebuild/README | 4 - trunk/src/revdep-rebuild/TODO | 7 - trunk/src/revdep-rebuild/find_pkgs.py | 22 - trunk/src/revdep-rebuild/revdep-rebuild | 1094 -------------- trunk/src/revdep-rebuild/revdep-rebuild-old | 720 --------- trunk/src/revdep-rebuild/revdep-rebuild-sh | 332 ----- trunk/src/revdep-rebuild/revdep-rebuild.1 | 101 -- trunk/src/useflag/AUTHORS | 0 trunk/src/useflag/ChangeLog | 0 trunk/src/useflag/README | 0 trunk/src/useflag/useflag | 610 -------- trunk/src/useflag/useflag.1 | 69 - 436 files changed, 21211 insertions(+), 21211 deletions(-) create mode 100644 AUTHORS create mode 100644 COPYING create mode 100644 ChangeLog create mode 100644 Makefile create mode 100644 NEWS create mode 100644 README create mode 100644 README.Developer create mode 100644 TODO create mode 100644 makedefs.mak create mode 100755 release.sh create mode 100644 src/99gentoolkit-env create mode 100644 src/change/AUTHORS create mode 100644 src/change/ChangeLog create mode 100644 src/change/README create mode 100644 src/change/change create mode 100644 src/change/change.1 create mode 100644 src/dep-clean/AUTHORS create mode 100644 src/dep-clean/ChangeLog create mode 100644 src/dep-clean/README create mode 100644 src/dep-clean/dep-clean create mode 100644 src/dep-clean/dep-clean.1 create mode 100644 src/dev-scripts/README create mode 100755 src/dev-scripts/included_headers.sh create mode 100755 src/dev-scripts/linking_libs.sh create mode 100644 src/distfiles-clean/AUTHORS create mode 100644 src/distfiles-clean/ChangeLog create mode 100644 src/distfiles-clean/TODO create mode 100644 src/distfiles-clean/distfiles-clean create mode 100644 src/ebump/AUTHORS create mode 100644 src/ebump/ChangeLog create mode 100644 src/ebump/Makefile create mode 100644 src/ebump/README create mode 100644 src/ebump/TODO create mode 100755 src/ebump/ebump create mode 100644 src/ebump/ebump.1 create mode 100644 src/echangelog/AUTHORS create mode 100644 src/echangelog/ChangeLog create mode 100644 src/echangelog/Makefile create mode 100644 src/echangelog/README create mode 100644 src/echangelog/TODO create mode 100644 src/echangelog/echangelog create mode 100644 src/echangelog/echangelog.1 create mode 100644 src/echangelog/echangelog.pod create mode 100644 src/eclean/AUTHORS create mode 100644 src/eclean/ChangeLog create mode 100644 src/eclean/Makefile create mode 100644 src/eclean/THANKS create mode 100644 src/eclean/TODO create mode 100644 src/eclean/distfiles.exclude create mode 100644 src/eclean/eclean create mode 100644 src/eclean/eclean.1 create mode 100644 src/eclean/packages.exclude create mode 100644 src/ego/AUTHOR create mode 100644 src/ego/AUTHORS create mode 100644 src/ego/ChangeLog create mode 100644 src/ego/Makefile create mode 100644 src/ego/README create mode 100644 src/ego/TODO create mode 100644 src/ego/ego create mode 100644 src/ekeyword/AUTHORS create mode 100644 src/ekeyword/ChangeLog create mode 100644 src/ekeyword/Makefile create mode 100644 src/ekeyword/README create mode 100644 src/ekeyword/TODO create mode 100644 src/ekeyword/ekeyword create mode 100644 src/ekeyword/ekeyword.pod create mode 100644 src/epkginfo/Makefile create mode 100755 src/epkginfo/epkginfo create mode 100644 src/epkginfo/epkginfo.1 create mode 100644 src/epkgmove/AUTHORS create mode 100644 src/epkgmove/ChangeLog create mode 100644 src/epkgmove/Makefile create mode 100644 src/epkgmove/README create mode 100644 src/epkgmove/TODO create mode 100644 src/epkgmove/epkgmove create mode 100644 src/equery/AUTHORS create mode 100644 src/equery/Makefile create mode 100644 src/equery/README create mode 100644 src/equery/TODO create mode 100755 src/equery/equery create mode 100644 src/equery/equery.1 create mode 100644 src/equery/tests/common-functions.sh create mode 100755 src/equery/tests/run-all-tests.sh create mode 100644 src/equery/tests/test-belongs-help.out create mode 100755 src/equery/tests/test-belongs.sh create mode 100644 src/equery/tests/test-changes-help.out create mode 100644 src/equery/tests/test-check-help.out create mode 100755 src/equery/tests/test-check.sh create mode 100644 src/equery/tests/test-depends-help.out create mode 100755 src/equery/tests/test-depends.sh create mode 100644 src/equery/tests/test-depgraph-help.out create mode 100755 src/equery/tests/test-depgraph.sh create mode 100644 src/equery/tests/test-files-help.out create mode 100755 src/equery/tests/test-files.sh create mode 100644 src/equery/tests/test-glsa-help.out create mode 100644 src/equery/tests/test-hasuses-help.out create mode 100644 src/equery/tests/test-help.out create mode 100755 src/equery/tests/test-help.sh create mode 100644 src/equery/tests/test-list-help.out create mode 100755 src/equery/tests/test-list.sh create mode 100644 src/equery/tests/test-size-help.out create mode 100755 src/equery/tests/test-size.sh create mode 100644 src/equery/tests/test-stats-help.out create mode 100644 src/equery/tests/test-uses-help.out create mode 100755 src/equery/tests/test-uses.sh create mode 100644 src/equery/tests/test-which-help.out create mode 100755 src/equery/tests/test-which.sh create mode 100644 src/eread/AUTHORS create mode 100644 src/eread/Makefile create mode 100755 src/eread/eread create mode 100644 src/eread/eread.1 create mode 100644 src/etc-update/AUTHORS create mode 100644 src/etc-update/ChangeLog create mode 100644 src/etc-update/Makefile create mode 100644 src/etc-update/README create mode 100755 src/etc-update/etc-update create mode 100644 src/etc-update/etc-update.1 create mode 100644 src/etcat/AUTHORS create mode 100644 src/etcat/ChangeLog create mode 100644 src/etcat/Makefile create mode 100644 src/etcat/README create mode 100644 src/etcat/TODO create mode 100755 src/etcat/etcat create mode 100644 src/etcat/etcat.1 create mode 100644 src/euse/AUTHORS create mode 100644 src/euse/ChangeLog create mode 100644 src/euse/Makefile create mode 100755 src/euse/euse create mode 100644 src/euse/euse.1 create mode 100644 src/eviewcvs/AUTHORS create mode 100644 src/eviewcvs/Makefile create mode 100644 src/eviewcvs/README create mode 100755 src/eviewcvs/eviewcvs create mode 100644 src/eviewcvs/eviewcvs.pod create mode 100644 src/genpkgindex/Makefile create mode 100644 src/genpkgindex/genpkgindex create mode 100644 src/genpkgindex/genpkgindex.1 create mode 100644 src/gensync/AUTHORS create mode 100644 src/gensync/ChangeLog create mode 100644 src/gensync/Makefile create mode 100644 src/gensync/README create mode 100644 src/gensync/TODO create mode 100644 src/gensync/bmg-gnome-current.syncsource create mode 100644 src/gensync/bmg-main.syncsource create mode 100755 src/gensync/gensync create mode 100644 src/gensync/gensync.1 create mode 100644 src/gensync/gensync.conf create mode 100644 src/gentoolkit/AUTHORS create mode 100644 src/gentoolkit/Makefile create mode 100644 src/gentoolkit/README create mode 100644 src/gentoolkit/TODO create mode 100644 src/gentoolkit/__init__.py create mode 100644 src/gentoolkit/errors.py create mode 100644 src/gentoolkit/helpers.py create mode 100644 src/gentoolkit/package.py create mode 100644 src/gentoolkit/pprinter.py create mode 100644 src/glsa-check/Makefile create mode 100644 src/glsa-check/glsa-check create mode 100644 src/glsa-check/glsa-check.1 create mode 100644 src/glsa-check/glsa.py create mode 100644 src/lintool/AUTHORS create mode 100644 src/lintool/COPYING create mode 100644 src/lintool/ChangeLog create mode 100644 src/lintool/NEWS create mode 100644 src/lintool/README create mode 100644 src/lintool/lintool.1 create mode 100755 src/lintool/lintool.py create mode 100644 src/lintool/lintool/__init__.py create mode 100644 src/lintool/lintool/changelog.py create mode 100644 src/lintool/lintool/digest.py create mode 100644 src/lintool/lintool/ebuild.py create mode 100644 src/lintool/lintool/test.py create mode 100644 src/moo/AUTHORS create mode 100644 src/moo/README create mode 100644 src/moo/TODO create mode 100755 src/moo/moo create mode 100644 src/moo/moo.1 create mode 100644 src/old-scripts/Makefile create mode 100644 src/old-scripts/dep-clean create mode 100644 src/old-scripts/dep-clean.1 create mode 100755 src/old-scripts/ewhich create mode 100644 src/old-scripts/ewhich.1 create mode 100644 src/old-scripts/mkebuild create mode 100644 src/old-scripts/mkebuild.1 create mode 100644 src/old-scripts/pkg-clean create mode 100644 src/old-scripts/pkg-clean.1 create mode 100644 src/old-scripts/pkg-size create mode 100644 src/old-scripts/pkg-size.1 create mode 100644 src/pkg-clean/AUTHORS create mode 100644 src/pkg-clean/ChangeLog create mode 100644 src/pkg-clean/README create mode 100644 src/pkg-clean/pkg-clean create mode 100644 src/pkg-clean/pkg-clean.1 create mode 100644 src/pkg-size/pkg-size create mode 100644 src/qpkg/AUTHORS create mode 100644 src/qpkg/ChangeLog create mode 100644 src/qpkg/Makefile create mode 100644 src/qpkg/README create mode 100644 src/qpkg/TODO create mode 100644 src/qpkg/qpkg create mode 100644 src/qpkg/qpkg.1 create mode 100644 src/qpkg/qpkg.sh create mode 100644 src/revdep-rebuild/99revdep-rebuild create mode 100644 src/revdep-rebuild/AUTHORS create mode 100644 src/revdep-rebuild/ChangeLog create mode 100644 src/revdep-rebuild/Makefile create mode 100644 src/revdep-rebuild/README create mode 100644 src/revdep-rebuild/TODO create mode 100755 src/revdep-rebuild/find_pkgs.py create mode 100755 src/revdep-rebuild/revdep-rebuild create mode 100755 src/revdep-rebuild/revdep-rebuild-old create mode 100755 src/revdep-rebuild/revdep-rebuild-sh create mode 100644 src/revdep-rebuild/revdep-rebuild.1 create mode 100644 src/useflag/AUTHORS create mode 100644 src/useflag/ChangeLog create mode 100644 src/useflag/README create mode 100644 src/useflag/useflag create mode 100644 src/useflag/useflag.1 delete mode 100644 trunk/AUTHORS delete mode 100644 trunk/COPYING delete mode 100644 trunk/ChangeLog delete mode 100644 trunk/Makefile delete mode 100644 trunk/NEWS delete mode 100644 trunk/README delete mode 100644 trunk/README.Developer delete mode 100644 trunk/TODO delete mode 100644 trunk/makedefs.mak delete mode 100755 trunk/release.sh delete mode 100644 trunk/src/99gentoolkit-env delete mode 100644 trunk/src/change/AUTHORS delete mode 100644 trunk/src/change/ChangeLog delete mode 100644 trunk/src/change/README delete mode 100644 trunk/src/change/change delete mode 100644 trunk/src/change/change.1 delete mode 100644 trunk/src/dep-clean/AUTHORS delete mode 100644 trunk/src/dep-clean/ChangeLog delete mode 100644 trunk/src/dep-clean/README delete mode 100644 trunk/src/dep-clean/dep-clean delete mode 100644 trunk/src/dep-clean/dep-clean.1 delete mode 100644 trunk/src/dev-scripts/README delete mode 100755 trunk/src/dev-scripts/included_headers.sh delete mode 100755 trunk/src/dev-scripts/linking_libs.sh delete mode 100644 trunk/src/distfiles-clean/AUTHORS delete mode 100644 trunk/src/distfiles-clean/ChangeLog delete mode 100644 trunk/src/distfiles-clean/TODO delete mode 100644 trunk/src/distfiles-clean/distfiles-clean delete mode 100644 trunk/src/ebump/AUTHORS delete mode 100644 trunk/src/ebump/ChangeLog delete mode 100644 trunk/src/ebump/Makefile delete mode 100644 trunk/src/ebump/README delete mode 100644 trunk/src/ebump/TODO delete mode 100755 trunk/src/ebump/ebump delete mode 100644 trunk/src/ebump/ebump.1 delete mode 100644 trunk/src/echangelog/AUTHORS delete mode 100644 trunk/src/echangelog/ChangeLog delete mode 100644 trunk/src/echangelog/Makefile delete mode 100644 trunk/src/echangelog/README delete mode 100644 trunk/src/echangelog/TODO delete mode 100644 trunk/src/echangelog/echangelog delete mode 100644 trunk/src/echangelog/echangelog.1 delete mode 100644 trunk/src/echangelog/echangelog.pod delete mode 100644 trunk/src/eclean/AUTHORS delete mode 100644 trunk/src/eclean/ChangeLog delete mode 100644 trunk/src/eclean/Makefile delete mode 100644 trunk/src/eclean/THANKS delete mode 100644 trunk/src/eclean/TODO delete mode 100644 trunk/src/eclean/distfiles.exclude delete mode 100644 trunk/src/eclean/eclean delete mode 100644 trunk/src/eclean/eclean.1 delete mode 100644 trunk/src/eclean/packages.exclude delete mode 100644 trunk/src/ego/AUTHOR delete mode 100644 trunk/src/ego/AUTHORS delete mode 100644 trunk/src/ego/ChangeLog delete mode 100644 trunk/src/ego/Makefile delete mode 100644 trunk/src/ego/README delete mode 100644 trunk/src/ego/TODO delete mode 100644 trunk/src/ego/ego delete mode 100644 trunk/src/ekeyword/AUTHORS delete mode 100644 trunk/src/ekeyword/ChangeLog delete mode 100644 trunk/src/ekeyword/Makefile delete mode 100644 trunk/src/ekeyword/README delete mode 100644 trunk/src/ekeyword/TODO delete mode 100644 trunk/src/ekeyword/ekeyword delete mode 100644 trunk/src/ekeyword/ekeyword.pod delete mode 100644 trunk/src/epkginfo/Makefile delete mode 100755 trunk/src/epkginfo/epkginfo delete mode 100644 trunk/src/epkginfo/epkginfo.1 delete mode 100644 trunk/src/epkgmove/AUTHORS delete mode 100644 trunk/src/epkgmove/ChangeLog delete mode 100644 trunk/src/epkgmove/Makefile delete mode 100644 trunk/src/epkgmove/README delete mode 100644 trunk/src/epkgmove/TODO delete mode 100644 trunk/src/epkgmove/epkgmove delete mode 100644 trunk/src/equery/AUTHORS delete mode 100644 trunk/src/equery/Makefile delete mode 100644 trunk/src/equery/README delete mode 100644 trunk/src/equery/TODO delete mode 100755 trunk/src/equery/equery delete mode 100644 trunk/src/equery/equery.1 delete mode 100644 trunk/src/equery/tests/common-functions.sh delete mode 100755 trunk/src/equery/tests/run-all-tests.sh delete mode 100644 trunk/src/equery/tests/test-belongs-help.out delete mode 100755 trunk/src/equery/tests/test-belongs.sh delete mode 100644 trunk/src/equery/tests/test-changes-help.out delete mode 100644 trunk/src/equery/tests/test-check-help.out delete mode 100755 trunk/src/equery/tests/test-check.sh delete mode 100644 trunk/src/equery/tests/test-depends-help.out delete mode 100755 trunk/src/equery/tests/test-depends.sh delete mode 100644 trunk/src/equery/tests/test-depgraph-help.out delete mode 100755 trunk/src/equery/tests/test-depgraph.sh delete mode 100644 trunk/src/equery/tests/test-files-help.out delete mode 100755 trunk/src/equery/tests/test-files.sh delete mode 100644 trunk/src/equery/tests/test-glsa-help.out delete mode 100644 trunk/src/equery/tests/test-hasuses-help.out delete mode 100644 trunk/src/equery/tests/test-help.out delete mode 100755 trunk/src/equery/tests/test-help.sh delete mode 100644 trunk/src/equery/tests/test-list-help.out delete mode 100755 trunk/src/equery/tests/test-list.sh delete mode 100644 trunk/src/equery/tests/test-size-help.out delete mode 100755 trunk/src/equery/tests/test-size.sh delete mode 100644 trunk/src/equery/tests/test-stats-help.out delete mode 100644 trunk/src/equery/tests/test-uses-help.out delete mode 100755 trunk/src/equery/tests/test-uses.sh delete mode 100644 trunk/src/equery/tests/test-which-help.out delete mode 100755 trunk/src/equery/tests/test-which.sh delete mode 100644 trunk/src/eread/AUTHORS delete mode 100644 trunk/src/eread/Makefile delete mode 100755 trunk/src/eread/eread delete mode 100644 trunk/src/eread/eread.1 delete mode 100644 trunk/src/etc-update/AUTHORS delete mode 100644 trunk/src/etc-update/ChangeLog delete mode 100644 trunk/src/etc-update/Makefile delete mode 100644 trunk/src/etc-update/README delete mode 100755 trunk/src/etc-update/etc-update delete mode 100644 trunk/src/etc-update/etc-update.1 delete mode 100644 trunk/src/etcat/AUTHORS delete mode 100644 trunk/src/etcat/ChangeLog delete mode 100644 trunk/src/etcat/Makefile delete mode 100644 trunk/src/etcat/README delete mode 100644 trunk/src/etcat/TODO delete mode 100755 trunk/src/etcat/etcat delete mode 100644 trunk/src/etcat/etcat.1 delete mode 100644 trunk/src/euse/AUTHORS delete mode 100644 trunk/src/euse/ChangeLog delete mode 100644 trunk/src/euse/Makefile delete mode 100755 trunk/src/euse/euse delete mode 100644 trunk/src/euse/euse.1 delete mode 100644 trunk/src/eviewcvs/AUTHORS delete mode 100644 trunk/src/eviewcvs/Makefile delete mode 100644 trunk/src/eviewcvs/README delete mode 100755 trunk/src/eviewcvs/eviewcvs delete mode 100644 trunk/src/eviewcvs/eviewcvs.pod delete mode 100644 trunk/src/genpkgindex/Makefile delete mode 100644 trunk/src/genpkgindex/genpkgindex delete mode 100644 trunk/src/genpkgindex/genpkgindex.1 delete mode 100644 trunk/src/gensync/AUTHORS delete mode 100644 trunk/src/gensync/ChangeLog delete mode 100644 trunk/src/gensync/Makefile delete mode 100644 trunk/src/gensync/README delete mode 100644 trunk/src/gensync/TODO delete mode 100644 trunk/src/gensync/bmg-gnome-current.syncsource delete mode 100644 trunk/src/gensync/bmg-main.syncsource delete mode 100755 trunk/src/gensync/gensync delete mode 100644 trunk/src/gensync/gensync.1 delete mode 100644 trunk/src/gensync/gensync.conf delete mode 100644 trunk/src/gentoolkit/AUTHORS delete mode 100644 trunk/src/gentoolkit/Makefile delete mode 100644 trunk/src/gentoolkit/README delete mode 100644 trunk/src/gentoolkit/TODO delete mode 100644 trunk/src/gentoolkit/__init__.py delete mode 100644 trunk/src/gentoolkit/errors.py delete mode 100644 trunk/src/gentoolkit/helpers.py delete mode 100644 trunk/src/gentoolkit/package.py delete mode 100644 trunk/src/gentoolkit/pprinter.py delete mode 100644 trunk/src/glsa-check/Makefile delete mode 100644 trunk/src/glsa-check/glsa-check delete mode 100644 trunk/src/glsa-check/glsa-check.1 delete mode 100644 trunk/src/glsa-check/glsa.py delete mode 100644 trunk/src/lintool/AUTHORS delete mode 100644 trunk/src/lintool/COPYING delete mode 100644 trunk/src/lintool/ChangeLog delete mode 100644 trunk/src/lintool/NEWS delete mode 100644 trunk/src/lintool/README delete mode 100644 trunk/src/lintool/lintool.1 delete mode 100755 trunk/src/lintool/lintool.py delete mode 100644 trunk/src/lintool/lintool/__init__.py delete mode 100644 trunk/src/lintool/lintool/changelog.py delete mode 100644 trunk/src/lintool/lintool/digest.py delete mode 100644 trunk/src/lintool/lintool/ebuild.py delete mode 100644 trunk/src/lintool/lintool/test.py delete mode 100644 trunk/src/moo/AUTHORS delete mode 100644 trunk/src/moo/README delete mode 100644 trunk/src/moo/TODO delete mode 100755 trunk/src/moo/moo delete mode 100644 trunk/src/moo/moo.1 delete mode 100644 trunk/src/old-scripts/Makefile delete mode 100644 trunk/src/old-scripts/dep-clean delete mode 100644 trunk/src/old-scripts/dep-clean.1 delete mode 100755 trunk/src/old-scripts/ewhich delete mode 100644 trunk/src/old-scripts/ewhich.1 delete mode 100644 trunk/src/old-scripts/mkebuild delete mode 100644 trunk/src/old-scripts/mkebuild.1 delete mode 100644 trunk/src/old-scripts/pkg-clean delete mode 100644 trunk/src/old-scripts/pkg-clean.1 delete mode 100644 trunk/src/old-scripts/pkg-size delete mode 100644 trunk/src/old-scripts/pkg-size.1 delete mode 100644 trunk/src/pkg-clean/AUTHORS delete mode 100644 trunk/src/pkg-clean/ChangeLog delete mode 100644 trunk/src/pkg-clean/README delete mode 100644 trunk/src/pkg-clean/pkg-clean delete mode 100644 trunk/src/pkg-clean/pkg-clean.1 delete mode 100644 trunk/src/pkg-size/pkg-size delete mode 100644 trunk/src/qpkg/AUTHORS delete mode 100644 trunk/src/qpkg/ChangeLog delete mode 100644 trunk/src/qpkg/Makefile delete mode 100644 trunk/src/qpkg/README delete mode 100644 trunk/src/qpkg/TODO delete mode 100644 trunk/src/qpkg/qpkg delete mode 100644 trunk/src/qpkg/qpkg.1 delete mode 100644 trunk/src/qpkg/qpkg.sh delete mode 100644 trunk/src/revdep-rebuild/99revdep-rebuild delete mode 100644 trunk/src/revdep-rebuild/AUTHORS delete mode 100644 trunk/src/revdep-rebuild/ChangeLog delete mode 100644 trunk/src/revdep-rebuild/Makefile delete mode 100644 trunk/src/revdep-rebuild/README delete mode 100644 trunk/src/revdep-rebuild/TODO delete mode 100755 trunk/src/revdep-rebuild/find_pkgs.py delete mode 100755 trunk/src/revdep-rebuild/revdep-rebuild delete mode 100755 trunk/src/revdep-rebuild/revdep-rebuild-old delete mode 100755 trunk/src/revdep-rebuild/revdep-rebuild-sh delete mode 100644 trunk/src/revdep-rebuild/revdep-rebuild.1 delete mode 100644 trunk/src/useflag/AUTHORS delete mode 100644 trunk/src/useflag/ChangeLog delete mode 100644 trunk/src/useflag/README delete mode 100644 trunk/src/useflag/useflag delete mode 100644 trunk/src/useflag/useflag.1 diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 0000000..fdfccf3 --- /dev/null +++ b/AUTHORS @@ -0,0 +1,6 @@ +Karl Trygve Kalleberg + * Maintenance + +See the AUTHOR file in the various src/ subdirectories for a full +log of who's done what with whome and when. + diff --git a/COPYING b/COPYING new file mode 100644 index 0000000..60549be --- /dev/null +++ b/COPYING @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) 19yy + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) 19yy name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/ChangeLog b/ChangeLog new file mode 100644 index 0000000..b100110 --- /dev/null +++ b/ChangeLog @@ -0,0 +1,776 @@ +2008-08-26: Paul Varner + * glsa-check: Fix has_key() deprecation message. (Bug #232797) + * revdep-rebuild: Update fix for Bug 232270 to utilize better patch + from Ian Abbott. + +2008-08-22: Paul Varner + * gentoolkit: Fix find_packages and find_installed_packages to print + a warning instead of a traceback when an InvalidAtom exception occurs. + (Bug #234358) + * equery: Fix equery belongs to strip multiple slashes from path + names. (Bug #234584) + +2008-07-24: Paul Varner + * equery: Fix equery check to convert mtime to an integer so that + comparisions always work. Thanks to Alexey Parshin for discovering the + problem and providing a patch. (Bug 232803) + +2008-07-22: Paul Varner + * gentoolkit: Fix gentoolkit.split_package_name to work with + newer portage.catpkgsplit that now returns a tuple instead of a + list. (Bug 232599) + +2008-07-21: Paul Varner + * revdep-rebuild: Fix filtering of masked paths from SEARCH_DIRS + variable. (Bug 232270) + +2008-07-18: Paul Varner + * equery: Remove prefixed '+/-' signs from IUSE for equery uses + command. (Bug 232019) + +2008-07-09: Paul Varner + * revdep-rebuild: Fix revdep-rebuild to use TMPDIR instead of HOME for + temporary files. (Bug 203414) + * revdep-rebuild: Fix revdep-rebuild to not evaluate broken objects + multiple times. (Bug 220761) + +2008-07-09: Paul Varner + * gentoolkit: Fix gentoolkit to work without thread support in + python. (Bug 223255) + +2008-06-16: Marius Mauch + * euse: Add support for multi-parent profiles, account for missing + final newline in make.conf + +2008-03-19: Paul Varner + * glsa-check: Fix imports so mail functionality in glsa-check works + with python versions less than 2.5 (Bug 211706) + +2008-03-13: Paul Varner + * euse: Add --info-installed option from patch provided by Andreas + Waidler. (Bug 212573) + +2008-03-13: Paul Varner + * revdep-rebuild: Fix trying to emerge an empty list of packages. (Bug + 213294) + +2008-02-28: Paul Varner + * gentoolkit: Fix traceback when accessing the portage + db. (Bug #211716) + +2008-02-21: Paul Varner + * revdep-rebuild: "Use /etc/init.d/functions.sh instead of + /sbin/functions.sh. (Bug 210940) + +2008-02-18: Paul Varner + * revdep-rebuild: Apply patch to allow combined short options. + (Bug 188343) + * revdep-rebuild: Don't duplicate broken file output. (Bug 201319) + * revdep-rebuild: unset GREP_OPTIONS to prevent problems with grep. + (Bug 189257) + * revdep-rebuild: Apply patch to prevent false matches of object names. + (Bug 196460) + * revdep-rebuild: Apply patch to better handle masked and removed + packages. (Bug 205227) + * revdep-rebuild: Filter SEARCH_DIRS_MASK paths from SEARCH_DIRS. + (Bug 194993) + * revdep-rebuild: Apply patch for revdep-rebuild portable find function. + (Bug 194234) + * equery: Fix equery list to not generate an internal portage error when + fed input with too many slashes. (Bug 119806) + * equery: Assume the -p flag when equery list -I is used by itself. + (Bug 106278) + + +2007-10-09: Marius Mauch + * glsa-check: Change "affected" target so it's based on "new" instead of + "all" (IOW: exclude already applied/injected GLSAs). + +2007-10-05: Marius Mauch + * glsa-check: Use UTF-8 strings to avoid EncodeErrors if a GLSA contains + non-ascii characters (bug #162493) + +2007-09-19: Paul Varner + * epkginfo: Fix handling of KEYWORDS="" in an ebuild. (Bug #193108) + * revdep-rebuild: Fix handling of /var/db/pkg when it is a symbolic + link. (Bug #179392) + +2007-09-18: Paul Varner + * equery: Apply patch from Carlo Marcelo Arenas Belon to fix incorrect + display of masking status in list command. (Bug #188678) + * revdep-rebuild: Correctly handle LD_LIBRARY_MASK when checking for + "no version information" errors/ (Bug #182882) + +2007-09-12: Paul Varner + * eclean: Fix processing of the long arguments to work correctly. (Bug + #192345) + * revdep-rebuild: Correctly handle the case where an ebuild no longer + exists for a package (Bug #188918) + * eread: Fix eread to not accept invalid input for file selection. + (Bug #189994) + +2007-08-08: Paul Varner + * revdep-rebuild: Fix progress bar to only update when there is a + change (Bug #186945) + * revdep-rebuild: Ensure that we source functions.sh before calling + ewarn, etc. + +2007-08-06: Paul Varner + * revdep-rebuild: Fix processing of .la files (Bug #187453) + * revdep-rebuild: Add -X option back for backwards compatibilty (Bug + #187366) + +2007-07-30: Paul Varner + * revdep-rebuild: Fix grepping for non-existant package-owners file + (Bug #187141) + +2007-07-05: Paul Varner + * revdep-rebuild: Added refactored revdep-rebuild from Michael A. + Smith (Bug #184042) + +2007-05-30: Marius Mauch + * glsa-check: check SLOT when selecting and displaying upgrades + * glsa-check: new --emergelike option to use the best version + within the same SLOT instead of the one with the smallest delta. + * glsa-check: prefer visible upgrades to masked upgrades + * equery: check for and warn about unknown options (bug 119674) + * equery,eclean,glsa-check,epkginfo: Only add /usr/lib/portage/pym + to python search path when necessary + +2007-05-21: Paul Varner + * echangelog: Add patch from genstef to fix issues from Bug 176337 + +2007-05-11: Paul Varner + * eclean: Changed permission check to see if you are either root or + belong to the portage group (Bug #177385) + +2007-05-11: Paul Varner + * eclean: Updated eclean to not delete metadata.dtd by default (Bug + #176951) + +2007-05-10: Marius Mauch + * euse: Fix incorrect flag status display when a flag appears multiple + times in a single location + +2007-04-25: Paul Varner + * echangelog: Re-added subversion/git support with fixes from genstef. + (Bug #136048) + +2007-04-24: Paul Varner + * etcat: Removed from Makefile (deprecated since 04-25-2005) + * qpkg: Removed from Makefile (deprecated since 04-25-2005) + +2007-04-23: Paul Varner + * genpkgindex, epkginfo: Move to /usr/bin from + /usr/lib/gentoolkit/bin (Bug #175759) + +2007-04-10: Paul Varner + * equery: Change equery uses to command to display the best matching + uninstalled package version if an uninstalled package is specified. + Changed the meaning of -a to mean display all versions. (Bug #152325) + +2007-04-01: Alec Warner + * eread: Fix path and fully qualified paths (Bug #172969) + +2007-03-31: Paul Varner + * equery: Fix traceback in equery which (Bug #134053) + +2007-03-29: Paul Varner + * gentoolkit: Change package.get_???_deps() methods to try the portage + tree first, since emerge always uses the portage tree for dependencies. + (Bug #164678) + +2007-03-29: Paul Varner + * equery: Convert deprecated strings functions to str methods (Bug + #172694) + +2007-03-25: Paul Varner + * echangelog: Remove subversion/git patch due to many bugs. + +2007-03-18 Paul Varner + * revdep-rebuild: Change --no-color to --nocolor for consistency + within gentoolkit. (Bug #165165) + +2007-03-16 Paul Varner + * gentoolkit: Fix typo in package.py (Bug #168347) + +2007-03-15 Paul Varner + * equery: Fix equery check to not fail for symlinks prefixed with ./ + (Bug #170702) + +2007-03-14 Paul Varner + * equery: Trim trailing slash from query for equery belongs command + (Bug #170981) + +2007-03-13 Paul Varner + * revdep-rebuild: Fix bug with --package-names option not rebuilding + packages (Bug #169761) + +2007-03-10 Paul Varner + * equery: Add --depth option to equery depgraph to limit the depth of + the dependency graph. (Bug #115807) + +2007-03-09 Paul Varner + * revdep-rebuild: Add support to detect "no version information + available" message from ldd (Bug #169973) + +2007-03-08 Paul Varner + * equery: Improved handling of KeyError in equery depends command + (Bug #169929) + +2007-03-07 Paul Varner + * revdep-rebuild: Change ordering algorithm to use --deep instead of + --emptytree on the advice of zmedico + +2007-02-26 Marius Mauch + * glsa-check: Display access information in verbose list mode (bug 168482) + +2007-02-19 Paul Varner + * echangelog: Updated to support git and subversion (Bug #136048) + +2007-01-10 Paul Varner + * epkgmove: removed epkgmove command due to popular demand. (Bug + 161360) + * gensync: Deprecated gensync in favor of app-portage/layman (multiple + bugs) + +2007-01-02 Paul Varner + * equery: Fix equery depends --indirect command. (Bug #124552) + +2006-12-31 Paul Varner + * equery: Reworked equery depends command to be more accurate. + +2006-12-13 Paul Varner + * revdep-rebuild: Fix handling of /etc/portage/package.mask (Bug + #158025) Thanks to Wolfram Schlich for the patch. + +2006-12-12 Paul Varner + * equery: Add --tree option to equery files command. (Bug #62898) + Thanks to scope for the patch. + +2006-12-06 Paul Varner + * equery: Modify equery size command to work like the equery list + command for pkgspec arguments + +2006-11-27 Paul Varner + * eclean: Fix typographical error in help and man page. (Bug #156243) + +2006-10-11 Paul Varner + * equery: Fix fileAsStr to understand device files. + (http://forums.gentoo.org/viewtopic-p-3639575.html) + +2006-10-07 Paul Varner + * euse: Fix quoting bug in get_real_path() (Bug #150335). + +2006-09-21 Paul Varner + * eread: Add eread script for reading and managing portage ELOG files. + Thanks to Donnie Berkholz for writing this. + +2006-09-03 Paul Varner + * revdep-rebuild: Remove unused environment variables before calling + emerge (Bug #142074). Check for permissions to write temporary files + (Bug #142308) + +2006-08-12 Marius Mauch + * glsa-check: Add new --mail option to send out vulnerability reports + (output of --list plus --dump for each matched glsa as attachment), + using elog configuration. + +2006-07-31 Paul Varner + * euse: Replace calls to readlink with bash function for Gentoo/ALT + compatibility. (Bugs #140477, #128960) + +2006-07-28 Paul Varner + * revdep-rebuild: Fix revdep-rebuild to correctly handle --ask being + passed to emerge. Thanks to Sal Gonzalez for + the patch. (Bug #37485) + +2006-07-07 Paul Varner + * revdep-rebuild: Rename --no-path to --no-ld-path and change + functionality to not set LD_LIBRARY_PATH. This fixes bug #96946 as + well as bug #137313 + * revdep-rebuild: Apply patch from truedfx to fix bug #38751 + +2006-07-05 Paul Varner + * revdep-rebuild: Add --no-path option to revdep-rebuild for bug + #137313 + +2006-06-25 Marius Mauch + * glsa-check: update cve code for bug 128115 + +2006-06-14 Paul Varner + * gentoolkit: Fix package.py to honor $ROOT. (bug #136811) + +2006-05-22 Paul Varner + * revdep-rebuild: Use qfile to locate packages if portage-utils is + installed (Bug #128374). Be even more paranoid about extra slashes in + path names (Bug #128108). Remove unused code. Update configuration + section of manpage (Bug #126038). + +2006-04-02 Paul Varner + * revdep-rebuild: Remove double-slashes from path names (Bug #128108) + +2006-04-01 Paul Varner + * revdep-rebuild: Add fix so that packages no longer in the tree cause + errors (Bug #128174). Fix case where masked packages cause + revdep-rebuild to not rebuild any packages (Bug #128085) + +2006-03-29 Marius Mauch + * euse: Add support for special %active argument as placeholder for + active use flags + +2006-03-26 Aron Griffis + * echangelog: Don't warn about missing ebuilds when updating + copyrights #120061 + +2006-03-25 Aron Griffis + * eviewcvs: Update for sources.gentoo.org, add subversion support + +2006-03-21 Paul Varner + * revdep-rebuild: Fix to clear environment before portageq call. (Bug + #126038) + +2006-03-08 Paul Varner + * genpkgindex: Add binary package indexing utility. (Bug 82132) + +2006-03-01 Paul Varner + * gentoolkit: Fix depends parsing to properly handle conjunction. (bug + #123725). Thanks to tgl for the patch. + * gentoolkit: Added function to get post-merge dependencies (PDEPEND) + (bug #99191) + * gentoolkit: Change get_dependency functions to always use the + portage tree + * equery: Added post-merge dependencies to depends and depgraph + actions. (bug #99191) + * equery: Removed requirement for package to be installed to use + depgraph action. + +2006-02-16 Marius Mauch + * euse: add/remove use flags even if there is no USE= statement in make.conf + (bug #95432) + +2006-02-16 Marius Mauch + * glsa-check: Fix bug causing the wrong summary to be displayed + for --test --verbose (bug #123084) + +2006-02-06 Paul Varner + * revdep-rebuild: Reset PORTAGE_NICENESS, so that emerge is not niced + twice. Thanks to Lukas Reck for the patch. (Bug 121482) + +2006-01-24 Marius Mauch + * glsa-check: Use vbd information in verbose list mode (patch by solar) + +2006-01-18 Paul Varner + * revdep-rebuild: Add capability to check libtool .la files for + non-existant references. + +2006-01-06 Paul Varner + * revdep-rebuild: Fix revdep-rebuild to play nicely with portage-2.1 + (Bug 118124) + +2005-12-28 Paul Varner + * revdep-rebuild: Fix to automatically determine how to call find (Bug 111203) + +2005-12-19 Paul Varner + * eclean: Add regular expression matching for exclude files (Bug 114365) + +2005-12-13 Paul Varner + * equery: Fix USE flag parsing. (Bug 115294) + +2005-12-07 Paul Varner + * revdep-rebuild: Fix revdep-rebuild to work with findutils-4.2.27. + (bug 111203) + * equery: Added note to error message about quoting redirection + characters. (Bug 113423) + * gentoolkit: Removed python-config call from make file. (Bug 113386) + +2005-11-23 Paul Varner + * equery: Changed default behavior for equery list to search for + partial name matches. Added equery list examples to the equery man + page. (Bugs 113032, 113134) + +2005-11-15 Marius Mauch + * glsa-check: Changed several messages to stderr instead of stdout + * glsa-check: Added new --cve option as requested by solar (bug 98589) + * glsa-check: Added support for a EMERGE_OPTS env variable to modify the emerge call of glsa-check --fix + * glsa-check: Added a new target "affected" + * glsa-check: Removed the warning message as it is now pretty much tested + * glsa-check: Show GLSA title on --test if --verbose is also used + +2005-11-11 Paul Varner + * equery: Added sanity check to equery files (Bug 75983) + * equery: Fix string matching for equery depends (Bug 85653) + * gentoolkit: Fix package.size() to report correct size for symbolic + links (Bug 90384) + * equery: Fix equery depgraph to show all dependencies (Bug 99191) + * equery: Fix traceback with invalid regular expression for equery + list (Bug 109392) + +2005-11-04 Paul Varner + * equery: Fix equery belongs to correctly work when passed an argument + list of multiple files (Bug 111501) + +2005-11-02 Paul Varner + * revdep-rebuild: Fix to work with findutils-4.2.25 (Bug 111203) + +2005-10-18 Paul Varner + * equery: Make equery look at both DEPEND and RDEPEND for dependencies + * gentoolkit: Fix _parse_deps to understand || syntax (Bug 101377) + +2005-10-14 Paul Varner + * equery: Add qpkg --dups functionality to equery list command (bug + 109156) + +2005-10-13 Paul Varner + * equery: equery depgraph shows USE flags (Bug 74554) + * equery: equery should properly parse use.local.desc (Bug 74569) + * equery: equery list escapes regular expressions (Bug 77113) + * equery: equery uses displays flags correctly (Bug 86633) + * equery: equery -N option to disable pipe detection (Bug 90046) + * equery: equery list properly detects version string (Bug 91286) + * equery: equery belongs now requires a filename (Bug 94618) + * equery: equery files over a pipe only prints file names (Bug 100148) + * revdep-rebuild: Fix typo in man page (Bug 109147) + +2005-09-25 Paul Varner + * revdep-rebuild: Update to read configuration files from + /etc/revdep-rebuild + +2005-09-23 Paul Varner + * equery: Sort output from equery list (bug 67152) + * equery: Update man page (Bugs 73893, 74944) + * equery: equery which returns best-visible ebuild (bug 78687) + * equery: equery --quiet is actually quiet (bug 78921) + * equery: Fixed typo in equery -h (bug 82352) + * gentoolkit: gentoolkit now uses a single portage.config object (bug + 90680) + * equery: equery uses returns unique, sorted list (bug 91623) + * equery: equery always honors nocolor flag and settings (bug 98634) + +2005-09-08 Paul Varner + * eclean: Inital commit of eclean 0.4.1 from Thomas de Grenier de + Latour (tgl) (bug 33877) + +2005-06-28 Paul Varner + * revdep-rebuild: Revert fix for bug 93574 as it can cause packages to + be missed. (bug 97171) + +2005-06-07 Paul Varner + * revdep-rebuild: Delete temporary files if the environment does not + match the previous environment (bug 95274) + +2005-06-05 Paul Varner + * revdep-rebuild: Imported revdep-rebuild release from bug 62644 + * revdep-rebuild: Major changes to the functionality when using + --package-names/-X The script should now update slotted packages + correctly. (bug 22161) + * revdep-rebuild: Customizable searching controlled through environment + variables. This removes the need for end users to directly modify the + script. (bugs 32276, 38011, 59803) + * revdep-rebuild: The directories to search are no longer hard coded + into the script. revdep-rebuild now determines the directories to + search based upon /etc/profile.env and /etc/ld.so.conf. (bugs 32276, + 38011, 89781) + * revdep-rebuild: --ignore option to ignore temporary files left from + previous runs. Automatically ignore temporary files older than 24 hours. + (bug 34052) + * revdep-rebuild: Always return an exit status based upon success or + failure. (bug 38472) + * revdep-rebuild: Fixed to only emerge packages with direct missing + dependencies. (bug 38487) + * revdep-rebuild: New man page. (bug 40042) + * revdep-rebuild: emerge is no longer called with --nodeps. This allows + for needed dependencies to be pulled in. (bug 62893) + * revdep-rebuild: Cleaned up grammatical errors (bug 85278) + * revdep-rebuild: Added support for revdep-rebuild --soname + /path/to/library.so (bug 91503) + * revdep-rebuild: Removed symbolically linked directories from search + (bug 93574) + * revdep-rebuild: --nocolor option to turn off colored output, the + script also obeys the NOCOLOR setting from /etc/make.conf. + * revdep-rebuild: Removed dependency on qpkg + * revdep-rebuild: Script uses PORTAGE_NICENESS from /etc/make.conf + * revdep-rebuild: Undocumented --keep-temp option. This is primarily + for debugging/testing. This option prevents temporary files from being + deleted. + * revdep-rebuild: Changed --soname --soname-regexp options to --library + and treat all arguments as basic regular expressions. --soname and + --soname-regexp can still be used as options for backwards + compatability. + * revdep-rebuild: Removed requirement to keep revdep-rebuild and emerge + options distinct. Options that are unrecognized by revdep-rebuild are + passed directly to emerge. + +2005-04-30 Marius Mauch + * glsa-check: add V to short option list so it actually works + * equery: added new option --name-only to belongs command to make it + "emerge-compatible" + +2005-04-26 Marius Mauch + * gentoolkit: fix broken Makefile + * gentoolkit: add some sticky tape to get the stupid thing working again + * equery: fix a few minor problems + +2005-04-25 Marius Mauch + * qpkg: moving to /usr/share/doc/gentoolkit-*/deprecated + * etcat: moving to /usr/share/doc/gentoolkit-*/deprecated + * revdep-rebuild: replacing qpkg call with equivalent grep/sed call + +2005-04-07 Marius Mauch + * euse: fixed bugs 74344, 75525 and 84521 + * euse: add better support for cascaded profiles + * glsa-check: use --oneshot (bug 79819) + * glsa.py: fix stupid revision comparison bug (bug 75233) + +2005-03-12 Aron Griffis + * Added eviewcvs to -dev, utility for generating viewcvs URLs + +2005-03-01 Karl Trygve Kalleberg + * Dropped epkgmove from the -dev + * Released gentoolkit-dev-0.2.3 + +2005-03-01 Karl Trygve Kalleberg + * Released gentookit-dev-0.2.2 + +2004-12-09 Marius Mauch + * glsa.py: Another stupid bug, this time revisionMatch() broke as + ~foobar-rN isn't valid anymore + +2004-12-08 Marius Mauch + * equery: implemented the --category option + * glsa-check: fixed the bug where it wanted to unnecessary merge masked + packages + * glsa-check: added a check to verify that all non-option arguments are + valid GLSAs + * glsa.py: changed the outfile parameter in Glsa.dump() to outstream so + we don't have to open/close a file which breaks pipes + * glsa.py: checks now for python versions below 2.3 and throws an + exception + +2004-11-29 Karl Trygve Kalleberg + * branched v0-3-0: major rework in equery is in progess. the main + branch is reserved for minor and incremental fixups. + +2004-10-20 Karl Trygve Kalleberg + * release.sh: New script that automates the relase of a new gentoolkit + relase. Only works for gentoolkit-dev at the moment. + * src/echangelog/Makefile: Fixed spurious '}' + * Released gentoolkit-dev-0.2.1 + +2004-10-31 Marius Mauch + * qpkg: security fix for bug #68846 + +2004-10-20 Karl Trygve Kalleberg + * etcat: fixed get_use_vars to get_use_flags, fixes #67349. + +2004-10-18 Karl Trygve Kalleberg + * gentoolkit: collapsed ChangeLog into base ChangeLog + * gentoolkit: reverted indenting back to tabs, due to loud protests + from Marius;) + * equery: collapsed ChangeLog into base ChangeLog + * equery: reverted indenting back to tabs, due to loud protests from + Marius;) + * equery: minor syntactical cleanups. + * equery: minor documentation improvements + * equery: added errors module that will hold various types of internal + errors raised. + * equery: added try block around on md5sum check, which fails on various + conditions like insufficient permission or stale temporary checksum + files. + +2004-10-17 Marius Mauch + * equery: fix for bug #67473 (checking md5sums of prelinked binaries) + * equery: fix for bug #67275 (--nocolor didn't work as configure was + called before parsing the arguments + * equery: changed defaults for `equery depends` as making a depgraph for + the full portage tree isn't a good idea and find_all_packages() uses way + to much memory currently + * euse: replaced the old perl version with a newly written bash version. + +2004-10-12 Marius Mauch + * equery: fix for bug #67210 + +2004-10-10 Marius Mauch + * Removed old-scripts directory from gentoolkit + * euse: added a errormessage that it doesn't support cascading profiles + * equery: small bugfixes + * equery: performance speedup for `equery belongs` by using portage + directly + * equery: added MD5 verification to `equery check` + * equery: renamed 'hasuses' to 'hasuse' + * equery: added filter patch for `equery files` from bug 43422, thanks + to degrenier@easyconnect.fr + * Released gentoolkit-0.2.0_pre10 + +2004-10-10 Karl Trygve Kalleberg + * equery: Added unit tests for all supported commands + * equery: Fixed printing order and recognition of overlay, #53432. + +2004-10-11 Karl Trygve Kalleberg + * gentoolkit: Split gentoolkit.py into helpers.py and package.py + +2004-10-10 Karl Trygve Kalleberg + * gentoolkit: Fixed Makefiles to work with posix-compatible shells + * gentoolkit: Fixed is_overlay() to report properly, #53432. + +2004-10-06 Marius Mauch + * glsa.py: Convert Unicode strings to ascii before passing them to + portage + * glsa.py: Some formatting fixes for dump() + * glsa.py: changed the matching routines so the reports are hopefully + more accurate + * glsa-check: added color support + * glsa-check: added a --verbose option to show the warnings about + invalid GLSAs + +2004-09-30 Karl Trygve Kalleberg + * equery: Added unit tests for --help + * equery: Added unit tests for 'files' + +2004-09-27 Karl Trygve Kalleberg + * gentoolkit: Added find_installed_packages + * equery: Added short commands + * equery: Fixed copyright dates + * equery: Fixed belongs to search only installed packages + * equery: Fixed reporting bug in uses command + * equery: Fixed reference to cppv + * equery: Added import of die + * equery: Added searching header to uses + * equery: Fixed hasuses to report properly + * Released gentoolkit-0.2.0_pre9 + * Released gentoolkit-dev-0.2.0_pre4 + +2004-09-08 Karl Trygve Kalleberg + * equery: Added man page rewrites by Katerina Barone-Adesi + , fixes #63045 + * equery: Fixed spacing issues with files, fixes #63036. + * equery: Added depends command by Olivier Crete , + fixes #40830. + * equery: Reworked output yet again. + * equery: Belongs handles multiple files on the command line, partially + fixes #62361. + * gentoolkit: Reworked printing functions + +2004-08-29 Karl Trygve Kalleberg + * gentoolkit: Added printing functions + * equery: Added check for bad regexp in belongs, fixes #58494 + * equery: Added proper error reporting to stderr, fixes #57580 + +2004-08-22 Karl Trygve Kalleberg + * gentoolkit: Fixed Package.get_env_var to use the correct tree db. + * gentoolkit: Renamed Package.get_use_vars to Package.get_use_flags + * equery: Searches now include masked packages, when installed. + * equery: Fixed output to be piping-friendly + * equery: Added -N option to force non-piping output + * equery: Added hasuses command + +2004-08-01 Marius Mauch + * Fixed grep expression for `qpkg -f` + +2004-05-04 Karl Trygve Kalleberg + * equery: Added a -f/--full-regex option to belongs and some logic so + users can do belongs ant, belongs /usr/bin/ant and belongs -f ".*ant.*" + while getting sensible results. Fixes #37637. + +2004-04-14 Karl Trygve Kalleberg + * Released gentoolkit-dev-0.2.0_pre3 + +2004-03-31 Marius Mauch + * glsa-check: updates, fixing #45528 and #45522, adding support for rXX + operators and passing filenames as arguments to Glsa() + +2004-03-13 Marius Mauch + * Added glsa-check and glsa.py, please note: + - they are only temporary for testing, so no manpage/ChangeLog + - their CVS home is in gentoo-projects + * fixed bugs #42160, #40935, #43389 + * equery: fixing descriptions for local USE flags + * equery: more checking on exceptions + +2004-02-08 Karl Trygve Kalleberg + * Added ebump + * Added gensync + * Added epkgmove, closes #36663. + +2004-02-06 Marius Mauch + * fixed bugs #40159, #39798, #39652, #39596, #39293 + * changed etcat and equery behavior for ambigous package names, + they now return values for all matching packages rather + than erroring out + * added "will be phased out" messages to etcat and qpkg + +2004-01-23 Marius Mauch + * lots of bugfixes + * equery: now catches Exceptions thrown by portage + * equery: minor bugfixes + +2004-01-14 Karl Trygve Kalleberg + * Added src/ego to gentoolkit-dev + +2004-01-12 Marius Mauch + * equery: added mask, keyword and slot information to list command + * equery: fixed traceback in equery + * equery: added more information on "equery list" + +2004-01-10 Karl Trygve Kalleberg + * Added src/ego + +2004-01-07 Karl Trygve Kalleberg + * equery: Added Makefile + * Added new build system + * Added src/old-scripts, the scripts from app-portage/gentoolkit + * Renamed gentool to equery + * Released 0.2.0_pre1 + +2003-12-31 Karl Trygve Kalleberg + * equery: Added which command + * equery: Added check command (not finished) + +2003-12-12 Karl Trygve Kalleberg + * equery: Added size command + * equery: Added depgraph command + +2003-12-11 Karl Trygve Kalleberg + * equery: Added list command + * equery: Added uses command + +2003-12-08 Karl Trygve Kalleberg + * Removed emerge-rsync, emerge-webrsync + * Added moo + * Added skeleton man pages to all packages + * Added Makefile + +2003-10-05 Karl Trygve Kalleberg + * equery: Added files command + * equery: Added belongs command + +2003-10-04 Karl Trygve Kalleberg + * Rewrote dep-clean to python + +2003-06-31 Karl Trygve Kalleberg + * Rewrote more of etcat; many of the functions now employ + gentoolkit. + * Replaced qpkg with stubs of a reimplementation in python. + +2003-06-27 Karl Trygve Kalleberg + * Added patch to echangelog to consider PORTDIR, fixes #23881. + +2003-06-26 Karl Trygve Kalleberg + * Added echangelog, by agenkin + * Added ekeyword, by agenkin + * Added gentoolkit, the common python library for all Gentoolkit tools. + * Revived pkg-size as a testbed for the gentoolkit library + * Fixed some minor issues in qpkg + * Added revdep-rebuild-1 + * Added revdep-rebuild-2 + * Restructuring etcat + * Fixed some minor issues in dep-clean + +2002-11-21 Karl Trygve Kalleberg + * Renamed pkg-size to gentool-package-size + * Renamed pst-package-count to gentool-package-count + * Retired rest of pst-* stuff + +2002-08-06 Karl Trygve Kalleberg + * Created separate CVS module for Gentoolkit + * Restructured directory hierarchy diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..3906c52 --- /dev/null +++ b/Makefile @@ -0,0 +1,85 @@ +# Copyright 2003-2004 Karl Trygve Kalleberg +# Copyright 2003-2004 Gentoo Technologies, Inc. +# Distributed under the terms of the GNU General Public License v2 +# +# $Header$ + +include makedefs.mak + + +all: + echo "YARMOUTH (vb.) To shout at foreigners in the belief that the louder you speak, the better they'll understand you." + echo $(PYVERSION) + echo $(VERSION) + echo $(docdir) + echo $(bindir) + echo $(sbindir) + echo $(mandir) + +clean: + rm -rf release/* + +dist: + echo "Error: Must use either dist-gentoolkit or dist-gentoolkit-dev" + exit 1 + +dist-gentoolkit-dev: + mkdir -p release/gentoolkit-dev-$(VERSION)$(RELEASE_TAG) + for x in ekeyword echangelog ego ebump gensync eviewcvs ; do \ + ( cd src/$$x ; $(MAKE) distdir=release/gentoolkit-dev-$(VERSION)$(RELEASE_TAG) dist ) \ + done + cp Makefile AUTHORS README README.Developer TODO COPYING NEWS ChangeLog release/gentoolkit-dev-$(VERSION)$(RELEASE_TAG)/ + cat makedefs.mak | \ + sed "s/^VERSION=.*/VERSION=$(VERSION)/" | \ + sed "s/^RELEASE_TAG=.*/RELEASE_TAG=$(RELEASE_TAG)/" | \ + sed "s:^docdir=.*:docdir=\$$(DESTDIR)/usr/share/doc/gentoolkit-dev-\$$(VERSION)\$$(RELEASE_TAG):" \ + > release/gentoolkit-dev-$(VERSION)$(RELEASE_TAG)/makedefs.mak + ( cd release ; tar zcf gentoolkit-dev-$(VERSION)$(RELEASE_TAG).tar.gz gentoolkit-dev-$(VERSION)$(RELEASE_TAG)/ ) + +dist-gentoolkit: + mkdir -p release/gentoolkit-$(VERSION)$(RELEASE_TAG) + rm -rf release/gentoolkit-$(VERSION)$(RELEASE_TAG)/ + for x in eclean equery eread euse gentoolkit revdep-rebuild glsa-check genpkgindex epkginfo; do \ + ( cd src/$$x ; $(MAKE) distdir=release/gentoolkit-$(VERSION)$(RELEASE_TAG) dist ) \ + done + cp Makefile AUTHORS README TODO COPYING NEWS ChangeLog release/gentoolkit-$(VERSION)$(RELEASE_TAG)/ + cp src/99gentoolkit-env release/gentoolkit-$(VERSION)$(RELEASE_TAG)/src/ + cat makedefs.mak | \ + sed "s/^VERSION=.*/VERSION=$(VERSION)/" | \ + sed "s/^RELEASE_TAG=.*/RELEASE_TAG=$(RELEASE_TAG)/" \ + > release/gentoolkit-$(VERSION)$(RELEASE_TAG)/makedefs.mak + ( cd release ; tar zcf gentoolkit-$(VERSION)$(RELEASE_TAG).tar.gz gentoolkit-$(VERSION)$(RELEASE_TAG)/ ) + +install: + echo "Err0r: Must use either install-gentoolkit or install-gentoolkit-dev" + exit 1 + +install-gentoolkit: + + install -d $(docdir) + install -d $(bindir) + install -d $(sbindir) + install -d $(mandir) + install -d $(sysconfdir)/env.d + + install -m 0644 AUTHORS ChangeLog COPYING NEWS README TODO $(docdir)/ + install -m 0644 src/99gentoolkit-env $(sysconfdir)/env.d/ + + for x in eclean equery eread euse gentoolkit revdep-rebuild glsa-check genpkgindex epkginfo; do \ + ( cd src/$$x ; $(MAKE) DESTDIR=$(DESTDIR) install ) \ + done + + +# FIXME: If run from the CVS tree, the documentation will be installed in +# $(DESTDIR)/usr/share/doc/gentoolkit-$(VERSION), not gentoolkit-dev-$(VERSION) +install-gentoolkit-dev: + + install -d $(docdir) + install -d $(bindir) + install -d $(mandir) + + install -m 0644 AUTHORS ChangeLog COPYING NEWS README README.Developer TODO $(docdir)/ + + for x in ekeyword echangelog ego ebump gensync eviewcvs ; do \ + ( cd src/$$x ; $(MAKE) DESTDIR=$(DESTDIR) install ) \ + done diff --git a/NEWS b/NEWS new file mode 100644 index 0000000..e69de29 diff --git a/README b/README new file mode 100644 index 0000000..5c785d3 --- /dev/null +++ b/README @@ -0,0 +1,46 @@ +Package: gentoolkit/gentoolkit-dev +Authors: Aron Griffis + Brandon Low + Ian Leitch + Karl Trygve Kalleberg + Marius Mauch + Paul Varner + See src//AUTHORS for tool-specific authors + +MOTIVATION + +The gentoolkit and gentoolkit-dev packages contain a collection of useful +administration scripts particular to the Gentoo Linux distribution. It contains +rough drafts and implementations of features that may in time make it into +Portage, or into full-fledged tools in their own right. + +The gentoolkit-dev package is intended primarily for Gentoo developers. + +CONTENTS + +gentoolkit +========== +eclean - tool to clean up outdated distfiles and packages +equery - replacement for etcat and qpkg +etcat - extracts auxillary information from portage (deprecated) +euse - tool to manage USE flags +glsa-check - tool to manage GLSA's (Gentoo Linux Security Advisory) +qpkg - convient package query tool (deprecated) +revdep-rebuild - scans/fixes broken shared libs and binaries + +gentoolkit-dev +============== +ebump - Ebuild revision bumper +echangelog - update portage ChangeLogs +ego - +ekeyword - modify package KEYWORDS +epkgmove - tool for moving and renaming packages in CVS +eviewcvs - generate viewcvs URLs +gensync - Overlay Sync Tool + +IMPROVEMENTS + +Any suggestions for improvements should be sent to tools-portage@gentoo.org, or +added as a bug assigned to us. + +We only accept new contributions if they are written in bash or python. diff --git a/README.Developer b/README.Developer new file mode 100644 index 0000000..6c48c84 --- /dev/null +++ b/README.Developer @@ -0,0 +1,65 @@ + +OVERVIEW + +The SVN module 'gentoolkit' contains all the scripts and stuff for both the +gentoolkit and the gentoolkit-dev package. The gentoolkit-dev package is +an optional add-on, that is only intented for the Gentoo developers. + +STYLE POLICY + +If you're touching any of the python scripts please don't change the indentation +style (if it's using tabs, you should use tabs too). Especially don't mix +spaces and tabs as that makes the code completely unreadable. + +MAKING A RELEASE + +Releases should only be made by members of the tools-portage team. See +http://www.gentoo.org/proj/en/metastructure/herds/herds.xml?select=tools-portage +for who to contact on IRC, or shuffle over a bug report to us, or send +us a mail at tools-portage@gentoo.org if you need an immediate release. + +The release manager (big words;) will then do + +1) make VERSION=major.minor.patch RELEASE_TAG= dist-gentoolkit +2) copy release/gentoolkit-${VERSION}-${RELEASE_TAG}.tar.gz to + dev.gentoo.org/space/distfiles-local/ +3) make a new ebuild, app-portage/gentoolkit/gentoolkit-${VERSION}.ebuild + with a SRC_URI that points to + mirror://gentoo/gentoolkit-${VERSION}-${RELEASE_TAG}.tar.gz + (just use one of the previous ebuilds) + +The process is similar for gentoolkit-dev: + +1) make dist-gentoolkit-dev +2) copy dist/gentoolkit-dev-${VERSION}-${RELEASE_TAG}.tar.gz to emu +3) update app-portage/gentoolkit-dev + +Important! +1) _ALWAYS_ make sure you don't "overwrite" a previous release. Your + new VERSION must be newer than any previous released version. If you + mess up a release, don't overwrite with the same release number, iterate + the patch version and try again (and again, and again until you get + it right;) + + +MAKING A RELEASE WITH release.sh + +If you have added your system details at the top of the release.sh script, +you can make a release in the following fashion: + +(NOTE! This only works for -dev at the moment) + +1) Add a notice in the ChangeLog about the release you are making. +2) Do VERSION="x.y.z" ./release.sh dev +3) Test the package: ACCEPT_KEYWORDS="~arch" emerge gentoolkit-dev +4) Do a repoman ci -m "Released x.y.z" in your + CVS/app-portage/gentoolkit-dev directory. + + +Currently, the following people have "release access": + + - genone@gentoo.org + - fuzzyray@gentoo.org + +If you want a new release, ping either of us. If you want to get +"release access", talk to fuzzyray@gentoo.org diff --git a/TODO b/TODO new file mode 100644 index 0000000..d39ea85 --- /dev/null +++ b/TODO @@ -0,0 +1,40 @@ +- equery: + - add --overlay, --portdir to uses + - add glsa pkgspec + - query for current GLSAs on installed package(s) + - add changelog [--last] [--lastentry] [--current] + - displays changelog entries + - add check [--full] [--display=pkgnames,full] + - check md5 and timestamps (optionally also in CONFIG_PROTECT dirs) + - add which + - as ewhich +- fully deprecate dep-clean and pkg-clean +- rewrite ekeywords and echangelog to use gentoolkit +- add deep depends to equery +- fully deprecate qpkg +- fully deprecate pkg-size +- merge change and echangelog +- merge useflag and euse, have _one_ command line tool + - update ufed to rely on the CLI tool + - update ufed to rely on generate-use + - merge generate-use and ufed? +- rewrite revdep-rebuild to use gentoolkit + - drop qpkg dependency; use equery instead +- rewrite distfiles-clean to use gentoolkit +- look through forums.gentoo.org for additional scripts +- write a Gentoolkit Guide +- write efeatures for turning on/off FEATURES in make.conf +- look at ekeys, ewatch +- revision bump tool + - bump versioned files in filesdir + - -m for changelog entry + - use ~/.gentoo/gentoolkit/ebump.conf + - use /etc/gentoolkit/ebump.conf +- should be removed: + - etc-update + - epm + - useflag +- add 'clean' target + ++ check esearch, eupdatedb: separate package for now + diff --git a/makedefs.mak b/makedefs.mak new file mode 100644 index 0000000..efbc8ce --- /dev/null +++ b/makedefs.mak @@ -0,0 +1,20 @@ +# Copyright 2003 Karl Trygve Kalleberg +# Copyright 2003 Gentoo Technologies, Inc. +# Distributed under the terms of the GNU General Public License v2 +# +# $Header$ + +# Override this on command line when making a release, ie 'dist' + +VERSION=9.9.9 +RELEASE_TAG= +# python-config is not installed on all arches Bug #113386 +#PYVERSION="`python-config | sed 's/-l//' | sed 's/ -lm.*//'`" +PYVERSION="`LC_COLLATE=C; python -V 2>&1 | tr '[:upper:]' '[:lower:]' | sed -e 's/ //g;s/\([0-9]\.[0-9]\)\.[0-9]/\1/'`" +DESTDIR= + +docdir=$(DESTDIR)/usr/share/doc/gentoolkit-$(VERSION)$(RELEASE_TAG) +bindir=$(DESTDIR)/usr/bin +sbindir=$(DESTDIR)/usr/sbin +mandir=$(DESTDIR)/usr/share/man/man1 +sysconfdir=$(DESTDIR)/etc diff --git a/release.sh b/release.sh new file mode 100755 index 0000000..22313b4 --- /dev/null +++ b/release.sh @@ -0,0 +1,89 @@ +#! /bin/bash + +case $(whoami) in + karltk) + publish_path=dev.gentoo.org:public_html/projects/gentoolkit/releases + publish_public_path="http://dev.gentoo.org/~karltk/projects/gentoolkit/releases" + portdir=/home/karltk/source/oss/gentoo/gentoo-x86/ + export ECHANGELOG_USER="Karl Trygve Kalleberg " + ;; + + port001) + publish_path=dev.gentoo.org:public_html/distfiles/gentoolkit/releases + publish_public_path="http://dev.gentoo.org/~port001/distfiles/gentoolkit/releases" + portdir=/home/port001/Gentoo/gentoo-x86/ + export ECHANGELOG_USER="Ian Leitch " + ;; + + genone) + publish_path=dev:public_html/distfiles/ + publish_public_path="http://dev.gentoo.org/~genone/distfiles/" + portdir=/home/gentoo/cvs/gentoo-x86/ + export ECHANGELOG_USER="Marius Mauch " + ;; + + agriffis) + publish_path=gentoo:public_html/dist/ + publish_public_path="http://dev.gentoo.org/~agriffis/dist/" + portdir=/home/agriffis/portage/ + ;; + + *) + echo "!!! Don't know who $(whoami) is, can't release" + exit 1 + ;; +esac + +function most-recent-ebuild() { + # FIXME: actually pick the most recent one + ls gentoolkit-dev-*.ebuild | tail -n 1 +} + +function release-dev() { + + echo "* Building .tar.bz" + make VERSION=${VERSION} RELEASE_TAG=${RELEASE_TAG} dist-gentoolkit-dev > /dev/null || exit + + echo "* Uploading .tar.bz" + scp release/gentoolkit-dev-${VERSION}${RELEASE_TAG}.tar.gz ${publish_path} || exit + + + echo "* Generating new ebuild" + + local ebuild="gentoolkit-dev-${VERSION}${RELEASE_TAG}.ebuild" + + cd ${portdir}/app-portage/gentoolkit-dev || exit + cp $(most-recent-ebuild) ${ebuild} + ekeyword ~all ${ebuild} + sed -i -e "s|SRC_URI=.*|SRC_URI=\"${publish_public_path}/\$\{\P\}.tar.gz\"|" ${ebuild} + + echo "* Generating digest" + ebuild ${ebuild} digest || exit + cvs add ${ebuild} || exit + echangelog "New upstream release" + echo '* Everything ready. You should:' + echo ' 1) ACCEPT_KEYWORDS="~x86" sudo emerge =gentoolkit-dev-${VERSION}${RELEASE_TAG}' + echo ' 2) repoman ci -m "New upstream release" from `pwd`' +} + + +if [ -z "${VERSION}" ] ; then + echo "!!! You must set the VERSION env var" + exit 1 +fi + +if [ -z "${RELEASE_TAG}" ] ; then + echo "No RELEASE_TAG found, presumably okay" +fi + + +if [ "$1" == "dev" ] ; then + release-dev +elif [ "$1" == "main" ] ; then + echo "!!! Unsupported atm, feel free to add code;)" + exit 1 +else + echo "!!! You must select to release either 'dev' or 'main', as parameter to release.sh" + exit 1 +fi + diff --git a/src/99gentoolkit-env b/src/99gentoolkit-env new file mode 100644 index 0000000..3933874 --- /dev/null +++ b/src/99gentoolkit-env @@ -0,0 +1 @@ +CONFIG_PROTECT_MASK="/etc/revdep-rebuild" diff --git a/src/change/AUTHORS b/src/change/AUTHORS new file mode 100644 index 0000000..4b3873a --- /dev/null +++ b/src/change/AUTHORS @@ -0,0 +1,5 @@ +Dan Armak + * Basic idea + * Initial version +Karl Trygve Kalleberg + * Gentoolkit-specific changes diff --git a/src/change/ChangeLog b/src/change/ChangeLog new file mode 100644 index 0000000..bd7d5dd --- /dev/null +++ b/src/change/ChangeLog @@ -0,0 +1,7 @@ +2002-08-11 Dan Armak : + * Fix two bugs which are long to describe, so I won't do so here. + They caused malformed or incomplete changelog files to be created. + +2002-08-09 Karl Trygve Kalleberg : + * Reformatted usage to work with 80 columns + * Now loads ~/.gentoo/gentool-env instead of ~/.change diff --git a/src/change/README b/src/change/README new file mode 100644 index 0000000..bda1842 --- /dev/null +++ b/src/change/README @@ -0,0 +1,20 @@ +Package : change +Version : 0.2.4 +Author : See AUTHORS + +MOTIVATION + +Maintaing Gentoo's ChangeLog files in the Portage Tree is a tedious affair. +Many of the details are well-defined enough for a tool to do. change is this +tool. + +MECHANICS + +change can create a ChangeLog, add entries to the ChangeLog file, scan for +updated files. + + +IMPROVEMENTS + +For improvements, send a mail to karltk@gentoo.org or make out a bug at +bugs.gentoo.org and assign it to me. diff --git a/src/change/change b/src/change/change new file mode 100644 index 0000000..094573b --- /dev/null +++ b/src/change/change @@ -0,0 +1,343 @@ +#! /bin/bash + +# Copyright 1999-2002 Gentoo Technologies, Inc. +# Distributed under the terms of the GNU General Public License v2 +# Author: Dan Armak +# $Header: /space/gentoo/cvsroot/gentoolkit/src/change/change,v 1.2 2002/08/11 13:32:12 karltk Exp $ + +eval `grep PORTDIR= /etc/make.globals` +eval `grep PORTDIR= /etc/make.conf` +[ -z "$PORTDIR" ] && PORTDIR="/usr/portage" + +# register temp files (we delete them in the end) +TMPMESSAGE=`tempfile -p change` || cleanup 1 +TMPHEADER=`tempfile -p change` || cleanup 1 +TMPENTRY=`tempfile -p change` || cleanup 1 +TMPOLDLOG=`tempfile -p change` || cleanup 1 +TMPCHANGELOG=`tempfile -p change` || cleanup 1 + +# get user info from config file - $AUTHORNAME and $AUTHOREMAIL +init() { + . ~/.gentoo/gentool-env || return 1 +} + +print_about() { + + echo "change v 0.2.4 - A Gentoo ChangeLog editor." + echo "Author Dan Armak " +} + +print_usage() { + + echo "Usage: +change [-shv] [-m|--message msg] [-f|--message-file file] + [-a|--authorname name] [-l|--authormail mail] + [-n|--new-version ver] [-o|--output dest] + +: List of packages whose changelogs are to be edited. All +changelogs edited in one run will be added the same log message. + +Acceptable formats: Example: +category/package kde-base/kdebase +path to package dir kdebase || ../../kdebase +path to changelog file portage/kde-base/kdebase/ChangeLog + +Note that you must use -g for changelog files outside $PORTDIR. + +-m, --message \"msg\" Use log message \"msg\", do not open editor. +-f, --message-file Use contents of as log message, do not open + editor. +-a, --authorname \"name\" Use \"name\" (e.g. Dan Armak) in log. +-l, --authormail \"email\" Use \"email\" (e.g. danarmak@gentoo.org) in log. +-n, --new-version \"ver\" Add a line about a new version number \"ver\" to + the log. +-g, --generate Create a new changelog file if one does not exist. + This option must come before the list of affected + changelog files. Incidentally, this option also + enables you to work with a changelog file outside + $PORTDIR. + You must use it every time you edit such a file. + However, change won't be able to figure out the + category and package names of your changelog file + and those parts will be missing. (FIXME!) +-o, --output \"file\" Save new changelog in file \"file\". + Default is the the same file we're changing (i.e. + no backup). +-s, --stdout Print new changelog to stdout (disables saving to + file). This suppresses the usual info messages. +-c, --changed-files List of changed files (goes into entry header). + Default is to simply say \"ChangeLog :\". Multiple + -c options can be given. +-h, --help Print this usage information. +-v, --version Print a short about line and the version number and + exit. + +See also the mandatory config file ~/.gentoo/gentool-env (the gentool-env man +page contains a template). +" + +} + +# parse command line parameters +# this function should be called before all others (e.g. before init()) +# or else it might stomp on some settings +parse_params() { + + # at least one parameter required - changelog to process + if [ -z "$1" ]; then + echo "At least one parameter is required." + print_about + print_usage + cleanup 1 + fi + + while [ -n "$1" ]; do + + # note: with parameters that come in two pieces (i.e. -m foo) + # we identify the first one, grab the second one from $2 and + # shift an extra time + case "$1" in + + # optional log message, if defined then we won't launch $EDITOR + # comes in explicit string and file reference variations + -m | --message) + MESSAGE="$2" + shift + ;; + -f | --message-file) + cp $2 $TMPMESSAGE + shift + ;; + + # general settings (usually set in .change) + -a | --authorname) + AUTHORNAME="$2" + shift + ;; + -l | --authormail) + AUTHOREMAIL="$2" + shift + ;; + + # add a line about a new version (starting with *) to the changelog + # to add the line but no changelog info, call with -n -m "" + -n | --new-version) + NEWVERSION="$2" + shift + ;; + + # create a new changelog file + -g | --generate) + GENERATE=true + ;; + + # output redirection. default (if $OUTPUT isn't set) is to change the + # specified changelog file. + # illegal if more than one changelog file/package is specified. + -o | --output) + OUTPUT="$2" + shift + ;; + # redirect output to stdout - can be combined with -o + -s | --stdout) + STDOUT="true" + OUTPUT="/dev/null" + ;; + + # list of files changed (second part inclosed in quotes!) + -c | --changed-files) + CHANGED="$CHANGED $2" + shift + ;; + + # request for version/usage information etc + -h | --help) + print_about + print_usage + cleanup 0 + ;; + -v | --version) + print_about + cleanup 0 + ;; + + # everything else we couldn't identify. most of it is packages/files to work on. + *) + for x in "$MYPORTDIR/$1/ChangeLog" "$PORTDIR/$1/ChangeLog" "$PWD/$1/ChangeLog" "$PWD/$1"; do + if [ -f "$x" ]; then + FILES="$FILES $x" + shift # because by calling continue we skip the shift at the end of the case block + continue 2 # next while iteration + fi + done + # if we haveb't detected a changelog file, maybe we need to create one + if [ -n "$GENERATE" ]; then + for x in "$PWD/$1" "$1" "$MYPORTDIR/$1" "$PORTDIR/$1"; do + if [ -d "$x" ]; then + touch $x/ChangeLog + FILES="$FILES $x/ChangeLog" + shift # because by calling continue we skip the shift at the end of the case block + continue 2 # next while iteration + fi + done + fi + + echo "!!! Error: unrecognized option: $1" + echo + print_usage + cleanup 1 + + ;; + + esac + + shift + done + + if [ -z "$FILES" ]; then + echo "No changelog path or package name passed, mandatory parameter missing." + echo + print_usage + cleanup 1 + fi + +} + +# get the log message +get_msg() { + + if [ -n "`cat $TMPMESSAGE`" ]; then + echo "Using message-on-file." + elif [ -n "$MESSAGE" ]; then + echo "$MESSAGE" > $TMPMESSAGE + else # [ -z "$MESSAGE" ] + + echo > $TMPMESSAGE + echo "Please enter changelog. You can leave this line, it will be automatically removed." >> $TMPMESSAGE + $EDITOR $TMPMESSAGE + cp $TMPMESSAGE ${TMPMESSAGE}2 + sed -e '/Please enter changelog. You can leave this line, it will be automatically removed./ D' \ + ${TMPMESSAGE}2 > $TMPMESSAGE + rm ${TMPMESSAGE}2 + + fi + + # break up into 80-character columns (actually 78 chars because we'll + # add two spaces to every line) + cp $TMPMESSAGE ${TMPMESSAGE}2 + fmt -s -w 78 ${TMPMESSAGE}2 > $TMPMESSAGE + rm ${TMPMESSAGE}2 + + # add two spaces to the beginning of every line of the message. + # do this separately from the sed in the else section above + # because it should be executed for the if and elif sections too. + cp $TMPMESSAGE ${TMPMESSAGE}2 + sed -e 's:^: :g' ${TMPMESSAGE}2 > $TMPMESSAGE + rm ${TMPMESSAGE}2 + +} + +# get list of files and wrap it in the following manner: +# 1 item on the first list and upto 80 chars on every other. +# also adds 2 spaces to the beginning of every line but the first. +wrap_list() { + + echo -n $1 + shift + + while [ -n "$1" ]; do + if [ -n "$LIST" ]; then + LIST="$LIST, $1" + else + echo , + LIST="$1" + fi + shift + done + LIST="$LIST :" + + echo $LIST | fmt -s -w 78 | sed -e 's:^: :g' - + +} + +# do the actual work on te changelog file passed as $1 +process() { + # figure out category and package names + name=${1//${PORTDIR}} + name=${name//${MYPORTDIR}} + name=${name//\/ChangeLog} + + OLDIFS="$IFS" + IFS="/" + for x in $name; do + if [ -z "$CATEGORY" ]; then + CATEGORY="$x" + else + PACKAGE="$x" + fi + done + IFS="$OLDIFS" + + # create header + echo \ +"# ChangeLog for $CATEGORY/$PACKAGE +# Copyright 2002 Gentoo Technologies, Inc.; Distributed under the GPL v2 +# \$Header: \$ +" > $TMPHEADER + + # create entry line + if [ -n "$NEWVERSION" ]; then + echo "*$PACKAGE-$NEWVERSION (`date '+%d %b %Y'`)" > $TMPENTRY + echo >> $TMPENTRY + fi + + echo -n " `date "+%d %b %Y"`; ${AUTHORNAME} <${AUTHOREMAIL}> " >> $TMPENTRY + [ -z "$CHANGED" ] && CHANGED="ChangeLog " + wrap_list $CHANGED >> $TMPENTRY + + echo >> $TMPENTRY + + # get the original changelog, minus the old header + sed -e '/^# ChangeLog for/ D + /^# Copyright 2002 Gentoo Technologies/ D + /^# \$Header:/ D' $1 > $TMPOLDLOG + + # join everything together + cat $TMPHEADER $TMPENTRY $TMPMESSAGE $TMPOLDLOG > $TMPCHANGELOG + + # various output options + if [ -n "$OUTPUT" ]; then + cp $TMPCHANGELOG $OUTPUT + [ -z "$STDOUT" ] && echo "New changelog saved in $OUTPUT." + else + cp $TMPCHANGELOG $1 + [ -z "$STDOUT" ] && echo "Original changelog $1 replaced." + fi + + if [ -n "$STDOUT" ]; then + cat $TMPCHANGELOG + fi + +} + +# pass exit code to this function +cleanup() { + + rm -f $TMPMESSAGE $TMPHEADER $TMPENTRY $TMPCHANGELOG $TMPOLDLOG + + exit $1 + +} + +parse_params "${@}" + +init + +get_msg + +for x in $FILES; do + process $x +done + +cleanup 0 + diff --git a/src/change/change.1 b/src/change/change.1 new file mode 100644 index 0000000..e69de29 diff --git a/src/dep-clean/AUTHORS b/src/dep-clean/AUTHORS new file mode 100644 index 0000000..2fa030f --- /dev/null +++ b/src/dep-clean/AUTHORS @@ -0,0 +1,9 @@ +Maintainer: +Karl Trygve Kalleberg + +Authors: +Karl Trygve Kalleberg (dep-clean, man page) +Jerry Haltom (dep-clean) +Brandon Low (dep-clean) +Paul Belt (man page) +Brandon Low (dep-clean) diff --git a/src/dep-clean/ChangeLog b/src/dep-clean/ChangeLog new file mode 100644 index 0000000..dc6980e --- /dev/null +++ b/src/dep-clean/ChangeLog @@ -0,0 +1,13 @@ + 04 Oct 2003: Karl Trygve Kalleberg dep-clean, dep-clean.1: + * Rewrote to Python + * Uses gentoolkit + * Changed the switches to be proper toggles + + 25 Feb 2003; Brandon Low dep-clean, dep-clean.1: + * Update to work with current everything + * Add -q and change the default behaviour and the verbose behavior + * Make a lot faster by rewriting most everything + * Make script much more readable + * Make pay attention to PORTDIR_OVERLAY + * Bring back from the dead as it give more info + than the depclean action in portage. diff --git a/src/dep-clean/README b/src/dep-clean/README new file mode 100644 index 0000000..6521aef --- /dev/null +++ b/src/dep-clean/README @@ -0,0 +1,4 @@ +See man dep-clean or just run dep-clean --help. + +QuickStart: +dep-clean displays missing, extra, and removed packages on your system. diff --git a/src/dep-clean/dep-clean b/src/dep-clean/dep-clean new file mode 100644 index 0000000..2f2bde0 --- /dev/null +++ b/src/dep-clean/dep-clean @@ -0,0 +1,164 @@ +#!/usr/bin/python +# +# Terminology: +# +# portdir = /usr/portage + /usr/local/portage +# vardir = /var/db/pkg + +import sys +import gentoolkit +try: + from portage.output import * +except ImportError: + from output import * + +__author__ = "Karl Trygve Kalleberg, Brandon Low, Jerry Haltom" +__email__ = "karltk@gentoo.org, lostlogic@gentoo.org, ssrit@larvalstage" +__version__ = "0.2.0" +__productname__ = "dep-clean" +__description__ = "Portage auxiliary dependency checker" + +class Config: + pass + +def defaultConfig(): + Config.displayUnneeded = 1 + Config.displayNeeded = 1 + Config.displayRemoved = 1 + Config.color = -1 + Config.verbosity = 2 + Config.prefixes = { "R" : "", + "U" : "", + "N" : "" } +def asCPVs(pkgs): + return map(lambda x: x.get_cpv(), pkgs) + +def asCPs(pkgs): + return map(lambda x: x.get_cp(), pkgs) + +def toCP(cpvs): + def _(x): + (c,p,v,r) = gentoolkit.split_package_name(x) + return c + "/" + p + return map(_, cpvs) + +def checkDeps(): + if Config.verbosity > 1: + print "Scanning packages, please be patient..." + + unmerged = asCPVs(gentoolkit.find_all_uninstalled_packages()) + unmerged_cp = toCP(unmerged) + + merged = asCPVs(gentoolkit.find_all_installed_packages()) + merged_cp = toCP(merged) + + (system, unres_system) = gentoolkit.find_system_packages() + system = asCPVs(system) + + (world, unres_world) = gentoolkit.find_world_packages() + world = asCPVs(world) + + desired = system + world + + unneeded = filter(lambda x: x not in desired, merged) + needed = filter(lambda x: x not in merged, desired) + old = filter(lambda x: x not in unmerged_cp, merged_cp) + + if len(needed): + print "Packages required, but not by world and system:" + for x in needed: print " " + x + raise "Internal error, please report." + + if len(unres_system) and Config.displayNeeded: + if Config.verbosity > 0: + print white("Packages in system but not installed:") + for x in unres_system: + print " " + Config.prefixes["N"] + red(x) + + if len(unres_world) and Config.displayNeeded: + if Config.verbosity > 0: + print white("Packages in world but not installed:") + for x in unres_world: + print " " + Config.prefixes["N"] + red(x) + + if len(old) and Config.displayRemoved: + if Config.verbosity > 0: + print white("Packages installed, but no longer available:") + for x in old: + print " " + Config.prefixes["R"] + yellow(x) + + if len(unneeded) and Config.displayUnneeded: + if Config.verbosity > 0: + print white("Packages installed, but not required by system or world:") + for x in unneeded: + print " " + Config.prefixes["U"] + green(x) + +def main(): + + defaultConfig() + + for x in sys.argv: + if 0: + pass + elif x in ["-h","--help"]: + printUsage() + sys.exit(0) + elif x in ["-V","--version"]: + printVersion() + sys.exit(0) + + elif x in ["-n","--needed","--needed=yes"]: + Config.displayNeeded = 1 + elif x in ["-N","--needed=no"]: + Config.displayNeeded = 0 + + elif x in ["-u","--unneeded","--unneeded=yes"]: + Config.displayUnneeded = 1 + elif x in ["-U","--unneeded=no"]: + Config.displayUnneeded = 0 + + elif x in ["-r","--removed","--removed=yes"]: + Config.displayRemoved = 1 + elif x in ["-R","--removed","--removed=no"]: + Config.displayRemoved = 0 + elif x in ["-c","--color=yes"]: + Config.color = 1 + elif x in ["-C","--color=no"]: + Config.color = 0 + + elif x in ["-v", "--verbose"]: + Config.verbosity += 1 + elif x in ["-q", "--quiet"]: + Config.verbosity = 0 + + # Set up colour output correctly + if (Config.color == -1 and \ + ((not sys.stdout.isatty()) or \ + (gentoolkit.settings["NOCOLOR"] in ["yes","true"]))) \ + or \ + Config.color == 0: + nocolor() + Config.prefixes = { "R": "R ", "N": "N ", "U": "U " } + + checkDeps() + +def printVersion(): + print __productname__ + "(" + __version__ + ") - " + \ + __description__ + print "Authors: " + __author__ + +def printUsage(): + print white("Usage: ") + turquoise(__productname__) + \ + " [" + turquoise("options") + "]" + print "Where " + turquoise("options") + " is one of:" + print white("Display:") + print " -N,--needed needed packages that are not installed." + print " -R,--removed installed packages not in portage." + print " -U,--unneeded potentially unneeded packages that are installed." + print white("Other:") + print " -C,--nocolor output without color. Categories will be denoted by P,N,U." + print " -h,--help print this help" + print " -v,--version print version information" + +if __name__ == "__main__": + main() diff --git a/src/dep-clean/dep-clean.1 b/src/dep-clean/dep-clean.1 new file mode 100644 index 0000000..9e42019 --- /dev/null +++ b/src/dep-clean/dep-clean.1 @@ -0,0 +1,194 @@ +.\" Automatically generated by Pod::Man version 1.15 +.\" Thu Jul 18 15:59:55 2002 +.\" +.\" Standard preamble: +.\" ====================================================================== +.de Sh \" Subsection heading +.br +.if t .Sp +.ne 5 +.PP +\fB\\$1\fR +.PP +.. +.de Sp \" Vertical space (when we can't use .PP) +.if t .sp .5v +.if n .sp +.. +.de Ip \" List item +.br +.ie \\n(.$>=3 .ne \\$3 +.el .ne 3 +.IP "\\$1" \\$2 +.. +.de Vb \" Begin verbatim text +.ft CW +.nf +.ne \\$1 +.. +.de Ve \" End verbatim text +.ft R + +.fi +.. +.\" Set up some character translations and predefined strings. \*(-- will +.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left +.\" double quote, and \*(R" will give a right double quote. | will give a +.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used +.\" to do unbreakable dashes and therefore won't be available. \*(C` and +.\" \*(C' expand to `' in nroff, nothing in troff, for use with C<> +.tr \(*W-|\(bv\*(Tr +.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' +.ie n \{\ +. ds -- \(*W- +. ds PI pi +. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch +. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch +. ds L" "" +. ds R" "" +. ds C` "" +. ds C' "" +'br\} +.el\{\ +. ds -- \|\(em\| +. ds PI \(*p +. ds L" `` +. ds R" '' +'br\} +.\" +.\" If the F register is turned on, we'll generate index entries on stderr +.\" for titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and +.\" index entries marked with X<> in POD. Of course, you'll have to process +.\" the output yourself in some meaningful fashion. +.if \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. nr % 0 +. rr F +.\} +.\" +.\" For nroff, turn off justification. Always turn off hyphenation; it +.\" makes way too many mistakes in technical documents. +.hy 0 +.if n .na +.\" +.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). +.\" Fear. Run. Save yourself. No user-serviceable parts. +.bd B 3 +. \" fudge factors for nroff and troff +.if n \{\ +. ds #H 0 +. ds #V .8m +. ds #F .3m +. ds #[ \f1 +. ds #] \fP +.\} +.if t \{\ +. ds #H ((1u-(\\\\n(.fu%2u))*.13m) +. ds #V .6m +. ds #F 0 +. ds #[ \& +. ds #] \& +.\} +. \" simple accents for nroff and troff +.if n \{\ +. ds ' \& +. ds ` \& +. ds ^ \& +. ds , \& +. ds ~ ~ +. ds / +.\} +.if t \{\ +. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" +. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' +. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' +. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' +. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' +. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' +.\} +. \" troff and (daisy-wheel) nroff accents +.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' +.ds 8 \h'\*(#H'\(*b\h'-\*(#H' +.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] +.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' +.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' +.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] +.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] +.ds ae a\h'-(\w'a'u*4/10)'e +.ds Ae A\h'-(\w'A'u*4/10)'E +. \" corrections for vroff +.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' +.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' +. \" for low resolution devices (crt and lpr) +.if \n(.H>23 .if \n(.V>19 \ +\{\ +. ds : e +. ds 8 ss +. ds o a +. ds d- d\h'-1'\(ga +. ds D- D\h'-1'\(hy +. ds th \o'bp' +. ds Th \o'LP' +. ds ae ae +. ds Ae AE +.\} +.rm #[ #] #H #V #F C +.\" ====================================================================== +.\" +.IX Title "DEP-CLEAN 1" +.TH DEP-CLEAN 1 "Copyright 2002 Gentoo Technologies, Inc." "2002-07-18" "GenToolKit's Dependency Checker!" +.UC +.SH "NAME" +dep-clean \- Shows unrequired packages and missing dependencies. +.SH "SYNOPSIS" +.IX Header "SYNOPSIS" +.Vb 1 +\& dep-clean [-RUNICv] +.Ve +.SH "DESCRIPTION" +.IX Header "DESCRIPTION" +dep-clean displays extraneous, missing or extra packages. Extra packages are those in which are not a part of the portage tree (/usr/portage). It does \s-1NOT\s0 modify the system in any way. +.SH "OPTIONS" +.IX Header "OPTIONS" +.Ip "\-n, \-\-needed" 4 +.Ip "\-N, \-\-needed=no" 4 +.IX Item "-n, --needed" +Toggle display of needed packages that are not installed. (red) (default=yes) +.Ip "\-r, \-\-removed" 4 +.Ip "\-R, \-\-removed=no" 4 +.IX Item "-R, --removed" +Toggle display of installed packages not in portage. (yellow) (default=yes) +.Ip "\-u, \-\-unneeded" 4 +.Ip "\-U, \-\-unneeded=no" 4 +.IX Item "-U, --unneeded" +Toggle display of unneeded packages that are installed. (green) (default=yes) +.Ip "\-c, \-\-color" 4 +.Ip "\-C, \-\-color=no" 4 +.IX Item "-c, --color" +Toggle output of color. Without color, package types will be noted with R, U and N. +Default is use whatever Portage is set for. +.Ip "\-v, \-\-verbose" 4 +.IX Item "-v, --verbose" +Be more verbose. +.Ip "\-q, \-\-quiet" 4 +.IX Item "-q, --quiet" +Be quiet (display only packages). +.SH "NOTES" +.IX Header "NOTES" +.Ip "" 4 +If this script is run on a system that is not up-to-date or which hasn't been cleaned (with 'emerge \-c') recently, the output may be deceptive. +.Ip "" 4 +If the same package name appears in all three categories, then it is definitely time to update that package and then run 'emerge \-c'. +.Ip "" 4 +The \-U, \-N and \-R options may be combined, default is \-UNR +.SH "AUTHORS" +.IX Header "AUTHORS" +Jerry Haltom (dep-clean) +.br +Brandon Low (dep-clean) +.PP +Paul Belt (man page) +.br +Karl Trygve Kalleberg (dep-clean, man page) diff --git a/src/dev-scripts/README b/src/dev-scripts/README new file mode 100644 index 0000000..990a2ab --- /dev/null +++ b/src/dev-scripts/README @@ -0,0 +1,2 @@ +This directory is intended to be used for small developer oriented scripts used in gentoolkit-dev. +If a script develops into a full fledged tool, it will be moved into its own subdirectory. diff --git a/src/dev-scripts/included_headers.sh b/src/dev-scripts/included_headers.sh new file mode 100755 index 0000000..915628b --- /dev/null +++ b/src/dev-scripts/included_headers.sh @@ -0,0 +1,159 @@ +#!/bin/bash + +# CHANGES +# +# 20051211: Add qfile use from portage-utils, prefer over equery. Create new +# function track_headers() to handle package manager queries for both +# relative and absolute headers. Split relative and absolute queries into two +# separate places, since relative aren't quite as reliable. Prefer headers +# found in the tarball over those in /usr/include. Also, note which headers +# weren't considered in the calculation and the reasons why not. + +location=${1} + +usage() { + echo "${0##*/} [ -d ] source_location" + echo " Returns owners of all include files used. ${0##*/} defaults to" + echo " files in /usr/include, so if a file with the same name within the" + echo " source is the actual one used, false dependencies may be printed." + echo + echo " -d" + echo " Show debug output: Print files not found" + exit 1 +} + +decho() { + if [[ -n "${DEBUG}" ]]; then + echo "${1}" + fi +} + +if [[ $# -le 0 ]] || [[ $# -ge 3 ]]; then + usage +fi + +# Handle command-line options +while getopts d options; do + case ${options} in + d) DEBUG=1 + ;; + *) usage + ;; + esac +done +# Reset post-option stuff to positional parameters +shift $((OPTIND - 1)) + +get_absolute_includes() { + grep '^#[[:space:]]*include' -r ${1} | grep '.*.[ch]' | grep -e '<' -e '>' \ + | cut -d':' -f2 | cut -d'<' -f2 | cut -d'>' -f1 | grep '.*.[ch]' \ + | sort | uniq +} + +get_relative_includes() { + grep '^#[[:space:]]*include' -r ${1} | grep '.*.[ch]' | grep -e '"' -e '"' \ + | cut -d':' -f2 | cut -d'"' -f2 | cut -d'"' -f1 | grep '.*.[ch]' \ + | sort | uniq +} + +track_headers() { + if [[ -x $(which qfile 2> /dev/null) ]]; then + qfile ${@} | cut -d'(' -f1 | sort | uniq + elif [[ -x $(which equery 2> /dev/null) ]]; then + equery -q belongs ${@} | cut -d'(' -f1 + elif [[ -x $(which rpm 2> /dev/null) ]]; then + rpm -qf ${@} + else + echo "Couldn't find package query tool! Printing headerpaths instead." + echo + for header in ${@}; do + echo ${header} + done + fi +} + +echo "Analyzing source ... " +absolute_headers="$(get_absolute_includes ${1})" +relative_headers="$(get_relative_includes ${1})" + +echo "Looking for absolute headers ... " +echo +for header in ${absolute_headers}; do + absheader="/usr/include/${header}" + if [[ -e ${absheader} ]]; then + abs_headerpaths="${abs_headerpaths} ${absheader}" + echo " Looking for ${absheader} ... OK" + else + # Try as a relative header in case people use -I with <> + relative_headers="${relative_headers} ${header}" + decho " Looking for ${absheader} ... Not found!" + fi +done + +echo +echo "Looking for relative headers ... " +echo +for header in ${relative_headers}; do + fullheader=${header} + header=${header##*/} + # Prefer headers in tarball over /usr/include + header_options=$(find ${location} -name ${header} | grep ${fullheader}) + if [[ -z ${header_options} ]]; then + header_options="$(find /usr/include -name ${header} | grep ${fullheader})" + header_loc="/usr/include" + else + decho " Local header ${header} ... Not considering." + local_headers="${local_headers} ${header}" + continue + fi + count="0" + for found in ${header_options}; do + (( count++ )) + done + if [[ ${count} -ge 2 ]]; then + echo " Looking for ${header} ... " + echo " More than one option found for ${header} in ${header_loc}." + echo " Not considering ${header}." + duplicate_headers="${duplicate_headers} ${header}" + continue + elif [[ ${count} -le 0 ]]; then + decho " Looking for ${header} ... Not found!" + unfound_headers="${unfound_headers} ${header}" + continue + fi + header=${header_options} + if [[ -e ${header} ]] && [[ ${header_loc} = /usr/include ]]; then + rel_headerpaths="${rel_headerpaths} ${header}" + echo " Looking for ${header} ... OK" + else + decho " Looking for ${header} ... Not found!" + fi +done + +echo "Tracing headers back to packages ..." +echo +echo "Headers ignored because they exist in the tarball:" +echo +for header in ${local_headers}; do + echo "${header}" +done +echo +echo "Headers ignored because of duplicates in /usr/include:" +echo +for header in ${duplicate_headers}; do + echo "${header}" +done +echo +echo "Headers ignored because they weren't found:" +echo +for header in ${unfound_headers}; do + echo "${header}" +done +echo +echo "Absolute headers:" +echo +track_headers ${abs_headerpaths} +echo +echo "Relative headers:" +echo +track_headers ${rel_headerpaths} diff --git a/src/dev-scripts/linking_libs.sh b/src/dev-scripts/linking_libs.sh new file mode 100755 index 0000000..a249305 --- /dev/null +++ b/src/dev-scripts/linking_libs.sh @@ -0,0 +1,204 @@ +#!/bin/bash + +# CHANGES +# +# 20051211: Move most of the logic to check for bad links into get_libnames() +# seds, so we don't wrongly sed out whole link lines. Seems to catch more +# problems, such as ' or ` or -- in a link. +# 20051210: Prefer qfile from portage-utils over equery if it's available. +# Check for ... in "link" lines because configure checks are not links. +# Change get_link_generic() to handle whole lines at a time instead of single +# words, so get_linklines() works. +# 20051210: Rework get_libnames() to use a new style of grep, because the old +# way was broken on some packages from the \b. Also optimize the "Looking for +# libraries" section to only grep the log file once for links and cache it; +# also only grep the link lines ones for a given library, then parse the +# output for static or shared. Should speed things up considerably for large +# packages. I get 5 seconds in Analyzing log and 15 in Looking for libs on an +# xorg-x11-6.8.99.15 log on second run. +# Create get_link_generic() that both sections call with different options. + +usage() { + echo "${0##*/} compilation_log" + echo " Checks for -lfoo link commands and finds the library owners." + exit 1 +} + +if [[ $# -lt 1 || $1 == -h || $1 == --help ]]; then + usage +fi + + +# Finds all lines in a file that involve linking +# get_link_generic(char *grep_opts, char *filename) +get_link_generic() { + egrep ${1} '\-l\w[^[:space:]]*' ${2} \ + | while read linker; do + # -linker is passed through to ld and doesn't mean the inker lib. + # The new -w in grep makes sure they're separate "words", but its + # "word" characters only include alnum and underscore, so -- gets + # through. + # Some configure lines with ... match, so we drop them + # Some of the configure options match, so we get rid of = for that. + if \ + [[ "${linker}" != *...* ]] \ + && [[ "${linker}" != -lib ]] \ + && [[ "${linker}" != -libs ]]; then + echo ${linker} + fi + done +} + +# Note the lack of -o, as compared to get_libnames() egrep +get_linklines() { + get_link_generic "-w" ${1} | sort | uniq +} + +get_libnames() { + for x; do + get_link_generic "-o -w" ${x} \ + | sed \ + -e "/^-link/d" \ + -e "/^-lib/d" \ + -e "s:^-l::g" \ + -e "/=/d" \ + -e "/'/d" \ + -e "/^-/d" \ + -e "s:\.*$::g" \ + -e "s:|::g" \ + -e "s:\"::g" \ + -e "/^-link/d" \ + -e "/^-lib/d" + done | sort | uniq +} + +get_libdirs() { + cat /etc/ld.so.conf | sed -e "/^#/d" +} + +check_exists() { + if [[ -n ${1// } ]]; then + return 0 + fi + + return 1 +} + +trace_to_packages() { + local paths=$1 + + check_exists "${paths}" + local ret=$? + if [[ $ret -ne 0 ]]; then + return 1 + fi + + if [[ -x $(which qfile 2> /dev/null) ]]; then + qfile -q ${paths} | sort | uniq + elif [[ -x $(which equery 2> /dev/null) ]]; then + equery -q belongs ${paths} | cut -d'(' -f1 + elif [[ -x $(which rpm 2> /dev/null) ]]; then + rpm -qf ${paths} + else + echo "Couldn't find package query tool! Printing paths instead." + echo + for path in ${paths}; do + echo ${path} + done + fi +} + +# *64 needs to be first, as *lib is a symlink to it so equery screws up +libdirs="/lib64 /usr/lib64 /lib /usr/lib $(get_libdirs)" + +echo "Analyzing log ..." +libnames=$(get_libnames "$@") + +#echo libnames=$libnames + +echo "Looking for libraries ..." +linker_lines=$(get_linklines ${1}) + +#echo linker_lines=$linker_lines + +for libname in ${libnames}; do + static=0 + shared=0 + line=$(echo ${linker_lines} | grep "\b-l${libname}\b") + if echo ${line} | grep -q '\b-static\b'; then + static=1 + fi + if ! echo ${line} | grep -q '\b-static\b'; then + shared=1 + fi + staticlibname="lib${libname}.a" + sharedlibname="lib${libname}.so" + if [[ ${static} -eq 1 ]]; then + echo -n " Looking for ${staticlibname} ... " + for libdir in ${libdirs}; do + found=0 + if [[ -e ${libdir}/${staticlibname} ]]; then + libpaths="${libpaths} ${libdir}/${staticlibname}" + found=1 + echo "OK" + break + fi + done + if [[ ${found} -ne 1 ]]; then + echo "Not found!" + fi + fi + if [[ ${shared} -eq 1 ]]; then + echo -n " Looking for ${sharedlibname} ... " + for libdir in ${libdirs}; do + found=0 + if [[ -e ${libdir}/${sharedlibname} ]]; then + libpaths="${libpaths} ${libdir}/${sharedlibname}" + found=1 + echo "OK" + break + fi + done + if [[ ${found} -ne 1 ]]; then + echo "Not found!" + fi + fi +done + +# Add backslashes in front of any + symbols +libpaths=${libpaths//+/\\+} + +echo "Looking for build tools (imake, etc) ..." +BUILD_PKGS=$(egrep -h "$@" \ + -e '^(/usr/(X11R6/)?bin/)?rman' \ + -e '^(/usr/(X11R6/)?bin/)?gccmakedep' \ + -e '^(/usr/(X11R6/)?bin/)?makedepend' \ + -e '^(/usr/(X11R6/)?bin/)?imake' \ + -e '^(/usr/(X11R6/)?bin/)?rman' \ + -e '^(/usr/(X11R6/)?bin/)?lndir' \ + -e '^(/usr/(X11R6/)?bin/)?xmkmf' \ + | awk '{ print $1 }' \ + | sort \ + | uniq) + +for PKG in ${BUILD_PKGS}; do + PKG=$(basename ${PKG}) + echo -n " Looking for ${PKG} ... " + if [[ -e /usr/bin/${PKG} ]]; then + echo "OK" + buildpaths="${buildpaths} ${PKG}" + else + echo "Not found!" + fi +done + +echo +echo "Tracing libraries back to packages ..." +echo +trace_to_packages "${libpaths}" + +echo +echo "Tracing build tools back to packages ..." +echo + +trace_to_packages "${buildpaths}" diff --git a/src/distfiles-clean/AUTHORS b/src/distfiles-clean/AUTHORS new file mode 100644 index 0000000..d913891 --- /dev/null +++ b/src/distfiles-clean/AUTHORS @@ -0,0 +1,6 @@ +José Fonseca + * Wrote the script + +Karl Trygve Kalleberg + * Wrote the man page. + diff --git a/src/distfiles-clean/ChangeLog b/src/distfiles-clean/ChangeLog new file mode 100644 index 0000000..dfe6aa8 --- /dev/null +++ b/src/distfiles-clean/ChangeLog @@ -0,0 +1,2 @@ +2002-15-11: Karl Trygve Kalleberg + * Imported newest contributions from #10647. diff --git a/src/distfiles-clean/TODO b/src/distfiles-clean/TODO new file mode 100644 index 0000000..e69de29 diff --git a/src/distfiles-clean/distfiles-clean b/src/distfiles-clean/distfiles-clean new file mode 100644 index 0000000..23af32b --- /dev/null +++ b/src/distfiles-clean/distfiles-clean @@ -0,0 +1,78 @@ +#!/bin/sh +# +# distfiles-clean +# +# Cleans unused files from Portage's distfiles directory. +# +# José Fonseca + +PROGRAM=`basename "$0"` + +while [ ${#} -gt 0 ] +do + case "$1" in + -h|--help) + USAGE=y + break + ;; + -i|--ignore) + IGNORE="$IGNORE $2" + shift 2 + ;; + -I|--ignore-file) + IGNORE="$IGNORE `cat "$2"`" + shift 2 + ;; + -p|--pretend) + PRETEND=y + shift + ;; + *) + echo "$PROGRAM: Invalid option \'$1\'" 1>&2 + USAGE=y + break + ;; + esac +done + +# For PORTDIR and DISTDIR +. /etc/make.globals +. /etc/make.conf + +if [ "$USAGE" ] +then + echo "Usage: $PROGRAM [-h|--help] [-i|--ignore ] [-I|--ignore-file ] [-p|--pretend]" + echo "Cleans unused files from $DISTDIR directory." + exit +fi + +DBDIR=/var/db/pkg +CACHEDIR=/var/cache/edb/dep + +for DIR in "$PORTDIR" "$DISTDIR" "$DBDIR" "$CACHEDIR" +do + if [ ! -d "$DIR" ] + then + echo "$PROGRAM: \'$DIR\' not found." + exit + fi +done + +TMPFILE=`mktemp /tmp/$PROGRAM.XXXXXX` + +cd "$DISTDIR" + +{ + echo "cvs-src" + [ "$IGNORE" ] && ls -1d $IGNORE + find "$DBDIR" -name '*.ebuild' | sed -n -e "s:^$DBDIR/\([^/]*\)/\([^/]*\)/\([^/]*\)\.ebuild$:$CACHEDIR/\1/\3:p" | xargs sed -s -e '4!d;/^$/d;s/[[:alnum:]]\+?\|(\|)//g;s/\<[^[:space:]]\+\/\ "$TMPFILE" && ls -1 | comm -23 - "$TMPFILE" | { + if [ "$PRETEND" ] + then + cat + else + xargs rm -f + fi +} + +rm "$TMPFILE" diff --git a/src/ebump/AUTHORS b/src/ebump/AUTHORS new file mode 100644 index 0000000..2432e06 --- /dev/null +++ b/src/ebump/AUTHORS @@ -0,0 +1,5 @@ +Maintainer: +Karl Trygve Kalleberg + +Original author: +Karl Trygve Kalleberg diff --git a/src/ebump/ChangeLog b/src/ebump/ChangeLog new file mode 100644 index 0000000..4434b94 --- /dev/null +++ b/src/ebump/ChangeLog @@ -0,0 +1,8 @@ +2004-06-21 Karl Trygve Kalleberg + * Fixed handling of deletion. + +2004-03-11 Karl Trygve Kalleberg + * Fixed incorrect cut'ing of wc -l output when updating ChangeLog + +2004-02-08 Karl Trygve Kalleberg + * Initial import diff --git a/src/ebump/Makefile b/src/ebump/Makefile new file mode 100644 index 0000000..aa1d347 --- /dev/null +++ b/src/ebump/Makefile @@ -0,0 +1,20 @@ +# Copyright 2004 Karl Trygve Kalleberg +# Copyright 2004 Gentoo Technologies, Inc. +# Distributed under the terms of the GNU General Public License v2 +# +# $Header$ + +include ../../makedefs.mak + +.PHONY: all +all: + +dist: + mkdir -p ../../$(distdir)/src/ebump/ + cp Makefile AUTHORS README TODO ChangeLog ebump ebump.1 ../../$(distdir)/src/ebump/ + +install: all + install -m 0755 ebump $(bindir)/ + install -d $(docdir)/ebump + install -m 0644 AUTHORS README TODO ChangeLog $(docdir)/ebump/ + install -m 0644 ebump.1 $(mandir)/ diff --git a/src/ebump/README b/src/ebump/README new file mode 100644 index 0000000..c81835c --- /dev/null +++ b/src/ebump/README @@ -0,0 +1,18 @@ + +Package : ebump +Version : 0.1.0 +Author : See AUTHORS + +MOTIVATION + +The ebump utility is a Gentoo-specific tool for bumping the revision of +a given ebuild and auxiliary files in the Portage tree. It is only +useful for Gentoo developers with CVS commit access. + +MECHANICS + +N/A + +IMPROVEMENTS + +N/A diff --git a/src/ebump/TODO b/src/ebump/TODO new file mode 100644 index 0000000..e69de29 diff --git a/src/ebump/ebump b/src/ebump/ebump new file mode 100755 index 0000000..2623a28 --- /dev/null +++ b/src/ebump/ebump @@ -0,0 +1,356 @@ +#! /bin/sh +# +# Copyright (c) 2004 Karl Trygve Kalleberg +# Copyright (c) Gentoo Technologies, Inc. +# Licensed under the GNU General Public License, version 2 +# +# Maintainer: Karl Trygve Kalleberg + +__version__="0.1.0" +__author__="Karl Trygve Kalleberg" +__email__="" +__description__="Ebuild version bumping tool" + + + +die() { + echo $1 > /dev/stderr + exit -1 +} + +einfo() { + if [ ${opt_verbosity} -gt 2 ] ; then + echo $* + fi +} + +print_version() { + echo "${__description__}, v${__version__}" + echo "Copyright (c) 2004 ${__author__} ${__email__}" + echo "Copyright (c) 2004 Gentoo Technologies, Inc." + echo "Licensed under the GNU General Public License, version 2" +} + +print_usage() { + echo "Usage: ebump foo<.ebuild>" + echo "Ebuild version bumping tool, v${__version__}" + echo " -V|--version show version info" + echo " -v|--verbose increase verbosity" + echo " -q|--quiet turn off output" + echo " -C|--no-cvs do not add to CVS" + echo " -m|--message append message to ChangeLog" + echo " -d|--delete-old delete previous revision from CVS (DANGEROUS!)" +} + +# +# Load options from /etc/gentoolkit/ebump.conf and ${HOME}/.gentoo/ebump.conf +# Home directory file takes precedence. +# +load_options() { + + # FIXME: Sourcing config files like this is really a bad idea; users may + # easily override any function in this program inside his config files. + + if [ -f /etc/gentoolkit/ebump.conf ] ; then + . /etc/gentoolkit/ebump.conf + fi + if [ -f ${HOME}/.gentoo/gentool-env ] ; then + . ${HOME}/.gentoo/gentool-env + fi + if [ -f ${HOME}/.gentoo/ebump.conf ] ; then + . ${HOME}/.gentoo/ebump.conf + fi +} + +# +# Find closes ebuild to ${1}, if any +# +find_ebuild() { + f=${1} + + if [ -f ${1} ] ; then + echo ${1} + fi + + if [ -f ${1}.ebuild ] ; then + echo ${1} + fi +} + +# +# splitname (version|name|revision) package-name-version-revision +# +splitname() { + case $1 in + version) + echo ${2} | sed -r "s/.*-([0-9].*)/\1/" + ;; + name) + name=$(echo ${2} | sed -r "s/(.*)-[0-9].*/\1/") + if [ ${name} == ${2} ] ; then + if [ $(echo ${2} | grep "^[0-9].*") ] ; then + # The filename starts with a version number, thus it has no + # name + name="" + else + # The filename doesn't have a recognizeable version number; + # everything is a name + name=${2} + fi + fi + echo ${name} + ;; + revision) + rev=$(echo ${2} | sed -r "s/.*-r([0-9][0-9]*)/\1/") + if [ ${rev} == ${2} ] ; then + rev=0 + fi + echo ${rev} + ;; + vernorev) + ver=$(echo ${2} | sed -r "s/.*-([0-9].*)-r[0-9]+/\1/") + if [ ${ver} == ${2} ] ; then + ver=$(echo ${2} | sed -r "s/.*-([0-9].*)/\1/") + fi + echo ${ver} + ;; + *) + echo + esac +} + +process_ebuild() { + ebuild_arg=${1} + + # Files to add to CVS + addfiles="" + # Files to remove from CVS + delfiles="" + + if [ -z ${ebuild_arg} ] ; then + print_usage + exit + fi + + # + # Try to find a matching ebuild + # + + ebuild_name=$(find_ebuild ${ebuild_arg}) + if [ -z ${ebuild_name} ] ; then + die "Could not find ${ebuild_arg}" + fi + einfo "Processing ebuild ${ebuild_name}" + + # + # Bump revision suffix (or add one) + # + + PF=$(basename ${ebuild_name} .ebuild) + PN=$(splitname name ${PF}) + PV=$(splitname version ${PF}) + rev=$(splitname revision ${PF}) + PV_norev=$(splitname vernorev ${PF}) + newPF=${PN}-${PV_norev}-r$[rev+1] + +# echo $PF / $PN / $PV / $rev / $PV_norev / $newPF + + einfo "Bumped ${PF}.ebuild to ${newPF}.ebuild" + + cp ${PF}.ebuild ${newPF}.ebuild + + addfiles="${addfiles} ${newPF}.ebuild" + delfiles="${delfiles} ${PF}.ebuild" + + # + # (Optional) Bump relevant files in files/ + # + + if [ "${opt_bump_auxfiles}" == "y" ] ; then + + # Gather list of auxiliary files in files/ that has a versioned + # filename, where the version matches our current version. + + bumplist="" + for x in $(echo files/*) ; do + if [ ! -z $(echo $x | grep "${PV}$") ] ; then + bumplist="${bumplist} ${x}" + fi + done + + # Bump version of all matches + + for x in ${bumplist} ; do + + bn=$(basename ${x}) + dn=$(dirname ${x}) + + PN=$(splitname name ${bn}) + PV=$(splitname version ${bn}) + rev=$(splitname revision ${bn}) + PV_norev=$(splitname vernorev ${bn}) + +# echo $PN / ${PV_norev} / ${rev} + + # Special case for when we have no name part; filename + # is just a version number + if [ -z "${PN}" ] ; then + newbn=${PV_norev}-r$[rev+1] + else + newbn=${PN}-${PV_norev}-r$[rev+1] + fi + + if [ -d ${dn}/${bn} ] ; then + if [ -e ${dn}/${newbn} ] ; then + echo "Directory ${dn}/${newbn} exists, not copying" > /dev/stderr + else + cp -a ${dn}/${bn} ${dn}/${newbn} + find ${dn}/${newbn} -name CVS | xargs rm -rf + fi + else + cp ${dn}/${bn} ${dn}/${newbn} + fi + + addfiles="${addfiles} ${dn}/${newbn}" + delfiles="${delfiles} ${dn}/${bn}" + + einfo "Bumped ${dn}/${bn} to ${dn}/${newbn}" + done + fi + +# echo "addfiles ${addfiles}" +# echo "delfiles ${delfiles}" + + filelist="${addfiles}" + # + # (Optional) Add ChangeLog entry + # + + if [ "${opt_add_changelog}" == "y" ] && + [ -f ChangeLog ] ; then + + # Add ChangeLog entry + + curdate=$(LC_TIME="us" date +"%02d %b %Y") + cp ChangeLog ChangeLog.old + ( + # Use header (four first lines) of the old ChangeLog + head -n 4 ChangeLog.old + + # Write new entry + + echo "*${newPF} (${curdate})" + echo + echo " ${curdate}; ${AUTHORNAME} <${AUTHOREMAIL}> ${filelist}" + + # If we don't have a commit message, add comment + if [ -z "${opt_commitmessage}" ] ; then + echo " # INSERT ENTRY HERE" + if [ "${opt_delete_old}" == "y" ] && [ ! -z "${delfiles}" ] ; then + echo " Removed ${delfiles}." + fi + echo + else + echo " ${opt_commitmessage}" + echo + fi + + # Write tail of old ChangeLog + nl=$(wc -l ChangeLog.old | sed -r "s/^([0-9]+).*/\1/") + tail -n $[nl - 4] ChangeLog.old + ) > ChangeLog + rm ChangeLog.old + + einfo "Added ChangeLog entry" + fi + + # + # (Optional) Add CVS entry for all new files + # + + if [ "${opt_add_cvs}" == "y" ] ; then + + # Add all new files to CVS + for x in ${addfiles} ; do + if [ -d ${x} ] ; then + find ${x} | xargs echo cvs add + else + cvs add ${x} + fi + done + einfo "Added ${addfiles} to CVS" + fi + + + # + # (Optional) Delete previous entry + # + + if [ "${opt_delete_old}" == "y" ] ; then + + for x in ${delfiles} ; do + cvs remove -f ${x} + done + einfo "Removed ${delfiles} from CVS" + fi + +} + +original_params=${#} + +# +# Global options +# +opt_verbosity=1 +opt_warn_on_delete=y +opt_add_changelog=y +opt_add_cvs=y +opt_bump_auxfiles=y +opt_delete_old=n +opt_commitmessage="" + +load_options + +skip=0 +while [ ${#} -gt 0 ] ; do + arg=${1} + shift + if [ ${skip} -gt 0 ] ; then + skip=$[skip-1] + else + case ${arg} in + -h|--help) + print_usage + exit 0 + ;; + -m|--message) + opt_commitmessage="${1}" + skip=1 + ;; + -C|--no-cvs) + opt_add_cvs=n + ;; + -V|--version) + print_version + exit + ;; + -v|--verbose) + opt_verbosity=$[opt_verbosity + 1] + ;; + -q|--quiet) + opt_verbosity=0 + ;; + -d|--delete-old) + opt_delete_old=y + ;; + *) + ebuild_arg=${arg} + ;; + esac + fi +done + +process_ebuild ${ebuild_arg} + +# TODO: +# - put cli parser into separate functions diff --git a/src/ebump/ebump.1 b/src/ebump/ebump.1 new file mode 100644 index 0000000..6a64a0a --- /dev/null +++ b/src/ebump/ebump.1 @@ -0,0 +1,110 @@ +.TH "ebump" "1" "0.1.0" "Gentoolkit" "Gentoo Administration" +.SH "NAME" +.LP +ebump \- Gentoo: Ebuild revision bumper +.SH "SYNTAX" +.LP +ebump [\fIoption\fP] <\fIpackage-name[-version]\fP> + +.SH "DESCRIPTION" + +.LP +\fIebump\fR bumps the revision of a particular ebuild, and all auxiliary +files in the files/ directory that have a matching version suffix. + +.LP +By default, the all new revision files will be added to CVS, and a +dummy ChangeLog entry will be made. + +.LP +You must stand in the directory of the ebuild to be bumped. + +.SH "OPTIONS" +.LP +\fB\-C\fR +.br +\fB--no-cvs\fB +.IP +Do not add new files to CVS. + +.LP +\fB\-V\fR +.br +\fB--version\fB +.IP +Display version information and exit. + +.LP +\fB\-v\fR +.br +\fB--verbose\fB +.IP +Increase verbosity level. May be used more than once. + +.LP +\fB\-q\fR +.br +\fB--quiet\fB +.IP +Do not output any non-essential information. + +.LP +\fB\-m\fR <\fIChangeLog text\fR> +.br +\fB\--message\fR <\fIChangeLog text\fR> +.IP +Specifies the message to add to the ChangeLog, instead of the standard +placeholder. + +.LP +\fB\-d\fR +.br +\fB\--delete-old\fR +.IP +Delete old revision and old auxiliary files from CVS. This is +\fIdangerous\fR and should only be used if you know exactly what you are +doing, because +.br +1) the old revision may be stable on a different architecture than the one you +are working on. +.br +2) the auxiliary files may be required by other versions of the ebuild. +.br +3) the new revision should usually undergo a period of testing before being marked stable. + +.SH "CONFIGURATION" + +.LP +\fB/etc/gentoolkit/ebump.conf\fR +.br +\fB~/.gentoo/ebump.conf\fR +.IP +From these files, \fIebump\fR will load the settings +.br +\fBopt_verbosity\fR (default \fI1\fR) - verbosity level 0-10 +.br +\fBopt_add_changelog\fR (default \fIy\fR) - add entry in ChangeLog +.br +\fBopt_add_cvs\fR (default \fIy\fR) - add new files to CVS +.br +\fBopt_bump_auxfiles\fR (default \fIy\fR) - bump auxiliary files in files/ +.br +\fBopt_delete_old\fR (default \fIn\fR) - delete old revision (DANGEROUS!) +.br +\fBopt_commitmessage\fR (default \fI""\fR) - default ChangeLog message + +.LP +\fB~/.gentoo/gentool-env\fR +.IR +From this file, \fIebump\fR will load the env vars \fBAUTHORNAME\fR and +\fBAUTHOREMAIL\fR, which are used to generate proper ChangeLog entries. + +.SH "SEE ALSO" +.LP +The rest of the utilities in \fIapp-portage/gentoolkit-dev\fR, such as +\fIechangelog\fR and \fIego\fR. + +.SH "AUTHORS" +.LP +Karl Trygve Kalleberg + diff --git a/src/echangelog/AUTHORS b/src/echangelog/AUTHORS new file mode 100644 index 0000000..36d5bfd --- /dev/null +++ b/src/echangelog/AUTHORS @@ -0,0 +1 @@ +Aron Griffis diff --git a/src/echangelog/ChangeLog b/src/echangelog/ChangeLog new file mode 100644 index 0000000..c1c5885 --- /dev/null +++ b/src/echangelog/ChangeLog @@ -0,0 +1,84 @@ +26 Mar 2006 Aron Griffis + * echangelog: Don't warn about missing ebuilds when updating + copyrights #120061 + +27 Apr 2005 Aron Griffis + * more changes for #90326; report all trivial files if no significant + changes can be found + +26 Apr 2005 Aron Griffis + * detect conflicts explicitly + * report ChangeLog in the list of files if it's the only file that is + changing #90326 + +23 Mar 2005 Aron Griffis + * handle package moves without adding new version lines + +08 Mar 2005 Aron Griffis + * don't complain about cvs add of digests #84377 + * use gmtime instead of localtime + +07 Mar 2005 Aron Griffis + * report all changed versions #84332 + +25 Feb 2005 Aron Griffis + * strip GECOS #80011 + +09 Nov 2004 Aron Griffis + * change "cvs diff -fU 0" => "cvs -f diff U0" because -f is a + global option, not a diff option + +08 Nov 2004 Aron Griffis + * call cvs with -f to refrain from using .cvsrc, which might + contain conflicting options + * fix auto-addition of ChangeLog; last attempt was broken + +03 Nov 2004 Aron Griffis + * abort when there are unresolved files (files that aren't under + revision control) just like repoman + * auto-add to cvs when a new ChangeLog is created + +15 Sep 2004 Aron Griffis + * fix the wrapping to fit in 80 columns properly. It was + previously possible to get lines with 81 chars. Thanks to + ciaranm for reporting. + +29 Mar 2004 Aron Griffis + * fix bug 46111 by testing for / + * apply patch from plasmaroo, with minor modifications, to enable EDITOR + and +- support + +27 Mar 2004 Michael Sterrett + * don't fall out of the loop if update_copyright() didn't change + anything. Just go on to the next file. + +21 Mar 2004 Aron Griffis + * Fix typo $0 -> 0 + +19 Mar 2004 Aron Griffis + * Remove debugging output + * Fix $v bug introduced in last commit + +16 Mar 2004 Aron Griffis + * Make Feb 17 behavior work without Feb 20 bug :-) + * Release as version 0.2.0 + +20 Feb 2004 Aron Griffis + * Only update copyrights on modified ebuilds, otherwise if you run + echangelog again, it reports that all the ebuilds have been updated! + The copyright year issue would be better solved on Jan 1 of each year by + a separate script. + +17 Feb 2004 Aron Griffis + * Update copyrights on all ebuilds, not just the modified ones + +07 Jan 2004 Aron Griffis + * Updated Makefile to understand building man-page from pod + * Removed static man-page in favor of generated man-page from pod + * Added copyright year updating + * Allow echangelog to run even when no files have changed + +2004-01-07 Karl Trygve Kalleberg + * Added Makefile diff --git a/src/echangelog/Makefile b/src/echangelog/Makefile new file mode 100644 index 0000000..61c5e57 --- /dev/null +++ b/src/echangelog/Makefile @@ -0,0 +1,23 @@ +# Copyright 2004 Karl Trygve Kalleberg +# Copyright 2004 Gentoo Technologies, Inc. +# Distributed under the terms of the GNU General Public License v2 +# +# $Header$ + +include ../../makedefs.mak + +%.1 : %.pod + pod2man $< > $@ + +.PHONY: all +all: echangelog.1 + +dist: echangelog.1 + mkdir -p ../../$(distdir)/src/echangelog/ + cp Makefile AUTHORS README TODO ChangeLog echangelog echangelog.pod echangelog.1 ../../$(distdir)/src/echangelog/ + +install: all + install -m 0755 echangelog $(bindir)/ + install -d $(docdir)/echangelog + install -m 0644 AUTHORS README $(docdir)/echangelog/ + install -m 0644 echangelog.1 $(mandir)/ diff --git a/src/echangelog/README b/src/echangelog/README new file mode 100644 index 0000000..77a7930 --- /dev/null +++ b/src/echangelog/README @@ -0,0 +1,11 @@ +Most of the documentation is contained in the man-page, which you can +read directly (using GNU man) by doing + + man ./echangelog.1 + +To rebuild the man-page from pod source, do + + pod2man --name=echangelog --center='Gentoolkit' \ + echangelog.pod echangelog.1 + +03 Nov 2004 agriffis diff --git a/src/echangelog/TODO b/src/echangelog/TODO new file mode 100644 index 0000000..e69de29 diff --git a/src/echangelog/echangelog b/src/echangelog/echangelog new file mode 100644 index 0000000..1a4bee7 --- /dev/null +++ b/src/echangelog/echangelog @@ -0,0 +1,493 @@ +#!/usr/bin/perl -w +# +# echangelog: Update the ChangeLog for an ebuild. For example: +# +# $ echangelog 'Add ~alpha to KEYWORDS' +# 4a5,7 +# > 10 Feb 2003; Aron Griffis oaf-0.6.8-r1.ebuild : +# > Add ~alpha to KEYWORDS +# > + +use strict; +use POSIX qw(strftime getcwd setlocale); +use File::Find; + +# Fix bug 21022 by restricting to C locale +setlocale(&POSIX::LC_ALL, "C"); + +use Text::Wrap; +$Text::Wrap::columns = 77; +$Text::Wrap::unexpand = 0; + +# Global variables +my (@files, @ebuilds, @conflicts, @trivial, @unknown, @new_versions, %actions); +my ($input, $editor, $entry, $user, $date, $text, $version, $year, $vcs); + +my %vcs = ( cvs => { diff => "cvs -f diff -U0", + status => "cvs -fn up", + add => "cvs -f add", + skip => 6, + regex => qr/^Index: ()(([^\/]*?)\.ebuild)\s*$/ }, + svn => { diff => "svn diff -N", + status => "svn status", + add => "svn add", + skip => 6, + regex => qr/^Index: ()(([^\/]*?)\.ebuild)\s*$/ }, + git => { diff => "git diff", + status => "git diff-index HEAD --name-status", + add => "git add", + skip => 4, + regex => qr/^diff \-\-git \S*\/((\S*)\.ebuild)/ } + +); + +# Figure out what kind of repo we are in. + +if ( -d "CVS" ) { + $vcs = "cvs"; +} elsif ( -d '.svn' ) { + $vcs = "svn"; +} elsif ( -f '/usr/bin/git' and open GIT, "git rev-parse --git-dir |" ) { + $vcs = "git"; + close GIT; +} else { + die "No CVS, .git, .svn directories found, what kind of repo is this?"; +} + +# Read the current ChangeLog +if (-f 'ChangeLog') { + open I, '; } + close I; +} else { + # No ChangeLog here, maybe we should make one... + if (<*.ebuild>) { + open C, "portageq envvar PORTDIR |" or die "Can't find PORTDIR"; + my ($new) = ; + close C; + $new =~ s/\s+$//; + open I, "< $new/skel.ChangeLog" + or die "Can't open $new/skel.ChangeLog for input: $!\n"; + { local $/ = undef; $text = ; } + close I; + my ($cwd) = getcwd(); + $cwd =~ m|.*/(\w+-\w+)/([^/]+)| + or die "Can't figure out category/package.. sorry!\n"; + my ($category, $package_name) = ($1, $2); + $text =~ s/^\*.*//ms; # don't need the fake entry + $text =~ s//$category/; + $text =~ s//$package_name/; + } else { + die "This should be run in a directory with ebuilds...\n"; + } +} + +# Figure out what has changed around here +open C, $vcs{$vcs}{status}.' 2>&1 |' or die "Can't run ".$vcs{$vcs}{status}.": $!\n"; +while () { + if (/^C\s+(\S+)/) { + if($vcs eq "git") { + my $filename = $2; + $filename =~ /\S*\/(\S*)/; + if( -d $1 ) { + next; + } + push @conflicts, $1; + next; + } + push @conflicts, $1; + next; + } elsif (/^\?\s+(\S+)/) { + if($vcs eq "git") { + my $filename = $2; + $filename =~ /\S*\/(\S*)/; + if( -d $1 ) { + next; + } + push @unknown, $1; + next; + } else { + push @unknown, $1; + } + $actions{$1} = '+'; + next; + } elsif (/^([ARMD])\s+(\S+)/) { + my ($status, $filename) = ($1,$2); + if($vcs eq "git") { + open P, "git-rev-parse --sq --show-prefix |"; + my $prefix =

; + $prefix = substr($prefix, 0, -1); + close P; + + if ($filename =~ /$prefix(\S*)/) { + $filename = $1 ; + } + else { + next; + } + } + if( -d $filename ) { + next; + } + push @files, $filename; + ($actions{$filename} = $status) =~ tr/DARM/-+-/d; + } +} + +# git only shows files already added so we need to check for unknown files +# separately here. +if($vcs eq "git") { + find(\&git_unknown_objects, "./"); +} + +sub git_unknown_objects { + my $object = $_; + my ($dev,$ino,$mode,$nlink,$uid,$gid); + + # Ignore empty directories - git doesn't version them and cvs removes them. + if ((($dev,$ino,$mode,$nlink,$uid,$gid) = lstat($_)) && ! -d _) { + open C, $vcs." status $_ 2>&1 1>/dev/null |"; + + while () { + $_ = ; + push @unknown, $object; + }; + close C; + }; +} + +# Separate out the trivial files for now +@files = grep { + !/files.digest|Manifest|ChangeLog/ or do { push @trivial, $_; 0; } +} @files; + +@unknown = grep { + !/files.digest|Manifest|ChangeLog/ or do { push @trivial, $_; 0; } +} @unknown; + +# Don't allow any conflicts +if (@conflicts) { + print STDERR < $nb[$i]); + return $retval if $retval; + next; + } + + # char vs. char + if ($na[$i] =~ /^\D/ and $nb[$i] =~ /^\D/) { + $retval = ($na[$i] cmp $nb[$i]); + return $retval if $retval; + next; + } + + # num vs. char + $retval = ($na[$i] =~ /\d/ and -1 or +1); + return $retval; + } + + # + # compare suffix second + # + if (defined $sa and !defined $sb) { + return +2 if $sa eq "p"; + return -2; + } + if (defined $sb and !defined $sa) { + return -3 if $sb eq "p"; + return +3; + } + + if (defined $sa) { # and defined $sb + $retval = ($sa cmp $sb); + if ($retval) { + return +4 if $sa eq "p"; + return -4 if $sb eq "p"; + return $retval; # suffixes happen to be alphabetical order, mostly + } + + # compare suffix number + return +5 if defined $sna and !defined $snb; + return -5 if defined $snb and !defined $sna; + if (defined $sna) { # and defined $snb + $retval = ($sna <=> $snb); + return $retval if $retval; + } + } + + # + # compare rev third + # + return +6 if defined $ra and !defined $rb; + return -6 if defined $rb and !defined $ra; + if (defined $ra) { # and defined $rb + return ($ra <=> $rb); + } + + # + # nothing left to compare + # + return 0; +} +@files = sort sortfunc @files; + +# Forget ebuilds that only have changed copyrights, unless that's all +# the changed files we have + +@ebuilds = grep /\.ebuild$/, @files; +@files = grep !/\.ebuild$/, @files; + +if (@ebuilds) { + if ($vcs eq "git") { + open C, $vcs{$vcs}{diff}." HEAD -- @ebuilds 2>&1 |" or die "Can't run: ".$vcs{$vcs}{diff}."$!\n"; + } else { + open C, $vcs{$vcs}{diff}." @ebuilds 2>&1 |" or die "Can't run: ".$vcs{$vcs}{diff}."$!\n"; + } + $_ = ; + while (defined $_) { + # only possible with cvs + if (/^$vcs diff: (([^\/]*?)\.ebuild) was removed/) { + push @files, $1; + } + + # We assume GNU diff output format here. + # git format: diff --git a/app-doc/repodoc/metadata.xml b/app-doc/repodoc/metadata.xml + elsif (/$vcs{$vcs}{regex}/) { + my $f; + if ($vcs eq "git") { + ($f) = ($1); + my $version = ($2); + while () { + last if /^deleted file mode|^index/; + if (/^new file mode/) { + push @new_versions, $version; # new ebuild, will create a new entry + last; + } + } + } else { + ($f) = ($2); + } + + # check if more than just copyright date changed. + # skip some lines (vcs dependent) + foreach(1..$vcs{$vcs}{skip}){ + $_ = ; + } + while () { + last if /^[A-Za-z]/; + if (/^[-+](?!# Copyright)/) { + push @files, $f; + last; + } + } + # at this point we've either added $f to @files or not, + # and we have the next line in $_ for processing + next; + } + elsif (/^$vcs.*?: (([^\/]*?)\.ebuild) is a new entry/) { + push @files, $1; + push @new_versions, $2; # new ebuild, will create a new entry + } + # other cvs output is ignored + $_ = ; + } +} +close C; + +# When a package move occurs, the versions appear to be new even though they are +# not. Trim them from @new_versions in that case. +@new_versions = grep { $text !~ /^\*\Q$_\E\s/m } @new_versions; + +# Check if we have any files left, otherwise re-insert ebuild list +# (of course, both might be empty anyway) +@files = @ebuilds unless (@files); + +# Allow ChangeLog entries with no changed files, but give a fat warning +unless (@files) { + print STDERR "**\n"; + print STDERR "** NOTE: No non-trivial changed files found. Normally echangelog\n"; + print STDERR "** should be run after all affected files have been added and/or\n"; + print STDERR "** modified. Did you forget to $vcs add?\n"; + print STDERR "**\n"; + @files = sort sortfunc @trivial; + @files = qw/ChangeLog/ unless @files; # last resort to put something in the list +} + +# Get the input from the cmdline, editor or stdin +if ($ARGV[0]) { + $input = "@ARGV"; +} else { + # Testing for defined() allows ECHANGELOG_EDITOR='' to cancel EDITOR + $editor = defined($ENV{'ECHANGELOG_EDITOR'}) ? $ENV{'ECHANGELOG_EDITOR'} : + $ENV{'EDITOR'} || undef; + if ($editor) { + system("$editor ChangeLog.new"); + if ($? != 0) { + # This usually happens when the editor got forcefully killed; and + # the terminal is probably messed up: so we reset things. + system('/usr/bin/stty sane'); + print STDERR "Editor died! Reverting to stdin method.\n"; + undef $editor; + } else { + if (open I, "; + close I; + } else { + print STDERR "Error opening ChangeLog.new: $!\n"; + print STDERR "Reverting to stdin method.\n"; + undef $editor; + } + unlink 'ChangeLog.new'; + } + } + unless ($editor) { + print "Please type the log entry: use Ctrl-d to finish, Ctrl-c to abort...\n"; + local $/ = undef; + $input = <>; + } +} +die "Empty entry; aborting\n" unless $input =~ /\S/; + +# If there are any long lines, then wrap the input at $columns chars +# (leaving 2 chars on left, one char on right, after adding indentation below). +$input =~ s/^\s*(.*?)\s*\z/$1/s; # trim whitespace +$input = Text::Wrap::fill(' ', ' ', $input); + +# Prepend the user info to the input +unless ($user = $ENV{'ECHANGELOG_USER'}) { + my ($fullname, $username) = (getpwuid($<))[6,0]; + $fullname =~ s/,.*//; # remove GECOS, bug 80011 + $user = sprintf "%s <%s\@gentoo.org>", $fullname, $username; +} +# Make sure that we didn't get "root" +die "Please set ECHANGELOG_USER or run as non-root\n" if $user =~ /ChangeLog.new' or die "Can't open ChangeLog.new for output: $!\n"; +print O $text or die "Can't write ChangeLog.new: $!\n"; +close O or die "Can't close ChangeLog.new: $!\n"; + +# Update affected ebuild copyright dates. There is no reason to update the +# copyright lines on ebuilds that haven't changed. I verified this with an IP +# lawyer. +for my $e (grep /\.ebuild$/, @files) { + if (-s $e) { + my ($etext, $netext); + open E, "<$e" or warn("Can't read $e to update copyright year\n"), next; + { local $/ = undef; $etext = ; } + close E; + + # Attempt the substitution and compare + $netext = update_copyright($etext); + next if $netext eq $etext; # skip this file if no change. + + # Write the new ebuild + open E, ">$e.new" or warn("Can't open $e.new\n"), next; + print E $netext and + close E or warn("Can't write $e.new\n"), next; + + # Move things around and show the diff + system "diff -U 0 $e $e.new"; + rename "$e.new", $e or warn("Can't rename $e.new: $!\n"); + } +} + +# Move things around and show the ChangeLog diff +system 'diff -Nu ChangeLog ChangeLog.new'; +rename 'ChangeLog.new', 'ChangeLog' or die "Can't rename ChangeLog.new: $!\n"; + +# Okay, now we have a starter ChangeLog to work with. +# The text will be added just like with any other ChangeLog below. +# Add the new ChangeLog to vcs before continuing. +if ($vcs eq "cvs") { + if (open F, "CVS/Entries") { + system("cvs -f add ChangeLog") unless (scalar grep /^\/ChangeLog\//, ); + } +} elsif ($vcs eq "svn") { + if (open F, ".svn/entries") { + system("svn add ChangeLog") unless (scalar grep /ChangeLog/, ); + } +} else { + system("$vcs{$vcs}{add} ChangeLog 2>&1 >> /dev/null"); +} + +# vim:sw=4 ts=8 expandtab diff --git a/src/echangelog/echangelog.1 b/src/echangelog/echangelog.1 new file mode 100644 index 0000000..f83eaf7 --- /dev/null +++ b/src/echangelog/echangelog.1 @@ -0,0 +1,275 @@ +.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.13 +.\" +.\" Standard preamble: +.\" ======================================================================== +.de Sh \" Subsection heading +.br +.if t .Sp +.ne 5 +.PP +\fB\\$1\fR +.PP +.. +.de Sp \" Vertical space (when we can't use .PP) +.if t .sp .5v +.if n .sp +.. +.de Vb \" Begin verbatim text +.ft CW +.nf +.ne \\$1 +.. +.de Ve \" End verbatim text +.ft R +.fi +.. +.\" Set up some character translations and predefined strings. \*(-- will +.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left +.\" double quote, and \*(R" will give a right double quote. | will give a +.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to +.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C' +.\" expand to `' in nroff, nothing in troff, for use with C<>. +.tr \(*W-|\(bv\*(Tr +.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' +.ie n \{\ +. ds -- \(*W- +. ds PI pi +. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch +. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch +. ds L" "" +. ds R" "" +. ds C` "" +. ds C' "" +'br\} +.el\{\ +. ds -- \|\(em\| +. ds PI \(*p +. ds L" `` +. ds R" '' +'br\} +.\" +.\" If the F register is turned on, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. +.if \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. nr % 0 +. rr F +.\} +.\" +.\" For nroff, turn off justification. Always turn off hyphenation; it makes +.\" way too many mistakes in technical documents. +.hy 0 +.if n .na +.\" +.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). +.\" Fear. Run. Save yourself. No user-serviceable parts. +. \" fudge factors for nroff and troff +.if n \{\ +. ds #H 0 +. ds #V .8m +. ds #F .3m +. ds #[ \f1 +. ds #] \fP +.\} +.if t \{\ +. ds #H ((1u-(\\\\n(.fu%2u))*.13m) +. ds #V .6m +. ds #F 0 +. ds #[ \& +. ds #] \& +.\} +. \" simple accents for nroff and troff +.if n \{\ +. ds ' \& +. ds ` \& +. ds ^ \& +. ds , \& +. ds ~ ~ +. ds / +.\} +.if t \{\ +. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" +. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' +. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' +. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' +. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' +. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' +.\} +. \" troff and (daisy-wheel) nroff accents +.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' +.ds 8 \h'\*(#H'\(*b\h'-\*(#H' +.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] +.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' +.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' +.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] +.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] +.ds ae a\h'-(\w'a'u*4/10)'e +.ds Ae A\h'-(\w'A'u*4/10)'E +. \" corrections for vroff +.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' +.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' +. \" for low resolution devices (crt and lpr) +.if \n(.H>23 .if \n(.V>19 \ +\{\ +. ds : e +. ds 8 ss +. ds o a +. ds d- d\h'-1'\(ga +. ds D- D\h'-1'\(hy +. ds th \o'bp' +. ds Th \o'LP' +. ds ae ae +. ds Ae AE +.\} +.rm #[ #] #H #V #F C +.\" ======================================================================== +.\" +.IX Title "ECHANGELOG 1" +.TH ECHANGELOG 1 "2004-04-02" "perl v5.8.2" "User Contributed Perl Documentation" +.SH "NAME" +echangelog \- Gentoo: update portage ChangeLogs +.SH "SYNOPSIS" +.IX Header "SYNOPSIS" +echangelog [ \fItext\fR ] +.SH "DESCRIPTION" +.IX Header "DESCRIPTION" +This tool provides an easy way to create or update portage ChangeLogs +in Gentoo. The tool scans the current directory, which is assumed to +be a package directory such as /usr/portage/app\-editors/vim, finds +what files have been changed or added, and inserts the appropriate +entry to ChangeLog. If \fItext\fR is not provided on the command\-line, +echangelog prompts for it. +.PP +All modifications should occur before running echangelog so that it +can include the appropriate file information in the ChangeLog entry. +For example, you should run \*(L"cvs add\*(R" on your files, otherwise +echangelog won't know those files are part of the update. +.PP +If your text would cause the ChangeLog entry to exceed 80 columns, it +will be rewrapped to keep the ChangeLog neat. If you need special +formatting in the ChangeLog, then you can either (1) run echangelog +with no text on the command\-line, and make sure that your text won't +be too wide, (2) edit the ChangeLog manually. If you prefer (2), I'd +recommend something like \*(L"echangelog blah\*(R" so that the header lines +are computed correctly, then edit and change \*(L"blah\*(R" to your preferred +text. +.PP +In addition to updating the ChangeLog, echangelog will automatically +update the copyright year of all out-of-date ebuilds, as well as the +ChangeLog itself. These updates are included in the diff displayed by +echangelog when it finishes its work. +.SH "OPTIONS" +.IX Header "OPTIONS" +Presently echangelog is simple enough that it supplies no options. +Probably I'll add \fB\-\-help\fR and \fB\-\-version\fR in the future, but for +now it's enough to track the gentoolkit version. +.SH "EXAMPLES" +.IX Header "EXAMPLES" +To create a ChangeLog for a completely new package. The header is +parsed from skel.ebuild. +.PP +.Vb 2 +\& $ cvs add metalog-0.1.ebuild +\& cvs server: use 'cvs commit' to add this file permanently +.Ve +.PP +.Vb 13 +\& $ echangelog 'New ebuild, thanks to Harvey McGillicuddy' +\& --- ChangeLog 1969-12-31 19:00:00.000000000 -0500 +\& +++ ChangeLog.new 2003-02-23 14:04:06.000000000 -0500 +\& @@ -0,0 +1,9 @@ +\& +# ChangeLog for app-admin/metalog +\& +# Copyright 2000-2003 Gentoo Technologies, Inc.; Distributed under the GPL v2 +\& +# $Header$ +\& + +\& +*metalog-0.1 (23 Feb 2003) +\& + +\& + 23 Feb 2003; Aron Griffis metalog-0.1.ebuild : +\& + New ebuild, thanks to Harvey McGillicuddy +\& + +.Ve +.PP +To bump a revision. Note you need to \*(L"cvs add\*(R" so that echangelog +will notice the new file. +.PP +.Vb 2 +\& $ cvs add metalog-0.1-r1.ebuild +\& cvs server: use 'cvs commit' to add this file permanently +.Ve +.PP +.Vb 6 +\& $ echangelog 'Bump revision to fix bug #999' +\& --- ChangeLog 2003-02-23 14:04:06.000000000 -0500 +\& +++ ChangeLog.new 2003-02-23 14:07:48.000000000 -0500 +\& @@ -2,6 +2,11 @@ +\& # Copyright 2000-2003 Gentoo Technologies, Inc.; Distributed under the GPL v2 +\& # $Header$ +.Ve +.PP +.Vb 6 +\& +*metalog-0.1-r1 (23 Feb 2003) +\& + +\& + 23 Feb 2003; Aron Griffis metalog-0.1-r1.ebuild : +\& + Bump revision to fix bug #999 +\& + +\& *metalog-0.1 (23 Feb 2003) +.Ve +.PP +.Vb 1 +\& 23 Feb 2003; Aron Griffis metalog-0.1.ebuild : +.Ve +.PP +For a multi-line entry, omit the command-line arg. +.PP +.Vb 10 +\& $ echangelog +\& Please type the log entry, finish with ctrl-d +\& Bump revision to fix bug #999. Necessary to bump the revision because +\& the problem appears at run-time, not compile-time. This should also +\& give users the updated default configuration file. +\& --- ChangeLog 2003-02-23 14:09:12.000000000 -0500 +\& +++ ChangeLog.new 2003-02-23 14:12:43.000000000 -0500 +\& @@ -2,6 +2,13 @@ +\& # Copyright 2000-2003 Gentoo Technologies, Inc.; Distributed under the GPL v2 +\& # $Header$ +.Ve +.PP +.Vb 8 +\& +*metalog-0.1-r1 (23 Feb 2003) +\& + +\& + 23 Feb 2003; Aron Griffis metalog-0.1-r1.ebuild : +\& + Bump revision to fix bug #999. Necessary to bump the revision because +\& + the problem appears at run-time, not compile-time. This should also +\& + give users the updated default configuration file. +\& + +\& *metalog-0.1 (23 Feb 2003) +.Ve +.PP +.Vb 1 +\& 23 Feb 2003; Aron Griffis metalog-0.1.ebuild : +.Ve +.SH "ENVIRONMENT VARIABLES" +.IX Header "ENVIRONMENT VARIABLES" +.IP "\s-1ECHANGELOG_USER\s0" 4 +.IX Item "ECHANGELOG_USER" +If echangelog can't figure out your username for the entry, you should +set \s-1ECHANGELOG_USER\s0. For example, export ECHANGELOG_USER=\*(L"Aron +Griffis \*(R" +.SH "NOTES" +.IX Header "NOTES" +As of the most recent version of echangelog (when this man-page +appeared), echangelog puts all new entries at the top of the file +instead of finding the appropriate *version line within the file. +This is because that \*(L"new\*(R" ChangeLog format was never agreed upon by +the Gentoo developers. Unfortunately the existence of both formats +will undoubtedly cause much confusion. +.PP +This also means that the examples above are wrong, since I just copied +them from some old email. However they're not much wrong. ;\-) +.PP +This tool was written by Aron Griffis . Bugs +found should be filed against me at http://bugs.gentoo.org/ diff --git a/src/echangelog/echangelog.pod b/src/echangelog/echangelog.pod new file mode 100644 index 0000000..192af8d --- /dev/null +++ b/src/echangelog/echangelog.pod @@ -0,0 +1,136 @@ +=head1 NAME + +echangelog - Gentoo: update portage ChangeLogs + +=head1 SYNOPSIS + +echangelog [ I ] + +=head1 DESCRIPTION + +This tool provides an easy way to create or update portage ChangeLogs +in Gentoo. The tool scans the current directory, which is assumed to +be a package directory such as /usr/portage/app-editors/vim, finds +what files have been changed or added, and inserts the appropriate +entry to ChangeLog. If I is not provided on the command-line, +echangelog prompts for it. + +All modifications should occur before running echangelog so that it +can include the appropriate file information in the ChangeLog entry. +For example, you should run "cvs add" on your files, otherwise +echangelog won't know those files are part of the update. + +If your text would cause the ChangeLog entry to exceed 80 columns, it +will be rewrapped to keep the ChangeLog neat. If you need special +formatting in the ChangeLog, then you can either (1) run echangelog +with no text on the command-line, and make sure that your text won't +be too wide, (2) edit the ChangeLog manually. If you prefer (2), I'd +recommend something like "echangelog blah" so that the header lines +are computed correctly, then edit and change "blah" to your preferred +text. + +In addition to updating the ChangeLog, echangelog will automatically +update the copyright year of all out-of-date ebuilds, as well as the +ChangeLog itself. These updates are included in the diff displayed by +echangelog when it finishes its work. + +=head1 OPTIONS + +Presently echangelog is simple enough that it supplies no options. +Probably I'll add B<--help> and B<--version> in the future, but for +now it's enough to track the gentoolkit version. + +=head1 EXAMPLES + +To create a ChangeLog for a completely new package. The header is +parsed from skel.ebuild. + + $ cvs add metalog-0.1.ebuild + cvs server: use 'cvs commit' to add this file permanently + + $ echangelog 'New ebuild, thanks to Harvey McGillicuddy' + --- ChangeLog 1969-12-31 19:00:00.000000000 -0500 + +++ ChangeLog.new 2003-02-23 14:04:06.000000000 -0500 + @@ -0,0 +1,9 @@ + +# ChangeLog for app-admin/metalog + +# Copyright 2000-2003 Gentoo Technologies, Inc.; Distributed under the GPL v2 + +# $Header$ + + + +*metalog-0.1 (23 Feb 2003) + + + + 23 Feb 2003; Aron Griffis metalog-0.1.ebuild : + + New ebuild, thanks to Harvey McGillicuddy + + + +To bump a revision. Note you need to "cvs add" so that echangelog +will notice the new file. + + $ cvs add metalog-0.1-r1.ebuild + cvs server: use 'cvs commit' to add this file permanently + + $ echangelog 'Bump revision to fix bug #999' + --- ChangeLog 2003-02-23 14:04:06.000000000 -0500 + +++ ChangeLog.new 2003-02-23 14:07:48.000000000 -0500 + @@ -2,6 +2,11 @@ + # Copyright 2000-2003 Gentoo Technologies, Inc.; Distributed under the GPL v2 + # $Header$ + + +*metalog-0.1-r1 (23 Feb 2003) + + + + 23 Feb 2003; Aron Griffis metalog-0.1-r1.ebuild : + + Bump revision to fix bug #999 + + + *metalog-0.1 (23 Feb 2003) + + 23 Feb 2003; Aron Griffis metalog-0.1.ebuild : + +For a multi-line entry, omit the command-line arg. + + $ echangelog + Please type the log entry, finish with ctrl-d + Bump revision to fix bug #999. Necessary to bump the revision because + the problem appears at run-time, not compile-time. This should also + give users the updated default configuration file. + --- ChangeLog 2003-02-23 14:09:12.000000000 -0500 + +++ ChangeLog.new 2003-02-23 14:12:43.000000000 -0500 + @@ -2,6 +2,13 @@ + # Copyright 2000-2003 Gentoo Technologies, Inc.; Distributed under the GPL v2 + # $Header$ + + +*metalog-0.1-r1 (23 Feb 2003) + + + + 23 Feb 2003; Aron Griffis metalog-0.1-r1.ebuild : + + Bump revision to fix bug #999. Necessary to bump the revision because + + the problem appears at run-time, not compile-time. This should also + + give users the updated default configuration file. + + + *metalog-0.1 (23 Feb 2003) + + 23 Feb 2003; Aron Griffis metalog-0.1.ebuild : + +=head1 ENVIRONMENT VARIABLES + +=over + +=item ECHANGELOG_USER + +If echangelog can't figure out your username for the entry, you should +set ECHANGELOG_USER. For example, export ECHANGELOG_USER="Aron +Griffis " + +=back + +=head1 NOTES + +As of the most recent version of echangelog (when this man-page +appeared), echangelog puts all new entries at the top of the file +instead of finding the appropriate *version line within the file. +This is because that "new" ChangeLog format was never agreed upon by +the Gentoo developers. Unfortunately the existence of both formats +will undoubtedly cause much confusion. + +This also means that the examples above are wrong, since I just copied +them from some old email. However they're not much wrong. ;-) + +This tool was written by Aron Griffis . Bugs +found should be filed against me at http://bugs.gentoo.org/ diff --git a/src/eclean/AUTHORS b/src/eclean/AUTHORS new file mode 100644 index 0000000..9263cbb --- /dev/null +++ b/src/eclean/AUTHORS @@ -0,0 +1 @@ +Thomas de Grenier de Latour (tgl) diff --git a/src/eclean/ChangeLog b/src/eclean/ChangeLog new file mode 100644 index 0000000..36d9a28 --- /dev/null +++ b/src/eclean/ChangeLog @@ -0,0 +1,27 @@ +2005-12-19 Paul Varner + * Add support for reqular expression matching for file names in the + exclude files. + +2005-08-28 Thomas de Grenier de Latour (tgl) + * Version 0.4.1 + * added support for some "eclean-dist" and "eclean-pkg" symlinks on eclean + (and thus refactored command-line parsing and help screen code) + * accept file names in exclude files for specific distfiles protection + (useful to protect the OOo i18n files for instance, which are not in + $SRC_URI but put there manually) + * minor rewrite of some findDistfiles() code + * added /usr/lib/portage/pym python path, just to be sure it comes first + (after all, "ouput" is a pretty generic name for a python module...) + * updated manpage + +2005-08-27 Thomas de Grenier de Latour (tgl) + * Version 0.4 + * added exclusion files support + * added time limit option + * added size limit option (for distfiles only) + * added fetch-restricted distfile optionnal protection + * added --package-names option for protection of all versions of installed + packages. + * removed support of multiple actions on command-line. That would have been + hell with action-specific options. + * updated manpage diff --git a/src/eclean/Makefile b/src/eclean/Makefile new file mode 100644 index 0000000..79c5895 --- /dev/null +++ b/src/eclean/Makefile @@ -0,0 +1,24 @@ +# Copyright 2004 Karl Trygve Kalleberg +# Copyright 2004 Gentoo Technologies, Inc. +# Distributed under the terms of the GNU General Public License v2 +# +# $Header$ + +include ../../makedefs.mak + +all: + +dist: + mkdir -p ../../$(distdir)/src/eclean + cp eclean eclean.1 Makefile *.exclude ../../$(distdir)/src/eclean + cp AUTHORS THANKS TODO ChangeLog ../../$(distdir)/src/eclean + +install: + install -m 0755 eclean $(bindir)/ + ln -sf eclean $(bindir)/eclean-pkg + ln -sf eclean $(bindir)/eclean-dist + install -d $(sysconfdir)/eclean + install -m 0644 distfiles.exclude packages.exclude $(sysconfdir)/eclean/ + install -d $(docdir)/eclean + install -m 0644 AUTHORS THANKS TODO ChangeLog $(docdir)/eclean/ + install -m 0644 eclean.1 $(mandir)/ diff --git a/src/eclean/THANKS b/src/eclean/THANKS new file mode 100644 index 0000000..6b8dc2e --- /dev/null +++ b/src/eclean/THANKS @@ -0,0 +1,7 @@ +The starting point ideas were found here: +http://forums.gentoo.org/viewtopic.php?t=3011 + +Thanks to eswanson and far for their contributions, and to wolf31o2 for his +support. Thanks also to karltk, some of this code was at some point inspired +by his "equery" tool. And thanks to people who had a look on bug #33877: +Benjamin Braatz, fuzzyray, genone, etc. diff --git a/src/eclean/TODO b/src/eclean/TODO new file mode 100644 index 0000000..04e64ca --- /dev/null +++ b/src/eclean/TODO @@ -0,0 +1,16 @@ +- exclusion file syntax could be improved (maybe it should support real + dep-atoms, or wildcards, etc.) + +- some policy to keep the X latest versions of a package (in each of its + SLOT maybe) would be really cool... + +- add an option to protect system binary packages + => yup, but later... (needs some portage modifications to be done right) + +- add actions for PORT_LOGDIR and/or /var/tmp/portage cleaning? + => bah, don't know... imho tmpreaper or find+rm onliners are enough here + +- cleanup of DISTDIR/cvs-src when action=distfiles + => i never use cvs ebuilds, i should check what it does exactly + +- rewrite for a decent Portage API if there ever is one diff --git a/src/eclean/distfiles.exclude b/src/eclean/distfiles.exclude new file mode 100644 index 0000000..a31be55 --- /dev/null +++ b/src/eclean/distfiles.exclude @@ -0,0 +1,5 @@ +# /etc/eclean/distfiles.exclude +# In this file you can list some categories or cat/pkg-name for which you want +# to protect distfiles from "ecleaning". You can also name some specific files. +# See `man eclean` for syntax details. +metadata.dtd diff --git a/src/eclean/eclean b/src/eclean/eclean new file mode 100644 index 0000000..4fdec10 --- /dev/null +++ b/src/eclean/eclean @@ -0,0 +1,807 @@ +#!/usr/bin/env python +# Copyright 2003-2005 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: $ + + +############################################################################### +# Meta: +__author__ = "Thomas de Grenier de Latour (tgl)" +__email__ = "degrenier@easyconnect.fr" +__version__ = "0.4.1" +__productname__ = "eclean" +__description__ = "A cleaning tool for Gentoo distfiles and binaries." + + +############################################################################### +# Python imports: +import sys +import os, stat +import re +import time +import getopt +import fpformat +import signal +try: + import portage +except ImportError: + sys.path.insert(0, "/usr/lib/portage/pym") + import portage +try: + from portage.output import * +except ImportError: + from output import * + +listdir = portage.listdir + +############################################################################### +# Misc. shortcuts to some portage stuff: +port_settings = portage.settings +distdir = port_settings["DISTDIR"] +pkgdir = port_settings["PKGDIR"] + + +############################################################################### +# printVersion: +def printVersion(): + print "%s (version %s) - %s" \ + % (__productname__, __version__, __description__) + print "Author: %s <%s>" % (__author__,__email__) + print "Copyright 2003-2005 Gentoo Foundation" + print "Distributed under the terms of the GNU General Public License v2" + + +############################################################################### +# printUsage: print help message. May also print partial help to stderr if an +# error from {'options','actions'} is specified. +def printUsage(error=None,help=None): + out = sys.stdout + if error: out = sys.stderr + if not error in ('actions', 'global-options', \ + 'packages-options', 'distfiles-options', \ + 'merged-packages-options', 'merged-distfiles-options', \ + 'time', 'size'): + error = None + if not error and not help: help = 'all' + if error == 'time': + eerror("Wrong time specification") + print >>out, "Time specification should be an integer followed by a"+ \ + " single letter unit." + print >>out, "Available units are: y (years), m (months), w (weeks), "+ \ + "d (days) and h (hours)." + print >>out, "For instance: \"1y\" is \"one year\", \"2w\" is \"two"+ \ + " weeks\", etc. " + return + if error == 'size': + eerror("Wrong size specification") + print >>out, "Size specification should be an integer followed by a"+ \ + " single letter unit." + print >>out, "Available units are: G, M, K and B." + print >>out, "For instance: \"10M\" is \"ten megabytes\", \"200K\" "+ \ + "is \"two hundreds kilobytes\", etc." + return + if error in ('global-options', 'packages-options', 'distfiles-options', \ + 'merged-packages-options', 'merged-distfiles-options',): + eerror("Wrong option on command line.") + print >>out + elif error == 'actions': + eerror("Wrong or missing action name on command line.") + print >>out + print >>out, white("Usage:") + if error in ('actions','global-options', 'packages-options', \ + 'distfiles-options') or help == 'all': + print >>out, " "+turquoise(__productname__), \ + yellow("[global-option] ..."), \ + green(""), \ + yellow("[action-option] ...") + if error == 'merged-distfiles-options' or help in ('all','distfiles'): + print >>out, " "+turquoise(__productname__+'-dist'), \ + yellow("[global-option, distfiles-option] ...") + if error == 'merged-packages-options' or help in ('all','packages'): + print >>out, " "+turquoise(__productname__+'-pkg'), \ + yellow("[global-option, packages-option] ...") + if error in ('global-options', 'actions'): + print >>out, " "+turquoise(__productname__), \ + yellow("[--help, --version]") + if help == 'all': + print >>out, " "+turquoise(__productname__+"(-dist,-pkg)"), \ + yellow("[--help, --version]") + if error == 'merged-packages-options' or help == 'packages': + print >>out, " "+turquoise(__productname__+'-pkg'), \ + yellow("[--help, --version]") + if error == 'merged-distfiles-options' or help == 'distfiles': + print >>out, " "+turquoise(__productname__+'-dist'), \ + yellow("[--help, --version]") + print >>out + if error in ('global-options', 'merged-packages-options', \ + 'merged-distfiles-options') or help: + print >>out, "Available global", yellow("options")+":" + print >>out, yellow(" -C, --nocolor")+ \ + " - turn off colors on output" + print >>out, yellow(" -d, --destructive")+ \ + " - only keep the minimum for a reinstallation" + print >>out, yellow(" -e, --exclude-file=")+ \ + " - path to the exclusion file" + print >>out, yellow(" -i, --interactive")+ \ + " - ask confirmation before deletions" + print >>out, yellow(" -n, --package-names")+ \ + " - protect all versions (when --destructive)" + print >>out, yellow(" -p, --pretend")+ \ + " - only display what would be cleaned" + print >>out, yellow(" -q, --quiet")+ \ + " - be as quiet as possible" + print >>out, yellow(" -t, --time-limit=

  • elements for a given
      or
        node. + + @type listnode: xml.dom.Node + @param listnode:
          or
            list to get the elements for + @rtype: List of Strings + @return: a list that contains the value of the
          1. elements + """ + rValue = [] + if not listnode.nodeName in ["ul", "ol"]: + raise GlsaFormatException("Invalid function call: listnode is not
              or
                ") + for li in listnode.childNodes: + if li.nodeType != xml.dom.Node.ELEMENT_NODE: + continue + rValue.append(getText(li, format="strip")) + return rValue + +def getText(node, format): + """ + This is the main parser function. It takes a node and traverses + recursive over the subnodes, getting the text of each (and the + I{link} attribute for and ). Depending on the I{format} + parameter the text might be formatted by adding/removing newlines, + tabs and spaces. This function is only useful for the GLSA DTD, + it's not applicable for other DTDs. + + @type node: xml.dom.Node + @param node: the root node to start with the parsing + @type format: String + @param format: this should be either I{strip}, I{keep} or I{xml} + I{keep} just gets the text and does no formatting. + I{strip} replaces newlines and tabs with spaces and + replaces multiple spaces with one space. + I{xml} does some more formatting, depending on the + type of the encountered nodes. + @rtype: String + @return: the (formatted) content of the node and its subnodes + """ + rValue = "" + if format in ["strip", "keep"]: + if node.nodeName in ["uri", "mail"]: + rValue += node.childNodes[0].data+": "+node.getAttribute("link") + else: + for subnode in node.childNodes: + if subnode.nodeName == "#text": + rValue += subnode.data + else: + rValue += getText(subnode, format) + else: + for subnode in node.childNodes: + if subnode.nodeName == "p": + for p_subnode in subnode.childNodes: + if p_subnode.nodeName == "#text": + rValue += p_subnode.data.strip() + elif p_subnode.nodeName in ["uri", "mail"]: + rValue += p_subnode.childNodes[0].data + rValue += " ( "+p_subnode.getAttribute("link")+" )" + rValue += NEWLINE_ESCAPE + elif subnode.nodeName == "ul": + for li in getListElements(subnode): + rValue += "-"+SPACE_ESCAPE+li+NEWLINE_ESCAPE+" " + elif subnode.nodeName == "ol": + i = 0 + for li in getListElements(subnode): + i = i+1 + rValue += str(i)+"."+SPACE_ESCAPE+li+NEWLINE_ESCAPE+" " + elif subnode.nodeName == "code": + rValue += getText(subnode, format="keep").replace("\n", NEWLINE_ESCAPE) + if rValue[-1*len(NEWLINE_ESCAPE):] != NEWLINE_ESCAPE: + rValue += NEWLINE_ESCAPE + elif subnode.nodeName == "#text": + rValue += subnode.data + else: + raise GlsaFormatException("Invalid Tag found: ", subnode.nodeName) + if format == "strip": + rValue = rValue.strip(" \n\t") + rValue = re.sub("[\s]{2,}", " ", rValue) + # Hope that the utf conversion doesn't break anything else + return rValue.encode("utf_8") + +def getMultiTagsText(rootnode, tagname, format): + """ + Returns a list with the text of all subnodes of type I{tagname} + under I{rootnode} (which itself is not parsed) using the given I{format}. + + @type rootnode: xml.dom.Node + @param rootnode: the node to search for I{tagname} + @type tagname: String + @param tagname: the name of the tags to search for + @type format: String + @param format: see L{getText} + @rtype: List of Strings + @return: a list containing the text of all I{tagname} childnodes + """ + rValue = [] + for e in rootnode.getElementsByTagName(tagname): + rValue.append(getText(e, format)) + return rValue + +def makeAtom(pkgname, versionNode): + """ + creates from the given package name and information in the + I{versionNode} a (syntactical) valid portage atom. + + @type pkgname: String + @param pkgname: the name of the package for this atom + @type versionNode: xml.dom.Node + @param versionNode: a or Node that + contains the version information for this atom + @rtype: String + @return: the portage atom + """ + rValue = opMapping[versionNode.getAttribute("range")] \ + + pkgname \ + + "-" + getText(versionNode, format="strip") + return str(rValue) + +def makeVersion(versionNode): + """ + creates from the information in the I{versionNode} a + version string (format ). + + @type versionNode: xml.dom.Node + @param versionNode: a or Node that + contains the version information for this atom + @rtype: String + @return: the version string + """ + return opMapping[versionNode.getAttribute("range")] \ + +getText(versionNode, format="strip") + +def match(atom, portdbname, match_type="default"): + """ + wrapper that calls revisionMatch() or portage.dbapi.match() depending on + the given atom. + + @type atom: string + @param atom: a <~ or >~ atom or a normal portage atom that contains the atom to match against + @type portdb: portage.dbapi + @param portdb: one of the portage databases to use as information source + @type match_type: string + @param match_type: if != "default" passed as first argument to dbapi.xmatch + to apply the wanted visibility filters + + @rtype: list of strings + @return: a list with the matching versions + """ + db = portage.db["/"][portdbname].dbapi + if atom[2] == "~": + return revisionMatch(atom, db, match_type=match_type) + elif match_type == "default" or not hasattr(db, "xmatch"): + return db.match(atom) + else: + return db.xmatch(match_type, atom) + +def revisionMatch(revisionAtom, portdb, match_type="default"): + """ + handler for the special >~, >=~, <=~ and <~ atoms that are supposed to behave + as > and < except that they are limited to the same version, the range only + applies to the revision part. + + @type revisionAtom: string + @param revisionAtom: a <~ or >~ atom that contains the atom to match against + @type portdb: portage.dbapi + @param portdb: one of the portage databases to use as information source + @type match_type: string + @param match_type: if != "default" passed as first argument to portdb.xmatch + to apply the wanted visibility filters + + @rtype: list of strings + @return: a list with the matching versions + """ + if match_type == "default" or not hasattr(portdb, "xmatch"): + mylist = portdb.match(re.sub("-r[0-9]+$", "", revisionAtom[2:])) + else: + mylist = portdb.xmatch(match_type, re.sub("-r[0-9]+$", "", revisionAtom[2:])) + rValue = [] + for v in mylist: + r1 = portage.pkgsplit(v)[-1][1:] + r2 = portage.pkgsplit(revisionAtom[3:])[-1][1:] + if eval(r1+" "+revisionAtom[0:2]+" "+r2): + rValue.append(v) + return rValue + + +def getMinUpgrade(vulnerableList, unaffectedList, minimize=True): + """ + Checks if the systemstate is matching an atom in + I{vulnerableList} and returns string describing + the lowest version for the package that matches an atom in + I{unaffectedList} and is greater than the currently installed + version or None if the system is not affected. Both + I{vulnerableList} and I{unaffectedList} should have the + same base package. + + @type vulnerableList: List of Strings + @param vulnerableList: atoms matching vulnerable package versions + @type unaffectedList: List of Strings + @param unaffectedList: atoms matching unaffected package versions + @type minimize: Boolean + @param minimize: True for a least-change upgrade, False for emerge-like algorithm + + @rtype: String | None + @return: the lowest unaffected version that is greater than + the installed version. + """ + rValue = None + v_installed = [] + u_installed = [] + for v in vulnerableList: + v_installed += match(v, "vartree") + + for u in unaffectedList: + u_installed += match(u, "vartree") + + install_unaffected = True + for i in v_installed: + if i not in u_installed: + install_unaffected = False + + if install_unaffected: + return rValue + + for u in unaffectedList: + mylist = match(u, "porttree", match_type="match-all") + for c in mylist: + c_pv = portage.catpkgsplit(c) + i_pv = portage.catpkgsplit(portage.best(v_installed)) + if portage.pkgcmp(c_pv[1:], i_pv[1:]) > 0 \ + and (rValue == None \ + or not match("="+rValue, "porttree") \ + or (minimize ^ (portage.pkgcmp(c_pv[1:], portage.catpkgsplit(rValue)[1:]) > 0)) \ + and match("="+c, "porttree")) \ + and portage.db["/"]["porttree"].dbapi.aux_get(c, ["SLOT"]) == portage.db["/"]["vartree"].dbapi.aux_get(portage.best(v_installed), ["SLOT"]): + rValue = c_pv[0]+"/"+c_pv[1]+"-"+c_pv[2] + if c_pv[3] != "r0": # we don't like -r0 for display + rValue += "-"+c_pv[3] + return rValue + + +# simple Exception classes to catch specific errors +class GlsaTypeException(Exception): + def __init__(self, doctype): + Exception.__init__(self, "wrong DOCTYPE: %s" % doctype) + +class GlsaFormatException(Exception): + pass + +class GlsaArgumentException(Exception): + pass + +# GLSA xml data wrapper class +class Glsa: + """ + This class is a wrapper for the XML data and provides methods to access + and display the contained data. + """ + def __init__(self, myid, myconfig): + """ + Simple constructor to set the ID, store the config and gets the + XML data by calling C{self.read()}. + + @type myid: String + @param myid: String describing the id for the GLSA object (standard + GLSAs have an ID of the form YYYYMM-nn) or an existing + filename containing a GLSA. + @type myconfig: portage.config + @param myconfig: the config that should be used for this object. + """ + if re.match(r'\d{6}-\d{2}', myid): + self.type = "id" + elif os.path.exists(myid): + self.type = "file" + else: + raise GlsaArgumentException("Given ID "+myid+" isn't a valid GLSA ID or filename.") + self.nr = myid + self.config = myconfig + self.read() + + def read(self): + """ + Here we build the filename from the config and the ID and pass + it to urllib to fetch it from the filesystem or a remote server. + + @rtype: None + @return: None + """ + if self.config["CHECKMODE"] == "local": + repository = "file://" + self.config["GLSA_DIR"] + else: + repository = self.config["GLSA_SERVER"] + if self.type == "file": + myurl = "file://"+self.nr + else: + myurl = repository + self.config["GLSA_PREFIX"] + str(self.nr) + self.config["GLSA_SUFFIX"] + self.parse(urllib.urlopen(myurl)) + return None + + def parse(self, myfile): + """ + This method parses the XML file and sets up the internal data + structures by calling the different helper functions in this + module. + + @type myfile: String + @param myfile: Filename to grab the XML data from + @rtype: None + @returns: None + """ + self.DOM = xml.dom.minidom.parse(myfile) + if not self.DOM.doctype: + raise GlsaTypeException(None) + elif self.DOM.doctype.systemId != "http://www.gentoo.org/dtd/glsa.dtd": + raise GlsaTypeException(self.DOM.doctype.systemId) + myroot = self.DOM.getElementsByTagName("glsa")[0] + if self.type == "id" and myroot.getAttribute("id") != self.nr: + raise GlsaFormatException("filename and internal id don't match:" + myroot.getAttribute("id") + " != " + self.nr) + + # the simple (single, required, top-level, #PCDATA) tags first + self.title = getText(myroot.getElementsByTagName("title")[0], format="strip") + self.synopsis = getText(myroot.getElementsByTagName("synopsis")[0], format="strip") + self.announced = getText(myroot.getElementsByTagName("announced")[0], format="strip") + self.revised = getText(myroot.getElementsByTagName("revised")[0], format="strip") + + # now the optional and 0-n toplevel, #PCDATA tags and references + try: + self.access = getText(myroot.getElementsByTagName("access")[0], format="strip") + except IndexError: + self.access = "" + self.bugs = getMultiTagsText(myroot, "bug", format="strip") + self.references = getMultiTagsText(myroot.getElementsByTagName("references")[0], "uri", format="keep") + + # and now the formatted text elements + self.description = getText(myroot.getElementsByTagName("description")[0], format="xml") + self.workaround = getText(myroot.getElementsByTagName("workaround")[0], format="xml") + self.resolution = getText(myroot.getElementsByTagName("resolution")[0], format="xml") + self.impact_text = getText(myroot.getElementsByTagName("impact")[0], format="xml") + self.impact_type = myroot.getElementsByTagName("impact")[0].getAttribute("type") + try: + self.background = getText(myroot.getElementsByTagName("background")[0], format="xml") + except IndexError: + self.background = "" + + # finally the interesting tags (product, affected, package) + self.glsatype = myroot.getElementsByTagName("product")[0].getAttribute("type") + self.product = getText(myroot.getElementsByTagName("product")[0], format="strip") + self.affected = myroot.getElementsByTagName("affected")[0] + self.packages = {} + for p in self.affected.getElementsByTagName("package"): + name = p.getAttribute("name") + if not self.packages.has_key(name): + self.packages[name] = [] + tmp = {} + tmp["arch"] = p.getAttribute("arch") + tmp["auto"] = (p.getAttribute("auto") == "yes") + tmp["vul_vers"] = [makeVersion(v) for v in p.getElementsByTagName("vulnerable")] + tmp["unaff_vers"] = [makeVersion(v) for v in p.getElementsByTagName("unaffected")] + tmp["vul_atoms"] = [makeAtom(name, v) for v in p.getElementsByTagName("vulnerable")] + tmp["unaff_atoms"] = [makeAtom(name, v) for v in p.getElementsByTagName("unaffected")] + self.packages[name].append(tmp) + # TODO: services aren't really used yet + self.services = self.affected.getElementsByTagName("service") + return None + + def dump(self, outstream=sys.stdout): + """ + Dumps a plaintext representation of this GLSA to I{outfile} or + B{stdout} if it is ommitted. You can specify an alternate + I{encoding} if needed (default is latin1). + + @type outstream: File + @param outfile: Stream that should be used for writing + (defaults to sys.stdout) + """ + width = int(self.config["PRINTWIDTH"]) + outstream.write(center("GLSA %s: \n%s" % (self.nr, self.title), width)+"\n") + outstream.write((width*"=")+"\n") + outstream.write(wrap(self.synopsis, width, caption="Synopsis: ")+"\n") + outstream.write("Announced on: %s\n" % self.announced) + outstream.write("Last revised on: %s\n\n" % self.revised) + if self.glsatype == "ebuild": + for k in self.packages.keys(): + pkg = self.packages[k] + for path in pkg: + vul_vers = "".join(path["vul_vers"]) + unaff_vers = "".join(path["unaff_vers"]) + outstream.write("Affected package: %s\n" % k) + outstream.write("Affected archs: ") + if path["arch"] == "*": + outstream.write("All\n") + else: + outstream.write("%s\n" % path["arch"]) + outstream.write("Vulnerable: %s\n" % vul_vers) + outstream.write("Unaffected: %s\n\n" % unaff_vers) + elif self.glsatype == "infrastructure": + pass + if len(self.bugs) > 0: + outstream.write("\nRelated bugs: ") + for i in range(0, len(self.bugs)): + outstream.write(self.bugs[i]) + if i < len(self.bugs)-1: + outstream.write(", ") + else: + outstream.write("\n") + if self.background: + outstream.write("\n"+wrap(self.background, width, caption="Background: ")) + outstream.write("\n"+wrap(self.description, width, caption="Description: ")) + outstream.write("\n"+wrap(self.impact_text, width, caption="Impact: ")) + outstream.write("\n"+wrap(self.workaround, width, caption="Workaround: ")) + outstream.write("\n"+wrap(self.resolution, width, caption="Resolution: ")) + myreferences = "" + for r in self.references: + myreferences += (r.replace(" ", SPACE_ESCAPE)+NEWLINE_ESCAPE+" ") + outstream.write("\n"+wrap(myreferences, width, caption="References: ")) + outstream.write("\n") + + def isVulnerable(self): + """ + Tests if the system is affected by this GLSA by checking if any + vulnerable package versions are installed. Also checks for affected + architectures. + + @rtype: Boolean + @returns: True if the system is affected, False if not + """ + vList = [] + rValue = False + for k in self.packages.keys(): + pkg = self.packages[k] + for path in pkg: + if path["arch"] == "*" or self.config["ARCH"] in path["arch"].split(): + for v in path["vul_atoms"]: + rValue = rValue \ + or (len(match(v, "vartree")) > 0 \ + and getMinUpgrade(path["vul_atoms"], path["unaff_atoms"])) + return rValue + + def isApplied(self): + """ + Looks if the GLSA IDis in the GLSA checkfile to check if this + GLSA was already applied. + + @rtype: Boolean + @returns: True if the GLSA was applied, False if not + """ + aList = portage.grabfile(self.config["CHECKFILE"]) + return (self.nr in aList) + + def inject(self): + """ + Puts the ID of this GLSA into the GLSA checkfile, so it won't + show up on future checks. Should be called after a GLSA is + applied or on explicit user request. + + @rtype: None + @returns: None + """ + if not self.isApplied(): + checkfile = open(self.config["CHECKFILE"], "a+") + checkfile.write(self.nr+"\n") + checkfile.close() + return None + + def getMergeList(self, least_change=True): + """ + Returns the list of package-versions that have to be merged to + apply this GLSA properly. The versions are as low as possible + while avoiding downgrades (see L{getMinUpgrade}). + + @type least_change: Boolean + @param least_change: True if the smallest possible upgrade should be selected, + False for an emerge-like algorithm + @rtype: List of Strings + @return: list of package-versions that have to be merged + """ + rValue = [] + for pkg in self.packages.keys(): + for path in self.packages[pkg]: + update = getMinUpgrade(path["vul_atoms"], path["unaff_atoms"], minimize=least_change) + if update: + rValue.append(update) + return rValue diff --git a/src/lintool/AUTHORS b/src/lintool/AUTHORS new file mode 100644 index 0000000..fe436cb --- /dev/null +++ b/src/lintool/AUTHORS @@ -0,0 +1 @@ +Karl Trygve Kalleberg diff --git a/src/lintool/COPYING b/src/lintool/COPYING new file mode 100644 index 0000000..60549be --- /dev/null +++ b/src/lintool/COPYING @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) 19yy + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) 19yy name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/src/lintool/ChangeLog b/src/lintool/ChangeLog new file mode 100644 index 0000000..0e8c1e9 --- /dev/null +++ b/src/lintool/ChangeLog @@ -0,0 +1,71 @@ +2004-02-18 Karl Trygve Kalleberg + * Moved from separate CVS module to be part of gentoolkit-dev + +2002-10-31 Karl Trygve Kalleberg + * Fixed \$Header$ comment + * Fixed off-by-one in line numbering + +2002-10-30 Karl Trygve Kalleberg + * Now defaults to showing all details + * Added --no-details + * Better LICENSE parsing + * Better references to policy. + * Line numbers for whitespace testing. + * Released 0.2.4 + +2002-08-12 Karl Trygve Kalleberg + * Added more header tests + * Added initial tests for SLOT, KEYWORD and LICENSE + +2002-08-10 Karl Trygve Kalleberg + * Spurious space checker works again. + * Added Makefile, COPYING, README, AUTHORS, NEWS + +2002-07-22 Karl Trygve Kalleberg + * Changed A=${P}.tar.gz check to ^A=.*, as per Seemant's suggestion. + +2002-07-17 Karl Trygve Kalleberg + * Added TestLicense to ebuild.py + * Added --aux-license-dir= + * Added MunchieFormatter + * Added --formatter= + +2002-07-10 Karl Trygve Kalleberg + * Refactored; split tests into changelog, digest and ebuild-specific + * Added TestSyntax test to digest.py + * Added TestHeaders, TestConstructPresence, TestIndentation to + changelog.py + +2002-05-15 Karl Trygve Kalleberg + + * Fixed test for Author: and Maintainer: to warn about their + deprecation and recommend the use of ChangeLog instead. + * Added (E) and (W) prefixes to messages printed by --show-details + * Added --tests=- to allow turning off a + particular test easily. + * Added statistics output at the bottom. + * Updated man page to reflect new option feature. + * Fixed the --show-details, --show-separate annoyance. + * Fixed use flags parsing to disregard some false positives. + +2002-05-13 Karl Trygve Kalleberg + * Fixed --list-tests which was incorrectly --listTests + +2002-04-30 Karl Trygve Kalleberg + * Added 's cleanups + * Improved error reporting; now separates into errors and + warnings. + * Improved TestSpaces to check for non-conformant + line-continuations. + * Added TestUseFlags that checks that an ebuild only uses + sanctioned use flags (read from /usr/portage/profiles/use.desc) + * Added SLOT= to list desired env vars (warns if missing) + * Added LICENSE= to list of required env vars (errors if missing) + * Improved error messages + * Added --tests= option to allow the user to specify which tests + to run + * Added --list-tests option that lists available tests + * Updated man page. + +2002-03-22 Karl Trygve Kalleberg + * Added this ChangeLog diff --git a/src/lintool/NEWS b/src/lintool/NEWS new file mode 100644 index 0000000..e69de29 diff --git a/src/lintool/README b/src/lintool/README new file mode 100644 index 0000000..1494aad --- /dev/null +++ b/src/lintool/README @@ -0,0 +1,23 @@ + +Package: Lintool +Version: 0.1.3 +Author : Karl Trygve Kalleberg + + +MOTIVATION + +Lintool is a "lint" utility for the Gentoo Linux distribution. It is a +tool that tests ebuilds, changelogs and package digests for +well-formedness. It's intended to aid Gentoo Linux developers avoid most +common mistakes when packaging software for Gentoo. + +MECHANICS + +To check an ebuild, do lintool --ebuild +To check a ChangeLog, do lintool --changelog +To check a package digest, do lintoo --digest + +IMPROVEMENTS + +Any suggestions for improvements should be sent to karltk@gentoo.org, or +added as a bug assigned to me. diff --git a/src/lintool/lintool.1 b/src/lintool/lintool.1 new file mode 100644 index 0000000..11883e8 --- /dev/null +++ b/src/lintool/lintool.1 @@ -0,0 +1,41 @@ +.TH lintool "1" "March 2002" "gentoolkit 0.1.3" +.SH NAME +lintool \- manual page for the lintool program, a program that checks the +santity of ebuild scripts. +.SH SYNOPSIS +.B lintool +\fI\fR \fIebuilds...\fR +.SH DESCRIPTION +Lintool checks if a set of +.I ebuilds +conforms to the ebuild style guide. This is not +(yet) an exhaustive test, so your ebuild might be broken even if lintool +thinks it's okay. +.PP +.SH OPTIONS +.TP +\fB--no-summary\fI +Turn off total summary for all tests run on all ebuilds. +.TP +\fB--show-separate\fI +Show short summary of tests for each ebuild checked. +.TP +\fB--show-details\fI +Show full details of tests for each ebuild checked +.TP +\fB--tests=test1,test2,..\fI +Run only the tests specified to this option. Default is to run all +tests. One can turn off a particular test by pretending it with minus (e.g. +.I --tests=-TestUseFlags,-TestSpaces +). A list of tests can be obtained from +.I --list-tests +.TP +\fB--list-tests\fI +List available tests. +.SH AUTHORS +Karl Trygve Kalleberg , 2002 +.SH "SEE ALSO" +ebuild(5) +.TP +The \fI/usr/sbin/lintool\fR script. + diff --git a/src/lintool/lintool.py b/src/lintool/lintool.py new file mode 100755 index 0000000..721c744 --- /dev/null +++ b/src/lintool/lintool.py @@ -0,0 +1,320 @@ +#! /usr/bin/python +# +# Copyright 2002 Gentoo Technologies, Inc +# Distributed under the terms of the GNU General Public License v2.0 +# Author Karl Trygve Kalleberg +# +# About: +# lintool aims to check the stylistic and syntactical correctness for +# ebuilds, changelogs and digest files for the Gentoo packaging system. +# +# TODO +# +# - Make HTMLFormatter +# + +VERSION="0.2.4" + +import sys +import getopt + +from lintool import ebuild, changelog, digest + +class TextFormatter: + def section(self, s): + print "\n" + "-"*79 + print " " + s + "\n" + def bullet(self, s): + print "* " + s + def sub(self, s): + print "- " + s + def subwarn(self, s): + print "- (W) " + s + def suberr(self, s): + print "- (E) " + s + def subsub(self, s): + print " |" + s + def subsubwarn(self, s): + print " (W) |" + s + def subsuberr(self, s): + print " (E) |" + s + def line(self,s): + print s + def div(self, left, right): + l = len(left) + r = len(right) + return left + " " * (78-l-r) + right + +class MunchieFormatter: + def section(self, s): + print "[lintool] " + "-" * (78 - len("[lintool] ")) + print "[lintool] " + s + "\n" + def bullet(self, s): + print "[lintool] * " + s + def sub(self, s): + print "[lintool] - " + s + def subwarn(self, s): + print "[lintool] - (W) " + s + def suberr(self, s): + print "[lintool] - (E) " + s + def subsub(self, s): + print "[lintool] |" + s + def subsubwarn(self, s): + print "[lintool] (W) |" + s + def subsuberr(self, s): + print "[lintool] (E) |" + s + def line(self,s): + print "[lintool] " + s + def div(self, left, right): + l = len("[lintool] " + left) + r = len(right) + return left + " " * (78-l-r) + right + +formatters = { "text" : TextFormatter(), "munchie" : MunchieFormatter() } + +def extractFilename(path): + return path + +def runTests(tests,results,ins): + for j in tests: + j.reset() + + ln = 1 + for i in ins.readlines(): + for j in tests: + j.checkLine(i, ln) + ln += 1 + + hasWarning = 0 + hasError = 0 + for j in xrange(len(tests)): + if tests[j].hasErrors(): + results[j][0] += 1 + hasError = 1 + if tests[j].hasWarnings(): + results[j][1] += 1 + hasWarning = 1 + return (hasError, hasWarning) + +def showStatus(options,tests,formatter,file): + if options['showDetails'] or options['showSeparate']: + formatter.section("Status for " + file) + for j in tests: + if options['showSeparate'] or options['showDetails']: + l = len(j.getDesc()) + formatter.bullet(formatter.div(j.getDesc(), ": " + j.getStatus())) + if options['showDetails']: + j.report() + elif options['showShort']: + allOK = 1 + for j in tests: + if j.hasErrors(): + allOK = 0 + break + if allOK: + formatter.div(file, ": OK") + else: + formatter.div(file, ": Not OK") + # else fall through the bottom + +def usage(opts): + print sys.argv[0], "[options] ebuild [ebuild ebuild ... ]" + print + + if opts: + print "Where [options] include:" + for (short,long_,desc) in opts: + short_ = '' + for s in short: + short_ = short_ + '-' + s + ',' + long_ = '--' + long_ + opt = short_ + long_ + opt = opt.rjust(18) + print opt + ' ' + desc + print + +def parse_opts(argv): + options = { 'showSeparate': 0, + 'showTotal': 1, + 'showDetails': 1, + 'showShort': 1, + 'listTests': 0, + 'desiredTests': 0, + 'testMode' : "ebuild", + 'licenseDirs' : [ "/usr/portage/licenses" ], + 'formatter' : 'text' + } + + opts = (('', 'show-separate', + 'Show short summary of tests for each ebuild checked'), + + ('v', 'version', + 'Show program version'), + + ('', 'no-summary', + 'Do not show total summary'), + + ('', 'no-details', + 'Do not show full details of tests for each ebuild checked'), + + ('', 'ebuild', + 'Files to check are ebuilds'), + + ('', 'changelog', + 'Files to check are changelogs'), + + ('', 'digest', + 'Files to check are digests'), + + ('', 'tests=', + 'Comma-separated list of tests to run'), + + ('', 'list-tests', + 'List available tests'), + + ('', 'from-file=', + 'Read ebuilds from '), + + ('', 'formatter=', + "Use 'text' (default) or 'munchie' formatter"), + + ('', 'aux-license-dir=', + 'Add to directories to search for licenses'), + + ('?h', 'help', + 'Show this help'), + ) + + short_options = '' + long_options = [] + for (short,long_,desc) in opts: + short_options = short_options + short + if '=' in long_: + long_ = long_.split('=', 1)[0] + '=' + long_options.append(long_) + + try: + (option_list,args) = getopt.getopt(sys.argv[1:], short_options, long_options) + except getopt.GetoptError, details: + print 'Error parsing command line:',str(details) + sys.exit(1) + + for (option,value) in option_list: + if option in [ '--no-details' ]: + options['showShort'] = 1 + options['showDetails'] = 0 + elif option in [ '--show-separate' ]: + options['showShort'] = 0 + options['showSeparate'] = 1 + elif option in [ '--no-summary']: + options['showTotal'] = 0 + elif option in [ '--from-file' ]: + lines = open(value, 'r').readlines() + lines = [o.strip() for o in lines] + args = lines + args + elif option in [ '--tests' ]: + options['desiredTests'] = value.split(",") + elif option in [ '--formatter' ]: + options['formatter'] = value + elif option in [ '--list-tests' ]: + options['listTests'] = 1 + elif option in [ '--ebuild' ]: + options['testMode'] = 'ebuild' + elif option in [ '--changelog' ]: + options['testMode'] = 'changelog' + elif option in [ '--digest' ]: + options['testMode'] = 'digest' + elif option in [ '--aux-license-dir' ]: + options['licenseDirs'].append(value) + elif option in [ '-v', '--version' ]: + print "Lintool " + VERSION + sys.exit(0) + elif option in [ '-h', '-?', '--help' ]: + usage(opts) + sys.exit(0) + else: + # shouldn't ever happen. better to be safe + print "Unknown option - '%s'!" % (option) + sys.exit(1) + + return (options,args) + +def main(): + (options,args) = parse_opts(sys.argv[1:]) + + formatter = formatters[options['formatter']] + + # Get test suite for given mode + if options['testMode'] == "ebuild": + available_tests = ebuild.getTests(formatter, options) + elif options['testMode'] == "changelog": + available_tests = changelog.getTests(formatter, options) + elif options['testMode'] == "digest": + available_tests = digest.getTests(formatter, options) + + # List available tests, if that was the users request + if options['listTests']: + maxlen = 0 + for i in available_tests: + maxlen = max(len(i.__class__.__name__), maxlen) + for i in available_tests: + n = i.__class__.__name__ + print n + " " * (maxlen - len(n)) + " - " + i.getDesc() + + # Quit with short usage string, if no params given + if len(args) == 0: + usage(None) + sys.exit(1) + + # Create final list of tests to run + tests = [] + notTests = [] + if options['desiredTests']: + for i in options['desiredTests']: + for j in available_tests: + if len(i) and i[0] == "-": + notTests.append(i[1:]) + if j.__class__.__name__ == i: + tests.append(j) + else: + tests = available_tests + + if len(notTests): + for i in available_tests: + if i.__class__.__name__ not in notTests: + tests.append(i) + + results = [[0, 0] for x in range(len(tests))] + + # Set up for test run + numFiles = 0 + totalErrors = 0 + totalWarnings = 0 + + # Iterate through all files given as arguments, testing each file + # against the final list of tests + for i in args: + fn = extractFilename(i) + ins = open(i, "r") + numFiles += 1 + (hasError, hasWarning) = runTests(tests,results,ins) + totalErrors += hasError + totalWarnings += hasWarning + showStatus(options,tests,formatter,fn) + + # Show totals, if options allow it + if options['showTotal']: + formatter.section(formatter.div("Summary for all " + str(numFiles) + " " + options['testMode'] + "(s) checked", "#errors/warns")) + for i in xrange(len(tests)): + l = len(tests[i].getDesc()) + formatter.line(formatter.div(tests[i].getDesc(), ": %3d / %3d" % (results[i][0], results[i][1]))) + formatter.line(formatter.div("Total number of ebuilds with errors", \ + "%3d (%3d%%)" % (totalErrors, totalErrors*100/numFiles))) + formatter.line(formatter.div("Total number of ebuilds with warnings", \ + "%3d (%3d%%)" % (totalWarnings, totalWarnings*100/numFiles))) + if totalErrors: + sys.exit(1) + +if __name__ == "__main__": + main() + diff --git a/src/lintool/lintool/__init__.py b/src/lintool/lintool/__init__.py new file mode 100644 index 0000000..4d2e3a6 --- /dev/null +++ b/src/lintool/lintool/__init__.py @@ -0,0 +1,3 @@ +import ebuild +import changelog +import digest diff --git a/src/lintool/lintool/changelog.py b/src/lintool/lintool/changelog.py new file mode 100644 index 0000000..1dad779 --- /dev/null +++ b/src/lintool/lintool/changelog.py @@ -0,0 +1,105 @@ +# Copyright 2002 Gentoo Technologies, Inc +# Distributed under the terms of the GNU General Public License v2.0 +# Author Karl Trygve Kalleberg + +from test import Test, Regex +import re + +class TestHeaders(Test): + def __init__(self, formatter,options): + Test.__init__(self,formatter,options) + self.desc = "Testing for malformed headers" + self.re = [ (1, # append result of regex match + re.compile("^(# Copyright 1999-(2000|2001).*)"), + "Suspect copyright year"), + (1, + re.compile("^(# /home.*)"), + "Suspect path in header"), + (0, # don't append result of regex match + re.compile("^(# Author.*)"), + "Use of Author field in the header is deprecated. Put name in ChangeLog"), + (0, + re.compile("^(# Maintainer.*)"), + "Use of Maintainer field in the header is deprecated. Put name in ChangeLog"), + (1, + re.compile("^(# /space.*)"), + "Suspect path in header")] + + def checkLine(self, s, ln): + for i in self.re: + k = i[1].match(s) + if k and i[0]: + self.warnings.append(i[2] + ": " + k.groups()[0] ) + elif k and not i[0]: + self.warnings.append(i[2]) + + def report(self): + if len(self.warnings): + self.formatter.subwarn("Has illegal or suspect headers:") + for i in self.warnings: + self.formatter.subsub(i) + +class TestConstructPresence(Test): + + def __init__(self, formatter,options): + Test.__init__(self,formatter,options) + self.desc = "Testing for presence of required constructs" + self.required = [ ["# ChangeLog for " + Regex.category + "/" + Regex.PN, + None, + None, + "proper ChangeLog line" + ], + + ["\*" + Regex.P + " \([0-9]+ [A-Z][a-z][a-z] 2002\).*", + None, + None, + "proper release entry on the form *package-1.0.0 (01 Apr 2000)" + ], + + [" [0-9]+ [A-Z][a-z][a-z] 2002; .* <.*@.*> .*:", + None, + None, + "proper changelog entry" + ] + ] + + for i in self.required: + i[1] = re.compile("^(" + i[0] + ")") + + def checkLine(self, s, ln): + for i in self.required: + k = i[1].match(s) + if k: + i[2] = 1 + + def report(self): + for i in self.required: + if not i[2]: + self.formatter.suberr("Missing " + i[3]) + + def hasErrors(self): + for i in self.required: + if not i[2]: + return 1 + +class TestIndentation(Test): + + def __init__(self, formatter,options): + Test.__init__(self,formatter,options) + self.desc = "Testing for proper indentation" + self.re = re.compile("^( |[#*].|\n).*") + + def checkLine(self, s, ln): + k = self.re.match(s) + if not k: + self.errors.append(s) + + def report(self): + for i in self.errors: + print i.replace(' ','%') + +def getTests(formatter,options): + return [ TestHeaders(formatter,options), + TestConstructPresence(formatter,options), + TestIndentation(formatter,options) + ] diff --git a/src/lintool/lintool/digest.py b/src/lintool/lintool/digest.py new file mode 100644 index 0000000..5f174ae --- /dev/null +++ b/src/lintool/lintool/digest.py @@ -0,0 +1,28 @@ +# Copyright 2002 Gentoo Technologies, Inc +# Distributed under the terms of the GNU General Public License v2.0 +# Author Karl Trygve Kalleberg + +from test import Test +import re + +class TestSyntax(Test): + + def __init__(self,formatter,options): + Test.__init__(self,formatter,options) + self.desc = "Testing for correct syntax" + self.re = [ re.compile("^(MD5 [a-z0-9]+ [a-zA-Z0-9_+.-]+ [0-9]+)") ] + self.errors = [] + + def checkLine(self, s, ln): + for i in self.re: + k = i.match(s) + if not k: + self.errors.append("Invalid line in digest\n |" + s) + + def report(self): + for i in self.errors: + self.formatter.suberr(i) + + +def getTests(formatter,options): + return [ TestSyntax(formatter,options) ] diff --git a/src/lintool/lintool/ebuild.py b/src/lintool/lintool/ebuild.py new file mode 100644 index 0000000..c8df0a2 --- /dev/null +++ b/src/lintool/lintool/ebuild.py @@ -0,0 +1,349 @@ +# Copyright 2002 Gentoo Technologies, Inc +# Distributed under the terms of the GNU General Public License v2.0 +# Author Karl Trygve Kalleberg + +from test import Test +import re +import os +import os.path + +class TestSpaces(Test): + + def __init__(self, formatter, options): + Test.__init__(self, formatter, options) + self.desc = "Testing for correct formatting" + self.re_spaces = [ re.compile("^([ ][ ]*)([a-zA-Z\.].*)"), + re.compile("(.*)([ \t]+)\n") ] + self.re_backslash = re.compile("([^#]*\S)((\s\s+|\t))\\\\") + self.reset() + + def checkLine(self, s, ln): + for r in self.re_spaces: + k = r.match(s) + if k: + spcs = k.groups()[1] + rest = k.groups()[0] + self.spaces.append((ln, spcs.replace(" ", "%").replace("\t","%") + rest)) + else: + k = self.re_backslash.match(s) + if k: + head = k.group(1) + spcs = k.group(2) + tail = "\\" + self.backslashes.append((ln, head + len(spcs) * "%" + tail)) + + def hasErrors(self): + return 0 + def hasWarnings(self): + return len(self.spaces) + len(self.backslashes) + + def reset(self): + self.spaces = [] + self.backslashes = [] + + def report(self): + if len(self.spaces): + self.formatter.subwarn("Has illegal space characters (marked by %):") + for i in self.spaces: + self.formatter.subsub("[line " + str(i[0]) + "]:" + i[1]) + if len(self.backslashes): + self.formatter.subwarn("Has illegal white space (marked by %), only one space character allowed:") + for i in self.backslashes: + self.formatter.subsub("[line " + str(i[0]) + "]:" + i[1]) + +class TestHeaders(Test): + + def __init__(self, formatter, options): + Test.__init__(self,formatter, options) + self.desc = "Testing for malformed headers" + self.want = [ [ 0, # count + re.compile("^(# Copyright .*2002.*)"), + "Copyright statement" ], + [ 0, # count + re.compile("^(# " + "\$" + "Header:.*" + "\$)"), # Don't want CVS to fix this + "$" + "Header:" + "$" ], # Don't want CVS to fix this either + [ 0, # count + re.compile("^(# Distributed under the terms of the GNU General Public License.*)"), + "GPL license" ] ] + self.dontwant = [ (1, # append result of regex match + re.compile("^(# Copyright 1999-(2000|2001).*)"), + "Suspect copyright year"), + (1, + re.compile("^(# /home.*)"), + "Suspect path in header"), + (0, # don't append result of regex match + re.compile("^(# Author.*)"), + "Use of Author field in the header is deprecated. Put name in ChangeLog"), + (0, + re.compile("^(# Maintainer.*)"), + "Use of Maintainer field in the header is deprecated. Put name in ChangeLog"), + (1, + re.compile("^(# /space.*)"), + "Suspect path in header")] + + def reset(self): + for i in self.want: + i[0] = 0 + self.errors = [] + self.warnings = [] + + def hasErrors(self): + num_error = 0 + for i in self.want: + if i[0] == 0: + num_error += 1 + return num_error + + def checkLine(self, s, ln): + for i in self.dontwant: + k = i[1].match(s) + if k and i[0]: + self.warnings.append(i[2] + ": " + k.groups()[0] ) + elif k and not i[0]: + self.warnings.append(i[2]) + for i in self.want: + k = i[1].match(s) + if k: + i[0] += 1 + + def report(self): + illegal_headers = len(self.warnings) + for i in self.want: + if i[0] == 0: + illegal_headers += 1 + if illegal_headers: + self.formatter.subwarn("Has illegal or suspect headers:") + for i in self.warnings: + self.formatter.subwarn(i) + for i in self.want: + if i[0] == 0: + self.formatter.suberr("Missing " + i[2]) + +class TestTry(Test): + + def __init__(self,formatter, options): + Test.__init__(self,formatter, options) + self.desc = "Testing for occurence of deprecated try" + self.re = [ re.compile("^([ \t][ \t]*try.*)"), + re.compile("(.*=.* try .*)") ] + + def checkLine(self, s, ln): + for i in self.re: + k = i.match(s) + if k: + self.errors.append(k.groups()[0]) + + def report(self): + if len(self.errors): + self.formatter.suberr("Uses try, which is deprecated") + for i in self.errors: + self.formatter.subsub(i) + +class TestA(Test): + + def __init__(self, formatter, options): + Test.__init__(self,formatter, options) + self.desc = "Testing for superfluous A=${P}.tar.gz" + self.re = re.compile("(^A=.*)") + + def checkLine(self, s, ln): + k = self.re.match(s) + if k: + self.errors.append(k.groups()[0]) + + def report(self): + if len(self.errors): + self.formatter.suberr("Contains superfluous " + self.errors[0]) + +class TestDepend(Test): + + def __init__(self, formatter, options): + Test.__init__(self,formatter, options) + self.desc = "Testing for empty DEPEND" + self.re = re.compile("DEPEND=\"\"") + + def checkLine(self, s, ln): + k = self.re.match(s) + if k: + self.warnings.append("") + + def report(self): + if len(self.warnings): + self.formatter.subwarn("DEPEND is suspiciously empty") + +class TestHomepage(Test): + + def __init__(self, formatter,options): + Test.__init__(self,formatter,options) + self.desc = "Testing for empty HOMEPAGE" + self.re = re.compile("HOMEPAGE=\"\"") + + def checkLine(self, s, ln): + k = self.re.match(s) + if k: + self.warnings.append("") + + def report(self): + if len(self.warnings): + self.formatter.subwarn("Is HOMEPAGE really supposed to be empty ?") + +class TestDescription(Test): + + def __init__(self, formatter, options): + Test.__init__(self,formatter, options) + self.desc = "Testing for empty DESCRIPTION" + self.re = re.compile("DESCRIPTION=\"\"") + + def checkLine(self, s, ln): + k = self.re.match(s) + if k: + self.errors.append("") + + def report(self): + if len(self.errors): + self.formatter.suberr("DESCRIPTION must not be empty") + +class TestEnvVarPresence(Test): + + def __init__(self, formatter, options): + Test.__init__(self,formatter, options) + self.desc = "Testing for presence of env vars" + self.re = [] + self.found = [] + self.required = [ ("SRC_URI", "See 2.4"), + ("DESCRIPTION", "See policy, 2.8"), + ("HOMEPAGE", "See policy, 2.8"), + ("DEPEND", "See policy, 2.2"), + ("LICENSE", "See policy, 2.6"), + ("SLOT", "See policy, 2.5"), + ("KEYWORDS", "See policy, 2.3"), + ("IUSE", "See policy, 2.7") + ] + self.desired = [ ("RDEPEND", "Is RDEPEND == DEPEND ? See policy, 2.2") ] + + + for i in self.required: + self.re.append(re.compile("^(" + i[0] + ")=")) + for i in self.desired: + self.re.append(re.compile("^(" + i[0] + ")=")) + + def checkLine(self, s, ln): + for i in self.re: + k = i.match(s) + if k: + self.found.append(k.group(1)) + + def report(self): + for i in self.required: + if i[0] not in self.found: + self.formatter.suberr("Missing " + i[0] + ". " + i[1]) + for i in self.desired: + if i[0] not in self.found: + self.formatter.subwarn("Missing " + i[0] + ". " + i[1]) + + def hasWarnings(self): + for i in self.desired: + if i[0] not in self.found: + return 1 + + def hasErrors(self): + for i in self.required: + if i[0] not in self.found: + return 1 + +class TestLicense(Test): + def __init__(self, formatter, options): + Test.__init__(self,formatter, options) + self.desc = "Testing for proper LICENSE" + self.re = re.compile("^LICENSE=\"(.*)\"") + self.license_dirs = options['licenseDirs'] + self.licenses = self.loadLicenses() + + def loadLicenses(self): + licenses = [] + for i in self.license_dirs: + try: + candidates = os.listdir(i) + except: + self.formatter.line("!!! License directory '" + i + "' does not exist") + continue + for j in candidates: + if os.path.isfile(i + "/" + j): + licenses.append(j) + return licenses + + def checkLine(self, s, ln): + k = self.re.match(s) + if k: + print k.group(1) + licenses = k.group(1).split(" ") + for i in licenses: + if i not in self.licenses: + self.errors.append("License '" + i + "' not known") + + def report(self): + for i in self.errors: + self.formatter.suberr(i) + +class TestUseFlags(Test): + def __init__(self, formatter, options): + Test.__init__(self,formatter, options) + self.desc = "Testing for sane USE flag usage" + self.re = re.compile("[^#]*use ([a-z0-9\+]+).*") + self.useflags = self.loadUseFlags() + + def loadUseFlags(self): + ins = open("/usr/portage/profiles/use.desc") + rex = re.compile("^([a-z0-9]+)[ \t]+-.*"); + useflags = [] + for i in ins.readlines(): + k = rex.match(i) + if k: + useflags.append(k.group(1)) + return useflags + + def checkLine(self, s, ln): + k = self.re.match(s) + if k: + flag = k.group(1) + if flag not in self.useflags: + l = k.start(1) + # We want to try and figure pretty exactly if we've hit a real instnce + # of the use command or just some random mumbling inside a string + numApostrophes = 0 + numBackticks = 0 + numTicks = 0 + for i in xrange(l,0,-1): + if s[i] == '\"' and (i == 0 or (i > 0 and s[i-1] != '\\')): + numApostrophes += 1 + if s[i] == '\'' and (i == 0 or (i > 0 and s[i-1] != '\\')): + numTicks += 1 + if s[i] == '`' and (i == 0 or (i > 0 and s[i-1] != '\\')): + numBackticks += 1 + + if numApostrophes % 2 == 0: + foundError = 1 + elif numBackticks % 2 and numTicks % 2 == 0: + foundError = 1 + else: + foundError = 0 + + if foundError: + self.errors.append("Unknown USE flag '" + flag + "'") + + def report(self): + for i in self.errors: + self.formatter.suberr(i) + + +def getTests(formatter,options): + return [ TestSpaces(formatter,options), + TestHeaders(formatter,options), + TestTry(formatter,options), + TestA(formatter,options), + TestDepend(formatter,options), + TestHomepage(formatter,options), + TestDescription(formatter,options), + TestEnvVarPresence(formatter,options), + TestUseFlags(formatter,options), + TestLicense(formatter,options) ] diff --git a/src/lintool/lintool/test.py b/src/lintool/lintool/test.py new file mode 100644 index 0000000..0cc56ff --- /dev/null +++ b/src/lintool/lintool/test.py @@ -0,0 +1,30 @@ +# Copyright 2002 Gentoo Technologies, Inc +# Distributed under the terms of the GNU General Public License v2.0 +# Author Karl Trygve Kalleberg + +class Test: + def __init__(self, formatter,options=None): + self.formatter = formatter + self.errors = [] + self.warnings = [] + def reset(self): + self.errors = [] + self.warnings = [] + def hasWarnings(self): + return len(self.warnings) + def hasErrors(self): + return len(self.errors) + def getDesc(self): + return self.desc + def getStatus(self): + if self.hasErrors(): + return "failed" + else: + return "passed" + +class Regex: + PN = "[a-zA-Z_.-]+" + PV = "[a-z0-9A-Z_.-]+" + P = PN + "-" + PV + "(-r[0-9]+)?" + category = "[a-z0-9]+-[a-z0-9]+" + full = category + "/" + P diff --git a/src/moo/AUTHORS b/src/moo/AUTHORS new file mode 100644 index 0000000..fe436cb --- /dev/null +++ b/src/moo/AUTHORS @@ -0,0 +1 @@ +Karl Trygve Kalleberg diff --git a/src/moo/README b/src/moo/README new file mode 100644 index 0000000..e69de29 diff --git a/src/moo/TODO b/src/moo/TODO new file mode 100644 index 0000000..e69de29 diff --git a/src/moo/moo b/src/moo/moo new file mode 100755 index 0000000..828df08 --- /dev/null +++ b/src/moo/moo @@ -0,0 +1,244 @@ +#! /usr/bin/env python2.2 + +import os +import sys +import time +import signal + +CONFDIR="/tmp/moo" + +class Config: + pass + +def die(code, msg): + sys.stdout.write(msg + "\n") + sys.edit(code) + +def printUsage(): + print "Usage: moo [command] \n" + \ + "Where [command] is one of:\n" + \ + "scan - scan for available networks\n" + \ + "list - list available profiles\n"+ \ + "select - select a particular profile\n" + +def scanNetworks(): + pass + +def runCmd(cmd): + if Config.verbosity > 5: + print "Executing \"" + cmd + "\"" + v = os.system(cmd) + if Config.verbosity > 5: + print "Result: " + str(v) + return v + +class ProfileHandler: + def __init__(self): + self.profiles = {} + self._loadProfiles() + def _loadProfiles(self): + for x in os.listdir(CONFDIR+"/profiles"): + if x[-1] != "~" and x[0] != ".": + self.profiles[x] = Profile(CONFDIR+"/profiles/"+x) + def listProfiles(self,detailed=0): + for x in self.profiles.keys(): + if detailed: + print x + ":" + self.profiles[x].dump() + else: + print x + " [" + self.profiles[x].description + "]" + def getProfileNames(self): + return self.profiles.keys() + def getProfile(self,name): + return self.profiles[name] + + +class Profile: + def __init__(self, filename): + self._loadFromFile(filename) + def _loadFromFile(self,filename): + self.desc = "" + self.ifaceName = "" + self.ip = "" + self.broadcast = "" + self.gateway = "" + self.exclusive = "no" + self.netmask = "" + self.nameserver = "" + + ins = open(filename) + for s in ins.readlines(): + for x in ["description","ifaceName","ip","broadcast", + "gateway","exclusive","nameserver","wepkey"]: + if s.find(x+"=") == 0: + val=s.replace(x+"=","").strip() + self.__dict__[x] = val + def dump(self): + print "description = " + self.description + "\n" + \ + "iface = " + self.ifaceName + "\n" + \ + "ip = " + self.ip + "\n" + \ + "broadcast = " + self.broadcast + "\n" + \ + "gateway = " + self.gateway + "\n" + \ + "gateway = " + self.nameserver + "\n" + \ + "exclusive = " + self.exclusive + "\n" + +class Interface: + def __init__(self, name): + self.name = name + self.netmask = "" + self.broadcast = "" + self.ip = "" + self.gateway = "" + self.nameserver = "" + self.wepkey = "" + self._loadIPV4Info() + def _loadIPV4Info(self): + pass + def getNameserver(self): + return self.nameserver + def getNetmask(self): + return self.netmask + def getName(self): + return self.name + def getBroadcast(self): + return self.broadcast + def getWEPKey(self): + return self.wepkey + def getGateway(self): + return self.gateway + def setNameserver(self,nameserver): + self.nameserver = nameserver + def setIP(self, ip): + self.ip = ip + def setWEPKey(self,key): + self.wepkey = key + def setGateway(self,gw): + self.gateway = gw + def setBroadcast(self,broadcast): + self.broadcast = broadcast + def setNetmask(self,netmask): + self.netmask = netmask + def runDHCP(self): + runCmd("dhcpcd " + self.name) + def down(self): + runCmd("ifconfig " + self.name + " down") + pidFile = "/var/run/dhcpcd-" + self.name + ".pid" + if os.path.exists(pidFile): + ins = open(pidFile) + pid = int(ins.readline()) + os.kill(pid,signal.SIGTERM) + time.sleep(1) + def up(self): + options = "" + + if self.wepkey: + if runCmd("iwconfig eth1 key " + self.wepkey): + die(4, "Failed to set WEP key for " + self.name) + + if self.ip: + options += self.ip + " " + if self.broadcast: + options += "broadcast " + self.broadcast + " " + if self.netmask: + options += "netmask " + self.netmask + " " + + if runCmd("ifconfig " + self.name + " " + options + " up"): + die(2, "Failed to bring up " + self.name) + + if self.gateway: + if runCmd("route add default gw " + self.gateway + " " + self.name): + die(3, "Failed to set default gateway for " + self.name) + + if self.nameserver: + if Config.verbosity > 5: + print("Using nameserver " + self.nameserver) + try: + ous = open("/etc/resolv.conf","w") + ous.write("nameserver " + self.nameserver) + ous.close() + except OSError: + die("Failed to set nameserver") + if Config.verbosity > 3: + print "Brough interface " + self.name + " up" + +class InterfaceHandler: + def __init__(self): + self.ifaces = {} + self._loadAllInterfaces() + def _loadAllInterfaces(self): + ins=open("/proc/net/dev") + for line in ins.readlines(): + tokens = line.split(":") + if len(tokens) > 1: + ifaceName = tokens[0].strip() + iface = Interface(ifaceName) + self.ifaces[ifaceName] = iface + def getInterface(self,ifaceName): + return self.ifaces[ifaceName] + def downAll(self): + for x in self.ifaces.values(): + if x.getName() != "lo": + x.down() + +class Moo: + def __init__(self): + self.profileHandler = ProfileHandler() + self.ifaceHandler = InterfaceHandler() + + def selectProfile(self,profile): + prof = self.profileHandler.getProfile(profile) + + if prof.exclusive == "yes": + self.ifaceHandler.downAll() + + iface = self.ifaceHandler.getInterface(prof.ifaceName) + + if prof.ip == "dhcp": + iface.runDHCP() + else: + iface.setIP(prof.ip) + iface.setBroadcast(prof.broadcast) + iface.setNetmask(prof.netmask) + iface.setGateway(prof.gateway) + iface.setNameserver(prof.nameserver) + iface.up() + + def listProfiles(self,detailed=0): + self.profileHandler.listProfiles(detailed) + +def initConfig(): + Config.verbosity = 3 + +def main(): + + initConfig() + + if len(sys.argv) < 2: + printUsage() + sys.exit(1) + + moo = Moo() + + for i in xrange(len(sys.argv)): + if sys.argv[i] == "list": + detailed = 0 + for x in sys.argv[i:]: + if x == "--detailed": + detailed = 1 + moo.listProfiles(detailed) + + elif sys.argv[i] == "select": + moo.selectProfile(sys.argv[2]) + +if __name__ == "__main__": + main() + + +# TODO +# - automatically create profile +# - specify wireless network name +# - specify wep key +# - specify access point +# - specify pre_run/post_run commands +# - with parameters +# diff --git a/src/moo/moo.1 b/src/moo/moo.1 new file mode 100644 index 0000000..534aa0c --- /dev/null +++ b/src/moo/moo.1 @@ -0,0 +1,12 @@ +.TH moo "1" "Nov 2003" "gentoolkit" +.SH NAME +moo \- Gentoo: Configuration Update Utility +.SH SYNOPSIS +.B moo +.SH BUGS +This tool does not yet have a man page. Feel free to submit a bug about it to +http://bugs.gentoo.org +.SH AUTHORS +This informative man page was written by Karl Trygve Kalleberg +. + diff --git a/src/old-scripts/Makefile b/src/old-scripts/Makefile new file mode 100644 index 0000000..8f61cb5 --- /dev/null +++ b/src/old-scripts/Makefile @@ -0,0 +1,32 @@ +# Copyright 2004 Karl Trygve Kalleberg +# Copyright 2004 Gentoo Technologies, Inc. +# Distributed under the terms of the GNU General Public License v2 +# +# $Header$ + +include ../../makedefs.mak + +all: + echo "BOTOLPHS Huge benign tumors which archdeacons and old chemistry teachers affect to wear on the sides of their noses." + +dist: + mkdir -p ../../$(distdir)/src/old-scripts/ + cp Makefile ../../$(distdir)/src/old-scripts/ + cp dep-clean dep-clean.1 ../../$(distdir)/src/old-scripts/ + cp pkg-clean pkg-clean.1 ../../$(distdir)/src/old-scripts/ + cp ewhich ewhich.1 ../../$(distdir)/src/old-scripts/ + cp mkebuild mkebuild.1 ../../$(distdir)/src/old-scripts/ + cp pkg-size pkg-size.1 ../../$(distdir)/src/old-scripts/ + +install: + install -m 0755 dep-clean $(bindir)/ + install -m 0755 pkg-clean $(sbindir)/ + install -m 0755 ewhich $(bindir)/ + install -m 0755 mkebuild $(sbindir)/ + install -m 0755 pkg-size $(bindir)/ + + install -m 0644 dep-clean.1 $(mandir)/ + install -m 0644 pkg-clean.1 $(mandir)/ + install -m 0644 ewhich.1 $(mandir)/ + install -m 0644 mkebuild.1 $(mandir)/ + install -m 0644 pkg-size.1 $(mandir)/ diff --git a/src/old-scripts/dep-clean b/src/old-scripts/dep-clean new file mode 100644 index 0000000..89c6364 --- /dev/null +++ b/src/old-scripts/dep-clean @@ -0,0 +1,272 @@ +#!/bin/bash +#Shows unrequired packages and missing dependencies. +#Author/Maintainer: Brandon Low +#Author: Jerry Haltom + +echo +echo -e "\x1b[31;01m!!! As of Gentoolkit 0.2.0, this tool is deprecated." +echo -e "!!!\x1b[0;0m Please refer to 'emerge clean' and 'emerge depclean' for replacements." +echo + +PROG=`basename ${0}` + +tmp="/tmp/$$" + +#Get PORTDIR and PORTDIR_OVERLAY from portage +PORTDIR_OVERLAY="$(/usr/lib/portage/bin/portageq portdir_overlay)" +PORTDIR="$(/usr/lib/portage/bin/portageq portdir)" + +rm -rf ${tmp} > /dev/null 2>&1 +mkdir ${tmp} > /dev/null 2>&1 + +declare -i i + +set -- `getopt -n ${PROG} -o N,R,U,I,v,q,C,h -l needed,removed,unneeded,interactive,verbose,quiet,nocolor,help -- ${*/ --/};[ $? != 0 ] && echo "y"` + +while [ ${#} -gt 0 ] +do + a=${1} + shift + case "${a}" in + + -I|--interactive) + interactive=y + ;; + + -N|--needed) + needed=y + ;; + + -U|--unneeded) + unneeded=y + ;; + + -R|--removed) + removed=y + ;; + + -v|--verbose) + verb=y + ;; + + -q|--quiet) + quiet=y + ;; + + -C|--nocolor) + nocolor=y + ;; + + -h|--help) + usage=y + ;; + + --) + [ ${1} ] && usage=y && broke=y + break + ;; + + *) + usage=y + broke=y + echo "FIXME - OPTION PARSING - ${a}" + break + ;; + + esac +done + +if [ ! ${needed} ] && [ ! ${unneeded} ] && [ ! ${removed} ]; then + needed=y + unneeded=y + removed=y +fi + +#Set up colors +if [ ! "${nocolor}" ]; then + NO="\x1b[0;0m" + BR="\x1b[0;01m" + CY="\x1b[36;01m" + GR="\x1b[32;01m" + RD="\x1b[31;01m" + YL="\x1b[33;01m" + BL="\x1b[34;01m" +elif [ ${quiet} ] && ( + ( [ ${needed} ] && [ ${unneeded} ] ) || + ( [ ${unneeded} ] && [ ${removed} ] ) || + ( [ ${removed} ] && [ ${needed} ] ) + ); then + NEED=" N" + UNNE=" U" + REMO=" R" +fi + +if [ ${usage} ]; then + echo -e "${BR}GenToolKit's Dependency Checker! +${NO}Displays packages that are installed but which none +of the packages in world or system depend on, and +displays packages which are depended on by world or +system, but are not currently installed. + +${BR}USAGE: + ${BL}${PROG}${YL} [${NO}options${YL}]${NO} + ${BL}${PROG}${GR} --help${NO} + +${BR}OPTIONS: + ${GR}-U, --unneeded${NO} display unneeded packages that are installed (${GR}green${NO}) + ${GR}-N, --needed${NO} display needed packages that are not installed (${RD}red${NO}) + ${GR}-R, --removed${NO} display installed packages not in portage (${YL}yellow${NO}) + + ${GR}-I, --interactive${NO} interactively modify world file before proceeding + ${GR}-C, --nocolor${NO} output without color, if necessary, package types are + noted with ${GR}U, N${NO} and ${GR}R${NO} respectively + ${GR}-v, --verbose${NO} be more verbose + ${GR}-q, --quiet${NO} be quiet (just output the packages, no extra info) + +${BR}NOTES: + ${GR}*${NO} If this script is run on a system that is not up-to-date or which hasn't + been cleaned (with '${BL}emerge -c${NO}') recently, the output may be deceptive. + ${GR}*${NO} If the same package name appears in all three categories, then it is + definitely time to update that package and then run '${BL}emerge -c${NO}'. + ${GR}*${NO} The ${GR}-U, -N${NO} and ${GR}-R${NO} options may be combined, defaults to ${GR}-UNR${NO}" + rm -rf ${tmp} > /dev/null 2>&1 + [ ${broke} ] && exit 1 || exit 0 +fi + +X="\([^/]*\)" + +#Retrieve currently merged packages. +if [ ${verb} ];then + echo -e "${CY}Retrieving currently merged packages.${NO}" +fi +find /var/db/pkg/ -name '*.ebuild' | \ + sed -e "s:/var/db/pkg/::" \ + -e "s:${X}/${X}/${X}:\1/\2:" | \ + sort -u >> ${tmp}/current + +if [ ${verb} ]; then + echo -e "${CY}"`cat ${tmp}/current | wc -l` "currently merged packages.${NO}" + echo -e +fi + +#Retrieve system packages and add to image. +if [ ${verb} ];then + echo -e "${CY}Retrieving system packages.${NO}" +fi +emerge system -ep | \ + sed -e "/ebuild/s:^.*] \([^ ]*\) *:\1:p;d" | \ + sort -u \ + > ${tmp}/system + +if [ ${verb} ]; then + echo -e "${CY}"`cat ${tmp}/system | wc -l 2> /dev/null` "packages contained in system.${NO}" + echo -e + echo -e "${CY}Preparing world file.${NO}" +fi + +#Create local copy of world and ask user to verify it. +cp /var/cache/edb/world ${tmp}/world + +if [ ${interactive} ]; then + ${EDITOR} ${tmp}/world +fi + +#Retrieve world packages and dependencies and add to image. +if [ ${verb} ]; then + echo -e + echo -e "${CY}Preparing list of installed world packages.${NO}" + echo -e +fi + +cat ${tmp}/current | grep -f ${tmp}/world | sort > ${tmp}/world.inst +find ${PORTDIR} ${PORTDIR_OVERLAY} -iname '*.ebuild' | \ + awk -F'/' '{printf("%s/%s\n", $(NF-2), $NF)}' | \ + sed -e 's:\.ebuild::' > ${tmp}/ebuilds +grep -xf ${tmp}/world.inst ${tmp}/ebuilds >> ${tmp}/world.new + +if [ ${verb} ]; then + echo -e "${CY}"`cat ${tmp}/ebuilds | wc -l`"\tebuilds available.${NO}" + echo -e "${CY}"`cat ${tmp}/world.new | wc -l`"\tpackages contained in final world file.${NO}" + echo -e + echo -e "${CY}List prepared, checking dependencies with emerge -ep${NO}" +fi + +sort ${tmp}/world.new |sed -e 's:^:\\\=:' | uniq | xargs emerge -ep | \ + tee ${tmp}/log | sed -e '/ebuild/s:^.*] \([^ ]*\) *$:\1:p;d' > ${tmp}/image.unsorted + +depends=`cat ${tmp}/image.unsorted|wc -l` + +if [ ${depends} -lt "2" ]; then + echo -e "${RD}There appears to be an unresolved dependency in your world file." + echo -e "Please check for masking errors or other world file issues," + echo -e "and then try again." + echo -e + echo -e "The following is the emerge output for your reference:${NO}" + cat ${tmp}/log + rm -rf ${tmp} > /dev/null 2>&1 + exit 1 +fi + +cat ${tmp}/system >> ${tmp}/image.unsorted + +#Cleanup image +sort -u ${tmp}/image.unsorted > ${tmp}/image + +if [ ${verb} ];then + echo -e "${CY}"`cat ${tmp}/image | wc -l` "packages contained in final image.${NO}" + echo -e +fi + +#Determine packages that exist in current but not in image. +#These packages are safe to clean up. +if [ ${unneeded} ]; then + if [ ! ${quiet} ]; then + echo -e "${CY}These packages have no other packages depending on them.${NO}" + fi + + grep -vxf ${tmp}/image ${tmp}/current > ${tmp}/unneeded + for line in `cat ${tmp}/unneeded`;do + echo -e "${GR}${line}${CY}${UNNE}${NO}" + done + + if [ ! ${quiet} ];then + echo -e "${CY}Total of"`cat ${tmp}/unneeded|wc -l` "unneeded packages.${NO}" + fi +fi + +#Determine packages that exist in image but not in current. +#These packages should be added. +if [ ${needed} ]; then + if [ ! ${quiet} ];then + echo -e + echo -e "${CY}These packages are depended upon but are not present on the system.${NO}" + fi + + grep -vxf ${tmp}/current ${tmp}/image > ${tmp}/needed + for line in `cat ${tmp}/needed`;do + echo -e "${RD}${line}${CY}${NEED}${NO}" + done + + if [ ! ${quiet} ];then + echo -e "${CY}Total of"`cat ${tmp}/needed|wc -l` "needed packages.${NO}" + fi +fi + +#Determine packages that are installed but not currently in portage +if [ ${removed} ]; then + if [ ! ${quiet} ];then + echo -e + echo -e "${CY}These packages are installed but not in the portage tree.${NO}" + fi + grep -xf ${tmp}/current ${tmp}/ebuilds > ${tmp}/hascurrent + grep -vxf ${tmp}/hascurrent ${tmp}/current > ${tmp}/removed + for line in `cat ${tmp}/removed`;do + echo -e "${YL}${line}${CY}${REMO}${NO}" + done + + if [ ! ${quiet} ];then + echo -e "${CY}Total of"`cat ${tmp}/removed|wc -l` "removed packages.${NO}" + fi +fi + +rm -rf ${tmp} > /dev/null 2>&1 diff --git a/src/old-scripts/dep-clean.1 b/src/old-scripts/dep-clean.1 new file mode 100644 index 0000000..9747ce4 --- /dev/null +++ b/src/old-scripts/dep-clean.1 @@ -0,0 +1,190 @@ +.\" Automatically generated by Pod::Man version 1.15 +.\" Thu Jul 18 15:59:55 2002 +.\" +.\" Standard preamble: +.\" ====================================================================== +.de Sh \" Subsection heading +.br +.if t .Sp +.ne 5 +.PP +\fB\\$1\fR +.PP +.. +.de Sp \" Vertical space (when we can't use .PP) +.if t .sp .5v +.if n .sp +.. +.de Ip \" List item +.br +.ie \\n(.$>=3 .ne \\$3 +.el .ne 3 +.IP "\\$1" \\$2 +.. +.de Vb \" Begin verbatim text +.ft CW +.nf +.ne \\$1 +.. +.de Ve \" End verbatim text +.ft R + +.fi +.. +.\" Set up some character translations and predefined strings. \*(-- will +.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left +.\" double quote, and \*(R" will give a right double quote. | will give a +.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used +.\" to do unbreakable dashes and therefore won't be available. \*(C` and +.\" \*(C' expand to `' in nroff, nothing in troff, for use with C<> +.tr \(*W-|\(bv\*(Tr +.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' +.ie n \{\ +. ds -- \(*W- +. ds PI pi +. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch +. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch +. ds L" "" +. ds R" "" +. ds C` "" +. ds C' "" +'br\} +.el\{\ +. ds -- \|\(em\| +. ds PI \(*p +. ds L" `` +. ds R" '' +'br\} +.\" +.\" If the F register is turned on, we'll generate index entries on stderr +.\" for titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and +.\" index entries marked with X<> in POD. Of course, you'll have to process +.\" the output yourself in some meaningful fashion. +.if \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. nr % 0 +. rr F +.\} +.\" +.\" For nroff, turn off justification. Always turn off hyphenation; it +.\" makes way too many mistakes in technical documents. +.hy 0 +.if n .na +.\" +.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). +.\" Fear. Run. Save yourself. No user-serviceable parts. +.bd B 3 +. \" fudge factors for nroff and troff +.if n \{\ +. ds #H 0 +. ds #V .8m +. ds #F .3m +. ds #[ \f1 +. ds #] \fP +.\} +.if t \{\ +. ds #H ((1u-(\\\\n(.fu%2u))*.13m) +. ds #V .6m +. ds #F 0 +. ds #[ \& +. ds #] \& +.\} +. \" simple accents for nroff and troff +.if n \{\ +. ds ' \& +. ds ` \& +. ds ^ \& +. ds , \& +. ds ~ ~ +. ds / +.\} +.if t \{\ +. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" +. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' +. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' +. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' +. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' +. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' +.\} +. \" troff and (daisy-wheel) nroff accents +.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' +.ds 8 \h'\*(#H'\(*b\h'-\*(#H' +.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] +.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' +.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' +.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] +.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] +.ds ae a\h'-(\w'a'u*4/10)'e +.ds Ae A\h'-(\w'A'u*4/10)'E +. \" corrections for vroff +.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' +.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' +. \" for low resolution devices (crt and lpr) +.if \n(.H>23 .if \n(.V>19 \ +\{\ +. ds : e +. ds 8 ss +. ds o a +. ds d- d\h'-1'\(ga +. ds D- D\h'-1'\(hy +. ds th \o'bp' +. ds Th \o'LP' +. ds ae ae +. ds Ae AE +.\} +.rm #[ #] #H #V #F C +.\" ====================================================================== +.\" +.IX Title "DEP-CLEAN 1" +.TH DEP-CLEAN 1 "Copyright 2002 Gentoo Technologies, Inc." "2002-07-18" "GenToolKit's Dependency Checker!" +.UC +.SH "NAME" +dep-clean \- Gentoo: Shows unrequired packages and missing dependencies. +.SH "SYNOPSIS" +.IX Header "SYNOPSIS" +.Vb 1 +\& dep-clean [-RUNICv] +.Ve +.SH "DESCRIPTION" +.IX Header "DESCRIPTION" +dep-clean displays extraneous, missing or extra packages. Extra packages are those in which are not a part of the portage tree (/usr/portage). It does \s-1NOT\s0 modify the system in any way. +.SH "OPTIONS" +.IX Header "OPTIONS" +.Ip "\-N, \-\-needed" 4 +.IX Item "-N, --needed" +Display needed packages that are not installed. (red) (default) +.Ip "\-R, \-\-removed" 4 +.IX Item "-R, --removed" +Display installed packages not in portage. (yellow) (default) +.Ip "\-U, \-\-unneeded" 4 +.IX Item "-U, --unneeded" +Display unneeded packages that are installed. (green) (default) +.Ip "\-I, \-\-interactive" 4 +.IX Item "-I, --interactive" +Interactively modify world file before proceeding. +.Ip "\-C, \-\-nocolor" 4 +.IX Item "-C, --nocolor" +Output without color. Package types will be noted with R, U and N. +.Ip "\-v, \-\-verbose" 4 +.IX Item "-v, --verbose" +Be more verbose. +.Ip "\-q, \-\-quiet" 4 +.IX Item "-q, --quiet" +Be quiet (display only packages). +.SH "NOTES" +.IX Header "NOTES" +.Ip "" 4 +If this script is run on a system that is not up-to-date or which hasn't been cleaned (with 'emerge \-c') recently, the output may be deceptive. +.Ip "" 4 +If the same package name appears in all three categories, then it is definitely time to update that package and then run 'emerge \-c'. +.Ip "" 4 +The \-U, \-N and \-R options may be combined, default is \-UNR +.SH "AUTHORS" +.IX Header "AUTHORS" +Jerry Haltom (dep-clean) +.br +Brandon Low (dep-clean) +.PP +Paul Belt (man page) diff --git a/src/old-scripts/ewhich b/src/old-scripts/ewhich new file mode 100755 index 0000000..345ec34 --- /dev/null +++ b/src/old-scripts/ewhich @@ -0,0 +1,44 @@ +#!/usr/bin/python +# Copyright 1999-2003 Gentoo Technologies, Inc. +# Distributed under the terms of the GNU General Public License v2 +# $Header$ +# +# Author: Marius Mauch +# +# ewhich is a tool to get the ebuild filename for a given package name + +import portage,sys,os +from output import * + +sys.stderr.write("\n" + red("!!!") + " As of Gentoolkit 0.2.0 this tool is deprecated\n") +sys.stderr.write(red("!!!") + " Refer to 'equery which' for a replacement\n\n") + +def print_help(): + print + print fuscia(os.path.basename(sys.argv[0])), "is a tool to get the filename of the ebuild for a given package" + print ' '*len(os.path.basename(sys.argv[0])), "that would be used by portage with the current configuration" + print + print yellow("Syntax:"), os.path.basename(sys.argv[0]), teal("") + print + print teal(""), "is either a simple package name (like "+green("xfree")+")," + print " a package name with category (like "+green("x11-base/xfree")+")" + print " or a DEPEND style atom as defined in ebuild(5) (like "+green(">=x11-base/xfree-4.3.0")+")" + print + +if len(sys.argv) <= 1 or sys.argv[1] == "-h" or sys.argv[1] == "--help": + print_help() + sys.exit(0) + +p = portage.db[portage.root]["porttree"].dbapi.xmatch("bestmatch-visible", sys.argv[1]) +if len(p) <= 1: + print + print red("*"), "\""+sys.argv[1]+"\" is not a valid package name or a masked package" + print + sys.exit(1) +pv = portage.catpkgsplit(p) +ebuild = "/"+pv[0]+"/"+pv[1]+"/"+p.split("/")[1]+".ebuild" +for ov in portage.settings["PORTDIR_OVERLAY"].split(): + if os.path.exists(ov+ebuild): + print os.path.normpath(ov+ebuild) + sys.exit(0) +print os.path.normpath(portage.settings["PORTDIR"]+ebuild) diff --git a/src/old-scripts/ewhich.1 b/src/old-scripts/ewhich.1 new file mode 100644 index 0000000..4bc5459 --- /dev/null +++ b/src/old-scripts/ewhich.1 @@ -0,0 +1,24 @@ +.TH ewhich 1 "October 19, 2003" "ewhich" + +.SH NAME +ewhich \- Gentoo: program for resolving ebuild names + +.SH SYNOPSIS +.B ewhich +[ -h | --help ] + +.SH DESCRIPTION +.B ewhich +is a little tool to find the actual ebuild file for a given package name. +It can use simple package names (like xfree), package names with category +(like x11-base/xfree) or DEPEND atoms (like >=x11-base/xfree-4.3.0). + +.SH BUGS +.B ewhich +No known bugs + +.SH SEE ALSO +emerge(1), make.conf(5), ebuild(5) + +.SH AUTHOR +Marius Mauch diff --git a/src/old-scripts/mkebuild b/src/old-scripts/mkebuild new file mode 100644 index 0000000..9ee0ce1 --- /dev/null +++ b/src/old-scripts/mkebuild @@ -0,0 +1,216 @@ +#!/bin/bash + +# Copyright (c) 2002 +# John Stalker +# Department of Mathematics +# Princeton University + +echo +echo -e "\x1b[31;01m!!! As of Gentoolkit 0.2.0, this tool is deprecated" +echo -e "!!!\x1b[0;0m Refer to app-portage/ebuilder for a replacement." +echo + +CONFIG_FILE=${HOME}/.mkebuild +if [ -e $CONFIG_FILE ] +then + source $CONFIG_FILE +else + echo This appears to be the first time you have used mkebuild. + echo I am going to make some guesses. If any of these are wrong + echo you should edit the file ${CONFIG_FILE}. + echo + MY_NAME=`awk -F":" '/^'${USER}:'/ { print $5 }' /etc/passwd` + echo Your name is ${MY_NAME}. + echo 'MY_NAME="'${MY_NAME}'"' >${CONFIG_FILE} + COPYRIGHT="Gentoo Technologies, Inc." + echo You wish to asign copyright to ${COPYRIGHT} + echo 'COPYRIGHT="'${COPYRIGHT}'"' >>${CONFIG_FILE} + MY_EMAIL=${USER}"@"${HOSTNAME} + echo Your email address is ${MY_EMAIL}. + echo 'MY_EMAIL='${MY_EMAIL} >>$CONFIG_FILE + LICENSE="the GNU General Public License, v2" + echo Your preferred license is ${LICENSE}. + echo 'LICENSE="'${LICENSE}'"' >>${CONFIG_FILE} + LOCAL_SOURCE=${HOME} + echo You download sources to ${LOCAL_SOURCE}. + echo LOCAL_SOURCE=${LOCAL_SOURCE} >>${CONFIG_FILE} + BUILD_DIRECTORY=${HOME} + echo You build packages in ${BUILD_DIRECTORY}. + echo 'BUILD_DIRECTORY='${BUILD_DIRECTORY} >>${CONFIG_FILE} + echo +fi +FILE_NAME=`basename $1` +SOURCE_LOCATION=`dirname $1` +PACKAGE_NAME=${FILE_NAME%.*} +FILE_EXTENSION=${FILE_NAME##*.} +if [ "${PACKAGE_NAME##*.}" = "tar" ] +then + FILE_EXTENSION=tar.${FILE_EXTENSION} + PACKAGE_NAME=${PACKAGE_NAME%.tar} +fi +EBUILD_FILE=${PWD}/${PACKAGE_NAME}.ebuild +echo "# Copyright" `date +"%Y"` ${COPYRIGHT} >${EBUILD_FILE} +echo "# Distributed under the terms of" ${LICENSE} >>${EBUILD_FILE} +#echo "# Author" ${MY_NAME} '<'${MY_EMAIL}'>' >>${EBUILD_FILE} +echo "# \$Header$" >>${EBUILD_FILE} +echo >>${EBUILD_FILE} +echo 'DESCRIPTION=""' >>${EBUILD_FILE} +echo 'SRC_URI="'${SOURCE_LOCATION}'/${P}.'${FILE_EXTENSION}'"' >>${EBUILD_FILE} +echo 'HOMEPAGE="'${SOURCE_LOCATION}'/"' >>${EBUILD_FILE} +echo 'LICENSE=""' >>${EBUILD_FILE} +echo 'SLOT="0"' >>${EBUILD_FILE} +echo 'KEYWORDS="~x86"' >>${EBUILD_FILE} +echo 'IUSE=""' >>${EBUILD_FILE} +echo >>${EBUILD_FILE} +echo 'DEPEND=""' >>${EBUILD_FILE} +echo >>${EBUILD_FILE} +echo '#RDEPEND=""' >>${EBUILD_FILE} +echo 'S=${WORKDIR}/${P}' >>${EBUILD_FILE} +echo >>${EBUILD_FILE} +echo 'src_unpack() {' >>${EBUILD_FILE} +echo >>${EBUILD_FILE} +echo -e "\t"'unpack ${A}' >>${EBUILD_FILE} +echo -e "\t"'cd ${S}' >>${EBUILD_FILE} +echo >>${EBUILD_FILE} +echo '}' >>${EBUILD_FILE} +if [ -e ${LOCAL_SOURCE}/${FILE_NAME} ] +then + echo I am assuming that $1 really + echo exists and that ${LOCAL_SOURCE}/${FILE_NAME} + echo is a faithful copy. +else + echo I didn\'t find ${LOCAL_SOURCE}/${FILE_NAME} so I will fetch + echo $1. + cd ${LOCAL_SOURCE} + wget $1 +fi +if [ -e ${BUILD_DIRECTORY}/${PACKAGE_NAME} ] +then + echo + echo I am assuming that ${BUILD_DIRECTORY}/${PACKAGE_NAME} \ + is the unpacked + echo version of ${LOCAL_SOURCE}/${FILE_NAME}. +else + cd ${BUILD_DIRECTORY} + if [ $? -ne 0 ] + then + echo + echo I was unable to enter the directory ${BUILD_DIRECTORY}. + exit 1 + fi + case "${FILE_EXTENSION}" in + tar.gz|tgz) + tar xzf ${LOCAL_SOURCE}/${FILE_NAME} + ;; + tar.bz2|tbz2) + tar xjf ${LOCAL_SOURCE}/${FILE_NAME} + ;; + tar.Z|tar.z) + unzip ${LOCAL_SOURCE}/${FILE_NAME} + tar xf ${PACKAGE_NAME}.tar + ;; + *) + echo + echo I can\'t figure out how to uncompress + echo ${LOCAL_SOURCE}/${FILE_NAME} + exit 1 + esac + if [ $? -ne 0 ] + then + echo + echo I was unable to uncompress ${LOCAL_SOURCE}/${FILE_NAME}. + exit 1 + fi +fi +cd ${BUILD_DIRECTORY}/${PACKAGE_NAME} +if [ $? -ne 0 ] +then + echo + echo I could not change directory to ${BUILD_DIRECTORY}/${PACKAGE_NAME} + exit 1 +fi +echo +echo You might want to look at the following files for configuration and +echo dependency information: +find ${PWD} -name README -print +find ${PWD} -name README.txt -print +find ${PWD} -name INSTALL -print +find ${PWD} -name INSTALL.txt -print +find ${PWD} -name Changes -print +find ${PWD} -name CHANGES.txt -print +find ${PWD} -name FAQ.txt +find ${PWD} -name ChangeLog -print +find ${PWD} -name NEWS -print +echo >>${EBUILD_FILE} +echo 'src_compile() {' >>${EBUILD_FILE} +echo >>${EBUILD_FILE} +echo +if [ -e Imakefile ] +then + echo I found an Imakefile. I am assuming that we should use xmkmf. + echo I don\'t really understand xmkmf so you will have to configure + echo things on your own. + echo + echo -e "\t"'xmkmf || die' >>${EBUILD_FILE} + echo -e "\tmake Makefiles" >>${EBUILD_FILE} + echo -e "\tmake includes" >>${EBUILD_FILE} + echo -e "\tmake depend" >>${EBUILD_FILES} +elif [ -e configure ] +then + echo I found a configure file. I am assuming that we are using autoconf +. + echo I will take care of setting the most commonly used options. I am + echo including a list of all the available options to confiigure, commen +ted + echo out. You might want to look it over to see if I have missed anythi +ng. + echo + ./configure --help >.config.options + echo -e "\t./configure \\" >>${EBUILD_FILE} + awk '/--prefix/ { print "\t\t--prefix=/usr \\"}' \ + .config.options >>${EBUILD_FILE} + awk '/--infodir/ { print "\t\t--infodir=/usr/share/info \\"}' \ + .config.options >>${EBUILD_FILE} + awk '/--mandir/ { print "\t\t--mandir=/usr/share/man \\"}' \ + .config.options >>${EBUILD_FILE} + echo -e "\t\t"'|| die "./configure failed"' >>${EBUILD_FILE} + echo -e "#\tAvailable options to configure:" >>${EBUILD_FILE} + awk '/--/ { print "#" $0 }' .config.options >>${EBUILD_FILE} + echo -e "\t"'emake || die' >>${EBUILD_FILE} +elif [ -e Makefile ] +then + echo I found a Makefile. You should look at it and possibly prepare + echo a patch. + echo + echo -e "\temake || die" >>${EBUILD_FILE} +else + echo I couldn\'t find a Imakefile, configure script, or Makefile for + echo this package. You will have to figure out what to do on your + echo own. + echo +fi +echo '}' >>${EBUILD_FILE} +echo >>${EBUILD_FILE} +echo 'src_install () {' >>${EBUILD_FILE} +echo >>${EBUILD_FILE} +echo -e "\t"'make DESTDIR=${D} install || die' >>${EBUILD_FILE} +echo '}' >>${EBUILD_FILE} +echo >>${EBUILD_FILE} +echo >>${EBUILD_FILE} +echo >>${EBUILD_FILE} +echo I couldn\'t supply a package description for the ebuild file +echo because I don\'t know what ${PACKAGE_NAME} does. +echo +echo I am assume the hompage for this package is ${SOURCE_LOCATION}/. +echo If that is not correct you will need to edit that portion of +echo the ebuild file as well. +echo +echo I don\'t understand dependencies yet. You will have to add any +echo dependencies you know of by hand. Then try your ebuild script +echo out to see if there are any dependencies you don\'t know of. +echo +echo I am assuming that this package comes with a well-behaved Makefile +echo which does not install anything outside of '${DESTDIR}'. You will +echo need to check this by looking at the portion of the Makefile +echo beginning with the line '"install:"'. + diff --git a/src/old-scripts/mkebuild.1 b/src/old-scripts/mkebuild.1 new file mode 100644 index 0000000..e800d4d --- /dev/null +++ b/src/old-scripts/mkebuild.1 @@ -0,0 +1,20 @@ +.TH mkebuild "1" "Nov 2003" "gentoolkit" +.SH NAME +mkebuild \- Gentoo: Interactive ebuild generator +.SH SYNOPSIS +.B mkebuild +.SH BUGS +This tool is obsolete, as of gentoolkit 0.2.0. +Use ebuilder [app\-portage/ebuilder] instead. +.SH SEE ALSO +.BR ebuilder(1) +.br +.BR /usr/sbin/ebuilder +.br +.BR /usr/sbin/mkebuild + +.SH AUTHORS +This informative man page was written by Karl Trygve Kalleberg + and expanded by Katerina Barone\-Adesi +. + diff --git a/src/old-scripts/pkg-clean b/src/old-scripts/pkg-clean new file mode 100644 index 0000000..9b07337 --- /dev/null +++ b/src/old-scripts/pkg-clean @@ -0,0 +1,107 @@ +#!/usr/bin/python +# Copyright 1999-2003 Gentoo Technologies, Inc. +# Distributed under the terms of the GNU General Public License v2 +# $Header$ +# Author: Leo Lipelis +# Author: Karl Trygve Kalleberg + +import commands +import re +import sys +import time +import os +from output import * + +print +print red("!!! As of Gentoolkit 0.2.0, this tool is deprecated") +print red("!!!") + " Refer to 'emerge clean' and 'emerge depclean' for replacements." +print + +time.sleep(4) + +# constants for package tuples that are stored in pkg_hash +PKG_TIME = 0 # number of seconds for ctime function +PKG = 1 # package full path as accepted by ebuild +PKG_NAME = 2 # package name as accepted by emerge + +(status, pkg_files) = commands.getstatusoutput( + "find /var/db/pkg -iname '*.ebuild' -printf '%T@ %p\n' | sort -n") + +pkg_file_list = pkg_files.splitlines() + +pkg_hash = {} +for time_pkg_pair in pkg_file_list: + (pkg_time, pkg) = time_pkg_pair.split() + pkg_time = int(pkg_time) + # This covers developer trees with not-accepted categories + tmp_name = re.match(r'/var/db/pkg/(.*/.*)/.*', pkg) + if not tmp_name: continue + pkg_name = tmp_name.group(1) + tmp_core = re.match(r'(.*)-\d.*', pkg_name) + if not tmp_core: continue + pkg_core = tmp_core.group(1) + if pkg_hash.has_key(pkg_core): + pkg_hash[pkg_core].append((pkg_time, pkg, pkg_name)) + else: + pkg_hash[pkg_core] = [(pkg_time, pkg, pkg_name)] + +total_len = len(pkg_hash.keys()) +curpkg = 0 +tmpname = os.tmpnam() +assume_yes = 0 + +if len(sys.argv) > 1: + if sys.argv[1] in ["-y", "--yes"]: + assume_yes = 1 + elif sys.argv[1] in ["-h", "--help"]: + print """pkg-clean [options] + +-y, --yes Don't ask for individual confirmation before unmerging; assume yes. +""" + sys.exit(0) + +for pkg_core in pkg_hash.keys(): + print "Examining %s:" % (pkg_core) + if len(pkg_hash[pkg_core]) < 2: + continue + unmerged_indexes = [] + + curpkg += 1 + choices = "" + idx = 1 + for pkg_tuple in pkg_hash[pkg_core]: + choices += " %d \"%s %s\" 0" % \ + (idx, time.ctime(pkg_tuple[PKG_TIME]), + pkg_tuple[PKG_NAME]) + idx += 1 + + params = "dialog --separate-output --backtitle \"pkg-clean processing package %d of %d\" " % ( curpkg, total_len) + params += "--checklist \"Select which package(s) to unmerge\" 20 70 12" + choices + res = os.system(params + " 2> " + tmpname) + if res: + sys.exit(0) + + ins = open(tmpname) + for j in ins.readlines(): + idx = int(j) + if idx == 0: + break + + full_path = pkg_hash[pkg_core][idx-1][PKG] + ebuild = full_path.replace('/var/db/pkg','') + + if not assume_yes: + params = "dialog --backtitle \"" + ebuild + "\" " + \ + "--yesno \"Are you sure you want to unmerge " + ebuild + " ?\" 20 70" + res = os.system(params) + else: + res = 0 + + if res == 0: + (status, unmerge_out) = commands.getstatusoutput( + "ebuild %s unmerge" % (full_path)) + print unmerge_out + time.sleep(2) + if status != 0: + sys.exit(status) + ins.close() diff --git a/src/old-scripts/pkg-clean.1 b/src/old-scripts/pkg-clean.1 new file mode 100644 index 0000000..7a295f3 --- /dev/null +++ b/src/old-scripts/pkg-clean.1 @@ -0,0 +1,20 @@ +.TH pkg\-clean "1" "Nov 2003" "gentoolkit" +.SH NAME +pkg\-clean \- Gentoo: Clean obsolete packages +.SH SYNOPSIS +.B pkg\-clean +.SH BUGS +This tool is obsolete, as of gentoolkit 0.2.0. +Use 'emerge clean' or 'emerge depclean' (with caution; read the man page) +instead. + +.SH SEE ALSO +.BR emerge(1) +.br +.BR /usr/sbin/pkg\-clean + +.SH AUTHORS +This informative man page was written by Karl Trygve Kalleberg + and expanded by Katerina Barone\-Adesi +. + diff --git a/src/old-scripts/pkg-size b/src/old-scripts/pkg-size new file mode 100644 index 0000000..8770db7 --- /dev/null +++ b/src/old-scripts/pkg-size @@ -0,0 +1,63 @@ +#!/bin/sh +# Copyright 1999-2003 Gentoo Technologies, Inc. +# Distributed under the terms of the GNU General Public License v2 +# $Header$ +# Author: Karl Trygve Kalleberg + +echo +echo -e "\x1b[31;01m!!! As of Gentoolkit 0.2.0, this tool is deprecated." +echo -e "!!!\x1b[0;0m Refer to 'equery size' for a replacement." +echo + +spec=$1 + +if [ -z "$spec" ] ; then + echo "Usage: pkg-size package" + exit 1 +fi + +name=`echo $1 | sed "s/\([^/]*\)\///"` +category=`echo $1 | sed "s/\/.*//"` + +if [ "$category" == "$name" ] ; then + category= +fi + +function tryfile() { + local foo + foo=/var/db/pkg/$1/CONTENTS + bar=`ls $foo 2> /dev/null` + for i in $bar ; do + if [ -f "$i" ] ; then + echo $i + break + fi + done +} + +file=`tryfile "${category}/${name}"` +if [ -z $file ] ; then + file=`tryfile "${category}/${name}*"` + if [ -z $file ] ; then + file=`tryfile "${category}*/${name}"` + if [ -z $file ] ; then + file=`tryfile "${category}*/${name}*"` + if [ -z $file ] ; then + echo "!!! Package resembling ${category}/${name} not found" + exit 1 + fi + fi + fi +fi + +pkgname=`echo $file | sed -e "s:\/var\/db\/pkg\/::" -e "s:\/CONTENTS::"` + +totals=`cat $file|grep "obj"|awk '{ print $2 }' | sed "s/ /\\ /" | xargs du -scb | grep total | cut -f 1` + +size=0 +for i in $totals ; do + size=$[size+i] +done + +echo "$pkgname $size ($[size/1024]KB)" + diff --git a/src/old-scripts/pkg-size.1 b/src/old-scripts/pkg-size.1 new file mode 100644 index 0000000..b195412 --- /dev/null +++ b/src/old-scripts/pkg-size.1 @@ -0,0 +1,11 @@ +.TH pkg-size "1" "Nov 2003" "gentoolkit" +.SH NAME +pkg-size \- Gentoo: Package size calculator +.SH SYNOPSIS +.B pkg-size +\fIpackage\fR +.SH DESCRIPTION +Calculate size of \fIpackage\fR. +.SH AUTHORS +\fBpkg-size\fR was written by Karl Trygve Kalleberg . + diff --git a/src/pkg-clean/AUTHORS b/src/pkg-clean/AUTHORS new file mode 100644 index 0000000..f126a36 --- /dev/null +++ b/src/pkg-clean/AUTHORS @@ -0,0 +1,5 @@ +Maintainer: +Karl Trygve Kalleberg + +Authors: +Leo Lipelis (original author) diff --git a/src/pkg-clean/ChangeLog b/src/pkg-clean/ChangeLog new file mode 100644 index 0000000..e69de29 diff --git a/src/pkg-clean/README b/src/pkg-clean/README new file mode 100644 index 0000000..e69de29 diff --git a/src/pkg-clean/pkg-clean b/src/pkg-clean/pkg-clean new file mode 100644 index 0000000..abe0159 --- /dev/null +++ b/src/pkg-clean/pkg-clean @@ -0,0 +1,99 @@ +#!/usr/bin/python +# Copyright 1999-2003 Gentoo Technologies, Inc. +# Distributed under the terms of the GNU General Public License v2 +# $Header$ +# Author: Leo Lipelis +# Author: Karl Trygve Kalleberg + +import commands +import re +import sys +import time +import os + +# constants for package tuples that are stored in pkg_hash +PKG_TIME = 0 # number of seconds for ctime function +PKG = 1 # package full path as accepted by ebuild +PKG_NAME = 2 # package name as accepted by emerge + +(status, pkg_files) = commands.getstatusoutput( + "find /var/db/pkg -iname '*.ebuild' -printf '%T@ %p\n' | sort -n") + +pkg_file_list = pkg_files.splitlines() + +pkg_hash = {} +for time_pkg_pair in pkg_file_list: + (pkg_time, pkg) = time_pkg_pair.split() + pkg_time = int(pkg_time) + # This covers developer trees with not-accepted categories + tmp_name = re.match(r'/var/db/pkg/(.*/.*)/.*', pkg) + if not tmp_name: continue + pkg_name = tmp_name.group(1) + tmp_core = re.match(r'(.*)-\d.*', pkg_name) + if not tmp_core: continue + pkg_core = tmp_core.group(1) + if pkg_hash.has_key(pkg_core): + pkg_hash[pkg_core].append((pkg_time, pkg, pkg_name)) + else: + pkg_hash[pkg_core] = [(pkg_time, pkg, pkg_name)] + +total_len = len(pkg_hash.keys()) +curpkg = 0 +tmpname = os.tmpnam() +assume_yes = 0 + +if len(sys.argv) > 1: + if sys.argv[1] in ["-y", "--yes"]: + assume_yes = 1 + elif sys.argv[1] in ["-h", "--help"]: + print """pkg-clean [options] + +-y, --yes Don't ask for individual confirmation before unmerging; assume yes. +""" + sys.exit(0) + +for pkg_core in pkg_hash.keys(): + print "Examining %s:" % (pkg_core) + if len(pkg_hash[pkg_core]) < 2: + continue + unmerged_indexes = [] + + curpkg += 1 + choices = "" + idx = 1 + for pkg_tuple in pkg_hash[pkg_core]: + choices += " %d \"%s %s\" 0" % \ + (idx, time.ctime(pkg_tuple[PKG_TIME]), + pkg_tuple[PKG_NAME]) + idx += 1 + + params = "dialog --separate-output --backtitle \"pkg-clean processing package %d of %d\" " % ( curpkg, total_len) + params += "--checklist \"Select which package(s) to unmerge\" 20 70 12" + choices + res = os.system(params + " 2> " + tmpname) + if res: + sys.exit(0) + + ins = open(tmpname) + for j in ins.readlines(): + idx = int(j) + if idx == 0: + break + + full_path = pkg_hash[pkg_core][idx-1][PKG] + ebuild = full_path.replace("/var/db/pkg/", "") + + if not assume_yes: + params = "dialog --backtitle \"" + ebuild + "\" " + \ + "--yesno \"Are you sure you want to unmerge " + ebuild + " ?\" 20 70" + res = os.system(params) + else: + res = 0 + + if res == 0: + (status, unmerge_out) = commands.getstatusoutput( + "ebuild %s unmerge" % (full_path)) + print unmerge_out + time.sleep(2) + if status != 0: + sys.exit(status) + ins.close() diff --git a/src/pkg-clean/pkg-clean.1 b/src/pkg-clean/pkg-clean.1 new file mode 100644 index 0000000..7a295f3 --- /dev/null +++ b/src/pkg-clean/pkg-clean.1 @@ -0,0 +1,20 @@ +.TH pkg\-clean "1" "Nov 2003" "gentoolkit" +.SH NAME +pkg\-clean \- Gentoo: Clean obsolete packages +.SH SYNOPSIS +.B pkg\-clean +.SH BUGS +This tool is obsolete, as of gentoolkit 0.2.0. +Use 'emerge clean' or 'emerge depclean' (with caution; read the man page) +instead. + +.SH SEE ALSO +.BR emerge(1) +.br +.BR /usr/sbin/pkg\-clean + +.SH AUTHORS +This informative man page was written by Karl Trygve Kalleberg + and expanded by Katerina Barone\-Adesi +. + diff --git a/src/pkg-size/pkg-size b/src/pkg-size/pkg-size new file mode 100644 index 0000000..84dd7df --- /dev/null +++ b/src/pkg-size/pkg-size @@ -0,0 +1,66 @@ +#! /usr/bin/python +# +# $Header$ +# +# Distributed under the terms of the GNU General Public License v2 +# Copyright (c) 2003 Karl Trygve Kalleberg + +import portage +import pprint +import sys +import os + +__author__ = "Karl Trygve Kalleberg" +__email__ = "karltk@gentoo.org" +__version__ = "0.1.0" +__productname__ = "pkg-size" +__description__ = "Portage package size calculator" + +def find(name): + return portage.portdb.match(name) + +def print_size(cpv): + scpv=portage.catpkgsplit(cpv) + cat = scpv[0] + pnv = scpv[1]+"-"+scpv[2] + if scpv[3] != "r0": + pnv +="-"+scpv[3] + db=portage.dblink(cat,pnv,"") + size=0 + uncounted = 0 + if not os.path.exists(db.getpath()): + return + k=db.getcontents() + if not k: + return + for i in k: + try: + size += os.stat(i).st_size + except OSError: + uncounted += 1 + s = cpv + ": " + str(size) + " bytes (" + str((size+512)/1024) + "KB)" + if uncounted > 0: + s += " (" + str(uncounted) + " file(s) not accessible)" + print s + + +def main(): + # parse parameters + if len(sys.argv) < 2: + print "No arguments!" + return + name = sys.argv[1] + candidates = find(name) + if len(candidates) == 0: + print "No candidate packages found!" + return + + for i in candidates: + print_size(i) + +if __name__ == "__main__": + try: + main() + except KeyboardInterrupt: + print "Operation Aborted!" + diff --git a/src/qpkg/AUTHORS b/src/qpkg/AUTHORS new file mode 100644 index 0000000..e69de29 diff --git a/src/qpkg/ChangeLog b/src/qpkg/ChangeLog new file mode 100644 index 0000000..b25fd25 --- /dev/null +++ b/src/qpkg/ChangeLog @@ -0,0 +1,5 @@ +2004-02-18 Brandon Low + * Fix a reported security issue, have a TMP location that is process specific + +2004-01-07 Karl Trygve Kalleberg + * Added Makefile diff --git a/src/qpkg/Makefile b/src/qpkg/Makefile new file mode 100644 index 0000000..cccdee0 --- /dev/null +++ b/src/qpkg/Makefile @@ -0,0 +1,19 @@ +# Copyright 2004 Karl Trygve Kalleberg +# Copyright 2004 Gentoo Technologies, Inc. +# Distributed under the terms of the GNU General Public License v2 +# +# $Header$ + +include ../../makedefs.mak + +all: + echo "HATHERSAGE (n.) The tiny snippets of beard which coat the inside of a washbasin after shaving in it." + +dist: + mkdir -p ../../${distdir}/src/qpkg + cp Makefile README AUTHORS ChangeLog TODO qpkg qpkg.1 ../../${distdir}/src/qpkg/ + +install: + install -d $(docdir)/deprecated/qpkg + install -m 0755 qpkg $(docdir)/deprecated/qpkg/ + install -m 0644 qpkg.1 README AUTHORS ChangeLog $(docdir)/deprecated/qpkg/ diff --git a/src/qpkg/README b/src/qpkg/README new file mode 100644 index 0000000..e69de29 diff --git a/src/qpkg/TODO b/src/qpkg/TODO new file mode 100644 index 0000000..e69de29 diff --git a/src/qpkg/qpkg b/src/qpkg/qpkg new file mode 100644 index 0000000..dd8344b --- /dev/null +++ b/src/qpkg/qpkg @@ -0,0 +1,581 @@ +#!/bin/bash +# +# qpkg - query portage package system for various information +# +# Copyright (c) Vitaly Kushneriuk +# This program is distributed under the terms of GPL version 2. +# +# Maintainer: Brandon Low +# Additional code thanks to: +# Josh Goebel +# +# $Header$ +ID='$Id$' +VERSION=0.`echo ${ID} | cut -d\ -f3` + +umask 0077 + +TMP="$(mktemp -d -t qpkg-XXXXXX)" +rm -rf ${TMP} +mkdir -p ${TMP} + +PROG=`basename ${0}` + +# Parse args +verb=0 +group="*" +params=${#} +while [ ${#} -gt 0 ] +do + a=${1} + shift + case "${a}" in + + -h|--help) + usage=y + break + ;; + + -i|--info) + info=y + ;; + + -d|--dups) + dups=y + inst=y + ;; + + -q|--query-deps) + query=y + ;; + + -s|--slot) + slot=y + ;; + + -f|--find-file) + ffind=y + inst=y + ;; + + -fp|--find-pattern) + ffind=y + fpat=y + inst=y + ;; + + -I|--installed) + inst=y + ;; + + -m|--masked) + grepmask="-L" + ;; + + -n|--non-masked) + grepmask="-l" + ;; + + -U|--uninstalled) + uninst=y + ;; + + -g|--group) + group=$1 + shift + ;; + + -l|--list) + list=y + inst=y + ;; + + -ct|--check-time|-tc|--time-check) + tcheck=y + inst=y + ;; + + -cm|--check-md5|-mc|--md5-check) + mcheck=y + inst=y + ;; + + -c|--check) + mcheck=y + tcheck=y + inst=y + ;; + + -v|--verbose) + let $((verb++)) + ;; + + -vv) + let $((verb++)) + let $((verb++)) + ;; + + -nc|--no-color|--nocolor|--no-colors|--nocolors) + nocolor=y + ;; + + -*) + echo -e ${CY}${PROG}${NO}:${YL} Invalid option ${RD}$a 1>&2 + usage=y + break + ;; + *) + if [ -n "${arg}" ]; then + echo -e ${CY}${PROG}: ${YL}Only one argument supported + usage=y + break + fi + arg=$a + ;; + + esac +done + +#This is a dumb way to handle things, take it out next time +T="\t" + +#Set up colors +if [ ! "${nocolor}" ]; then + NO="\x1b[0;0m" + BR="\x1b[0;01m" + CY="\x1b[36;01m" + RD="\x1b[31;01m" + GR="\x1b[32;01m" + YL="\x1b[33;01m" + BL="\x1b[34;01m" + STAR=" *" +elif [ ! "${inst}" ] && [ ! "${uninst}" ]; then + STAR=" *" +fi + + +# check for option conflicts +if [ "${inst}" -a "${uninst}" \ + -o \( "${ffind}" -o "${list}" -o "${tcheck}" -o "${mcheck}" \) \ + -a "${uninst}" ]; then + echo -e ${CY}${PROG}${NO}:${YL} conflicting options/modes${NO} + usage=y +fi + +if [ "${usage}" ]; then + echo -e "${CY}${PROG} v. ${VERSION}${NO} + +${CY}${PROG}${NO} is GenToolKit's \"query package\" tool, using it, you can +find packages owning files on your filesystem, check the integrity +of installed packages, and do other queries against installed or +uninstalled packages. + +NOTICE: This tool will be phased out at some point in the + future, please use equery instead. + Bugs are still fixed but new features won't be added. + +${BR}Usage: +${T}${CY}${PROG}${NO} [${BR}options${NO}] [${YL}pkgname${NO}] [${BL}-g${YL} group${NO}] [${BL}-f${YL} ${NO}|${BL}-fp${YL} ${NO}] +${T}${CY}${PROG}${NO} ${BL}--dups${NO} [${BL}--slot${NO}] +${T}${CY}${PROG}${NO} ${BL}--help${NO} + +${BR}Duplicate Locating: + ${BL}-d, --dups${NO}${T}${T}print packages that have multiple versions installed + ${BL}-s, --slot${NO}${T}${T}make ${BL}-d${NO} SLOT only print dups of the same SLOT + +${BR}Package Selection: + ${BL}-f, --find-file${NO}${T}finds package that owns file + ${BL}-fp, --find-pattern${NO}${T}finds to package that owns file matching ** + ${BL}-m, --masked${NO}${T}${T}Include${YL} only${NO} masked packages + ${BL}-n, --non-masked${NO}${T}Include${YL} only${NO} non-masked packages + ${BL}-I, --installed${NO}${T}Include${YL} only${NO} installed packages + ${BL}-U, --uninstalled${NO}${T}Include${YL} only${NO} uninstalled packages + ${BL}-g, --group${NO}${T}${T}Find by group (can be combined with other searches) + +${BR}Information Selection: + ${BL}-l, --list${NO}${T}${T}List package content + ${BL}-i, --info${NO}${T}${T}Get package description and home page. + ${BL}-ct, --check-time${NO} + ${BL}-tc, --time-check${NO}${T}Verify package files timestamps + ${BL}-cm, --check-md5${NO} + ${BL}-mc, --md5-check${NO}${T}Verify package files md5 + ${BL}-c, --check${NO}${T}${T}Verify mtimes${YL} and${NO} md5. + ${BL}-q, --query-deps${NO}${T}display all installed packages +${T}${T}${T}depending on selected packages + +${BR}Operation Modifiers: + ${BL}-nc, --no-color${NO}${T}don't use colors + ${BL}-v, --verbose${NO}${T}Be more verbose [ can be repeated twice ] + ${BL}-vv${NO}${T}${T}${T}Same as ${BL}-v -v${NO} + +${YL}Notes${NO}: +${YL}*${NO} ${BL}-f${NO}, ${BL}-fp, ${BL}-d${NO}, ${BL}-l${NO}, ${BL}-ct${NO}, ${BL}-cm${NO}, and ${BL}-c${NO} apply only to installed packages. +${YL}*${NO} Short options may not be combined on the command-line, yet. +${YL}*${NO} The operation of some flags has been changed by the + stripping of version numbers from some output to see + the version numbers play with ${BL}-v${NO} and ${BL}-vv${NO}. +${YL}*${NO} When using${BL} -f${NO} with ${BL}-l${NO} or ${BL}--check.. -v${NO} options, only + matching files will be displayed, unless ${BL}-v${NO} is doubled, + (yet more verbose) or ${BL}-vv${NO} is used. + + +${YL}Examples${NO}: + ${PROG} --dups print duplicates oldest first + ${PROG} --dups -v .. with versions + ${PROG} print list of installed packages + ${PROG} porta -I print versions of installed portage + ${PROG} porta -i .. + versions in portage tree + descriptions + and homepages + ${PROG} gawk -c -v check integrity of all installed versions of gawk + the older ones will have \"damaged\" files. + ${PROG} -f /bin/ls print package(s) that own /bin/ls +" + rm -rf ${TMP} + exit +fi + +#For the --dups switch only +if [ "${dups}" ]; then +if [ "${grepmask}" ]; then + mask=`python -c 'import portage; print portage.settings["ACCEPT_KEYWORDS"];' 2> /dev/null` + echo -e "Currently accepted keywords: ${BL}${mask}${NO}" + echo -e + mask=`echo ${mask} | perl -pe 's/\s+/|/'` +fi + + #First dig out the list of packages with duplicates + find /var/db/pkg/ -iname "*${arg}*.ebuild" 2> /dev/null > ${TMP}qpkg.lst + dups=`cat ${TMP}qpkg.lst | cut -f7 -d/ | + sed -e 's:\.ebuild$::; s:-r[0-9]*$::; s:-[^-]*$::; /^$/d' | + sort | + uniq -d` + + #Next get all the exact versions + duppak=`cat ${TMP}qpkg.lst | fgrep "${dups}"` + + #Now cut that down to the directory name so we can be smart + dirs=`sed -e 's:/[^/]*$::' ${TMP}qpkg.lst` + + #Go through each package's DB and create a sortable file + #to play with + declare -i defcount=`cat /var/cache/edb/counter` + for DIR in ${dirs} + do #Package COUNTER + NUM=`cat "${DIR}/COUNTER" 2> /dev/null` + [ -z "${NUM}" ] && NUM=defcount + #Package slot if requested + [ ${slot} ] && SLOT=`cat "${DIR}/SLOT"` + #Package fullname + PKG=`ls --color=no -1 ${DIR}/*.ebuild|cut -f5,7 -d"/"` + #Package basename + NAME=`echo "${PKG}"|sed -e 's:\.ebuild$::; s:-r[0-9]\+$::; s:-[0-9].*$::'` + echo "${NUM} ${PKG} ${NAME}${SLOT}" + #Finish loop, and sort that nice sortable file based on + #installation order, and then based on package basename + #bash hates me so I decided to use a temp file + done |sort -t" " -k3 -k1g,2|uniq -D -f2 > ${TMP}qpkg.lst + duppak=`cat ${TMP}qpkg.lst` + rm ${TMP}qpkg.lst + + #If max verbosity is set output with full path to each ebuild + if [ "${verb}" -gt 1 ]; then + echo -n "${duppak}"|cut -f2 -d" "| \ + sed -e "s:^:${BL}/var/db/pkg/${BR}:" \ + -e "s:\(/\)\([^/]*\)\(.ebuild\):\1${CY}\2${NO}\1\2\3:" + + #If normal verbosity output package group, package name and package version + elif [ "${verb}" -gt 0 ]; then + echo -n "${duppak}"|cut -f2 -d" "| \ + sed -e "s:\(^[^/]*/\)\(.*\)\(\.ebuild\):${BR}\1${CY}\2${NO}:" + + #Otherwise just output package group and package name + else + echo -n "${duppak}"|cut -f2 -d" "| \ + sed -e "s:-r[0-9]\+$::" \ + -e "s:-[0-9].*$::" \ + -e "s:\(^[^/]*/\)\(.*\):${BR}\1${CY}\2${NO}:"|uniq + fi + rm -rf ${TMP} + exit +fi + +# get list of ebuilds to work on +if [ "${ffind}" ]; then + # file find mode - list all ebuilds for + # package/CONTENTS containing + if [ "${fpat}" ]; then + dirs=`ls /var/db/pkg/${group}/*/CONTENTS \ + | xargs grep -l "${arg} " \ + | xargs --no-run-if-empty -n 1 dirname` + else + # if the user didnt specify a full path assume they + # want to check in the working dir #17331 + [ "${arg:0:1}" != "/" ] && arg="${PWD}/${arg}" + + dirs=`ls /var/db/pkg/${group}/*/CONTENTS \ + | xargs grep -Fl " ${arg} " \ + | xargs --no-run-if-empty -n 1 dirname` + fi + ipak=`( + for d in ${dirs} -;do + [ "-" = "$d" ] && break + ls ${d}/*.ebuild + done)` +else + # normal mode - list ebuilds for ebuild name containing + + # installed packages + if [ ! "${uninst}" ]; then + ipak=`find /var/db/pkg/ -iname "*.ebuild" 2>/dev/null` + if [[ ${group} != "*" ]]; then + ipak=`echo ${ipak}|sed -e "s: :\n:g"|grep ${group}` + fi + if [ ${arg} ]; then + # avoid ${arg}="db" from pulling in every installed package + temp="/var/db/pkg/.*${arg}" + ipak=`echo ${ipak}|sed -e "s: :\n:g"|grep -i ${temp}` + fi + if [ -n "${mask}" ]; then + ipak=`echo ${ipak}|xargs -r egrep ${grepmask} "^KEYWORDS=.*[[:space:]\"\'](${mask})[[:space:]\"\']"` + fi + fi + # not installed packages (yet:-) + if [ ! "${inst}" ]; then + upak=`find /usr/portage/ -iname "*.ebuild" 2>/dev/null|grep -v --regex="/usr/portage/[^/]*\.ebuild"` + if [[ ${group} != "*" ]]; then + upak=`echo ${upak}|sed -e "s: :\n:g"|grep ${group}` + fi + if [ ${arg} ]; then + upak=`echo ${upak}|sed -e "s: :\n:g"|grep -i ${arg}` + fi + if [ -n "${mask}" ]; then + upak=`echo ${upak}|xargs -r egrep ${grepmask} "^KEYWORDS=.*[[:space:]\"\'](${mask})[[:space:]\"\']"` + fi + fi +fi + +X="\([^/]*\)" + +for p in ${ipak} ${upak} -;do + [ "${p}" = "-" ] && break + + # cut common prefix from ebuild name and mark installed/uninstalled packages + # Note: iii/uuu will be replaced by the pipe at the end + n=${p%.ebuild} + var_db_pkg="/var/db/pkg/" + n=${n/${var_db_pkg}/iii } + usr_portage="/usr/portage/" + n=${n/${usr_portage}/uuu } + n=${n/\/*\//\/} + + d=${p%\/*.ebuild} # faster d=`dirname ${p}` + echo ${n} + + # if we have no passed parameters then + # we can skip the extra conditional checks + [[ ${params} == 0 ]] && continue; + + if [ "${mask}" ]; then + keywords=`grep KEYWORDS ${p}| cut -d\" -f2` + echo -e "${T}Keywords: ${BL}${keywords}${NO}" + fi + + if [ ${verb} -gt 1 ];then + echo "vvv ${p}" + fi + + if [ "${info}" ]; then + source ${p} 2> /dev/null + home="${HOMEPAGE}" + desc="${DESCRIPTION}" + #home=`grep HOMEPAGE ${p}| cut -d\" -f2` + #desc=`grep DESCRIPTION ${p}|cut -d= -f2-|cat` + echo -e "${T}${BL}${desc}${NO} [ ${YL}${home}${NO} ]" + if [ ${verb} -gt 0 ]; then + pdir=${p/$(basename ${p})/} + if [[ -r ${pdir}/USE && -r ${pdir}/IUSE ]]; then + echo -n "Compiled with USE Flags: " + for flag in $(<${pdir}/IUSE) + do + use=$(grep -o ${flag} ${pdir}/USE | tr -d '\n') + if [[ "${use}" == "" ]]; then + echo -n "-" + fi + echo -n "${flag} " + done + echo + fi + fi + fi + + if [ "${query}" ]; then + echo -e "${BL}DEPENDED ON BY:${NO}" + package="`echo ${n}|sed -e 's:-r[0-9]\+$::' \ + -e 's:-[0-9].*$::' \ + -e 's:^iii ::' \ + -e 's:^uuu ::'`" + place="`echo ${n}|cut -f1 -d' '`" + [[ "${place}" == "iii" ]] && color="${GR}" || color="${RD}" + + if [[ ${place} == "iii" ]]; then + for deppkg in $(grep -R "${package}" /var/db/pkg/*/*/RDEPEND | sed 's/RDEPEND.*$//') + do + rdepend=$(< ${deppkg}/RDEPEND) + + for flag in $(< ${deppkg}/USE) + do + if [[ "${flag:0:1}" == "-" ]]; then + rdepend="$(echo ${rdepend} | sed 's/${flag:1}? ( [[:alnum:][:punct:]]* )//')" + fi + done + + if [[ $(echo ${rdepend} | grep -o ${package}) == ${package} ]]; then + echo $'\t'$(< ${deppkg}/PF) + fi + done + else + grep -R "${package}" /var/db/pkg/*/*/RDEPEND | \ + cut -f5,6 -d"/" | sed -e "s:^:\t${color}:;s:$:${NO}:" | sort -u + fi + if [[ $(grep -R "*${package}" /etc/make.profile/packages) != "" ]]; then + echo -e "\t${color}SYSTEM PROFILE${NO}" + fi + fi + + # cat package content, remove obj/sym/dir, md5 and mtime when not verbose + # display only match in file-find mode unless extra verbose + if [ "${list}" ]; then + echo -e ${BL}CONTENTS:${NO} + + if [ ${verb} -gt 1 ]; then + cat ${d}/CONTENTS + else + if [ "${ffind}" ]; then + if [ "${fpat}" ]; then + grep "${arg}[:blank:]" $d/CONTENTS + else + grep " ${arg}\( .*\)*$" $d/CONTENTS + fi + else + cat $d/CONTENTS + fi | + if [ ${verb} -gt 0 ]; then + cat + else + sed -e "s:\(^obj \)\(.*\)\( .*\)\{2\}$:\1${BR}\2${NO}:; + s:\(^sym \)\(.*\)\( -> \)\(.*\)\( .*\)\{2\}$:\1${CY}\2${NO}\3\4:; + s:\(^dir \)\(.*\)$:\1${YL}\2${NO}:" + fi + fi + + echo + + # check files mtime and md5, display summary at the end + elif [ "${tcheck}" -o "${mcheck}" ]; then + # counters + fe=0 + fs=0 + # read the CONTENTS file and check md5 and mtime if needed + # process only matching files in find-file mode unless extra verbose + cat ${d}/CONTENTS | + if [ "${ffind}" -a ${verb} -lt 2 ];then + if [ "${fpat}" ]; then + grep "${arg}" + else + grep " ${arg} " + fi + else + cat + fi | + ( + while read -a line + do + fs=$((fs + 1)) + + unset md5 + unset _md5 + unset mtime + unset _mtime + unset err + unset len + + len="${#line[*]}" + if [ "${line[0]}" = "obj" ]; then + name= + for i in `seq 1 $((${len}-3))`; do + [ "${name}" ] && name="${name} ${line[${i}]}" || name="${line[${i}]}" + done + else + name="${line[1]}" + fi + + missing= + [ ! -e "${name}" ] && missing=1 + + # colorize name and compute mtime/md5 + if [ "obj" = "${line[0]}" ]; then + [ -e "${name}" ] && { + [ "${tcheck}" ] && mtime="${line[$((${len}-1))]}" + [ "${tcheck}" ] && _mtime=`date -r "${name}" +%s` + + [ "${mcheck}" ] && md5=${line[$((${len}-2))]} + [ "${mcheck}" ] && _md5=`md5sum "${name}"|cut -f1 -d" "` + } + + name="${BR}${name}${NO}" + + elif [ "sym" = "${line[0]}" ]; then + name="${CY}${name}${NO}" + + elif [ "dir" = "${line[0]}" ]; then + name="${YL}${name}${NO}" + fi + + # compare + if [ "${missing}" ]; then + err=1 + name="${name} ${RD}!not exist!${NO}" + fi + if [ "${md5}" != "${_md5}" ]; then + #If the md5 fails the first time check it with + #everything changed to lowercase :-D + md5="$(echo ${md5}|tr A-Z a-z)" + if [ "${md5}" != "${_md5}" ]; then + err=1 + name="${name} ${RD}!md5!${NO}" + fi + fi + if [ "${mtime}" != "${_mtime}" ]; then + err=1 + name="${name} ${RD}!mtime!${NO}" + fi + + [ "${verb}" -gt 1 ] && echo -e "${name}" + [[ "${verb}" -eq 1 ]] && [[ "${err}" -eq 1 ]] && echo -e "${name}" + + fe=$((fe + err)) + done + if [ "${fe}" = "0" ]; then + echo -e "${YL}${fe}${CY}/${fs}${NO}" + else + echo -e "${RD}${fe}${CY}/${fs}${NO}" + fi + echo + ) + fi + +done | ( + if [ ! \( "${tcheck}" -o "${mcheck}" -o "${info}" -o "${list}" -o "${query}" -o "${mask}" -o ${verb} -gt 0 \) ]; then + sed -e "s:-r[0-9]\+$::" -e "s:-[0-9][^-]*$::"|sort -k2|uniq -f1 + elif [ ! \( "${tcheck}" -o "${mcheck}" -o "${info}" -o "${list}" -o "${query}" -o "${mask}" -o ${verb} -lt 2 \) ]; then + sort -k2|uniq -f1 + else + cat + fi | sed \ + -e "s:^iii ${X}/${X}:${BR}\1/${CY}\2${STAR}${NO}:" \ + -e "s:^uuu ${X}/${X}:${BR}\1/${YL}\2${NO}:" \ + -e "s:^vvv \(.*\)$:${BL}\1${NO}:" \ + -e "s:^obj ::;s:^sym ::;s:^dir ::" + +) +rm -rf ${TMP} diff --git a/src/qpkg/qpkg.1 b/src/qpkg/qpkg.1 new file mode 100644 index 0000000..6d45a93 --- /dev/null +++ b/src/qpkg/qpkg.1 @@ -0,0 +1,112 @@ +.TH "qpkg" "1" "1.6" "gentoolkit 0.1.11-r1" "" +.SH "NAME" +qpkg \- Gentoo: query package tool +.SH "SYNOPSIS" +.LP +.B qpkg\fR [\fIoptions\fR] [\fIpkgname\fR] [\fI\-g group\fR] +.br + [\fI\-f \fR|\fI\-fp \fR] +.TP +.B qpkg \fI\-\-dups\fR [\fI\-\-slot\fR] +.TP +.B qpkg \fI\-\-help\fR +.SH "DESCRIPTION" +qpkg is GenToolKit's "query package" tool, using it, you can find packages owning files on your filesystem, check the integrity of installed packages, and do other queries against installed or uninstalled packages. +.SH "OPTIONS " +.LP +.I Duplicate Locating: +.LP +.B \-d, \-\-dups\fR print packages that have multiple +.br + versions installed +.br +.B \-s, \-\-slot\fR make \-d SLOT only print dups of the +.br + same SLOT +.LP +.I Package Selection: +.LP +.B \-f, \-\-find\-file\fR Finds package that owns file +.br +.B \-fp, \-\-find\-pattern\fR Finds to package that owns file +.br + matching ** +.br +.B \-I, \-\-installed\fR Include only installed packages +.br +.B \-U, \-\-uninstalled\fR Include only uninstalled packages +.br +.B \-g, \-\-group\fR Find by group (can be combined with +.br + other searches) +.LP +.I Information Selection: +.LP +.B \-l, \-\-list\fR List package content +.br +.B \-i, \-\-info\fR Get package description and home page. +.br +.B \-ct, \-\-check\-time +.br +.B \-tc, \-\-time\-check\fR Verify package files timestamps +.br +.B \-cm, \-\-check\-md5 +.br +.B \-mc, \-\-md5\-check\fR Verify package files md5 +.br +.B \-c, \-\-check\fR Verify mtimes and md5. +.br +.B \-q, \-\-query\-deps\fR display all installed packages +.br +\fR depending on selected packages +.LP +.I Operation Modifiers: +.LP +.B \-nc, \-\-no\-color\fR Don't use colors +.br +.B \-v, \-\-verbose\fR Be more verbose [2 levels] +.br +.B \-vv\fR Same as \-v \-v +.SH "NOTES" +\fI\-f, \-fp, \-d, \-l, \-ct, \-cm, \fRand \fI\-c\fR apply only to installed packages. +.br +.TP +Short options may not be combined on the command\-line, yet. +.TP +The operation of some flags has been changed in version 1.6 by the stripping of version numbers from some output to see the version numbers play with \fI\-v\fR and \fI\-vv\fR. +.TP +When using \fI\-f\fR with \fI\-l\fR or \fI\-\-check.. \-v\fR options, only matching files will be displayed, unless \fI\-v\fR is doubled, (yet more verbose), equivalent to \fI\-vv\fR. +.TP +When using \fI\-q\fR, it is important to note that the querying of deps checks package names only, because qpkg is not advanced enough (nor can it reasonably made so) to check complete deps with versions. Please use \fBdepclean\fR or \fBemerge --dep-clean\fR to more completely check the dependency sanity of your system. +.SH "EXAMPLES" +.LP +.B qpkg \fI\-\-dups\fR print duplicates oldest first +.br +.B qpkg \fI\-\-dups \-v\fR.. with versions +.br +.B qpkg\fR print list of packages +.br +.B qpkg\fR porta \fI\-I\fR print versions of installed portage +.br +.B qpkg porta \fI\-i\fR .. + versions in portage tree + +.br + descriptions and homepages +.br +.B qpkg gawk \fI\-c \-v\fR check integrity all installed versions +.br + of gawk the older versions will have +.br + "damaged" files. +.br +.B qpkg \fI\-f\fR /bin/ls print package(s) that own /bin/ls +.SH "AUTHORS" +Vitaly Kushneriuk , 2002: qpkg +.br +Karl Trygve Kalleberg , 2002: man page +.br +Brandon Low , 2002: maintainance +.SH "SEE ALSO" +ebuild(5) +.TP +The \fI/usr/sbin/qpkg\fR script. +.TP diff --git a/src/qpkg/qpkg.sh b/src/qpkg/qpkg.sh new file mode 100644 index 0000000..cdbe3c7 --- /dev/null +++ b/src/qpkg/qpkg.sh @@ -0,0 +1,520 @@ +#!/bin/bash +# +# qpkg - query portage package system for various information +# +# Copyright (c) Vitaly Kushneriuk +# This program is distributed under the terms of GPL version 2. +# +# Maintainer: Brandon Low +# Additional code thanks to: +# Josh Goebel +# +# $Header$ +ID='$Id$' +VERSION=0.`echo ${ID} | cut -d\ -f3` + +PROG=`basename ${0}` + +# Parse args +verb=0 +group="*" +params=${#} +while [ ${#} -gt 0 ] +do + a=${1} + shift + case "${a}" in + + -h|--help) + usage=y + break + ;; + + -i|--info) + info=y + ;; + + -d|--dups) + dups=y + inst=y + ;; + + -q|--query-deps) + query=y + ;; + + -s|--slot) + slot=y + ;; + + -f|--find-file) + ffind=y + inst=y + ;; + + -fp|--find-pattern) + ffind=y + fpat=y + inst=y + ;; + + -I|--installed) + inst=y + ;; + + -m|--masked) + grepmask="-L" + ;; + + -n|--non-masked) + grepmask="-l" + ;; + + -U|--uninstalled) + uninst=y + ;; + + -g|--group) + group=$1 + shift + ;; + + -l|--list) + list=y + inst=y + ;; + + -ct|--check-time|-tc|--time-check) + tcheck=y + inst=y + ;; + + -cm|--check-md5|-mc|--md5-check) + mcheck=y + inst=y + ;; + + -c|--check) + mcheck=y + tcheck=y + inst=y + ;; + + -v|--verbose) + let $((verb++)) + ;; + + -vv) + let $((verb++)) + let $((verb++)) + ;; + + -nc|--no-color|--nocolor|--no-colors|--nocolors) + nocolor=y + ;; + + -*) + echo -e ${CY}${PROG}${NO}:${YL} Invalid option ${RD}$a 1>&2 + usage=y + break + ;; + *) + if [ -n "${arg}" ]; then + echo -e ${CY}${PROG}: ${YL}Only one argument supported + usage=y + break + fi + arg=$a + ;; + + esac +done + +#This is a dumb way to handle things, take it out next time +T="\t" + +#Set up colors +if [ ! "${nocolor}" ]; then + NO="\x1b[0;0m" + BR="\x1b[0;01m" + CY="\x1b[36;01m" + RD="\x1b[31;01m" + GR="\x1b[32;01m" + YL="\x1b[33;01m" + BL="\x1b[34;01m" + STAR=" *" +elif [ ! "${inst}" ] && [ ! "${uninst}" ]; then + STAR=" *" +fi + + +# check for option conflicts +if [ "${inst}" -a "${uninst}" \ + -o \( "${ffind}" -o "${list}" -o "${tcheck}" -o "${mcheck}" \) \ + -a "${uninst}" ]; then + echo -e ${CY}${PROG}${NO}:${YL} conflicting options/modes${NO} + usage=y +fi + +if [ "${usage}" ]; then + echo -e "${CY}${PROG} v. ${VERSION}${NO} + +${CY}${PROG}${NO} is GenToolKit's \"query package\" tool, using it, you can +find packages owning files on your filesystem, check the integrity +of installed packages, and do other queries against installed or +uninstalled packages. + +${BR}Usage: +${T}${CY}${PROG}${NO} [${BR}options${NO}] [${YL}pkgname${NO}] [${BL}-g${YL} group${NO}] [${BL}-f${YL} ${NO}|${BL}-fp${YL} ${NO}] +${T}${CY}${PROG}${NO} ${BL}--dups${NO} [${BL}--slot${NO}] +${T}${CY}${PROG}${NO} ${BL}--help${NO} + +${BR}Duplicate Locating: + ${BL}-d, --dups${NO}${T}${T}print packages that have multiple versions installed + ${BL}-s, --slot${NO}${T}${T}make ${BL}-d${NO} SLOT only print dups of the same SLOT + +${BR}Package Selection: + ${BL}-f, --find-file${NO}${T}finds package that owns file + ${BL}-fp, --find-pattern${NO}${T}finds to package that owns file matching ** + ${BL}-m, --masked${NO}${T}Include${YL} only${NO} masked packages + ${BL}-n, --non-masked${NO}${T}Include${YL} only${NO} non-masked packages + ${BL}-I, --installed${NO}${T}Include${YL} only${NO} installed packages + ${BL}-U, --uninstalled${NO}${T}Include${YL} only${NO} uninstalled packages + ${BL}-g, --group${NO}${T}${T}Find by goup (can be combined with other searches) + +${BR}Information Selection: + ${BL}-l, --list${NO}${T}${T}List package content + ${BL}-i, --info${NO}${T}${T}Get package description and home page. + ${BL}-ct, --check-time${NO} + ${BL}-tc, --time-check${NO}${T}Verify package files timestamps + ${BL}-cm, --check-md5${NO} + ${BL}-mc, --md5-check${NO}${T}Verify package files md5 + ${BL}-c, --check${NO}${T}${T}Verify mtimes${YL} and${NO} md5. + ${BL}-q, --query-deps${NO}${T}display all installed packages +${T}${T}${T}depending on selected packages + +${BR}Operation Modifiers: + ${BL}-nc, --no-color${NO}${T}don't use colors + ${BL}-v, --verbose${NO}${T}Be more verbose [ can be repeated twise ] + ${BL}-vv${NO}${T}${T}${T}Same as ${BL}-v -v${NO} + +${YL}Notes${NO}: +${YL}*${NO} ${BL}-f${NO}, ${BL}-fp, ${BL}-d${NO}, ${BL}-l${NO}, ${BL}-ct${NO}, ${BL}-cm${NO}, and ${BL}-c${NO} apply only to installed packages. +${YL}*${NO} Short options may not be combined on the command-line, yet. +${YL}*${NO} The operation of some flags has been changed by the + stripping of version numbers from some output to see + the version numbers play with ${BL}-v${NO} and ${BL}-vv${NO}. +${YL}*${NO} When using${BL} -f${NO} with ${BL}-l${NO} or ${BL}--check.. -v${NO} options, only + matching files will be displayed, unless ${BL}-v${NO} is doubled, + (yet more verbose) or ${BL}-vv${NO} is used. + + +${YL}Examples${NO}: + ${PROG} --dups print duplicates oldest first + ${PROG} --dups -v .. with versions + ${PROG} print list of installed packages + ${PROG} porta -I print versions of installed portage + ${PROG} porta -i .. + versions in portage tree + descriptions + and homepages + ${PROG} gawk -c -v check integrity all installed versions of gawk + the older will have \"damaged\" files. + ${PROG} -f /bin/ls print package(s) that own /bin/ls +" + exit +fi + +#For the --dups switch only +if [ "${dups}" ]; then +if [ "${grepmask}" ]; then + mask=`python -c 'import portage; print portage.settings["ACCEPT_KEYWORDS"];' 2> /dev/null` + echo -e "Currently accepted keywords: ${BL}${mask}${NO}" + echo -e + mask=`echo ${mask} | perl -pe 's/\s+/|/'` +fi + + #First dig out the list of packages with duplicates + find /var/db/pkg -iname "*${arg}*.ebuild" 2> /dev/null > /tmp/qpkg.lst + dups=`cat /tmp/qpkg.lst | cut -f7 -d/ | + sed -e 's:\.ebuild$::; s:-r[0-9]*$::; s:-[^-]*$::; /^$/d' | + sort | + uniq -d` + + #Next get all the exact versions + duppak=`cat /tmp/qpkg.lst | fgrep "${dups}"` + + #Now cut that down to the directory name so we can be smart + dirs=`sed -e 's:/[^/]*$::' /tmp/qpkg.lst` + + #Go through each package's DB and create a sortable file + #to play with + declare -i defcount=`cat /var/cache/edb/counter` + for DIR in ${dirs} + do #Package COUNTER + NUM=`cat "${DIR}/COUNTER" 2> /dev/null` + [ -z "${NUM}" ] && NUM=defcount + #Package slot if requested + [ ${slot} ] && SLOT=`cat "${DIR}/SLOT"` + #Package fullname + PKG=`ls --color=no -1 ${DIR}/*.ebuild|cut -f5,7 -d"/"` + #Package basename + NAME=`echo "${PKG}"|sed -e 's:\.ebuild$::; s:-r[0-9]\+$::; s:-[0-9].*$::'` + echo "${NUM} ${PKG} ${NAME}${SLOT}" + #Finish loop, and sort that nice sortable file based on + #installation order, and then based on package basename + #bash hates me so I decided to use a temp file + done |sort -t" " -k3 -k1g,2|uniq -D -f2 > /tmp/qpkg.lst + duppak=`cat /tmp/qpkg.lst` + rm /tmp/qpkg.lst + + #If max verbosity is set output with full path to each ebuild + if [ "${verb}" -gt 1 ]; then + echo -n "${duppak}"|cut -f2 -d" "| \ + sed -e "s:^:${BL}/var/db/pkg/${BR}:" \ + -e "s:\(/\)\([^/]*\)\(.ebuild\):\1${CY}\2${NO}\1\2\3:" + + #If normal verbosity output package group, package name and package version + elif [ "${verb}" -gt 0 ]; then + echo -n "${duppak}"|cut -f2 -d" "| \ + sed -e "s:\(^[^/]*/\)\(.*\)\(\.ebuild\):${BR}\1${CY}\2${NO}:" + + #Otherwise just output package group and package name + else + echo -n "${duppak}"|cut -f2 -d" "| \ + sed -e "s:-r[0-9]\+$::" \ + -e "s:-[0-9].*$::" \ + -e "s:\(^[^/]*/\)\(.*\):${BR}\1${CY}\2${NO}:"|uniq + fi + exit +fi + +# get list of ebuilds to work on +if [ "${ffind}" ]; then + # file find mode - list all ebuilds for + # package/CONTENTS containing + if [ "${fpat}" ]; then + dirs=`ls /var/db/pkg/${group}/*/CONTENTS \ + | xargs grep -l "${arg}" \ + | xargs --no-run-if-empty -n 1 dirname` + else + # if the user didnt specify a full path assume they + # want to check in the working dir #17331 + [ "${arg:0:1}" != "/" ] && arg="${PWD}/${arg}" + + dirs=`ls /var/db/pkg/${group}/*/CONTENTS \ + | xargs grep -l " ${arg}\( .*\)*$" \ + | xargs --no-run-if-empty -n 1 dirname` + fi + ipak=`( + for d in ${dirs} -;do + [ "-" = "$d" ] && break + ls ${d}/*.ebuild + done)` +else + # normal mode - list ebuilds for ebuild name containing + + # installed packages + if [ ! "${uninst}" ]; then + ipak=`find /var/db/pkg/ -iname "*.ebuild" 2>/dev/null` + if [[ ${group} != "*" ]]; then + ipak=`echo ${ipak}|sed -e "s: :\n:g"|grep ${group}` + fi + if [ ${arg} ]; then + # avoid ${arg}="db" from pulling in every installed package + temp="/var/db/pkg/.*${arg}" + ipak=`echo ${ipak}|sed -e "s: :\n:g"|grep ${temp}` + fi + if [ -n "${mask}" ]; then + ipak=`echo ${ipak}|xargs -r egrep ${grepmask} "^KEYWORDS=.*[[:space:]\"\'](${mask})[[:space:]\"\']"` + fi + fi + # not installed packages (yet:-) + if [ ! "${inst}" ]; then + upak=`find /usr/portage/ -iname "*.ebuild" 2>/dev/null|grep -v --regex="/usr/portage/[^/]*\.ebuild"` + if [[ ${group} != "*" ]]; then + upak=`echo ${upak}|sed -e "s: :\n:g"|grep ${group}` + fi + if [ ${arg} ]; then + upak=`echo ${upak}|sed -e "s: :\n:g"|grep ${arg}` + fi + if [ -n "${mask}" ]; then + upak=`echo ${upak}|xargs -r egrep ${grepmask} "^KEYWORDS=.*[[:space:]\"\'](${mask})[[:space:]\"\']"` + fi + fi +fi + +X="\([^/]*\)" + +for p in ${ipak} ${upak} -;do + [ "${p}" = "-" ] && break + + # cut common prefix from ebuild name and mark installed/uninstalled packages + # Note: iii/uuu will be replaced by the pipe at the end + n=${p%.ebuild} + var_db_pkg="/var/db/pkg/" + n=${n/${var_db_pkg}/iii } + usr_portage="/usr/portage/" + n=${n/${usr_portage}/uuu } + n=${n/\/*\//\/} + + d=${p%\/*.ebuild} # faster d=`dirname ${p}` + echo ${n} + + # if we have no passed parameters then + # we can skip the extra conditional checks + [[ ${params} == 0 ]] && continue; + + if [ "${mask}" ]; then + keywords=`grep KEYWORDS ${p}| cut -d\" -f2` + echo -e "${T}Keywords: ${BL}${keywords}${NO}" + fi + + if [ ${verb} -gt 1 ];then + echo "vvv ${p}" + fi + + if [ "${info}" ]; then + home=`grep HOMEPAGE ${p}| cut -d\" -f2` + desc=`grep DESCRIPTION ${p}| cut -d\" -f2` + echo -e "${T}${BL}${desc}${NO} [ ${YL}${home}${NO} ]" + fi + + if [ "${query}" ]; then + echo -e "${BL}DEPENDED ON BY:${NO}" + package="`echo ${n}|sed -e 's:-r[0-9]\+$::' \ + -e 's:-[0-9].*$::' \ + -e 's:^iii ::' \ + -e 's:^uuu ::'`" + place="`echo ${n}|cut -f1 -d' '`" + [[ "${place}" == "iii" ]] && color="${GR}" || color="${RD}" + grep -R "${package}" /var/db/pkg/*/*/RDEPEND | \ + cut -f5,6 -d"/" | sed -e "s:^:\t${color}:;s:$:${NO}:" | sort | uniq +# gawk -F "/" '{printf("${place}\n\t%s/%s${NO}",$5,$6)}' | sort | uniq + fi + + # cat package content, remove obj/sym/dir, md5 and mtime when not verbose + # display only match in file-find mode unless extra verbose + if [ "${list}" ]; then + echo -e ${BL}CONTENTS:${NO} + + if [ ${verb} -gt 1 ]; then + cat ${d}/CONTENTS + else + if [ "${ffind}" ]; then + if [ "${fpat}" ]; then + grep "${arg}" $d/CONTENTS + else + grep " ${arg}\( .*\)*$" $d/CONTENTS + fi + else + cat $d/CONTENTS + fi | + if [ ${verb} -gt 0 ]; then + cat + else + sed -e "s:\(^obj \)\([^ ]*\)\(.*$\):\1${BR}\2${NO}:; + s:\(^sym \)\([^ ]*\)\( -> \)\([^ ]*\)\(.*$\):\1${CY}\2${NO}\3\4:; + s:\(^dir \)\([^ ]*\)\(.*$\):\1${YL}\2${NO}:" + fi + fi + + echo + + # check files mtime and md5, display summary at the end + elif [ "${tcheck}" -o "${mcheck}" ]; then + # counters + fe=0 + fs=0 + # read the CONTENTS file and check md5 and mtime if needed + # process only matching files in find-file mode unless extra verbose + cat ${d}/CONTENTS | + if [ "${ffind}" -a ${verb} -lt 2 ];then + if [ "${fpat}" ]; then + grep "${arg}" + else + grep " ${arg} " + fi + else + cat + fi | + ( + while read -a line + do + fs=$((fs + 1)) + + unset md5 + unset _md5 + unset mtime + unset _mtime + unset err + + name=${line[1]} + + missing= + [ ! -e ${name} ] && missing=1 + + # colorize name and compute mtime/md5 + if [ "obj" = ${line[0]} ]; then + [ -e ${name} ] && { + [ "${tcheck}" ] && mtime=${line[3]} + [ "${tcheck}" ] && _mtime=`date -r ${name} +%s` + + [ "${mcheck}" ] && md5=${line[2]} + [ "${mcheck}" ] && _md5=`md5sum ${name}|cut -f1 -d" "` + } + + name=${BR}${name}${NO} + + elif [ "sym" = ${line[0]} ]; then + name=${CY}${name}${NO} + + elif [ "dir" = ${line[0]} ]; then + name=${YL}${name}${NO} + fi + + # compare + if [ "$missing" ]; then + err=1 + name="${name} ${RD}!not exist!${NO}" + fi + if [ "${md5}" != "${_md5}" ]; then + #If the md5 fails the first time check it with + #everything changed to lowercase :-D + md5=`echo "${md5}"|tr A-Z a-z` + if [ "${md5}" != "${_md5}" ]; then + err=1 + name="${name} ${RD}!md5!${NO}" + fi + fi + if [ "${mtime}" != "${_mtime}" ]; then + err=1 + name="${name} ${RD}!mtime!${NO}" + fi + + [ ${verb} -gt 1 ] && echo -e ${name} + [[ ${verb} -eq 1 ]] && [[ $err -eq 1 ]] && echo -e ${name} + + fe=$((fe + err)) + done + if [ "$fe" = "0" ]; then + echo -e ${YL}$fe${CY}/$fs${NO} + else + echo -e ${RD}$fe${CY}/$fs${NO} + fi + echo + ) + fi + +done | ( + if [ ! \( "${tcheck}" -o "${mcheck}" -o "${info}" -o "${list}" -o "${query}" -o "${mask}" -o ${verb} -gt 0 \) ]; then + sed -e "s:-r[0-9]\+$::" -e "s:-[0-9][^-]*$::"|sort -k2|uniq -f1 + elif [ ! \( "${tcheck}" -o "${mcheck}" -o "${info}" -o "${list}" -o "${query}" -o "${mask}" -o ${verb} -lt 2 \) ]; then + sort -k2|uniq -f1 + else + cat + fi | sed \ + -e "s:^iii ${X}/${X}:${BR}\1/${CY}\2${STAR}${NO}:" \ + -e "s:^uuu ${X}/${X}:${BR}\1/${YL}\2${NO}:" \ + -e "s:^vvv \(.*\)$:${BL}\1${NO}:" \ + -e "s:^obj ::;s:^sym ::;s:^dir ::" + +) diff --git a/src/revdep-rebuild/99revdep-rebuild b/src/revdep-rebuild/99revdep-rebuild new file mode 100644 index 0000000..bdaecc7 --- /dev/null +++ b/src/revdep-rebuild/99revdep-rebuild @@ -0,0 +1,21 @@ +# Default revdep-rebuild configuration file +# +# revdep-rebuild no longer uses hardcoded paths. To change the default +# behavior the following variables can be changed: +# +# LD_LIBRARY_MASK - Mask of specially evaluated libraries +# +# SEARCH_DIRS - List of directories to search for executables and libraries +# Use this for directories that are not included in PATH or ld.so.conf. +# An application should normally not have to set this variable +# +# SEARCH_DIRS_MASK - List of directories to not search +# Use this for directories that should not be searched by revdep-rebuild +# This is normally used by binary packages such as openoffice-bin +# +# Note: This file is sourced using bash by the revdep-rebuild script + +LD_LIBRARY_MASK="libodbcinst.so libodbc.so libjava.so libjvm.so" +SEARCH_DIRS="/bin /sbin /usr/bin /usr/sbin /lib* /usr/lib*" +SEARCH_DIRS_MASK="/lib*/modules" + diff --git a/src/revdep-rebuild/AUTHORS b/src/revdep-rebuild/AUTHORS new file mode 100644 index 0000000..b3d9b32 --- /dev/null +++ b/src/revdep-rebuild/AUTHORS @@ -0,0 +1,2 @@ +Stanislav Brabec (original author) +Paul Varner diff --git a/src/revdep-rebuild/ChangeLog b/src/revdep-rebuild/ChangeLog new file mode 100644 index 0000000..9060781 --- /dev/null +++ b/src/revdep-rebuild/ChangeLog @@ -0,0 +1,9 @@ +2005-06-05 Paul Varner + + * ChangeLog moved to main gentoolkit ChangeLog + +2004-01-07 Karl Trygve Kalleberg + + * Added Makefile + * Copied revdep-rebuild script from app-portage/gentoolkit + diff --git a/src/revdep-rebuild/Makefile b/src/revdep-rebuild/Makefile new file mode 100644 index 0000000..d509681 --- /dev/null +++ b/src/revdep-rebuild/Makefile @@ -0,0 +1,23 @@ +# Copyright 2004 Karl Trygve Kalleberg +# Copyright 2004 Gentoo Technologies, Inc. +# Distributed under the terms of the GNU General Public License v2 +# +# $Header$ + +include ../../makedefs.mak + +all: + echo "AIGBURTH (AYG-berth n.) Any piece of readily identifiable anatomy found among cooked meat." + +dist: + mkdir -p ../../$(distdir)/src/revdep-rebuild + cp Makefile AUTHORS README TODO ChangeLog revdep-rebuild revdep-rebuild.1 99revdep-rebuild ../../$(distdir)/src/revdep-rebuild/ + +install: + + install -m 0755 revdep-rebuild $(bindir)/ + install -d $(docdir)/revdep-rebuild + install -m 0644 AUTHORS README TODO $(docdir)/revdep-rebuild/ + install -m 0644 revdep-rebuild.1 $(mandir)/ + install -d $(sysconfdir)/revdep-rebuild + install -m 0644 99revdep-rebuild $(sysconfdir)/revdep-rebuild/ diff --git a/src/revdep-rebuild/README b/src/revdep-rebuild/README new file mode 100644 index 0000000..3a51d9f --- /dev/null +++ b/src/revdep-rebuild/README @@ -0,0 +1,4 @@ +This tool scans libraries and binaries for broken shared lib dependencies +and fixes them by re-emerging those broken binaries and shared libraries. + +- Alastair Tse diff --git a/src/revdep-rebuild/TODO b/src/revdep-rebuild/TODO new file mode 100644 index 0000000..d9f6350 --- /dev/null +++ b/src/revdep-rebuild/TODO @@ -0,0 +1,7 @@ +- revdep cache in /var/cache + - list all .so files this package depends on + - use timestamps of files to know when to rebuild + - if ts of cache is older than any of the package's contained + files, we must rebuild +- update to use equery/gentoolkit +- rewrite in python and/or eclectic module diff --git a/src/revdep-rebuild/find_pkgs.py b/src/revdep-rebuild/find_pkgs.py new file mode 100755 index 0000000..7013813 --- /dev/null +++ b/src/revdep-rebuild/find_pkgs.py @@ -0,0 +1,22 @@ +#!/usr/bin/python +# Copyright 1999-2005 Gentoo Foundation +# $Header$ + +# Temporary script to find package versions and slot for revdep-rebuild + +import sys + +sys.path.insert(0, "/usr/lib/gentoolkit/pym") +import gentoolkit + +for pkgname in sys.argv[1:]: + matches = gentoolkit.find_packages(pkgname) + for pkg in matches: + (cat, name, ver, rev) = gentoolkit.split_package_name(pkg.get_cpv()) + slot = pkg.get_env_var("SLOT") + if rev == "r0": + fullversion = ver + else: + fullversion = ver + "-" + rev + + print name + " " + fullversion + " (" + slot + ")" diff --git a/src/revdep-rebuild/revdep-rebuild b/src/revdep-rebuild/revdep-rebuild new file mode 100755 index 0000000..3ffe904 --- /dev/null +++ b/src/revdep-rebuild/revdep-rebuild @@ -0,0 +1,1094 @@ +#!/bin/bash +# Copyright 1999-2008 Gentoo Foundation + +# revdep-rebuild: Reverse dependency rebuilder. +# Original Author: Stanislav Brabec +# Rewrite Author: Michael A. Smith +# Current Maintainer: Paul Varner + +# TODO: +# - Use more /etc/init.d/functions.sh +# - Try to reduce the number of global vars + +## +# Global Variables: + +# Must-be-blank: +unset GREP_OPTIONS + +# Readonly variables: +declare -r APP_NAME="${0##*/}" # The name of this application +declare -r OIFS="$IFS" # Save the IFS +declare -r ENV_FILE=0_env.rr # Contains environment variables +declare -r FILES_FILE=1_files.rr # Contains a list of files to search +declare -r LDPATH_FILE=2_ldpath.rr # Contains the LDPATH +declare -r BROKEN_FILE=3_broken.rr # Contains the list of broken files +declare -r ERRORS_FILE=3_errors.rr # Contains the ldd error output +declare -r RAW_FILE=4_raw.rr # Contains the raw list of packages +declare -r OWNERS_FILE=4_owners.rr # Contains the file owners +declare -r PKGS_FILE=4_pkgs.rr # Contains the unsorted bare package names +declare -r EBUILDS_FILE=4_ebuilds.rr # Contains the unsorted atoms + # (Appropriately slotted or versioned) +declare -r ORDER_FILE=5_order.rr # Contains the sorted atoms +declare -r STATUS_FILE=6_status.rr # Contains the ldd error output +declare -ra FILES=( + "$ENV_FILE" + "$FILES_FILE" + "$LDPATH_FILE" + "$BROKEN_FILE" + "$ERRORS_FILE" + "$RAW_FILE" + "$OWNERS_FILE" + "$PKGS_FILE" + "$EBUILDS_FILE" + "$ORDER_FILE" + "$STATUS_FILE" +) + +# "Boolean" variables: Considered "true" if it has any value at all +# "True" indicates we should... +declare FULL_LD_PATH # ...search across the COMPLETE_LD_LIBRARY_PATH +declare KEEP_TEMP # ...not delete tempfiles from the current run +declare ORDER_PKGS # ...sort the atoms in deep dependency order +declare PACKAGE_NAMES # ...emerge by slot, not by versionated atom +declare RM_OLD_TEMPFILES # ...remove tempfiles from prior runs +declare SEARCH_BROKEN # ...search for broken libraries and binaries +declare VERBOSE # ...give verbose output + +# Globals that impact portage directly: +declare EMERGE_DEFAULT_OPTS # String of options portage assumes to be set +declare EMERGE_OPTIONS # Array of options to pass to portage +declare PORTAGE_NICENESS # Renice to this value +declare PORTAGE_ROOT # The root path for portage + +# Customizable incremental variables: +# These variables can be prepended to either by setting the variable in +# your environment prior to execution, or by placing an entry in +# /etc/make.conf. +# +# An entry of "-*" means to clear the variable from that point forward. +# Example: env SEARCH_DIRS="/usr/bin -*" revdep-rebuild will set SEARCH_DIRS +# to contain only /usr/bin +declare LD_LIBRARY_MASK # Mask of specially evaluated libraries +declare SEARCH_DIRS # List of dirs to search for executables and libraries +declare SEARCH_DIRS_MASK # List of dirs not to search + +# Other globals: +declare OLDPROG # Previous pass through the progress meter +declare EXACT_PKG # Versionated atom to emerge +declare HEAD_TEXT # Feedback string about the search +declare NOCOLOR # Set to "true" not to output term colors +declare OK_TEXT # Feedback about a search which found no errors +declare RC_NOCOLOR # Hack to insure we respect NOCOLOR +declare REBUILD_LIST # Array of atoms to emerge +declare SKIP_LIST # Array of atoms that cannot be emerged (masked?) +declare SONAME # Soname/soname path pattern given on commandline +declare SONAME_SEARCH # Value of SONAME modified to match ldd's output +declare WORKING_TEXT # Feedback about the search +declare WORKING_DIR # Working directory where cache files are kept + +main() { + # preliminary setup + get_opts "$@" + setup_portage + setup_search_paths_and_masks + get_search_env + echo + + # Search for broken binaries + get_files + get_ldpath + main_checks + + # Associate broken binaries with packages to rebuild + if [[ $PACKAGE_NAMES ]]; then + get_packages + clean_packages + assign_packages_to_ebuilds + else + get_exact_ebuilds + fi + + # Rebuild packages owning broken binaries + get_build_order + rebuild + + # All done + cleanup +} +## +# Refuse to delete anything before we cd to our tmpdir +# (See mkdir_and_cd_to_tmpdir() +rm() { + eerror "I was instructed to rm '$@'" + die 1 "Refusing to delete anything before changing to temporary directory." +} +## +# GNU find has -executable, but if our users' finds do not have that flag +# we emulate it with this function. Also emulates -writable and -readable. +# Usage: find PATH ARGS -- use find like normal, except use -executable instead +# of various versions of -perm /+ blah blah and hacks +find() { + hash find || { die 1 'find not found!'; } + # We can be pretty sure find itself should be executable. + local testsubject="$(type -P find)" + if [[ $(command find "$testsubject" -executable 2> /dev/null) ]]; then + unset -f find # We can just use the command find + elif [[ $(command find "$testsubject" -perm /u+x 2> /dev/null) ]]; then + find() { + a=(${@//-executable/-perm \/u+x}) + a=(${a[@]//-writable/-perm \/u+w}) + a=(${a[@]//-readable/-perm \/r+w}) + command find "${a[@]}" + } + elif [[ $(command find "$testsubject" -perm +u+x 2> /dev/null) ]]; then + find() { + a=(${@//-executable/-perm +u+x}) + a=(${a[@]//-writable/-perm +u+w}) + a=(${a[@]//-readable/-perm +r+w}) + command find "${a[@]}" + } + else # Last resort + find() { + a=(${@//-executable/-exec test -x '{}' \; -print}) + a=(${a[@]//-writable/-exec test -w '{}' \; -print}) + a=(${a[@]//-readable/-exec test -r '{}' \; -print}) + command find "${a[@]}" + } + fi + find "$@" +} + +print_usage() { +cat << EOF +Usage: $APP_NAME [OPTIONS] [--] [EMERGE_OPTIONS] + +Broken reverse dependency rebuilder. + + -C, --nocolor Turn off colored output + -d, --debug Print way too much information (uses bash's set -xv) + -e, --exact Emerge based on exact package version + -h, --help Print this usage + -i, --ignore Ignore temporary files from previous runs + -k, --keep-temp Do not delete temporary files on exit + -L, --library NAME Emerge existing packages that use the library with NAME + --library=NAME NAME can be a full path to the library or a basic + regular expression (man grep) + -l, --no-ld-path Do not set LD_LIBRARY_PATH + -o, --no-order Do not check the build order + (Saves time, but may cause breakage.) + -p, --pretend Do a trial run without actually emerging anything + (also passed to emerge command) + -P, --no-progress Turn off the progress meter + -q, --quiet Be less verbose (also passed to emerge command) + -v, --verbose Be more verbose (also passed to emerge command) + +Calls emerge, options after -- are ignored by $APP_NAME +and passed directly to emerge. + +Report bugs to +EOF +} +## +# Usage: progress i n +# i: current item +# n: total number of items to process +progress() { + if [[ -t 1 ]]; then + progress() { + local curProg=$(( $1 * 100 / $2 )) + (( curProg == OLDPROG )) && return # no change, output nothing + OLDPROG="$curProg" # must be a global variable + (( $1 == $2 )) && local lb=$'\n' + echo -ne '\r \r'"[ $curProg% ] $lb" + } + progress $@ + else # STDOUT is not a tty. Disable progress meter. + progress() { :; } + fi +} +## +# Usage: countdown n +# n: number of seconds to count +countdown() { + local i + for ((i=1; i<$1; i++)); do + echo -ne '\a.' + ((i<$1)) && sleep 1 + done + echo -e '\a.' +} +## +# Replace whitespace with linebreaks, normalize repeated '/' chars, and sort -u +# (If any libs have whitespace in their filenames, someone needs punishment.) +clean_var() { + awk 'BEGIN {RS="[[:space:]]"} + /-\*/ {exit} + /[^[:space:]]/ {gsub(/\/\/+/, "/"); print}' | sort -u +} +## +# Exit and optionally output to sterr +die() { + local status=$1 + shift + eerror "$@" + exit $status +} +## +# What to do when dynamic linking is consistent +clean_exit() { + if [[ ! $KEEP_TEMP ]]; then + rm -f "${FILES[@]}" + if [[ "$WORKING_DIR" != "/var/cache/${APP_NAME}" ]]; then + # Remove the working directory + builtin cd; rmdir "$WORKING_DIR" + fi + fi + echo + einfo "$OK_TEXT... All done. " + exit 0 +} +## +# Get the name of the package that owns a file or list of files given as args. +get_file_owner() { + local IFS=$'\n' + # ${*/%/ } adds a space to the end of each object name to prevent false + # matches, for example /usr/bin/dia matching /usr/bin/dialog (bug #196460). + find -L /var/db/pkg -name CONTENTS -print0 | + xargs -0 grep -Fl "${*/%/ }" | + sed 's:/var/db/pkg/\(.*\)/CONTENTS:\1:' +} +## +# Normalize some EMERGE_OPTIONS +normalize_emerge_opts() { + # Normalize some EMERGE_OPTIONS + EMERGE_OPTIONS=(${EMERGE_OPTIONS[@]/%-p/--pretend}) + EMERGE_OPTIONS=(${EMERGE_OPTIONS[@]/%-f/--fetchonly}) + EMERGE_OPTIONS=(${EMERGE_OPTIONS[@]/%-f/--verbose}) +} +## +# Use the color preference from portage +setup_color() { + # This should still work if NOCOLOR is set by the -C flag or in the user's + # environment. + export NOCOLOR=$(portageq envvar NOCOLOR) + [[ $NOCOLOR = yes || $NOCOLOR = true ]] && export RC_NOCOLOR=yes # HACK! (grr) + . /etc/init.d/functions.sh +} +## +# Die if an argument is missing. +die_if_missing_arg() { + [[ ! $2 || $2 = -* ]] && die 1 "Missing expected argument to $1" +} +## +# Die because an option is not recognized. +die_invalid_option() { + # Can't use eerror and einfo because this gets called before function.sh + # is sourced + echo + echo "Encountered unrecognized option $1." >&2 + echo + echo "$APP_NAME no longer automatically passes unrecognized options to portage." + echo "Separate emerge-only options from revdep-rebuild options with the -- flag." + echo + echo "For example, $APP_NAME -v -- --ask" + echo + echo "See the man page or $APP_NAME -h for more detail." + echo + exit 1 +} +## +# Warn about deprecated options. +warn_deprecated_opt() { + # Can't use eerror and einfo because this gets called before function.sh + # is sourced + echo + echo "Encountered deprecated option $1." >&2 + [[ $2 ]] && echo "Please use $2 instead." >&2 +} +## +# Get whole-word commandline options preceded by two dashes. +get_longopts() { + case $1 in + --nocolor) export NOCOLOR="yes";; + --no-color) warn_deprecated_opt "$1" "--nocolor" + export NOCOLOR="yes";; + --debug) set -xv;; + --exact) unset PACKAGE_NAMES;; + --help) print_usage + exit 0;; + --ignore) RM_OLD_TEMPFILES=1;; + --keep-temp) KEEP_TEMP=1;; + --library=*) # TODO: check for invalid values + SONAME="${1#*=}" + unset SEARCH_BROKEN;; + --soname=*|--soname-regexp=*) # TODO: check for invalid values + warn_deprecated_opt "${1%=*}" "--library" + SONAME="${1#*=}" + unset SEARCH_BROKEN;; + --library) # TODO: check for invalid values + die_if_missing_arg $1 $2 + shift + SONAME="$1" + unset SEARCH_BROKEN;; + --soname|--soname-regexp) # TODO: check for invalid values + warn_deprecated_opt "$1" "--library" + die_if_missing_arg $1 $2 + shift + SONAME="$1" + unset SEARCH_BROKEN;; + --no-ld-path) unset FULL_LD_PATH;; + --no-order) unset ORDER_PKGS;; + --no-progress) progress() { :; };; + --pretend) EMERGE_OPTIONS+=("--pretend");; + --quiet) echo_v() { :; } + progress() { :; } + quiet=1 + EMERGE_OPTIONS+=($1);; + --verbose) VERBOSE=1 + EMERGE_OPTIONS+=("--verbose");; + --extra-verbose) warn_deprecated_opt "$1" "--verbose" + VERBOSE=1 + EMERGE_OPTIONS+=("--verbose");; + --package-names) # No longer used, since it is the + # default. We accept it for + # backwards compatibility. + warn_deprecated_opt "$1" + PACKAGE_NAMES=1;; + *) die_invalid_option $1;; + esac +} + +## +# Get single-letter commandline options preceded by a single dash. +get_shortopts() { + local OPT OPTSTRING OPTARG OPTIND + while getopts ":CdehikL:loPpqu:vX" OPT; do + case "$OPT" in + C) # TODO: Match syntax with the rest of gentoolkit + export NOCOLOR="yes";; + d) set -xv;; + e) unset PACKAGE_NAMES;; + h) print_usage + exit 0;; + i) RM_OLD_TEMPFILES=1;; + k) KEEP_TEMP=1;; + L) # TODO: Check for invalid values + SONAME="${OPTARG#*=}" + unset SEARCH_BROKEN;; + l) unset FULL_LD_PATH;; + o) unset ORDER_PKGS;; + P) progress() { :; };; + p) EMERGE_OPTIONS+=("--pretend");; + q) echo_v() { :; } + progress() { :; } + quiet=1 + EMERGE_OPTIONS+=("--quiet");; + v) VERBOSE=1 + EMERGE_OPTIONS+=("--verbose");; + X) # No longer used, since it is the default. + # We accept it for backwards compatibility. + warn_deprecated_opt "-X" + PACKAGE_NAMES=1;; + *) die_invalid_option "-$OPTARG";; + esac + done +} +## +# Get command-line options. +get_opts() { + local avoid_utils + local -a args + echo_v() { ewarn "$@"; } + unset VERBOSE KEEP_TEMP EMERGE_OPTIONS RM_OLD_TEMPFILES + ORDER_PKGS=1 + PACKAGE_NAMES=1 + SONAME="not found" + SEARCH_BROKEN=1 + FULL_LD_PATH=1 + while [[ $1 ]]; do + case $1 in + --) shift + EMERGE_OPTIONS+=("$@") + break;; + -*) while true; do + args+=("$1") + shift + [[ ${1:--} = -* ]] && break + done + if [[ ${args[0]} = --* ]]; then + get_longopts "${args[@]}" + else + get_shortopts "${args[@]}" + fi;; + *) die_invalid_option "$1";; + esac + unset args + done + + setup_color + normalize_emerge_opts + + # If the user is not super, add --pretend to EMERGE_OPTIONS + if [[ ${EMERGE_OPTIONS[@]} != *--pretend* && $UID -ne 0 ]]; then + ewarn "You are not superuser. Adding --pretend to emerge options." + EMERGE_OPTIONS+=(--pretend) + fi +} +## +# Is there a --pretend or --fetchonly flag in the EMERGE_OPTIONS array? +is_real_merge() { + [[ ${EMERGE_OPTIONS[@]} != *--pretend* && + ${EMERGE_OPTIONS[@]} != *--fetchonly* ]] +} +## +# Clean up temporary files and exit +cleanup_and_die() { + rm -f "$@" + die 1 " ...terminated. Removing incomplete $@." +} +## +# Clean trap +clean_trap() { + trap "cleanup_and_die $*" SIGHUP SIGINT SIGQUIT SIGABRT SIGTERM + rm -f "$@" +} +## +# Returns 0 if the first arg is found in the remaining args, 1 otherwise +# (Returns 2 if given fewer than 2 arguments) +has() { + (( $# > 1 )) || return 2 + local IFS=$'\a' target="$1" + shift + [[ $'\a'"$*"$'\a' = *$'\a'$target$'\a'* ]] +} +## +# Dies when it can't change directories +cd() { + if builtin cd -P "$@"; then + if [[ $1 != $PWD ]]; then + # Some symlink malfeasance is going on + die 1 "Working directory expected to be $1, but it is $PWD" + fi + else + die 1 "Unable to change working directory to '$@'" + fi +} +## +# Tries not to delete any files or directories it shouldn't +setup_rm() { + ## + # Anything in the FILES array in tmpdir is fair game for removal + rm() { + local i IFS=$'\a' + [[ $APP_NAME ]] || die 1 '$APP_NAME is not defined! (This is a bug.)' + case $@ in + */*|*-r*|*-R*) die 1 "Oops, I'm not allowed to delete that. ($@)";; + esac + for i; do + # Don't delete files that are not listed in the array + # Allow no slashes or recursive deletes at all. + case $i in + */*|-*r*|-*R*) :;; # Not OK + -*) continue;; # OK + esac + has "$i" "${FILES[@]}" && continue + die 1 "Oops, I'm not allowed to delete that. ($@)" + done + command rm "$@" + } + # delete this setup function so it's harmless to re-run + setup_rm() { :; } +} +## +# Make our temporary files directory +# $1 - directory name +# $2 - user name +verify_tmpdir() { + umask 007 || die $? "Unable to set umask 007" + if [[ ! $1 ]]; then + die 1 'Temporary file path is unset! (This is a bug.)' + elif [[ -d $1 ]]; then + # HACK: I hate using find this way + if [[ $(find "$1" -type d ! \( -user $2 -perm -0700 \) ) ]]; then + eerror "Incorrect permissions on $1" + eerror "or at least one file in $1." + die 1 "Please make sure it's not a symlink and then remove it." + fi + cd "$1" + else + die 1 "Unable to find a satisfactory location for temporary files ($1)" + fi + [[ $VERBOSE ]] && einfo "Temporary cache files are located in $PWD" + setup_rm +} +get_search_env() { + local new_env + local old_env + local uid=$(python -c 'import os; import pwd; print pwd.getpwuid(os.getuid())[0]') + # Find a place to put temporary files + if [[ "$uid" == "root" ]]; then + local tmp_target="/var/cache/${APP_NAME}" + else + local tmp_target="$(mktemp -d -t revdep-rebuild.XXXXXXXXXX)" + fi + + # From here on all work is done inside the temporary directory + verify_tmpdir "$tmp_target" "$uid" + WORKING_DIR="$tmp_target" + + if [[ $SEARCH_BROKEN ]]; then + SONAME_SEARCH="$SONAME" + HEAD_TEXT="broken by a package update" + OK_TEXT="Dynamic linking on your system is consistent" + WORKING_TEXT="consistency" + else + # first case is needed to test against /path/to/foo.so + if [[ $SONAME = /* ]]; then + # Set to "$SONAME" + SONAME_SEARCH=" $SONAME " + # Escape the "/" characters + SONAME_SEARCH="${SONAME_SEARCH//\//\\/}" + else + # Set to "$SONAME" + SONAME_SEARCH=$'\t'"$SONAME " + fi + HEAD_TEXT="using $SONAME" + OK_TEXT="There are no dynamic links to $SONAME" + unset WORKING_TEXT + fi + + # If any of our temporary files are older than 1 day, remove them all + if [[ ! $KEEP_TEMP ]]; then + while read; do + RM_OLD_TEMPFILES=1 + break + done < <(find -L . -maxdepth 1 -type f -name '*.rr' -mmin +1440 -print 2>/dev/null) + fi + + # Compare old and new environments + # Don't use our previous files if environment doesn't match + new_env=$( + # We do not care if these emerge options change + EMERGE_OPTIONS=(${EMERGE_OPTIONS[@]//--pretend/}) + EMERGE_OPTIONS=(${EMERGE_OPTIONS[@]//--fetchonly/}) + EMERGE_OPTIONS=(${EMERGE_OPTIONS[@]//--verbose/}) + cat <<- EOF + SEARCH_DIRS="$SEARCH_DIRS" + SEARCH_DIRS_MASK="$SEARCH_DIRS_MASK" + LD_LIBRARY_MASK="$LD_LIBRARY_MASK" + PORTAGE_ROOT="$PORTAGE_ROOT" + EMERGE_OPTIONS="${EMERGE_OPTIONS[@]}" + ORDER_PKGS="$ORDER_PKGS" + FULL_LD_PATH="$FULL_LD_PATH" + EOF + ) + if [[ -r "$ENV_FILE" && -s "$ENV_FILE" ]]; then + old_env=$(<"$ENV_FILE") + if [[ $old_env != $new_env ]]; then + ewarn 'Environment mismatch from previous run, deleting temporary files...' + RM_OLD_TEMPFILES=1 + fi + else + # No env file found, silently delete any other tempfiles that may exist + RM_OLD_TEMPFILES=1 + fi + + # If we should remove old tempfiles, do so + if [[ $RM_OLD_TEMPFILES ]]; then + rm -f "${FILES[@]}" + else + for file in "${FILES[@]}"; do + if [ -e "$file" ]; then + chown ${uid}:portage "$file" + chmod 700 "$file" + fi + done + fi + + # Save the environment in a file for next time + echo "$new_env" > "$ENV_FILE" + + [[ $VERBOSE ]] && echo $'\n'"$APP_NAME environment:"$'\n'"$new_env" + + echo + einfo "Checking reverse dependencies" + einfo "Packages containing binaries and libraries $HEAD_TEXT" + einfo "will be emerged." +} + +get_files() { + einfo "Collecting system binaries and libraries" + if [[ -r "$FILES_FILE" && -s "$FILES_FILE" ]]; then + einfo "Found existing $FILES_FILE" + else + # Be safe and remove any extraneous temporary files + # Don't remove 0_env.rr - The first file in the array + rm -f "${FILES[@]:1}" + + clean_trap "$FILES_FILE" + + if [[ $SEARCH_DIRS_MASK ]]; then + findMask=($SEARCH_DIRS_MASK) + findMask="${findMask[@]/#/-o -path }" + findMask="( ${findMask#-o } ) -prune -o" + fi + # TODO: Check this + find ${SEARCH_DIRS[@]} $findMask -type f \( -executable -o \ + -name '*.so' -o -name '*.so.*' -o -name '*.la' \) -print 2> /dev/null | + sort -u > "$FILES_FILE" || + die $? "find failed to list binary files (This is a bug.)" + einfo "Generated new $FILES_FILE" + fi +} +get_ldpath() { + local COMPLETE_LD_LIBRARY_PATH + [[ $SEARCH_BROKEN && $FULL_LD_PATH ]] || return + einfo 'Collecting complete LD_LIBRARY_PATH' + if [[ -r "$LDPATH_FILE" && -s "$LDPATH_FILE" ]]; then + einfo "Found existing $LDPATH_FILE." + else + clean_trap "$LDPATH_FILE" + # Ensure that the "trusted" lib directories are at the start of the path + COMPLETE_LD_LIBRARY_PATH=( + /lib* + /usr/lib* + $(sed '/^#/d;s/#.*$//' < /etc/ld.so.conf) + $(sed 's:/[^/]*$::' < "$FILES_FILE" | sort -ru) + ) + IFS=':' + COMPLETE_LD_LIBRARY_PATH="${COMPLETE_LD_LIBRARY_PATH[*]}" + IFS="$OIFS" + echo "$COMPLETE_LD_LIBRARY_PATH" > "$LDPATH_FILE" + einfo "Generated new $LDPATH_FILE" + fi +} +main_checks() { + local target_file + local -a files + local i=0 + local ldd_output + local ldd_status + local numFiles + local COMPLETE_LD_LIBRARY_PATH + if [[ $SEARCH_BROKEN && $FULL_LD_PATH ]]; then + [[ -r "$LDPATH_FILE" && -s "$LDPATH_FILE" ]] || + die 1 "Unable to find $LDPATH_FILE" + COMPLETE_LD_LIBRARY_PATH=$(<"$LDPATH_FILE") + fi + einfo "Checking dynamic linking $WORKING_TEXT" + if [[ -r "$BROKEN_FILE" && -s "$BROKEN_FILE" ]]; then + einfo "Found existing $BROKEN_FILE." + else + clean_trap "$BROKEN_FILE" "$ERRORS_FILE" + files=($(<"$FILES_FILE")) + numFiles="${#files[@]}" + for target_file in "${files[@]}"; do + if [[ $target_file != *.la ]]; then + # Note: double checking seems to be faster than single with complete path + # (special add ons are rare). + ldd_output=$(ldd "$target_file" 2>> "$ERRORS_FILE" | sort -u) + ldd_status=$? # TODO: Check this for problems with sort + # HACK: if LD_LIBRARY_MASK is null or undefined grep -vF doesn't work + if grep -vF "${LD_LIBRARY_MASK:=$'\a'}" <<< "$ldd_output" | + grep -q "$SONAME_SEARCH"; then + if [[ $SEARCH_BROKEN && $FULL_LD_PATH ]]; then + if LD_LIBRARY_PATH="$COMPLETE_LD_LIBRARY_PATH" ldd "$target_file" 2>/dev/null | + grep -vF "$LD_LIBRARY_MASK" | grep -q "$SONAME_SEARCH"; then + # FIXME: I hate duplicating code + # Only build missing direct dependencies + MISSING_LIBS=$( + expr='s/[[:space:]]*\([^[:space:]]*\) => not found/\1/p' + sed -n "$expr" <<< "$ldd_output" + ) + REQUIRED_LIBS=$( + expr='s/^[[:space:]]*NEEDED[[:space:]]*\([^[:space:]]*\).*/\1/p'; + objdump -x "$target_file" | grep NEEDED | sed "$expr" | sort -u + ) + MISSING_LIBS=$(grep -F "$REQUIRED_LIBS" <<< "$MISSING_LIBS") + if [[ $MISSING_LIBS ]]; then + echo "obj $target_file" >> "$BROKEN_FILE" + echo_v " broken $target_file (requires $MISSING_LIBS)" + fi + fi + else + # FIXME: I hate duplicating code + # Only rebuild for direct dependencies + MISSING_LIBS=$( + expr="/$SONAME_SEARCH/s/^[[:space:]]*\([^[:space:]]*\).*$/\1/p" + sort -u <<< "$ldd_output" | sed -n "$expr" + ) + REQUIRED_LIBS=$( + expr='s/^[[:space:]]*NEEDED[[:space:]]*\([^[:space:]]*\).*/\1/p'; + objdump -x "$target_file" | grep NEEDED | sed "$expr" | sort -u + ) + MISSING_LIBS=$(grep -F "$REQUIRED_LIBS" <<< "$MISSING_LIBS") + if [[ $MISSING_LIBS ]]; then + echo "obj $target_file" >> "$BROKEN_FILE" + if [[ $SEARCH_BROKEN ]]; then + echo_v " broken $target_file (requires $MISSING_LIBS)" + else + echo_v " found $target_file" + fi + fi + fi + fi + elif [[ $SEARCH_BROKEN ]]; then + # Look for broken .la files + for depend in $( + awk -F"[=']" '/^dependency_libs/{ + gsub("^-[^[:space:]]*", "", $3); + gsub("[[:space:]]-[^[:space:]]*", "", $3); + print $3 + }' "$target_file" + ); do + if [[ $depend = /* && ! -e $depend ]]; then + echo "obj $target_file" >> "$BROKEN_FILE" + echo_v " broken $target_file (requires $depend)" + fi + done + fi + [[ $VERBOSE ]] && + progress $((++i)) $numFiles $target_file || + progress $((++i)) $numFiles + done + if [[ $SEARCH_BROKEN ]]; then + # Look for missing version + while read target_file; do + echo "obj $target_file" >> "$BROKEN_FILE" + echo_v " broken $target_file (no version information available)" + done < <( + # Regexify LD_LIBRARY_MASK. Exclude it from the search. + LD_LIBRARY_MASK="${LD_LIBRARY_MASK//$'\n'/|}" + awk -v ldmask="(${LD_LIBRARY_MASK//./\\\.})" ' + /no version information available/ && $0 !~ ldmask { + gsub(/[()]/, "", $NF) + if (seen[$NF]++) next + print $NF + }' "$ERRORS_FILE" + ) + fi + [[ -r "$BROKEN_FILE" && -s "$BROKEN_FILE" ]] || clean_exit + sort -u "$BROKEN_FILE" -o "$BROKEN_FILE" + einfo "Generated new $BROKEN_FILE" + fi +} +get_packages() { + local target_file + local EXACT_PKG + local PKG + local obj + einfo 'Assigning files to packages' + if [[ -r "$RAW_FILE" && -s "$RAW_FILE" ]]; then + einfo "Found existing $RAW_FILE" + else + clean_trap "$RAW_FILE" "$OWNERS_FILE" + while read obj target_file; do + EXACT_PKG=$(get_file_owner $target_file) + if [[ $EXACT_PKG ]]; then + # Strip version information + PKG="${EXACT_PKG%%-r[[:digit:]]*}" + PKG="${PKG%-*}" + echo "$EXACT_PKG" >> "$RAW_FILE" + echo "$target_file -> $EXACT_PKG" >> "$OWNERS_FILE" + echo_v " $target_file -> $PKG" + else + ewarn " !!! $target_file not owned by any package is broken !!!" + echo "$target_file -> (none)" >> "$OWNERS_FILE" + echo_v " $target_file -> (none)" + fi + done < "$BROKEN_FILE" + einfo "Generated new $RAW_FILE and $OWNERS_FILE" + fi + # if we find '(none)' on every line, exit out + if ! grep -qvF '(none)' "$OWNERS_FILE"; then + ewarn "Found some broken files, but none of them were associated with known packages" + ewarn "Unable to proceed with automatic repairs." + ewarn "The broken files are listed in $OWNERS_FILE" + if [[ $VERBOSE ]]; then + ewarn "The broken files are:" + while read filename junk; do + ewarn " $filename" + done < "$OWNERS_FILE" + fi + exit 0 # FIXME: Should we exit 1 here? + fi +} +clean_packages() { + einfo 'Cleaning list of packages to rebuild' + if [[ -r "$PKGS_FILE" && -s "$PKGS_FILE" ]]; then + einfo "Found existing $PKGS_FILE" + else + sort -u "$RAW_FILE" > "$PKGS_FILE" + einfo "Generated new $PKGS_FILE" + fi +} +assign_packages_to_ebuilds() { + local EXACT_PKG + local PKG + local SLOT + einfo 'Assigning packages to ebuilds' + if [[ -r "$EBUILDS_FILE" && -s "$EBUILDS_FILE" ]]; then + einfo "Found existing $EBUILDS_FILE" + elif [[ -r "$PKGS_FILE" && -s "$PKGS_FILE" ]]; then + clean_trap "$EBUILDS_FILE" + while read EXACT_PKG; do + # Get the slot + PKG="${EXACT_PKG%%-r[[:digit:]]*}" + PKG="${PKG%-*}" + SLOT=$( "$EBUILDS_FILE" + einfo "Generated new $EBUILDS_FILE" + else + einfo 'Nothing to rebuild.' + die 1 '(The program should have already quit, so this is a minor bug.)' + fi +} +get_exact_ebuilds() { + einfo 'Assigning files to ebuilds' + if [[ -r $EBUILDS_FILE && -s $EBUILDS_FILE ]]; then + einfo "Found existing $EBUILDS_FILE" + elif [[ -r $BROKEN_FILE && -s $BROKEN_FILE ]]; then + rebuildList=" $(<"$BROKEN_FILE") " + rebuildList=(${rebuildList//[[:space:]]obj[[:space:]]/ }) + get_file_owner "${rebuildList[@]}" | sed 's/^/=/' > "$EBUILDS_FILE" + einfo "Generated new $EBUILDS_FILE" + else + einfo 'Nothing to rebuild.' + die 1 '(The program should have already quit, so this is a minor bug.)' + fi +} +list_skipped_packages() { + ewarn + ewarn 'Portage could not find any version of the following packages it could build:' + ewarn "${SKIP_LIST[@]}" + ewarn + ewarn '(Perhaps they are masked, blocked, or removed from portage.)' + ewarn 'Try to emerge them manually.' + ewarn +} +get_build_order() { + local -r OLD_EMERGE_DEFAULT_OPTS="$EMERGE_DEFAULT_OPTS" + local RAW_REBUILD_LIST + local REBUILD_GREP + local i + if [[ ! $ORDER_PKGS ]]; then + einfo 'Skipping package ordering' + return + fi + einfo 'Evaluating package order' + if [[ -r "$ORDER_FILE" && -s "$ORDER_FILE" ]]; then + einfo "Found existing $ORDER_FILE" + else + clean_trap "$ORDER_FILE" + RAW_REBUILD_LIST=$(<"$EBUILDS_FILE") + if [[ $RAW_REBUILD_LIST ]]; then + export EMERGE_DEFAULT_OPTS="--nospinner --pretend --oneshot --quiet" + RAW_REBUILD_LIST=($RAW_REBUILD_LIST) # convert into array + # If PACKAGE_NAMES is defined we're using slots, not versions + if [[ $PACKAGE_NAMES ]]; then + # Eliminate atoms that can't be built + for i in "${!RAW_REBUILD_LIST[@]}"; do + if [[ "${RAW_REBUILD_LIST[i]}" = *[A-Za-z]* ]]; then + portageq best_visible "$PORTAGE_ROOT" "${RAW_REBUILD_LIST[i]}" >/dev/null && continue + SKIP_LIST+=("${RAW_REBUILD_LIST[i]}") + fi + unset RAW_REBUILD_LIST[i] + done + # If RAW_REBUILD_LIST is empty, then we have nothing to build. + if (( ${#RAW_REBUILD_LIST[@]} == 0 )); then + if (( ${#SKIP_LIST[@]} == 0 )); then + ewarn "The list of packages to skip is empty, but there are no" + ewarn "packages listed to rebuild either. (This is a bug.)" + else + list_skipped_packages + fi + die 1 'Warning: Portage cannot rebuild any of the necessary packages.' + fi + fi + RAW_REBUILD_LIST="${RAW_REBUILD_LIST[@]}" + REBUILD_GREP=$(emerge --nodeps $RAW_REBUILD_LIST | sed 's/\[[^]]*\]//g') + if (( ${PIPESTATUS[0]} == 0 )); then + emerge --deep $RAW_REBUILD_LIST | + sed 's/\[[^]]*\]//g' | + grep -F "$REBUILD_GREP" > "$ORDER_FILE" + fi + + # Here we use the PIPESTATUS from the second emerge, the --deep one. + if (( ${PIPESTATUS[0]} != 0 )); then + eerror + eerror 'Warning: Failed to resolve package order.' + eerror 'Will merge in arbitrary order' + eerror + cat <<- EOF + Possible reasons: + - An ebuild is no longer in the portage tree. + - An ebuild is masked, use /etc/portage/packages.keyword + and/or /etc/portage/package.unmask to unmask it + EOF + countdown 5 + rm -f "$ORDER_FILE" + fi + export EMERGE_DEFAULT_OPTS="$OLD_EMERGE_DEFAULT_OPTS" + else + einfo 'Nothing to rebuild.' + die 1 '(The program should have already quit, so this is a minor bug.)' + fi + fi + [[ -r "$ORDER_FILE" && -s "$ORDER_FILE" ]] && einfo "Generated new $ORDER_FILE" +} + +show_unowned_files() { + if grep -qF '(none)' "$OWNERS_FILE"; then + ewarn "Found some broken files that weren't associated with known packages" + ewarn "The broken files are:" + while read filename junk; do + [[ $junk = *none* ]] && ewarn " $filename" + done < "$OWNERS_FILE" | awk '!s[$0]++' # (omit dupes) + fi +} +## +# Setup portage and the search paths +setup_portage() { + local PORTAGE_NICENESS=$(portageq envvar PORTAGE_NICENESS) + PORTAGE_ROOT=$(portageq envvar ROOT) + + # Obey PORTAGE_NICENESS + if [[ $PORTAGE_NICENESS ]]; then + renice $PORTAGE_NICENESS $$ > /dev/null + # Since we have already set our nice value for our processes, + # reset PORTAGE_NICENESS to zero to avoid having emerge renice again. + export PORTAGE_NICENESS="0" + fi + + PORTAGE_ROOT="${PORTAGE_ROOT:-/}" +} + +## +# Setup the paths to search (and filter the ones to avoid) +setup_search_paths_and_masks() { + local configfile sdir mdir skip_me filter_SEARCH_DIRS + + einfo "Configuring search environment for $APP_NAME" + + # Update the incremental variables using /etc/profile.env, /etc/ld.so.conf, + # portage, and the environment + + # Read the incremental variables from environment and portage + # Until such time as portage supports these variables as incrementals + # The value will be what is in /etc/make.conf + SEARCH_DIRS+=" "$(unset SEARCH_DIRS; portageq envvar SEARCH_DIRS) + SEARCH_DIRS_MASK+=" "$(unset SEARCH_DIRS_MASK; portageq envvar SEARCH_DIRS_MASK) + LD_LIBRARY_MASK+=" "$(unset LD_LIBRARY_MASK; portageq envvar LD_LIBRARY_MASK) + + # Add the defaults + if [[ -d /etc/revdep-rebuild ]]; then + for configfile in /etc/revdep-rebuild/*; do + SEARCH_DIRS+=" "$(. $configfile; echo $SEARCH_DIRS) + SEARCH_DIRS_MASK+=" "$(. $configfile; echo $SEARCH_DIRS_MASK) + LD_LIBRARY_MASK+=" "$(. $configfile; echo $LD_LIBRARY_MASK) + done + else + SEARCH_DIRS+=" /bin /sbin /usr/bin /usr/sbin /lib* /usr/lib*" + SEARCH_DIRS_MASK+=" /opt/OpenOffice /usr/lib/openoffice" + LD_LIBRARY_MASK+=" libodbcinst.so libodbc.so libjava.so libjvm.so" + fi + + # Get the ROOTPATH and PATH from /etc/profile.env + if [[ -r "/etc/profile.env" && -s "/etc/profile.env" ]]; then + SEARCH_DIRS+=" "$(. /etc/profile.env; /usr/bin/tr ':' ' ' <<< "$ROOTPATH $PATH") + fi + + # Get the directories from /etc/ld.so.conf + if [[ -r /etc/ld.so.conf && -s /etc/ld.so.conf ]]; then + SEARCH_DIRS+=" "$(sed '/^#/d;s/#.*$//' /etc/ld.so.conf) + fi + + # Set the final variables + SEARCH_DIRS=$(clean_var <<< "$SEARCH_DIRS") + SEARCH_DIRS_MASK=$(clean_var <<< "$SEARCH_DIRS_MASK") + LD_LIBRARY_MASK=$(clean_var <<< "$LD_LIBRARY_MASK") + # Filter masked paths from SEARCH_DIRS + for sdir in ${SEARCH_DIRS} ; do + skip_me= + for mdir in ${SEARCH_DIRS_MASK}; do + [[ ${sdir} == ${mdir}/* ]] && skip_me=1 && break + done + [[ -n ${skip_me} ]] || filter_SEARCH_DIRS+=" ${sdir}" + done + SEARCH_DIRS=$(clean_var <<< "${filter_SEARCH_DIRS}") + [[ $SEARCH_DIRS ]] || die 1 "No search defined -- this is a bug." +} +## +# Rebuild packages owning broken binaries +rebuild() { + if [[ -r $LIST.5_order && -s $LIST.5_order ]]; then + REBUILD_LIST=( $(<"$LIST.5_order") ) + REBUILD_LIST="${REBUILD_LIST[@]/#/=}" + else + REBUILD_LIST=$(sort -u "$EBUILDS_FILE") + fi + + trap - SIGHUP SIGINT SIGQUIT SIGABRT SIGTERM + + einfo 'All prepared. Starting rebuild' + echo "emerge --oneshot ${EMERGE_OPTIONS[@]} $REBUILD_LIST" + + is_real_merge && countdown 10 + + # Link file descriptor #6 with stdin so --ask will work + exec 6<&0 + + # Run in background to correctly handle Ctrl-C + { + EMERGE_DEFAULT_OPTS="--oneshot ${EMERGE_OPTIONS[@]}" emerge $REBUILD_LIST <&6 + echo $? > "$STATUS_FILE" + } & + wait + + # Now restore stdin from fd #6, where it had been saved, and close fd #6 ( 6<&- ) to free it for other processes to use. + exec 0<&6 6<&- +} +## +# Finish up +cleanup() { + if (( $(<"$STATUS_FILE") != 0 )); then + ewarn + ewarn "$APP_NAME failed to emerge all packages." + ewarn 'you have the following choices:' + einfo "- If emerge failed during the build, fix the problems and re-run $APP_NAME." + einfo '- Use /etc/portage/package.keywords to unmask a newer version of the package.' + einfo " (and remove $ORDER_FILE to be evaluated again)" + einfo '- Modify the above emerge command and run it manually.' + einfo '- Compile or unmerge unsatisfied packages manually,' + einfo ' remove temporary files, and try again.' + einfo ' (you can edit package/ebuild list first)' + einfo + einfo 'To remove temporary files, please run:' + einfo "rm ${WORKING_DIR}/*.rr" + show_unowned_files + exit $EMERGE_STATUS + elif is_real_merge; then + trap_cmd() { + eerror "terminated. Please remove the temporary files manually:" + eerror "rm ${WORKING_DIR}/*.rr" + exit 1 + } + [[ "${SKIP_LIST[@]}" != "" ]] && list_skipped_packages + trap trap_cmd SIGHUP SIGINT SIGQUIT SIGABRT SIGTERM + einfo 'Build finished correctly. Removing temporary files...' + einfo + einfo 'You can re-run revdep-rebuild to verify that all libraries and binaries' + einfo 'are fixed. If some inconsistency remains, it can be orphaned file, deep' + einfo 'dependency, binary package or specially evaluated library.' + if [[ -r "$OWNERS_FILE" && -s "$OWNERS_FILE" ]]; then + show_unowned_files + fi + [[ $KEEP_TEMP ]] || rm "${FILES[@]}" + else + einfo 'Now you can remove -p (or --pretend) from arguments and re-run revdep-rebuild.' + fi +} + +main "$@" diff --git a/src/revdep-rebuild/revdep-rebuild-old b/src/revdep-rebuild/revdep-rebuild-old new file mode 100755 index 0000000..52d6d19 --- /dev/null +++ b/src/revdep-rebuild/revdep-rebuild-old @@ -0,0 +1,720 @@ +#!/bin/bash +# Copyright 1999-2007 Gentoo Foundation +# $Header$ + +# revdep-rebuild: Reverse dependency rebuilder. +# Original Author: Stanislav Brabec +# Current Maintainer: Paul Varner + +# Known problems: +# +# In exact ebuild mode revdep-rebuild can fail to properly order packages, +# which are not up to date. +# http://bugs.gentoo.org/show_bug.cgi?id=23018 +# +# Rebuilding using --package-names mode should be default, but emerge has no +# feature to update to latest version of defined SLOT. +# http://bugs.gentoo.org/show_bug.cgi?id=4698 + +# Customizable variables: +# +# LD_LIBRARY_MASK - Mask of specially evaluated libraries +# SEARCH_DIRS - List of directories to search for executables and libraries +# SEARCH_DIRS_MASK - List of directories to not search +# +# These variables can be prepended to either by setting the variable in +# your environment prior to execution, or by placing an entry in +# /etc/make.conf. +# +# An entry of "-*" means to clear the variable from that point forward. +# Example: env SEARCH_DIRS="/usr/bin -*" revdep-rebuild will set SEARCH_DIRS +# to contain only /usr/bin + +if [ "$1" = "-h" -o "$1" = "--help" ] +then + echo "Usage: $0 [OPTIONS] [--] [EMERGE_OPTIONS]" + echo + echo "Broken reverse dependency rebuilder." + echo + echo " -X, --package-names Emerge based on package names, not exact versions" + echo " --library NAME Emerge existing packages that use the library with NAME" + echo " --library=NAME NAME can be a full path to the library or a basic" + echo " regular expression (man grep)" + echo " -np, --no-ld-path Do not set LD_LIBRARY_PATH" + echo " -nc, --nocolor Turn off colored output" + echo " -i, --ignore Ignore temporary files from previous runs" + echo " -q, --quiet Be less verbose (also passed to emerge command)" + echo " -vv, --extra-verbose Be extra verbose" + echo + echo "Calls emerge, all other options are used for it (e. g. -p, --pretend)." + echo + echo "Report bugs to " + exit 0 +fi + +echo "Configuring search environment for revdep-rebuild" + +# Obey PORTAGE_NICENESS +PORTAGE_NICENESS=$(portageq envvar PORTAGE_NICENESS) +if [ ! -z "$PORTAGE_NICENESS" ] +then + renice $PORTAGE_NICENESS $$ > /dev/null + # Since we have already set our nice value for our processes, + # reset PORTAGE_NICENESS to zero to avoid having emerge renice again. + export PORTAGE_NICENESS="0" +fi + +PORTAGE_ROOT=$(portageq envvar ROOT) +[ -z "$PORTAGE_ROOT" ] && PORTAGE_ROOT="/" + +# Update the incremental variables using /etc/profile.env, /etc/ld.so.conf, +# portage, and the environment + +# Read the incremental variables from environment and portage +# Until such time as portage supports these variables as incrementals +# The value will be what is in /etc/make.conf +PRELIMINARY_SEARCH_DIRS="$SEARCH_DIRS $(unset SEARCH_DIRS; portageq envvar SEARCH_DIRS)" +PRELIMINARY_SEARCH_DIRS_MASK="$SEARCH_DIRS_MASK $(unset SEARCH_DIRS_MASK; portageq envvar SEARCH_DIRS_MASK)" +PRELIMINARY_LD_LIBRARY_MASK="$LD_LIBRARY_MASK $(unset LD_LIBRARY_MASK; portageq envvar LD_LIBRARY_MASK)" + +# Add the defaults +if [ -d /etc/revdep-rebuild ] +then + for file in $(ls /etc/revdep-rebuild) + do + PRELIMINARY_SEARCH_DIRS="$PRELIMINARY_SEARCH_DIRS $(. /etc/revdep-rebuild/${file}; echo $SEARCH_DIRS)" + PRELIMINARY_SEARCH_DIRS_MASK="$PRELIMINARY_SEARCH_DIRS_MASK $(. /etc/revdep-rebuild/${file}; echo $SEARCH_DIRS_MASK)" + PRELIMINARY_LD_LIBRARY_MASK="$PRELIMINARY_LD_LIBRARY_MASK $(. /etc/revdep-rebuild/${file}; echo $LD_LIBRARY_MASK)" + done +else + PRELIMINARY_SEARCH_DIRS="$PRELIMINARY_SEARCH_DIRS /bin /sbin /usr/bin /usr/sbin /lib* /usr/lib*" + PRELIMINARY_SEARCH_DIRS_MASK="$PRELIMINARY_SEARCH_DIRS_MASK /opt/OpenOffice /usr/lib/openoffice" + PRELIMINARY_LD_LIBRARY_MASK="$PRELIMINARY_LD_LIBRARY_MASK libodbcinst.so libodbc.so libjava.so libjvm.so" +fi + +# Get the ROOTPATH and PATH from /etc/profile.env +if [ -e "/etc/profile.env" ] +then + PRELIMINARY_SEARCH_DIRS="$PRELIMINARY_SEARCH_DIRS $((. /etc/profile.env; echo ${ROOTPATH}:${PATH}) | tr ':' ' ')" +fi + +# Get the directories from /etc/ld.so.conf +if [ -e /etc/ld.so.conf ] +then + PRELIMINARY_SEARCH_DIRS="$PRELIMINARY_SEARCH_DIRS $(grep -v "^#" /etc/ld.so.conf | tr '\n' ' ')" +fi + +# Set the final variables +# Note: Using $(echo $variable) removes extraneous spaces from variable assignment +unset SEARCH_DIRS +for i in $(echo $PRELIMINARY_SEARCH_DIRS) +do + [ "$i" = "-*" ] && break + # Append a / at the end so that links and directories are treated the same by find + # Remove any existing trailing slashes to prevent double-slashes + SEARCH_DIRS="$(echo $SEARCH_DIRS ${i/%\//}/)" +done +# Remove any double-slashes from the path +SEARCH_DIRS="$(echo $SEARCH_DIRS | sed 's:/\+:/:g')" + +unset SEARCH_DIRS_MASK +for i in $(echo $PRELIMINARY_SEARCH_DIRS_MASK) +do + [ "$i" = "-*" ] && break + SEARCH_DIRS_MASK="$(echo $SEARCH_DIRS_MASK $i)" +done + +unset LD_LIBRARY_MASK +for i in $(echo $PRELIMINARY_LD_LIBRARY_MASK) +do + [ "$i" = "-*" ] && break + LD_LIBRARY_MASK="$(echo $LD_LIBRARY_MASK $i)" +done + +# Use the color preference from portage +NOCOLOR=$(portageq envvar NOCOLOR) + +# Base of temporary files names. +touch ${HOME}/.revdep-rebuild_0.test 2>/dev/null +if [ $? -eq 0 ] +then + LIST="${HOME}/.revdep-rebuild" + rm ~/.revdep-rebuild_0.test +else + # Try to use /var/tmp since $HOME is not available + touch /var/tmp/.revdep-rebuild_0.test 2>/dev/null + if [ $? -eq 0 ] + then + LIST="/var/tmp/.revdep-rebuild" + rm /var/tmp/.revdep-rebuild_0.test + else + echo + echo "!!! Unable to write temporary files to either $HOME or /var/tmp !!!" + echo + exit 1 + fi +fi + +shopt -s nullglob +shopt -s expand_aliases +unalias -a + +# Color Definitions +NO="\x1b[0m" +BR="\x1b[0;01m" +CY="\x1b[36;01m" +GR="\x1b[32;01m" +RD="\x1b[31;01m" +YL="\x1b[33;01m" +BL="\x1b[34;01m" + +# Check if portage-utils are installed +portageq has_version $PORTAGE_ROOT portage-utils +if [ "$?" -eq 0 ] +then + PORTAGE_UTILS=true +else + PORTAGE_UTILS=false +fi + +alias echo_v=echo + +PACKAGE_NAMES=false +SONAME="not found" +SONAME_GREP=grep +SEARCH_BROKEN=true +EXTRA_VERBOSE=false +KEEP_TEMP=false +FULL_LD_PATH=true + +EMERGE_OPTIONS="" +PRELIMINARY_CALLED_OPTIONS="" +while [ ! -z "$1" ] ; do + case "$1" in + -X | --package-names ) + PACKAGE_NAMES=true + PRELIMINARY_CALLED_OPTIONS="${PRELIMINARY_CALLED_OPTIONS} --package_names" + shift + ;; + -q | --quiet ) + alias echo_v=: + EMERGE_OPTIONS="${EMERGE_OPTIONS} $1" + shift + ;; + --library=* | --soname=* | --soname-regexp=* ) + SONAME="${1#*=}" + SEARCH_BROKEN=false + PRELIMINARY_CALLED_OPTIONS="${PRELIMINARY_CALLED_OPTIONS} --library=${SONAME}" + shift + ;; + --library | --soname | --soname-regexp ) + SONAME="$2" + SEARCH_BROKEN=false + PRELIMINARY_CALLED_OPTIONS="${PRELIMINARY_CALLED_OPTIONS} --library=${SONAME}" + shift 2 + ;; + -nc | --no-color | --nocolor ) + NOCOLOR=true + shift + ;; + -np | --no-ld-path ) + FULL_LD_PATH=false + PRELIMINARY_CALLED_OPTIONS="${PRELIMINARY_CALLED_OPTIONS} --no-ld-path" + shift + ;; + -i | --ignore ) + rm -f ${LIST}* + shift + ;; + --keep-temp ) + KEEPTEMP=true + shift + ;; + -vv | --extra-verbose ) + EXTRA_VERBOSE=true + shift + ;; + -- ) + shift + ;; + * ) + EMERGE_OPTIONS="${EMERGE_OPTIONS} $1" + shift + ;; + esac +done + +EMERGE_OPTIONS=$(echo $EMERGE_OPTIONS | sed 's/^ //') + +if [ -z "$PRELIMINARY_CALLED_OPTIONS" ] +then + CALLED_OPTIONS="" +else + for i in $(echo $PRELIMINARY_CALLED_OPTIONS | tr ' ' '\n'| sort) + do + CALLED_OPTIONS="$(echo $CALLED_OPTIONS $i)" + done +fi + +if [ "$NOCOLOR" = "yes" -o "$NOCOLOR" = "true" ] +then + NOCOLOR=true +else + NOCOLOR=false +fi + +# Make the NOCOLOR variable visible to emerge +export NOCOLOR + +if $NOCOLOR +then + NO="" + BR="" + CY="" + GR="" + RD="" + YL="" + BL="" +fi + +function set_trap () { + trap "rm_temp $1" SIGHUP SIGINT SIGQUIT SIGABRT SIGTERM +} + +function rm_temp () { + echo " terminated." + echo "Removing incomplete $1." + rm $1 + echo + exit 1 +} + +if $SEARCH_BROKEN ; then + SONAME_SEARCH="$SONAME" + LLIST=$LIST + HEAD_TEXT="broken by a package update" + OK_TEXT="Dynamic linking on your system is consistent" + WORKING_TEXT=" consistency" +else + # first case is needed to test against /path/to/foo.so + if [ ${SONAME:0:1} == '/' ] ; then + # Set to "$SONAME" + SONAME_SEARCH=" $SONAME " + else + # Set to "$SONAME" + SONAME_SEARCH=" $SONAME " + fi + LLIST=${LIST}_$(echo "$SONAME_SEARCH$SONAME" | md5sum | head -c 8) + HEAD_TEXT="using $SONAME" + OK_TEXT="There are no dynamic links to $SONAME" + WORKING_TEXT="" +fi + +# If any of our temporary files are older than 1 day, remove them all +[ "$(find "${LIST%/*}/." ! -name . -prune -name "${LIST##*/}*" -type f -mmin +1440)" != "" ] && rm -f ${LIST}* + +# Don't use our previous files if environment doesn't match +if [ -f $LIST.0_env ] +then + PREVIOUS_SEARCH_DIRS=$(. ${LIST}.0_env; echo "$SEARCH_DIRS") + PREVIOUS_SEARCH_DIRS_MASK=$(. ${LIST}.0_env; echo "$SEARCH_DIRS_MASK") + PREVIOUS_LD_LIBRARY_MASK=$(. ${LIST}.0_env; echo "$LD_LIBRARY_MASK") + PREVIOUS_PORTAGE_ROOT=$(. ${LIST}.0_env; echo "$PORTAGE_ROOT") + PREVIOUS_OPTIONS=$(. ${LIST}.0_env; echo "$CALLED_OPTIONS") + if [ "$PREVIOUS_SEARCH_DIRS" != "$SEARCH_DIRS" ] || \ + [ "$PREVIOUS_SEARCH_DIRS_MASK" != "$SEARCH_DIRS_MASK" ] || \ + [ "$PREVIOUS_LD_LIBRARY_MASK" != "$LD_LIBRARY_MASK" ] || \ + [ "$PREVIOUS_PORTAGE_ROOT" != "$PORTAGE_ROOT" ] || \ + [ "$PREVIOUS_OPTIONS" != "$CALLED_OPTIONS" ] + then + echo + echo "Environment mismatch from previous run, deleting temporary files..." + rm -f ${LIST}* + fi +fi + +# Clean up no longer needed environment variables +unset PREVIOUS_SEARCH_DIRS PREVIOUS_SEARCH_DIRS_MASK PREVIOUS_LD_LIBRARY_MASK PREVIOUS_PORTAGE_ROOT PREVIOUS_OPTIONS +unset PRELIMINARY_SEARCH_DIRS PRELIMINARY_SEARCH_DIRS_MASK PRELIMINARY_LD_LIBRARY_MASK PRELIMINARY_CALLED_OPTIONS + +# Log our environment +echo "SEARCH_DIRS=\"$SEARCH_DIRS\"" > $LIST.0_env +echo "SEARCH_DIRS_MASK=\"$SEARCH_DIRS_MASK\"" >> $LIST.0_env +echo "LD_LIBRARY_MASK=\"$LD_LIBRARY_MASK\"" >> $LIST.0_env +echo "PORTAGE_ROOT=\"$PORTAGE_ROOT\"" >> $LIST.0_env +echo "CALLED_OPTIONS=\"$CALLED_OPTIONS\"" >> $LIST.0_env +echo "EMERGE_OPTIONS=\"$EMERGE_OPTIONS\"" >> $LIST.0_env + +if $EXTRA_VERBOSE +then + echo + echo "revdep-rebuild environment:" + cat $LIST.0_env +fi + +echo +echo "Checking reverse dependencies..." +echo +echo "Packages containing binaries and libraries $HEAD_TEXT" +echo "will be emerged." + +echo +echo -n -e "${GR}Collecting system binaries and libraries...${NO}" + +if [ -f $LIST.1_files ] +then + echo " using existing $LIST.1_files." +else + # Be safe and remove any extraneous temporary files + rm -f ${LIST}.[1-9]_* + + set_trap "$LIST.1_*" + + # Hack for the different versions of find. + # Be extra paranoid and pipe results through sed to remove multiple slashes + find_results=$(find /usr/bin/revdep-rebuild -type f -perm /u+x 2>/dev/null) + if [ -z $find_results ] + then + find_results=$(find /usr/bin/revdep-rebuild -type f -perm +u+x 2>/dev/null) + if [ -z $find_results ] + then + echo -e "\n" + echo -e "${RD}Unable to determine how to use find to locate executable files${NO}" + echo -e "${RD}Open a bug at http://bugs.gentoo.org${NO}" + echo + exit 1 + else + # using -perm +u+x for find command + find $SEARCH_DIRS -type f \( -perm +u+x -o -name '*.so' -o -name '*.so.*' -o -name '*.la' \) 2>/dev/null | sort | uniq | sed 's:/\+:/:g' >$LIST.0_files + fi + else + # using -perm /u+x for find command + find $SEARCH_DIRS -type f \( -perm /u+x -o -name '*.so' -o -name '*.so.*' -o -name '*.la' \) 2>/dev/null | sort | uniq | sed 's:/\+:/:g' >$LIST.0_files + fi + + # Remove files that match SEARCH_DIR_MASK + for dir in $SEARCH_DIRS_MASK + do + grep -v "^$dir" $LIST.0_files > $LIST.1_files + mv $LIST.1_files $LIST.0_files + done + + mv $LIST.0_files $LIST.1_files + echo -e " done.\n ($LIST.1_files)" +fi + +if $SEARCH_BROKEN && $FULL_LD_PATH ; then + echo + echo -n -e "${GR}Collecting complete LD_LIBRARY_PATH...${NO}" + if [ -f $LIST.2_ldpath ] ; then + echo " using existing $LIST.2_ldpath." + else + set_trap "$LIST.2_ldpath" + # Ensure that the "trusted" lib directories are at the start of the path + ( + echo /lib* /usr/lib* | sed 's/ /:/g' + sed '/^#/d;s/#.*$//' $LIST.2_ldpath + echo -e " done.\n ($LIST.2_ldpath)" + fi + COMPLETE_LD_LIBRARY_PATH="$(cat $LIST.2_ldpath)" +fi + +echo +echo -n -e "${GR}Checking dynamic linking$WORKING_TEXT...${NO}" +if [ -f $LLIST.3_rebuild ] ; then + echo " using existing $LLIST.3_rebuild." +else + echo_v + set_trap "$LLIST.3_rebuild" + LD_MASK="\\( $(echo "$LD_LIBRARY_MASK" | sed 's/\./\\./g;s/ / \\| /g') \\)" + echo -n >$LLIST.3_rebuild + echo -n >$LLIST.3_ldd_errors + cat $LIST.1_files | egrep -v '*\.la$' | while read FILE ; do + # Note: double checking seems to be faster than single + # with complete path (special add ons are rare). + if ldd "$FILE" 2>>$LLIST.3_ldd_errors | grep -v "$LD_MASK" | $SONAME_GREP -q "$SONAME_SEARCH" ; then + if $SEARCH_BROKEN && $FULL_LD_PATH ; then + if LD_LIBRARY_PATH="$COMPLETE_LD_LIBRARY_PATH" ldd "$FILE" 2>/dev/null | grep -v "$LD_MASK" | $SONAME_GREP -q "$SONAME_SEARCH" ; then + # FIX: I hate duplicating code + # Only build missing direct dependencies + ALL_MISSING_LIBS=$(ldd "$FILE" 2>/dev/null | sort -u | sed -n 's/ \(.*\) => not found/\1/p' | tr '\n' ' ' | sed 's/ $//' ) + REQUIRED_LIBS=$(objdump -x $FILE | grep NEEDED | awk '{print $2}' | tr '\n' ' ' | sed 's/ $//') + MISSING_LIBS="" + for lib in $ALL_MISSING_LIBS + do + if echo $REQUIRED_LIBS | grep -q $lib + then + MISSING_LIBS="$MISSING_LIBS $lib" + fi + done + if [ "$MISSING_LIBS" != "" ] + then + echo "obj $FILE" >>$LLIST.3_rebuild + echo_v " broken $FILE (requires ${MISSING_LIBS})" + fi + fi + else + # FIX: I hate duplicating code + # Only rebuild for direct dependencies + ALL_MISSING_LIBS=$(ldd "$FILE" 2>/dev/null | sort -u | $SONAME_GREP "$SONAME_SEARCH" | awk '{print $1}' | tr '\n' ' ' | sed 's/ $//' ) + REQUIRED_LIBS=$(objdump -x $FILE | grep NEEDED | awk '{print $2}' | tr '\n' ' ' | sed 's/ $//') + MISSING_LIBS="" + for lib in $ALL_MISSING_LIBS + do + if echo $REQUIRED_LIBS | grep -q $lib + then + MISSING_LIBS="$MISSING_LIBS $lib" + fi + done + if [ "$MISSING_LIBS" != "" ] + then + echo "obj $FILE" >>$LLIST.3_rebuild + if $SEARCH_BROKEN ; then + echo_v " broken $FILE (requires ${MISSING_LIBS})" + else + echo_v " found $FILE" + fi + fi + fi + fi + done + if $SEARCH_BROKEN ; then + # Look for missing version + for FILE in $(grep "no version information available" $LLIST.3_ldd_errors | awk '{print $NF}' | sed 's/[()]//g' | sort -u) ; do + echo "obj $FILE" >>$LLIST.3_rebuild + echo_v " broken $FILE (no version information available)" + done + # Look for broken .la files + cat $LIST.1_files | egrep '*\.la$' | while read FILE ; do + for depend in $(grep '^dependency_libs' $FILE | awk -F'=' '{print $2}' | sed "s/'//g") ; do + [ ${depend:0:1} != '/' ] && continue + if [ ! -e $depend ] ; then + echo "obj $FILE" >>$LLIST.3_rebuild + echo_v " broken $FILE (requires ${depend})" + fi + done + done + fi + echo -e " done.\n ($LLIST.3_rebuild)" +fi + +if $PACKAGE_NAMES ; then + EXACT_EBUILDS=false + + echo + echo -n -e "${GR}Assigning files to packages...${NO}" + if [ -f $LLIST.4_packages_raw ] ; then + echo " using existing $LLIST.4_packages_raw." + else + set_trap "$LLIST.4_packages*" + echo -n >$LLIST.4_packages_raw + echo -n >$LLIST.4_package_owners + cat $LLIST.3_rebuild | while read obj FILE ; do + if $PORTAGE_UTILS ; then + EXACT_PKG="$(qfile -qvC ${FILE} )" + else + EXACT_PKG=$(find /var/db/pkg -name CONTENTS | xargs fgrep -l "obj $FILE " | sed -e 's:/var/db/pkg/\(.*\)/CONTENTS:\1:g') + fi + # Ugly sed hack to strip version information + PKG="$(echo $EXACT_PKG | sed 's/-r[0-9].*$//;s/\(^.*\/*\)-.*$/\1/')" + if [ -z "$PKG" ] ; then + echo -n -e "\n ${RD}*** $FILE not owned by any package is broken! ***${NO}" + echo "$FILE -> (none)" >> $LLIST.4_package_owners + echo_v -n -e "\n $FILE -> (none)" + else + echo "$EXACT_PKG" >> $LLIST.4_packages_raw + echo "$FILE -> $EXACT_PKG" >> $LLIST.4_package_owners + echo_v -n -e "\n $FILE -> $PKG" + fi + done + echo_v + echo -e " done.\n ($LLIST.4_packages_raw, $LLIST.4_package_owners)" + fi + + echo + echo -n -e "${GR}Cleaning list of packages to rebuild...${NO}" + if [ -f $LLIST.4_packages ] ; then + echo " using existing $LLIST.4_packages." + else + sort -u $LLIST.4_packages_raw >$LLIST.4_packages + echo -e " done.\n ($LLIST.4_packages)" + fi + + echo + echo -n -e "${GR}Assigning packages to ebuilds...${NO}" + if [ -f $LLIST.4_ebuilds ] ; then + echo " using existing $LLIST.4_ebuilds." + else + if [ -s "$LLIST.4_packages" ] + then + set_trap "$LLIST.4_ebuilds" + cat $LLIST.4_packages | while read EXACT_PKG + do + PKG="$(echo $EXACT_PKG | sed 's/-r[0-9].*$//;s/\(^.*\/*\)-.*$/\1/')" + SLOT=$(cat /var/db/pkg/${EXACT_PKG}/SLOT) + best_visible=$(portageq best_visible $PORTAGE_ROOT ${PKG}:${SLOT}) + [ "x" != "x$best_visible" ] && echo $best_visible + done > $LLIST.4_ebuilds + echo -e " done.\n ($LLIST.4_ebuilds)" + else + echo " Nothing to rebuild" + echo -n > $LLIST.4_ebuilds + fi + fi +else + EXACT_EBUILDS=true + + echo + echo -n -e "${GR}Assigning files to ebuilds...${NO}" + if [ -f $LLIST.4_ebuilds ] ; then + echo " using existing $LLIST.4_ebuilds." + else + if [ -s "$LLIST.3_rebuild" ] ; then + set_trap "$LLIST.4_ebuilds" + find /var/db/pkg -name CONTENTS | xargs fgrep -l -f $LLIST.3_rebuild | + sed 's:/var/db/pkg/\(.*\)/CONTENTS:\1:' > $LLIST.4_ebuilds + echo -e " done.\n ($LLIST.4_ebuilds)" + else + echo " Nothing to rebuild" + echo -n > $LLIST.4_ebuilds + fi + fi + +fi + +echo +echo -n -e "${GR}Evaluating package order...${NO}" +if [ -f $LLIST.5_order ] ; then + echo " using existing $LLIST.5_order." +else + set_trap "$LLIST.5_order" + RAW_REBUILD_LIST="$(cat $LLIST.4_ebuilds | sed s/^/=/ | tr '\n' ' ')" + if [ ! -z "$RAW_REBUILD_LIST" ] ; then + REBUILD_GREP="^\\($( (EMERGE_DEFAULT_OPTS="" emerge --nospinner --pretend --oneshot --nodeps --quiet $RAW_REBUILD_LIST ; echo $? >$LLIST.5a_status ) | sed -n 's/\./\\&/g;s/ //g;s/$/\\/;s/\[[^]]*\]//gp' | tr '\n' '|' | sed 's/|$//'))\$" + if [ $(cat $LLIST.5a_status) -gt 0 ] ; then + echo "" + echo -e "${RD}Warning: Failed to resolve package order." + echo -e "Will merge in \"random\" order!${NO}" + echo "Possible reasons:" + echo "- An ebuild is no longer in the portage tree." + echo "- An ebuild is masked, use /etc/portage/packages.keyword" + echo " and/or /etc/portage/package.unmask to unmask it" + for i in . . . . . ; do + echo -n -e '\a.' + sleep 1 + done + ln -f $LLIST.4_ebuilds $LLIST.5_order + else + (EMERGE_DEFAULT_OPTS="" emerge --nospinner --pretend --oneshot --deep --quiet $RAW_REBUILD_LIST ; echo $? >$LLIST.5b_status ) | sed -n 's/ *$//;s/^\[.*\] //p' | awk '{print $1}' | grep "$REBUILD_GREP" >$LLIST.5_order + if [ $(cat $LLIST.5b_status) -gt 0 ] ; then + echo "" + echo -e "${RD}Warning: Failed to resolve package order." + echo -e "Will merge in \"random\" order!${NO}" + echo "Possible reasons:" + echo "- An ebuild is no longer in the portage tree." + echo "- An ebuild is masked, use /etc/portage/packages.keyword" + echo " and/or /etc/portage/package.unmask to unmask it" + for i in . . . . . ; do + echo -n -e '\a.' + sleep 1 + done + rm -f $LLIST.5_order + ln -f $LLIST.4_ebuilds $LLIST.5_order + fi + fi + else + echo -n "" >$LLIST.5_order + fi + echo -e " done.\n ($LLIST.5_order)" +fi + +# Clean up no longer needed environment variables +unset COMPLETE_LD_LIBRARY_PATH SEARCH_DIRS SEARCH_DIRS_MASK LD_LIBRARY_MASK PORTAGE_ROOT CALLED_OPTIONS + +REBUILD_LIST="$(cat $LLIST.5_order | sed s/^/=/ | tr '\n' ' ')" + +trap - SIGHUP SIGINT SIGQUIT SIGABRT SIGTERM + +if [ -z "$REBUILD_LIST" ] ; then + echo -e "\n${GR}$OK_TEXT... All done.${NO} " + if [ ! $KEEPTEMP ] + then + rm $LIST.[0-2]_* + rm $LLIST.[3-9]_* + fi + exit 0 +fi + +IS_REAL_MERGE=true +echo " $EMERGE_OPTIONS " | grep -q '\( -p \| --pretend \| -f \| --fetchonly \)' && IS_REAL_MERGE=false + +echo +echo -e "${GR}All prepared. Starting rebuild...${NO}" + +echo "emerge --oneshot $EMERGE_OPTIONS $REBUILD_LIST" + +if $IS_REAL_MERGE ; then + for i in . . . . . . . . . . ; do + echo -n -e '\a.' + sleep 1 + done + echo +fi + +# Link file descriptor #6 with stdin +exec 6<&0 + +# Run in background to correctly handle Ctrl-C +( + EMERGE_DEFAULT_OPTS="" emerge --oneshot $EMERGE_OPTIONS $REBUILD_LIST <&6 + echo $? >$LLIST.6_status +) & +wait + +# Now restore stdin from fd #6, where it had been saved, and close fd #6 ( 6<&- ) to free it for other processes to use. +exec 0<&6 6<&- + +#if $EXACT_EBUILDS ; then +# mv -i /usr/portage/profiles/package.mask.hidden /usr/portage/profiles/package.mask +# trap - SIGHUP SIGINT SIGQUIT SIGABRT SIGTERM +#fi + +if [ "$(cat $LLIST.6_status)" -gt 0 ] ; then + echo + echo -e "${RD}revdep-rebuild failed to emerge all packages${NO}" + echo -e "${RD}you have the following choices:${NO}" + echo + echo "- if emerge failed during the build, fix the problems and re-run revdep-rebuild" + echo " or" + echo "- use -X or --package-names as first argument (trys to rebuild package, not exact" + echo " ebuild)" + echo " or" + echo "- set ACCEPT_KEYWORDS=\"~\" and/or /etc/portage/package.unmask" + echo " (and remove $LLIST.5_order to be evaluated again)" + echo " or" + echo "- modify the above emerge command and run it manually" + echo " or" + echo "- compile or unmerge unsatisfied packages manually, remove temporary files and" + echo " try again (you can edit package/ebuild list first)" + echo + echo -e "${GR}To remove temporary files, please run:${NO}" + echo "rm $LIST*.?_*" + exit $(cat $LLIST.6_status) +else + if $IS_REAL_MERGE ; then + trap "echo -e \" terminated. Please remove them manually:\nrm $LIST*.?_*\" ; exit 1" \ + SIGHUP SIGINT SIGQUIT SIGABRT SIGTERM + echo -n -e "${GR}Build finished correctly. Removing temporary files...${NO} " + echo + rm $LIST.[0-2]_* + rm $LLIST.[3-9]_* + echo "You can re-run revdep-rebuild to verify that all libraries and binaries" + echo "are fixed. If some inconsistency remains, it can be orphaned file, deep" + echo "dependency, binary package or specially evaluated library." + else + echo -e "${GR}Now you can remove -p (or --pretend) from arguments and re-run revdep-rebuild.${NO}" + fi +fi +exit 0 diff --git a/src/revdep-rebuild/revdep-rebuild-sh b/src/revdep-rebuild/revdep-rebuild-sh new file mode 100755 index 0000000..c7acdc6 --- /dev/null +++ b/src/revdep-rebuild/revdep-rebuild-sh @@ -0,0 +1,332 @@ +#!/bin/sh +# Copyright 1999-2007 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +appname=${0##*/} + +# If baselayout is broken, define our own functions +[ -r /etc/init.d/functions.sh ] && . /etc/init.d/functions.sh +if ! type eend >/dev/null 2>&1 || ! eend 0 >/dev/null 2>&1; then + einfo() { echo " * $*"; } + eerror() { echo " * $*" >&2; return 1; } + eindent() { :; } + eoutdent() { :; } +fi + +# No temporary files used, so nothing to clean up :) +trap "export RC_EINDENT=; echo; eerror 'Caught interrupt'; exit 1" \ + SIGINT SIGQUIT + +print_usage() { + cat << EOF +Usage: ${appname} [OPTIONS] [--] [EMERGE_OPTIONS] + +Broken reverse dependency rebuilder. + + -h, --help Print this usage + -e, --exact Emerge based on exact package version + -C, --nocolor Turn off colored output + -L, --library NAME Emerge existing packages that use the library with NAME + --library=NAME NAME can be a full path to the library or a basic + regular expression (man grep) + +Calls emerge, all other options are used for it (e. g. -p, --pretend). + +Report bugs to +EOF +} + +# Have we linked to this library? +elf_linked() { + local f=$1 + shift + while [ -n "$1" ]; do + ldd "${f}" 2>/dev/null | grep -q "=> $1 " && return 0 + shift + done + return 1 +} + +# Work out of we really need this library or not +elf_needed() { + local f=$1 + shift + while [ -n "$1" ]; do + objdump -p "${f}" 2>/dev/null | \ + grep -vF "${ld_mask:=$'\a'}" | \ + grep -q "^ NEEDED ${1##*/}" && return 0 + shift + done + return 1 +} + +elf_broken() { + local lib= + + for lib in $(ldd "$1" 2>/dev/null | \ + sed -n -e 's/[[:space:]]*\(.*\) => not found.*/\1/p'); do + if elf_needed "$1" "${lib}"; then + echo "(missing ${lib})" + return 0 + fi + done + return 1 +} + +# Check that all direct files exist in .la files +la_broken() { + local x= + for x in $(sed -n -e "s/^dependency_libs=\'\(.*\)'\$/\1/p" "$1"); do + case "${x}" in + /*) + if [ ! -e "${x}" ]; then + echo "(missing ${x})" + return 0 + fi + ;; + esac + done + + return 1 +} + +# Return a $PATH style variable based on ld.so.conf +read_so_conf() { + local line= + while read line; do + case "${line}" in + "#"*) ;; + *) printf ":%s" "${line}";; + esac + done < /etc/ld.so.conf +} + +# Check to see if we have already scanned a dir or not +scanned() { + local dir=$1 IFS=: + set -- ${scanned} + + while [ -n "$1" ]; do + [ "$1" = "$dir" ] && return 0 + shift + done + + scanned="${scanned}${scanned:+:}${dir}" + return 1 +} + +# Hit the portage vdb to work out our ebuilds +# If everything is 100% then this happens in one very fast pass +# Otherwise we have to take the slow approach to inform the user which files +# are orphans +get_exact_ebuilds() { + local regex= ebuilds= x= IFS=: + set -- $@ + IFS=" " + + # Hit the vdb in one go - this is fast! + regex=$(printf "%s|" "$@") + regex=${regex%*|} + find /var/db/pkg -name CONTENTS | \ + xargs egrep "^obj (${regex}) " | \ + sed -e 's,/var/db/pkg/\(.*\/.*\)/CONTENTS:.*,=\1,g' | \ + tr '\n' ' ' +} + +# Get our args +libs= +exact=false +order=true +while [ -n "$1" ]; do + case "$1" in + --*=*) + arg1=${1%%=*} + arg2=${1#*=} + shift + set -- ${arg1} ${arg2} $@ + continue + ;; + -h|--help) print_usage; exit 0;; + -L|--library|--soname|--soname-regexp) + if [ -z "$2" ]; then + eerror "Missing expected argument to $1" + exit 1 + fi + libs="${libs}${libs:+ }$2" + shift + ;; + -e|--exact) exact=true;; + -X|--package-names) ;; #compat + --) shift; emerge_opts="$@"; break;; + *) eerror "$0: unknown option $1"; exit 1;; + esac + shift +done + +einfo "Configuring search environment for ${appname}" +# OK, this truely sucks. Paths can have spaces in, but our config format +# is space separated? +sdirs=$(unset SEARCH_DIRS; portageq envvar SEARCH_DIRS) +sdirs_mask=$(unset SEARCH_DIRS_MASK; portageq envvar SEARCH_DIRS_MASK) +ld_mask=$(unset LD_LIBRARY_MASK; portageq envvar LD_LIBRARY_MASK) + +if [ -d /etc/revdep-rebuild ]; then + for x in /etc/revdep-rebuild/*; do + sdirs="${sdirs}${sdirs:+ }$(unset SEARCH_DIRS; . "${x}"; echo "${SEARCH_DIRS}")" + sdirs_mask="${sdirs_mask}${sdirs_mask:+ }$(unset SEARCH_DIRS_MASK; . "${x}" ; echo "${SEARCH_DIRS_MASK}")" + ld_mask="${ld_mask}${ld_mask:+ }$(unset LD_LIBRARY_MASK; . "${x}"; echo "${LD_LIBRARY_MASK}")" + done +else + sdirs="${sdirs}${sdirs:+ }/bin /sbin /usr/bin /usr/sbin /lib* /usr/lib*" + sdirs_mask="${sdirs_mask}${sdirs_mask:+ }/opt/OpenOffice /usr/lib/openoffice" + ld_mask="${ld_mask}${ld_mask:+ }libodbcinst.so libodbc.so libjava.so libjvm.so" +fi + +sdirs=$(find ${sdirs} -type d) + +einfo "Starting scan" +eindent +# Mark our masked dirs already scanned +scanned= +for dir in ${sdirs_mask}; do + scanned "${dir}" +done + +# Now scan our dirs +for dir in ${sdirs}; do + scanned "${dir}" && continue + + einfo "in ${dir}" + eindent + for x in "${dir}"/*; do + [ -d "${x}" ] && continue + [ -L "${x}" ] && continue + + scan=true + process=false + reason= + case "${x}" in + *.so|*.so.*) process=true;; + *.la) + scan=false + if [ -z "${libs}" ]; then + reason=$(la_broken "${x}") + [ $? = 0 ] && process=true + fi + ;; + esac + [ -x "${x}" ] && ${scan} && process=true + ${process} || continue + + if ${scan}; then + process=false + if [ -n "${libs}" ]; then + for lib in ${libs}; do + if [ "${lib#/}" != "${lib}" ]; then + # If lib starts with / then check if the exact + # lib is linked + elf_linked "${x}" "${lib}" || continue + fi + if elf_needed "${x}" ${lib}; then + process=true + break + fi + done + else + reason=$(elf_broken "${x}") + [ $? = 0 ] && process=true + fi + fi + + ${process} || continue + einfo "found ${x} ${reason}" + files="${files}${files:+:}${x}" + done + eoutdent +done +eoutdent + +if [ -z "${files}" ]; then + if [ -z "${libs}" ]; then + einfo "Nothing found that needs rebuilding" + else + einfo "No dynamic binaries found with these libraries" + fi + exit 0 +fi + +einfo "Assigning files to packages" +eindent +ebuilds=$(get_exact_ebuilds "${files}") + +if [ -z "${ebuilds}" ]; then + eerror "No packages own these files" + exit 1 +fi + +# Work out the best visible package for the slot +if ! ${exact}; then + root=$(portageq envvar ROOT) + root=${root:-/} + + set -- ${ebuilds} + ebuilds= + for x in "$@"; do + x=${x#=*} + pkg=${x%-r[0-9]*} + pkg=${pkg%-*} + slot=$(cat "/var/db/pkg/${x}/SLOT") + ebd=$(portageq best_visible "${root}" "${pkg}:${slot}") + if [ -z "${ebd}" ]; then + eerror "Cannot find an ebuild visible for ${x}" + else + ebuilds="${ebuilds}${ebuilds:+ }=${ebd}" + fi + done +fi +eoutdent + +# Work out the build order +if ${order}; then + einfo "Ordering packages" + order="$(EMERGE_DEFAULT_OPTS="" \ + emerge --nospinner --pretend --deep --quiet ${ebuilds})" + if [ $? = 0 ]; then + ebuilds=$(echo "${order}" | \ + sed -e 's:^\[.*\] \([^ ]*\)[ ].*$:=\1:' | \ + grep -F "$(printf "%s\n" ${ebuilds})" | \ + tr '\n' ' ') + else + eerror "Unable to order packages!" + fi +fi + +if [ -z "${ebuilds}" ]; then + eerror "Don't know how to find which package owns what file :/" + exit 1 +fi + +echo +einfo "About to execute" +echo "emerge --oneshot ${emerge_opts} ${ebuilds}" +echo + +i=5 +printf "in" +while [ ${i} -gt 0 ]; do + printf " ${i}" + sleep 1 + i=$((${i} - 1)) +done +printf "\n\n" + +EMERGE_DEFAULT_OPTS="" emerge --oneshot ${emerge_opts} ${ebuilds} +retval=$? + +if [ "${retval}" = 0 ]; then + einfo "All done" + exit 0 +fi + +eerror "There was an error trying to emerge the broken packages" +exit "${retval}" diff --git a/src/revdep-rebuild/revdep-rebuild.1 b/src/revdep-rebuild/revdep-rebuild.1 new file mode 100644 index 0000000..267f7f1 --- /dev/null +++ b/src/revdep-rebuild/revdep-rebuild.1 @@ -0,0 +1,101 @@ +.TH "revdep\-rebuild" "1" "" "gentoolkit" "" +.SH "NAME" +revdep\-rebuild \- Gentoo: Reverse Dependency Rebuilder +.SH "SYNOPSIS" +.B revdep\-rebuild +[OPTIONS] [\-\-] [EMERGE OPTIONS] +.SH "DESCRIPTION" +revdep\-rebuild scans libraries and binaries for missing shared library dependencies and attempts to fix them by re\-emerging those broken binaries and shared libraries. It is useful when an upgraded package breaks other software packages that are dependent upon the upgraded package. +.SH "OPTIONS" +.TP +.B \-C | \-\-nocolor +Turn off colored output. (This option is also passed to portage.) +.TP +.B \-e | \-\-exact +Emerge the most recent version of found packages, without regard to SLOT. +.TP +.B \-h | \-\-help +Print usage. +.TP +.B \-i | \-\-ignore +Delete temporary files from previous runs. +.TP +.B \-k | \-\-keep\-temp +Force revdep\-rebuild not to delete temporary files after it successfully rebuilds packages. This option will NOT prevent revdep\-rebuild from deleting inconsistent or out\-of\-date temporary files. +.TP +.B \-\-library NAME | -L NAME +Search for reverse dependencies for a particular library or group of libraries, rather than every library on the system. Emerge packages that use the named library. NAME can be a full path to a library or basic regular expression. (See regex(7).) +.TP +.B \-l | \-\-no\-ld\-path +Do not set LD_LIBRARY_PATH. \fBNote:\fR Using this option will cause revdep-rebuild to report some false positives. +.TP +.B \-o | \-\-no-order +Do not check the build order against the deep dependency list. This will make revdep-rebuild faster, but it can cause emerge failures. Please try revdep\-rebuild without \-o before reporting any bugs. +.TP +.B \-p | \-\-pretend +Do a dry-run. Do not delete temporary files. (\-k \-p is redundant, but harmless.) \-\-pretend is assumed when not running revdep\-rebuild as root. +.TP +.B \-P | \-\-no\-progress +Turn off the progress meter +.TP +.B \-q | \-\-quiet +Print less output and disable the progress meter. (This option is also passed to portage.) +.TP +.B \-u UTIL | \-\-no-util UTIL +Do not use features provided by UTIL. +UTIL can be one of portage-utils or pkgcore, or it can be a \fBquoted\fR space-delimited list. +.TP +.B \-v | \-\-verbose +More output. (Prints the revdep\-rebuild search environment.) +.TP +.B All other options (including unrecognized ones) are passed to the emerge command. Single\-letter options may not be combined, so for example, \-pv is not valid. Please use \-p \-v. +.SH "CONFIGURATION" +revdep\-rebuild no longer uses hardcoded paths. To change the default behavior the following variables can be changed by the user. + +LD_LIBRARY_MASK \- Mask of specially evaluated libraries +.LP +SEARCH_DIRS \- List of directories to search for executables and libraries +.LP +SEARCH_DIRS_MASK \- List of directories to not search + +You can prepend to these variables by setting the variable in your environment prior to execution, by placing an entry in /etc/make.conf, or by placing a file in /etc/revdep\-rebuild containing the appropriate variables. + +The variables are read and set in the following order: + +environment settings \- one time changes by user +.br +/etc/make.conf \- persistent changes by user +.br +/etc/revdep\-rebuild/* \- persistent changes by ebuild authors + +While a user can edit and modify the files in the /etc/revdep\-rebuild directory, please be aware that the /etc/revdep\-rebuild directory is not under configuration protection and files can be removed and/or overwritten by an ebuild. To change this add /etc/revdep\-rebuild to the CONFIG_PROTECT variable in /etc/make.conf. + +An entry of "\-*" means to clear the variable from that point forward. +Example: SEARCH_DIRS="/usr/bin \-*" will set SEARCH_DIRS to contain only /usr/bin + +revdep\-rebuild honors the NOCOLOR and PORTAGE_NICENESS variables from /etc/make.conf +.SH "EXAMPLES" +It is recommended that when running revdep\-rebuild that the following command be used initially: +.br +\fBrevdep\-rebuild \-\-ignore \-\-pretend\fR + +To search the entire system, while excluding /mnt and /home: +.br +\fBenv SEARCH_DIRS="/ \-*" SEARCH_DIRS_MASK="/mnt /home" revdep\-rebuild\fR + +To rebuild packages that depend on libkdecore.so.4 from KDE 3.3: +.br +\fBrevdep\-rebuild \-\-library /usr/kde/3.3/lib/libkdecore.so.4\fR + +To rebuild packages that depend upon libImlib.so and libImlib2.so: +.br +\fBrevdep\-rebuild \-\-library libImlib[2]*.so.*\fR + +.SH "EXIT STATUS" +revdep\-rebuild returns a zero exit status if it \fBand emerge\fR succeeds, and a nonzero exit status otherwise. +.SH "BUGS" +.LP +Report bugs to . Please do not report emerge failures caused by \-o or \-e. Please include your .revdep\-rebuild* files, your emerge \-\-info, and patches. ;) + +.SH "SEE ALSO" +emerge(1), portage(5), regex(7) diff --git a/src/useflag/AUTHORS b/src/useflag/AUTHORS new file mode 100644 index 0000000..e69de29 diff --git a/src/useflag/ChangeLog b/src/useflag/ChangeLog new file mode 100644 index 0000000..e69de29 diff --git a/src/useflag/README b/src/useflag/README new file mode 100644 index 0000000..e69de29 diff --git a/src/useflag/useflag b/src/useflag/useflag new file mode 100644 index 0000000..fd4cc08 --- /dev/null +++ b/src/useflag/useflag @@ -0,0 +1,610 @@ +#!/bin/bash +# useflag v0.3.1 +# Script to help users manage USE flags in Gentoo Linux +# +# Distributed under the terms of the GNU General Public License, v2 or later +# Author: Michael Thompson , (c) 2002 + +run_name=`basename $0` +use_desc="/usr/portage/profiles/use.desc" +make_conf_dir="/etc" +make_conf="${make_conf_dir}/make.conf" +# Home directory was chosen as the use of /tmp allows for symlink attacks +make_temp="${HOME}/use.make.conf.tmp" +use_cache_parent="/var/cache" +use_cache_dir="${use_cache_parent}/use_desc" +use_cache="${use_cache_dir}/use.cache" +lock_cache="${use_cache_dir}/lock.cache" +changes="0" + + +# Get flag description +# parm1 = Use flag to get description of +do_get_desc() { + local parm1=$1 + # Strip the comments and find the flag. + local out_get_desc=`grep -v "#" ${use_desc} | grep -w -e "${parm1} -"` + if [ "${out_get_desc}" = "" ]; then + local lcl_avail=`grep -v "#" ${use_desc} | cut -d ' ' -f1 | \ + grep -w -e "${parm1}"` + if [ "${lcl_avail}" != "" ]; then + echo "${parm1} - No description available." + else + echo "!!! ${parm1} does not exist." + fi + else + echo "${out_get_desc}" + fi +} + +# Get the contents of the USE variable +# parm1 controls whether or not to include the '-' with each flag +do_get_make() { + local parm1=$1 + # Get the USE flags from make.conf + # using `source` now instead of brain-damaged grepping + source ${make_conf} + local get_make_out=${USE} + # If called with "nodashes", then strip the leading dashes + if [ "${parm1}" = "nodashes" ]; then + for tr_sucks in ${get_make_out}; do + if [ "${tr_sucks:0:1}" = "-" ]; then + local tr_out="${tr_out} ${tr_sucks:1}" + else + local tr_out="${tr_out} ${tr_sucks}" + fi + done + get_make_out="${tr_out}" + fi + echo "${get_make_out}" +} + +# Yes, it's pointless. But it could be used more than once in the future +# so it's a function. +# Gets the master list of available USE flags from use.desc +do_get_avail() { + grep -v "#" ${use_desc} | cut -d " " -f1 | tr '\n' ' ' +} + +# Get deprecated flags. +# parm1 = flag to check for deprecation +# parm2 = list of available flags +do_get_depr() { + local parm1=$1 + local parm2=${@:2} + # This next var can't be local + get_depr_tmp=`echo "${parm2}" | tr ' ' '\n' | grep -x -e "${parm1}"` + local ret_code=$? + if [ "${ret_code}" != "0" ]; then + echo "${parm1}" | tr '\n' ' ' + fi +} + +# Removes a USE flag from make.conf +# parm1 = flag to remove +# use_rm_out = list of available flags +do_use_rm() { + local parm1=$1 + local use_rm_out=${@:2} + # Strip matching USE flags. Yes, this is ugly, I know. + use_rm_out=`echo "${use_rm_out}" | tr ' ' '\n' | \ + grep -x -v -e "${parm1}" | tr '\n' ' '` + # Also strip the inverse. Even uglier... + if [ "${parm1:0:1}" = "-" ]; then + use_rm_out=`echo "${use_rm_out}" | tr ' ' '\n' | \ + grep -x -v -e "${parm1:1}" | tr '\n' ' '` + else + use_rm_out=`echo "${use_rm_out}" | tr ' ' '\n' | \ + grep -x -v -e "-${parm1}" | tr '\n' ' '` + fi + echo "${use_rm_out}" +} + +# Adds a USE flag to make.conf +# parm1 = flag to add +# use_add_out = list of available flags +do_use_add() { + local parm1=$1 + local use_add_out=${@:2} + # First strip existing flags (matching or inverse), then add. + # This is not the best way to do this. Better would be to replace a + # flag if it already exists. That turned out to be a real PITA. + # Maybe in a later version... + use_add_out=`do_use_rm ${parm1} ${use_add_out}` + use_add_out="${use_add_out} ${parm1}" + echo "${use_add_out}" +} + +# Adds a flag to the locked flag cache +# Pass list of flags to lock as parameter. +do_lock_flags() { + local flag_list=$@ + # Merge the new list of flags flags that are already locked. + if [ -r ${lock_cache} ]; then + local lock_old=`cat ${lock_cache}` + fi + flag_list="${lock_old} ${flag_list}" + # Remove duplicates. + echo "${flag_list}" | tr ' ' '\n' | sort | uniq | tr '\n' ' ' +} + +# Writes the list of locked flags to the cache file +# Pass list of flags to write as parameter. +do_write_lock() { + local write_flags=$@ + if [ -r ${make_conf} ]; then + local make_prune=`do_get_make nodashes` + else + do_report_err ${make_conf} read + fi + # Be sure and remove any locked flags that no longer exist in USE. + for prune in ${write_flags}; do + local prune_test=`do_get_depr ${prune} ${make_prune}` + if [ "$prune_test" = "" ]; then + local new_cache="${prune} ${new_cache}" + fi + done + if [ -w ${use_cache_parent} ]; then + mkdir -p ${use_cache_dir} + chmod 700 ${use_cache_dir} + echo "${new_cache}" > ${lock_cache} + chmod 600 ${lock_cache} + else + do_report_err ${lock_cache} write + fi +} + +# Writes new USE variable to make.conf +# Pass new list of USE flags as parameter. +do_write_make() { + local use_write="USE=\"$@\"" + local old_use="USE=\"`do_get_make dashes`\"" + if [ -w ${make_conf} ] && [ -w ${make_conf_dir} ]; then + local use_write="USE=\"$@\"" + local old_use=`grep "USE=\"" ${make_conf} | grep -v "#"` + local start_line=`grep -n "USE=\"" ${make_conf} | \ + grep -v "#" | cut -d ":" -f1` + if [ "${old_use:0-1}" != "\\" ]; then + sed -e "s/${old_use}/${use_write}/" ${make_conf} > \ + ${make_temp} + else + sed -e "s/${old_use}\\/${use_write}/" ${make_conf} > \ + ${make_temp} + fi + let start_line="${start_line} + 1" + if [ "${old_use:0-1}" != "\"" ]; then + del_line=`head -n ${start_line} ${make_temp} | \ + tail -n 1` + until [ "${del_line:0-1}" != "\\" ]; do + let del_length="${#del_line} - 1" + del_line="${del_line:0:${del_length}}" + grep -v -w "${del_line}" ${make_temp} > \ + ${make_temp}.2 + mv ${make_temp}.2 ${make_temp} + del_line=`head -n ${start_line} \ + ${make_temp} | tail -n 1` + done + let del_length="${#del_line} - 1" + del_line="${del_line:0:${del_length}}" + grep -v -x "${del_line}\"" ${make_temp} > \ + ${make_temp}.2 + mv ${make_temp}.2 ${make_temp} + fi + mv ${make_temp} ${make_conf} + else + do_report_err ${make_conf} write + fi +} + +# Reports a read/write error and exits +# parm1 = File to report on +# parm2 = read, write, etc +do_report_err() { + local parm1=$1 + local parm2=$2 + if [ "${parm2}" = "read" ]; then + echo "!!! Could not read ${parm1}" + echo -n "!!! Verify that file exists and that you have " + echo "appropriate permissions." + elif [ "${parm2}" = "write" ]; then + echo "!!! Could not write ${parm1}" + echo "!!! Got root?" + elif [ "${parm2}" = "nolock" ]; then + echo "!!! Could not read ${parm1}" + echo -n "!!! You have no locked flags or you have " + echo "insufficient permissions." + fi + exit 1 +} + + +# The main section of the script +# desc: +# This is the feature for getting USE descriptions. +if [ "$1" = "desc" ] || [ "$1" = "-i" ]; then + if [ -r ${use_desc} ]; then + for flag in ${@:2}; do + do_get_desc ${flag} + done + else + do_report_err ${use_desc} read + fi + +# show: +# This is the feature for showing the contents of the USE variable. +elif [ "$1" = "show" ] || [ "$1" = "-s" ]; then + if [ -r ${make_conf} ]; then + do_get_make dashes + else + do_report_err ${make_conf} read + fi + +# del: +# This is the feature for removing a USE flag. +elif [ "$1" = "del" ] || [ "$1" = "-d" ]; then + if [ -r ${make_conf} ]; then + make_use=`do_get_make dashes` + else + do_report_err ${make_conf} read + fi + for flag in ${@:2}; do + # Strip leading dashes. + if [ "${flag:0:1}" = "-" ]; then + flag="${flag:1}" + fi + del_test1=`do_get_depr ${flag} ${make_use}` + del_test2=`do_get_depr -${flag} ${make_use}` + if [ "${del_test1}" = "" ] || [ "${del_test2}" = "" ]; then + changes="1" + make_use=`do_use_rm ${flag} ${make_use}` + else + echo "!!! ${flag} is not in your USE variable." + fi + done + if [ "${changes}" != "0" ]; then + do_write_make ${make_use} + # Prune deleted USE flags from lock cache + lock_flags=`do_lock_flags $2` + do_write_lock ${lock_flags} + fi + +# add: +# This is the feature for explicitly enabling or disabling a USE flag. +elif [ "$1" = "add" ] || [ "$1" = "-a" ]; then + if [ -r ${make_conf} ]; then + make_use=`do_get_make dashes` + else + do_report_err ${make_conf} read + fi + for flag in ${@:2}; do + changes="1" + make_use=`do_use_add ${flag} ${make_use}` + done + if [ "${changes}" != "0" ]; then + do_write_make ${make_use} + fi + +# lock: +# This is the feature to lock a deprecated USE flag to prevent removal +elif [ "$1" = "lock" ] || [ "$1" = "-l" ]; then + if [ -r ${make_conf} ]; then + make_use=`do_get_make nodashes` + else + do_report_err ${make_conf} read + fi + for flag in ${@:2}; do + # Strip leading dashes. + if [ "${flag:0:1}" = "-" ]; then + flag="${flag:1}" + fi + lock_test=`do_get_depr ${flag} ${make_use}` + if [ "${lock_test}" = "" ]; then + lock_flags="${lock_flags} ${flag}" + else + echo "!!! ${flag} is not in your USE variable." + fi + done + lock_out=`do_lock_flags ${lock_flags}` + do_write_lock ${lock_out} + +# unlock: +# This is the feature to unlock a deprecated USE flag to allow removal +elif [ "$1" = "unlock" ] || [ "$1" = "-k" ]; then + if [ -r ${lock_cache} ]; then + lock_out=`cat ${lock_cache}` + else + do_report_err nolock + fi + for flag in ${@:2}; do + # Strip leading dashes. + if [ "${flag:0:1}" = "-" ]; then + flag="${flag:1}" + fi + lock_flag_check=`do_get_depr ${flag} ${lock_out}` + if [ "${lock_flag_check}" = "" ]; then + lock_out=`do_use_rm ${flag} ${lock_out}` + else + echo "!!! ${flag} is not a locked flag." + fi + done + do_write_lock ${lock_out} + +# showlock: +# This feature prints a list of USE flags that have been locked +elif [ "$1" = "showlock" ] || [ "$1" = "-w" ]; then + if [ -r ${lock_cache} ]; then + cat ${lock_cache} + else + do_report_err nolock + fi + +# update: +# This is the feature to update your USE by removing deprecated flags and +# handling new flags. +elif [ "$1" = "update" ] || [ "$1" = "-u" ]; then + if [ -r ${make_conf} ]; then + # Get our USE but strip leading dashes + make_use=`do_get_make nodashes` + else + do_report_err ${make_conf} read + fi + # Get available USE flags from use.desc + if [ -r ${use_desc} ]; then + use_avail=`do_get_avail` + else + do_report_err ${use_desc} read + fi + # First we check for deprecated flags. + echo "Your USE variable currently looks like this:" + echo + echo `do_get_make dashes` + echo + # Print the list of locked flags if any exist. + if [ -r ${lock_cache} ]; then + lock_test=`cat ${lock_cache} | tr -d ' '` + if [ "${lock_test}" != "" ]; then + echo "The following flags are locked:" + cat ${lock_cache} + echo + fi + fi + echo + echo "*** Checking for deprecated USE flags ..." + echo + for check_flag in ${make_use}; do + depr_ret=`do_get_depr ${check_flag} ${use_avail}` + flag_depr="${flag_depr}${depr_ret}" + done + # Filter out locked flags + if [ -r ${lock_cache} ] && [ "${lock_test}" != "" ]; then + lock_list=`cat ${lock_cache}` + for check_locks in ${flag_depr}; do + lock_ret=`do_get_depr ${check_locks} ${lock_list}` + lock_out="${lock_out}${lock_ret}" + done + flag_depr="${lock_out}" + fi + make_use=`do_get_make dashes` + if [ "${flag_depr}" = "" ]; then + echo "!!! No deprecated flags were found." + else + echo "The following USE flags appear to be deprecated:" + echo "${flag_depr}" + echo + echo "How would you like to handle them?" + echo "1) Handle them individually" + echo "2) Remove all deprecated flags" + echo "3) Don't remove any deprecated flags" + echo "4) Lock all deprecated flags" + echo + echo -n "Type (1, 2, 3, or 4): " + while [ "${luser_input}" = "" ]; do + read luser_input + case ${luser_input} in + "2") + changes="1" + for flag in ${flag_depr}; do + make_use=`do_use_rm \ + ${flag} ${make_use}` + done + echo + echo -n "*** All deprecated flags were " + echo "removed." + ;; + "3") + echo + echo "*** No flags were removed." + ;; + "1") + for flag in ${flag_depr}; do + echo -n "${flag} appears to be " + echo -n "deprecated. Remove it? " + echo -n "[Y]es/[N]o/[L]ock : " + luser_yn="" + while [ "${luser_yn}" = "" ]; do + read luser_yn + case ${luser_yn} in + "y" | "Y") + changes="1" + make_use=`do_use_rm \ + ${flag} \ + ${make_use}` + ;; + "n" | "N") + ;; + "l" | "L") + wlk="${flag} ${wlk}" + ;; + *) + luser_yn="" + ;; + esac + done + done + echo + echo -n "*** All deprecated flags " + echo "processed." + ;; + "4") + wlk="${flag_depr}" + echo + echo "*** All deprecated flags were locked." + ;; + *) + luser_input="" + ;; + esac + done + fi + if [ "${wlk}" != "" ]; then + do_write_lock ${wlk} + fi + # Now we check for new flags. + echo + echo + echo "*** Checking for new USE flags ..." + echo + # Load up our cached USE flags for comparison with use.desc + # Create the cache if it does not exist + if [ -w ${use_cache} ]; then + use_old=`cat ${use_cache}` + echo "${use_avail}" > ${use_cache} + chmod 600 ${use_cache} + elif [ -w ${use_cache_parent} ]; then + mkdir -p ${use_cache_dir} + chmod 700 ${use_cache_dir} + echo "${use_avail}" > ${use_cache} + chmod 600 ${use_cache} + use_old="" + else + do_report_err ${use_cache} write + fi + # Grab the contents of the USE variable. + make_cand=`do_get_make nodashes` + # Build a list of flags that do not exist in the USE variable. + for flag in ${use_avail}; do + new_cand="${new_cand}`do_get_depr ${flag} ${make_cand}`" + done + # Filter that list through the cached master list of flags. + for flag in ${new_cand}; do + new_flags="${new_flags}`do_get_depr ${flag} ${use_old}`" + done + if [ "${new_flags}" = "" ]; then + echo "!!! No new USE flags are available." + else + echo "The following new USE flags are available:" + echo "${new_flags}" + echo + echo "How would you like to handle them?" + echo "1) Handle them individually" + echo "2) Use Portage defaults (do not add to USE)" + echo "3) Explicitly enable all new flags" + echo "4) Explicitly disable all new flags" + echo + echo -n "Type (1, 2, 3, or 4): " + luser_input="" + while [ "${luser_input}" = "" ]; do + read luser_input + case ${luser_input} in + "1") + for h_flag in ${new_flags}; do + do_get_desc ${h_flag} + echo -n "How would you like to handle " + echo -n "${h_flag}? [e]nable, " + echo -n "[d]isable, [u]se default : " + luser_handle="" + while [ "${luser_handle}" = "" ]; do + read luser_handle + case ${luser_handle} in + "e" | "E") + changes="1" + make_use=`do_use_add \ + ${h_flag} \ + ${make_use}` + echo + ;; + "d" | "D") + changes="1" + make_use=`do_use_add \ + "-${h_flag}" \ + ${make_use}` + echo + ;; + "u" | "U") + echo + ;; + *) + luser_handle="" + ;; + esac + done + done + echo -n "*** All new flags have been " + echo "processed." + ;; + "2") + echo + echo -n "*** No new flags were added to " + echo "your USE." + ;; + "3") + changes="1" + for h_flag in ${new_flags}; do + make_use=`do_use_add ${h_flag} \ + ${make_use}` + done + echo + echo -n "*** All new flags were enabled in " + echo "your USE." + ;; + "4") + changes="1" + for h_flag in ${new_flags}; do + make_use=`do_use_add \ + "-${h_flag}" ${make_use}` + done + echo + echo -n "*** All new flags were disabled in " + echo "your USE." + ;; + *) + luser_input="" + ;; + esac + done + fi + # Write the changes if necessary. + if [ "${changes}" != "0" ]; then + do_write_make ${make_use} + # Prune any locked flags that do not exist in the USE variable + lock_prot=`do_lock_flags fakeflag` + do_write_lock ${lock_prot} + fi + echo + echo + echo "*** Script finished ..." + +# Display USAGE statement for unhandled parameters +else + echo "Usage:" + echo " ${run_name} action [flag] [...]" + echo + echo "Actions:" + echo "-s, show Displays the contents of the USE variable." + echo "-i, desc Displays a description of one or more USE flags." + echo -n "-a, add Adds the specified flag(s) to the USE " + echo "variable." + echo -n "-d, del Deletes the specified flag(s) from " + echo "the USE variable." + echo "-l, lock Locks the specified flag(s) to prevent deprecation." + echo -n "-k, unlock Unlocks the specified flags to allow " + echo "deprecation." + echo "-w, showlock Displays a list of locked flags." + echo -n "-u, update Interactively updates the USE variable to " + echo "reflect changes" + echo " to use.desc." + echo + exit 1 +fi +exit 0 + diff --git a/src/useflag/useflag.1 b/src/useflag/useflag.1 new file mode 100644 index 0000000..d321861 --- /dev/null +++ b/src/useflag/useflag.1 @@ -0,0 +1,69 @@ +.TH useflag "1" "May 2002" "gentoolkit" +.SH NAME +useflag \- manage and update Gentoo Linux USE flags +.SH SYNOPSIS +.B useflag +\fIaction\fR [\fIflag\fR] [\fI...\fR] +.SH DESCRIPTION +The \fBuseflag\fR utility allows the user to manage Gentoo Linux USE flags through a simple command-line interface. It allows quick and easy, single-command manipulation of the USE variable defined in \fI/etc/make.conf\fR. It also simplifies the process of handling changes to the master list of USE flags defined in \fI/usr/portage/profile/use.desc\fR. +.br + +It is important to note that a USE variable must exist in \fImake.conf\fR for this utility to work. Be sure that the USE variable is uncommented. It is OK for the USE variable to be empty. Please be sure to back up \fImake.conf\fR before using this utility for the first time. +.PP +.SH ACTIONS +.TP +\fBshow, -s\fR +Displays the raw contents of the USE variable as defined in \fImake.conf\fR. The output contains only the flags themselves. +.TP +\fBdesc, -i [flag] ...\fR +Displays a description of one or more USE flags specified on the command line. The flags should be seperated by spaces and should not contain leading dashes. Specifying a flag that does not exist returns a non-fatal error. +.TP +\fBadd, -a [[\-]flag] ...\fR +Adds one or more specified flags to the USE variable defined in \fImake.conf\fR. The flags are appended to the USE variable exactly as they appear on the command line. If a specified flag already exists in the USE variable, it is removed before the new set of flags is appended. The utility removes existing flags regardless of whether they are in an enabled or disabled state, allowing the user to enable or disable a flag with a single command. The user may add flags that are not defined in the \fIuse.desc\fR master list. +.TP +\fBdel, -d [flag] ...\fR +Deletes one or more specified flags from the USE variable defined in \fImake.conf\fR. The enabled/disabled state of a flag in the USE variable as well as any dashes prepended to flags on the command line is ignored. Attempting to delete a flag that is not in the USE variable returns a non-fatal error. When a flag is deleted from the USE variable using this utility, it is automatically unlocked. +.TP +\fBlock, -l [flag] ...\fR +Locks one or more specified flags that exist in the USE variable defined in \fImake.conf\fR. Locked flags are not considered to be deprecated by the update function of this utility. This allows the user to avoid being queried by the utility about deprecated, undocumented, or custom flags that the user wishes to preserve when performing an update. A flag must exist in the USE variable in order to be locked. The enabled/disabled state of a flag in the USE variable as well as any dashes prepended to flags on the command line is ignored. +.TP +\fBunlock, -k [flag] ...\fR +Unlocks one or more specified USE flags. This allows the update function to consider a flag deprecated if it no longer exists in the master list defined in \fIuse.desc\fR. Any dashes prepended to flags on the command line are ignored. Attempting to unlock flags that are not locked returns a non-fatal error. +.TP +\fBshowlock, -w\fR +Displays the raw list of locked flags, seperated by spaces. +.TP +\fBupdate, -u\fR +Interactively updates the USE variable defined in \fImake.conf\fR to reflect changes to the master list of USE flags defined in \fI use.desc\fR. +.br + +First, the user is presented with the current raw contents of the USE variable. The user is also shown the list of locked flags if any exist. +.br + +Next, the USE variable is searched for flags that do not appear in the master list. If any are found and they are not locked, then they are considered to be deprecated and are displayed to the user along with a list of options for handling them. The user may choose to remove all of the flags, remove none of the flags, lock all of the flags, or handle each flag individually. +.br + +Last, the master list is searched for any new flags that have become available since the last time the update function was run, and these are displayed to the user. If this is the first time, then all flags not currently defined in the USE variable will be displayed. The user will then be presented with a list of options for handling these flags. The user may choose to add all of the new flags to the USE variable as enabled, add all of the new flags as disabled, use Portage defaults for all of the flags, or handle each flag individually. +.SH FILES +.TP +\fI/etc/make.conf\fR +Contains the USE variable that Portage uses to control build-time functionality. +.TP +\fI/usr/portage/profile/use.desc\fR +Contains a master list of all documented USE flags along with their descriptions. +.TP +\fI/var/cache/use_desc/use.cache\fR +Contains a cached list of flags from \fIuse.desc\fR. This prevents the user from being repeatedly queried about flags that exist in \fIuse.desc\fR but not in the USE variable. DO NOT EDIT THIS FILE MANUALLY. +.TP +\fI/var/cache/use_desc/lock.cache\fR +Contains a list of USE flags that have been locked. DO NOT EDIT THIS FILE MANUALLY. +.SH AUTHOR +Michael Thompson , 2002 +.SH SEE ALSO +ebuild(1), ebuild(5), emerge(1), make.conf(5). +.TP +See \fI/usr/share/doc/gentoolkit-/\fR for documentation on other gentoolkit utilities. +.SH TIPS +.TP +Deleting \fI/var/cache/use_desc/use.cache\fR will allow the utility to query about all flags not currently defined in the USE variable. + diff --git a/trunk/AUTHORS b/trunk/AUTHORS deleted file mode 100644 index fdfccf3..0000000 --- a/trunk/AUTHORS +++ /dev/null @@ -1,6 +0,0 @@ -Karl Trygve Kalleberg - * Maintenance - -See the AUTHOR file in the various src/ subdirectories for a full -log of who's done what with whome and when. - diff --git a/trunk/COPYING b/trunk/COPYING deleted file mode 100644 index 60549be..0000000 --- a/trunk/COPYING +++ /dev/null @@ -1,340 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) 19yy - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) 19yy name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General -Public License instead of this License. diff --git a/trunk/ChangeLog b/trunk/ChangeLog deleted file mode 100644 index b100110..0000000 --- a/trunk/ChangeLog +++ /dev/null @@ -1,776 +0,0 @@ -2008-08-26: Paul Varner - * glsa-check: Fix has_key() deprecation message. (Bug #232797) - * revdep-rebuild: Update fix for Bug 232270 to utilize better patch - from Ian Abbott. - -2008-08-22: Paul Varner - * gentoolkit: Fix find_packages and find_installed_packages to print - a warning instead of a traceback when an InvalidAtom exception occurs. - (Bug #234358) - * equery: Fix equery belongs to strip multiple slashes from path - names. (Bug #234584) - -2008-07-24: Paul Varner - * equery: Fix equery check to convert mtime to an integer so that - comparisions always work. Thanks to Alexey Parshin for discovering the - problem and providing a patch. (Bug 232803) - -2008-07-22: Paul Varner - * gentoolkit: Fix gentoolkit.split_package_name to work with - newer portage.catpkgsplit that now returns a tuple instead of a - list. (Bug 232599) - -2008-07-21: Paul Varner - * revdep-rebuild: Fix filtering of masked paths from SEARCH_DIRS - variable. (Bug 232270) - -2008-07-18: Paul Varner - * equery: Remove prefixed '+/-' signs from IUSE for equery uses - command. (Bug 232019) - -2008-07-09: Paul Varner - * revdep-rebuild: Fix revdep-rebuild to use TMPDIR instead of HOME for - temporary files. (Bug 203414) - * revdep-rebuild: Fix revdep-rebuild to not evaluate broken objects - multiple times. (Bug 220761) - -2008-07-09: Paul Varner - * gentoolkit: Fix gentoolkit to work without thread support in - python. (Bug 223255) - -2008-06-16: Marius Mauch - * euse: Add support for multi-parent profiles, account for missing - final newline in make.conf - -2008-03-19: Paul Varner - * glsa-check: Fix imports so mail functionality in glsa-check works - with python versions less than 2.5 (Bug 211706) - -2008-03-13: Paul Varner - * euse: Add --info-installed option from patch provided by Andreas - Waidler. (Bug 212573) - -2008-03-13: Paul Varner - * revdep-rebuild: Fix trying to emerge an empty list of packages. (Bug - 213294) - -2008-02-28: Paul Varner - * gentoolkit: Fix traceback when accessing the portage - db. (Bug #211716) - -2008-02-21: Paul Varner - * revdep-rebuild: "Use /etc/init.d/functions.sh instead of - /sbin/functions.sh. (Bug 210940) - -2008-02-18: Paul Varner - * revdep-rebuild: Apply patch to allow combined short options. - (Bug 188343) - * revdep-rebuild: Don't duplicate broken file output. (Bug 201319) - * revdep-rebuild: unset GREP_OPTIONS to prevent problems with grep. - (Bug 189257) - * revdep-rebuild: Apply patch to prevent false matches of object names. - (Bug 196460) - * revdep-rebuild: Apply patch to better handle masked and removed - packages. (Bug 205227) - * revdep-rebuild: Filter SEARCH_DIRS_MASK paths from SEARCH_DIRS. - (Bug 194993) - * revdep-rebuild: Apply patch for revdep-rebuild portable find function. - (Bug 194234) - * equery: Fix equery list to not generate an internal portage error when - fed input with too many slashes. (Bug 119806) - * equery: Assume the -p flag when equery list -I is used by itself. - (Bug 106278) - - -2007-10-09: Marius Mauch - * glsa-check: Change "affected" target so it's based on "new" instead of - "all" (IOW: exclude already applied/injected GLSAs). - -2007-10-05: Marius Mauch - * glsa-check: Use UTF-8 strings to avoid EncodeErrors if a GLSA contains - non-ascii characters (bug #162493) - -2007-09-19: Paul Varner - * epkginfo: Fix handling of KEYWORDS="" in an ebuild. (Bug #193108) - * revdep-rebuild: Fix handling of /var/db/pkg when it is a symbolic - link. (Bug #179392) - -2007-09-18: Paul Varner - * equery: Apply patch from Carlo Marcelo Arenas Belon to fix incorrect - display of masking status in list command. (Bug #188678) - * revdep-rebuild: Correctly handle LD_LIBRARY_MASK when checking for - "no version information" errors/ (Bug #182882) - -2007-09-12: Paul Varner - * eclean: Fix processing of the long arguments to work correctly. (Bug - #192345) - * revdep-rebuild: Correctly handle the case where an ebuild no longer - exists for a package (Bug #188918) - * eread: Fix eread to not accept invalid input for file selection. - (Bug #189994) - -2007-08-08: Paul Varner - * revdep-rebuild: Fix progress bar to only update when there is a - change (Bug #186945) - * revdep-rebuild: Ensure that we source functions.sh before calling - ewarn, etc. - -2007-08-06: Paul Varner - * revdep-rebuild: Fix processing of .la files (Bug #187453) - * revdep-rebuild: Add -X option back for backwards compatibilty (Bug - #187366) - -2007-07-30: Paul Varner - * revdep-rebuild: Fix grepping for non-existant package-owners file - (Bug #187141) - -2007-07-05: Paul Varner - * revdep-rebuild: Added refactored revdep-rebuild from Michael A. - Smith (Bug #184042) - -2007-05-30: Marius Mauch - * glsa-check: check SLOT when selecting and displaying upgrades - * glsa-check: new --emergelike option to use the best version - within the same SLOT instead of the one with the smallest delta. - * glsa-check: prefer visible upgrades to masked upgrades - * equery: check for and warn about unknown options (bug 119674) - * equery,eclean,glsa-check,epkginfo: Only add /usr/lib/portage/pym - to python search path when necessary - -2007-05-21: Paul Varner - * echangelog: Add patch from genstef to fix issues from Bug 176337 - -2007-05-11: Paul Varner - * eclean: Changed permission check to see if you are either root or - belong to the portage group (Bug #177385) - -2007-05-11: Paul Varner - * eclean: Updated eclean to not delete metadata.dtd by default (Bug - #176951) - -2007-05-10: Marius Mauch - * euse: Fix incorrect flag status display when a flag appears multiple - times in a single location - -2007-04-25: Paul Varner - * echangelog: Re-added subversion/git support with fixes from genstef. - (Bug #136048) - -2007-04-24: Paul Varner - * etcat: Removed from Makefile (deprecated since 04-25-2005) - * qpkg: Removed from Makefile (deprecated since 04-25-2005) - -2007-04-23: Paul Varner - * genpkgindex, epkginfo: Move to /usr/bin from - /usr/lib/gentoolkit/bin (Bug #175759) - -2007-04-10: Paul Varner - * equery: Change equery uses to command to display the best matching - uninstalled package version if an uninstalled package is specified. - Changed the meaning of -a to mean display all versions. (Bug #152325) - -2007-04-01: Alec Warner - * eread: Fix path and fully qualified paths (Bug #172969) - -2007-03-31: Paul Varner - * equery: Fix traceback in equery which (Bug #134053) - -2007-03-29: Paul Varner - * gentoolkit: Change package.get_???_deps() methods to try the portage - tree first, since emerge always uses the portage tree for dependencies. - (Bug #164678) - -2007-03-29: Paul Varner - * equery: Convert deprecated strings functions to str methods (Bug - #172694) - -2007-03-25: Paul Varner - * echangelog: Remove subversion/git patch due to many bugs. - -2007-03-18 Paul Varner - * revdep-rebuild: Change --no-color to --nocolor for consistency - within gentoolkit. (Bug #165165) - -2007-03-16 Paul Varner - * gentoolkit: Fix typo in package.py (Bug #168347) - -2007-03-15 Paul Varner - * equery: Fix equery check to not fail for symlinks prefixed with ./ - (Bug #170702) - -2007-03-14 Paul Varner - * equery: Trim trailing slash from query for equery belongs command - (Bug #170981) - -2007-03-13 Paul Varner - * revdep-rebuild: Fix bug with --package-names option not rebuilding - packages (Bug #169761) - -2007-03-10 Paul Varner - * equery: Add --depth option to equery depgraph to limit the depth of - the dependency graph. (Bug #115807) - -2007-03-09 Paul Varner - * revdep-rebuild: Add support to detect "no version information - available" message from ldd (Bug #169973) - -2007-03-08 Paul Varner - * equery: Improved handling of KeyError in equery depends command - (Bug #169929) - -2007-03-07 Paul Varner - * revdep-rebuild: Change ordering algorithm to use --deep instead of - --emptytree on the advice of zmedico - -2007-02-26 Marius Mauch - * glsa-check: Display access information in verbose list mode (bug 168482) - -2007-02-19 Paul Varner - * echangelog: Updated to support git and subversion (Bug #136048) - -2007-01-10 Paul Varner - * epkgmove: removed epkgmove command due to popular demand. (Bug - 161360) - * gensync: Deprecated gensync in favor of app-portage/layman (multiple - bugs) - -2007-01-02 Paul Varner - * equery: Fix equery depends --indirect command. (Bug #124552) - -2006-12-31 Paul Varner - * equery: Reworked equery depends command to be more accurate. - -2006-12-13 Paul Varner - * revdep-rebuild: Fix handling of /etc/portage/package.mask (Bug - #158025) Thanks to Wolfram Schlich for the patch. - -2006-12-12 Paul Varner - * equery: Add --tree option to equery files command. (Bug #62898) - Thanks to scope for the patch. - -2006-12-06 Paul Varner - * equery: Modify equery size command to work like the equery list - command for pkgspec arguments - -2006-11-27 Paul Varner - * eclean: Fix typographical error in help and man page. (Bug #156243) - -2006-10-11 Paul Varner - * equery: Fix fileAsStr to understand device files. - (http://forums.gentoo.org/viewtopic-p-3639575.html) - -2006-10-07 Paul Varner - * euse: Fix quoting bug in get_real_path() (Bug #150335). - -2006-09-21 Paul Varner - * eread: Add eread script for reading and managing portage ELOG files. - Thanks to Donnie Berkholz for writing this. - -2006-09-03 Paul Varner - * revdep-rebuild: Remove unused environment variables before calling - emerge (Bug #142074). Check for permissions to write temporary files - (Bug #142308) - -2006-08-12 Marius Mauch - * glsa-check: Add new --mail option to send out vulnerability reports - (output of --list plus --dump for each matched glsa as attachment), - using elog configuration. - -2006-07-31 Paul Varner - * euse: Replace calls to readlink with bash function for Gentoo/ALT - compatibility. (Bugs #140477, #128960) - -2006-07-28 Paul Varner - * revdep-rebuild: Fix revdep-rebuild to correctly handle --ask being - passed to emerge. Thanks to Sal Gonzalez for - the patch. (Bug #37485) - -2006-07-07 Paul Varner - * revdep-rebuild: Rename --no-path to --no-ld-path and change - functionality to not set LD_LIBRARY_PATH. This fixes bug #96946 as - well as bug #137313 - * revdep-rebuild: Apply patch from truedfx to fix bug #38751 - -2006-07-05 Paul Varner - * revdep-rebuild: Add --no-path option to revdep-rebuild for bug - #137313 - -2006-06-25 Marius Mauch - * glsa-check: update cve code for bug 128115 - -2006-06-14 Paul Varner - * gentoolkit: Fix package.py to honor $ROOT. (bug #136811) - -2006-05-22 Paul Varner - * revdep-rebuild: Use qfile to locate packages if portage-utils is - installed (Bug #128374). Be even more paranoid about extra slashes in - path names (Bug #128108). Remove unused code. Update configuration - section of manpage (Bug #126038). - -2006-04-02 Paul Varner - * revdep-rebuild: Remove double-slashes from path names (Bug #128108) - -2006-04-01 Paul Varner - * revdep-rebuild: Add fix so that packages no longer in the tree cause - errors (Bug #128174). Fix case where masked packages cause - revdep-rebuild to not rebuild any packages (Bug #128085) - -2006-03-29 Marius Mauch - * euse: Add support for special %active argument as placeholder for - active use flags - -2006-03-26 Aron Griffis - * echangelog: Don't warn about missing ebuilds when updating - copyrights #120061 - -2006-03-25 Aron Griffis - * eviewcvs: Update for sources.gentoo.org, add subversion support - -2006-03-21 Paul Varner - * revdep-rebuild: Fix to clear environment before portageq call. (Bug - #126038) - -2006-03-08 Paul Varner - * genpkgindex: Add binary package indexing utility. (Bug 82132) - -2006-03-01 Paul Varner - * gentoolkit: Fix depends parsing to properly handle conjunction. (bug - #123725). Thanks to tgl for the patch. - * gentoolkit: Added function to get post-merge dependencies (PDEPEND) - (bug #99191) - * gentoolkit: Change get_dependency functions to always use the - portage tree - * equery: Added post-merge dependencies to depends and depgraph - actions. (bug #99191) - * equery: Removed requirement for package to be installed to use - depgraph action. - -2006-02-16 Marius Mauch - * euse: add/remove use flags even if there is no USE= statement in make.conf - (bug #95432) - -2006-02-16 Marius Mauch - * glsa-check: Fix bug causing the wrong summary to be displayed - for --test --verbose (bug #123084) - -2006-02-06 Paul Varner - * revdep-rebuild: Reset PORTAGE_NICENESS, so that emerge is not niced - twice. Thanks to Lukas Reck for the patch. (Bug 121482) - -2006-01-24 Marius Mauch - * glsa-check: Use vbd information in verbose list mode (patch by solar) - -2006-01-18 Paul Varner - * revdep-rebuild: Add capability to check libtool .la files for - non-existant references. - -2006-01-06 Paul Varner - * revdep-rebuild: Fix revdep-rebuild to play nicely with portage-2.1 - (Bug 118124) - -2005-12-28 Paul Varner - * revdep-rebuild: Fix to automatically determine how to call find (Bug 111203) - -2005-12-19 Paul Varner - * eclean: Add regular expression matching for exclude files (Bug 114365) - -2005-12-13 Paul Varner - * equery: Fix USE flag parsing. (Bug 115294) - -2005-12-07 Paul Varner - * revdep-rebuild: Fix revdep-rebuild to work with findutils-4.2.27. - (bug 111203) - * equery: Added note to error message about quoting redirection - characters. (Bug 113423) - * gentoolkit: Removed python-config call from make file. (Bug 113386) - -2005-11-23 Paul Varner - * equery: Changed default behavior for equery list to search for - partial name matches. Added equery list examples to the equery man - page. (Bugs 113032, 113134) - -2005-11-15 Marius Mauch - * glsa-check: Changed several messages to stderr instead of stdout - * glsa-check: Added new --cve option as requested by solar (bug 98589) - * glsa-check: Added support for a EMERGE_OPTS env variable to modify the emerge call of glsa-check --fix - * glsa-check: Added a new target "affected" - * glsa-check: Removed the warning message as it is now pretty much tested - * glsa-check: Show GLSA title on --test if --verbose is also used - -2005-11-11 Paul Varner - * equery: Added sanity check to equery files (Bug 75983) - * equery: Fix string matching for equery depends (Bug 85653) - * gentoolkit: Fix package.size() to report correct size for symbolic - links (Bug 90384) - * equery: Fix equery depgraph to show all dependencies (Bug 99191) - * equery: Fix traceback with invalid regular expression for equery - list (Bug 109392) - -2005-11-04 Paul Varner - * equery: Fix equery belongs to correctly work when passed an argument - list of multiple files (Bug 111501) - -2005-11-02 Paul Varner - * revdep-rebuild: Fix to work with findutils-4.2.25 (Bug 111203) - -2005-10-18 Paul Varner - * equery: Make equery look at both DEPEND and RDEPEND for dependencies - * gentoolkit: Fix _parse_deps to understand || syntax (Bug 101377) - -2005-10-14 Paul Varner - * equery: Add qpkg --dups functionality to equery list command (bug - 109156) - -2005-10-13 Paul Varner - * equery: equery depgraph shows USE flags (Bug 74554) - * equery: equery should properly parse use.local.desc (Bug 74569) - * equery: equery list escapes regular expressions (Bug 77113) - * equery: equery uses displays flags correctly (Bug 86633) - * equery: equery -N option to disable pipe detection (Bug 90046) - * equery: equery list properly detects version string (Bug 91286) - * equery: equery belongs now requires a filename (Bug 94618) - * equery: equery files over a pipe only prints file names (Bug 100148) - * revdep-rebuild: Fix typo in man page (Bug 109147) - -2005-09-25 Paul Varner - * revdep-rebuild: Update to read configuration files from - /etc/revdep-rebuild - -2005-09-23 Paul Varner - * equery: Sort output from equery list (bug 67152) - * equery: Update man page (Bugs 73893, 74944) - * equery: equery which returns best-visible ebuild (bug 78687) - * equery: equery --quiet is actually quiet (bug 78921) - * equery: Fixed typo in equery -h (bug 82352) - * gentoolkit: gentoolkit now uses a single portage.config object (bug - 90680) - * equery: equery uses returns unique, sorted list (bug 91623) - * equery: equery always honors nocolor flag and settings (bug 98634) - -2005-09-08 Paul Varner - * eclean: Inital commit of eclean 0.4.1 from Thomas de Grenier de - Latour (tgl) (bug 33877) - -2005-06-28 Paul Varner - * revdep-rebuild: Revert fix for bug 93574 as it can cause packages to - be missed. (bug 97171) - -2005-06-07 Paul Varner - * revdep-rebuild: Delete temporary files if the environment does not - match the previous environment (bug 95274) - -2005-06-05 Paul Varner - * revdep-rebuild: Imported revdep-rebuild release from bug 62644 - * revdep-rebuild: Major changes to the functionality when using - --package-names/-X The script should now update slotted packages - correctly. (bug 22161) - * revdep-rebuild: Customizable searching controlled through environment - variables. This removes the need for end users to directly modify the - script. (bugs 32276, 38011, 59803) - * revdep-rebuild: The directories to search are no longer hard coded - into the script. revdep-rebuild now determines the directories to - search based upon /etc/profile.env and /etc/ld.so.conf. (bugs 32276, - 38011, 89781) - * revdep-rebuild: --ignore option to ignore temporary files left from - previous runs. Automatically ignore temporary files older than 24 hours. - (bug 34052) - * revdep-rebuild: Always return an exit status based upon success or - failure. (bug 38472) - * revdep-rebuild: Fixed to only emerge packages with direct missing - dependencies. (bug 38487) - * revdep-rebuild: New man page. (bug 40042) - * revdep-rebuild: emerge is no longer called with --nodeps. This allows - for needed dependencies to be pulled in. (bug 62893) - * revdep-rebuild: Cleaned up grammatical errors (bug 85278) - * revdep-rebuild: Added support for revdep-rebuild --soname - /path/to/library.so (bug 91503) - * revdep-rebuild: Removed symbolically linked directories from search - (bug 93574) - * revdep-rebuild: --nocolor option to turn off colored output, the - script also obeys the NOCOLOR setting from /etc/make.conf. - * revdep-rebuild: Removed dependency on qpkg - * revdep-rebuild: Script uses PORTAGE_NICENESS from /etc/make.conf - * revdep-rebuild: Undocumented --keep-temp option. This is primarily - for debugging/testing. This option prevents temporary files from being - deleted. - * revdep-rebuild: Changed --soname --soname-regexp options to --library - and treat all arguments as basic regular expressions. --soname and - --soname-regexp can still be used as options for backwards - compatability. - * revdep-rebuild: Removed requirement to keep revdep-rebuild and emerge - options distinct. Options that are unrecognized by revdep-rebuild are - passed directly to emerge. - -2005-04-30 Marius Mauch - * glsa-check: add V to short option list so it actually works - * equery: added new option --name-only to belongs command to make it - "emerge-compatible" - -2005-04-26 Marius Mauch - * gentoolkit: fix broken Makefile - * gentoolkit: add some sticky tape to get the stupid thing working again - * equery: fix a few minor problems - -2005-04-25 Marius Mauch - * qpkg: moving to /usr/share/doc/gentoolkit-*/deprecated - * etcat: moving to /usr/share/doc/gentoolkit-*/deprecated - * revdep-rebuild: replacing qpkg call with equivalent grep/sed call - -2005-04-07 Marius Mauch - * euse: fixed bugs 74344, 75525 and 84521 - * euse: add better support for cascaded profiles - * glsa-check: use --oneshot (bug 79819) - * glsa.py: fix stupid revision comparison bug (bug 75233) - -2005-03-12 Aron Griffis - * Added eviewcvs to -dev, utility for generating viewcvs URLs - -2005-03-01 Karl Trygve Kalleberg - * Dropped epkgmove from the -dev - * Released gentoolkit-dev-0.2.3 - -2005-03-01 Karl Trygve Kalleberg - * Released gentookit-dev-0.2.2 - -2004-12-09 Marius Mauch - * glsa.py: Another stupid bug, this time revisionMatch() broke as - ~foobar-rN isn't valid anymore - -2004-12-08 Marius Mauch - * equery: implemented the --category option - * glsa-check: fixed the bug where it wanted to unnecessary merge masked - packages - * glsa-check: added a check to verify that all non-option arguments are - valid GLSAs - * glsa.py: changed the outfile parameter in Glsa.dump() to outstream so - we don't have to open/close a file which breaks pipes - * glsa.py: checks now for python versions below 2.3 and throws an - exception - -2004-11-29 Karl Trygve Kalleberg - * branched v0-3-0: major rework in equery is in progess. the main - branch is reserved for minor and incremental fixups. - -2004-10-20 Karl Trygve Kalleberg - * release.sh: New script that automates the relase of a new gentoolkit - relase. Only works for gentoolkit-dev at the moment. - * src/echangelog/Makefile: Fixed spurious '}' - * Released gentoolkit-dev-0.2.1 - -2004-10-31 Marius Mauch - * qpkg: security fix for bug #68846 - -2004-10-20 Karl Trygve Kalleberg - * etcat: fixed get_use_vars to get_use_flags, fixes #67349. - -2004-10-18 Karl Trygve Kalleberg - * gentoolkit: collapsed ChangeLog into base ChangeLog - * gentoolkit: reverted indenting back to tabs, due to loud protests - from Marius;) - * equery: collapsed ChangeLog into base ChangeLog - * equery: reverted indenting back to tabs, due to loud protests from - Marius;) - * equery: minor syntactical cleanups. - * equery: minor documentation improvements - * equery: added errors module that will hold various types of internal - errors raised. - * equery: added try block around on md5sum check, which fails on various - conditions like insufficient permission or stale temporary checksum - files. - -2004-10-17 Marius Mauch - * equery: fix for bug #67473 (checking md5sums of prelinked binaries) - * equery: fix for bug #67275 (--nocolor didn't work as configure was - called before parsing the arguments - * equery: changed defaults for `equery depends` as making a depgraph for - the full portage tree isn't a good idea and find_all_packages() uses way - to much memory currently - * euse: replaced the old perl version with a newly written bash version. - -2004-10-12 Marius Mauch - * equery: fix for bug #67210 - -2004-10-10 Marius Mauch - * Removed old-scripts directory from gentoolkit - * euse: added a errormessage that it doesn't support cascading profiles - * equery: small bugfixes - * equery: performance speedup for `equery belongs` by using portage - directly - * equery: added MD5 verification to `equery check` - * equery: renamed 'hasuses' to 'hasuse' - * equery: added filter patch for `equery files` from bug 43422, thanks - to degrenier@easyconnect.fr - * Released gentoolkit-0.2.0_pre10 - -2004-10-10 Karl Trygve Kalleberg - * equery: Added unit tests for all supported commands - * equery: Fixed printing order and recognition of overlay, #53432. - -2004-10-11 Karl Trygve Kalleberg - * gentoolkit: Split gentoolkit.py into helpers.py and package.py - -2004-10-10 Karl Trygve Kalleberg - * gentoolkit: Fixed Makefiles to work with posix-compatible shells - * gentoolkit: Fixed is_overlay() to report properly, #53432. - -2004-10-06 Marius Mauch - * glsa.py: Convert Unicode strings to ascii before passing them to - portage - * glsa.py: Some formatting fixes for dump() - * glsa.py: changed the matching routines so the reports are hopefully - more accurate - * glsa-check: added color support - * glsa-check: added a --verbose option to show the warnings about - invalid GLSAs - -2004-09-30 Karl Trygve Kalleberg - * equery: Added unit tests for --help - * equery: Added unit tests for 'files' - -2004-09-27 Karl Trygve Kalleberg - * gentoolkit: Added find_installed_packages - * equery: Added short commands - * equery: Fixed copyright dates - * equery: Fixed belongs to search only installed packages - * equery: Fixed reporting bug in uses command - * equery: Fixed reference to cppv - * equery: Added import of die - * equery: Added searching header to uses - * equery: Fixed hasuses to report properly - * Released gentoolkit-0.2.0_pre9 - * Released gentoolkit-dev-0.2.0_pre4 - -2004-09-08 Karl Trygve Kalleberg - * equery: Added man page rewrites by Katerina Barone-Adesi - , fixes #63045 - * equery: Fixed spacing issues with files, fixes #63036. - * equery: Added depends command by Olivier Crete , - fixes #40830. - * equery: Reworked output yet again. - * equery: Belongs handles multiple files on the command line, partially - fixes #62361. - * gentoolkit: Reworked printing functions - -2004-08-29 Karl Trygve Kalleberg - * gentoolkit: Added printing functions - * equery: Added check for bad regexp in belongs, fixes #58494 - * equery: Added proper error reporting to stderr, fixes #57580 - -2004-08-22 Karl Trygve Kalleberg - * gentoolkit: Fixed Package.get_env_var to use the correct tree db. - * gentoolkit: Renamed Package.get_use_vars to Package.get_use_flags - * equery: Searches now include masked packages, when installed. - * equery: Fixed output to be piping-friendly - * equery: Added -N option to force non-piping output - * equery: Added hasuses command - -2004-08-01 Marius Mauch - * Fixed grep expression for `qpkg -f` - -2004-05-04 Karl Trygve Kalleberg - * equery: Added a -f/--full-regex option to belongs and some logic so - users can do belongs ant, belongs /usr/bin/ant and belongs -f ".*ant.*" - while getting sensible results. Fixes #37637. - -2004-04-14 Karl Trygve Kalleberg - * Released gentoolkit-dev-0.2.0_pre3 - -2004-03-31 Marius Mauch - * glsa-check: updates, fixing #45528 and #45522, adding support for rXX - operators and passing filenames as arguments to Glsa() - -2004-03-13 Marius Mauch - * Added glsa-check and glsa.py, please note: - - they are only temporary for testing, so no manpage/ChangeLog - - their CVS home is in gentoo-projects - * fixed bugs #42160, #40935, #43389 - * equery: fixing descriptions for local USE flags - * equery: more checking on exceptions - -2004-02-08 Karl Trygve Kalleberg - * Added ebump - * Added gensync - * Added epkgmove, closes #36663. - -2004-02-06 Marius Mauch - * fixed bugs #40159, #39798, #39652, #39596, #39293 - * changed etcat and equery behavior for ambigous package names, - they now return values for all matching packages rather - than erroring out - * added "will be phased out" messages to etcat and qpkg - -2004-01-23 Marius Mauch - * lots of bugfixes - * equery: now catches Exceptions thrown by portage - * equery: minor bugfixes - -2004-01-14 Karl Trygve Kalleberg - * Added src/ego to gentoolkit-dev - -2004-01-12 Marius Mauch - * equery: added mask, keyword and slot information to list command - * equery: fixed traceback in equery - * equery: added more information on "equery list" - -2004-01-10 Karl Trygve Kalleberg - * Added src/ego - -2004-01-07 Karl Trygve Kalleberg - * equery: Added Makefile - * Added new build system - * Added src/old-scripts, the scripts from app-portage/gentoolkit - * Renamed gentool to equery - * Released 0.2.0_pre1 - -2003-12-31 Karl Trygve Kalleberg - * equery: Added which command - * equery: Added check command (not finished) - -2003-12-12 Karl Trygve Kalleberg - * equery: Added size command - * equery: Added depgraph command - -2003-12-11 Karl Trygve Kalleberg - * equery: Added list command - * equery: Added uses command - -2003-12-08 Karl Trygve Kalleberg - * Removed emerge-rsync, emerge-webrsync - * Added moo - * Added skeleton man pages to all packages - * Added Makefile - -2003-10-05 Karl Trygve Kalleberg - * equery: Added files command - * equery: Added belongs command - -2003-10-04 Karl Trygve Kalleberg - * Rewrote dep-clean to python - -2003-06-31 Karl Trygve Kalleberg - * Rewrote more of etcat; many of the functions now employ - gentoolkit. - * Replaced qpkg with stubs of a reimplementation in python. - -2003-06-27 Karl Trygve Kalleberg - * Added patch to echangelog to consider PORTDIR, fixes #23881. - -2003-06-26 Karl Trygve Kalleberg - * Added echangelog, by agenkin - * Added ekeyword, by agenkin - * Added gentoolkit, the common python library for all Gentoolkit tools. - * Revived pkg-size as a testbed for the gentoolkit library - * Fixed some minor issues in qpkg - * Added revdep-rebuild-1 - * Added revdep-rebuild-2 - * Restructuring etcat - * Fixed some minor issues in dep-clean - -2002-11-21 Karl Trygve Kalleberg - * Renamed pkg-size to gentool-package-size - * Renamed pst-package-count to gentool-package-count - * Retired rest of pst-* stuff - -2002-08-06 Karl Trygve Kalleberg - * Created separate CVS module for Gentoolkit - * Restructured directory hierarchy diff --git a/trunk/Makefile b/trunk/Makefile deleted file mode 100644 index 3906c52..0000000 --- a/trunk/Makefile +++ /dev/null @@ -1,85 +0,0 @@ -# Copyright 2003-2004 Karl Trygve Kalleberg -# Copyright 2003-2004 Gentoo Technologies, Inc. -# Distributed under the terms of the GNU General Public License v2 -# -# $Header$ - -include makedefs.mak - - -all: - echo "YARMOUTH (vb.) To shout at foreigners in the belief that the louder you speak, the better they'll understand you." - echo $(PYVERSION) - echo $(VERSION) - echo $(docdir) - echo $(bindir) - echo $(sbindir) - echo $(mandir) - -clean: - rm -rf release/* - -dist: - echo "Error: Must use either dist-gentoolkit or dist-gentoolkit-dev" - exit 1 - -dist-gentoolkit-dev: - mkdir -p release/gentoolkit-dev-$(VERSION)$(RELEASE_TAG) - for x in ekeyword echangelog ego ebump gensync eviewcvs ; do \ - ( cd src/$$x ; $(MAKE) distdir=release/gentoolkit-dev-$(VERSION)$(RELEASE_TAG) dist ) \ - done - cp Makefile AUTHORS README README.Developer TODO COPYING NEWS ChangeLog release/gentoolkit-dev-$(VERSION)$(RELEASE_TAG)/ - cat makedefs.mak | \ - sed "s/^VERSION=.*/VERSION=$(VERSION)/" | \ - sed "s/^RELEASE_TAG=.*/RELEASE_TAG=$(RELEASE_TAG)/" | \ - sed "s:^docdir=.*:docdir=\$$(DESTDIR)/usr/share/doc/gentoolkit-dev-\$$(VERSION)\$$(RELEASE_TAG):" \ - > release/gentoolkit-dev-$(VERSION)$(RELEASE_TAG)/makedefs.mak - ( cd release ; tar zcf gentoolkit-dev-$(VERSION)$(RELEASE_TAG).tar.gz gentoolkit-dev-$(VERSION)$(RELEASE_TAG)/ ) - -dist-gentoolkit: - mkdir -p release/gentoolkit-$(VERSION)$(RELEASE_TAG) - rm -rf release/gentoolkit-$(VERSION)$(RELEASE_TAG)/ - for x in eclean equery eread euse gentoolkit revdep-rebuild glsa-check genpkgindex epkginfo; do \ - ( cd src/$$x ; $(MAKE) distdir=release/gentoolkit-$(VERSION)$(RELEASE_TAG) dist ) \ - done - cp Makefile AUTHORS README TODO COPYING NEWS ChangeLog release/gentoolkit-$(VERSION)$(RELEASE_TAG)/ - cp src/99gentoolkit-env release/gentoolkit-$(VERSION)$(RELEASE_TAG)/src/ - cat makedefs.mak | \ - sed "s/^VERSION=.*/VERSION=$(VERSION)/" | \ - sed "s/^RELEASE_TAG=.*/RELEASE_TAG=$(RELEASE_TAG)/" \ - > release/gentoolkit-$(VERSION)$(RELEASE_TAG)/makedefs.mak - ( cd release ; tar zcf gentoolkit-$(VERSION)$(RELEASE_TAG).tar.gz gentoolkit-$(VERSION)$(RELEASE_TAG)/ ) - -install: - echo "Err0r: Must use either install-gentoolkit or install-gentoolkit-dev" - exit 1 - -install-gentoolkit: - - install -d $(docdir) - install -d $(bindir) - install -d $(sbindir) - install -d $(mandir) - install -d $(sysconfdir)/env.d - - install -m 0644 AUTHORS ChangeLog COPYING NEWS README TODO $(docdir)/ - install -m 0644 src/99gentoolkit-env $(sysconfdir)/env.d/ - - for x in eclean equery eread euse gentoolkit revdep-rebuild glsa-check genpkgindex epkginfo; do \ - ( cd src/$$x ; $(MAKE) DESTDIR=$(DESTDIR) install ) \ - done - - -# FIXME: If run from the CVS tree, the documentation will be installed in -# $(DESTDIR)/usr/share/doc/gentoolkit-$(VERSION), not gentoolkit-dev-$(VERSION) -install-gentoolkit-dev: - - install -d $(docdir) - install -d $(bindir) - install -d $(mandir) - - install -m 0644 AUTHORS ChangeLog COPYING NEWS README README.Developer TODO $(docdir)/ - - for x in ekeyword echangelog ego ebump gensync eviewcvs ; do \ - ( cd src/$$x ; $(MAKE) DESTDIR=$(DESTDIR) install ) \ - done diff --git a/trunk/NEWS b/trunk/NEWS deleted file mode 100644 index e69de29..0000000 diff --git a/trunk/README b/trunk/README deleted file mode 100644 index 5c785d3..0000000 --- a/trunk/README +++ /dev/null @@ -1,46 +0,0 @@ -Package: gentoolkit/gentoolkit-dev -Authors: Aron Griffis - Brandon Low - Ian Leitch - Karl Trygve Kalleberg - Marius Mauch - Paul Varner - See src//AUTHORS for tool-specific authors - -MOTIVATION - -The gentoolkit and gentoolkit-dev packages contain a collection of useful -administration scripts particular to the Gentoo Linux distribution. It contains -rough drafts and implementations of features that may in time make it into -Portage, or into full-fledged tools in their own right. - -The gentoolkit-dev package is intended primarily for Gentoo developers. - -CONTENTS - -gentoolkit -========== -eclean - tool to clean up outdated distfiles and packages -equery - replacement for etcat and qpkg -etcat - extracts auxillary information from portage (deprecated) -euse - tool to manage USE flags -glsa-check - tool to manage GLSA's (Gentoo Linux Security Advisory) -qpkg - convient package query tool (deprecated) -revdep-rebuild - scans/fixes broken shared libs and binaries - -gentoolkit-dev -============== -ebump - Ebuild revision bumper -echangelog - update portage ChangeLogs -ego - -ekeyword - modify package KEYWORDS -epkgmove - tool for moving and renaming packages in CVS -eviewcvs - generate viewcvs URLs -gensync - Overlay Sync Tool - -IMPROVEMENTS - -Any suggestions for improvements should be sent to tools-portage@gentoo.org, or -added as a bug assigned to us. - -We only accept new contributions if they are written in bash or python. diff --git a/trunk/README.Developer b/trunk/README.Developer deleted file mode 100644 index 6c48c84..0000000 --- a/trunk/README.Developer +++ /dev/null @@ -1,65 +0,0 @@ - -OVERVIEW - -The SVN module 'gentoolkit' contains all the scripts and stuff for both the -gentoolkit and the gentoolkit-dev package. The gentoolkit-dev package is -an optional add-on, that is only intented for the Gentoo developers. - -STYLE POLICY - -If you're touching any of the python scripts please don't change the indentation -style (if it's using tabs, you should use tabs too). Especially don't mix -spaces and tabs as that makes the code completely unreadable. - -MAKING A RELEASE - -Releases should only be made by members of the tools-portage team. See -http://www.gentoo.org/proj/en/metastructure/herds/herds.xml?select=tools-portage -for who to contact on IRC, or shuffle over a bug report to us, or send -us a mail at tools-portage@gentoo.org if you need an immediate release. - -The release manager (big words;) will then do - -1) make VERSION=major.minor.patch RELEASE_TAG= dist-gentoolkit -2) copy release/gentoolkit-${VERSION}-${RELEASE_TAG}.tar.gz to - dev.gentoo.org/space/distfiles-local/ -3) make a new ebuild, app-portage/gentoolkit/gentoolkit-${VERSION}.ebuild - with a SRC_URI that points to - mirror://gentoo/gentoolkit-${VERSION}-${RELEASE_TAG}.tar.gz - (just use one of the previous ebuilds) - -The process is similar for gentoolkit-dev: - -1) make dist-gentoolkit-dev -2) copy dist/gentoolkit-dev-${VERSION}-${RELEASE_TAG}.tar.gz to emu -3) update app-portage/gentoolkit-dev - -Important! -1) _ALWAYS_ make sure you don't "overwrite" a previous release. Your - new VERSION must be newer than any previous released version. If you - mess up a release, don't overwrite with the same release number, iterate - the patch version and try again (and again, and again until you get - it right;) - - -MAKING A RELEASE WITH release.sh - -If you have added your system details at the top of the release.sh script, -you can make a release in the following fashion: - -(NOTE! This only works for -dev at the moment) - -1) Add a notice in the ChangeLog about the release you are making. -2) Do VERSION="x.y.z" ./release.sh dev -3) Test the package: ACCEPT_KEYWORDS="~arch" emerge gentoolkit-dev -4) Do a repoman ci -m "Released x.y.z" in your - CVS/app-portage/gentoolkit-dev directory. - - -Currently, the following people have "release access": - - - genone@gentoo.org - - fuzzyray@gentoo.org - -If you want a new release, ping either of us. If you want to get -"release access", talk to fuzzyray@gentoo.org diff --git a/trunk/TODO b/trunk/TODO deleted file mode 100644 index d39ea85..0000000 --- a/trunk/TODO +++ /dev/null @@ -1,40 +0,0 @@ -- equery: - - add --overlay, --portdir to uses - - add glsa pkgspec - - query for current GLSAs on installed package(s) - - add changelog [--last] [--lastentry] [--current] - - displays changelog entries - - add check [--full] [--display=pkgnames,full] - - check md5 and timestamps (optionally also in CONFIG_PROTECT dirs) - - add which - - as ewhich -- fully deprecate dep-clean and pkg-clean -- rewrite ekeywords and echangelog to use gentoolkit -- add deep depends to equery -- fully deprecate qpkg -- fully deprecate pkg-size -- merge change and echangelog -- merge useflag and euse, have _one_ command line tool - - update ufed to rely on the CLI tool - - update ufed to rely on generate-use - - merge generate-use and ufed? -- rewrite revdep-rebuild to use gentoolkit - - drop qpkg dependency; use equery instead -- rewrite distfiles-clean to use gentoolkit -- look through forums.gentoo.org for additional scripts -- write a Gentoolkit Guide -- write efeatures for turning on/off FEATURES in make.conf -- look at ekeys, ewatch -- revision bump tool - - bump versioned files in filesdir - - -m for changelog entry - - use ~/.gentoo/gentoolkit/ebump.conf - - use /etc/gentoolkit/ebump.conf -- should be removed: - - etc-update - - epm - - useflag -- add 'clean' target - -+ check esearch, eupdatedb: separate package for now - diff --git a/trunk/makedefs.mak b/trunk/makedefs.mak deleted file mode 100644 index efbc8ce..0000000 --- a/trunk/makedefs.mak +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright 2003 Karl Trygve Kalleberg -# Copyright 2003 Gentoo Technologies, Inc. -# Distributed under the terms of the GNU General Public License v2 -# -# $Header$ - -# Override this on command line when making a release, ie 'dist' - -VERSION=9.9.9 -RELEASE_TAG= -# python-config is not installed on all arches Bug #113386 -#PYVERSION="`python-config | sed 's/-l//' | sed 's/ -lm.*//'`" -PYVERSION="`LC_COLLATE=C; python -V 2>&1 | tr '[:upper:]' '[:lower:]' | sed -e 's/ //g;s/\([0-9]\.[0-9]\)\.[0-9]/\1/'`" -DESTDIR= - -docdir=$(DESTDIR)/usr/share/doc/gentoolkit-$(VERSION)$(RELEASE_TAG) -bindir=$(DESTDIR)/usr/bin -sbindir=$(DESTDIR)/usr/sbin -mandir=$(DESTDIR)/usr/share/man/man1 -sysconfdir=$(DESTDIR)/etc diff --git a/trunk/release.sh b/trunk/release.sh deleted file mode 100755 index 22313b4..0000000 --- a/trunk/release.sh +++ /dev/null @@ -1,89 +0,0 @@ -#! /bin/bash - -case $(whoami) in - karltk) - publish_path=dev.gentoo.org:public_html/projects/gentoolkit/releases - publish_public_path="http://dev.gentoo.org/~karltk/projects/gentoolkit/releases" - portdir=/home/karltk/source/oss/gentoo/gentoo-x86/ - export ECHANGELOG_USER="Karl Trygve Kalleberg " - ;; - - port001) - publish_path=dev.gentoo.org:public_html/distfiles/gentoolkit/releases - publish_public_path="http://dev.gentoo.org/~port001/distfiles/gentoolkit/releases" - portdir=/home/port001/Gentoo/gentoo-x86/ - export ECHANGELOG_USER="Ian Leitch " - ;; - - genone) - publish_path=dev:public_html/distfiles/ - publish_public_path="http://dev.gentoo.org/~genone/distfiles/" - portdir=/home/gentoo/cvs/gentoo-x86/ - export ECHANGELOG_USER="Marius Mauch " - ;; - - agriffis) - publish_path=gentoo:public_html/dist/ - publish_public_path="http://dev.gentoo.org/~agriffis/dist/" - portdir=/home/agriffis/portage/ - ;; - - *) - echo "!!! Don't know who $(whoami) is, can't release" - exit 1 - ;; -esac - -function most-recent-ebuild() { - # FIXME: actually pick the most recent one - ls gentoolkit-dev-*.ebuild | tail -n 1 -} - -function release-dev() { - - echo "* Building .tar.bz" - make VERSION=${VERSION} RELEASE_TAG=${RELEASE_TAG} dist-gentoolkit-dev > /dev/null || exit - - echo "* Uploading .tar.bz" - scp release/gentoolkit-dev-${VERSION}${RELEASE_TAG}.tar.gz ${publish_path} || exit - - - echo "* Generating new ebuild" - - local ebuild="gentoolkit-dev-${VERSION}${RELEASE_TAG}.ebuild" - - cd ${portdir}/app-portage/gentoolkit-dev || exit - cp $(most-recent-ebuild) ${ebuild} - ekeyword ~all ${ebuild} - sed -i -e "s|SRC_URI=.*|SRC_URI=\"${publish_public_path}/\$\{\P\}.tar.gz\"|" ${ebuild} - - echo "* Generating digest" - ebuild ${ebuild} digest || exit - cvs add ${ebuild} || exit - echangelog "New upstream release" - echo '* Everything ready. You should:' - echo ' 1) ACCEPT_KEYWORDS="~x86" sudo emerge =gentoolkit-dev-${VERSION}${RELEASE_TAG}' - echo ' 2) repoman ci -m "New upstream release" from `pwd`' -} - - -if [ -z "${VERSION}" ] ; then - echo "!!! You must set the VERSION env var" - exit 1 -fi - -if [ -z "${RELEASE_TAG}" ] ; then - echo "No RELEASE_TAG found, presumably okay" -fi - - -if [ "$1" == "dev" ] ; then - release-dev -elif [ "$1" == "main" ] ; then - echo "!!! Unsupported atm, feel free to add code;)" - exit 1 -else - echo "!!! You must select to release either 'dev' or 'main', as parameter to release.sh" - exit 1 -fi - diff --git a/trunk/src/99gentoolkit-env b/trunk/src/99gentoolkit-env deleted file mode 100644 index 3933874..0000000 --- a/trunk/src/99gentoolkit-env +++ /dev/null @@ -1 +0,0 @@ -CONFIG_PROTECT_MASK="/etc/revdep-rebuild" diff --git a/trunk/src/change/AUTHORS b/trunk/src/change/AUTHORS deleted file mode 100644 index 4b3873a..0000000 --- a/trunk/src/change/AUTHORS +++ /dev/null @@ -1,5 +0,0 @@ -Dan Armak - * Basic idea - * Initial version -Karl Trygve Kalleberg - * Gentoolkit-specific changes diff --git a/trunk/src/change/ChangeLog b/trunk/src/change/ChangeLog deleted file mode 100644 index bd7d5dd..0000000 --- a/trunk/src/change/ChangeLog +++ /dev/null @@ -1,7 +0,0 @@ -2002-08-11 Dan Armak : - * Fix two bugs which are long to describe, so I won't do so here. - They caused malformed or incomplete changelog files to be created. - -2002-08-09 Karl Trygve Kalleberg : - * Reformatted usage to work with 80 columns - * Now loads ~/.gentoo/gentool-env instead of ~/.change diff --git a/trunk/src/change/README b/trunk/src/change/README deleted file mode 100644 index bda1842..0000000 --- a/trunk/src/change/README +++ /dev/null @@ -1,20 +0,0 @@ -Package : change -Version : 0.2.4 -Author : See AUTHORS - -MOTIVATION - -Maintaing Gentoo's ChangeLog files in the Portage Tree is a tedious affair. -Many of the details are well-defined enough for a tool to do. change is this -tool. - -MECHANICS - -change can create a ChangeLog, add entries to the ChangeLog file, scan for -updated files. - - -IMPROVEMENTS - -For improvements, send a mail to karltk@gentoo.org or make out a bug at -bugs.gentoo.org and assign it to me. diff --git a/trunk/src/change/change b/trunk/src/change/change deleted file mode 100644 index 094573b..0000000 --- a/trunk/src/change/change +++ /dev/null @@ -1,343 +0,0 @@ -#! /bin/bash - -# Copyright 1999-2002 Gentoo Technologies, Inc. -# Distributed under the terms of the GNU General Public License v2 -# Author: Dan Armak -# $Header: /space/gentoo/cvsroot/gentoolkit/src/change/change,v 1.2 2002/08/11 13:32:12 karltk Exp $ - -eval `grep PORTDIR= /etc/make.globals` -eval `grep PORTDIR= /etc/make.conf` -[ -z "$PORTDIR" ] && PORTDIR="/usr/portage" - -# register temp files (we delete them in the end) -TMPMESSAGE=`tempfile -p change` || cleanup 1 -TMPHEADER=`tempfile -p change` || cleanup 1 -TMPENTRY=`tempfile -p change` || cleanup 1 -TMPOLDLOG=`tempfile -p change` || cleanup 1 -TMPCHANGELOG=`tempfile -p change` || cleanup 1 - -# get user info from config file - $AUTHORNAME and $AUTHOREMAIL -init() { - . ~/.gentoo/gentool-env || return 1 -} - -print_about() { - - echo "change v 0.2.4 - A Gentoo ChangeLog editor." - echo "Author Dan Armak " -} - -print_usage() { - - echo "Usage: -change [-shv] [-m|--message msg] [-f|--message-file file] - [-a|--authorname name] [-l|--authormail mail] - [-n|--new-version ver] [-o|--output dest] - -: List of packages whose changelogs are to be edited. All -changelogs edited in one run will be added the same log message. - -Acceptable formats: Example: -category/package kde-base/kdebase -path to package dir kdebase || ../../kdebase -path to changelog file portage/kde-base/kdebase/ChangeLog - -Note that you must use -g for changelog files outside $PORTDIR. - --m, --message \"msg\" Use log message \"msg\", do not open editor. --f, --message-file Use contents of as log message, do not open - editor. --a, --authorname \"name\" Use \"name\" (e.g. Dan Armak) in log. --l, --authormail \"email\" Use \"email\" (e.g. danarmak@gentoo.org) in log. --n, --new-version \"ver\" Add a line about a new version number \"ver\" to - the log. --g, --generate Create a new changelog file if one does not exist. - This option must come before the list of affected - changelog files. Incidentally, this option also - enables you to work with a changelog file outside - $PORTDIR. - You must use it every time you edit such a file. - However, change won't be able to figure out the - category and package names of your changelog file - and those parts will be missing. (FIXME!) --o, --output \"file\" Save new changelog in file \"file\". - Default is the the same file we're changing (i.e. - no backup). --s, --stdout Print new changelog to stdout (disables saving to - file). This suppresses the usual info messages. --c, --changed-files List of changed files (goes into entry header). - Default is to simply say \"ChangeLog :\". Multiple - -c options can be given. --h, --help Print this usage information. --v, --version Print a short about line and the version number and - exit. - -See also the mandatory config file ~/.gentoo/gentool-env (the gentool-env man -page contains a template). -" - -} - -# parse command line parameters -# this function should be called before all others (e.g. before init()) -# or else it might stomp on some settings -parse_params() { - - # at least one parameter required - changelog to process - if [ -z "$1" ]; then - echo "At least one parameter is required." - print_about - print_usage - cleanup 1 - fi - - while [ -n "$1" ]; do - - # note: with parameters that come in two pieces (i.e. -m foo) - # we identify the first one, grab the second one from $2 and - # shift an extra time - case "$1" in - - # optional log message, if defined then we won't launch $EDITOR - # comes in explicit string and file reference variations - -m | --message) - MESSAGE="$2" - shift - ;; - -f | --message-file) - cp $2 $TMPMESSAGE - shift - ;; - - # general settings (usually set in .change) - -a | --authorname) - AUTHORNAME="$2" - shift - ;; - -l | --authormail) - AUTHOREMAIL="$2" - shift - ;; - - # add a line about a new version (starting with *) to the changelog - # to add the line but no changelog info, call with -n -m "" - -n | --new-version) - NEWVERSION="$2" - shift - ;; - - # create a new changelog file - -g | --generate) - GENERATE=true - ;; - - # output redirection. default (if $OUTPUT isn't set) is to change the - # specified changelog file. - # illegal if more than one changelog file/package is specified. - -o | --output) - OUTPUT="$2" - shift - ;; - # redirect output to stdout - can be combined with -o - -s | --stdout) - STDOUT="true" - OUTPUT="/dev/null" - ;; - - # list of files changed (second part inclosed in quotes!) - -c | --changed-files) - CHANGED="$CHANGED $2" - shift - ;; - - # request for version/usage information etc - -h | --help) - print_about - print_usage - cleanup 0 - ;; - -v | --version) - print_about - cleanup 0 - ;; - - # everything else we couldn't identify. most of it is packages/files to work on. - *) - for x in "$MYPORTDIR/$1/ChangeLog" "$PORTDIR/$1/ChangeLog" "$PWD/$1/ChangeLog" "$PWD/$1"; do - if [ -f "$x" ]; then - FILES="$FILES $x" - shift # because by calling continue we skip the shift at the end of the case block - continue 2 # next while iteration - fi - done - # if we haveb't detected a changelog file, maybe we need to create one - if [ -n "$GENERATE" ]; then - for x in "$PWD/$1" "$1" "$MYPORTDIR/$1" "$PORTDIR/$1"; do - if [ -d "$x" ]; then - touch $x/ChangeLog - FILES="$FILES $x/ChangeLog" - shift # because by calling continue we skip the shift at the end of the case block - continue 2 # next while iteration - fi - done - fi - - echo "!!! Error: unrecognized option: $1" - echo - print_usage - cleanup 1 - - ;; - - esac - - shift - done - - if [ -z "$FILES" ]; then - echo "No changelog path or package name passed, mandatory parameter missing." - echo - print_usage - cleanup 1 - fi - -} - -# get the log message -get_msg() { - - if [ -n "`cat $TMPMESSAGE`" ]; then - echo "Using message-on-file." - elif [ -n "$MESSAGE" ]; then - echo "$MESSAGE" > $TMPMESSAGE - else # [ -z "$MESSAGE" ] - - echo > $TMPMESSAGE - echo "Please enter changelog. You can leave this line, it will be automatically removed." >> $TMPMESSAGE - $EDITOR $TMPMESSAGE - cp $TMPMESSAGE ${TMPMESSAGE}2 - sed -e '/Please enter changelog. You can leave this line, it will be automatically removed./ D' \ - ${TMPMESSAGE}2 > $TMPMESSAGE - rm ${TMPMESSAGE}2 - - fi - - # break up into 80-character columns (actually 78 chars because we'll - # add two spaces to every line) - cp $TMPMESSAGE ${TMPMESSAGE}2 - fmt -s -w 78 ${TMPMESSAGE}2 > $TMPMESSAGE - rm ${TMPMESSAGE}2 - - # add two spaces to the beginning of every line of the message. - # do this separately from the sed in the else section above - # because it should be executed for the if and elif sections too. - cp $TMPMESSAGE ${TMPMESSAGE}2 - sed -e 's:^: :g' ${TMPMESSAGE}2 > $TMPMESSAGE - rm ${TMPMESSAGE}2 - -} - -# get list of files and wrap it in the following manner: -# 1 item on the first list and upto 80 chars on every other. -# also adds 2 spaces to the beginning of every line but the first. -wrap_list() { - - echo -n $1 - shift - - while [ -n "$1" ]; do - if [ -n "$LIST" ]; then - LIST="$LIST, $1" - else - echo , - LIST="$1" - fi - shift - done - LIST="$LIST :" - - echo $LIST | fmt -s -w 78 | sed -e 's:^: :g' - - -} - -# do the actual work on te changelog file passed as $1 -process() { - # figure out category and package names - name=${1//${PORTDIR}} - name=${name//${MYPORTDIR}} - name=${name//\/ChangeLog} - - OLDIFS="$IFS" - IFS="/" - for x in $name; do - if [ -z "$CATEGORY" ]; then - CATEGORY="$x" - else - PACKAGE="$x" - fi - done - IFS="$OLDIFS" - - # create header - echo \ -"# ChangeLog for $CATEGORY/$PACKAGE -# Copyright 2002 Gentoo Technologies, Inc.; Distributed under the GPL v2 -# \$Header: \$ -" > $TMPHEADER - - # create entry line - if [ -n "$NEWVERSION" ]; then - echo "*$PACKAGE-$NEWVERSION (`date '+%d %b %Y'`)" > $TMPENTRY - echo >> $TMPENTRY - fi - - echo -n " `date "+%d %b %Y"`; ${AUTHORNAME} <${AUTHOREMAIL}> " >> $TMPENTRY - [ -z "$CHANGED" ] && CHANGED="ChangeLog " - wrap_list $CHANGED >> $TMPENTRY - - echo >> $TMPENTRY - - # get the original changelog, minus the old header - sed -e '/^# ChangeLog for/ D - /^# Copyright 2002 Gentoo Technologies/ D - /^# \$Header:/ D' $1 > $TMPOLDLOG - - # join everything together - cat $TMPHEADER $TMPENTRY $TMPMESSAGE $TMPOLDLOG > $TMPCHANGELOG - - # various output options - if [ -n "$OUTPUT" ]; then - cp $TMPCHANGELOG $OUTPUT - [ -z "$STDOUT" ] && echo "New changelog saved in $OUTPUT." - else - cp $TMPCHANGELOG $1 - [ -z "$STDOUT" ] && echo "Original changelog $1 replaced." - fi - - if [ -n "$STDOUT" ]; then - cat $TMPCHANGELOG - fi - -} - -# pass exit code to this function -cleanup() { - - rm -f $TMPMESSAGE $TMPHEADER $TMPENTRY $TMPCHANGELOG $TMPOLDLOG - - exit $1 - -} - -parse_params "${@}" - -init - -get_msg - -for x in $FILES; do - process $x -done - -cleanup 0 - diff --git a/trunk/src/change/change.1 b/trunk/src/change/change.1 deleted file mode 100644 index e69de29..0000000 diff --git a/trunk/src/dep-clean/AUTHORS b/trunk/src/dep-clean/AUTHORS deleted file mode 100644 index 2fa030f..0000000 --- a/trunk/src/dep-clean/AUTHORS +++ /dev/null @@ -1,9 +0,0 @@ -Maintainer: -Karl Trygve Kalleberg - -Authors: -Karl Trygve Kalleberg (dep-clean, man page) -Jerry Haltom (dep-clean) -Brandon Low (dep-clean) -Paul Belt (man page) -Brandon Low (dep-clean) diff --git a/trunk/src/dep-clean/ChangeLog b/trunk/src/dep-clean/ChangeLog deleted file mode 100644 index dc6980e..0000000 --- a/trunk/src/dep-clean/ChangeLog +++ /dev/null @@ -1,13 +0,0 @@ - 04 Oct 2003: Karl Trygve Kalleberg dep-clean, dep-clean.1: - * Rewrote to Python - * Uses gentoolkit - * Changed the switches to be proper toggles - - 25 Feb 2003; Brandon Low dep-clean, dep-clean.1: - * Update to work with current everything - * Add -q and change the default behaviour and the verbose behavior - * Make a lot faster by rewriting most everything - * Make script much more readable - * Make pay attention to PORTDIR_OVERLAY - * Bring back from the dead as it give more info - than the depclean action in portage. diff --git a/trunk/src/dep-clean/README b/trunk/src/dep-clean/README deleted file mode 100644 index 6521aef..0000000 --- a/trunk/src/dep-clean/README +++ /dev/null @@ -1,4 +0,0 @@ -See man dep-clean or just run dep-clean --help. - -QuickStart: -dep-clean displays missing, extra, and removed packages on your system. diff --git a/trunk/src/dep-clean/dep-clean b/trunk/src/dep-clean/dep-clean deleted file mode 100644 index 2f2bde0..0000000 --- a/trunk/src/dep-clean/dep-clean +++ /dev/null @@ -1,164 +0,0 @@ -#!/usr/bin/python -# -# Terminology: -# -# portdir = /usr/portage + /usr/local/portage -# vardir = /var/db/pkg - -import sys -import gentoolkit -try: - from portage.output import * -except ImportError: - from output import * - -__author__ = "Karl Trygve Kalleberg, Brandon Low, Jerry Haltom" -__email__ = "karltk@gentoo.org, lostlogic@gentoo.org, ssrit@larvalstage" -__version__ = "0.2.0" -__productname__ = "dep-clean" -__description__ = "Portage auxiliary dependency checker" - -class Config: - pass - -def defaultConfig(): - Config.displayUnneeded = 1 - Config.displayNeeded = 1 - Config.displayRemoved = 1 - Config.color = -1 - Config.verbosity = 2 - Config.prefixes = { "R" : "", - "U" : "", - "N" : "" } -def asCPVs(pkgs): - return map(lambda x: x.get_cpv(), pkgs) - -def asCPs(pkgs): - return map(lambda x: x.get_cp(), pkgs) - -def toCP(cpvs): - def _(x): - (c,p,v,r) = gentoolkit.split_package_name(x) - return c + "/" + p - return map(_, cpvs) - -def checkDeps(): - if Config.verbosity > 1: - print "Scanning packages, please be patient..." - - unmerged = asCPVs(gentoolkit.find_all_uninstalled_packages()) - unmerged_cp = toCP(unmerged) - - merged = asCPVs(gentoolkit.find_all_installed_packages()) - merged_cp = toCP(merged) - - (system, unres_system) = gentoolkit.find_system_packages() - system = asCPVs(system) - - (world, unres_world) = gentoolkit.find_world_packages() - world = asCPVs(world) - - desired = system + world - - unneeded = filter(lambda x: x not in desired, merged) - needed = filter(lambda x: x not in merged, desired) - old = filter(lambda x: x not in unmerged_cp, merged_cp) - - if len(needed): - print "Packages required, but not by world and system:" - for x in needed: print " " + x - raise "Internal error, please report." - - if len(unres_system) and Config.displayNeeded: - if Config.verbosity > 0: - print white("Packages in system but not installed:") - for x in unres_system: - print " " + Config.prefixes["N"] + red(x) - - if len(unres_world) and Config.displayNeeded: - if Config.verbosity > 0: - print white("Packages in world but not installed:") - for x in unres_world: - print " " + Config.prefixes["N"] + red(x) - - if len(old) and Config.displayRemoved: - if Config.verbosity > 0: - print white("Packages installed, but no longer available:") - for x in old: - print " " + Config.prefixes["R"] + yellow(x) - - if len(unneeded) and Config.displayUnneeded: - if Config.verbosity > 0: - print white("Packages installed, but not required by system or world:") - for x in unneeded: - print " " + Config.prefixes["U"] + green(x) - -def main(): - - defaultConfig() - - for x in sys.argv: - if 0: - pass - elif x in ["-h","--help"]: - printUsage() - sys.exit(0) - elif x in ["-V","--version"]: - printVersion() - sys.exit(0) - - elif x in ["-n","--needed","--needed=yes"]: - Config.displayNeeded = 1 - elif x in ["-N","--needed=no"]: - Config.displayNeeded = 0 - - elif x in ["-u","--unneeded","--unneeded=yes"]: - Config.displayUnneeded = 1 - elif x in ["-U","--unneeded=no"]: - Config.displayUnneeded = 0 - - elif x in ["-r","--removed","--removed=yes"]: - Config.displayRemoved = 1 - elif x in ["-R","--removed","--removed=no"]: - Config.displayRemoved = 0 - elif x in ["-c","--color=yes"]: - Config.color = 1 - elif x in ["-C","--color=no"]: - Config.color = 0 - - elif x in ["-v", "--verbose"]: - Config.verbosity += 1 - elif x in ["-q", "--quiet"]: - Config.verbosity = 0 - - # Set up colour output correctly - if (Config.color == -1 and \ - ((not sys.stdout.isatty()) or \ - (gentoolkit.settings["NOCOLOR"] in ["yes","true"]))) \ - or \ - Config.color == 0: - nocolor() - Config.prefixes = { "R": "R ", "N": "N ", "U": "U " } - - checkDeps() - -def printVersion(): - print __productname__ + "(" + __version__ + ") - " + \ - __description__ - print "Authors: " + __author__ - -def printUsage(): - print white("Usage: ") + turquoise(__productname__) + \ - " [" + turquoise("options") + "]" - print "Where " + turquoise("options") + " is one of:" - print white("Display:") - print " -N,--needed needed packages that are not installed." - print " -R,--removed installed packages not in portage." - print " -U,--unneeded potentially unneeded packages that are installed." - print white("Other:") - print " -C,--nocolor output without color. Categories will be denoted by P,N,U." - print " -h,--help print this help" - print " -v,--version print version information" - -if __name__ == "__main__": - main() diff --git a/trunk/src/dep-clean/dep-clean.1 b/trunk/src/dep-clean/dep-clean.1 deleted file mode 100644 index 9e42019..0000000 --- a/trunk/src/dep-clean/dep-clean.1 +++ /dev/null @@ -1,194 +0,0 @@ -.\" Automatically generated by Pod::Man version 1.15 -.\" Thu Jul 18 15:59:55 2002 -.\" -.\" Standard preamble: -.\" ====================================================================== -.de Sh \" Subsection heading -.br -.if t .Sp -.ne 5 -.PP -\fB\\$1\fR -.PP -.. -.de Sp \" Vertical space (when we can't use .PP) -.if t .sp .5v -.if n .sp -.. -.de Ip \" List item -.br -.ie \\n(.$>=3 .ne \\$3 -.el .ne 3 -.IP "\\$1" \\$2 -.. -.de Vb \" Begin verbatim text -.ft CW -.nf -.ne \\$1 -.. -.de Ve \" End verbatim text -.ft R - -.fi -.. -.\" Set up some character translations and predefined strings. \*(-- will -.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left -.\" double quote, and \*(R" will give a right double quote. | will give a -.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used -.\" to do unbreakable dashes and therefore won't be available. \*(C` and -.\" \*(C' expand to `' in nroff, nothing in troff, for use with C<> -.tr \(*W-|\(bv\*(Tr -.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' -.ie n \{\ -. ds -- \(*W- -. ds PI pi -. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch -. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch -. ds L" "" -. ds R" "" -. ds C` "" -. ds C' "" -'br\} -.el\{\ -. ds -- \|\(em\| -. ds PI \(*p -. ds L" `` -. ds R" '' -'br\} -.\" -.\" If the F register is turned on, we'll generate index entries on stderr -.\" for titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and -.\" index entries marked with X<> in POD. Of course, you'll have to process -.\" the output yourself in some meaningful fashion. -.if \nF \{\ -. de IX -. tm Index:\\$1\t\\n%\t"\\$2" -.. -. nr % 0 -. rr F -.\} -.\" -.\" For nroff, turn off justification. Always turn off hyphenation; it -.\" makes way too many mistakes in technical documents. -.hy 0 -.if n .na -.\" -.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). -.\" Fear. Run. Save yourself. No user-serviceable parts. -.bd B 3 -. \" fudge factors for nroff and troff -.if n \{\ -. ds #H 0 -. ds #V .8m -. ds #F .3m -. ds #[ \f1 -. ds #] \fP -.\} -.if t \{\ -. ds #H ((1u-(\\\\n(.fu%2u))*.13m) -. ds #V .6m -. ds #F 0 -. ds #[ \& -. ds #] \& -.\} -. \" simple accents for nroff and troff -.if n \{\ -. ds ' \& -. ds ` \& -. ds ^ \& -. ds , \& -. ds ~ ~ -. ds / -.\} -.if t \{\ -. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" -. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' -. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' -. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' -. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' -. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' -.\} -. \" troff and (daisy-wheel) nroff accents -.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' -.ds 8 \h'\*(#H'\(*b\h'-\*(#H' -.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] -.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' -.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' -.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] -.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] -.ds ae a\h'-(\w'a'u*4/10)'e -.ds Ae A\h'-(\w'A'u*4/10)'E -. \" corrections for vroff -.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' -.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' -. \" for low resolution devices (crt and lpr) -.if \n(.H>23 .if \n(.V>19 \ -\{\ -. ds : e -. ds 8 ss -. ds o a -. ds d- d\h'-1'\(ga -. ds D- D\h'-1'\(hy -. ds th \o'bp' -. ds Th \o'LP' -. ds ae ae -. ds Ae AE -.\} -.rm #[ #] #H #V #F C -.\" ====================================================================== -.\" -.IX Title "DEP-CLEAN 1" -.TH DEP-CLEAN 1 "Copyright 2002 Gentoo Technologies, Inc." "2002-07-18" "GenToolKit's Dependency Checker!" -.UC -.SH "NAME" -dep-clean \- Shows unrequired packages and missing dependencies. -.SH "SYNOPSIS" -.IX Header "SYNOPSIS" -.Vb 1 -\& dep-clean [-RUNICv] -.Ve -.SH "DESCRIPTION" -.IX Header "DESCRIPTION" -dep-clean displays extraneous, missing or extra packages. Extra packages are those in which are not a part of the portage tree (/usr/portage). It does \s-1NOT\s0 modify the system in any way. -.SH "OPTIONS" -.IX Header "OPTIONS" -.Ip "\-n, \-\-needed" 4 -.Ip "\-N, \-\-needed=no" 4 -.IX Item "-n, --needed" -Toggle display of needed packages that are not installed. (red) (default=yes) -.Ip "\-r, \-\-removed" 4 -.Ip "\-R, \-\-removed=no" 4 -.IX Item "-R, --removed" -Toggle display of installed packages not in portage. (yellow) (default=yes) -.Ip "\-u, \-\-unneeded" 4 -.Ip "\-U, \-\-unneeded=no" 4 -.IX Item "-U, --unneeded" -Toggle display of unneeded packages that are installed. (green) (default=yes) -.Ip "\-c, \-\-color" 4 -.Ip "\-C, \-\-color=no" 4 -.IX Item "-c, --color" -Toggle output of color. Without color, package types will be noted with R, U and N. -Default is use whatever Portage is set for. -.Ip "\-v, \-\-verbose" 4 -.IX Item "-v, --verbose" -Be more verbose. -.Ip "\-q, \-\-quiet" 4 -.IX Item "-q, --quiet" -Be quiet (display only packages). -.SH "NOTES" -.IX Header "NOTES" -.Ip "" 4 -If this script is run on a system that is not up-to-date or which hasn't been cleaned (with 'emerge \-c') recently, the output may be deceptive. -.Ip "" 4 -If the same package name appears in all three categories, then it is definitely time to update that package and then run 'emerge \-c'. -.Ip "" 4 -The \-U, \-N and \-R options may be combined, default is \-UNR -.SH "AUTHORS" -.IX Header "AUTHORS" -Jerry Haltom (dep-clean) -.br -Brandon Low (dep-clean) -.PP -Paul Belt (man page) -.br -Karl Trygve Kalleberg (dep-clean, man page) diff --git a/trunk/src/dev-scripts/README b/trunk/src/dev-scripts/README deleted file mode 100644 index 990a2ab..0000000 --- a/trunk/src/dev-scripts/README +++ /dev/null @@ -1,2 +0,0 @@ -This directory is intended to be used for small developer oriented scripts used in gentoolkit-dev. -If a script develops into a full fledged tool, it will be moved into its own subdirectory. diff --git a/trunk/src/dev-scripts/included_headers.sh b/trunk/src/dev-scripts/included_headers.sh deleted file mode 100755 index 915628b..0000000 --- a/trunk/src/dev-scripts/included_headers.sh +++ /dev/null @@ -1,159 +0,0 @@ -#!/bin/bash - -# CHANGES -# -# 20051211: Add qfile use from portage-utils, prefer over equery. Create new -# function track_headers() to handle package manager queries for both -# relative and absolute headers. Split relative and absolute queries into two -# separate places, since relative aren't quite as reliable. Prefer headers -# found in the tarball over those in /usr/include. Also, note which headers -# weren't considered in the calculation and the reasons why not. - -location=${1} - -usage() { - echo "${0##*/} [ -d ] source_location" - echo " Returns owners of all include files used. ${0##*/} defaults to" - echo " files in /usr/include, so if a file with the same name within the" - echo " source is the actual one used, false dependencies may be printed." - echo - echo " -d" - echo " Show debug output: Print files not found" - exit 1 -} - -decho() { - if [[ -n "${DEBUG}" ]]; then - echo "${1}" - fi -} - -if [[ $# -le 0 ]] || [[ $# -ge 3 ]]; then - usage -fi - -# Handle command-line options -while getopts d options; do - case ${options} in - d) DEBUG=1 - ;; - *) usage - ;; - esac -done -# Reset post-option stuff to positional parameters -shift $((OPTIND - 1)) - -get_absolute_includes() { - grep '^#[[:space:]]*include' -r ${1} | grep '.*.[ch]' | grep -e '<' -e '>' \ - | cut -d':' -f2 | cut -d'<' -f2 | cut -d'>' -f1 | grep '.*.[ch]' \ - | sort | uniq -} - -get_relative_includes() { - grep '^#[[:space:]]*include' -r ${1} | grep '.*.[ch]' | grep -e '"' -e '"' \ - | cut -d':' -f2 | cut -d'"' -f2 | cut -d'"' -f1 | grep '.*.[ch]' \ - | sort | uniq -} - -track_headers() { - if [[ -x $(which qfile 2> /dev/null) ]]; then - qfile ${@} | cut -d'(' -f1 | sort | uniq - elif [[ -x $(which equery 2> /dev/null) ]]; then - equery -q belongs ${@} | cut -d'(' -f1 - elif [[ -x $(which rpm 2> /dev/null) ]]; then - rpm -qf ${@} - else - echo "Couldn't find package query tool! Printing headerpaths instead." - echo - for header in ${@}; do - echo ${header} - done - fi -} - -echo "Analyzing source ... " -absolute_headers="$(get_absolute_includes ${1})" -relative_headers="$(get_relative_includes ${1})" - -echo "Looking for absolute headers ... " -echo -for header in ${absolute_headers}; do - absheader="/usr/include/${header}" - if [[ -e ${absheader} ]]; then - abs_headerpaths="${abs_headerpaths} ${absheader}" - echo " Looking for ${absheader} ... OK" - else - # Try as a relative header in case people use -I with <> - relative_headers="${relative_headers} ${header}" - decho " Looking for ${absheader} ... Not found!" - fi -done - -echo -echo "Looking for relative headers ... " -echo -for header in ${relative_headers}; do - fullheader=${header} - header=${header##*/} - # Prefer headers in tarball over /usr/include - header_options=$(find ${location} -name ${header} | grep ${fullheader}) - if [[ -z ${header_options} ]]; then - header_options="$(find /usr/include -name ${header} | grep ${fullheader})" - header_loc="/usr/include" - else - decho " Local header ${header} ... Not considering." - local_headers="${local_headers} ${header}" - continue - fi - count="0" - for found in ${header_options}; do - (( count++ )) - done - if [[ ${count} -ge 2 ]]; then - echo " Looking for ${header} ... " - echo " More than one option found for ${header} in ${header_loc}." - echo " Not considering ${header}." - duplicate_headers="${duplicate_headers} ${header}" - continue - elif [[ ${count} -le 0 ]]; then - decho " Looking for ${header} ... Not found!" - unfound_headers="${unfound_headers} ${header}" - continue - fi - header=${header_options} - if [[ -e ${header} ]] && [[ ${header_loc} = /usr/include ]]; then - rel_headerpaths="${rel_headerpaths} ${header}" - echo " Looking for ${header} ... OK" - else - decho " Looking for ${header} ... Not found!" - fi -done - -echo "Tracing headers back to packages ..." -echo -echo "Headers ignored because they exist in the tarball:" -echo -for header in ${local_headers}; do - echo "${header}" -done -echo -echo "Headers ignored because of duplicates in /usr/include:" -echo -for header in ${duplicate_headers}; do - echo "${header}" -done -echo -echo "Headers ignored because they weren't found:" -echo -for header in ${unfound_headers}; do - echo "${header}" -done -echo -echo "Absolute headers:" -echo -track_headers ${abs_headerpaths} -echo -echo "Relative headers:" -echo -track_headers ${rel_headerpaths} diff --git a/trunk/src/dev-scripts/linking_libs.sh b/trunk/src/dev-scripts/linking_libs.sh deleted file mode 100755 index a249305..0000000 --- a/trunk/src/dev-scripts/linking_libs.sh +++ /dev/null @@ -1,204 +0,0 @@ -#!/bin/bash - -# CHANGES -# -# 20051211: Move most of the logic to check for bad links into get_libnames() -# seds, so we don't wrongly sed out whole link lines. Seems to catch more -# problems, such as ' or ` or -- in a link. -# 20051210: Prefer qfile from portage-utils over equery if it's available. -# Check for ... in "link" lines because configure checks are not links. -# Change get_link_generic() to handle whole lines at a time instead of single -# words, so get_linklines() works. -# 20051210: Rework get_libnames() to use a new style of grep, because the old -# way was broken on some packages from the \b. Also optimize the "Looking for -# libraries" section to only grep the log file once for links and cache it; -# also only grep the link lines ones for a given library, then parse the -# output for static or shared. Should speed things up considerably for large -# packages. I get 5 seconds in Analyzing log and 15 in Looking for libs on an -# xorg-x11-6.8.99.15 log on second run. -# Create get_link_generic() that both sections call with different options. - -usage() { - echo "${0##*/} compilation_log" - echo " Checks for -lfoo link commands and finds the library owners." - exit 1 -} - -if [[ $# -lt 1 || $1 == -h || $1 == --help ]]; then - usage -fi - - -# Finds all lines in a file that involve linking -# get_link_generic(char *grep_opts, char *filename) -get_link_generic() { - egrep ${1} '\-l\w[^[:space:]]*' ${2} \ - | while read linker; do - # -linker is passed through to ld and doesn't mean the inker lib. - # The new -w in grep makes sure they're separate "words", but its - # "word" characters only include alnum and underscore, so -- gets - # through. - # Some configure lines with ... match, so we drop them - # Some of the configure options match, so we get rid of = for that. - if \ - [[ "${linker}" != *...* ]] \ - && [[ "${linker}" != -lib ]] \ - && [[ "${linker}" != -libs ]]; then - echo ${linker} - fi - done -} - -# Note the lack of -o, as compared to get_libnames() egrep -get_linklines() { - get_link_generic "-w" ${1} | sort | uniq -} - -get_libnames() { - for x; do - get_link_generic "-o -w" ${x} \ - | sed \ - -e "/^-link/d" \ - -e "/^-lib/d" \ - -e "s:^-l::g" \ - -e "/=/d" \ - -e "/'/d" \ - -e "/^-/d" \ - -e "s:\.*$::g" \ - -e "s:|::g" \ - -e "s:\"::g" \ - -e "/^-link/d" \ - -e "/^-lib/d" - done | sort | uniq -} - -get_libdirs() { - cat /etc/ld.so.conf | sed -e "/^#/d" -} - -check_exists() { - if [[ -n ${1// } ]]; then - return 0 - fi - - return 1 -} - -trace_to_packages() { - local paths=$1 - - check_exists "${paths}" - local ret=$? - if [[ $ret -ne 0 ]]; then - return 1 - fi - - if [[ -x $(which qfile 2> /dev/null) ]]; then - qfile -q ${paths} | sort | uniq - elif [[ -x $(which equery 2> /dev/null) ]]; then - equery -q belongs ${paths} | cut -d'(' -f1 - elif [[ -x $(which rpm 2> /dev/null) ]]; then - rpm -qf ${paths} - else - echo "Couldn't find package query tool! Printing paths instead." - echo - for path in ${paths}; do - echo ${path} - done - fi -} - -# *64 needs to be first, as *lib is a symlink to it so equery screws up -libdirs="/lib64 /usr/lib64 /lib /usr/lib $(get_libdirs)" - -echo "Analyzing log ..." -libnames=$(get_libnames "$@") - -#echo libnames=$libnames - -echo "Looking for libraries ..." -linker_lines=$(get_linklines ${1}) - -#echo linker_lines=$linker_lines - -for libname in ${libnames}; do - static=0 - shared=0 - line=$(echo ${linker_lines} | grep "\b-l${libname}\b") - if echo ${line} | grep -q '\b-static\b'; then - static=1 - fi - if ! echo ${line} | grep -q '\b-static\b'; then - shared=1 - fi - staticlibname="lib${libname}.a" - sharedlibname="lib${libname}.so" - if [[ ${static} -eq 1 ]]; then - echo -n " Looking for ${staticlibname} ... " - for libdir in ${libdirs}; do - found=0 - if [[ -e ${libdir}/${staticlibname} ]]; then - libpaths="${libpaths} ${libdir}/${staticlibname}" - found=1 - echo "OK" - break - fi - done - if [[ ${found} -ne 1 ]]; then - echo "Not found!" - fi - fi - if [[ ${shared} -eq 1 ]]; then - echo -n " Looking for ${sharedlibname} ... " - for libdir in ${libdirs}; do - found=0 - if [[ -e ${libdir}/${sharedlibname} ]]; then - libpaths="${libpaths} ${libdir}/${sharedlibname}" - found=1 - echo "OK" - break - fi - done - if [[ ${found} -ne 1 ]]; then - echo "Not found!" - fi - fi -done - -# Add backslashes in front of any + symbols -libpaths=${libpaths//+/\\+} - -echo "Looking for build tools (imake, etc) ..." -BUILD_PKGS=$(egrep -h "$@" \ - -e '^(/usr/(X11R6/)?bin/)?rman' \ - -e '^(/usr/(X11R6/)?bin/)?gccmakedep' \ - -e '^(/usr/(X11R6/)?bin/)?makedepend' \ - -e '^(/usr/(X11R6/)?bin/)?imake' \ - -e '^(/usr/(X11R6/)?bin/)?rman' \ - -e '^(/usr/(X11R6/)?bin/)?lndir' \ - -e '^(/usr/(X11R6/)?bin/)?xmkmf' \ - | awk '{ print $1 }' \ - | sort \ - | uniq) - -for PKG in ${BUILD_PKGS}; do - PKG=$(basename ${PKG}) - echo -n " Looking for ${PKG} ... " - if [[ -e /usr/bin/${PKG} ]]; then - echo "OK" - buildpaths="${buildpaths} ${PKG}" - else - echo "Not found!" - fi -done - -echo -echo "Tracing libraries back to packages ..." -echo -trace_to_packages "${libpaths}" - -echo -echo "Tracing build tools back to packages ..." -echo - -trace_to_packages "${buildpaths}" diff --git a/trunk/src/distfiles-clean/AUTHORS b/trunk/src/distfiles-clean/AUTHORS deleted file mode 100644 index d913891..0000000 --- a/trunk/src/distfiles-clean/AUTHORS +++ /dev/null @@ -1,6 +0,0 @@ -José Fonseca - * Wrote the script - -Karl Trygve Kalleberg - * Wrote the man page. - diff --git a/trunk/src/distfiles-clean/ChangeLog b/trunk/src/distfiles-clean/ChangeLog deleted file mode 100644 index dfe6aa8..0000000 --- a/trunk/src/distfiles-clean/ChangeLog +++ /dev/null @@ -1,2 +0,0 @@ -2002-15-11: Karl Trygve Kalleberg - * Imported newest contributions from #10647. diff --git a/trunk/src/distfiles-clean/TODO b/trunk/src/distfiles-clean/TODO deleted file mode 100644 index e69de29..0000000 diff --git a/trunk/src/distfiles-clean/distfiles-clean b/trunk/src/distfiles-clean/distfiles-clean deleted file mode 100644 index 23af32b..0000000 --- a/trunk/src/distfiles-clean/distfiles-clean +++ /dev/null @@ -1,78 +0,0 @@ -#!/bin/sh -# -# distfiles-clean -# -# Cleans unused files from Portage's distfiles directory. -# -# José Fonseca - -PROGRAM=`basename "$0"` - -while [ ${#} -gt 0 ] -do - case "$1" in - -h|--help) - USAGE=y - break - ;; - -i|--ignore) - IGNORE="$IGNORE $2" - shift 2 - ;; - -I|--ignore-file) - IGNORE="$IGNORE `cat "$2"`" - shift 2 - ;; - -p|--pretend) - PRETEND=y - shift - ;; - *) - echo "$PROGRAM: Invalid option \'$1\'" 1>&2 - USAGE=y - break - ;; - esac -done - -# For PORTDIR and DISTDIR -. /etc/make.globals -. /etc/make.conf - -if [ "$USAGE" ] -then - echo "Usage: $PROGRAM [-h|--help] [-i|--ignore ] [-I|--ignore-file ] [-p|--pretend]" - echo "Cleans unused files from $DISTDIR directory." - exit -fi - -DBDIR=/var/db/pkg -CACHEDIR=/var/cache/edb/dep - -for DIR in "$PORTDIR" "$DISTDIR" "$DBDIR" "$CACHEDIR" -do - if [ ! -d "$DIR" ] - then - echo "$PROGRAM: \'$DIR\' not found." - exit - fi -done - -TMPFILE=`mktemp /tmp/$PROGRAM.XXXXXX` - -cd "$DISTDIR" - -{ - echo "cvs-src" - [ "$IGNORE" ] && ls -1d $IGNORE - find "$DBDIR" -name '*.ebuild' | sed -n -e "s:^$DBDIR/\([^/]*\)/\([^/]*\)/\([^/]*\)\.ebuild$:$CACHEDIR/\1/\3:p" | xargs sed -s -e '4!d;/^$/d;s/[[:alnum:]]\+?\|(\|)//g;s/\<[^[:space:]]\+\/\ "$TMPFILE" && ls -1 | comm -23 - "$TMPFILE" | { - if [ "$PRETEND" ] - then - cat - else - xargs rm -f - fi -} - -rm "$TMPFILE" diff --git a/trunk/src/ebump/AUTHORS b/trunk/src/ebump/AUTHORS deleted file mode 100644 index 2432e06..0000000 --- a/trunk/src/ebump/AUTHORS +++ /dev/null @@ -1,5 +0,0 @@ -Maintainer: -Karl Trygve Kalleberg - -Original author: -Karl Trygve Kalleberg diff --git a/trunk/src/ebump/ChangeLog b/trunk/src/ebump/ChangeLog deleted file mode 100644 index 4434b94..0000000 --- a/trunk/src/ebump/ChangeLog +++ /dev/null @@ -1,8 +0,0 @@ -2004-06-21 Karl Trygve Kalleberg - * Fixed handling of deletion. - -2004-03-11 Karl Trygve Kalleberg - * Fixed incorrect cut'ing of wc -l output when updating ChangeLog - -2004-02-08 Karl Trygve Kalleberg - * Initial import diff --git a/trunk/src/ebump/Makefile b/trunk/src/ebump/Makefile deleted file mode 100644 index aa1d347..0000000 --- a/trunk/src/ebump/Makefile +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright 2004 Karl Trygve Kalleberg -# Copyright 2004 Gentoo Technologies, Inc. -# Distributed under the terms of the GNU General Public License v2 -# -# $Header$ - -include ../../makedefs.mak - -.PHONY: all -all: - -dist: - mkdir -p ../../$(distdir)/src/ebump/ - cp Makefile AUTHORS README TODO ChangeLog ebump ebump.1 ../../$(distdir)/src/ebump/ - -install: all - install -m 0755 ebump $(bindir)/ - install -d $(docdir)/ebump - install -m 0644 AUTHORS README TODO ChangeLog $(docdir)/ebump/ - install -m 0644 ebump.1 $(mandir)/ diff --git a/trunk/src/ebump/README b/trunk/src/ebump/README deleted file mode 100644 index c81835c..0000000 --- a/trunk/src/ebump/README +++ /dev/null @@ -1,18 +0,0 @@ - -Package : ebump -Version : 0.1.0 -Author : See AUTHORS - -MOTIVATION - -The ebump utility is a Gentoo-specific tool for bumping the revision of -a given ebuild and auxiliary files in the Portage tree. It is only -useful for Gentoo developers with CVS commit access. - -MECHANICS - -N/A - -IMPROVEMENTS - -N/A diff --git a/trunk/src/ebump/TODO b/trunk/src/ebump/TODO deleted file mode 100644 index e69de29..0000000 diff --git a/trunk/src/ebump/ebump b/trunk/src/ebump/ebump deleted file mode 100755 index 2623a28..0000000 --- a/trunk/src/ebump/ebump +++ /dev/null @@ -1,356 +0,0 @@ -#! /bin/sh -# -# Copyright (c) 2004 Karl Trygve Kalleberg -# Copyright (c) Gentoo Technologies, Inc. -# Licensed under the GNU General Public License, version 2 -# -# Maintainer: Karl Trygve Kalleberg - -__version__="0.1.0" -__author__="Karl Trygve Kalleberg" -__email__="" -__description__="Ebuild version bumping tool" - - - -die() { - echo $1 > /dev/stderr - exit -1 -} - -einfo() { - if [ ${opt_verbosity} -gt 2 ] ; then - echo $* - fi -} - -print_version() { - echo "${__description__}, v${__version__}" - echo "Copyright (c) 2004 ${__author__} ${__email__}" - echo "Copyright (c) 2004 Gentoo Technologies, Inc." - echo "Licensed under the GNU General Public License, version 2" -} - -print_usage() { - echo "Usage: ebump foo<.ebuild>" - echo "Ebuild version bumping tool, v${__version__}" - echo " -V|--version show version info" - echo " -v|--verbose increase verbosity" - echo " -q|--quiet turn off output" - echo " -C|--no-cvs do not add to CVS" - echo " -m|--message append message to ChangeLog" - echo " -d|--delete-old delete previous revision from CVS (DANGEROUS!)" -} - -# -# Load options from /etc/gentoolkit/ebump.conf and ${HOME}/.gentoo/ebump.conf -# Home directory file takes precedence. -# -load_options() { - - # FIXME: Sourcing config files like this is really a bad idea; users may - # easily override any function in this program inside his config files. - - if [ -f /etc/gentoolkit/ebump.conf ] ; then - . /etc/gentoolkit/ebump.conf - fi - if [ -f ${HOME}/.gentoo/gentool-env ] ; then - . ${HOME}/.gentoo/gentool-env - fi - if [ -f ${HOME}/.gentoo/ebump.conf ] ; then - . ${HOME}/.gentoo/ebump.conf - fi -} - -# -# Find closes ebuild to ${1}, if any -# -find_ebuild() { - f=${1} - - if [ -f ${1} ] ; then - echo ${1} - fi - - if [ -f ${1}.ebuild ] ; then - echo ${1} - fi -} - -# -# splitname (version|name|revision) package-name-version-revision -# -splitname() { - case $1 in - version) - echo ${2} | sed -r "s/.*-([0-9].*)/\1/" - ;; - name) - name=$(echo ${2} | sed -r "s/(.*)-[0-9].*/\1/") - if [ ${name} == ${2} ] ; then - if [ $(echo ${2} | grep "^[0-9].*") ] ; then - # The filename starts with a version number, thus it has no - # name - name="" - else - # The filename doesn't have a recognizeable version number; - # everything is a name - name=${2} - fi - fi - echo ${name} - ;; - revision) - rev=$(echo ${2} | sed -r "s/.*-r([0-9][0-9]*)/\1/") - if [ ${rev} == ${2} ] ; then - rev=0 - fi - echo ${rev} - ;; - vernorev) - ver=$(echo ${2} | sed -r "s/.*-([0-9].*)-r[0-9]+/\1/") - if [ ${ver} == ${2} ] ; then - ver=$(echo ${2} | sed -r "s/.*-([0-9].*)/\1/") - fi - echo ${ver} - ;; - *) - echo - esac -} - -process_ebuild() { - ebuild_arg=${1} - - # Files to add to CVS - addfiles="" - # Files to remove from CVS - delfiles="" - - if [ -z ${ebuild_arg} ] ; then - print_usage - exit - fi - - # - # Try to find a matching ebuild - # - - ebuild_name=$(find_ebuild ${ebuild_arg}) - if [ -z ${ebuild_name} ] ; then - die "Could not find ${ebuild_arg}" - fi - einfo "Processing ebuild ${ebuild_name}" - - # - # Bump revision suffix (or add one) - # - - PF=$(basename ${ebuild_name} .ebuild) - PN=$(splitname name ${PF}) - PV=$(splitname version ${PF}) - rev=$(splitname revision ${PF}) - PV_norev=$(splitname vernorev ${PF}) - newPF=${PN}-${PV_norev}-r$[rev+1] - -# echo $PF / $PN / $PV / $rev / $PV_norev / $newPF - - einfo "Bumped ${PF}.ebuild to ${newPF}.ebuild" - - cp ${PF}.ebuild ${newPF}.ebuild - - addfiles="${addfiles} ${newPF}.ebuild" - delfiles="${delfiles} ${PF}.ebuild" - - # - # (Optional) Bump relevant files in files/ - # - - if [ "${opt_bump_auxfiles}" == "y" ] ; then - - # Gather list of auxiliary files in files/ that has a versioned - # filename, where the version matches our current version. - - bumplist="" - for x in $(echo files/*) ; do - if [ ! -z $(echo $x | grep "${PV}$") ] ; then - bumplist="${bumplist} ${x}" - fi - done - - # Bump version of all matches - - for x in ${bumplist} ; do - - bn=$(basename ${x}) - dn=$(dirname ${x}) - - PN=$(splitname name ${bn}) - PV=$(splitname version ${bn}) - rev=$(splitname revision ${bn}) - PV_norev=$(splitname vernorev ${bn}) - -# echo $PN / ${PV_norev} / ${rev} - - # Special case for when we have no name part; filename - # is just a version number - if [ -z "${PN}" ] ; then - newbn=${PV_norev}-r$[rev+1] - else - newbn=${PN}-${PV_norev}-r$[rev+1] - fi - - if [ -d ${dn}/${bn} ] ; then - if [ -e ${dn}/${newbn} ] ; then - echo "Directory ${dn}/${newbn} exists, not copying" > /dev/stderr - else - cp -a ${dn}/${bn} ${dn}/${newbn} - find ${dn}/${newbn} -name CVS | xargs rm -rf - fi - else - cp ${dn}/${bn} ${dn}/${newbn} - fi - - addfiles="${addfiles} ${dn}/${newbn}" - delfiles="${delfiles} ${dn}/${bn}" - - einfo "Bumped ${dn}/${bn} to ${dn}/${newbn}" - done - fi - -# echo "addfiles ${addfiles}" -# echo "delfiles ${delfiles}" - - filelist="${addfiles}" - # - # (Optional) Add ChangeLog entry - # - - if [ "${opt_add_changelog}" == "y" ] && - [ -f ChangeLog ] ; then - - # Add ChangeLog entry - - curdate=$(LC_TIME="us" date +"%02d %b %Y") - cp ChangeLog ChangeLog.old - ( - # Use header (four first lines) of the old ChangeLog - head -n 4 ChangeLog.old - - # Write new entry - - echo "*${newPF} (${curdate})" - echo - echo " ${curdate}; ${AUTHORNAME} <${AUTHOREMAIL}> ${filelist}" - - # If we don't have a commit message, add comment - if [ -z "${opt_commitmessage}" ] ; then - echo " # INSERT ENTRY HERE" - if [ "${opt_delete_old}" == "y" ] && [ ! -z "${delfiles}" ] ; then - echo " Removed ${delfiles}." - fi - echo - else - echo " ${opt_commitmessage}" - echo - fi - - # Write tail of old ChangeLog - nl=$(wc -l ChangeLog.old | sed -r "s/^([0-9]+).*/\1/") - tail -n $[nl - 4] ChangeLog.old - ) > ChangeLog - rm ChangeLog.old - - einfo "Added ChangeLog entry" - fi - - # - # (Optional) Add CVS entry for all new files - # - - if [ "${opt_add_cvs}" == "y" ] ; then - - # Add all new files to CVS - for x in ${addfiles} ; do - if [ -d ${x} ] ; then - find ${x} | xargs echo cvs add - else - cvs add ${x} - fi - done - einfo "Added ${addfiles} to CVS" - fi - - - # - # (Optional) Delete previous entry - # - - if [ "${opt_delete_old}" == "y" ] ; then - - for x in ${delfiles} ; do - cvs remove -f ${x} - done - einfo "Removed ${delfiles} from CVS" - fi - -} - -original_params=${#} - -# -# Global options -# -opt_verbosity=1 -opt_warn_on_delete=y -opt_add_changelog=y -opt_add_cvs=y -opt_bump_auxfiles=y -opt_delete_old=n -opt_commitmessage="" - -load_options - -skip=0 -while [ ${#} -gt 0 ] ; do - arg=${1} - shift - if [ ${skip} -gt 0 ] ; then - skip=$[skip-1] - else - case ${arg} in - -h|--help) - print_usage - exit 0 - ;; - -m|--message) - opt_commitmessage="${1}" - skip=1 - ;; - -C|--no-cvs) - opt_add_cvs=n - ;; - -V|--version) - print_version - exit - ;; - -v|--verbose) - opt_verbosity=$[opt_verbosity + 1] - ;; - -q|--quiet) - opt_verbosity=0 - ;; - -d|--delete-old) - opt_delete_old=y - ;; - *) - ebuild_arg=${arg} - ;; - esac - fi -done - -process_ebuild ${ebuild_arg} - -# TODO: -# - put cli parser into separate functions diff --git a/trunk/src/ebump/ebump.1 b/trunk/src/ebump/ebump.1 deleted file mode 100644 index 6a64a0a..0000000 --- a/trunk/src/ebump/ebump.1 +++ /dev/null @@ -1,110 +0,0 @@ -.TH "ebump" "1" "0.1.0" "Gentoolkit" "Gentoo Administration" -.SH "NAME" -.LP -ebump \- Gentoo: Ebuild revision bumper -.SH "SYNTAX" -.LP -ebump [\fIoption\fP] <\fIpackage-name[-version]\fP> - -.SH "DESCRIPTION" - -.LP -\fIebump\fR bumps the revision of a particular ebuild, and all auxiliary -files in the files/ directory that have a matching version suffix. - -.LP -By default, the all new revision files will be added to CVS, and a -dummy ChangeLog entry will be made. - -.LP -You must stand in the directory of the ebuild to be bumped. - -.SH "OPTIONS" -.LP -\fB\-C\fR -.br -\fB--no-cvs\fB -.IP -Do not add new files to CVS. - -.LP -\fB\-V\fR -.br -\fB--version\fB -.IP -Display version information and exit. - -.LP -\fB\-v\fR -.br -\fB--verbose\fB -.IP -Increase verbosity level. May be used more than once. - -.LP -\fB\-q\fR -.br -\fB--quiet\fB -.IP -Do not output any non-essential information. - -.LP -\fB\-m\fR <\fIChangeLog text\fR> -.br -\fB\--message\fR <\fIChangeLog text\fR> -.IP -Specifies the message to add to the ChangeLog, instead of the standard -placeholder. - -.LP -\fB\-d\fR -.br -\fB\--delete-old\fR -.IP -Delete old revision and old auxiliary files from CVS. This is -\fIdangerous\fR and should only be used if you know exactly what you are -doing, because -.br -1) the old revision may be stable on a different architecture than the one you -are working on. -.br -2) the auxiliary files may be required by other versions of the ebuild. -.br -3) the new revision should usually undergo a period of testing before being marked stable. - -.SH "CONFIGURATION" - -.LP -\fB/etc/gentoolkit/ebump.conf\fR -.br -\fB~/.gentoo/ebump.conf\fR -.IP -From these files, \fIebump\fR will load the settings -.br -\fBopt_verbosity\fR (default \fI1\fR) - verbosity level 0-10 -.br -\fBopt_add_changelog\fR (default \fIy\fR) - add entry in ChangeLog -.br -\fBopt_add_cvs\fR (default \fIy\fR) - add new files to CVS -.br -\fBopt_bump_auxfiles\fR (default \fIy\fR) - bump auxiliary files in files/ -.br -\fBopt_delete_old\fR (default \fIn\fR) - delete old revision (DANGEROUS!) -.br -\fBopt_commitmessage\fR (default \fI""\fR) - default ChangeLog message - -.LP -\fB~/.gentoo/gentool-env\fR -.IR -From this file, \fIebump\fR will load the env vars \fBAUTHORNAME\fR and -\fBAUTHOREMAIL\fR, which are used to generate proper ChangeLog entries. - -.SH "SEE ALSO" -.LP -The rest of the utilities in \fIapp-portage/gentoolkit-dev\fR, such as -\fIechangelog\fR and \fIego\fR. - -.SH "AUTHORS" -.LP -Karl Trygve Kalleberg - diff --git a/trunk/src/echangelog/AUTHORS b/trunk/src/echangelog/AUTHORS deleted file mode 100644 index 36d5bfd..0000000 --- a/trunk/src/echangelog/AUTHORS +++ /dev/null @@ -1 +0,0 @@ -Aron Griffis diff --git a/trunk/src/echangelog/ChangeLog b/trunk/src/echangelog/ChangeLog deleted file mode 100644 index c1c5885..0000000 --- a/trunk/src/echangelog/ChangeLog +++ /dev/null @@ -1,84 +0,0 @@ -26 Mar 2006 Aron Griffis - * echangelog: Don't warn about missing ebuilds when updating - copyrights #120061 - -27 Apr 2005 Aron Griffis - * more changes for #90326; report all trivial files if no significant - changes can be found - -26 Apr 2005 Aron Griffis - * detect conflicts explicitly - * report ChangeLog in the list of files if it's the only file that is - changing #90326 - -23 Mar 2005 Aron Griffis - * handle package moves without adding new version lines - -08 Mar 2005 Aron Griffis - * don't complain about cvs add of digests #84377 - * use gmtime instead of localtime - -07 Mar 2005 Aron Griffis - * report all changed versions #84332 - -25 Feb 2005 Aron Griffis - * strip GECOS #80011 - -09 Nov 2004 Aron Griffis - * change "cvs diff -fU 0" => "cvs -f diff U0" because -f is a - global option, not a diff option - -08 Nov 2004 Aron Griffis - * call cvs with -f to refrain from using .cvsrc, which might - contain conflicting options - * fix auto-addition of ChangeLog; last attempt was broken - -03 Nov 2004 Aron Griffis - * abort when there are unresolved files (files that aren't under - revision control) just like repoman - * auto-add to cvs when a new ChangeLog is created - -15 Sep 2004 Aron Griffis - * fix the wrapping to fit in 80 columns properly. It was - previously possible to get lines with 81 chars. Thanks to - ciaranm for reporting. - -29 Mar 2004 Aron Griffis - * fix bug 46111 by testing for / - * apply patch from plasmaroo, with minor modifications, to enable EDITOR - and +- support - -27 Mar 2004 Michael Sterrett - * don't fall out of the loop if update_copyright() didn't change - anything. Just go on to the next file. - -21 Mar 2004 Aron Griffis - * Fix typo $0 -> 0 - -19 Mar 2004 Aron Griffis - * Remove debugging output - * Fix $v bug introduced in last commit - -16 Mar 2004 Aron Griffis - * Make Feb 17 behavior work without Feb 20 bug :-) - * Release as version 0.2.0 - -20 Feb 2004 Aron Griffis - * Only update copyrights on modified ebuilds, otherwise if you run - echangelog again, it reports that all the ebuilds have been updated! - The copyright year issue would be better solved on Jan 1 of each year by - a separate script. - -17 Feb 2004 Aron Griffis - * Update copyrights on all ebuilds, not just the modified ones - -07 Jan 2004 Aron Griffis - * Updated Makefile to understand building man-page from pod - * Removed static man-page in favor of generated man-page from pod - * Added copyright year updating - * Allow echangelog to run even when no files have changed - -2004-01-07 Karl Trygve Kalleberg - * Added Makefile diff --git a/trunk/src/echangelog/Makefile b/trunk/src/echangelog/Makefile deleted file mode 100644 index 61c5e57..0000000 --- a/trunk/src/echangelog/Makefile +++ /dev/null @@ -1,23 +0,0 @@ -# Copyright 2004 Karl Trygve Kalleberg -# Copyright 2004 Gentoo Technologies, Inc. -# Distributed under the terms of the GNU General Public License v2 -# -# $Header$ - -include ../../makedefs.mak - -%.1 : %.pod - pod2man $< > $@ - -.PHONY: all -all: echangelog.1 - -dist: echangelog.1 - mkdir -p ../../$(distdir)/src/echangelog/ - cp Makefile AUTHORS README TODO ChangeLog echangelog echangelog.pod echangelog.1 ../../$(distdir)/src/echangelog/ - -install: all - install -m 0755 echangelog $(bindir)/ - install -d $(docdir)/echangelog - install -m 0644 AUTHORS README $(docdir)/echangelog/ - install -m 0644 echangelog.1 $(mandir)/ diff --git a/trunk/src/echangelog/README b/trunk/src/echangelog/README deleted file mode 100644 index 77a7930..0000000 --- a/trunk/src/echangelog/README +++ /dev/null @@ -1,11 +0,0 @@ -Most of the documentation is contained in the man-page, which you can -read directly (using GNU man) by doing - - man ./echangelog.1 - -To rebuild the man-page from pod source, do - - pod2man --name=echangelog --center='Gentoolkit' \ - echangelog.pod echangelog.1 - -03 Nov 2004 agriffis diff --git a/trunk/src/echangelog/TODO b/trunk/src/echangelog/TODO deleted file mode 100644 index e69de29..0000000 diff --git a/trunk/src/echangelog/echangelog b/trunk/src/echangelog/echangelog deleted file mode 100644 index 1a4bee7..0000000 --- a/trunk/src/echangelog/echangelog +++ /dev/null @@ -1,493 +0,0 @@ -#!/usr/bin/perl -w -# -# echangelog: Update the ChangeLog for an ebuild. For example: -# -# $ echangelog 'Add ~alpha to KEYWORDS' -# 4a5,7 -# > 10 Feb 2003; Aron Griffis oaf-0.6.8-r1.ebuild : -# > Add ~alpha to KEYWORDS -# > - -use strict; -use POSIX qw(strftime getcwd setlocale); -use File::Find; - -# Fix bug 21022 by restricting to C locale -setlocale(&POSIX::LC_ALL, "C"); - -use Text::Wrap; -$Text::Wrap::columns = 77; -$Text::Wrap::unexpand = 0; - -# Global variables -my (@files, @ebuilds, @conflicts, @trivial, @unknown, @new_versions, %actions); -my ($input, $editor, $entry, $user, $date, $text, $version, $year, $vcs); - -my %vcs = ( cvs => { diff => "cvs -f diff -U0", - status => "cvs -fn up", - add => "cvs -f add", - skip => 6, - regex => qr/^Index: ()(([^\/]*?)\.ebuild)\s*$/ }, - svn => { diff => "svn diff -N", - status => "svn status", - add => "svn add", - skip => 6, - regex => qr/^Index: ()(([^\/]*?)\.ebuild)\s*$/ }, - git => { diff => "git diff", - status => "git diff-index HEAD --name-status", - add => "git add", - skip => 4, - regex => qr/^diff \-\-git \S*\/((\S*)\.ebuild)/ } - -); - -# Figure out what kind of repo we are in. - -if ( -d "CVS" ) { - $vcs = "cvs"; -} elsif ( -d '.svn' ) { - $vcs = "svn"; -} elsif ( -f '/usr/bin/git' and open GIT, "git rev-parse --git-dir |" ) { - $vcs = "git"; - close GIT; -} else { - die "No CVS, .git, .svn directories found, what kind of repo is this?"; -} - -# Read the current ChangeLog -if (-f 'ChangeLog') { - open I, '; } - close I; -} else { - # No ChangeLog here, maybe we should make one... - if (<*.ebuild>) { - open C, "portageq envvar PORTDIR |" or die "Can't find PORTDIR"; - my ($new) = ; - close C; - $new =~ s/\s+$//; - open I, "< $new/skel.ChangeLog" - or die "Can't open $new/skel.ChangeLog for input: $!\n"; - { local $/ = undef; $text = ; } - close I; - my ($cwd) = getcwd(); - $cwd =~ m|.*/(\w+-\w+)/([^/]+)| - or die "Can't figure out category/package.. sorry!\n"; - my ($category, $package_name) = ($1, $2); - $text =~ s/^\*.*//ms; # don't need the fake entry - $text =~ s//$category/; - $text =~ s//$package_name/; - } else { - die "This should be run in a directory with ebuilds...\n"; - } -} - -# Figure out what has changed around here -open C, $vcs{$vcs}{status}.' 2>&1 |' or die "Can't run ".$vcs{$vcs}{status}.": $!\n"; -while () { - if (/^C\s+(\S+)/) { - if($vcs eq "git") { - my $filename = $2; - $filename =~ /\S*\/(\S*)/; - if( -d $1 ) { - next; - } - push @conflicts, $1; - next; - } - push @conflicts, $1; - next; - } elsif (/^\?\s+(\S+)/) { - if($vcs eq "git") { - my $filename = $2; - $filename =~ /\S*\/(\S*)/; - if( -d $1 ) { - next; - } - push @unknown, $1; - next; - } else { - push @unknown, $1; - } - $actions{$1} = '+'; - next; - } elsif (/^([ARMD])\s+(\S+)/) { - my ($status, $filename) = ($1,$2); - if($vcs eq "git") { - open P, "git-rev-parse --sq --show-prefix |"; - my $prefix =

                ; - $prefix = substr($prefix, 0, -1); - close P; - - if ($filename =~ /$prefix(\S*)/) { - $filename = $1 ; - } - else { - next; - } - } - if( -d $filename ) { - next; - } - push @files, $filename; - ($actions{$filename} = $status) =~ tr/DARM/-+-/d; - } -} - -# git only shows files already added so we need to check for unknown files -# separately here. -if($vcs eq "git") { - find(\&git_unknown_objects, "./"); -} - -sub git_unknown_objects { - my $object = $_; - my ($dev,$ino,$mode,$nlink,$uid,$gid); - - # Ignore empty directories - git doesn't version them and cvs removes them. - if ((($dev,$ino,$mode,$nlink,$uid,$gid) = lstat($_)) && ! -d _) { - open C, $vcs." status $_ 2>&1 1>/dev/null |"; - - while () { - $_ = ; - push @unknown, $object; - }; - close C; - }; -} - -# Separate out the trivial files for now -@files = grep { - !/files.digest|Manifest|ChangeLog/ or do { push @trivial, $_; 0; } -} @files; - -@unknown = grep { - !/files.digest|Manifest|ChangeLog/ or do { push @trivial, $_; 0; } -} @unknown; - -# Don't allow any conflicts -if (@conflicts) { - print STDERR < $nb[$i]); - return $retval if $retval; - next; - } - - # char vs. char - if ($na[$i] =~ /^\D/ and $nb[$i] =~ /^\D/) { - $retval = ($na[$i] cmp $nb[$i]); - return $retval if $retval; - next; - } - - # num vs. char - $retval = ($na[$i] =~ /\d/ and -1 or +1); - return $retval; - } - - # - # compare suffix second - # - if (defined $sa and !defined $sb) { - return +2 if $sa eq "p"; - return -2; - } - if (defined $sb and !defined $sa) { - return -3 if $sb eq "p"; - return +3; - } - - if (defined $sa) { # and defined $sb - $retval = ($sa cmp $sb); - if ($retval) { - return +4 if $sa eq "p"; - return -4 if $sb eq "p"; - return $retval; # suffixes happen to be alphabetical order, mostly - } - - # compare suffix number - return +5 if defined $sna and !defined $snb; - return -5 if defined $snb and !defined $sna; - if (defined $sna) { # and defined $snb - $retval = ($sna <=> $snb); - return $retval if $retval; - } - } - - # - # compare rev third - # - return +6 if defined $ra and !defined $rb; - return -6 if defined $rb and !defined $ra; - if (defined $ra) { # and defined $rb - return ($ra <=> $rb); - } - - # - # nothing left to compare - # - return 0; -} -@files = sort sortfunc @files; - -# Forget ebuilds that only have changed copyrights, unless that's all -# the changed files we have - -@ebuilds = grep /\.ebuild$/, @files; -@files = grep !/\.ebuild$/, @files; - -if (@ebuilds) { - if ($vcs eq "git") { - open C, $vcs{$vcs}{diff}." HEAD -- @ebuilds 2>&1 |" or die "Can't run: ".$vcs{$vcs}{diff}."$!\n"; - } else { - open C, $vcs{$vcs}{diff}." @ebuilds 2>&1 |" or die "Can't run: ".$vcs{$vcs}{diff}."$!\n"; - } - $_ = ; - while (defined $_) { - # only possible with cvs - if (/^$vcs diff: (([^\/]*?)\.ebuild) was removed/) { - push @files, $1; - } - - # We assume GNU diff output format here. - # git format: diff --git a/app-doc/repodoc/metadata.xml b/app-doc/repodoc/metadata.xml - elsif (/$vcs{$vcs}{regex}/) { - my $f; - if ($vcs eq "git") { - ($f) = ($1); - my $version = ($2); - while () { - last if /^deleted file mode|^index/; - if (/^new file mode/) { - push @new_versions, $version; # new ebuild, will create a new entry - last; - } - } - } else { - ($f) = ($2); - } - - # check if more than just copyright date changed. - # skip some lines (vcs dependent) - foreach(1..$vcs{$vcs}{skip}){ - $_ = ; - } - while () { - last if /^[A-Za-z]/; - if (/^[-+](?!# Copyright)/) { - push @files, $f; - last; - } - } - # at this point we've either added $f to @files or not, - # and we have the next line in $_ for processing - next; - } - elsif (/^$vcs.*?: (([^\/]*?)\.ebuild) is a new entry/) { - push @files, $1; - push @new_versions, $2; # new ebuild, will create a new entry - } - # other cvs output is ignored - $_ = ; - } -} -close C; - -# When a package move occurs, the versions appear to be new even though they are -# not. Trim them from @new_versions in that case. -@new_versions = grep { $text !~ /^\*\Q$_\E\s/m } @new_versions; - -# Check if we have any files left, otherwise re-insert ebuild list -# (of course, both might be empty anyway) -@files = @ebuilds unless (@files); - -# Allow ChangeLog entries with no changed files, but give a fat warning -unless (@files) { - print STDERR "**\n"; - print STDERR "** NOTE: No non-trivial changed files found. Normally echangelog\n"; - print STDERR "** should be run after all affected files have been added and/or\n"; - print STDERR "** modified. Did you forget to $vcs add?\n"; - print STDERR "**\n"; - @files = sort sortfunc @trivial; - @files = qw/ChangeLog/ unless @files; # last resort to put something in the list -} - -# Get the input from the cmdline, editor or stdin -if ($ARGV[0]) { - $input = "@ARGV"; -} else { - # Testing for defined() allows ECHANGELOG_EDITOR='' to cancel EDITOR - $editor = defined($ENV{'ECHANGELOG_EDITOR'}) ? $ENV{'ECHANGELOG_EDITOR'} : - $ENV{'EDITOR'} || undef; - if ($editor) { - system("$editor ChangeLog.new"); - if ($? != 0) { - # This usually happens when the editor got forcefully killed; and - # the terminal is probably messed up: so we reset things. - system('/usr/bin/stty sane'); - print STDERR "Editor died! Reverting to stdin method.\n"; - undef $editor; - } else { - if (open I, "; - close I; - } else { - print STDERR "Error opening ChangeLog.new: $!\n"; - print STDERR "Reverting to stdin method.\n"; - undef $editor; - } - unlink 'ChangeLog.new'; - } - } - unless ($editor) { - print "Please type the log entry: use Ctrl-d to finish, Ctrl-c to abort...\n"; - local $/ = undef; - $input = <>; - } -} -die "Empty entry; aborting\n" unless $input =~ /\S/; - -# If there are any long lines, then wrap the input at $columns chars -# (leaving 2 chars on left, one char on right, after adding indentation below). -$input =~ s/^\s*(.*?)\s*\z/$1/s; # trim whitespace -$input = Text::Wrap::fill(' ', ' ', $input); - -# Prepend the user info to the input -unless ($user = $ENV{'ECHANGELOG_USER'}) { - my ($fullname, $username) = (getpwuid($<))[6,0]; - $fullname =~ s/,.*//; # remove GECOS, bug 80011 - $user = sprintf "%s <%s\@gentoo.org>", $fullname, $username; -} -# Make sure that we didn't get "root" -die "Please set ECHANGELOG_USER or run as non-root\n" if $user =~ /ChangeLog.new' or die "Can't open ChangeLog.new for output: $!\n"; -print O $text or die "Can't write ChangeLog.new: $!\n"; -close O or die "Can't close ChangeLog.new: $!\n"; - -# Update affected ebuild copyright dates. There is no reason to update the -# copyright lines on ebuilds that haven't changed. I verified this with an IP -# lawyer. -for my $e (grep /\.ebuild$/, @files) { - if (-s $e) { - my ($etext, $netext); - open E, "<$e" or warn("Can't read $e to update copyright year\n"), next; - { local $/ = undef; $etext = ; } - close E; - - # Attempt the substitution and compare - $netext = update_copyright($etext); - next if $netext eq $etext; # skip this file if no change. - - # Write the new ebuild - open E, ">$e.new" or warn("Can't open $e.new\n"), next; - print E $netext and - close E or warn("Can't write $e.new\n"), next; - - # Move things around and show the diff - system "diff -U 0 $e $e.new"; - rename "$e.new", $e or warn("Can't rename $e.new: $!\n"); - } -} - -# Move things around and show the ChangeLog diff -system 'diff -Nu ChangeLog ChangeLog.new'; -rename 'ChangeLog.new', 'ChangeLog' or die "Can't rename ChangeLog.new: $!\n"; - -# Okay, now we have a starter ChangeLog to work with. -# The text will be added just like with any other ChangeLog below. -# Add the new ChangeLog to vcs before continuing. -if ($vcs eq "cvs") { - if (open F, "CVS/Entries") { - system("cvs -f add ChangeLog") unless (scalar grep /^\/ChangeLog\//, ); - } -} elsif ($vcs eq "svn") { - if (open F, ".svn/entries") { - system("svn add ChangeLog") unless (scalar grep /ChangeLog/, ); - } -} else { - system("$vcs{$vcs}{add} ChangeLog 2>&1 >> /dev/null"); -} - -# vim:sw=4 ts=8 expandtab diff --git a/trunk/src/echangelog/echangelog.1 b/trunk/src/echangelog/echangelog.1 deleted file mode 100644 index f83eaf7..0000000 --- a/trunk/src/echangelog/echangelog.1 +++ /dev/null @@ -1,275 +0,0 @@ -.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.13 -.\" -.\" Standard preamble: -.\" ======================================================================== -.de Sh \" Subsection heading -.br -.if t .Sp -.ne 5 -.PP -\fB\\$1\fR -.PP -.. -.de Sp \" Vertical space (when we can't use .PP) -.if t .sp .5v -.if n .sp -.. -.de Vb \" Begin verbatim text -.ft CW -.nf -.ne \\$1 -.. -.de Ve \" End verbatim text -.ft R -.fi -.. -.\" Set up some character translations and predefined strings. \*(-- will -.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left -.\" double quote, and \*(R" will give a right double quote. | will give a -.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to -.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C' -.\" expand to `' in nroff, nothing in troff, for use with C<>. -.tr \(*W-|\(bv\*(Tr -.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' -.ie n \{\ -. ds -- \(*W- -. ds PI pi -. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch -. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch -. ds L" "" -. ds R" "" -. ds C` "" -. ds C' "" -'br\} -.el\{\ -. ds -- \|\(em\| -. ds PI \(*p -. ds L" `` -. ds R" '' -'br\} -.\" -.\" If the F register is turned on, we'll generate index entries on stderr for -.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index -.\" entries marked with X<> in POD. Of course, you'll have to process the -.\" output yourself in some meaningful fashion. -.if \nF \{\ -. de IX -. tm Index:\\$1\t\\n%\t"\\$2" -.. -. nr % 0 -. rr F -.\} -.\" -.\" For nroff, turn off justification. Always turn off hyphenation; it makes -.\" way too many mistakes in technical documents. -.hy 0 -.if n .na -.\" -.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). -.\" Fear. Run. Save yourself. No user-serviceable parts. -. \" fudge factors for nroff and troff -.if n \{\ -. ds #H 0 -. ds #V .8m -. ds #F .3m -. ds #[ \f1 -. ds #] \fP -.\} -.if t \{\ -. ds #H ((1u-(\\\\n(.fu%2u))*.13m) -. ds #V .6m -. ds #F 0 -. ds #[ \& -. ds #] \& -.\} -. \" simple accents for nroff and troff -.if n \{\ -. ds ' \& -. ds ` \& -. ds ^ \& -. ds , \& -. ds ~ ~ -. ds / -.\} -.if t \{\ -. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" -. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' -. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' -. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' -. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' -. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' -.\} -. \" troff and (daisy-wheel) nroff accents -.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' -.ds 8 \h'\*(#H'\(*b\h'-\*(#H' -.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] -.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' -.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' -.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] -.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] -.ds ae a\h'-(\w'a'u*4/10)'e -.ds Ae A\h'-(\w'A'u*4/10)'E -. \" corrections for vroff -.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' -.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' -. \" for low resolution devices (crt and lpr) -.if \n(.H>23 .if \n(.V>19 \ -\{\ -. ds : e -. ds 8 ss -. ds o a -. ds d- d\h'-1'\(ga -. ds D- D\h'-1'\(hy -. ds th \o'bp' -. ds Th \o'LP' -. ds ae ae -. ds Ae AE -.\} -.rm #[ #] #H #V #F C -.\" ======================================================================== -.\" -.IX Title "ECHANGELOG 1" -.TH ECHANGELOG 1 "2004-04-02" "perl v5.8.2" "User Contributed Perl Documentation" -.SH "NAME" -echangelog \- Gentoo: update portage ChangeLogs -.SH "SYNOPSIS" -.IX Header "SYNOPSIS" -echangelog [ \fItext\fR ] -.SH "DESCRIPTION" -.IX Header "DESCRIPTION" -This tool provides an easy way to create or update portage ChangeLogs -in Gentoo. The tool scans the current directory, which is assumed to -be a package directory such as /usr/portage/app\-editors/vim, finds -what files have been changed or added, and inserts the appropriate -entry to ChangeLog. If \fItext\fR is not provided on the command\-line, -echangelog prompts for it. -.PP -All modifications should occur before running echangelog so that it -can include the appropriate file information in the ChangeLog entry. -For example, you should run \*(L"cvs add\*(R" on your files, otherwise -echangelog won't know those files are part of the update. -.PP -If your text would cause the ChangeLog entry to exceed 80 columns, it -will be rewrapped to keep the ChangeLog neat. If you need special -formatting in the ChangeLog, then you can either (1) run echangelog -with no text on the command\-line, and make sure that your text won't -be too wide, (2) edit the ChangeLog manually. If you prefer (2), I'd -recommend something like \*(L"echangelog blah\*(R" so that the header lines -are computed correctly, then edit and change \*(L"blah\*(R" to your preferred -text. -.PP -In addition to updating the ChangeLog, echangelog will automatically -update the copyright year of all out-of-date ebuilds, as well as the -ChangeLog itself. These updates are included in the diff displayed by -echangelog when it finishes its work. -.SH "OPTIONS" -.IX Header "OPTIONS" -Presently echangelog is simple enough that it supplies no options. -Probably I'll add \fB\-\-help\fR and \fB\-\-version\fR in the future, but for -now it's enough to track the gentoolkit version. -.SH "EXAMPLES" -.IX Header "EXAMPLES" -To create a ChangeLog for a completely new package. The header is -parsed from skel.ebuild. -.PP -.Vb 2 -\& $ cvs add metalog-0.1.ebuild -\& cvs server: use 'cvs commit' to add this file permanently -.Ve -.PP -.Vb 13 -\& $ echangelog 'New ebuild, thanks to Harvey McGillicuddy' -\& --- ChangeLog 1969-12-31 19:00:00.000000000 -0500 -\& +++ ChangeLog.new 2003-02-23 14:04:06.000000000 -0500 -\& @@ -0,0 +1,9 @@ -\& +# ChangeLog for app-admin/metalog -\& +# Copyright 2000-2003 Gentoo Technologies, Inc.; Distributed under the GPL v2 -\& +# $Header$ -\& + -\& +*metalog-0.1 (23 Feb 2003) -\& + -\& + 23 Feb 2003; Aron Griffis metalog-0.1.ebuild : -\& + New ebuild, thanks to Harvey McGillicuddy -\& + -.Ve -.PP -To bump a revision. Note you need to \*(L"cvs add\*(R" so that echangelog -will notice the new file. -.PP -.Vb 2 -\& $ cvs add metalog-0.1-r1.ebuild -\& cvs server: use 'cvs commit' to add this file permanently -.Ve -.PP -.Vb 6 -\& $ echangelog 'Bump revision to fix bug #999' -\& --- ChangeLog 2003-02-23 14:04:06.000000000 -0500 -\& +++ ChangeLog.new 2003-02-23 14:07:48.000000000 -0500 -\& @@ -2,6 +2,11 @@ -\& # Copyright 2000-2003 Gentoo Technologies, Inc.; Distributed under the GPL v2 -\& # $Header$ -.Ve -.PP -.Vb 6 -\& +*metalog-0.1-r1 (23 Feb 2003) -\& + -\& + 23 Feb 2003; Aron Griffis metalog-0.1-r1.ebuild : -\& + Bump revision to fix bug #999 -\& + -\& *metalog-0.1 (23 Feb 2003) -.Ve -.PP -.Vb 1 -\& 23 Feb 2003; Aron Griffis metalog-0.1.ebuild : -.Ve -.PP -For a multi-line entry, omit the command-line arg. -.PP -.Vb 10 -\& $ echangelog -\& Please type the log entry, finish with ctrl-d -\& Bump revision to fix bug #999. Necessary to bump the revision because -\& the problem appears at run-time, not compile-time. This should also -\& give users the updated default configuration file. -\& --- ChangeLog 2003-02-23 14:09:12.000000000 -0500 -\& +++ ChangeLog.new 2003-02-23 14:12:43.000000000 -0500 -\& @@ -2,6 +2,13 @@ -\& # Copyright 2000-2003 Gentoo Technologies, Inc.; Distributed under the GPL v2 -\& # $Header$ -.Ve -.PP -.Vb 8 -\& +*metalog-0.1-r1 (23 Feb 2003) -\& + -\& + 23 Feb 2003; Aron Griffis metalog-0.1-r1.ebuild : -\& + Bump revision to fix bug #999. Necessary to bump the revision because -\& + the problem appears at run-time, not compile-time. This should also -\& + give users the updated default configuration file. -\& + -\& *metalog-0.1 (23 Feb 2003) -.Ve -.PP -.Vb 1 -\& 23 Feb 2003; Aron Griffis metalog-0.1.ebuild : -.Ve -.SH "ENVIRONMENT VARIABLES" -.IX Header "ENVIRONMENT VARIABLES" -.IP "\s-1ECHANGELOG_USER\s0" 4 -.IX Item "ECHANGELOG_USER" -If echangelog can't figure out your username for the entry, you should -set \s-1ECHANGELOG_USER\s0. For example, export ECHANGELOG_USER=\*(L"Aron -Griffis \*(R" -.SH "NOTES" -.IX Header "NOTES" -As of the most recent version of echangelog (when this man-page -appeared), echangelog puts all new entries at the top of the file -instead of finding the appropriate *version line within the file. -This is because that \*(L"new\*(R" ChangeLog format was never agreed upon by -the Gentoo developers. Unfortunately the existence of both formats -will undoubtedly cause much confusion. -.PP -This also means that the examples above are wrong, since I just copied -them from some old email. However they're not much wrong. ;\-) -.PP -This tool was written by Aron Griffis . Bugs -found should be filed against me at http://bugs.gentoo.org/ diff --git a/trunk/src/echangelog/echangelog.pod b/trunk/src/echangelog/echangelog.pod deleted file mode 100644 index 192af8d..0000000 --- a/trunk/src/echangelog/echangelog.pod +++ /dev/null @@ -1,136 +0,0 @@ -=head1 NAME - -echangelog - Gentoo: update portage ChangeLogs - -=head1 SYNOPSIS - -echangelog [ I ] - -=head1 DESCRIPTION - -This tool provides an easy way to create or update portage ChangeLogs -in Gentoo. The tool scans the current directory, which is assumed to -be a package directory such as /usr/portage/app-editors/vim, finds -what files have been changed or added, and inserts the appropriate -entry to ChangeLog. If I is not provided on the command-line, -echangelog prompts for it. - -All modifications should occur before running echangelog so that it -can include the appropriate file information in the ChangeLog entry. -For example, you should run "cvs add" on your files, otherwise -echangelog won't know those files are part of the update. - -If your text would cause the ChangeLog entry to exceed 80 columns, it -will be rewrapped to keep the ChangeLog neat. If you need special -formatting in the ChangeLog, then you can either (1) run echangelog -with no text on the command-line, and make sure that your text won't -be too wide, (2) edit the ChangeLog manually. If you prefer (2), I'd -recommend something like "echangelog blah" so that the header lines -are computed correctly, then edit and change "blah" to your preferred -text. - -In addition to updating the ChangeLog, echangelog will automatically -update the copyright year of all out-of-date ebuilds, as well as the -ChangeLog itself. These updates are included in the diff displayed by -echangelog when it finishes its work. - -=head1 OPTIONS - -Presently echangelog is simple enough that it supplies no options. -Probably I'll add B<--help> and B<--version> in the future, but for -now it's enough to track the gentoolkit version. - -=head1 EXAMPLES - -To create a ChangeLog for a completely new package. The header is -parsed from skel.ebuild. - - $ cvs add metalog-0.1.ebuild - cvs server: use 'cvs commit' to add this file permanently - - $ echangelog 'New ebuild, thanks to Harvey McGillicuddy' - --- ChangeLog 1969-12-31 19:00:00.000000000 -0500 - +++ ChangeLog.new 2003-02-23 14:04:06.000000000 -0500 - @@ -0,0 +1,9 @@ - +# ChangeLog for app-admin/metalog - +# Copyright 2000-2003 Gentoo Technologies, Inc.; Distributed under the GPL v2 - +# $Header$ - + - +*metalog-0.1 (23 Feb 2003) - + - + 23 Feb 2003; Aron Griffis metalog-0.1.ebuild : - + New ebuild, thanks to Harvey McGillicuddy - + - -To bump a revision. Note you need to "cvs add" so that echangelog -will notice the new file. - - $ cvs add metalog-0.1-r1.ebuild - cvs server: use 'cvs commit' to add this file permanently - - $ echangelog 'Bump revision to fix bug #999' - --- ChangeLog 2003-02-23 14:04:06.000000000 -0500 - +++ ChangeLog.new 2003-02-23 14:07:48.000000000 -0500 - @@ -2,6 +2,11 @@ - # Copyright 2000-2003 Gentoo Technologies, Inc.; Distributed under the GPL v2 - # $Header$ - - +*metalog-0.1-r1 (23 Feb 2003) - + - + 23 Feb 2003; Aron Griffis metalog-0.1-r1.ebuild : - + Bump revision to fix bug #999 - + - *metalog-0.1 (23 Feb 2003) - - 23 Feb 2003; Aron Griffis metalog-0.1.ebuild : - -For a multi-line entry, omit the command-line arg. - - $ echangelog - Please type the log entry, finish with ctrl-d - Bump revision to fix bug #999. Necessary to bump the revision because - the problem appears at run-time, not compile-time. This should also - give users the updated default configuration file. - --- ChangeLog 2003-02-23 14:09:12.000000000 -0500 - +++ ChangeLog.new 2003-02-23 14:12:43.000000000 -0500 - @@ -2,6 +2,13 @@ - # Copyright 2000-2003 Gentoo Technologies, Inc.; Distributed under the GPL v2 - # $Header$ - - +*metalog-0.1-r1 (23 Feb 2003) - + - + 23 Feb 2003; Aron Griffis metalog-0.1-r1.ebuild : - + Bump revision to fix bug #999. Necessary to bump the revision because - + the problem appears at run-time, not compile-time. This should also - + give users the updated default configuration file. - + - *metalog-0.1 (23 Feb 2003) - - 23 Feb 2003; Aron Griffis metalog-0.1.ebuild : - -=head1 ENVIRONMENT VARIABLES - -=over - -=item ECHANGELOG_USER - -If echangelog can't figure out your username for the entry, you should -set ECHANGELOG_USER. For example, export ECHANGELOG_USER="Aron -Griffis " - -=back - -=head1 NOTES - -As of the most recent version of echangelog (when this man-page -appeared), echangelog puts all new entries at the top of the file -instead of finding the appropriate *version line within the file. -This is because that "new" ChangeLog format was never agreed upon by -the Gentoo developers. Unfortunately the existence of both formats -will undoubtedly cause much confusion. - -This also means that the examples above are wrong, since I just copied -them from some old email. However they're not much wrong. ;-) - -This tool was written by Aron Griffis . Bugs -found should be filed against me at http://bugs.gentoo.org/ diff --git a/trunk/src/eclean/AUTHORS b/trunk/src/eclean/AUTHORS deleted file mode 100644 index 9263cbb..0000000 --- a/trunk/src/eclean/AUTHORS +++ /dev/null @@ -1 +0,0 @@ -Thomas de Grenier de Latour (tgl) diff --git a/trunk/src/eclean/ChangeLog b/trunk/src/eclean/ChangeLog deleted file mode 100644 index 36d9a28..0000000 --- a/trunk/src/eclean/ChangeLog +++ /dev/null @@ -1,27 +0,0 @@ -2005-12-19 Paul Varner - * Add support for reqular expression matching for file names in the - exclude files. - -2005-08-28 Thomas de Grenier de Latour (tgl) - * Version 0.4.1 - * added support for some "eclean-dist" and "eclean-pkg" symlinks on eclean - (and thus refactored command-line parsing and help screen code) - * accept file names in exclude files for specific distfiles protection - (useful to protect the OOo i18n files for instance, which are not in - $SRC_URI but put there manually) - * minor rewrite of some findDistfiles() code - * added /usr/lib/portage/pym python path, just to be sure it comes first - (after all, "ouput" is a pretty generic name for a python module...) - * updated manpage - -2005-08-27 Thomas de Grenier de Latour (tgl) - * Version 0.4 - * added exclusion files support - * added time limit option - * added size limit option (for distfiles only) - * added fetch-restricted distfile optionnal protection - * added --package-names option for protection of all versions of installed - packages. - * removed support of multiple actions on command-line. That would have been - hell with action-specific options. - * updated manpage diff --git a/trunk/src/eclean/Makefile b/trunk/src/eclean/Makefile deleted file mode 100644 index 79c5895..0000000 --- a/trunk/src/eclean/Makefile +++ /dev/null @@ -1,24 +0,0 @@ -# Copyright 2004 Karl Trygve Kalleberg -# Copyright 2004 Gentoo Technologies, Inc. -# Distributed under the terms of the GNU General Public License v2 -# -# $Header$ - -include ../../makedefs.mak - -all: - -dist: - mkdir -p ../../$(distdir)/src/eclean - cp eclean eclean.1 Makefile *.exclude ../../$(distdir)/src/eclean - cp AUTHORS THANKS TODO ChangeLog ../../$(distdir)/src/eclean - -install: - install -m 0755 eclean $(bindir)/ - ln -sf eclean $(bindir)/eclean-pkg - ln -sf eclean $(bindir)/eclean-dist - install -d $(sysconfdir)/eclean - install -m 0644 distfiles.exclude packages.exclude $(sysconfdir)/eclean/ - install -d $(docdir)/eclean - install -m 0644 AUTHORS THANKS TODO ChangeLog $(docdir)/eclean/ - install -m 0644 eclean.1 $(mandir)/ diff --git a/trunk/src/eclean/THANKS b/trunk/src/eclean/THANKS deleted file mode 100644 index 6b8dc2e..0000000 --- a/trunk/src/eclean/THANKS +++ /dev/null @@ -1,7 +0,0 @@ -The starting point ideas were found here: -http://forums.gentoo.org/viewtopic.php?t=3011 - -Thanks to eswanson and far for their contributions, and to wolf31o2 for his -support. Thanks also to karltk, some of this code was at some point inspired -by his "equery" tool. And thanks to people who had a look on bug #33877: -Benjamin Braatz, fuzzyray, genone, etc. diff --git a/trunk/src/eclean/TODO b/trunk/src/eclean/TODO deleted file mode 100644 index 04e64ca..0000000 --- a/trunk/src/eclean/TODO +++ /dev/null @@ -1,16 +0,0 @@ -- exclusion file syntax could be improved (maybe it should support real - dep-atoms, or wildcards, etc.) - -- some policy to keep the X latest versions of a package (in each of its - SLOT maybe) would be really cool... - -- add an option to protect system binary packages - => yup, but later... (needs some portage modifications to be done right) - -- add actions for PORT_LOGDIR and/or /var/tmp/portage cleaning? - => bah, don't know... imho tmpreaper or find+rm onliners are enough here - -- cleanup of DISTDIR/cvs-src when action=distfiles - => i never use cvs ebuilds, i should check what it does exactly - -- rewrite for a decent Portage API if there ever is one diff --git a/trunk/src/eclean/distfiles.exclude b/trunk/src/eclean/distfiles.exclude deleted file mode 100644 index a31be55..0000000 --- a/trunk/src/eclean/distfiles.exclude +++ /dev/null @@ -1,5 +0,0 @@ -# /etc/eclean/distfiles.exclude -# In this file you can list some categories or cat/pkg-name for which you want -# to protect distfiles from "ecleaning". You can also name some specific files. -# See `man eclean` for syntax details. -metadata.dtd diff --git a/trunk/src/eclean/eclean b/trunk/src/eclean/eclean deleted file mode 100644 index 4fdec10..0000000 --- a/trunk/src/eclean/eclean +++ /dev/null @@ -1,807 +0,0 @@ -#!/usr/bin/env python -# Copyright 2003-2005 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Header: $ - - -############################################################################### -# Meta: -__author__ = "Thomas de Grenier de Latour (tgl)" -__email__ = "degrenier@easyconnect.fr" -__version__ = "0.4.1" -__productname__ = "eclean" -__description__ = "A cleaning tool for Gentoo distfiles and binaries." - - -############################################################################### -# Python imports: -import sys -import os, stat -import re -import time -import getopt -import fpformat -import signal -try: - import portage -except ImportError: - sys.path.insert(0, "/usr/lib/portage/pym") - import portage -try: - from portage.output import * -except ImportError: - from output import * - -listdir = portage.listdir - -############################################################################### -# Misc. shortcuts to some portage stuff: -port_settings = portage.settings -distdir = port_settings["DISTDIR"] -pkgdir = port_settings["PKGDIR"] - - -############################################################################### -# printVersion: -def printVersion(): - print "%s (version %s) - %s" \ - % (__productname__, __version__, __description__) - print "Author: %s <%s>" % (__author__,__email__) - print "Copyright 2003-2005 Gentoo Foundation" - print "Distributed under the terms of the GNU General Public License v2" - - -############################################################################### -# printUsage: print help message. May also print partial help to stderr if an -# error from {'options','actions'} is specified. -def printUsage(error=None,help=None): - out = sys.stdout - if error: out = sys.stderr - if not error in ('actions', 'global-options', \ - 'packages-options', 'distfiles-options', \ - 'merged-packages-options', 'merged-distfiles-options', \ - 'time', 'size'): - error = None - if not error and not help: help = 'all' - if error == 'time': - eerror("Wrong time specification") - print >>out, "Time specification should be an integer followed by a"+ \ - " single letter unit." - print >>out, "Available units are: y (years), m (months), w (weeks), "+ \ - "d (days) and h (hours)." - print >>out, "For instance: \"1y\" is \"one year\", \"2w\" is \"two"+ \ - " weeks\", etc. " - return - if error == 'size': - eerror("Wrong size specification") - print >>out, "Size specification should be an integer followed by a"+ \ - " single letter unit." - print >>out, "Available units are: G, M, K and B." - print >>out, "For instance: \"10M\" is \"ten megabytes\", \"200K\" "+ \ - "is \"two hundreds kilobytes\", etc." - return - if error in ('global-options', 'packages-options', 'distfiles-options', \ - 'merged-packages-options', 'merged-distfiles-options',): - eerror("Wrong option on command line.") - print >>out - elif error == 'actions': - eerror("Wrong or missing action name on command line.") - print >>out - print >>out, white("Usage:") - if error in ('actions','global-options', 'packages-options', \ - 'distfiles-options') or help == 'all': - print >>out, " "+turquoise(__productname__), \ - yellow("[global-option] ..."), \ - green(""), \ - yellow("[action-option] ...") - if error == 'merged-distfiles-options' or help in ('all','distfiles'): - print >>out, " "+turquoise(__productname__+'-dist'), \ - yellow("[global-option, distfiles-option] ...") - if error == 'merged-packages-options' or help in ('all','packages'): - print >>out, " "+turquoise(__productname__+'-pkg'), \ - yellow("[global-option, packages-option] ...") - if error in ('global-options', 'actions'): - print >>out, " "+turquoise(__productname__), \ - yellow("[--help, --version]") - if help == 'all': - print >>out, " "+turquoise(__productname__+"(-dist,-pkg)"), \ - yellow("[--help, --version]") - if error == 'merged-packages-options' or help == 'packages': - print >>out, " "+turquoise(__productname__+'-pkg'), \ - yellow("[--help, --version]") - if error == 'merged-distfiles-options' or help == 'distfiles': - print >>out, " "+turquoise(__productname__+'-dist'), \ - yellow("[--help, --version]") - print >>out - if error in ('global-options', 'merged-packages-options', \ - 'merged-distfiles-options') or help: - print >>out, "Available global", yellow("options")+":" - print >>out, yellow(" -C, --nocolor")+ \ - " - turn off colors on output" - print >>out, yellow(" -d, --destructive")+ \ - " - only keep the minimum for a reinstallation" - print >>out, yellow(" -e, --exclude-file=")+ \ - " - path to the exclusion file" - print >>out, yellow(" -i, --interactive")+ \ - " - ask confirmation before deletions" - print >>out, yellow(" -n, --package-names")+ \ - " - protect all versions (when --destructive)" - print >>out, yellow(" -p, --pretend")+ \ - " - only display what would be cleaned" - print >>out, yellow(" -q, --quiet")+ \ - " - be as quiet as possible" - print >>out, yellow(" -t, --time-limit=

              1. elements for a given
                  or
                    node. - - @type listnode: xml.dom.Node - @param listnode:
                      or
                        list to get the elements for - @rtype: List of Strings - @return: a list that contains the value of the
                      1. elements - """ - rValue = [] - if not listnode.nodeName in ["ul", "ol"]: - raise GlsaFormatException("Invalid function call: listnode is not
                          or
                            ") - for li in listnode.childNodes: - if li.nodeType != xml.dom.Node.ELEMENT_NODE: - continue - rValue.append(getText(li, format="strip")) - return rValue - -def getText(node, format): - """ - This is the main parser function. It takes a node and traverses - recursive over the subnodes, getting the text of each (and the - I{link} attribute for and ). Depending on the I{format} - parameter the text might be formatted by adding/removing newlines, - tabs and spaces. This function is only useful for the GLSA DTD, - it's not applicable for other DTDs. - - @type node: xml.dom.Node - @param node: the root node to start with the parsing - @type format: String - @param format: this should be either I{strip}, I{keep} or I{xml} - I{keep} just gets the text and does no formatting. - I{strip} replaces newlines and tabs with spaces and - replaces multiple spaces with one space. - I{xml} does some more formatting, depending on the - type of the encountered nodes. - @rtype: String - @return: the (formatted) content of the node and its subnodes - """ - rValue = "" - if format in ["strip", "keep"]: - if node.nodeName in ["uri", "mail"]: - rValue += node.childNodes[0].data+": "+node.getAttribute("link") - else: - for subnode in node.childNodes: - if subnode.nodeName == "#text": - rValue += subnode.data - else: - rValue += getText(subnode, format) - else: - for subnode in node.childNodes: - if subnode.nodeName == "p": - for p_subnode in subnode.childNodes: - if p_subnode.nodeName == "#text": - rValue += p_subnode.data.strip() - elif p_subnode.nodeName in ["uri", "mail"]: - rValue += p_subnode.childNodes[0].data - rValue += " ( "+p_subnode.getAttribute("link")+" )" - rValue += NEWLINE_ESCAPE - elif subnode.nodeName == "ul": - for li in getListElements(subnode): - rValue += "-"+SPACE_ESCAPE+li+NEWLINE_ESCAPE+" " - elif subnode.nodeName == "ol": - i = 0 - for li in getListElements(subnode): - i = i+1 - rValue += str(i)+"."+SPACE_ESCAPE+li+NEWLINE_ESCAPE+" " - elif subnode.nodeName == "code": - rValue += getText(subnode, format="keep").replace("\n", NEWLINE_ESCAPE) - if rValue[-1*len(NEWLINE_ESCAPE):] != NEWLINE_ESCAPE: - rValue += NEWLINE_ESCAPE - elif subnode.nodeName == "#text": - rValue += subnode.data - else: - raise GlsaFormatException("Invalid Tag found: ", subnode.nodeName) - if format == "strip": - rValue = rValue.strip(" \n\t") - rValue = re.sub("[\s]{2,}", " ", rValue) - # Hope that the utf conversion doesn't break anything else - return rValue.encode("utf_8") - -def getMultiTagsText(rootnode, tagname, format): - """ - Returns a list with the text of all subnodes of type I{tagname} - under I{rootnode} (which itself is not parsed) using the given I{format}. - - @type rootnode: xml.dom.Node - @param rootnode: the node to search for I{tagname} - @type tagname: String - @param tagname: the name of the tags to search for - @type format: String - @param format: see L{getText} - @rtype: List of Strings - @return: a list containing the text of all I{tagname} childnodes - """ - rValue = [] - for e in rootnode.getElementsByTagName(tagname): - rValue.append(getText(e, format)) - return rValue - -def makeAtom(pkgname, versionNode): - """ - creates from the given package name and information in the - I{versionNode} a (syntactical) valid portage atom. - - @type pkgname: String - @param pkgname: the name of the package for this atom - @type versionNode: xml.dom.Node - @param versionNode: a or Node that - contains the version information for this atom - @rtype: String - @return: the portage atom - """ - rValue = opMapping[versionNode.getAttribute("range")] \ - + pkgname \ - + "-" + getText(versionNode, format="strip") - return str(rValue) - -def makeVersion(versionNode): - """ - creates from the information in the I{versionNode} a - version string (format ). - - @type versionNode: xml.dom.Node - @param versionNode: a or Node that - contains the version information for this atom - @rtype: String - @return: the version string - """ - return opMapping[versionNode.getAttribute("range")] \ - +getText(versionNode, format="strip") - -def match(atom, portdbname, match_type="default"): - """ - wrapper that calls revisionMatch() or portage.dbapi.match() depending on - the given atom. - - @type atom: string - @param atom: a <~ or >~ atom or a normal portage atom that contains the atom to match against - @type portdb: portage.dbapi - @param portdb: one of the portage databases to use as information source - @type match_type: string - @param match_type: if != "default" passed as first argument to dbapi.xmatch - to apply the wanted visibility filters - - @rtype: list of strings - @return: a list with the matching versions - """ - db = portage.db["/"][portdbname].dbapi - if atom[2] == "~": - return revisionMatch(atom, db, match_type=match_type) - elif match_type == "default" or not hasattr(db, "xmatch"): - return db.match(atom) - else: - return db.xmatch(match_type, atom) - -def revisionMatch(revisionAtom, portdb, match_type="default"): - """ - handler for the special >~, >=~, <=~ and <~ atoms that are supposed to behave - as > and < except that they are limited to the same version, the range only - applies to the revision part. - - @type revisionAtom: string - @param revisionAtom: a <~ or >~ atom that contains the atom to match against - @type portdb: portage.dbapi - @param portdb: one of the portage databases to use as information source - @type match_type: string - @param match_type: if != "default" passed as first argument to portdb.xmatch - to apply the wanted visibility filters - - @rtype: list of strings - @return: a list with the matching versions - """ - if match_type == "default" or not hasattr(portdb, "xmatch"): - mylist = portdb.match(re.sub("-r[0-9]+$", "", revisionAtom[2:])) - else: - mylist = portdb.xmatch(match_type, re.sub("-r[0-9]+$", "", revisionAtom[2:])) - rValue = [] - for v in mylist: - r1 = portage.pkgsplit(v)[-1][1:] - r2 = portage.pkgsplit(revisionAtom[3:])[-1][1:] - if eval(r1+" "+revisionAtom[0:2]+" "+r2): - rValue.append(v) - return rValue - - -def getMinUpgrade(vulnerableList, unaffectedList, minimize=True): - """ - Checks if the systemstate is matching an atom in - I{vulnerableList} and returns string describing - the lowest version for the package that matches an atom in - I{unaffectedList} and is greater than the currently installed - version or None if the system is not affected. Both - I{vulnerableList} and I{unaffectedList} should have the - same base package. - - @type vulnerableList: List of Strings - @param vulnerableList: atoms matching vulnerable package versions - @type unaffectedList: List of Strings - @param unaffectedList: atoms matching unaffected package versions - @type minimize: Boolean - @param minimize: True for a least-change upgrade, False for emerge-like algorithm - - @rtype: String | None - @return: the lowest unaffected version that is greater than - the installed version. - """ - rValue = None - v_installed = [] - u_installed = [] - for v in vulnerableList: - v_installed += match(v, "vartree") - - for u in unaffectedList: - u_installed += match(u, "vartree") - - install_unaffected = True - for i in v_installed: - if i not in u_installed: - install_unaffected = False - - if install_unaffected: - return rValue - - for u in unaffectedList: - mylist = match(u, "porttree", match_type="match-all") - for c in mylist: - c_pv = portage.catpkgsplit(c) - i_pv = portage.catpkgsplit(portage.best(v_installed)) - if portage.pkgcmp(c_pv[1:], i_pv[1:]) > 0 \ - and (rValue == None \ - or not match("="+rValue, "porttree") \ - or (minimize ^ (portage.pkgcmp(c_pv[1:], portage.catpkgsplit(rValue)[1:]) > 0)) \ - and match("="+c, "porttree")) \ - and portage.db["/"]["porttree"].dbapi.aux_get(c, ["SLOT"]) == portage.db["/"]["vartree"].dbapi.aux_get(portage.best(v_installed), ["SLOT"]): - rValue = c_pv[0]+"/"+c_pv[1]+"-"+c_pv[2] - if c_pv[3] != "r0": # we don't like -r0 for display - rValue += "-"+c_pv[3] - return rValue - - -# simple Exception classes to catch specific errors -class GlsaTypeException(Exception): - def __init__(self, doctype): - Exception.__init__(self, "wrong DOCTYPE: %s" % doctype) - -class GlsaFormatException(Exception): - pass - -class GlsaArgumentException(Exception): - pass - -# GLSA xml data wrapper class -class Glsa: - """ - This class is a wrapper for the XML data and provides methods to access - and display the contained data. - """ - def __init__(self, myid, myconfig): - """ - Simple constructor to set the ID, store the config and gets the - XML data by calling C{self.read()}. - - @type myid: String - @param myid: String describing the id for the GLSA object (standard - GLSAs have an ID of the form YYYYMM-nn) or an existing - filename containing a GLSA. - @type myconfig: portage.config - @param myconfig: the config that should be used for this object. - """ - if re.match(r'\d{6}-\d{2}', myid): - self.type = "id" - elif os.path.exists(myid): - self.type = "file" - else: - raise GlsaArgumentException("Given ID "+myid+" isn't a valid GLSA ID or filename.") - self.nr = myid - self.config = myconfig - self.read() - - def read(self): - """ - Here we build the filename from the config and the ID and pass - it to urllib to fetch it from the filesystem or a remote server. - - @rtype: None - @return: None - """ - if self.config["CHECKMODE"] == "local": - repository = "file://" + self.config["GLSA_DIR"] - else: - repository = self.config["GLSA_SERVER"] - if self.type == "file": - myurl = "file://"+self.nr - else: - myurl = repository + self.config["GLSA_PREFIX"] + str(self.nr) + self.config["GLSA_SUFFIX"] - self.parse(urllib.urlopen(myurl)) - return None - - def parse(self, myfile): - """ - This method parses the XML file and sets up the internal data - structures by calling the different helper functions in this - module. - - @type myfile: String - @param myfile: Filename to grab the XML data from - @rtype: None - @returns: None - """ - self.DOM = xml.dom.minidom.parse(myfile) - if not self.DOM.doctype: - raise GlsaTypeException(None) - elif self.DOM.doctype.systemId != "http://www.gentoo.org/dtd/glsa.dtd": - raise GlsaTypeException(self.DOM.doctype.systemId) - myroot = self.DOM.getElementsByTagName("glsa")[0] - if self.type == "id" and myroot.getAttribute("id") != self.nr: - raise GlsaFormatException("filename and internal id don't match:" + myroot.getAttribute("id") + " != " + self.nr) - - # the simple (single, required, top-level, #PCDATA) tags first - self.title = getText(myroot.getElementsByTagName("title")[0], format="strip") - self.synopsis = getText(myroot.getElementsByTagName("synopsis")[0], format="strip") - self.announced = getText(myroot.getElementsByTagName("announced")[0], format="strip") - self.revised = getText(myroot.getElementsByTagName("revised")[0], format="strip") - - # now the optional and 0-n toplevel, #PCDATA tags and references - try: - self.access = getText(myroot.getElementsByTagName("access")[0], format="strip") - except IndexError: - self.access = "" - self.bugs = getMultiTagsText(myroot, "bug", format="strip") - self.references = getMultiTagsText(myroot.getElementsByTagName("references")[0], "uri", format="keep") - - # and now the formatted text elements - self.description = getText(myroot.getElementsByTagName("description")[0], format="xml") - self.workaround = getText(myroot.getElementsByTagName("workaround")[0], format="xml") - self.resolution = getText(myroot.getElementsByTagName("resolution")[0], format="xml") - self.impact_text = getText(myroot.getElementsByTagName("impact")[0], format="xml") - self.impact_type = myroot.getElementsByTagName("impact")[0].getAttribute("type") - try: - self.background = getText(myroot.getElementsByTagName("background")[0], format="xml") - except IndexError: - self.background = "" - - # finally the interesting tags (product, affected, package) - self.glsatype = myroot.getElementsByTagName("product")[0].getAttribute("type") - self.product = getText(myroot.getElementsByTagName("product")[0], format="strip") - self.affected = myroot.getElementsByTagName("affected")[0] - self.packages = {} - for p in self.affected.getElementsByTagName("package"): - name = p.getAttribute("name") - if not self.packages.has_key(name): - self.packages[name] = [] - tmp = {} - tmp["arch"] = p.getAttribute("arch") - tmp["auto"] = (p.getAttribute("auto") == "yes") - tmp["vul_vers"] = [makeVersion(v) for v in p.getElementsByTagName("vulnerable")] - tmp["unaff_vers"] = [makeVersion(v) for v in p.getElementsByTagName("unaffected")] - tmp["vul_atoms"] = [makeAtom(name, v) for v in p.getElementsByTagName("vulnerable")] - tmp["unaff_atoms"] = [makeAtom(name, v) for v in p.getElementsByTagName("unaffected")] - self.packages[name].append(tmp) - # TODO: services aren't really used yet - self.services = self.affected.getElementsByTagName("service") - return None - - def dump(self, outstream=sys.stdout): - """ - Dumps a plaintext representation of this GLSA to I{outfile} or - B{stdout} if it is ommitted. You can specify an alternate - I{encoding} if needed (default is latin1). - - @type outstream: File - @param outfile: Stream that should be used for writing - (defaults to sys.stdout) - """ - width = int(self.config["PRINTWIDTH"]) - outstream.write(center("GLSA %s: \n%s" % (self.nr, self.title), width)+"\n") - outstream.write((width*"=")+"\n") - outstream.write(wrap(self.synopsis, width, caption="Synopsis: ")+"\n") - outstream.write("Announced on: %s\n" % self.announced) - outstream.write("Last revised on: %s\n\n" % self.revised) - if self.glsatype == "ebuild": - for k in self.packages.keys(): - pkg = self.packages[k] - for path in pkg: - vul_vers = "".join(path["vul_vers"]) - unaff_vers = "".join(path["unaff_vers"]) - outstream.write("Affected package: %s\n" % k) - outstream.write("Affected archs: ") - if path["arch"] == "*": - outstream.write("All\n") - else: - outstream.write("%s\n" % path["arch"]) - outstream.write("Vulnerable: %s\n" % vul_vers) - outstream.write("Unaffected: %s\n\n" % unaff_vers) - elif self.glsatype == "infrastructure": - pass - if len(self.bugs) > 0: - outstream.write("\nRelated bugs: ") - for i in range(0, len(self.bugs)): - outstream.write(self.bugs[i]) - if i < len(self.bugs)-1: - outstream.write(", ") - else: - outstream.write("\n") - if self.background: - outstream.write("\n"+wrap(self.background, width, caption="Background: ")) - outstream.write("\n"+wrap(self.description, width, caption="Description: ")) - outstream.write("\n"+wrap(self.impact_text, width, caption="Impact: ")) - outstream.write("\n"+wrap(self.workaround, width, caption="Workaround: ")) - outstream.write("\n"+wrap(self.resolution, width, caption="Resolution: ")) - myreferences = "" - for r in self.references: - myreferences += (r.replace(" ", SPACE_ESCAPE)+NEWLINE_ESCAPE+" ") - outstream.write("\n"+wrap(myreferences, width, caption="References: ")) - outstream.write("\n") - - def isVulnerable(self): - """ - Tests if the system is affected by this GLSA by checking if any - vulnerable package versions are installed. Also checks for affected - architectures. - - @rtype: Boolean - @returns: True if the system is affected, False if not - """ - vList = [] - rValue = False - for k in self.packages.keys(): - pkg = self.packages[k] - for path in pkg: - if path["arch"] == "*" or self.config["ARCH"] in path["arch"].split(): - for v in path["vul_atoms"]: - rValue = rValue \ - or (len(match(v, "vartree")) > 0 \ - and getMinUpgrade(path["vul_atoms"], path["unaff_atoms"])) - return rValue - - def isApplied(self): - """ - Looks if the GLSA IDis in the GLSA checkfile to check if this - GLSA was already applied. - - @rtype: Boolean - @returns: True if the GLSA was applied, False if not - """ - aList = portage.grabfile(self.config["CHECKFILE"]) - return (self.nr in aList) - - def inject(self): - """ - Puts the ID of this GLSA into the GLSA checkfile, so it won't - show up on future checks. Should be called after a GLSA is - applied or on explicit user request. - - @rtype: None - @returns: None - """ - if not self.isApplied(): - checkfile = open(self.config["CHECKFILE"], "a+") - checkfile.write(self.nr+"\n") - checkfile.close() - return None - - def getMergeList(self, least_change=True): - """ - Returns the list of package-versions that have to be merged to - apply this GLSA properly. The versions are as low as possible - while avoiding downgrades (see L{getMinUpgrade}). - - @type least_change: Boolean - @param least_change: True if the smallest possible upgrade should be selected, - False for an emerge-like algorithm - @rtype: List of Strings - @return: list of package-versions that have to be merged - """ - rValue = [] - for pkg in self.packages.keys(): - for path in self.packages[pkg]: - update = getMinUpgrade(path["vul_atoms"], path["unaff_atoms"], minimize=least_change) - if update: - rValue.append(update) - return rValue diff --git a/trunk/src/lintool/AUTHORS b/trunk/src/lintool/AUTHORS deleted file mode 100644 index fe436cb..0000000 --- a/trunk/src/lintool/AUTHORS +++ /dev/null @@ -1 +0,0 @@ -Karl Trygve Kalleberg diff --git a/trunk/src/lintool/COPYING b/trunk/src/lintool/COPYING deleted file mode 100644 index 60549be..0000000 --- a/trunk/src/lintool/COPYING +++ /dev/null @@ -1,340 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) 19yy - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) 19yy name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General -Public License instead of this License. diff --git a/trunk/src/lintool/ChangeLog b/trunk/src/lintool/ChangeLog deleted file mode 100644 index 0e8c1e9..0000000 --- a/trunk/src/lintool/ChangeLog +++ /dev/null @@ -1,71 +0,0 @@ -2004-02-18 Karl Trygve Kalleberg - * Moved from separate CVS module to be part of gentoolkit-dev - -2002-10-31 Karl Trygve Kalleberg - * Fixed \$Header$ comment - * Fixed off-by-one in line numbering - -2002-10-30 Karl Trygve Kalleberg - * Now defaults to showing all details - * Added --no-details - * Better LICENSE parsing - * Better references to policy. - * Line numbers for whitespace testing. - * Released 0.2.4 - -2002-08-12 Karl Trygve Kalleberg - * Added more header tests - * Added initial tests for SLOT, KEYWORD and LICENSE - -2002-08-10 Karl Trygve Kalleberg - * Spurious space checker works again. - * Added Makefile, COPYING, README, AUTHORS, NEWS - -2002-07-22 Karl Trygve Kalleberg - * Changed A=${P}.tar.gz check to ^A=.*, as per Seemant's suggestion. - -2002-07-17 Karl Trygve Kalleberg - * Added TestLicense to ebuild.py - * Added --aux-license-dir= - * Added MunchieFormatter - * Added --formatter= - -2002-07-10 Karl Trygve Kalleberg - * Refactored; split tests into changelog, digest and ebuild-specific - * Added TestSyntax test to digest.py - * Added TestHeaders, TestConstructPresence, TestIndentation to - changelog.py - -2002-05-15 Karl Trygve Kalleberg - - * Fixed test for Author: and Maintainer: to warn about their - deprecation and recommend the use of ChangeLog instead. - * Added (E) and (W) prefixes to messages printed by --show-details - * Added --tests=- to allow turning off a - particular test easily. - * Added statistics output at the bottom. - * Updated man page to reflect new option feature. - * Fixed the --show-details, --show-separate annoyance. - * Fixed use flags parsing to disregard some false positives. - -2002-05-13 Karl Trygve Kalleberg - * Fixed --list-tests which was incorrectly --listTests - -2002-04-30 Karl Trygve Kalleberg - * Added 's cleanups - * Improved error reporting; now separates into errors and - warnings. - * Improved TestSpaces to check for non-conformant - line-continuations. - * Added TestUseFlags that checks that an ebuild only uses - sanctioned use flags (read from /usr/portage/profiles/use.desc) - * Added SLOT= to list desired env vars (warns if missing) - * Added LICENSE= to list of required env vars (errors if missing) - * Improved error messages - * Added --tests= option to allow the user to specify which tests - to run - * Added --list-tests option that lists available tests - * Updated man page. - -2002-03-22 Karl Trygve Kalleberg - * Added this ChangeLog diff --git a/trunk/src/lintool/NEWS b/trunk/src/lintool/NEWS deleted file mode 100644 index e69de29..0000000 diff --git a/trunk/src/lintool/README b/trunk/src/lintool/README deleted file mode 100644 index 1494aad..0000000 --- a/trunk/src/lintool/README +++ /dev/null @@ -1,23 +0,0 @@ - -Package: Lintool -Version: 0.1.3 -Author : Karl Trygve Kalleberg - - -MOTIVATION - -Lintool is a "lint" utility for the Gentoo Linux distribution. It is a -tool that tests ebuilds, changelogs and package digests for -well-formedness. It's intended to aid Gentoo Linux developers avoid most -common mistakes when packaging software for Gentoo. - -MECHANICS - -To check an ebuild, do lintool --ebuild -To check a ChangeLog, do lintool --changelog -To check a package digest, do lintoo --digest - -IMPROVEMENTS - -Any suggestions for improvements should be sent to karltk@gentoo.org, or -added as a bug assigned to me. diff --git a/trunk/src/lintool/lintool.1 b/trunk/src/lintool/lintool.1 deleted file mode 100644 index 11883e8..0000000 --- a/trunk/src/lintool/lintool.1 +++ /dev/null @@ -1,41 +0,0 @@ -.TH lintool "1" "March 2002" "gentoolkit 0.1.3" -.SH NAME -lintool \- manual page for the lintool program, a program that checks the -santity of ebuild scripts. -.SH SYNOPSIS -.B lintool -\fI\fR \fIebuilds...\fR -.SH DESCRIPTION -Lintool checks if a set of -.I ebuilds -conforms to the ebuild style guide. This is not -(yet) an exhaustive test, so your ebuild might be broken even if lintool -thinks it's okay. -.PP -.SH OPTIONS -.TP -\fB--no-summary\fI -Turn off total summary for all tests run on all ebuilds. -.TP -\fB--show-separate\fI -Show short summary of tests for each ebuild checked. -.TP -\fB--show-details\fI -Show full details of tests for each ebuild checked -.TP -\fB--tests=test1,test2,..\fI -Run only the tests specified to this option. Default is to run all -tests. One can turn off a particular test by pretending it with minus (e.g. -.I --tests=-TestUseFlags,-TestSpaces -). A list of tests can be obtained from -.I --list-tests -.TP -\fB--list-tests\fI -List available tests. -.SH AUTHORS -Karl Trygve Kalleberg , 2002 -.SH "SEE ALSO" -ebuild(5) -.TP -The \fI/usr/sbin/lintool\fR script. - diff --git a/trunk/src/lintool/lintool.py b/trunk/src/lintool/lintool.py deleted file mode 100755 index 721c744..0000000 --- a/trunk/src/lintool/lintool.py +++ /dev/null @@ -1,320 +0,0 @@ -#! /usr/bin/python -# -# Copyright 2002 Gentoo Technologies, Inc -# Distributed under the terms of the GNU General Public License v2.0 -# Author Karl Trygve Kalleberg -# -# About: -# lintool aims to check the stylistic and syntactical correctness for -# ebuilds, changelogs and digest files for the Gentoo packaging system. -# -# TODO -# -# - Make HTMLFormatter -# - -VERSION="0.2.4" - -import sys -import getopt - -from lintool import ebuild, changelog, digest - -class TextFormatter: - def section(self, s): - print "\n" + "-"*79 - print " " + s + "\n" - def bullet(self, s): - print "* " + s - def sub(self, s): - print "- " + s - def subwarn(self, s): - print "- (W) " + s - def suberr(self, s): - print "- (E) " + s - def subsub(self, s): - print " |" + s - def subsubwarn(self, s): - print " (W) |" + s - def subsuberr(self, s): - print " (E) |" + s - def line(self,s): - print s - def div(self, left, right): - l = len(left) - r = len(right) - return left + " " * (78-l-r) + right - -class MunchieFormatter: - def section(self, s): - print "[lintool] " + "-" * (78 - len("[lintool] ")) - print "[lintool] " + s + "\n" - def bullet(self, s): - print "[lintool] * " + s - def sub(self, s): - print "[lintool] - " + s - def subwarn(self, s): - print "[lintool] - (W) " + s - def suberr(self, s): - print "[lintool] - (E) " + s - def subsub(self, s): - print "[lintool] |" + s - def subsubwarn(self, s): - print "[lintool] (W) |" + s - def subsuberr(self, s): - print "[lintool] (E) |" + s - def line(self,s): - print "[lintool] " + s - def div(self, left, right): - l = len("[lintool] " + left) - r = len(right) - return left + " " * (78-l-r) + right - -formatters = { "text" : TextFormatter(), "munchie" : MunchieFormatter() } - -def extractFilename(path): - return path - -def runTests(tests,results,ins): - for j in tests: - j.reset() - - ln = 1 - for i in ins.readlines(): - for j in tests: - j.checkLine(i, ln) - ln += 1 - - hasWarning = 0 - hasError = 0 - for j in xrange(len(tests)): - if tests[j].hasErrors(): - results[j][0] += 1 - hasError = 1 - if tests[j].hasWarnings(): - results[j][1] += 1 - hasWarning = 1 - return (hasError, hasWarning) - -def showStatus(options,tests,formatter,file): - if options['showDetails'] or options['showSeparate']: - formatter.section("Status for " + file) - for j in tests: - if options['showSeparate'] or options['showDetails']: - l = len(j.getDesc()) - formatter.bullet(formatter.div(j.getDesc(), ": " + j.getStatus())) - if options['showDetails']: - j.report() - elif options['showShort']: - allOK = 1 - for j in tests: - if j.hasErrors(): - allOK = 0 - break - if allOK: - formatter.div(file, ": OK") - else: - formatter.div(file, ": Not OK") - # else fall through the bottom - -def usage(opts): - print sys.argv[0], "[options] ebuild [ebuild ebuild ... ]" - print - - if opts: - print "Where [options] include:" - for (short,long_,desc) in opts: - short_ = '' - for s in short: - short_ = short_ + '-' + s + ',' - long_ = '--' + long_ - opt = short_ + long_ - opt = opt.rjust(18) - print opt + ' ' + desc - print - -def parse_opts(argv): - options = { 'showSeparate': 0, - 'showTotal': 1, - 'showDetails': 1, - 'showShort': 1, - 'listTests': 0, - 'desiredTests': 0, - 'testMode' : "ebuild", - 'licenseDirs' : [ "/usr/portage/licenses" ], - 'formatter' : 'text' - } - - opts = (('', 'show-separate', - 'Show short summary of tests for each ebuild checked'), - - ('v', 'version', - 'Show program version'), - - ('', 'no-summary', - 'Do not show total summary'), - - ('', 'no-details', - 'Do not show full details of tests for each ebuild checked'), - - ('', 'ebuild', - 'Files to check are ebuilds'), - - ('', 'changelog', - 'Files to check are changelogs'), - - ('', 'digest', - 'Files to check are digests'), - - ('', 'tests=', - 'Comma-separated list of tests to run'), - - ('', 'list-tests', - 'List available tests'), - - ('', 'from-file=', - 'Read ebuilds from '), - - ('', 'formatter=', - "Use 'text' (default) or 'munchie' formatter"), - - ('', 'aux-license-dir=', - 'Add to directories to search for licenses'), - - ('?h', 'help', - 'Show this help'), - ) - - short_options = '' - long_options = [] - for (short,long_,desc) in opts: - short_options = short_options + short - if '=' in long_: - long_ = long_.split('=', 1)[0] + '=' - long_options.append(long_) - - try: - (option_list,args) = getopt.getopt(sys.argv[1:], short_options, long_options) - except getopt.GetoptError, details: - print 'Error parsing command line:',str(details) - sys.exit(1) - - for (option,value) in option_list: - if option in [ '--no-details' ]: - options['showShort'] = 1 - options['showDetails'] = 0 - elif option in [ '--show-separate' ]: - options['showShort'] = 0 - options['showSeparate'] = 1 - elif option in [ '--no-summary']: - options['showTotal'] = 0 - elif option in [ '--from-file' ]: - lines = open(value, 'r').readlines() - lines = [o.strip() for o in lines] - args = lines + args - elif option in [ '--tests' ]: - options['desiredTests'] = value.split(",") - elif option in [ '--formatter' ]: - options['formatter'] = value - elif option in [ '--list-tests' ]: - options['listTests'] = 1 - elif option in [ '--ebuild' ]: - options['testMode'] = 'ebuild' - elif option in [ '--changelog' ]: - options['testMode'] = 'changelog' - elif option in [ '--digest' ]: - options['testMode'] = 'digest' - elif option in [ '--aux-license-dir' ]: - options['licenseDirs'].append(value) - elif option in [ '-v', '--version' ]: - print "Lintool " + VERSION - sys.exit(0) - elif option in [ '-h', '-?', '--help' ]: - usage(opts) - sys.exit(0) - else: - # shouldn't ever happen. better to be safe - print "Unknown option - '%s'!" % (option) - sys.exit(1) - - return (options,args) - -def main(): - (options,args) = parse_opts(sys.argv[1:]) - - formatter = formatters[options['formatter']] - - # Get test suite for given mode - if options['testMode'] == "ebuild": - available_tests = ebuild.getTests(formatter, options) - elif options['testMode'] == "changelog": - available_tests = changelog.getTests(formatter, options) - elif options['testMode'] == "digest": - available_tests = digest.getTests(formatter, options) - - # List available tests, if that was the users request - if options['listTests']: - maxlen = 0 - for i in available_tests: - maxlen = max(len(i.__class__.__name__), maxlen) - for i in available_tests: - n = i.__class__.__name__ - print n + " " * (maxlen - len(n)) + " - " + i.getDesc() - - # Quit with short usage string, if no params given - if len(args) == 0: - usage(None) - sys.exit(1) - - # Create final list of tests to run - tests = [] - notTests = [] - if options['desiredTests']: - for i in options['desiredTests']: - for j in available_tests: - if len(i) and i[0] == "-": - notTests.append(i[1:]) - if j.__class__.__name__ == i: - tests.append(j) - else: - tests = available_tests - - if len(notTests): - for i in available_tests: - if i.__class__.__name__ not in notTests: - tests.append(i) - - results = [[0, 0] for x in range(len(tests))] - - # Set up for test run - numFiles = 0 - totalErrors = 0 - totalWarnings = 0 - - # Iterate through all files given as arguments, testing each file - # against the final list of tests - for i in args: - fn = extractFilename(i) - ins = open(i, "r") - numFiles += 1 - (hasError, hasWarning) = runTests(tests,results,ins) - totalErrors += hasError - totalWarnings += hasWarning - showStatus(options,tests,formatter,fn) - - # Show totals, if options allow it - if options['showTotal']: - formatter.section(formatter.div("Summary for all " + str(numFiles) + " " + options['testMode'] + "(s) checked", "#errors/warns")) - for i in xrange(len(tests)): - l = len(tests[i].getDesc()) - formatter.line(formatter.div(tests[i].getDesc(), ": %3d / %3d" % (results[i][0], results[i][1]))) - formatter.line(formatter.div("Total number of ebuilds with errors", \ - "%3d (%3d%%)" % (totalErrors, totalErrors*100/numFiles))) - formatter.line(formatter.div("Total number of ebuilds with warnings", \ - "%3d (%3d%%)" % (totalWarnings, totalWarnings*100/numFiles))) - if totalErrors: - sys.exit(1) - -if __name__ == "__main__": - main() - diff --git a/trunk/src/lintool/lintool/__init__.py b/trunk/src/lintool/lintool/__init__.py deleted file mode 100644 index 4d2e3a6..0000000 --- a/trunk/src/lintool/lintool/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ -import ebuild -import changelog -import digest diff --git a/trunk/src/lintool/lintool/changelog.py b/trunk/src/lintool/lintool/changelog.py deleted file mode 100644 index 1dad779..0000000 --- a/trunk/src/lintool/lintool/changelog.py +++ /dev/null @@ -1,105 +0,0 @@ -# Copyright 2002 Gentoo Technologies, Inc -# Distributed under the terms of the GNU General Public License v2.0 -# Author Karl Trygve Kalleberg - -from test import Test, Regex -import re - -class TestHeaders(Test): - def __init__(self, formatter,options): - Test.__init__(self,formatter,options) - self.desc = "Testing for malformed headers" - self.re = [ (1, # append result of regex match - re.compile("^(# Copyright 1999-(2000|2001).*)"), - "Suspect copyright year"), - (1, - re.compile("^(# /home.*)"), - "Suspect path in header"), - (0, # don't append result of regex match - re.compile("^(# Author.*)"), - "Use of Author field in the header is deprecated. Put name in ChangeLog"), - (0, - re.compile("^(# Maintainer.*)"), - "Use of Maintainer field in the header is deprecated. Put name in ChangeLog"), - (1, - re.compile("^(# /space.*)"), - "Suspect path in header")] - - def checkLine(self, s, ln): - for i in self.re: - k = i[1].match(s) - if k and i[0]: - self.warnings.append(i[2] + ": " + k.groups()[0] ) - elif k and not i[0]: - self.warnings.append(i[2]) - - def report(self): - if len(self.warnings): - self.formatter.subwarn("Has illegal or suspect headers:") - for i in self.warnings: - self.formatter.subsub(i) - -class TestConstructPresence(Test): - - def __init__(self, formatter,options): - Test.__init__(self,formatter,options) - self.desc = "Testing for presence of required constructs" - self.required = [ ["# ChangeLog for " + Regex.category + "/" + Regex.PN, - None, - None, - "proper ChangeLog line" - ], - - ["\*" + Regex.P + " \([0-9]+ [A-Z][a-z][a-z] 2002\).*", - None, - None, - "proper release entry on the form *package-1.0.0 (01 Apr 2000)" - ], - - [" [0-9]+ [A-Z][a-z][a-z] 2002; .* <.*@.*> .*:", - None, - None, - "proper changelog entry" - ] - ] - - for i in self.required: - i[1] = re.compile("^(" + i[0] + ")") - - def checkLine(self, s, ln): - for i in self.required: - k = i[1].match(s) - if k: - i[2] = 1 - - def report(self): - for i in self.required: - if not i[2]: - self.formatter.suberr("Missing " + i[3]) - - def hasErrors(self): - for i in self.required: - if not i[2]: - return 1 - -class TestIndentation(Test): - - def __init__(self, formatter,options): - Test.__init__(self,formatter,options) - self.desc = "Testing for proper indentation" - self.re = re.compile("^( |[#*].|\n).*") - - def checkLine(self, s, ln): - k = self.re.match(s) - if not k: - self.errors.append(s) - - def report(self): - for i in self.errors: - print i.replace(' ','%') - -def getTests(formatter,options): - return [ TestHeaders(formatter,options), - TestConstructPresence(formatter,options), - TestIndentation(formatter,options) - ] diff --git a/trunk/src/lintool/lintool/digest.py b/trunk/src/lintool/lintool/digest.py deleted file mode 100644 index 5f174ae..0000000 --- a/trunk/src/lintool/lintool/digest.py +++ /dev/null @@ -1,28 +0,0 @@ -# Copyright 2002 Gentoo Technologies, Inc -# Distributed under the terms of the GNU General Public License v2.0 -# Author Karl Trygve Kalleberg - -from test import Test -import re - -class TestSyntax(Test): - - def __init__(self,formatter,options): - Test.__init__(self,formatter,options) - self.desc = "Testing for correct syntax" - self.re = [ re.compile("^(MD5 [a-z0-9]+ [a-zA-Z0-9_+.-]+ [0-9]+)") ] - self.errors = [] - - def checkLine(self, s, ln): - for i in self.re: - k = i.match(s) - if not k: - self.errors.append("Invalid line in digest\n |" + s) - - def report(self): - for i in self.errors: - self.formatter.suberr(i) - - -def getTests(formatter,options): - return [ TestSyntax(formatter,options) ] diff --git a/trunk/src/lintool/lintool/ebuild.py b/trunk/src/lintool/lintool/ebuild.py deleted file mode 100644 index c8df0a2..0000000 --- a/trunk/src/lintool/lintool/ebuild.py +++ /dev/null @@ -1,349 +0,0 @@ -# Copyright 2002 Gentoo Technologies, Inc -# Distributed under the terms of the GNU General Public License v2.0 -# Author Karl Trygve Kalleberg - -from test import Test -import re -import os -import os.path - -class TestSpaces(Test): - - def __init__(self, formatter, options): - Test.__init__(self, formatter, options) - self.desc = "Testing for correct formatting" - self.re_spaces = [ re.compile("^([ ][ ]*)([a-zA-Z\.].*)"), - re.compile("(.*)([ \t]+)\n") ] - self.re_backslash = re.compile("([^#]*\S)((\s\s+|\t))\\\\") - self.reset() - - def checkLine(self, s, ln): - for r in self.re_spaces: - k = r.match(s) - if k: - spcs = k.groups()[1] - rest = k.groups()[0] - self.spaces.append((ln, spcs.replace(" ", "%").replace("\t","%") + rest)) - else: - k = self.re_backslash.match(s) - if k: - head = k.group(1) - spcs = k.group(2) - tail = "\\" - self.backslashes.append((ln, head + len(spcs) * "%" + tail)) - - def hasErrors(self): - return 0 - def hasWarnings(self): - return len(self.spaces) + len(self.backslashes) - - def reset(self): - self.spaces = [] - self.backslashes = [] - - def report(self): - if len(self.spaces): - self.formatter.subwarn("Has illegal space characters (marked by %):") - for i in self.spaces: - self.formatter.subsub("[line " + str(i[0]) + "]:" + i[1]) - if len(self.backslashes): - self.formatter.subwarn("Has illegal white space (marked by %), only one space character allowed:") - for i in self.backslashes: - self.formatter.subsub("[line " + str(i[0]) + "]:" + i[1]) - -class TestHeaders(Test): - - def __init__(self, formatter, options): - Test.__init__(self,formatter, options) - self.desc = "Testing for malformed headers" - self.want = [ [ 0, # count - re.compile("^(# Copyright .*2002.*)"), - "Copyright statement" ], - [ 0, # count - re.compile("^(# " + "\$" + "Header:.*" + "\$)"), # Don't want CVS to fix this - "$" + "Header:" + "$" ], # Don't want CVS to fix this either - [ 0, # count - re.compile("^(# Distributed under the terms of the GNU General Public License.*)"), - "GPL license" ] ] - self.dontwant = [ (1, # append result of regex match - re.compile("^(# Copyright 1999-(2000|2001).*)"), - "Suspect copyright year"), - (1, - re.compile("^(# /home.*)"), - "Suspect path in header"), - (0, # don't append result of regex match - re.compile("^(# Author.*)"), - "Use of Author field in the header is deprecated. Put name in ChangeLog"), - (0, - re.compile("^(# Maintainer.*)"), - "Use of Maintainer field in the header is deprecated. Put name in ChangeLog"), - (1, - re.compile("^(# /space.*)"), - "Suspect path in header")] - - def reset(self): - for i in self.want: - i[0] = 0 - self.errors = [] - self.warnings = [] - - def hasErrors(self): - num_error = 0 - for i in self.want: - if i[0] == 0: - num_error += 1 - return num_error - - def checkLine(self, s, ln): - for i in self.dontwant: - k = i[1].match(s) - if k and i[0]: - self.warnings.append(i[2] + ": " + k.groups()[0] ) - elif k and not i[0]: - self.warnings.append(i[2]) - for i in self.want: - k = i[1].match(s) - if k: - i[0] += 1 - - def report(self): - illegal_headers = len(self.warnings) - for i in self.want: - if i[0] == 0: - illegal_headers += 1 - if illegal_headers: - self.formatter.subwarn("Has illegal or suspect headers:") - for i in self.warnings: - self.formatter.subwarn(i) - for i in self.want: - if i[0] == 0: - self.formatter.suberr("Missing " + i[2]) - -class TestTry(Test): - - def __init__(self,formatter, options): - Test.__init__(self,formatter, options) - self.desc = "Testing for occurence of deprecated try" - self.re = [ re.compile("^([ \t][ \t]*try.*)"), - re.compile("(.*=.* try .*)") ] - - def checkLine(self, s, ln): - for i in self.re: - k = i.match(s) - if k: - self.errors.append(k.groups()[0]) - - def report(self): - if len(self.errors): - self.formatter.suberr("Uses try, which is deprecated") - for i in self.errors: - self.formatter.subsub(i) - -class TestA(Test): - - def __init__(self, formatter, options): - Test.__init__(self,formatter, options) - self.desc = "Testing for superfluous A=${P}.tar.gz" - self.re = re.compile("(^A=.*)") - - def checkLine(self, s, ln): - k = self.re.match(s) - if k: - self.errors.append(k.groups()[0]) - - def report(self): - if len(self.errors): - self.formatter.suberr("Contains superfluous " + self.errors[0]) - -class TestDepend(Test): - - def __init__(self, formatter, options): - Test.__init__(self,formatter, options) - self.desc = "Testing for empty DEPEND" - self.re = re.compile("DEPEND=\"\"") - - def checkLine(self, s, ln): - k = self.re.match(s) - if k: - self.warnings.append("") - - def report(self): - if len(self.warnings): - self.formatter.subwarn("DEPEND is suspiciously empty") - -class TestHomepage(Test): - - def __init__(self, formatter,options): - Test.__init__(self,formatter,options) - self.desc = "Testing for empty HOMEPAGE" - self.re = re.compile("HOMEPAGE=\"\"") - - def checkLine(self, s, ln): - k = self.re.match(s) - if k: - self.warnings.append("") - - def report(self): - if len(self.warnings): - self.formatter.subwarn("Is HOMEPAGE really supposed to be empty ?") - -class TestDescription(Test): - - def __init__(self, formatter, options): - Test.__init__(self,formatter, options) - self.desc = "Testing for empty DESCRIPTION" - self.re = re.compile("DESCRIPTION=\"\"") - - def checkLine(self, s, ln): - k = self.re.match(s) - if k: - self.errors.append("") - - def report(self): - if len(self.errors): - self.formatter.suberr("DESCRIPTION must not be empty") - -class TestEnvVarPresence(Test): - - def __init__(self, formatter, options): - Test.__init__(self,formatter, options) - self.desc = "Testing for presence of env vars" - self.re = [] - self.found = [] - self.required = [ ("SRC_URI", "See 2.4"), - ("DESCRIPTION", "See policy, 2.8"), - ("HOMEPAGE", "See policy, 2.8"), - ("DEPEND", "See policy, 2.2"), - ("LICENSE", "See policy, 2.6"), - ("SLOT", "See policy, 2.5"), - ("KEYWORDS", "See policy, 2.3"), - ("IUSE", "See policy, 2.7") - ] - self.desired = [ ("RDEPEND", "Is RDEPEND == DEPEND ? See policy, 2.2") ] - - - for i in self.required: - self.re.append(re.compile("^(" + i[0] + ")=")) - for i in self.desired: - self.re.append(re.compile("^(" + i[0] + ")=")) - - def checkLine(self, s, ln): - for i in self.re: - k = i.match(s) - if k: - self.found.append(k.group(1)) - - def report(self): - for i in self.required: - if i[0] not in self.found: - self.formatter.suberr("Missing " + i[0] + ". " + i[1]) - for i in self.desired: - if i[0] not in self.found: - self.formatter.subwarn("Missing " + i[0] + ". " + i[1]) - - def hasWarnings(self): - for i in self.desired: - if i[0] not in self.found: - return 1 - - def hasErrors(self): - for i in self.required: - if i[0] not in self.found: - return 1 - -class TestLicense(Test): - def __init__(self, formatter, options): - Test.__init__(self,formatter, options) - self.desc = "Testing for proper LICENSE" - self.re = re.compile("^LICENSE=\"(.*)\"") - self.license_dirs = options['licenseDirs'] - self.licenses = self.loadLicenses() - - def loadLicenses(self): - licenses = [] - for i in self.license_dirs: - try: - candidates = os.listdir(i) - except: - self.formatter.line("!!! License directory '" + i + "' does not exist") - continue - for j in candidates: - if os.path.isfile(i + "/" + j): - licenses.append(j) - return licenses - - def checkLine(self, s, ln): - k = self.re.match(s) - if k: - print k.group(1) - licenses = k.group(1).split(" ") - for i in licenses: - if i not in self.licenses: - self.errors.append("License '" + i + "' not known") - - def report(self): - for i in self.errors: - self.formatter.suberr(i) - -class TestUseFlags(Test): - def __init__(self, formatter, options): - Test.__init__(self,formatter, options) - self.desc = "Testing for sane USE flag usage" - self.re = re.compile("[^#]*use ([a-z0-9\+]+).*") - self.useflags = self.loadUseFlags() - - def loadUseFlags(self): - ins = open("/usr/portage/profiles/use.desc") - rex = re.compile("^([a-z0-9]+)[ \t]+-.*"); - useflags = [] - for i in ins.readlines(): - k = rex.match(i) - if k: - useflags.append(k.group(1)) - return useflags - - def checkLine(self, s, ln): - k = self.re.match(s) - if k: - flag = k.group(1) - if flag not in self.useflags: - l = k.start(1) - # We want to try and figure pretty exactly if we've hit a real instnce - # of the use command or just some random mumbling inside a string - numApostrophes = 0 - numBackticks = 0 - numTicks = 0 - for i in xrange(l,0,-1): - if s[i] == '\"' and (i == 0 or (i > 0 and s[i-1] != '\\')): - numApostrophes += 1 - if s[i] == '\'' and (i == 0 or (i > 0 and s[i-1] != '\\')): - numTicks += 1 - if s[i] == '`' and (i == 0 or (i > 0 and s[i-1] != '\\')): - numBackticks += 1 - - if numApostrophes % 2 == 0: - foundError = 1 - elif numBackticks % 2 and numTicks % 2 == 0: - foundError = 1 - else: - foundError = 0 - - if foundError: - self.errors.append("Unknown USE flag '" + flag + "'") - - def report(self): - for i in self.errors: - self.formatter.suberr(i) - - -def getTests(formatter,options): - return [ TestSpaces(formatter,options), - TestHeaders(formatter,options), - TestTry(formatter,options), - TestA(formatter,options), - TestDepend(formatter,options), - TestHomepage(formatter,options), - TestDescription(formatter,options), - TestEnvVarPresence(formatter,options), - TestUseFlags(formatter,options), - TestLicense(formatter,options) ] diff --git a/trunk/src/lintool/lintool/test.py b/trunk/src/lintool/lintool/test.py deleted file mode 100644 index 0cc56ff..0000000 --- a/trunk/src/lintool/lintool/test.py +++ /dev/null @@ -1,30 +0,0 @@ -# Copyright 2002 Gentoo Technologies, Inc -# Distributed under the terms of the GNU General Public License v2.0 -# Author Karl Trygve Kalleberg - -class Test: - def __init__(self, formatter,options=None): - self.formatter = formatter - self.errors = [] - self.warnings = [] - def reset(self): - self.errors = [] - self.warnings = [] - def hasWarnings(self): - return len(self.warnings) - def hasErrors(self): - return len(self.errors) - def getDesc(self): - return self.desc - def getStatus(self): - if self.hasErrors(): - return "failed" - else: - return "passed" - -class Regex: - PN = "[a-zA-Z_.-]+" - PV = "[a-z0-9A-Z_.-]+" - P = PN + "-" + PV + "(-r[0-9]+)?" - category = "[a-z0-9]+-[a-z0-9]+" - full = category + "/" + P diff --git a/trunk/src/moo/AUTHORS b/trunk/src/moo/AUTHORS deleted file mode 100644 index fe436cb..0000000 --- a/trunk/src/moo/AUTHORS +++ /dev/null @@ -1 +0,0 @@ -Karl Trygve Kalleberg diff --git a/trunk/src/moo/README b/trunk/src/moo/README deleted file mode 100644 index e69de29..0000000 diff --git a/trunk/src/moo/TODO b/trunk/src/moo/TODO deleted file mode 100644 index e69de29..0000000 diff --git a/trunk/src/moo/moo b/trunk/src/moo/moo deleted file mode 100755 index 828df08..0000000 --- a/trunk/src/moo/moo +++ /dev/null @@ -1,244 +0,0 @@ -#! /usr/bin/env python2.2 - -import os -import sys -import time -import signal - -CONFDIR="/tmp/moo" - -class Config: - pass - -def die(code, msg): - sys.stdout.write(msg + "\n") - sys.edit(code) - -def printUsage(): - print "Usage: moo [command] \n" + \ - "Where [command] is one of:\n" + \ - "scan - scan for available networks\n" + \ - "list - list available profiles\n"+ \ - "select - select a particular profile\n" - -def scanNetworks(): - pass - -def runCmd(cmd): - if Config.verbosity > 5: - print "Executing \"" + cmd + "\"" - v = os.system(cmd) - if Config.verbosity > 5: - print "Result: " + str(v) - return v - -class ProfileHandler: - def __init__(self): - self.profiles = {} - self._loadProfiles() - def _loadProfiles(self): - for x in os.listdir(CONFDIR+"/profiles"): - if x[-1] != "~" and x[0] != ".": - self.profiles[x] = Profile(CONFDIR+"/profiles/"+x) - def listProfiles(self,detailed=0): - for x in self.profiles.keys(): - if detailed: - print x + ":" - self.profiles[x].dump() - else: - print x + " [" + self.profiles[x].description + "]" - def getProfileNames(self): - return self.profiles.keys() - def getProfile(self,name): - return self.profiles[name] - - -class Profile: - def __init__(self, filename): - self._loadFromFile(filename) - def _loadFromFile(self,filename): - self.desc = "" - self.ifaceName = "" - self.ip = "" - self.broadcast = "" - self.gateway = "" - self.exclusive = "no" - self.netmask = "" - self.nameserver = "" - - ins = open(filename) - for s in ins.readlines(): - for x in ["description","ifaceName","ip","broadcast", - "gateway","exclusive","nameserver","wepkey"]: - if s.find(x+"=") == 0: - val=s.replace(x+"=","").strip() - self.__dict__[x] = val - def dump(self): - print "description = " + self.description + "\n" + \ - "iface = " + self.ifaceName + "\n" + \ - "ip = " + self.ip + "\n" + \ - "broadcast = " + self.broadcast + "\n" + \ - "gateway = " + self.gateway + "\n" + \ - "gateway = " + self.nameserver + "\n" + \ - "exclusive = " + self.exclusive + "\n" - -class Interface: - def __init__(self, name): - self.name = name - self.netmask = "" - self.broadcast = "" - self.ip = "" - self.gateway = "" - self.nameserver = "" - self.wepkey = "" - self._loadIPV4Info() - def _loadIPV4Info(self): - pass - def getNameserver(self): - return self.nameserver - def getNetmask(self): - return self.netmask - def getName(self): - return self.name - def getBroadcast(self): - return self.broadcast - def getWEPKey(self): - return self.wepkey - def getGateway(self): - return self.gateway - def setNameserver(self,nameserver): - self.nameserver = nameserver - def setIP(self, ip): - self.ip = ip - def setWEPKey(self,key): - self.wepkey = key - def setGateway(self,gw): - self.gateway = gw - def setBroadcast(self,broadcast): - self.broadcast = broadcast - def setNetmask(self,netmask): - self.netmask = netmask - def runDHCP(self): - runCmd("dhcpcd " + self.name) - def down(self): - runCmd("ifconfig " + self.name + " down") - pidFile = "/var/run/dhcpcd-" + self.name + ".pid" - if os.path.exists(pidFile): - ins = open(pidFile) - pid = int(ins.readline()) - os.kill(pid,signal.SIGTERM) - time.sleep(1) - def up(self): - options = "" - - if self.wepkey: - if runCmd("iwconfig eth1 key " + self.wepkey): - die(4, "Failed to set WEP key for " + self.name) - - if self.ip: - options += self.ip + " " - if self.broadcast: - options += "broadcast " + self.broadcast + " " - if self.netmask: - options += "netmask " + self.netmask + " " - - if runCmd("ifconfig " + self.name + " " + options + " up"): - die(2, "Failed to bring up " + self.name) - - if self.gateway: - if runCmd("route add default gw " + self.gateway + " " + self.name): - die(3, "Failed to set default gateway for " + self.name) - - if self.nameserver: - if Config.verbosity > 5: - print("Using nameserver " + self.nameserver) - try: - ous = open("/etc/resolv.conf","w") - ous.write("nameserver " + self.nameserver) - ous.close() - except OSError: - die("Failed to set nameserver") - if Config.verbosity > 3: - print "Brough interface " + self.name + " up" - -class InterfaceHandler: - def __init__(self): - self.ifaces = {} - self._loadAllInterfaces() - def _loadAllInterfaces(self): - ins=open("/proc/net/dev") - for line in ins.readlines(): - tokens = line.split(":") - if len(tokens) > 1: - ifaceName = tokens[0].strip() - iface = Interface(ifaceName) - self.ifaces[ifaceName] = iface - def getInterface(self,ifaceName): - return self.ifaces[ifaceName] - def downAll(self): - for x in self.ifaces.values(): - if x.getName() != "lo": - x.down() - -class Moo: - def __init__(self): - self.profileHandler = ProfileHandler() - self.ifaceHandler = InterfaceHandler() - - def selectProfile(self,profile): - prof = self.profileHandler.getProfile(profile) - - if prof.exclusive == "yes": - self.ifaceHandler.downAll() - - iface = self.ifaceHandler.getInterface(prof.ifaceName) - - if prof.ip == "dhcp": - iface.runDHCP() - else: - iface.setIP(prof.ip) - iface.setBroadcast(prof.broadcast) - iface.setNetmask(prof.netmask) - iface.setGateway(prof.gateway) - iface.setNameserver(prof.nameserver) - iface.up() - - def listProfiles(self,detailed=0): - self.profileHandler.listProfiles(detailed) - -def initConfig(): - Config.verbosity = 3 - -def main(): - - initConfig() - - if len(sys.argv) < 2: - printUsage() - sys.exit(1) - - moo = Moo() - - for i in xrange(len(sys.argv)): - if sys.argv[i] == "list": - detailed = 0 - for x in sys.argv[i:]: - if x == "--detailed": - detailed = 1 - moo.listProfiles(detailed) - - elif sys.argv[i] == "select": - moo.selectProfile(sys.argv[2]) - -if __name__ == "__main__": - main() - - -# TODO -# - automatically create profile -# - specify wireless network name -# - specify wep key -# - specify access point -# - specify pre_run/post_run commands -# - with parameters -# diff --git a/trunk/src/moo/moo.1 b/trunk/src/moo/moo.1 deleted file mode 100644 index 534aa0c..0000000 --- a/trunk/src/moo/moo.1 +++ /dev/null @@ -1,12 +0,0 @@ -.TH moo "1" "Nov 2003" "gentoolkit" -.SH NAME -moo \- Gentoo: Configuration Update Utility -.SH SYNOPSIS -.B moo -.SH BUGS -This tool does not yet have a man page. Feel free to submit a bug about it to -http://bugs.gentoo.org -.SH AUTHORS -This informative man page was written by Karl Trygve Kalleberg -. - diff --git a/trunk/src/old-scripts/Makefile b/trunk/src/old-scripts/Makefile deleted file mode 100644 index 8f61cb5..0000000 --- a/trunk/src/old-scripts/Makefile +++ /dev/null @@ -1,32 +0,0 @@ -# Copyright 2004 Karl Trygve Kalleberg -# Copyright 2004 Gentoo Technologies, Inc. -# Distributed under the terms of the GNU General Public License v2 -# -# $Header$ - -include ../../makedefs.mak - -all: - echo "BOTOLPHS Huge benign tumors which archdeacons and old chemistry teachers affect to wear on the sides of their noses." - -dist: - mkdir -p ../../$(distdir)/src/old-scripts/ - cp Makefile ../../$(distdir)/src/old-scripts/ - cp dep-clean dep-clean.1 ../../$(distdir)/src/old-scripts/ - cp pkg-clean pkg-clean.1 ../../$(distdir)/src/old-scripts/ - cp ewhich ewhich.1 ../../$(distdir)/src/old-scripts/ - cp mkebuild mkebuild.1 ../../$(distdir)/src/old-scripts/ - cp pkg-size pkg-size.1 ../../$(distdir)/src/old-scripts/ - -install: - install -m 0755 dep-clean $(bindir)/ - install -m 0755 pkg-clean $(sbindir)/ - install -m 0755 ewhich $(bindir)/ - install -m 0755 mkebuild $(sbindir)/ - install -m 0755 pkg-size $(bindir)/ - - install -m 0644 dep-clean.1 $(mandir)/ - install -m 0644 pkg-clean.1 $(mandir)/ - install -m 0644 ewhich.1 $(mandir)/ - install -m 0644 mkebuild.1 $(mandir)/ - install -m 0644 pkg-size.1 $(mandir)/ diff --git a/trunk/src/old-scripts/dep-clean b/trunk/src/old-scripts/dep-clean deleted file mode 100644 index 89c6364..0000000 --- a/trunk/src/old-scripts/dep-clean +++ /dev/null @@ -1,272 +0,0 @@ -#!/bin/bash -#Shows unrequired packages and missing dependencies. -#Author/Maintainer: Brandon Low -#Author: Jerry Haltom - -echo -echo -e "\x1b[31;01m!!! As of Gentoolkit 0.2.0, this tool is deprecated." -echo -e "!!!\x1b[0;0m Please refer to 'emerge clean' and 'emerge depclean' for replacements." -echo - -PROG=`basename ${0}` - -tmp="/tmp/$$" - -#Get PORTDIR and PORTDIR_OVERLAY from portage -PORTDIR_OVERLAY="$(/usr/lib/portage/bin/portageq portdir_overlay)" -PORTDIR="$(/usr/lib/portage/bin/portageq portdir)" - -rm -rf ${tmp} > /dev/null 2>&1 -mkdir ${tmp} > /dev/null 2>&1 - -declare -i i - -set -- `getopt -n ${PROG} -o N,R,U,I,v,q,C,h -l needed,removed,unneeded,interactive,verbose,quiet,nocolor,help -- ${*/ --/};[ $? != 0 ] && echo "y"` - -while [ ${#} -gt 0 ] -do - a=${1} - shift - case "${a}" in - - -I|--interactive) - interactive=y - ;; - - -N|--needed) - needed=y - ;; - - -U|--unneeded) - unneeded=y - ;; - - -R|--removed) - removed=y - ;; - - -v|--verbose) - verb=y - ;; - - -q|--quiet) - quiet=y - ;; - - -C|--nocolor) - nocolor=y - ;; - - -h|--help) - usage=y - ;; - - --) - [ ${1} ] && usage=y && broke=y - break - ;; - - *) - usage=y - broke=y - echo "FIXME - OPTION PARSING - ${a}" - break - ;; - - esac -done - -if [ ! ${needed} ] && [ ! ${unneeded} ] && [ ! ${removed} ]; then - needed=y - unneeded=y - removed=y -fi - -#Set up colors -if [ ! "${nocolor}" ]; then - NO="\x1b[0;0m" - BR="\x1b[0;01m" - CY="\x1b[36;01m" - GR="\x1b[32;01m" - RD="\x1b[31;01m" - YL="\x1b[33;01m" - BL="\x1b[34;01m" -elif [ ${quiet} ] && ( - ( [ ${needed} ] && [ ${unneeded} ] ) || - ( [ ${unneeded} ] && [ ${removed} ] ) || - ( [ ${removed} ] && [ ${needed} ] ) - ); then - NEED=" N" - UNNE=" U" - REMO=" R" -fi - -if [ ${usage} ]; then - echo -e "${BR}GenToolKit's Dependency Checker! -${NO}Displays packages that are installed but which none -of the packages in world or system depend on, and -displays packages which are depended on by world or -system, but are not currently installed. - -${BR}USAGE: - ${BL}${PROG}${YL} [${NO}options${YL}]${NO} - ${BL}${PROG}${GR} --help${NO} - -${BR}OPTIONS: - ${GR}-U, --unneeded${NO} display unneeded packages that are installed (${GR}green${NO}) - ${GR}-N, --needed${NO} display needed packages that are not installed (${RD}red${NO}) - ${GR}-R, --removed${NO} display installed packages not in portage (${YL}yellow${NO}) - - ${GR}-I, --interactive${NO} interactively modify world file before proceeding - ${GR}-C, --nocolor${NO} output without color, if necessary, package types are - noted with ${GR}U, N${NO} and ${GR}R${NO} respectively - ${GR}-v, --verbose${NO} be more verbose - ${GR}-q, --quiet${NO} be quiet (just output the packages, no extra info) - -${BR}NOTES: - ${GR}*${NO} If this script is run on a system that is not up-to-date or which hasn't - been cleaned (with '${BL}emerge -c${NO}') recently, the output may be deceptive. - ${GR}*${NO} If the same package name appears in all three categories, then it is - definitely time to update that package and then run '${BL}emerge -c${NO}'. - ${GR}*${NO} The ${GR}-U, -N${NO} and ${GR}-R${NO} options may be combined, defaults to ${GR}-UNR${NO}" - rm -rf ${tmp} > /dev/null 2>&1 - [ ${broke} ] && exit 1 || exit 0 -fi - -X="\([^/]*\)" - -#Retrieve currently merged packages. -if [ ${verb} ];then - echo -e "${CY}Retrieving currently merged packages.${NO}" -fi -find /var/db/pkg/ -name '*.ebuild' | \ - sed -e "s:/var/db/pkg/::" \ - -e "s:${X}/${X}/${X}:\1/\2:" | \ - sort -u >> ${tmp}/current - -if [ ${verb} ]; then - echo -e "${CY}"`cat ${tmp}/current | wc -l` "currently merged packages.${NO}" - echo -e -fi - -#Retrieve system packages and add to image. -if [ ${verb} ];then - echo -e "${CY}Retrieving system packages.${NO}" -fi -emerge system -ep | \ - sed -e "/ebuild/s:^.*] \([^ ]*\) *:\1:p;d" | \ - sort -u \ - > ${tmp}/system - -if [ ${verb} ]; then - echo -e "${CY}"`cat ${tmp}/system | wc -l 2> /dev/null` "packages contained in system.${NO}" - echo -e - echo -e "${CY}Preparing world file.${NO}" -fi - -#Create local copy of world and ask user to verify it. -cp /var/cache/edb/world ${tmp}/world - -if [ ${interactive} ]; then - ${EDITOR} ${tmp}/world -fi - -#Retrieve world packages and dependencies and add to image. -if [ ${verb} ]; then - echo -e - echo -e "${CY}Preparing list of installed world packages.${NO}" - echo -e -fi - -cat ${tmp}/current | grep -f ${tmp}/world | sort > ${tmp}/world.inst -find ${PORTDIR} ${PORTDIR_OVERLAY} -iname '*.ebuild' | \ - awk -F'/' '{printf("%s/%s\n", $(NF-2), $NF)}' | \ - sed -e 's:\.ebuild::' > ${tmp}/ebuilds -grep -xf ${tmp}/world.inst ${tmp}/ebuilds >> ${tmp}/world.new - -if [ ${verb} ]; then - echo -e "${CY}"`cat ${tmp}/ebuilds | wc -l`"\tebuilds available.${NO}" - echo -e "${CY}"`cat ${tmp}/world.new | wc -l`"\tpackages contained in final world file.${NO}" - echo -e - echo -e "${CY}List prepared, checking dependencies with emerge -ep${NO}" -fi - -sort ${tmp}/world.new |sed -e 's:^:\\\=:' | uniq | xargs emerge -ep | \ - tee ${tmp}/log | sed -e '/ebuild/s:^.*] \([^ ]*\) *$:\1:p;d' > ${tmp}/image.unsorted - -depends=`cat ${tmp}/image.unsorted|wc -l` - -if [ ${depends} -lt "2" ]; then - echo -e "${RD}There appears to be an unresolved dependency in your world file." - echo -e "Please check for masking errors or other world file issues," - echo -e "and then try again." - echo -e - echo -e "The following is the emerge output for your reference:${NO}" - cat ${tmp}/log - rm -rf ${tmp} > /dev/null 2>&1 - exit 1 -fi - -cat ${tmp}/system >> ${tmp}/image.unsorted - -#Cleanup image -sort -u ${tmp}/image.unsorted > ${tmp}/image - -if [ ${verb} ];then - echo -e "${CY}"`cat ${tmp}/image | wc -l` "packages contained in final image.${NO}" - echo -e -fi - -#Determine packages that exist in current but not in image. -#These packages are safe to clean up. -if [ ${unneeded} ]; then - if [ ! ${quiet} ]; then - echo -e "${CY}These packages have no other packages depending on them.${NO}" - fi - - grep -vxf ${tmp}/image ${tmp}/current > ${tmp}/unneeded - for line in `cat ${tmp}/unneeded`;do - echo -e "${GR}${line}${CY}${UNNE}${NO}" - done - - if [ ! ${quiet} ];then - echo -e "${CY}Total of"`cat ${tmp}/unneeded|wc -l` "unneeded packages.${NO}" - fi -fi - -#Determine packages that exist in image but not in current. -#These packages should be added. -if [ ${needed} ]; then - if [ ! ${quiet} ];then - echo -e - echo -e "${CY}These packages are depended upon but are not present on the system.${NO}" - fi - - grep -vxf ${tmp}/current ${tmp}/image > ${tmp}/needed - for line in `cat ${tmp}/needed`;do - echo -e "${RD}${line}${CY}${NEED}${NO}" - done - - if [ ! ${quiet} ];then - echo -e "${CY}Total of"`cat ${tmp}/needed|wc -l` "needed packages.${NO}" - fi -fi - -#Determine packages that are installed but not currently in portage -if [ ${removed} ]; then - if [ ! ${quiet} ];then - echo -e - echo -e "${CY}These packages are installed but not in the portage tree.${NO}" - fi - grep -xf ${tmp}/current ${tmp}/ebuilds > ${tmp}/hascurrent - grep -vxf ${tmp}/hascurrent ${tmp}/current > ${tmp}/removed - for line in `cat ${tmp}/removed`;do - echo -e "${YL}${line}${CY}${REMO}${NO}" - done - - if [ ! ${quiet} ];then - echo -e "${CY}Total of"`cat ${tmp}/removed|wc -l` "removed packages.${NO}" - fi -fi - -rm -rf ${tmp} > /dev/null 2>&1 diff --git a/trunk/src/old-scripts/dep-clean.1 b/trunk/src/old-scripts/dep-clean.1 deleted file mode 100644 index 9747ce4..0000000 --- a/trunk/src/old-scripts/dep-clean.1 +++ /dev/null @@ -1,190 +0,0 @@ -.\" Automatically generated by Pod::Man version 1.15 -.\" Thu Jul 18 15:59:55 2002 -.\" -.\" Standard preamble: -.\" ====================================================================== -.de Sh \" Subsection heading -.br -.if t .Sp -.ne 5 -.PP -\fB\\$1\fR -.PP -.. -.de Sp \" Vertical space (when we can't use .PP) -.if t .sp .5v -.if n .sp -.. -.de Ip \" List item -.br -.ie \\n(.$>=3 .ne \\$3 -.el .ne 3 -.IP "\\$1" \\$2 -.. -.de Vb \" Begin verbatim text -.ft CW -.nf -.ne \\$1 -.. -.de Ve \" End verbatim text -.ft R - -.fi -.. -.\" Set up some character translations and predefined strings. \*(-- will -.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left -.\" double quote, and \*(R" will give a right double quote. | will give a -.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used -.\" to do unbreakable dashes and therefore won't be available. \*(C` and -.\" \*(C' expand to `' in nroff, nothing in troff, for use with C<> -.tr \(*W-|\(bv\*(Tr -.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' -.ie n \{\ -. ds -- \(*W- -. ds PI pi -. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch -. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch -. ds L" "" -. ds R" "" -. ds C` "" -. ds C' "" -'br\} -.el\{\ -. ds -- \|\(em\| -. ds PI \(*p -. ds L" `` -. ds R" '' -'br\} -.\" -.\" If the F register is turned on, we'll generate index entries on stderr -.\" for titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and -.\" index entries marked with X<> in POD. Of course, you'll have to process -.\" the output yourself in some meaningful fashion. -.if \nF \{\ -. de IX -. tm Index:\\$1\t\\n%\t"\\$2" -.. -. nr % 0 -. rr F -.\} -.\" -.\" For nroff, turn off justification. Always turn off hyphenation; it -.\" makes way too many mistakes in technical documents. -.hy 0 -.if n .na -.\" -.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). -.\" Fear. Run. Save yourself. No user-serviceable parts. -.bd B 3 -. \" fudge factors for nroff and troff -.if n \{\ -. ds #H 0 -. ds #V .8m -. ds #F .3m -. ds #[ \f1 -. ds #] \fP -.\} -.if t \{\ -. ds #H ((1u-(\\\\n(.fu%2u))*.13m) -. ds #V .6m -. ds #F 0 -. ds #[ \& -. ds #] \& -.\} -. \" simple accents for nroff and troff -.if n \{\ -. ds ' \& -. ds ` \& -. ds ^ \& -. ds , \& -. ds ~ ~ -. ds / -.\} -.if t \{\ -. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" -. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' -. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' -. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' -. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' -. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' -.\} -. \" troff and (daisy-wheel) nroff accents -.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' -.ds 8 \h'\*(#H'\(*b\h'-\*(#H' -.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] -.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' -.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' -.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] -.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] -.ds ae a\h'-(\w'a'u*4/10)'e -.ds Ae A\h'-(\w'A'u*4/10)'E -. \" corrections for vroff -.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' -.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' -. \" for low resolution devices (crt and lpr) -.if \n(.H>23 .if \n(.V>19 \ -\{\ -. ds : e -. ds 8 ss -. ds o a -. ds d- d\h'-1'\(ga -. ds D- D\h'-1'\(hy -. ds th \o'bp' -. ds Th \o'LP' -. ds ae ae -. ds Ae AE -.\} -.rm #[ #] #H #V #F C -.\" ====================================================================== -.\" -.IX Title "DEP-CLEAN 1" -.TH DEP-CLEAN 1 "Copyright 2002 Gentoo Technologies, Inc." "2002-07-18" "GenToolKit's Dependency Checker!" -.UC -.SH "NAME" -dep-clean \- Gentoo: Shows unrequired packages and missing dependencies. -.SH "SYNOPSIS" -.IX Header "SYNOPSIS" -.Vb 1 -\& dep-clean [-RUNICv] -.Ve -.SH "DESCRIPTION" -.IX Header "DESCRIPTION" -dep-clean displays extraneous, missing or extra packages. Extra packages are those in which are not a part of the portage tree (/usr/portage). It does \s-1NOT\s0 modify the system in any way. -.SH "OPTIONS" -.IX Header "OPTIONS" -.Ip "\-N, \-\-needed" 4 -.IX Item "-N, --needed" -Display needed packages that are not installed. (red) (default) -.Ip "\-R, \-\-removed" 4 -.IX Item "-R, --removed" -Display installed packages not in portage. (yellow) (default) -.Ip "\-U, \-\-unneeded" 4 -.IX Item "-U, --unneeded" -Display unneeded packages that are installed. (green) (default) -.Ip "\-I, \-\-interactive" 4 -.IX Item "-I, --interactive" -Interactively modify world file before proceeding. -.Ip "\-C, \-\-nocolor" 4 -.IX Item "-C, --nocolor" -Output without color. Package types will be noted with R, U and N. -.Ip "\-v, \-\-verbose" 4 -.IX Item "-v, --verbose" -Be more verbose. -.Ip "\-q, \-\-quiet" 4 -.IX Item "-q, --quiet" -Be quiet (display only packages). -.SH "NOTES" -.IX Header "NOTES" -.Ip "" 4 -If this script is run on a system that is not up-to-date or which hasn't been cleaned (with 'emerge \-c') recently, the output may be deceptive. -.Ip "" 4 -If the same package name appears in all three categories, then it is definitely time to update that package and then run 'emerge \-c'. -.Ip "" 4 -The \-U, \-N and \-R options may be combined, default is \-UNR -.SH "AUTHORS" -.IX Header "AUTHORS" -Jerry Haltom (dep-clean) -.br -Brandon Low (dep-clean) -.PP -Paul Belt (man page) diff --git a/trunk/src/old-scripts/ewhich b/trunk/src/old-scripts/ewhich deleted file mode 100755 index 345ec34..0000000 --- a/trunk/src/old-scripts/ewhich +++ /dev/null @@ -1,44 +0,0 @@ -#!/usr/bin/python -# Copyright 1999-2003 Gentoo Technologies, Inc. -# Distributed under the terms of the GNU General Public License v2 -# $Header$ -# -# Author: Marius Mauch -# -# ewhich is a tool to get the ebuild filename for a given package name - -import portage,sys,os -from output import * - -sys.stderr.write("\n" + red("!!!") + " As of Gentoolkit 0.2.0 this tool is deprecated\n") -sys.stderr.write(red("!!!") + " Refer to 'equery which' for a replacement\n\n") - -def print_help(): - print - print fuscia(os.path.basename(sys.argv[0])), "is a tool to get the filename of the ebuild for a given package" - print ' '*len(os.path.basename(sys.argv[0])), "that would be used by portage with the current configuration" - print - print yellow("Syntax:"), os.path.basename(sys.argv[0]), teal("") - print - print teal(""), "is either a simple package name (like "+green("xfree")+")," - print " a package name with category (like "+green("x11-base/xfree")+")" - print " or a DEPEND style atom as defined in ebuild(5) (like "+green(">=x11-base/xfree-4.3.0")+")" - print - -if len(sys.argv) <= 1 or sys.argv[1] == "-h" or sys.argv[1] == "--help": - print_help() - sys.exit(0) - -p = portage.db[portage.root]["porttree"].dbapi.xmatch("bestmatch-visible", sys.argv[1]) -if len(p) <= 1: - print - print red("*"), "\""+sys.argv[1]+"\" is not a valid package name or a masked package" - print - sys.exit(1) -pv = portage.catpkgsplit(p) -ebuild = "/"+pv[0]+"/"+pv[1]+"/"+p.split("/")[1]+".ebuild" -for ov in portage.settings["PORTDIR_OVERLAY"].split(): - if os.path.exists(ov+ebuild): - print os.path.normpath(ov+ebuild) - sys.exit(0) -print os.path.normpath(portage.settings["PORTDIR"]+ebuild) diff --git a/trunk/src/old-scripts/ewhich.1 b/trunk/src/old-scripts/ewhich.1 deleted file mode 100644 index 4bc5459..0000000 --- a/trunk/src/old-scripts/ewhich.1 +++ /dev/null @@ -1,24 +0,0 @@ -.TH ewhich 1 "October 19, 2003" "ewhich" - -.SH NAME -ewhich \- Gentoo: program for resolving ebuild names - -.SH SYNOPSIS -.B ewhich -[ -h | --help ] - -.SH DESCRIPTION -.B ewhich -is a little tool to find the actual ebuild file for a given package name. -It can use simple package names (like xfree), package names with category -(like x11-base/xfree) or DEPEND atoms (like >=x11-base/xfree-4.3.0). - -.SH BUGS -.B ewhich -No known bugs - -.SH SEE ALSO -emerge(1), make.conf(5), ebuild(5) - -.SH AUTHOR -Marius Mauch diff --git a/trunk/src/old-scripts/mkebuild b/trunk/src/old-scripts/mkebuild deleted file mode 100644 index 9ee0ce1..0000000 --- a/trunk/src/old-scripts/mkebuild +++ /dev/null @@ -1,216 +0,0 @@ -#!/bin/bash - -# Copyright (c) 2002 -# John Stalker -# Department of Mathematics -# Princeton University - -echo -echo -e "\x1b[31;01m!!! As of Gentoolkit 0.2.0, this tool is deprecated" -echo -e "!!!\x1b[0;0m Refer to app-portage/ebuilder for a replacement." -echo - -CONFIG_FILE=${HOME}/.mkebuild -if [ -e $CONFIG_FILE ] -then - source $CONFIG_FILE -else - echo This appears to be the first time you have used mkebuild. - echo I am going to make some guesses. If any of these are wrong - echo you should edit the file ${CONFIG_FILE}. - echo - MY_NAME=`awk -F":" '/^'${USER}:'/ { print $5 }' /etc/passwd` - echo Your name is ${MY_NAME}. - echo 'MY_NAME="'${MY_NAME}'"' >${CONFIG_FILE} - COPYRIGHT="Gentoo Technologies, Inc." - echo You wish to asign copyright to ${COPYRIGHT} - echo 'COPYRIGHT="'${COPYRIGHT}'"' >>${CONFIG_FILE} - MY_EMAIL=${USER}"@"${HOSTNAME} - echo Your email address is ${MY_EMAIL}. - echo 'MY_EMAIL='${MY_EMAIL} >>$CONFIG_FILE - LICENSE="the GNU General Public License, v2" - echo Your preferred license is ${LICENSE}. - echo 'LICENSE="'${LICENSE}'"' >>${CONFIG_FILE} - LOCAL_SOURCE=${HOME} - echo You download sources to ${LOCAL_SOURCE}. - echo LOCAL_SOURCE=${LOCAL_SOURCE} >>${CONFIG_FILE} - BUILD_DIRECTORY=${HOME} - echo You build packages in ${BUILD_DIRECTORY}. - echo 'BUILD_DIRECTORY='${BUILD_DIRECTORY} >>${CONFIG_FILE} - echo -fi -FILE_NAME=`basename $1` -SOURCE_LOCATION=`dirname $1` -PACKAGE_NAME=${FILE_NAME%.*} -FILE_EXTENSION=${FILE_NAME##*.} -if [ "${PACKAGE_NAME##*.}" = "tar" ] -then - FILE_EXTENSION=tar.${FILE_EXTENSION} - PACKAGE_NAME=${PACKAGE_NAME%.tar} -fi -EBUILD_FILE=${PWD}/${PACKAGE_NAME}.ebuild -echo "# Copyright" `date +"%Y"` ${COPYRIGHT} >${EBUILD_FILE} -echo "# Distributed under the terms of" ${LICENSE} >>${EBUILD_FILE} -#echo "# Author" ${MY_NAME} '<'${MY_EMAIL}'>' >>${EBUILD_FILE} -echo "# \$Header$" >>${EBUILD_FILE} -echo >>${EBUILD_FILE} -echo 'DESCRIPTION=""' >>${EBUILD_FILE} -echo 'SRC_URI="'${SOURCE_LOCATION}'/${P}.'${FILE_EXTENSION}'"' >>${EBUILD_FILE} -echo 'HOMEPAGE="'${SOURCE_LOCATION}'/"' >>${EBUILD_FILE} -echo 'LICENSE=""' >>${EBUILD_FILE} -echo 'SLOT="0"' >>${EBUILD_FILE} -echo 'KEYWORDS="~x86"' >>${EBUILD_FILE} -echo 'IUSE=""' >>${EBUILD_FILE} -echo >>${EBUILD_FILE} -echo 'DEPEND=""' >>${EBUILD_FILE} -echo >>${EBUILD_FILE} -echo '#RDEPEND=""' >>${EBUILD_FILE} -echo 'S=${WORKDIR}/${P}' >>${EBUILD_FILE} -echo >>${EBUILD_FILE} -echo 'src_unpack() {' >>${EBUILD_FILE} -echo >>${EBUILD_FILE} -echo -e "\t"'unpack ${A}' >>${EBUILD_FILE} -echo -e "\t"'cd ${S}' >>${EBUILD_FILE} -echo >>${EBUILD_FILE} -echo '}' >>${EBUILD_FILE} -if [ -e ${LOCAL_SOURCE}/${FILE_NAME} ] -then - echo I am assuming that $1 really - echo exists and that ${LOCAL_SOURCE}/${FILE_NAME} - echo is a faithful copy. -else - echo I didn\'t find ${LOCAL_SOURCE}/${FILE_NAME} so I will fetch - echo $1. - cd ${LOCAL_SOURCE} - wget $1 -fi -if [ -e ${BUILD_DIRECTORY}/${PACKAGE_NAME} ] -then - echo - echo I am assuming that ${BUILD_DIRECTORY}/${PACKAGE_NAME} \ - is the unpacked - echo version of ${LOCAL_SOURCE}/${FILE_NAME}. -else - cd ${BUILD_DIRECTORY} - if [ $? -ne 0 ] - then - echo - echo I was unable to enter the directory ${BUILD_DIRECTORY}. - exit 1 - fi - case "${FILE_EXTENSION}" in - tar.gz|tgz) - tar xzf ${LOCAL_SOURCE}/${FILE_NAME} - ;; - tar.bz2|tbz2) - tar xjf ${LOCAL_SOURCE}/${FILE_NAME} - ;; - tar.Z|tar.z) - unzip ${LOCAL_SOURCE}/${FILE_NAME} - tar xf ${PACKAGE_NAME}.tar - ;; - *) - echo - echo I can\'t figure out how to uncompress - echo ${LOCAL_SOURCE}/${FILE_NAME} - exit 1 - esac - if [ $? -ne 0 ] - then - echo - echo I was unable to uncompress ${LOCAL_SOURCE}/${FILE_NAME}. - exit 1 - fi -fi -cd ${BUILD_DIRECTORY}/${PACKAGE_NAME} -if [ $? -ne 0 ] -then - echo - echo I could not change directory to ${BUILD_DIRECTORY}/${PACKAGE_NAME} - exit 1 -fi -echo -echo You might want to look at the following files for configuration and -echo dependency information: -find ${PWD} -name README -print -find ${PWD} -name README.txt -print -find ${PWD} -name INSTALL -print -find ${PWD} -name INSTALL.txt -print -find ${PWD} -name Changes -print -find ${PWD} -name CHANGES.txt -print -find ${PWD} -name FAQ.txt -find ${PWD} -name ChangeLog -print -find ${PWD} -name NEWS -print -echo >>${EBUILD_FILE} -echo 'src_compile() {' >>${EBUILD_FILE} -echo >>${EBUILD_FILE} -echo -if [ -e Imakefile ] -then - echo I found an Imakefile. I am assuming that we should use xmkmf. - echo I don\'t really understand xmkmf so you will have to configure - echo things on your own. - echo - echo -e "\t"'xmkmf || die' >>${EBUILD_FILE} - echo -e "\tmake Makefiles" >>${EBUILD_FILE} - echo -e "\tmake includes" >>${EBUILD_FILE} - echo -e "\tmake depend" >>${EBUILD_FILES} -elif [ -e configure ] -then - echo I found a configure file. I am assuming that we are using autoconf -. - echo I will take care of setting the most commonly used options. I am - echo including a list of all the available options to confiigure, commen -ted - echo out. You might want to look it over to see if I have missed anythi -ng. - echo - ./configure --help >.config.options - echo -e "\t./configure \\" >>${EBUILD_FILE} - awk '/--prefix/ { print "\t\t--prefix=/usr \\"}' \ - .config.options >>${EBUILD_FILE} - awk '/--infodir/ { print "\t\t--infodir=/usr/share/info \\"}' \ - .config.options >>${EBUILD_FILE} - awk '/--mandir/ { print "\t\t--mandir=/usr/share/man \\"}' \ - .config.options >>${EBUILD_FILE} - echo -e "\t\t"'|| die "./configure failed"' >>${EBUILD_FILE} - echo -e "#\tAvailable options to configure:" >>${EBUILD_FILE} - awk '/--/ { print "#" $0 }' .config.options >>${EBUILD_FILE} - echo -e "\t"'emake || die' >>${EBUILD_FILE} -elif [ -e Makefile ] -then - echo I found a Makefile. You should look at it and possibly prepare - echo a patch. - echo - echo -e "\temake || die" >>${EBUILD_FILE} -else - echo I couldn\'t find a Imakefile, configure script, or Makefile for - echo this package. You will have to figure out what to do on your - echo own. - echo -fi -echo '}' >>${EBUILD_FILE} -echo >>${EBUILD_FILE} -echo 'src_install () {' >>${EBUILD_FILE} -echo >>${EBUILD_FILE} -echo -e "\t"'make DESTDIR=${D} install || die' >>${EBUILD_FILE} -echo '}' >>${EBUILD_FILE} -echo >>${EBUILD_FILE} -echo >>${EBUILD_FILE} -echo >>${EBUILD_FILE} -echo I couldn\'t supply a package description for the ebuild file -echo because I don\'t know what ${PACKAGE_NAME} does. -echo -echo I am assume the hompage for this package is ${SOURCE_LOCATION}/. -echo If that is not correct you will need to edit that portion of -echo the ebuild file as well. -echo -echo I don\'t understand dependencies yet. You will have to add any -echo dependencies you know of by hand. Then try your ebuild script -echo out to see if there are any dependencies you don\'t know of. -echo -echo I am assuming that this package comes with a well-behaved Makefile -echo which does not install anything outside of '${DESTDIR}'. You will -echo need to check this by looking at the portion of the Makefile -echo beginning with the line '"install:"'. - diff --git a/trunk/src/old-scripts/mkebuild.1 b/trunk/src/old-scripts/mkebuild.1 deleted file mode 100644 index e800d4d..0000000 --- a/trunk/src/old-scripts/mkebuild.1 +++ /dev/null @@ -1,20 +0,0 @@ -.TH mkebuild "1" "Nov 2003" "gentoolkit" -.SH NAME -mkebuild \- Gentoo: Interactive ebuild generator -.SH SYNOPSIS -.B mkebuild -.SH BUGS -This tool is obsolete, as of gentoolkit 0.2.0. -Use ebuilder [app\-portage/ebuilder] instead. -.SH SEE ALSO -.BR ebuilder(1) -.br -.BR /usr/sbin/ebuilder -.br -.BR /usr/sbin/mkebuild - -.SH AUTHORS -This informative man page was written by Karl Trygve Kalleberg - and expanded by Katerina Barone\-Adesi -. - diff --git a/trunk/src/old-scripts/pkg-clean b/trunk/src/old-scripts/pkg-clean deleted file mode 100644 index 9b07337..0000000 --- a/trunk/src/old-scripts/pkg-clean +++ /dev/null @@ -1,107 +0,0 @@ -#!/usr/bin/python -# Copyright 1999-2003 Gentoo Technologies, Inc. -# Distributed under the terms of the GNU General Public License v2 -# $Header$ -# Author: Leo Lipelis -# Author: Karl Trygve Kalleberg - -import commands -import re -import sys -import time -import os -from output import * - -print -print red("!!! As of Gentoolkit 0.2.0, this tool is deprecated") -print red("!!!") + " Refer to 'emerge clean' and 'emerge depclean' for replacements." -print - -time.sleep(4) - -# constants for package tuples that are stored in pkg_hash -PKG_TIME = 0 # number of seconds for ctime function -PKG = 1 # package full path as accepted by ebuild -PKG_NAME = 2 # package name as accepted by emerge - -(status, pkg_files) = commands.getstatusoutput( - "find /var/db/pkg -iname '*.ebuild' -printf '%T@ %p\n' | sort -n") - -pkg_file_list = pkg_files.splitlines() - -pkg_hash = {} -for time_pkg_pair in pkg_file_list: - (pkg_time, pkg) = time_pkg_pair.split() - pkg_time = int(pkg_time) - # This covers developer trees with not-accepted categories - tmp_name = re.match(r'/var/db/pkg/(.*/.*)/.*', pkg) - if not tmp_name: continue - pkg_name = tmp_name.group(1) - tmp_core = re.match(r'(.*)-\d.*', pkg_name) - if not tmp_core: continue - pkg_core = tmp_core.group(1) - if pkg_hash.has_key(pkg_core): - pkg_hash[pkg_core].append((pkg_time, pkg, pkg_name)) - else: - pkg_hash[pkg_core] = [(pkg_time, pkg, pkg_name)] - -total_len = len(pkg_hash.keys()) -curpkg = 0 -tmpname = os.tmpnam() -assume_yes = 0 - -if len(sys.argv) > 1: - if sys.argv[1] in ["-y", "--yes"]: - assume_yes = 1 - elif sys.argv[1] in ["-h", "--help"]: - print """pkg-clean [options] - --y, --yes Don't ask for individual confirmation before unmerging; assume yes. -""" - sys.exit(0) - -for pkg_core in pkg_hash.keys(): - print "Examining %s:" % (pkg_core) - if len(pkg_hash[pkg_core]) < 2: - continue - unmerged_indexes = [] - - curpkg += 1 - choices = "" - idx = 1 - for pkg_tuple in pkg_hash[pkg_core]: - choices += " %d \"%s %s\" 0" % \ - (idx, time.ctime(pkg_tuple[PKG_TIME]), - pkg_tuple[PKG_NAME]) - idx += 1 - - params = "dialog --separate-output --backtitle \"pkg-clean processing package %d of %d\" " % ( curpkg, total_len) - params += "--checklist \"Select which package(s) to unmerge\" 20 70 12" + choices - res = os.system(params + " 2> " + tmpname) - if res: - sys.exit(0) - - ins = open(tmpname) - for j in ins.readlines(): - idx = int(j) - if idx == 0: - break - - full_path = pkg_hash[pkg_core][idx-1][PKG] - ebuild = full_path.replace('/var/db/pkg','') - - if not assume_yes: - params = "dialog --backtitle \"" + ebuild + "\" " + \ - "--yesno \"Are you sure you want to unmerge " + ebuild + " ?\" 20 70" - res = os.system(params) - else: - res = 0 - - if res == 0: - (status, unmerge_out) = commands.getstatusoutput( - "ebuild %s unmerge" % (full_path)) - print unmerge_out - time.sleep(2) - if status != 0: - sys.exit(status) - ins.close() diff --git a/trunk/src/old-scripts/pkg-clean.1 b/trunk/src/old-scripts/pkg-clean.1 deleted file mode 100644 index 7a295f3..0000000 --- a/trunk/src/old-scripts/pkg-clean.1 +++ /dev/null @@ -1,20 +0,0 @@ -.TH pkg\-clean "1" "Nov 2003" "gentoolkit" -.SH NAME -pkg\-clean \- Gentoo: Clean obsolete packages -.SH SYNOPSIS -.B pkg\-clean -.SH BUGS -This tool is obsolete, as of gentoolkit 0.2.0. -Use 'emerge clean' or 'emerge depclean' (with caution; read the man page) -instead. - -.SH SEE ALSO -.BR emerge(1) -.br -.BR /usr/sbin/pkg\-clean - -.SH AUTHORS -This informative man page was written by Karl Trygve Kalleberg - and expanded by Katerina Barone\-Adesi -. - diff --git a/trunk/src/old-scripts/pkg-size b/trunk/src/old-scripts/pkg-size deleted file mode 100644 index 8770db7..0000000 --- a/trunk/src/old-scripts/pkg-size +++ /dev/null @@ -1,63 +0,0 @@ -#!/bin/sh -# Copyright 1999-2003 Gentoo Technologies, Inc. -# Distributed under the terms of the GNU General Public License v2 -# $Header$ -# Author: Karl Trygve Kalleberg - -echo -echo -e "\x1b[31;01m!!! As of Gentoolkit 0.2.0, this tool is deprecated." -echo -e "!!!\x1b[0;0m Refer to 'equery size' for a replacement." -echo - -spec=$1 - -if [ -z "$spec" ] ; then - echo "Usage: pkg-size package" - exit 1 -fi - -name=`echo $1 | sed "s/\([^/]*\)\///"` -category=`echo $1 | sed "s/\/.*//"` - -if [ "$category" == "$name" ] ; then - category= -fi - -function tryfile() { - local foo - foo=/var/db/pkg/$1/CONTENTS - bar=`ls $foo 2> /dev/null` - for i in $bar ; do - if [ -f "$i" ] ; then - echo $i - break - fi - done -} - -file=`tryfile "${category}/${name}"` -if [ -z $file ] ; then - file=`tryfile "${category}/${name}*"` - if [ -z $file ] ; then - file=`tryfile "${category}*/${name}"` - if [ -z $file ] ; then - file=`tryfile "${category}*/${name}*"` - if [ -z $file ] ; then - echo "!!! Package resembling ${category}/${name} not found" - exit 1 - fi - fi - fi -fi - -pkgname=`echo $file | sed -e "s:\/var\/db\/pkg\/::" -e "s:\/CONTENTS::"` - -totals=`cat $file|grep "obj"|awk '{ print $2 }' | sed "s/ /\\ /" | xargs du -scb | grep total | cut -f 1` - -size=0 -for i in $totals ; do - size=$[size+i] -done - -echo "$pkgname $size ($[size/1024]KB)" - diff --git a/trunk/src/old-scripts/pkg-size.1 b/trunk/src/old-scripts/pkg-size.1 deleted file mode 100644 index b195412..0000000 --- a/trunk/src/old-scripts/pkg-size.1 +++ /dev/null @@ -1,11 +0,0 @@ -.TH pkg-size "1" "Nov 2003" "gentoolkit" -.SH NAME -pkg-size \- Gentoo: Package size calculator -.SH SYNOPSIS -.B pkg-size -\fIpackage\fR -.SH DESCRIPTION -Calculate size of \fIpackage\fR. -.SH AUTHORS -\fBpkg-size\fR was written by Karl Trygve Kalleberg . - diff --git a/trunk/src/pkg-clean/AUTHORS b/trunk/src/pkg-clean/AUTHORS deleted file mode 100644 index f126a36..0000000 --- a/trunk/src/pkg-clean/AUTHORS +++ /dev/null @@ -1,5 +0,0 @@ -Maintainer: -Karl Trygve Kalleberg - -Authors: -Leo Lipelis (original author) diff --git a/trunk/src/pkg-clean/ChangeLog b/trunk/src/pkg-clean/ChangeLog deleted file mode 100644 index e69de29..0000000 diff --git a/trunk/src/pkg-clean/README b/trunk/src/pkg-clean/README deleted file mode 100644 index e69de29..0000000 diff --git a/trunk/src/pkg-clean/pkg-clean b/trunk/src/pkg-clean/pkg-clean deleted file mode 100644 index abe0159..0000000 --- a/trunk/src/pkg-clean/pkg-clean +++ /dev/null @@ -1,99 +0,0 @@ -#!/usr/bin/python -# Copyright 1999-2003 Gentoo Technologies, Inc. -# Distributed under the terms of the GNU General Public License v2 -# $Header$ -# Author: Leo Lipelis -# Author: Karl Trygve Kalleberg - -import commands -import re -import sys -import time -import os - -# constants for package tuples that are stored in pkg_hash -PKG_TIME = 0 # number of seconds for ctime function -PKG = 1 # package full path as accepted by ebuild -PKG_NAME = 2 # package name as accepted by emerge - -(status, pkg_files) = commands.getstatusoutput( - "find /var/db/pkg -iname '*.ebuild' -printf '%T@ %p\n' | sort -n") - -pkg_file_list = pkg_files.splitlines() - -pkg_hash = {} -for time_pkg_pair in pkg_file_list: - (pkg_time, pkg) = time_pkg_pair.split() - pkg_time = int(pkg_time) - # This covers developer trees with not-accepted categories - tmp_name = re.match(r'/var/db/pkg/(.*/.*)/.*', pkg) - if not tmp_name: continue - pkg_name = tmp_name.group(1) - tmp_core = re.match(r'(.*)-\d.*', pkg_name) - if not tmp_core: continue - pkg_core = tmp_core.group(1) - if pkg_hash.has_key(pkg_core): - pkg_hash[pkg_core].append((pkg_time, pkg, pkg_name)) - else: - pkg_hash[pkg_core] = [(pkg_time, pkg, pkg_name)] - -total_len = len(pkg_hash.keys()) -curpkg = 0 -tmpname = os.tmpnam() -assume_yes = 0 - -if len(sys.argv) > 1: - if sys.argv[1] in ["-y", "--yes"]: - assume_yes = 1 - elif sys.argv[1] in ["-h", "--help"]: - print """pkg-clean [options] - --y, --yes Don't ask for individual confirmation before unmerging; assume yes. -""" - sys.exit(0) - -for pkg_core in pkg_hash.keys(): - print "Examining %s:" % (pkg_core) - if len(pkg_hash[pkg_core]) < 2: - continue - unmerged_indexes = [] - - curpkg += 1 - choices = "" - idx = 1 - for pkg_tuple in pkg_hash[pkg_core]: - choices += " %d \"%s %s\" 0" % \ - (idx, time.ctime(pkg_tuple[PKG_TIME]), - pkg_tuple[PKG_NAME]) - idx += 1 - - params = "dialog --separate-output --backtitle \"pkg-clean processing package %d of %d\" " % ( curpkg, total_len) - params += "--checklist \"Select which package(s) to unmerge\" 20 70 12" + choices - res = os.system(params + " 2> " + tmpname) - if res: - sys.exit(0) - - ins = open(tmpname) - for j in ins.readlines(): - idx = int(j) - if idx == 0: - break - - full_path = pkg_hash[pkg_core][idx-1][PKG] - ebuild = full_path.replace("/var/db/pkg/", "") - - if not assume_yes: - params = "dialog --backtitle \"" + ebuild + "\" " + \ - "--yesno \"Are you sure you want to unmerge " + ebuild + " ?\" 20 70" - res = os.system(params) - else: - res = 0 - - if res == 0: - (status, unmerge_out) = commands.getstatusoutput( - "ebuild %s unmerge" % (full_path)) - print unmerge_out - time.sleep(2) - if status != 0: - sys.exit(status) - ins.close() diff --git a/trunk/src/pkg-clean/pkg-clean.1 b/trunk/src/pkg-clean/pkg-clean.1 deleted file mode 100644 index 7a295f3..0000000 --- a/trunk/src/pkg-clean/pkg-clean.1 +++ /dev/null @@ -1,20 +0,0 @@ -.TH pkg\-clean "1" "Nov 2003" "gentoolkit" -.SH NAME -pkg\-clean \- Gentoo: Clean obsolete packages -.SH SYNOPSIS -.B pkg\-clean -.SH BUGS -This tool is obsolete, as of gentoolkit 0.2.0. -Use 'emerge clean' or 'emerge depclean' (with caution; read the man page) -instead. - -.SH SEE ALSO -.BR emerge(1) -.br -.BR /usr/sbin/pkg\-clean - -.SH AUTHORS -This informative man page was written by Karl Trygve Kalleberg - and expanded by Katerina Barone\-Adesi -. - diff --git a/trunk/src/pkg-size/pkg-size b/trunk/src/pkg-size/pkg-size deleted file mode 100644 index 84dd7df..0000000 --- a/trunk/src/pkg-size/pkg-size +++ /dev/null @@ -1,66 +0,0 @@ -#! /usr/bin/python -# -# $Header$ -# -# Distributed under the terms of the GNU General Public License v2 -# Copyright (c) 2003 Karl Trygve Kalleberg - -import portage -import pprint -import sys -import os - -__author__ = "Karl Trygve Kalleberg" -__email__ = "karltk@gentoo.org" -__version__ = "0.1.0" -__productname__ = "pkg-size" -__description__ = "Portage package size calculator" - -def find(name): - return portage.portdb.match(name) - -def print_size(cpv): - scpv=portage.catpkgsplit(cpv) - cat = scpv[0] - pnv = scpv[1]+"-"+scpv[2] - if scpv[3] != "r0": - pnv +="-"+scpv[3] - db=portage.dblink(cat,pnv,"") - size=0 - uncounted = 0 - if not os.path.exists(db.getpath()): - return - k=db.getcontents() - if not k: - return - for i in k: - try: - size += os.stat(i).st_size - except OSError: - uncounted += 1 - s = cpv + ": " + str(size) + " bytes (" + str((size+512)/1024) + "KB)" - if uncounted > 0: - s += " (" + str(uncounted) + " file(s) not accessible)" - print s - - -def main(): - # parse parameters - if len(sys.argv) < 2: - print "No arguments!" - return - name = sys.argv[1] - candidates = find(name) - if len(candidates) == 0: - print "No candidate packages found!" - return - - for i in candidates: - print_size(i) - -if __name__ == "__main__": - try: - main() - except KeyboardInterrupt: - print "Operation Aborted!" - diff --git a/trunk/src/qpkg/AUTHORS b/trunk/src/qpkg/AUTHORS deleted file mode 100644 index e69de29..0000000 diff --git a/trunk/src/qpkg/ChangeLog b/trunk/src/qpkg/ChangeLog deleted file mode 100644 index b25fd25..0000000 --- a/trunk/src/qpkg/ChangeLog +++ /dev/null @@ -1,5 +0,0 @@ -2004-02-18 Brandon Low - * Fix a reported security issue, have a TMP location that is process specific - -2004-01-07 Karl Trygve Kalleberg - * Added Makefile diff --git a/trunk/src/qpkg/Makefile b/trunk/src/qpkg/Makefile deleted file mode 100644 index cccdee0..0000000 --- a/trunk/src/qpkg/Makefile +++ /dev/null @@ -1,19 +0,0 @@ -# Copyright 2004 Karl Trygve Kalleberg -# Copyright 2004 Gentoo Technologies, Inc. -# Distributed under the terms of the GNU General Public License v2 -# -# $Header$ - -include ../../makedefs.mak - -all: - echo "HATHERSAGE (n.) The tiny snippets of beard which coat the inside of a washbasin after shaving in it." - -dist: - mkdir -p ../../${distdir}/src/qpkg - cp Makefile README AUTHORS ChangeLog TODO qpkg qpkg.1 ../../${distdir}/src/qpkg/ - -install: - install -d $(docdir)/deprecated/qpkg - install -m 0755 qpkg $(docdir)/deprecated/qpkg/ - install -m 0644 qpkg.1 README AUTHORS ChangeLog $(docdir)/deprecated/qpkg/ diff --git a/trunk/src/qpkg/README b/trunk/src/qpkg/README deleted file mode 100644 index e69de29..0000000 diff --git a/trunk/src/qpkg/TODO b/trunk/src/qpkg/TODO deleted file mode 100644 index e69de29..0000000 diff --git a/trunk/src/qpkg/qpkg b/trunk/src/qpkg/qpkg deleted file mode 100644 index dd8344b..0000000 --- a/trunk/src/qpkg/qpkg +++ /dev/null @@ -1,581 +0,0 @@ -#!/bin/bash -# -# qpkg - query portage package system for various information -# -# Copyright (c) Vitaly Kushneriuk -# This program is distributed under the terms of GPL version 2. -# -# Maintainer: Brandon Low -# Additional code thanks to: -# Josh Goebel -# -# $Header$ -ID='$Id$' -VERSION=0.`echo ${ID} | cut -d\ -f3` - -umask 0077 - -TMP="$(mktemp -d -t qpkg-XXXXXX)" -rm -rf ${TMP} -mkdir -p ${TMP} - -PROG=`basename ${0}` - -# Parse args -verb=0 -group="*" -params=${#} -while [ ${#} -gt 0 ] -do - a=${1} - shift - case "${a}" in - - -h|--help) - usage=y - break - ;; - - -i|--info) - info=y - ;; - - -d|--dups) - dups=y - inst=y - ;; - - -q|--query-deps) - query=y - ;; - - -s|--slot) - slot=y - ;; - - -f|--find-file) - ffind=y - inst=y - ;; - - -fp|--find-pattern) - ffind=y - fpat=y - inst=y - ;; - - -I|--installed) - inst=y - ;; - - -m|--masked) - grepmask="-L" - ;; - - -n|--non-masked) - grepmask="-l" - ;; - - -U|--uninstalled) - uninst=y - ;; - - -g|--group) - group=$1 - shift - ;; - - -l|--list) - list=y - inst=y - ;; - - -ct|--check-time|-tc|--time-check) - tcheck=y - inst=y - ;; - - -cm|--check-md5|-mc|--md5-check) - mcheck=y - inst=y - ;; - - -c|--check) - mcheck=y - tcheck=y - inst=y - ;; - - -v|--verbose) - let $((verb++)) - ;; - - -vv) - let $((verb++)) - let $((verb++)) - ;; - - -nc|--no-color|--nocolor|--no-colors|--nocolors) - nocolor=y - ;; - - -*) - echo -e ${CY}${PROG}${NO}:${YL} Invalid option ${RD}$a 1>&2 - usage=y - break - ;; - *) - if [ -n "${arg}" ]; then - echo -e ${CY}${PROG}: ${YL}Only one argument supported - usage=y - break - fi - arg=$a - ;; - - esac -done - -#This is a dumb way to handle things, take it out next time -T="\t" - -#Set up colors -if [ ! "${nocolor}" ]; then - NO="\x1b[0;0m" - BR="\x1b[0;01m" - CY="\x1b[36;01m" - RD="\x1b[31;01m" - GR="\x1b[32;01m" - YL="\x1b[33;01m" - BL="\x1b[34;01m" - STAR=" *" -elif [ ! "${inst}" ] && [ ! "${uninst}" ]; then - STAR=" *" -fi - - -# check for option conflicts -if [ "${inst}" -a "${uninst}" \ - -o \( "${ffind}" -o "${list}" -o "${tcheck}" -o "${mcheck}" \) \ - -a "${uninst}" ]; then - echo -e ${CY}${PROG}${NO}:${YL} conflicting options/modes${NO} - usage=y -fi - -if [ "${usage}" ]; then - echo -e "${CY}${PROG} v. ${VERSION}${NO} - -${CY}${PROG}${NO} is GenToolKit's \"query package\" tool, using it, you can -find packages owning files on your filesystem, check the integrity -of installed packages, and do other queries against installed or -uninstalled packages. - -NOTICE: This tool will be phased out at some point in the - future, please use equery instead. - Bugs are still fixed but new features won't be added. - -${BR}Usage: -${T}${CY}${PROG}${NO} [${BR}options${NO}] [${YL}pkgname${NO}] [${BL}-g${YL} group${NO}] [${BL}-f${YL} ${NO}|${BL}-fp${YL} ${NO}] -${T}${CY}${PROG}${NO} ${BL}--dups${NO} [${BL}--slot${NO}] -${T}${CY}${PROG}${NO} ${BL}--help${NO} - -${BR}Duplicate Locating: - ${BL}-d, --dups${NO}${T}${T}print packages that have multiple versions installed - ${BL}-s, --slot${NO}${T}${T}make ${BL}-d${NO} SLOT only print dups of the same SLOT - -${BR}Package Selection: - ${BL}-f, --find-file${NO}${T}finds package that owns file - ${BL}-fp, --find-pattern${NO}${T}finds to package that owns file matching ** - ${BL}-m, --masked${NO}${T}${T}Include${YL} only${NO} masked packages - ${BL}-n, --non-masked${NO}${T}Include${YL} only${NO} non-masked packages - ${BL}-I, --installed${NO}${T}Include${YL} only${NO} installed packages - ${BL}-U, --uninstalled${NO}${T}Include${YL} only${NO} uninstalled packages - ${BL}-g, --group${NO}${T}${T}Find by group (can be combined with other searches) - -${BR}Information Selection: - ${BL}-l, --list${NO}${T}${T}List package content - ${BL}-i, --info${NO}${T}${T}Get package description and home page. - ${BL}-ct, --check-time${NO} - ${BL}-tc, --time-check${NO}${T}Verify package files timestamps - ${BL}-cm, --check-md5${NO} - ${BL}-mc, --md5-check${NO}${T}Verify package files md5 - ${BL}-c, --check${NO}${T}${T}Verify mtimes${YL} and${NO} md5. - ${BL}-q, --query-deps${NO}${T}display all installed packages -${T}${T}${T}depending on selected packages - -${BR}Operation Modifiers: - ${BL}-nc, --no-color${NO}${T}don't use colors - ${BL}-v, --verbose${NO}${T}Be more verbose [ can be repeated twice ] - ${BL}-vv${NO}${T}${T}${T}Same as ${BL}-v -v${NO} - -${YL}Notes${NO}: -${YL}*${NO} ${BL}-f${NO}, ${BL}-fp, ${BL}-d${NO}, ${BL}-l${NO}, ${BL}-ct${NO}, ${BL}-cm${NO}, and ${BL}-c${NO} apply only to installed packages. -${YL}*${NO} Short options may not be combined on the command-line, yet. -${YL}*${NO} The operation of some flags has been changed by the - stripping of version numbers from some output to see - the version numbers play with ${BL}-v${NO} and ${BL}-vv${NO}. -${YL}*${NO} When using${BL} -f${NO} with ${BL}-l${NO} or ${BL}--check.. -v${NO} options, only - matching files will be displayed, unless ${BL}-v${NO} is doubled, - (yet more verbose) or ${BL}-vv${NO} is used. - - -${YL}Examples${NO}: - ${PROG} --dups print duplicates oldest first - ${PROG} --dups -v .. with versions - ${PROG} print list of installed packages - ${PROG} porta -I print versions of installed portage - ${PROG} porta -i .. + versions in portage tree + descriptions - and homepages - ${PROG} gawk -c -v check integrity of all installed versions of gawk - the older ones will have \"damaged\" files. - ${PROG} -f /bin/ls print package(s) that own /bin/ls -" - rm -rf ${TMP} - exit -fi - -#For the --dups switch only -if [ "${dups}" ]; then -if [ "${grepmask}" ]; then - mask=`python -c 'import portage; print portage.settings["ACCEPT_KEYWORDS"];' 2> /dev/null` - echo -e "Currently accepted keywords: ${BL}${mask}${NO}" - echo -e - mask=`echo ${mask} | perl -pe 's/\s+/|/'` -fi - - #First dig out the list of packages with duplicates - find /var/db/pkg/ -iname "*${arg}*.ebuild" 2> /dev/null > ${TMP}qpkg.lst - dups=`cat ${TMP}qpkg.lst | cut -f7 -d/ | - sed -e 's:\.ebuild$::; s:-r[0-9]*$::; s:-[^-]*$::; /^$/d' | - sort | - uniq -d` - - #Next get all the exact versions - duppak=`cat ${TMP}qpkg.lst | fgrep "${dups}"` - - #Now cut that down to the directory name so we can be smart - dirs=`sed -e 's:/[^/]*$::' ${TMP}qpkg.lst` - - #Go through each package's DB and create a sortable file - #to play with - declare -i defcount=`cat /var/cache/edb/counter` - for DIR in ${dirs} - do #Package COUNTER - NUM=`cat "${DIR}/COUNTER" 2> /dev/null` - [ -z "${NUM}" ] && NUM=defcount - #Package slot if requested - [ ${slot} ] && SLOT=`cat "${DIR}/SLOT"` - #Package fullname - PKG=`ls --color=no -1 ${DIR}/*.ebuild|cut -f5,7 -d"/"` - #Package basename - NAME=`echo "${PKG}"|sed -e 's:\.ebuild$::; s:-r[0-9]\+$::; s:-[0-9].*$::'` - echo "${NUM} ${PKG} ${NAME}${SLOT}" - #Finish loop, and sort that nice sortable file based on - #installation order, and then based on package basename - #bash hates me so I decided to use a temp file - done |sort -t" " -k3 -k1g,2|uniq -D -f2 > ${TMP}qpkg.lst - duppak=`cat ${TMP}qpkg.lst` - rm ${TMP}qpkg.lst - - #If max verbosity is set output with full path to each ebuild - if [ "${verb}" -gt 1 ]; then - echo -n "${duppak}"|cut -f2 -d" "| \ - sed -e "s:^:${BL}/var/db/pkg/${BR}:" \ - -e "s:\(/\)\([^/]*\)\(.ebuild\):\1${CY}\2${NO}\1\2\3:" - - #If normal verbosity output package group, package name and package version - elif [ "${verb}" -gt 0 ]; then - echo -n "${duppak}"|cut -f2 -d" "| \ - sed -e "s:\(^[^/]*/\)\(.*\)\(\.ebuild\):${BR}\1${CY}\2${NO}:" - - #Otherwise just output package group and package name - else - echo -n "${duppak}"|cut -f2 -d" "| \ - sed -e "s:-r[0-9]\+$::" \ - -e "s:-[0-9].*$::" \ - -e "s:\(^[^/]*/\)\(.*\):${BR}\1${CY}\2${NO}:"|uniq - fi - rm -rf ${TMP} - exit -fi - -# get list of ebuilds to work on -if [ "${ffind}" ]; then - # file find mode - list all ebuilds for - # package/CONTENTS containing - if [ "${fpat}" ]; then - dirs=`ls /var/db/pkg/${group}/*/CONTENTS \ - | xargs grep -l "${arg} " \ - | xargs --no-run-if-empty -n 1 dirname` - else - # if the user didnt specify a full path assume they - # want to check in the working dir #17331 - [ "${arg:0:1}" != "/" ] && arg="${PWD}/${arg}" - - dirs=`ls /var/db/pkg/${group}/*/CONTENTS \ - | xargs grep -Fl " ${arg} " \ - | xargs --no-run-if-empty -n 1 dirname` - fi - ipak=`( - for d in ${dirs} -;do - [ "-" = "$d" ] && break - ls ${d}/*.ebuild - done)` -else - # normal mode - list ebuilds for ebuild name containing - - # installed packages - if [ ! "${uninst}" ]; then - ipak=`find /var/db/pkg/ -iname "*.ebuild" 2>/dev/null` - if [[ ${group} != "*" ]]; then - ipak=`echo ${ipak}|sed -e "s: :\n:g"|grep ${group}` - fi - if [ ${arg} ]; then - # avoid ${arg}="db" from pulling in every installed package - temp="/var/db/pkg/.*${arg}" - ipak=`echo ${ipak}|sed -e "s: :\n:g"|grep -i ${temp}` - fi - if [ -n "${mask}" ]; then - ipak=`echo ${ipak}|xargs -r egrep ${grepmask} "^KEYWORDS=.*[[:space:]\"\'](${mask})[[:space:]\"\']"` - fi - fi - # not installed packages (yet:-) - if [ ! "${inst}" ]; then - upak=`find /usr/portage/ -iname "*.ebuild" 2>/dev/null|grep -v --regex="/usr/portage/[^/]*\.ebuild"` - if [[ ${group} != "*" ]]; then - upak=`echo ${upak}|sed -e "s: :\n:g"|grep ${group}` - fi - if [ ${arg} ]; then - upak=`echo ${upak}|sed -e "s: :\n:g"|grep -i ${arg}` - fi - if [ -n "${mask}" ]; then - upak=`echo ${upak}|xargs -r egrep ${grepmask} "^KEYWORDS=.*[[:space:]\"\'](${mask})[[:space:]\"\']"` - fi - fi -fi - -X="\([^/]*\)" - -for p in ${ipak} ${upak} -;do - [ "${p}" = "-" ] && break - - # cut common prefix from ebuild name and mark installed/uninstalled packages - # Note: iii/uuu will be replaced by the pipe at the end - n=${p%.ebuild} - var_db_pkg="/var/db/pkg/" - n=${n/${var_db_pkg}/iii } - usr_portage="/usr/portage/" - n=${n/${usr_portage}/uuu } - n=${n/\/*\//\/} - - d=${p%\/*.ebuild} # faster d=`dirname ${p}` - echo ${n} - - # if we have no passed parameters then - # we can skip the extra conditional checks - [[ ${params} == 0 ]] && continue; - - if [ "${mask}" ]; then - keywords=`grep KEYWORDS ${p}| cut -d\" -f2` - echo -e "${T}Keywords: ${BL}${keywords}${NO}" - fi - - if [ ${verb} -gt 1 ];then - echo "vvv ${p}" - fi - - if [ "${info}" ]; then - source ${p} 2> /dev/null - home="${HOMEPAGE}" - desc="${DESCRIPTION}" - #home=`grep HOMEPAGE ${p}| cut -d\" -f2` - #desc=`grep DESCRIPTION ${p}|cut -d= -f2-|cat` - echo -e "${T}${BL}${desc}${NO} [ ${YL}${home}${NO} ]" - if [ ${verb} -gt 0 ]; then - pdir=${p/$(basename ${p})/} - if [[ -r ${pdir}/USE && -r ${pdir}/IUSE ]]; then - echo -n "Compiled with USE Flags: " - for flag in $(<${pdir}/IUSE) - do - use=$(grep -o ${flag} ${pdir}/USE | tr -d '\n') - if [[ "${use}" == "" ]]; then - echo -n "-" - fi - echo -n "${flag} " - done - echo - fi - fi - fi - - if [ "${query}" ]; then - echo -e "${BL}DEPENDED ON BY:${NO}" - package="`echo ${n}|sed -e 's:-r[0-9]\+$::' \ - -e 's:-[0-9].*$::' \ - -e 's:^iii ::' \ - -e 's:^uuu ::'`" - place="`echo ${n}|cut -f1 -d' '`" - [[ "${place}" == "iii" ]] && color="${GR}" || color="${RD}" - - if [[ ${place} == "iii" ]]; then - for deppkg in $(grep -R "${package}" /var/db/pkg/*/*/RDEPEND | sed 's/RDEPEND.*$//') - do - rdepend=$(< ${deppkg}/RDEPEND) - - for flag in $(< ${deppkg}/USE) - do - if [[ "${flag:0:1}" == "-" ]]; then - rdepend="$(echo ${rdepend} | sed 's/${flag:1}? ( [[:alnum:][:punct:]]* )//')" - fi - done - - if [[ $(echo ${rdepend} | grep -o ${package}) == ${package} ]]; then - echo $'\t'$(< ${deppkg}/PF) - fi - done - else - grep -R "${package}" /var/db/pkg/*/*/RDEPEND | \ - cut -f5,6 -d"/" | sed -e "s:^:\t${color}:;s:$:${NO}:" | sort -u - fi - if [[ $(grep -R "*${package}" /etc/make.profile/packages) != "" ]]; then - echo -e "\t${color}SYSTEM PROFILE${NO}" - fi - fi - - # cat package content, remove obj/sym/dir, md5 and mtime when not verbose - # display only match in file-find mode unless extra verbose - if [ "${list}" ]; then - echo -e ${BL}CONTENTS:${NO} - - if [ ${verb} -gt 1 ]; then - cat ${d}/CONTENTS - else - if [ "${ffind}" ]; then - if [ "${fpat}" ]; then - grep "${arg}[:blank:]" $d/CONTENTS - else - grep " ${arg}\( .*\)*$" $d/CONTENTS - fi - else - cat $d/CONTENTS - fi | - if [ ${verb} -gt 0 ]; then - cat - else - sed -e "s:\(^obj \)\(.*\)\( .*\)\{2\}$:\1${BR}\2${NO}:; - s:\(^sym \)\(.*\)\( -> \)\(.*\)\( .*\)\{2\}$:\1${CY}\2${NO}\3\4:; - s:\(^dir \)\(.*\)$:\1${YL}\2${NO}:" - fi - fi - - echo - - # check files mtime and md5, display summary at the end - elif [ "${tcheck}" -o "${mcheck}" ]; then - # counters - fe=0 - fs=0 - # read the CONTENTS file and check md5 and mtime if needed - # process only matching files in find-file mode unless extra verbose - cat ${d}/CONTENTS | - if [ "${ffind}" -a ${verb} -lt 2 ];then - if [ "${fpat}" ]; then - grep "${arg}" - else - grep " ${arg} " - fi - else - cat - fi | - ( - while read -a line - do - fs=$((fs + 1)) - - unset md5 - unset _md5 - unset mtime - unset _mtime - unset err - unset len - - len="${#line[*]}" - if [ "${line[0]}" = "obj" ]; then - name= - for i in `seq 1 $((${len}-3))`; do - [ "${name}" ] && name="${name} ${line[${i}]}" || name="${line[${i}]}" - done - else - name="${line[1]}" - fi - - missing= - [ ! -e "${name}" ] && missing=1 - - # colorize name and compute mtime/md5 - if [ "obj" = "${line[0]}" ]; then - [ -e "${name}" ] && { - [ "${tcheck}" ] && mtime="${line[$((${len}-1))]}" - [ "${tcheck}" ] && _mtime=`date -r "${name}" +%s` - - [ "${mcheck}" ] && md5=${line[$((${len}-2))]} - [ "${mcheck}" ] && _md5=`md5sum "${name}"|cut -f1 -d" "` - } - - name="${BR}${name}${NO}" - - elif [ "sym" = "${line[0]}" ]; then - name="${CY}${name}${NO}" - - elif [ "dir" = "${line[0]}" ]; then - name="${YL}${name}${NO}" - fi - - # compare - if [ "${missing}" ]; then - err=1 - name="${name} ${RD}!not exist!${NO}" - fi - if [ "${md5}" != "${_md5}" ]; then - #If the md5 fails the first time check it with - #everything changed to lowercase :-D - md5="$(echo ${md5}|tr A-Z a-z)" - if [ "${md5}" != "${_md5}" ]; then - err=1 - name="${name} ${RD}!md5!${NO}" - fi - fi - if [ "${mtime}" != "${_mtime}" ]; then - err=1 - name="${name} ${RD}!mtime!${NO}" - fi - - [ "${verb}" -gt 1 ] && echo -e "${name}" - [[ "${verb}" -eq 1 ]] && [[ "${err}" -eq 1 ]] && echo -e "${name}" - - fe=$((fe + err)) - done - if [ "${fe}" = "0" ]; then - echo -e "${YL}${fe}${CY}/${fs}${NO}" - else - echo -e "${RD}${fe}${CY}/${fs}${NO}" - fi - echo - ) - fi - -done | ( - if [ ! \( "${tcheck}" -o "${mcheck}" -o "${info}" -o "${list}" -o "${query}" -o "${mask}" -o ${verb} -gt 0 \) ]; then - sed -e "s:-r[0-9]\+$::" -e "s:-[0-9][^-]*$::"|sort -k2|uniq -f1 - elif [ ! \( "${tcheck}" -o "${mcheck}" -o "${info}" -o "${list}" -o "${query}" -o "${mask}" -o ${verb} -lt 2 \) ]; then - sort -k2|uniq -f1 - else - cat - fi | sed \ - -e "s:^iii ${X}/${X}:${BR}\1/${CY}\2${STAR}${NO}:" \ - -e "s:^uuu ${X}/${X}:${BR}\1/${YL}\2${NO}:" \ - -e "s:^vvv \(.*\)$:${BL}\1${NO}:" \ - -e "s:^obj ::;s:^sym ::;s:^dir ::" - -) -rm -rf ${TMP} diff --git a/trunk/src/qpkg/qpkg.1 b/trunk/src/qpkg/qpkg.1 deleted file mode 100644 index 6d45a93..0000000 --- a/trunk/src/qpkg/qpkg.1 +++ /dev/null @@ -1,112 +0,0 @@ -.TH "qpkg" "1" "1.6" "gentoolkit 0.1.11-r1" "" -.SH "NAME" -qpkg \- Gentoo: query package tool -.SH "SYNOPSIS" -.LP -.B qpkg\fR [\fIoptions\fR] [\fIpkgname\fR] [\fI\-g group\fR] -.br - [\fI\-f \fR|\fI\-fp \fR] -.TP -.B qpkg \fI\-\-dups\fR [\fI\-\-slot\fR] -.TP -.B qpkg \fI\-\-help\fR -.SH "DESCRIPTION" -qpkg is GenToolKit's "query package" tool, using it, you can find packages owning files on your filesystem, check the integrity of installed packages, and do other queries against installed or uninstalled packages. -.SH "OPTIONS " -.LP -.I Duplicate Locating: -.LP -.B \-d, \-\-dups\fR print packages that have multiple -.br - versions installed -.br -.B \-s, \-\-slot\fR make \-d SLOT only print dups of the -.br - same SLOT -.LP -.I Package Selection: -.LP -.B \-f, \-\-find\-file\fR Finds package that owns file -.br -.B \-fp, \-\-find\-pattern\fR Finds to package that owns file -.br - matching ** -.br -.B \-I, \-\-installed\fR Include only installed packages -.br -.B \-U, \-\-uninstalled\fR Include only uninstalled packages -.br -.B \-g, \-\-group\fR Find by group (can be combined with -.br - other searches) -.LP -.I Information Selection: -.LP -.B \-l, \-\-list\fR List package content -.br -.B \-i, \-\-info\fR Get package description and home page. -.br -.B \-ct, \-\-check\-time -.br -.B \-tc, \-\-time\-check\fR Verify package files timestamps -.br -.B \-cm, \-\-check\-md5 -.br -.B \-mc, \-\-md5\-check\fR Verify package files md5 -.br -.B \-c, \-\-check\fR Verify mtimes and md5. -.br -.B \-q, \-\-query\-deps\fR display all installed packages -.br -\fR depending on selected packages -.LP -.I Operation Modifiers: -.LP -.B \-nc, \-\-no\-color\fR Don't use colors -.br -.B \-v, \-\-verbose\fR Be more verbose [2 levels] -.br -.B \-vv\fR Same as \-v \-v -.SH "NOTES" -\fI\-f, \-fp, \-d, \-l, \-ct, \-cm, \fRand \fI\-c\fR apply only to installed packages. -.br -.TP -Short options may not be combined on the command\-line, yet. -.TP -The operation of some flags has been changed in version 1.6 by the stripping of version numbers from some output to see the version numbers play with \fI\-v\fR and \fI\-vv\fR. -.TP -When using \fI\-f\fR with \fI\-l\fR or \fI\-\-check.. \-v\fR options, only matching files will be displayed, unless \fI\-v\fR is doubled, (yet more verbose), equivalent to \fI\-vv\fR. -.TP -When using \fI\-q\fR, it is important to note that the querying of deps checks package names only, because qpkg is not advanced enough (nor can it reasonably made so) to check complete deps with versions. Please use \fBdepclean\fR or \fBemerge --dep-clean\fR to more completely check the dependency sanity of your system. -.SH "EXAMPLES" -.LP -.B qpkg \fI\-\-dups\fR print duplicates oldest first -.br -.B qpkg \fI\-\-dups \-v\fR.. with versions -.br -.B qpkg\fR print list of packages -.br -.B qpkg\fR porta \fI\-I\fR print versions of installed portage -.br -.B qpkg porta \fI\-i\fR .. + versions in portage tree + -.br - descriptions and homepages -.br -.B qpkg gawk \fI\-c \-v\fR check integrity all installed versions -.br - of gawk the older versions will have -.br - "damaged" files. -.br -.B qpkg \fI\-f\fR /bin/ls print package(s) that own /bin/ls -.SH "AUTHORS" -Vitaly Kushneriuk , 2002: qpkg -.br -Karl Trygve Kalleberg , 2002: man page -.br -Brandon Low , 2002: maintainance -.SH "SEE ALSO" -ebuild(5) -.TP -The \fI/usr/sbin/qpkg\fR script. -.TP diff --git a/trunk/src/qpkg/qpkg.sh b/trunk/src/qpkg/qpkg.sh deleted file mode 100644 index cdbe3c7..0000000 --- a/trunk/src/qpkg/qpkg.sh +++ /dev/null @@ -1,520 +0,0 @@ -#!/bin/bash -# -# qpkg - query portage package system for various information -# -# Copyright (c) Vitaly Kushneriuk -# This program is distributed under the terms of GPL version 2. -# -# Maintainer: Brandon Low -# Additional code thanks to: -# Josh Goebel -# -# $Header$ -ID='$Id$' -VERSION=0.`echo ${ID} | cut -d\ -f3` - -PROG=`basename ${0}` - -# Parse args -verb=0 -group="*" -params=${#} -while [ ${#} -gt 0 ] -do - a=${1} - shift - case "${a}" in - - -h|--help) - usage=y - break - ;; - - -i|--info) - info=y - ;; - - -d|--dups) - dups=y - inst=y - ;; - - -q|--query-deps) - query=y - ;; - - -s|--slot) - slot=y - ;; - - -f|--find-file) - ffind=y - inst=y - ;; - - -fp|--find-pattern) - ffind=y - fpat=y - inst=y - ;; - - -I|--installed) - inst=y - ;; - - -m|--masked) - grepmask="-L" - ;; - - -n|--non-masked) - grepmask="-l" - ;; - - -U|--uninstalled) - uninst=y - ;; - - -g|--group) - group=$1 - shift - ;; - - -l|--list) - list=y - inst=y - ;; - - -ct|--check-time|-tc|--time-check) - tcheck=y - inst=y - ;; - - -cm|--check-md5|-mc|--md5-check) - mcheck=y - inst=y - ;; - - -c|--check) - mcheck=y - tcheck=y - inst=y - ;; - - -v|--verbose) - let $((verb++)) - ;; - - -vv) - let $((verb++)) - let $((verb++)) - ;; - - -nc|--no-color|--nocolor|--no-colors|--nocolors) - nocolor=y - ;; - - -*) - echo -e ${CY}${PROG}${NO}:${YL} Invalid option ${RD}$a 1>&2 - usage=y - break - ;; - *) - if [ -n "${arg}" ]; then - echo -e ${CY}${PROG}: ${YL}Only one argument supported - usage=y - break - fi - arg=$a - ;; - - esac -done - -#This is a dumb way to handle things, take it out next time -T="\t" - -#Set up colors -if [ ! "${nocolor}" ]; then - NO="\x1b[0;0m" - BR="\x1b[0;01m" - CY="\x1b[36;01m" - RD="\x1b[31;01m" - GR="\x1b[32;01m" - YL="\x1b[33;01m" - BL="\x1b[34;01m" - STAR=" *" -elif [ ! "${inst}" ] && [ ! "${uninst}" ]; then - STAR=" *" -fi - - -# check for option conflicts -if [ "${inst}" -a "${uninst}" \ - -o \( "${ffind}" -o "${list}" -o "${tcheck}" -o "${mcheck}" \) \ - -a "${uninst}" ]; then - echo -e ${CY}${PROG}${NO}:${YL} conflicting options/modes${NO} - usage=y -fi - -if [ "${usage}" ]; then - echo -e "${CY}${PROG} v. ${VERSION}${NO} - -${CY}${PROG}${NO} is GenToolKit's \"query package\" tool, using it, you can -find packages owning files on your filesystem, check the integrity -of installed packages, and do other queries against installed or -uninstalled packages. - -${BR}Usage: -${T}${CY}${PROG}${NO} [${BR}options${NO}] [${YL}pkgname${NO}] [${BL}-g${YL} group${NO}] [${BL}-f${YL} ${NO}|${BL}-fp${YL} ${NO}] -${T}${CY}${PROG}${NO} ${BL}--dups${NO} [${BL}--slot${NO}] -${T}${CY}${PROG}${NO} ${BL}--help${NO} - -${BR}Duplicate Locating: - ${BL}-d, --dups${NO}${T}${T}print packages that have multiple versions installed - ${BL}-s, --slot${NO}${T}${T}make ${BL}-d${NO} SLOT only print dups of the same SLOT - -${BR}Package Selection: - ${BL}-f, --find-file${NO}${T}finds package that owns file - ${BL}-fp, --find-pattern${NO}${T}finds to package that owns file matching ** - ${BL}-m, --masked${NO}${T}Include${YL} only${NO} masked packages - ${BL}-n, --non-masked${NO}${T}Include${YL} only${NO} non-masked packages - ${BL}-I, --installed${NO}${T}Include${YL} only${NO} installed packages - ${BL}-U, --uninstalled${NO}${T}Include${YL} only${NO} uninstalled packages - ${BL}-g, --group${NO}${T}${T}Find by goup (can be combined with other searches) - -${BR}Information Selection: - ${BL}-l, --list${NO}${T}${T}List package content - ${BL}-i, --info${NO}${T}${T}Get package description and home page. - ${BL}-ct, --check-time${NO} - ${BL}-tc, --time-check${NO}${T}Verify package files timestamps - ${BL}-cm, --check-md5${NO} - ${BL}-mc, --md5-check${NO}${T}Verify package files md5 - ${BL}-c, --check${NO}${T}${T}Verify mtimes${YL} and${NO} md5. - ${BL}-q, --query-deps${NO}${T}display all installed packages -${T}${T}${T}depending on selected packages - -${BR}Operation Modifiers: - ${BL}-nc, --no-color${NO}${T}don't use colors - ${BL}-v, --verbose${NO}${T}Be more verbose [ can be repeated twise ] - ${BL}-vv${NO}${T}${T}${T}Same as ${BL}-v -v${NO} - -${YL}Notes${NO}: -${YL}*${NO} ${BL}-f${NO}, ${BL}-fp, ${BL}-d${NO}, ${BL}-l${NO}, ${BL}-ct${NO}, ${BL}-cm${NO}, and ${BL}-c${NO} apply only to installed packages. -${YL}*${NO} Short options may not be combined on the command-line, yet. -${YL}*${NO} The operation of some flags has been changed by the - stripping of version numbers from some output to see - the version numbers play with ${BL}-v${NO} and ${BL}-vv${NO}. -${YL}*${NO} When using${BL} -f${NO} with ${BL}-l${NO} or ${BL}--check.. -v${NO} options, only - matching files will be displayed, unless ${BL}-v${NO} is doubled, - (yet more verbose) or ${BL}-vv${NO} is used. - - -${YL}Examples${NO}: - ${PROG} --dups print duplicates oldest first - ${PROG} --dups -v .. with versions - ${PROG} print list of installed packages - ${PROG} porta -I print versions of installed portage - ${PROG} porta -i .. + versions in portage tree + descriptions - and homepages - ${PROG} gawk -c -v check integrity all installed versions of gawk - the older will have \"damaged\" files. - ${PROG} -f /bin/ls print package(s) that own /bin/ls -" - exit -fi - -#For the --dups switch only -if [ "${dups}" ]; then -if [ "${grepmask}" ]; then - mask=`python -c 'import portage; print portage.settings["ACCEPT_KEYWORDS"];' 2> /dev/null` - echo -e "Currently accepted keywords: ${BL}${mask}${NO}" - echo -e - mask=`echo ${mask} | perl -pe 's/\s+/|/'` -fi - - #First dig out the list of packages with duplicates - find /var/db/pkg -iname "*${arg}*.ebuild" 2> /dev/null > /tmp/qpkg.lst - dups=`cat /tmp/qpkg.lst | cut -f7 -d/ | - sed -e 's:\.ebuild$::; s:-r[0-9]*$::; s:-[^-]*$::; /^$/d' | - sort | - uniq -d` - - #Next get all the exact versions - duppak=`cat /tmp/qpkg.lst | fgrep "${dups}"` - - #Now cut that down to the directory name so we can be smart - dirs=`sed -e 's:/[^/]*$::' /tmp/qpkg.lst` - - #Go through each package's DB and create a sortable file - #to play with - declare -i defcount=`cat /var/cache/edb/counter` - for DIR in ${dirs} - do #Package COUNTER - NUM=`cat "${DIR}/COUNTER" 2> /dev/null` - [ -z "${NUM}" ] && NUM=defcount - #Package slot if requested - [ ${slot} ] && SLOT=`cat "${DIR}/SLOT"` - #Package fullname - PKG=`ls --color=no -1 ${DIR}/*.ebuild|cut -f5,7 -d"/"` - #Package basename - NAME=`echo "${PKG}"|sed -e 's:\.ebuild$::; s:-r[0-9]\+$::; s:-[0-9].*$::'` - echo "${NUM} ${PKG} ${NAME}${SLOT}" - #Finish loop, and sort that nice sortable file based on - #installation order, and then based on package basename - #bash hates me so I decided to use a temp file - done |sort -t" " -k3 -k1g,2|uniq -D -f2 > /tmp/qpkg.lst - duppak=`cat /tmp/qpkg.lst` - rm /tmp/qpkg.lst - - #If max verbosity is set output with full path to each ebuild - if [ "${verb}" -gt 1 ]; then - echo -n "${duppak}"|cut -f2 -d" "| \ - sed -e "s:^:${BL}/var/db/pkg/${BR}:" \ - -e "s:\(/\)\([^/]*\)\(.ebuild\):\1${CY}\2${NO}\1\2\3:" - - #If normal verbosity output package group, package name and package version - elif [ "${verb}" -gt 0 ]; then - echo -n "${duppak}"|cut -f2 -d" "| \ - sed -e "s:\(^[^/]*/\)\(.*\)\(\.ebuild\):${BR}\1${CY}\2${NO}:" - - #Otherwise just output package group and package name - else - echo -n "${duppak}"|cut -f2 -d" "| \ - sed -e "s:-r[0-9]\+$::" \ - -e "s:-[0-9].*$::" \ - -e "s:\(^[^/]*/\)\(.*\):${BR}\1${CY}\2${NO}:"|uniq - fi - exit -fi - -# get list of ebuilds to work on -if [ "${ffind}" ]; then - # file find mode - list all ebuilds for - # package/CONTENTS containing - if [ "${fpat}" ]; then - dirs=`ls /var/db/pkg/${group}/*/CONTENTS \ - | xargs grep -l "${arg}" \ - | xargs --no-run-if-empty -n 1 dirname` - else - # if the user didnt specify a full path assume they - # want to check in the working dir #17331 - [ "${arg:0:1}" != "/" ] && arg="${PWD}/${arg}" - - dirs=`ls /var/db/pkg/${group}/*/CONTENTS \ - | xargs grep -l " ${arg}\( .*\)*$" \ - | xargs --no-run-if-empty -n 1 dirname` - fi - ipak=`( - for d in ${dirs} -;do - [ "-" = "$d" ] && break - ls ${d}/*.ebuild - done)` -else - # normal mode - list ebuilds for ebuild name containing - - # installed packages - if [ ! "${uninst}" ]; then - ipak=`find /var/db/pkg/ -iname "*.ebuild" 2>/dev/null` - if [[ ${group} != "*" ]]; then - ipak=`echo ${ipak}|sed -e "s: :\n:g"|grep ${group}` - fi - if [ ${arg} ]; then - # avoid ${arg}="db" from pulling in every installed package - temp="/var/db/pkg/.*${arg}" - ipak=`echo ${ipak}|sed -e "s: :\n:g"|grep ${temp}` - fi - if [ -n "${mask}" ]; then - ipak=`echo ${ipak}|xargs -r egrep ${grepmask} "^KEYWORDS=.*[[:space:]\"\'](${mask})[[:space:]\"\']"` - fi - fi - # not installed packages (yet:-) - if [ ! "${inst}" ]; then - upak=`find /usr/portage/ -iname "*.ebuild" 2>/dev/null|grep -v --regex="/usr/portage/[^/]*\.ebuild"` - if [[ ${group} != "*" ]]; then - upak=`echo ${upak}|sed -e "s: :\n:g"|grep ${group}` - fi - if [ ${arg} ]; then - upak=`echo ${upak}|sed -e "s: :\n:g"|grep ${arg}` - fi - if [ -n "${mask}" ]; then - upak=`echo ${upak}|xargs -r egrep ${grepmask} "^KEYWORDS=.*[[:space:]\"\'](${mask})[[:space:]\"\']"` - fi - fi -fi - -X="\([^/]*\)" - -for p in ${ipak} ${upak} -;do - [ "${p}" = "-" ] && break - - # cut common prefix from ebuild name and mark installed/uninstalled packages - # Note: iii/uuu will be replaced by the pipe at the end - n=${p%.ebuild} - var_db_pkg="/var/db/pkg/" - n=${n/${var_db_pkg}/iii } - usr_portage="/usr/portage/" - n=${n/${usr_portage}/uuu } - n=${n/\/*\//\/} - - d=${p%\/*.ebuild} # faster d=`dirname ${p}` - echo ${n} - - # if we have no passed parameters then - # we can skip the extra conditional checks - [[ ${params} == 0 ]] && continue; - - if [ "${mask}" ]; then - keywords=`grep KEYWORDS ${p}| cut -d\" -f2` - echo -e "${T}Keywords: ${BL}${keywords}${NO}" - fi - - if [ ${verb} -gt 1 ];then - echo "vvv ${p}" - fi - - if [ "${info}" ]; then - home=`grep HOMEPAGE ${p}| cut -d\" -f2` - desc=`grep DESCRIPTION ${p}| cut -d\" -f2` - echo -e "${T}${BL}${desc}${NO} [ ${YL}${home}${NO} ]" - fi - - if [ "${query}" ]; then - echo -e "${BL}DEPENDED ON BY:${NO}" - package="`echo ${n}|sed -e 's:-r[0-9]\+$::' \ - -e 's:-[0-9].*$::' \ - -e 's:^iii ::' \ - -e 's:^uuu ::'`" - place="`echo ${n}|cut -f1 -d' '`" - [[ "${place}" == "iii" ]] && color="${GR}" || color="${RD}" - grep -R "${package}" /var/db/pkg/*/*/RDEPEND | \ - cut -f5,6 -d"/" | sed -e "s:^:\t${color}:;s:$:${NO}:" | sort | uniq -# gawk -F "/" '{printf("${place}\n\t%s/%s${NO}",$5,$6)}' | sort | uniq - fi - - # cat package content, remove obj/sym/dir, md5 and mtime when not verbose - # display only match in file-find mode unless extra verbose - if [ "${list}" ]; then - echo -e ${BL}CONTENTS:${NO} - - if [ ${verb} -gt 1 ]; then - cat ${d}/CONTENTS - else - if [ "${ffind}" ]; then - if [ "${fpat}" ]; then - grep "${arg}" $d/CONTENTS - else - grep " ${arg}\( .*\)*$" $d/CONTENTS - fi - else - cat $d/CONTENTS - fi | - if [ ${verb} -gt 0 ]; then - cat - else - sed -e "s:\(^obj \)\([^ ]*\)\(.*$\):\1${BR}\2${NO}:; - s:\(^sym \)\([^ ]*\)\( -> \)\([^ ]*\)\(.*$\):\1${CY}\2${NO}\3\4:; - s:\(^dir \)\([^ ]*\)\(.*$\):\1${YL}\2${NO}:" - fi - fi - - echo - - # check files mtime and md5, display summary at the end - elif [ "${tcheck}" -o "${mcheck}" ]; then - # counters - fe=0 - fs=0 - # read the CONTENTS file and check md5 and mtime if needed - # process only matching files in find-file mode unless extra verbose - cat ${d}/CONTENTS | - if [ "${ffind}" -a ${verb} -lt 2 ];then - if [ "${fpat}" ]; then - grep "${arg}" - else - grep " ${arg} " - fi - else - cat - fi | - ( - while read -a line - do - fs=$((fs + 1)) - - unset md5 - unset _md5 - unset mtime - unset _mtime - unset err - - name=${line[1]} - - missing= - [ ! -e ${name} ] && missing=1 - - # colorize name and compute mtime/md5 - if [ "obj" = ${line[0]} ]; then - [ -e ${name} ] && { - [ "${tcheck}" ] && mtime=${line[3]} - [ "${tcheck}" ] && _mtime=`date -r ${name} +%s` - - [ "${mcheck}" ] && md5=${line[2]} - [ "${mcheck}" ] && _md5=`md5sum ${name}|cut -f1 -d" "` - } - - name=${BR}${name}${NO} - - elif [ "sym" = ${line[0]} ]; then - name=${CY}${name}${NO} - - elif [ "dir" = ${line[0]} ]; then - name=${YL}${name}${NO} - fi - - # compare - if [ "$missing" ]; then - err=1 - name="${name} ${RD}!not exist!${NO}" - fi - if [ "${md5}" != "${_md5}" ]; then - #If the md5 fails the first time check it with - #everything changed to lowercase :-D - md5=`echo "${md5}"|tr A-Z a-z` - if [ "${md5}" != "${_md5}" ]; then - err=1 - name="${name} ${RD}!md5!${NO}" - fi - fi - if [ "${mtime}" != "${_mtime}" ]; then - err=1 - name="${name} ${RD}!mtime!${NO}" - fi - - [ ${verb} -gt 1 ] && echo -e ${name} - [[ ${verb} -eq 1 ]] && [[ $err -eq 1 ]] && echo -e ${name} - - fe=$((fe + err)) - done - if [ "$fe" = "0" ]; then - echo -e ${YL}$fe${CY}/$fs${NO} - else - echo -e ${RD}$fe${CY}/$fs${NO} - fi - echo - ) - fi - -done | ( - if [ ! \( "${tcheck}" -o "${mcheck}" -o "${info}" -o "${list}" -o "${query}" -o "${mask}" -o ${verb} -gt 0 \) ]; then - sed -e "s:-r[0-9]\+$::" -e "s:-[0-9][^-]*$::"|sort -k2|uniq -f1 - elif [ ! \( "${tcheck}" -o "${mcheck}" -o "${info}" -o "${list}" -o "${query}" -o "${mask}" -o ${verb} -lt 2 \) ]; then - sort -k2|uniq -f1 - else - cat - fi | sed \ - -e "s:^iii ${X}/${X}:${BR}\1/${CY}\2${STAR}${NO}:" \ - -e "s:^uuu ${X}/${X}:${BR}\1/${YL}\2${NO}:" \ - -e "s:^vvv \(.*\)$:${BL}\1${NO}:" \ - -e "s:^obj ::;s:^sym ::;s:^dir ::" - -) diff --git a/trunk/src/revdep-rebuild/99revdep-rebuild b/trunk/src/revdep-rebuild/99revdep-rebuild deleted file mode 100644 index bdaecc7..0000000 --- a/trunk/src/revdep-rebuild/99revdep-rebuild +++ /dev/null @@ -1,21 +0,0 @@ -# Default revdep-rebuild configuration file -# -# revdep-rebuild no longer uses hardcoded paths. To change the default -# behavior the following variables can be changed: -# -# LD_LIBRARY_MASK - Mask of specially evaluated libraries -# -# SEARCH_DIRS - List of directories to search for executables and libraries -# Use this for directories that are not included in PATH or ld.so.conf. -# An application should normally not have to set this variable -# -# SEARCH_DIRS_MASK - List of directories to not search -# Use this for directories that should not be searched by revdep-rebuild -# This is normally used by binary packages such as openoffice-bin -# -# Note: This file is sourced using bash by the revdep-rebuild script - -LD_LIBRARY_MASK="libodbcinst.so libodbc.so libjava.so libjvm.so" -SEARCH_DIRS="/bin /sbin /usr/bin /usr/sbin /lib* /usr/lib*" -SEARCH_DIRS_MASK="/lib*/modules" - diff --git a/trunk/src/revdep-rebuild/AUTHORS b/trunk/src/revdep-rebuild/AUTHORS deleted file mode 100644 index b3d9b32..0000000 --- a/trunk/src/revdep-rebuild/AUTHORS +++ /dev/null @@ -1,2 +0,0 @@ -Stanislav Brabec (original author) -Paul Varner diff --git a/trunk/src/revdep-rebuild/ChangeLog b/trunk/src/revdep-rebuild/ChangeLog deleted file mode 100644 index 9060781..0000000 --- a/trunk/src/revdep-rebuild/ChangeLog +++ /dev/null @@ -1,9 +0,0 @@ -2005-06-05 Paul Varner - - * ChangeLog moved to main gentoolkit ChangeLog - -2004-01-07 Karl Trygve Kalleberg - - * Added Makefile - * Copied revdep-rebuild script from app-portage/gentoolkit - diff --git a/trunk/src/revdep-rebuild/Makefile b/trunk/src/revdep-rebuild/Makefile deleted file mode 100644 index d509681..0000000 --- a/trunk/src/revdep-rebuild/Makefile +++ /dev/null @@ -1,23 +0,0 @@ -# Copyright 2004 Karl Trygve Kalleberg -# Copyright 2004 Gentoo Technologies, Inc. -# Distributed under the terms of the GNU General Public License v2 -# -# $Header$ - -include ../../makedefs.mak - -all: - echo "AIGBURTH (AYG-berth n.) Any piece of readily identifiable anatomy found among cooked meat." - -dist: - mkdir -p ../../$(distdir)/src/revdep-rebuild - cp Makefile AUTHORS README TODO ChangeLog revdep-rebuild revdep-rebuild.1 99revdep-rebuild ../../$(distdir)/src/revdep-rebuild/ - -install: - - install -m 0755 revdep-rebuild $(bindir)/ - install -d $(docdir)/revdep-rebuild - install -m 0644 AUTHORS README TODO $(docdir)/revdep-rebuild/ - install -m 0644 revdep-rebuild.1 $(mandir)/ - install -d $(sysconfdir)/revdep-rebuild - install -m 0644 99revdep-rebuild $(sysconfdir)/revdep-rebuild/ diff --git a/trunk/src/revdep-rebuild/README b/trunk/src/revdep-rebuild/README deleted file mode 100644 index 3a51d9f..0000000 --- a/trunk/src/revdep-rebuild/README +++ /dev/null @@ -1,4 +0,0 @@ -This tool scans libraries and binaries for broken shared lib dependencies -and fixes them by re-emerging those broken binaries and shared libraries. - -- Alastair Tse diff --git a/trunk/src/revdep-rebuild/TODO b/trunk/src/revdep-rebuild/TODO deleted file mode 100644 index d9f6350..0000000 --- a/trunk/src/revdep-rebuild/TODO +++ /dev/null @@ -1,7 +0,0 @@ -- revdep cache in /var/cache - - list all .so files this package depends on - - use timestamps of files to know when to rebuild - - if ts of cache is older than any of the package's contained - files, we must rebuild -- update to use equery/gentoolkit -- rewrite in python and/or eclectic module diff --git a/trunk/src/revdep-rebuild/find_pkgs.py b/trunk/src/revdep-rebuild/find_pkgs.py deleted file mode 100755 index 7013813..0000000 --- a/trunk/src/revdep-rebuild/find_pkgs.py +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/python -# Copyright 1999-2005 Gentoo Foundation -# $Header$ - -# Temporary script to find package versions and slot for revdep-rebuild - -import sys - -sys.path.insert(0, "/usr/lib/gentoolkit/pym") -import gentoolkit - -for pkgname in sys.argv[1:]: - matches = gentoolkit.find_packages(pkgname) - for pkg in matches: - (cat, name, ver, rev) = gentoolkit.split_package_name(pkg.get_cpv()) - slot = pkg.get_env_var("SLOT") - if rev == "r0": - fullversion = ver - else: - fullversion = ver + "-" + rev - - print name + " " + fullversion + " (" + slot + ")" diff --git a/trunk/src/revdep-rebuild/revdep-rebuild b/trunk/src/revdep-rebuild/revdep-rebuild deleted file mode 100755 index 3ffe904..0000000 --- a/trunk/src/revdep-rebuild/revdep-rebuild +++ /dev/null @@ -1,1094 +0,0 @@ -#!/bin/bash -# Copyright 1999-2008 Gentoo Foundation - -# revdep-rebuild: Reverse dependency rebuilder. -# Original Author: Stanislav Brabec -# Rewrite Author: Michael A. Smith -# Current Maintainer: Paul Varner - -# TODO: -# - Use more /etc/init.d/functions.sh -# - Try to reduce the number of global vars - -## -# Global Variables: - -# Must-be-blank: -unset GREP_OPTIONS - -# Readonly variables: -declare -r APP_NAME="${0##*/}" # The name of this application -declare -r OIFS="$IFS" # Save the IFS -declare -r ENV_FILE=0_env.rr # Contains environment variables -declare -r FILES_FILE=1_files.rr # Contains a list of files to search -declare -r LDPATH_FILE=2_ldpath.rr # Contains the LDPATH -declare -r BROKEN_FILE=3_broken.rr # Contains the list of broken files -declare -r ERRORS_FILE=3_errors.rr # Contains the ldd error output -declare -r RAW_FILE=4_raw.rr # Contains the raw list of packages -declare -r OWNERS_FILE=4_owners.rr # Contains the file owners -declare -r PKGS_FILE=4_pkgs.rr # Contains the unsorted bare package names -declare -r EBUILDS_FILE=4_ebuilds.rr # Contains the unsorted atoms - # (Appropriately slotted or versioned) -declare -r ORDER_FILE=5_order.rr # Contains the sorted atoms -declare -r STATUS_FILE=6_status.rr # Contains the ldd error output -declare -ra FILES=( - "$ENV_FILE" - "$FILES_FILE" - "$LDPATH_FILE" - "$BROKEN_FILE" - "$ERRORS_FILE" - "$RAW_FILE" - "$OWNERS_FILE" - "$PKGS_FILE" - "$EBUILDS_FILE" - "$ORDER_FILE" - "$STATUS_FILE" -) - -# "Boolean" variables: Considered "true" if it has any value at all -# "True" indicates we should... -declare FULL_LD_PATH # ...search across the COMPLETE_LD_LIBRARY_PATH -declare KEEP_TEMP # ...not delete tempfiles from the current run -declare ORDER_PKGS # ...sort the atoms in deep dependency order -declare PACKAGE_NAMES # ...emerge by slot, not by versionated atom -declare RM_OLD_TEMPFILES # ...remove tempfiles from prior runs -declare SEARCH_BROKEN # ...search for broken libraries and binaries -declare VERBOSE # ...give verbose output - -# Globals that impact portage directly: -declare EMERGE_DEFAULT_OPTS # String of options portage assumes to be set -declare EMERGE_OPTIONS # Array of options to pass to portage -declare PORTAGE_NICENESS # Renice to this value -declare PORTAGE_ROOT # The root path for portage - -# Customizable incremental variables: -# These variables can be prepended to either by setting the variable in -# your environment prior to execution, or by placing an entry in -# /etc/make.conf. -# -# An entry of "-*" means to clear the variable from that point forward. -# Example: env SEARCH_DIRS="/usr/bin -*" revdep-rebuild will set SEARCH_DIRS -# to contain only /usr/bin -declare LD_LIBRARY_MASK # Mask of specially evaluated libraries -declare SEARCH_DIRS # List of dirs to search for executables and libraries -declare SEARCH_DIRS_MASK # List of dirs not to search - -# Other globals: -declare OLDPROG # Previous pass through the progress meter -declare EXACT_PKG # Versionated atom to emerge -declare HEAD_TEXT # Feedback string about the search -declare NOCOLOR # Set to "true" not to output term colors -declare OK_TEXT # Feedback about a search which found no errors -declare RC_NOCOLOR # Hack to insure we respect NOCOLOR -declare REBUILD_LIST # Array of atoms to emerge -declare SKIP_LIST # Array of atoms that cannot be emerged (masked?) -declare SONAME # Soname/soname path pattern given on commandline -declare SONAME_SEARCH # Value of SONAME modified to match ldd's output -declare WORKING_TEXT # Feedback about the search -declare WORKING_DIR # Working directory where cache files are kept - -main() { - # preliminary setup - get_opts "$@" - setup_portage - setup_search_paths_and_masks - get_search_env - echo - - # Search for broken binaries - get_files - get_ldpath - main_checks - - # Associate broken binaries with packages to rebuild - if [[ $PACKAGE_NAMES ]]; then - get_packages - clean_packages - assign_packages_to_ebuilds - else - get_exact_ebuilds - fi - - # Rebuild packages owning broken binaries - get_build_order - rebuild - - # All done - cleanup -} -## -# Refuse to delete anything before we cd to our tmpdir -# (See mkdir_and_cd_to_tmpdir() -rm() { - eerror "I was instructed to rm '$@'" - die 1 "Refusing to delete anything before changing to temporary directory." -} -## -# GNU find has -executable, but if our users' finds do not have that flag -# we emulate it with this function. Also emulates -writable and -readable. -# Usage: find PATH ARGS -- use find like normal, except use -executable instead -# of various versions of -perm /+ blah blah and hacks -find() { - hash find || { die 1 'find not found!'; } - # We can be pretty sure find itself should be executable. - local testsubject="$(type -P find)" - if [[ $(command find "$testsubject" -executable 2> /dev/null) ]]; then - unset -f find # We can just use the command find - elif [[ $(command find "$testsubject" -perm /u+x 2> /dev/null) ]]; then - find() { - a=(${@//-executable/-perm \/u+x}) - a=(${a[@]//-writable/-perm \/u+w}) - a=(${a[@]//-readable/-perm \/r+w}) - command find "${a[@]}" - } - elif [[ $(command find "$testsubject" -perm +u+x 2> /dev/null) ]]; then - find() { - a=(${@//-executable/-perm +u+x}) - a=(${a[@]//-writable/-perm +u+w}) - a=(${a[@]//-readable/-perm +r+w}) - command find "${a[@]}" - } - else # Last resort - find() { - a=(${@//-executable/-exec test -x '{}' \; -print}) - a=(${a[@]//-writable/-exec test -w '{}' \; -print}) - a=(${a[@]//-readable/-exec test -r '{}' \; -print}) - command find "${a[@]}" - } - fi - find "$@" -} - -print_usage() { -cat << EOF -Usage: $APP_NAME [OPTIONS] [--] [EMERGE_OPTIONS] - -Broken reverse dependency rebuilder. - - -C, --nocolor Turn off colored output - -d, --debug Print way too much information (uses bash's set -xv) - -e, --exact Emerge based on exact package version - -h, --help Print this usage - -i, --ignore Ignore temporary files from previous runs - -k, --keep-temp Do not delete temporary files on exit - -L, --library NAME Emerge existing packages that use the library with NAME - --library=NAME NAME can be a full path to the library or a basic - regular expression (man grep) - -l, --no-ld-path Do not set LD_LIBRARY_PATH - -o, --no-order Do not check the build order - (Saves time, but may cause breakage.) - -p, --pretend Do a trial run without actually emerging anything - (also passed to emerge command) - -P, --no-progress Turn off the progress meter - -q, --quiet Be less verbose (also passed to emerge command) - -v, --verbose Be more verbose (also passed to emerge command) - -Calls emerge, options after -- are ignored by $APP_NAME -and passed directly to emerge. - -Report bugs to -EOF -} -## -# Usage: progress i n -# i: current item -# n: total number of items to process -progress() { - if [[ -t 1 ]]; then - progress() { - local curProg=$(( $1 * 100 / $2 )) - (( curProg == OLDPROG )) && return # no change, output nothing - OLDPROG="$curProg" # must be a global variable - (( $1 == $2 )) && local lb=$'\n' - echo -ne '\r \r'"[ $curProg% ] $lb" - } - progress $@ - else # STDOUT is not a tty. Disable progress meter. - progress() { :; } - fi -} -## -# Usage: countdown n -# n: number of seconds to count -countdown() { - local i - for ((i=1; i<$1; i++)); do - echo -ne '\a.' - ((i<$1)) && sleep 1 - done - echo -e '\a.' -} -## -# Replace whitespace with linebreaks, normalize repeated '/' chars, and sort -u -# (If any libs have whitespace in their filenames, someone needs punishment.) -clean_var() { - awk 'BEGIN {RS="[[:space:]]"} - /-\*/ {exit} - /[^[:space:]]/ {gsub(/\/\/+/, "/"); print}' | sort -u -} -## -# Exit and optionally output to sterr -die() { - local status=$1 - shift - eerror "$@" - exit $status -} -## -# What to do when dynamic linking is consistent -clean_exit() { - if [[ ! $KEEP_TEMP ]]; then - rm -f "${FILES[@]}" - if [[ "$WORKING_DIR" != "/var/cache/${APP_NAME}" ]]; then - # Remove the working directory - builtin cd; rmdir "$WORKING_DIR" - fi - fi - echo - einfo "$OK_TEXT... All done. " - exit 0 -} -## -# Get the name of the package that owns a file or list of files given as args. -get_file_owner() { - local IFS=$'\n' - # ${*/%/ } adds a space to the end of each object name to prevent false - # matches, for example /usr/bin/dia matching /usr/bin/dialog (bug #196460). - find -L /var/db/pkg -name CONTENTS -print0 | - xargs -0 grep -Fl "${*/%/ }" | - sed 's:/var/db/pkg/\(.*\)/CONTENTS:\1:' -} -## -# Normalize some EMERGE_OPTIONS -normalize_emerge_opts() { - # Normalize some EMERGE_OPTIONS - EMERGE_OPTIONS=(${EMERGE_OPTIONS[@]/%-p/--pretend}) - EMERGE_OPTIONS=(${EMERGE_OPTIONS[@]/%-f/--fetchonly}) - EMERGE_OPTIONS=(${EMERGE_OPTIONS[@]/%-f/--verbose}) -} -## -# Use the color preference from portage -setup_color() { - # This should still work if NOCOLOR is set by the -C flag or in the user's - # environment. - export NOCOLOR=$(portageq envvar NOCOLOR) - [[ $NOCOLOR = yes || $NOCOLOR = true ]] && export RC_NOCOLOR=yes # HACK! (grr) - . /etc/init.d/functions.sh -} -## -# Die if an argument is missing. -die_if_missing_arg() { - [[ ! $2 || $2 = -* ]] && die 1 "Missing expected argument to $1" -} -## -# Die because an option is not recognized. -die_invalid_option() { - # Can't use eerror and einfo because this gets called before function.sh - # is sourced - echo - echo "Encountered unrecognized option $1." >&2 - echo - echo "$APP_NAME no longer automatically passes unrecognized options to portage." - echo "Separate emerge-only options from revdep-rebuild options with the -- flag." - echo - echo "For example, $APP_NAME -v -- --ask" - echo - echo "See the man page or $APP_NAME -h for more detail." - echo - exit 1 -} -## -# Warn about deprecated options. -warn_deprecated_opt() { - # Can't use eerror and einfo because this gets called before function.sh - # is sourced - echo - echo "Encountered deprecated option $1." >&2 - [[ $2 ]] && echo "Please use $2 instead." >&2 -} -## -# Get whole-word commandline options preceded by two dashes. -get_longopts() { - case $1 in - --nocolor) export NOCOLOR="yes";; - --no-color) warn_deprecated_opt "$1" "--nocolor" - export NOCOLOR="yes";; - --debug) set -xv;; - --exact) unset PACKAGE_NAMES;; - --help) print_usage - exit 0;; - --ignore) RM_OLD_TEMPFILES=1;; - --keep-temp) KEEP_TEMP=1;; - --library=*) # TODO: check for invalid values - SONAME="${1#*=}" - unset SEARCH_BROKEN;; - --soname=*|--soname-regexp=*) # TODO: check for invalid values - warn_deprecated_opt "${1%=*}" "--library" - SONAME="${1#*=}" - unset SEARCH_BROKEN;; - --library) # TODO: check for invalid values - die_if_missing_arg $1 $2 - shift - SONAME="$1" - unset SEARCH_BROKEN;; - --soname|--soname-regexp) # TODO: check for invalid values - warn_deprecated_opt "$1" "--library" - die_if_missing_arg $1 $2 - shift - SONAME="$1" - unset SEARCH_BROKEN;; - --no-ld-path) unset FULL_LD_PATH;; - --no-order) unset ORDER_PKGS;; - --no-progress) progress() { :; };; - --pretend) EMERGE_OPTIONS+=("--pretend");; - --quiet) echo_v() { :; } - progress() { :; } - quiet=1 - EMERGE_OPTIONS+=($1);; - --verbose) VERBOSE=1 - EMERGE_OPTIONS+=("--verbose");; - --extra-verbose) warn_deprecated_opt "$1" "--verbose" - VERBOSE=1 - EMERGE_OPTIONS+=("--verbose");; - --package-names) # No longer used, since it is the - # default. We accept it for - # backwards compatibility. - warn_deprecated_opt "$1" - PACKAGE_NAMES=1;; - *) die_invalid_option $1;; - esac -} - -## -# Get single-letter commandline options preceded by a single dash. -get_shortopts() { - local OPT OPTSTRING OPTARG OPTIND - while getopts ":CdehikL:loPpqu:vX" OPT; do - case "$OPT" in - C) # TODO: Match syntax with the rest of gentoolkit - export NOCOLOR="yes";; - d) set -xv;; - e) unset PACKAGE_NAMES;; - h) print_usage - exit 0;; - i) RM_OLD_TEMPFILES=1;; - k) KEEP_TEMP=1;; - L) # TODO: Check for invalid values - SONAME="${OPTARG#*=}" - unset SEARCH_BROKEN;; - l) unset FULL_LD_PATH;; - o) unset ORDER_PKGS;; - P) progress() { :; };; - p) EMERGE_OPTIONS+=("--pretend");; - q) echo_v() { :; } - progress() { :; } - quiet=1 - EMERGE_OPTIONS+=("--quiet");; - v) VERBOSE=1 - EMERGE_OPTIONS+=("--verbose");; - X) # No longer used, since it is the default. - # We accept it for backwards compatibility. - warn_deprecated_opt "-X" - PACKAGE_NAMES=1;; - *) die_invalid_option "-$OPTARG";; - esac - done -} -## -# Get command-line options. -get_opts() { - local avoid_utils - local -a args - echo_v() { ewarn "$@"; } - unset VERBOSE KEEP_TEMP EMERGE_OPTIONS RM_OLD_TEMPFILES - ORDER_PKGS=1 - PACKAGE_NAMES=1 - SONAME="not found" - SEARCH_BROKEN=1 - FULL_LD_PATH=1 - while [[ $1 ]]; do - case $1 in - --) shift - EMERGE_OPTIONS+=("$@") - break;; - -*) while true; do - args+=("$1") - shift - [[ ${1:--} = -* ]] && break - done - if [[ ${args[0]} = --* ]]; then - get_longopts "${args[@]}" - else - get_shortopts "${args[@]}" - fi;; - *) die_invalid_option "$1";; - esac - unset args - done - - setup_color - normalize_emerge_opts - - # If the user is not super, add --pretend to EMERGE_OPTIONS - if [[ ${EMERGE_OPTIONS[@]} != *--pretend* && $UID -ne 0 ]]; then - ewarn "You are not superuser. Adding --pretend to emerge options." - EMERGE_OPTIONS+=(--pretend) - fi -} -## -# Is there a --pretend or --fetchonly flag in the EMERGE_OPTIONS array? -is_real_merge() { - [[ ${EMERGE_OPTIONS[@]} != *--pretend* && - ${EMERGE_OPTIONS[@]} != *--fetchonly* ]] -} -## -# Clean up temporary files and exit -cleanup_and_die() { - rm -f "$@" - die 1 " ...terminated. Removing incomplete $@." -} -## -# Clean trap -clean_trap() { - trap "cleanup_and_die $*" SIGHUP SIGINT SIGQUIT SIGABRT SIGTERM - rm -f "$@" -} -## -# Returns 0 if the first arg is found in the remaining args, 1 otherwise -# (Returns 2 if given fewer than 2 arguments) -has() { - (( $# > 1 )) || return 2 - local IFS=$'\a' target="$1" - shift - [[ $'\a'"$*"$'\a' = *$'\a'$target$'\a'* ]] -} -## -# Dies when it can't change directories -cd() { - if builtin cd -P "$@"; then - if [[ $1 != $PWD ]]; then - # Some symlink malfeasance is going on - die 1 "Working directory expected to be $1, but it is $PWD" - fi - else - die 1 "Unable to change working directory to '$@'" - fi -} -## -# Tries not to delete any files or directories it shouldn't -setup_rm() { - ## - # Anything in the FILES array in tmpdir is fair game for removal - rm() { - local i IFS=$'\a' - [[ $APP_NAME ]] || die 1 '$APP_NAME is not defined! (This is a bug.)' - case $@ in - */*|*-r*|*-R*) die 1 "Oops, I'm not allowed to delete that. ($@)";; - esac - for i; do - # Don't delete files that are not listed in the array - # Allow no slashes or recursive deletes at all. - case $i in - */*|-*r*|-*R*) :;; # Not OK - -*) continue;; # OK - esac - has "$i" "${FILES[@]}" && continue - die 1 "Oops, I'm not allowed to delete that. ($@)" - done - command rm "$@" - } - # delete this setup function so it's harmless to re-run - setup_rm() { :; } -} -## -# Make our temporary files directory -# $1 - directory name -# $2 - user name -verify_tmpdir() { - umask 007 || die $? "Unable to set umask 007" - if [[ ! $1 ]]; then - die 1 'Temporary file path is unset! (This is a bug.)' - elif [[ -d $1 ]]; then - # HACK: I hate using find this way - if [[ $(find "$1" -type d ! \( -user $2 -perm -0700 \) ) ]]; then - eerror "Incorrect permissions on $1" - eerror "or at least one file in $1." - die 1 "Please make sure it's not a symlink and then remove it." - fi - cd "$1" - else - die 1 "Unable to find a satisfactory location for temporary files ($1)" - fi - [[ $VERBOSE ]] && einfo "Temporary cache files are located in $PWD" - setup_rm -} -get_search_env() { - local new_env - local old_env - local uid=$(python -c 'import os; import pwd; print pwd.getpwuid(os.getuid())[0]') - # Find a place to put temporary files - if [[ "$uid" == "root" ]]; then - local tmp_target="/var/cache/${APP_NAME}" - else - local tmp_target="$(mktemp -d -t revdep-rebuild.XXXXXXXXXX)" - fi - - # From here on all work is done inside the temporary directory - verify_tmpdir "$tmp_target" "$uid" - WORKING_DIR="$tmp_target" - - if [[ $SEARCH_BROKEN ]]; then - SONAME_SEARCH="$SONAME" - HEAD_TEXT="broken by a package update" - OK_TEXT="Dynamic linking on your system is consistent" - WORKING_TEXT="consistency" - else - # first case is needed to test against /path/to/foo.so - if [[ $SONAME = /* ]]; then - # Set to "$SONAME" - SONAME_SEARCH=" $SONAME " - # Escape the "/" characters - SONAME_SEARCH="${SONAME_SEARCH//\//\\/}" - else - # Set to "$SONAME" - SONAME_SEARCH=$'\t'"$SONAME " - fi - HEAD_TEXT="using $SONAME" - OK_TEXT="There are no dynamic links to $SONAME" - unset WORKING_TEXT - fi - - # If any of our temporary files are older than 1 day, remove them all - if [[ ! $KEEP_TEMP ]]; then - while read; do - RM_OLD_TEMPFILES=1 - break - done < <(find -L . -maxdepth 1 -type f -name '*.rr' -mmin +1440 -print 2>/dev/null) - fi - - # Compare old and new environments - # Don't use our previous files if environment doesn't match - new_env=$( - # We do not care if these emerge options change - EMERGE_OPTIONS=(${EMERGE_OPTIONS[@]//--pretend/}) - EMERGE_OPTIONS=(${EMERGE_OPTIONS[@]//--fetchonly/}) - EMERGE_OPTIONS=(${EMERGE_OPTIONS[@]//--verbose/}) - cat <<- EOF - SEARCH_DIRS="$SEARCH_DIRS" - SEARCH_DIRS_MASK="$SEARCH_DIRS_MASK" - LD_LIBRARY_MASK="$LD_LIBRARY_MASK" - PORTAGE_ROOT="$PORTAGE_ROOT" - EMERGE_OPTIONS="${EMERGE_OPTIONS[@]}" - ORDER_PKGS="$ORDER_PKGS" - FULL_LD_PATH="$FULL_LD_PATH" - EOF - ) - if [[ -r "$ENV_FILE" && -s "$ENV_FILE" ]]; then - old_env=$(<"$ENV_FILE") - if [[ $old_env != $new_env ]]; then - ewarn 'Environment mismatch from previous run, deleting temporary files...' - RM_OLD_TEMPFILES=1 - fi - else - # No env file found, silently delete any other tempfiles that may exist - RM_OLD_TEMPFILES=1 - fi - - # If we should remove old tempfiles, do so - if [[ $RM_OLD_TEMPFILES ]]; then - rm -f "${FILES[@]}" - else - for file in "${FILES[@]}"; do - if [ -e "$file" ]; then - chown ${uid}:portage "$file" - chmod 700 "$file" - fi - done - fi - - # Save the environment in a file for next time - echo "$new_env" > "$ENV_FILE" - - [[ $VERBOSE ]] && echo $'\n'"$APP_NAME environment:"$'\n'"$new_env" - - echo - einfo "Checking reverse dependencies" - einfo "Packages containing binaries and libraries $HEAD_TEXT" - einfo "will be emerged." -} - -get_files() { - einfo "Collecting system binaries and libraries" - if [[ -r "$FILES_FILE" && -s "$FILES_FILE" ]]; then - einfo "Found existing $FILES_FILE" - else - # Be safe and remove any extraneous temporary files - # Don't remove 0_env.rr - The first file in the array - rm -f "${FILES[@]:1}" - - clean_trap "$FILES_FILE" - - if [[ $SEARCH_DIRS_MASK ]]; then - findMask=($SEARCH_DIRS_MASK) - findMask="${findMask[@]/#/-o -path }" - findMask="( ${findMask#-o } ) -prune -o" - fi - # TODO: Check this - find ${SEARCH_DIRS[@]} $findMask -type f \( -executable -o \ - -name '*.so' -o -name '*.so.*' -o -name '*.la' \) -print 2> /dev/null | - sort -u > "$FILES_FILE" || - die $? "find failed to list binary files (This is a bug.)" - einfo "Generated new $FILES_FILE" - fi -} -get_ldpath() { - local COMPLETE_LD_LIBRARY_PATH - [[ $SEARCH_BROKEN && $FULL_LD_PATH ]] || return - einfo 'Collecting complete LD_LIBRARY_PATH' - if [[ -r "$LDPATH_FILE" && -s "$LDPATH_FILE" ]]; then - einfo "Found existing $LDPATH_FILE." - else - clean_trap "$LDPATH_FILE" - # Ensure that the "trusted" lib directories are at the start of the path - COMPLETE_LD_LIBRARY_PATH=( - /lib* - /usr/lib* - $(sed '/^#/d;s/#.*$//' < /etc/ld.so.conf) - $(sed 's:/[^/]*$::' < "$FILES_FILE" | sort -ru) - ) - IFS=':' - COMPLETE_LD_LIBRARY_PATH="${COMPLETE_LD_LIBRARY_PATH[*]}" - IFS="$OIFS" - echo "$COMPLETE_LD_LIBRARY_PATH" > "$LDPATH_FILE" - einfo "Generated new $LDPATH_FILE" - fi -} -main_checks() { - local target_file - local -a files - local i=0 - local ldd_output - local ldd_status - local numFiles - local COMPLETE_LD_LIBRARY_PATH - if [[ $SEARCH_BROKEN && $FULL_LD_PATH ]]; then - [[ -r "$LDPATH_FILE" && -s "$LDPATH_FILE" ]] || - die 1 "Unable to find $LDPATH_FILE" - COMPLETE_LD_LIBRARY_PATH=$(<"$LDPATH_FILE") - fi - einfo "Checking dynamic linking $WORKING_TEXT" - if [[ -r "$BROKEN_FILE" && -s "$BROKEN_FILE" ]]; then - einfo "Found existing $BROKEN_FILE." - else - clean_trap "$BROKEN_FILE" "$ERRORS_FILE" - files=($(<"$FILES_FILE")) - numFiles="${#files[@]}" - for target_file in "${files[@]}"; do - if [[ $target_file != *.la ]]; then - # Note: double checking seems to be faster than single with complete path - # (special add ons are rare). - ldd_output=$(ldd "$target_file" 2>> "$ERRORS_FILE" | sort -u) - ldd_status=$? # TODO: Check this for problems with sort - # HACK: if LD_LIBRARY_MASK is null or undefined grep -vF doesn't work - if grep -vF "${LD_LIBRARY_MASK:=$'\a'}" <<< "$ldd_output" | - grep -q "$SONAME_SEARCH"; then - if [[ $SEARCH_BROKEN && $FULL_LD_PATH ]]; then - if LD_LIBRARY_PATH="$COMPLETE_LD_LIBRARY_PATH" ldd "$target_file" 2>/dev/null | - grep -vF "$LD_LIBRARY_MASK" | grep -q "$SONAME_SEARCH"; then - # FIXME: I hate duplicating code - # Only build missing direct dependencies - MISSING_LIBS=$( - expr='s/[[:space:]]*\([^[:space:]]*\) => not found/\1/p' - sed -n "$expr" <<< "$ldd_output" - ) - REQUIRED_LIBS=$( - expr='s/^[[:space:]]*NEEDED[[:space:]]*\([^[:space:]]*\).*/\1/p'; - objdump -x "$target_file" | grep NEEDED | sed "$expr" | sort -u - ) - MISSING_LIBS=$(grep -F "$REQUIRED_LIBS" <<< "$MISSING_LIBS") - if [[ $MISSING_LIBS ]]; then - echo "obj $target_file" >> "$BROKEN_FILE" - echo_v " broken $target_file (requires $MISSING_LIBS)" - fi - fi - else - # FIXME: I hate duplicating code - # Only rebuild for direct dependencies - MISSING_LIBS=$( - expr="/$SONAME_SEARCH/s/^[[:space:]]*\([^[:space:]]*\).*$/\1/p" - sort -u <<< "$ldd_output" | sed -n "$expr" - ) - REQUIRED_LIBS=$( - expr='s/^[[:space:]]*NEEDED[[:space:]]*\([^[:space:]]*\).*/\1/p'; - objdump -x "$target_file" | grep NEEDED | sed "$expr" | sort -u - ) - MISSING_LIBS=$(grep -F "$REQUIRED_LIBS" <<< "$MISSING_LIBS") - if [[ $MISSING_LIBS ]]; then - echo "obj $target_file" >> "$BROKEN_FILE" - if [[ $SEARCH_BROKEN ]]; then - echo_v " broken $target_file (requires $MISSING_LIBS)" - else - echo_v " found $target_file" - fi - fi - fi - fi - elif [[ $SEARCH_BROKEN ]]; then - # Look for broken .la files - for depend in $( - awk -F"[=']" '/^dependency_libs/{ - gsub("^-[^[:space:]]*", "", $3); - gsub("[[:space:]]-[^[:space:]]*", "", $3); - print $3 - }' "$target_file" - ); do - if [[ $depend = /* && ! -e $depend ]]; then - echo "obj $target_file" >> "$BROKEN_FILE" - echo_v " broken $target_file (requires $depend)" - fi - done - fi - [[ $VERBOSE ]] && - progress $((++i)) $numFiles $target_file || - progress $((++i)) $numFiles - done - if [[ $SEARCH_BROKEN ]]; then - # Look for missing version - while read target_file; do - echo "obj $target_file" >> "$BROKEN_FILE" - echo_v " broken $target_file (no version information available)" - done < <( - # Regexify LD_LIBRARY_MASK. Exclude it from the search. - LD_LIBRARY_MASK="${LD_LIBRARY_MASK//$'\n'/|}" - awk -v ldmask="(${LD_LIBRARY_MASK//./\\\.})" ' - /no version information available/ && $0 !~ ldmask { - gsub(/[()]/, "", $NF) - if (seen[$NF]++) next - print $NF - }' "$ERRORS_FILE" - ) - fi - [[ -r "$BROKEN_FILE" && -s "$BROKEN_FILE" ]] || clean_exit - sort -u "$BROKEN_FILE" -o "$BROKEN_FILE" - einfo "Generated new $BROKEN_FILE" - fi -} -get_packages() { - local target_file - local EXACT_PKG - local PKG - local obj - einfo 'Assigning files to packages' - if [[ -r "$RAW_FILE" && -s "$RAW_FILE" ]]; then - einfo "Found existing $RAW_FILE" - else - clean_trap "$RAW_FILE" "$OWNERS_FILE" - while read obj target_file; do - EXACT_PKG=$(get_file_owner $target_file) - if [[ $EXACT_PKG ]]; then - # Strip version information - PKG="${EXACT_PKG%%-r[[:digit:]]*}" - PKG="${PKG%-*}" - echo "$EXACT_PKG" >> "$RAW_FILE" - echo "$target_file -> $EXACT_PKG" >> "$OWNERS_FILE" - echo_v " $target_file -> $PKG" - else - ewarn " !!! $target_file not owned by any package is broken !!!" - echo "$target_file -> (none)" >> "$OWNERS_FILE" - echo_v " $target_file -> (none)" - fi - done < "$BROKEN_FILE" - einfo "Generated new $RAW_FILE and $OWNERS_FILE" - fi - # if we find '(none)' on every line, exit out - if ! grep -qvF '(none)' "$OWNERS_FILE"; then - ewarn "Found some broken files, but none of them were associated with known packages" - ewarn "Unable to proceed with automatic repairs." - ewarn "The broken files are listed in $OWNERS_FILE" - if [[ $VERBOSE ]]; then - ewarn "The broken files are:" - while read filename junk; do - ewarn " $filename" - done < "$OWNERS_FILE" - fi - exit 0 # FIXME: Should we exit 1 here? - fi -} -clean_packages() { - einfo 'Cleaning list of packages to rebuild' - if [[ -r "$PKGS_FILE" && -s "$PKGS_FILE" ]]; then - einfo "Found existing $PKGS_FILE" - else - sort -u "$RAW_FILE" > "$PKGS_FILE" - einfo "Generated new $PKGS_FILE" - fi -} -assign_packages_to_ebuilds() { - local EXACT_PKG - local PKG - local SLOT - einfo 'Assigning packages to ebuilds' - if [[ -r "$EBUILDS_FILE" && -s "$EBUILDS_FILE" ]]; then - einfo "Found existing $EBUILDS_FILE" - elif [[ -r "$PKGS_FILE" && -s "$PKGS_FILE" ]]; then - clean_trap "$EBUILDS_FILE" - while read EXACT_PKG; do - # Get the slot - PKG="${EXACT_PKG%%-r[[:digit:]]*}" - PKG="${PKG%-*}" - SLOT=$( "$EBUILDS_FILE" - einfo "Generated new $EBUILDS_FILE" - else - einfo 'Nothing to rebuild.' - die 1 '(The program should have already quit, so this is a minor bug.)' - fi -} -get_exact_ebuilds() { - einfo 'Assigning files to ebuilds' - if [[ -r $EBUILDS_FILE && -s $EBUILDS_FILE ]]; then - einfo "Found existing $EBUILDS_FILE" - elif [[ -r $BROKEN_FILE && -s $BROKEN_FILE ]]; then - rebuildList=" $(<"$BROKEN_FILE") " - rebuildList=(${rebuildList//[[:space:]]obj[[:space:]]/ }) - get_file_owner "${rebuildList[@]}" | sed 's/^/=/' > "$EBUILDS_FILE" - einfo "Generated new $EBUILDS_FILE" - else - einfo 'Nothing to rebuild.' - die 1 '(The program should have already quit, so this is a minor bug.)' - fi -} -list_skipped_packages() { - ewarn - ewarn 'Portage could not find any version of the following packages it could build:' - ewarn "${SKIP_LIST[@]}" - ewarn - ewarn '(Perhaps they are masked, blocked, or removed from portage.)' - ewarn 'Try to emerge them manually.' - ewarn -} -get_build_order() { - local -r OLD_EMERGE_DEFAULT_OPTS="$EMERGE_DEFAULT_OPTS" - local RAW_REBUILD_LIST - local REBUILD_GREP - local i - if [[ ! $ORDER_PKGS ]]; then - einfo 'Skipping package ordering' - return - fi - einfo 'Evaluating package order' - if [[ -r "$ORDER_FILE" && -s "$ORDER_FILE" ]]; then - einfo "Found existing $ORDER_FILE" - else - clean_trap "$ORDER_FILE" - RAW_REBUILD_LIST=$(<"$EBUILDS_FILE") - if [[ $RAW_REBUILD_LIST ]]; then - export EMERGE_DEFAULT_OPTS="--nospinner --pretend --oneshot --quiet" - RAW_REBUILD_LIST=($RAW_REBUILD_LIST) # convert into array - # If PACKAGE_NAMES is defined we're using slots, not versions - if [[ $PACKAGE_NAMES ]]; then - # Eliminate atoms that can't be built - for i in "${!RAW_REBUILD_LIST[@]}"; do - if [[ "${RAW_REBUILD_LIST[i]}" = *[A-Za-z]* ]]; then - portageq best_visible "$PORTAGE_ROOT" "${RAW_REBUILD_LIST[i]}" >/dev/null && continue - SKIP_LIST+=("${RAW_REBUILD_LIST[i]}") - fi - unset RAW_REBUILD_LIST[i] - done - # If RAW_REBUILD_LIST is empty, then we have nothing to build. - if (( ${#RAW_REBUILD_LIST[@]} == 0 )); then - if (( ${#SKIP_LIST[@]} == 0 )); then - ewarn "The list of packages to skip is empty, but there are no" - ewarn "packages listed to rebuild either. (This is a bug.)" - else - list_skipped_packages - fi - die 1 'Warning: Portage cannot rebuild any of the necessary packages.' - fi - fi - RAW_REBUILD_LIST="${RAW_REBUILD_LIST[@]}" - REBUILD_GREP=$(emerge --nodeps $RAW_REBUILD_LIST | sed 's/\[[^]]*\]//g') - if (( ${PIPESTATUS[0]} == 0 )); then - emerge --deep $RAW_REBUILD_LIST | - sed 's/\[[^]]*\]//g' | - grep -F "$REBUILD_GREP" > "$ORDER_FILE" - fi - - # Here we use the PIPESTATUS from the second emerge, the --deep one. - if (( ${PIPESTATUS[0]} != 0 )); then - eerror - eerror 'Warning: Failed to resolve package order.' - eerror 'Will merge in arbitrary order' - eerror - cat <<- EOF - Possible reasons: - - An ebuild is no longer in the portage tree. - - An ebuild is masked, use /etc/portage/packages.keyword - and/or /etc/portage/package.unmask to unmask it - EOF - countdown 5 - rm -f "$ORDER_FILE" - fi - export EMERGE_DEFAULT_OPTS="$OLD_EMERGE_DEFAULT_OPTS" - else - einfo 'Nothing to rebuild.' - die 1 '(The program should have already quit, so this is a minor bug.)' - fi - fi - [[ -r "$ORDER_FILE" && -s "$ORDER_FILE" ]] && einfo "Generated new $ORDER_FILE" -} - -show_unowned_files() { - if grep -qF '(none)' "$OWNERS_FILE"; then - ewarn "Found some broken files that weren't associated with known packages" - ewarn "The broken files are:" - while read filename junk; do - [[ $junk = *none* ]] && ewarn " $filename" - done < "$OWNERS_FILE" | awk '!s[$0]++' # (omit dupes) - fi -} -## -# Setup portage and the search paths -setup_portage() { - local PORTAGE_NICENESS=$(portageq envvar PORTAGE_NICENESS) - PORTAGE_ROOT=$(portageq envvar ROOT) - - # Obey PORTAGE_NICENESS - if [[ $PORTAGE_NICENESS ]]; then - renice $PORTAGE_NICENESS $$ > /dev/null - # Since we have already set our nice value for our processes, - # reset PORTAGE_NICENESS to zero to avoid having emerge renice again. - export PORTAGE_NICENESS="0" - fi - - PORTAGE_ROOT="${PORTAGE_ROOT:-/}" -} - -## -# Setup the paths to search (and filter the ones to avoid) -setup_search_paths_and_masks() { - local configfile sdir mdir skip_me filter_SEARCH_DIRS - - einfo "Configuring search environment for $APP_NAME" - - # Update the incremental variables using /etc/profile.env, /etc/ld.so.conf, - # portage, and the environment - - # Read the incremental variables from environment and portage - # Until such time as portage supports these variables as incrementals - # The value will be what is in /etc/make.conf - SEARCH_DIRS+=" "$(unset SEARCH_DIRS; portageq envvar SEARCH_DIRS) - SEARCH_DIRS_MASK+=" "$(unset SEARCH_DIRS_MASK; portageq envvar SEARCH_DIRS_MASK) - LD_LIBRARY_MASK+=" "$(unset LD_LIBRARY_MASK; portageq envvar LD_LIBRARY_MASK) - - # Add the defaults - if [[ -d /etc/revdep-rebuild ]]; then - for configfile in /etc/revdep-rebuild/*; do - SEARCH_DIRS+=" "$(. $configfile; echo $SEARCH_DIRS) - SEARCH_DIRS_MASK+=" "$(. $configfile; echo $SEARCH_DIRS_MASK) - LD_LIBRARY_MASK+=" "$(. $configfile; echo $LD_LIBRARY_MASK) - done - else - SEARCH_DIRS+=" /bin /sbin /usr/bin /usr/sbin /lib* /usr/lib*" - SEARCH_DIRS_MASK+=" /opt/OpenOffice /usr/lib/openoffice" - LD_LIBRARY_MASK+=" libodbcinst.so libodbc.so libjava.so libjvm.so" - fi - - # Get the ROOTPATH and PATH from /etc/profile.env - if [[ -r "/etc/profile.env" && -s "/etc/profile.env" ]]; then - SEARCH_DIRS+=" "$(. /etc/profile.env; /usr/bin/tr ':' ' ' <<< "$ROOTPATH $PATH") - fi - - # Get the directories from /etc/ld.so.conf - if [[ -r /etc/ld.so.conf && -s /etc/ld.so.conf ]]; then - SEARCH_DIRS+=" "$(sed '/^#/d;s/#.*$//' /etc/ld.so.conf) - fi - - # Set the final variables - SEARCH_DIRS=$(clean_var <<< "$SEARCH_DIRS") - SEARCH_DIRS_MASK=$(clean_var <<< "$SEARCH_DIRS_MASK") - LD_LIBRARY_MASK=$(clean_var <<< "$LD_LIBRARY_MASK") - # Filter masked paths from SEARCH_DIRS - for sdir in ${SEARCH_DIRS} ; do - skip_me= - for mdir in ${SEARCH_DIRS_MASK}; do - [[ ${sdir} == ${mdir}/* ]] && skip_me=1 && break - done - [[ -n ${skip_me} ]] || filter_SEARCH_DIRS+=" ${sdir}" - done - SEARCH_DIRS=$(clean_var <<< "${filter_SEARCH_DIRS}") - [[ $SEARCH_DIRS ]] || die 1 "No search defined -- this is a bug." -} -## -# Rebuild packages owning broken binaries -rebuild() { - if [[ -r $LIST.5_order && -s $LIST.5_order ]]; then - REBUILD_LIST=( $(<"$LIST.5_order") ) - REBUILD_LIST="${REBUILD_LIST[@]/#/=}" - else - REBUILD_LIST=$(sort -u "$EBUILDS_FILE") - fi - - trap - SIGHUP SIGINT SIGQUIT SIGABRT SIGTERM - - einfo 'All prepared. Starting rebuild' - echo "emerge --oneshot ${EMERGE_OPTIONS[@]} $REBUILD_LIST" - - is_real_merge && countdown 10 - - # Link file descriptor #6 with stdin so --ask will work - exec 6<&0 - - # Run in background to correctly handle Ctrl-C - { - EMERGE_DEFAULT_OPTS="--oneshot ${EMERGE_OPTIONS[@]}" emerge $REBUILD_LIST <&6 - echo $? > "$STATUS_FILE" - } & - wait - - # Now restore stdin from fd #6, where it had been saved, and close fd #6 ( 6<&- ) to free it for other processes to use. - exec 0<&6 6<&- -} -## -# Finish up -cleanup() { - if (( $(<"$STATUS_FILE") != 0 )); then - ewarn - ewarn "$APP_NAME failed to emerge all packages." - ewarn 'you have the following choices:' - einfo "- If emerge failed during the build, fix the problems and re-run $APP_NAME." - einfo '- Use /etc/portage/package.keywords to unmask a newer version of the package.' - einfo " (and remove $ORDER_FILE to be evaluated again)" - einfo '- Modify the above emerge command and run it manually.' - einfo '- Compile or unmerge unsatisfied packages manually,' - einfo ' remove temporary files, and try again.' - einfo ' (you can edit package/ebuild list first)' - einfo - einfo 'To remove temporary files, please run:' - einfo "rm ${WORKING_DIR}/*.rr" - show_unowned_files - exit $EMERGE_STATUS - elif is_real_merge; then - trap_cmd() { - eerror "terminated. Please remove the temporary files manually:" - eerror "rm ${WORKING_DIR}/*.rr" - exit 1 - } - [[ "${SKIP_LIST[@]}" != "" ]] && list_skipped_packages - trap trap_cmd SIGHUP SIGINT SIGQUIT SIGABRT SIGTERM - einfo 'Build finished correctly. Removing temporary files...' - einfo - einfo 'You can re-run revdep-rebuild to verify that all libraries and binaries' - einfo 'are fixed. If some inconsistency remains, it can be orphaned file, deep' - einfo 'dependency, binary package or specially evaluated library.' - if [[ -r "$OWNERS_FILE" && -s "$OWNERS_FILE" ]]; then - show_unowned_files - fi - [[ $KEEP_TEMP ]] || rm "${FILES[@]}" - else - einfo 'Now you can remove -p (or --pretend) from arguments and re-run revdep-rebuild.' - fi -} - -main "$@" diff --git a/trunk/src/revdep-rebuild/revdep-rebuild-old b/trunk/src/revdep-rebuild/revdep-rebuild-old deleted file mode 100755 index 52d6d19..0000000 --- a/trunk/src/revdep-rebuild/revdep-rebuild-old +++ /dev/null @@ -1,720 +0,0 @@ -#!/bin/bash -# Copyright 1999-2007 Gentoo Foundation -# $Header$ - -# revdep-rebuild: Reverse dependency rebuilder. -# Original Author: Stanislav Brabec -# Current Maintainer: Paul Varner - -# Known problems: -# -# In exact ebuild mode revdep-rebuild can fail to properly order packages, -# which are not up to date. -# http://bugs.gentoo.org/show_bug.cgi?id=23018 -# -# Rebuilding using --package-names mode should be default, but emerge has no -# feature to update to latest version of defined SLOT. -# http://bugs.gentoo.org/show_bug.cgi?id=4698 - -# Customizable variables: -# -# LD_LIBRARY_MASK - Mask of specially evaluated libraries -# SEARCH_DIRS - List of directories to search for executables and libraries -# SEARCH_DIRS_MASK - List of directories to not search -# -# These variables can be prepended to either by setting the variable in -# your environment prior to execution, or by placing an entry in -# /etc/make.conf. -# -# An entry of "-*" means to clear the variable from that point forward. -# Example: env SEARCH_DIRS="/usr/bin -*" revdep-rebuild will set SEARCH_DIRS -# to contain only /usr/bin - -if [ "$1" = "-h" -o "$1" = "--help" ] -then - echo "Usage: $0 [OPTIONS] [--] [EMERGE_OPTIONS]" - echo - echo "Broken reverse dependency rebuilder." - echo - echo " -X, --package-names Emerge based on package names, not exact versions" - echo " --library NAME Emerge existing packages that use the library with NAME" - echo " --library=NAME NAME can be a full path to the library or a basic" - echo " regular expression (man grep)" - echo " -np, --no-ld-path Do not set LD_LIBRARY_PATH" - echo " -nc, --nocolor Turn off colored output" - echo " -i, --ignore Ignore temporary files from previous runs" - echo " -q, --quiet Be less verbose (also passed to emerge command)" - echo " -vv, --extra-verbose Be extra verbose" - echo - echo "Calls emerge, all other options are used for it (e. g. -p, --pretend)." - echo - echo "Report bugs to " - exit 0 -fi - -echo "Configuring search environment for revdep-rebuild" - -# Obey PORTAGE_NICENESS -PORTAGE_NICENESS=$(portageq envvar PORTAGE_NICENESS) -if [ ! -z "$PORTAGE_NICENESS" ] -then - renice $PORTAGE_NICENESS $$ > /dev/null - # Since we have already set our nice value for our processes, - # reset PORTAGE_NICENESS to zero to avoid having emerge renice again. - export PORTAGE_NICENESS="0" -fi - -PORTAGE_ROOT=$(portageq envvar ROOT) -[ -z "$PORTAGE_ROOT" ] && PORTAGE_ROOT="/" - -# Update the incremental variables using /etc/profile.env, /etc/ld.so.conf, -# portage, and the environment - -# Read the incremental variables from environment and portage -# Until such time as portage supports these variables as incrementals -# The value will be what is in /etc/make.conf -PRELIMINARY_SEARCH_DIRS="$SEARCH_DIRS $(unset SEARCH_DIRS; portageq envvar SEARCH_DIRS)" -PRELIMINARY_SEARCH_DIRS_MASK="$SEARCH_DIRS_MASK $(unset SEARCH_DIRS_MASK; portageq envvar SEARCH_DIRS_MASK)" -PRELIMINARY_LD_LIBRARY_MASK="$LD_LIBRARY_MASK $(unset LD_LIBRARY_MASK; portageq envvar LD_LIBRARY_MASK)" - -# Add the defaults -if [ -d /etc/revdep-rebuild ] -then - for file in $(ls /etc/revdep-rebuild) - do - PRELIMINARY_SEARCH_DIRS="$PRELIMINARY_SEARCH_DIRS $(. /etc/revdep-rebuild/${file}; echo $SEARCH_DIRS)" - PRELIMINARY_SEARCH_DIRS_MASK="$PRELIMINARY_SEARCH_DIRS_MASK $(. /etc/revdep-rebuild/${file}; echo $SEARCH_DIRS_MASK)" - PRELIMINARY_LD_LIBRARY_MASK="$PRELIMINARY_LD_LIBRARY_MASK $(. /etc/revdep-rebuild/${file}; echo $LD_LIBRARY_MASK)" - done -else - PRELIMINARY_SEARCH_DIRS="$PRELIMINARY_SEARCH_DIRS /bin /sbin /usr/bin /usr/sbin /lib* /usr/lib*" - PRELIMINARY_SEARCH_DIRS_MASK="$PRELIMINARY_SEARCH_DIRS_MASK /opt/OpenOffice /usr/lib/openoffice" - PRELIMINARY_LD_LIBRARY_MASK="$PRELIMINARY_LD_LIBRARY_MASK libodbcinst.so libodbc.so libjava.so libjvm.so" -fi - -# Get the ROOTPATH and PATH from /etc/profile.env -if [ -e "/etc/profile.env" ] -then - PRELIMINARY_SEARCH_DIRS="$PRELIMINARY_SEARCH_DIRS $((. /etc/profile.env; echo ${ROOTPATH}:${PATH}) | tr ':' ' ')" -fi - -# Get the directories from /etc/ld.so.conf -if [ -e /etc/ld.so.conf ] -then - PRELIMINARY_SEARCH_DIRS="$PRELIMINARY_SEARCH_DIRS $(grep -v "^#" /etc/ld.so.conf | tr '\n' ' ')" -fi - -# Set the final variables -# Note: Using $(echo $variable) removes extraneous spaces from variable assignment -unset SEARCH_DIRS -for i in $(echo $PRELIMINARY_SEARCH_DIRS) -do - [ "$i" = "-*" ] && break - # Append a / at the end so that links and directories are treated the same by find - # Remove any existing trailing slashes to prevent double-slashes - SEARCH_DIRS="$(echo $SEARCH_DIRS ${i/%\//}/)" -done -# Remove any double-slashes from the path -SEARCH_DIRS="$(echo $SEARCH_DIRS | sed 's:/\+:/:g')" - -unset SEARCH_DIRS_MASK -for i in $(echo $PRELIMINARY_SEARCH_DIRS_MASK) -do - [ "$i" = "-*" ] && break - SEARCH_DIRS_MASK="$(echo $SEARCH_DIRS_MASK $i)" -done - -unset LD_LIBRARY_MASK -for i in $(echo $PRELIMINARY_LD_LIBRARY_MASK) -do - [ "$i" = "-*" ] && break - LD_LIBRARY_MASK="$(echo $LD_LIBRARY_MASK $i)" -done - -# Use the color preference from portage -NOCOLOR=$(portageq envvar NOCOLOR) - -# Base of temporary files names. -touch ${HOME}/.revdep-rebuild_0.test 2>/dev/null -if [ $? -eq 0 ] -then - LIST="${HOME}/.revdep-rebuild" - rm ~/.revdep-rebuild_0.test -else - # Try to use /var/tmp since $HOME is not available - touch /var/tmp/.revdep-rebuild_0.test 2>/dev/null - if [ $? -eq 0 ] - then - LIST="/var/tmp/.revdep-rebuild" - rm /var/tmp/.revdep-rebuild_0.test - else - echo - echo "!!! Unable to write temporary files to either $HOME or /var/tmp !!!" - echo - exit 1 - fi -fi - -shopt -s nullglob -shopt -s expand_aliases -unalias -a - -# Color Definitions -NO="\x1b[0m" -BR="\x1b[0;01m" -CY="\x1b[36;01m" -GR="\x1b[32;01m" -RD="\x1b[31;01m" -YL="\x1b[33;01m" -BL="\x1b[34;01m" - -# Check if portage-utils are installed -portageq has_version $PORTAGE_ROOT portage-utils -if [ "$?" -eq 0 ] -then - PORTAGE_UTILS=true -else - PORTAGE_UTILS=false -fi - -alias echo_v=echo - -PACKAGE_NAMES=false -SONAME="not found" -SONAME_GREP=grep -SEARCH_BROKEN=true -EXTRA_VERBOSE=false -KEEP_TEMP=false -FULL_LD_PATH=true - -EMERGE_OPTIONS="" -PRELIMINARY_CALLED_OPTIONS="" -while [ ! -z "$1" ] ; do - case "$1" in - -X | --package-names ) - PACKAGE_NAMES=true - PRELIMINARY_CALLED_OPTIONS="${PRELIMINARY_CALLED_OPTIONS} --package_names" - shift - ;; - -q | --quiet ) - alias echo_v=: - EMERGE_OPTIONS="${EMERGE_OPTIONS} $1" - shift - ;; - --library=* | --soname=* | --soname-regexp=* ) - SONAME="${1#*=}" - SEARCH_BROKEN=false - PRELIMINARY_CALLED_OPTIONS="${PRELIMINARY_CALLED_OPTIONS} --library=${SONAME}" - shift - ;; - --library | --soname | --soname-regexp ) - SONAME="$2" - SEARCH_BROKEN=false - PRELIMINARY_CALLED_OPTIONS="${PRELIMINARY_CALLED_OPTIONS} --library=${SONAME}" - shift 2 - ;; - -nc | --no-color | --nocolor ) - NOCOLOR=true - shift - ;; - -np | --no-ld-path ) - FULL_LD_PATH=false - PRELIMINARY_CALLED_OPTIONS="${PRELIMINARY_CALLED_OPTIONS} --no-ld-path" - shift - ;; - -i | --ignore ) - rm -f ${LIST}* - shift - ;; - --keep-temp ) - KEEPTEMP=true - shift - ;; - -vv | --extra-verbose ) - EXTRA_VERBOSE=true - shift - ;; - -- ) - shift - ;; - * ) - EMERGE_OPTIONS="${EMERGE_OPTIONS} $1" - shift - ;; - esac -done - -EMERGE_OPTIONS=$(echo $EMERGE_OPTIONS | sed 's/^ //') - -if [ -z "$PRELIMINARY_CALLED_OPTIONS" ] -then - CALLED_OPTIONS="" -else - for i in $(echo $PRELIMINARY_CALLED_OPTIONS | tr ' ' '\n'| sort) - do - CALLED_OPTIONS="$(echo $CALLED_OPTIONS $i)" - done -fi - -if [ "$NOCOLOR" = "yes" -o "$NOCOLOR" = "true" ] -then - NOCOLOR=true -else - NOCOLOR=false -fi - -# Make the NOCOLOR variable visible to emerge -export NOCOLOR - -if $NOCOLOR -then - NO="" - BR="" - CY="" - GR="" - RD="" - YL="" - BL="" -fi - -function set_trap () { - trap "rm_temp $1" SIGHUP SIGINT SIGQUIT SIGABRT SIGTERM -} - -function rm_temp () { - echo " terminated." - echo "Removing incomplete $1." - rm $1 - echo - exit 1 -} - -if $SEARCH_BROKEN ; then - SONAME_SEARCH="$SONAME" - LLIST=$LIST - HEAD_TEXT="broken by a package update" - OK_TEXT="Dynamic linking on your system is consistent" - WORKING_TEXT=" consistency" -else - # first case is needed to test against /path/to/foo.so - if [ ${SONAME:0:1} == '/' ] ; then - # Set to "$SONAME" - SONAME_SEARCH=" $SONAME " - else - # Set to "$SONAME" - SONAME_SEARCH=" $SONAME " - fi - LLIST=${LIST}_$(echo "$SONAME_SEARCH$SONAME" | md5sum | head -c 8) - HEAD_TEXT="using $SONAME" - OK_TEXT="There are no dynamic links to $SONAME" - WORKING_TEXT="" -fi - -# If any of our temporary files are older than 1 day, remove them all -[ "$(find "${LIST%/*}/." ! -name . -prune -name "${LIST##*/}*" -type f -mmin +1440)" != "" ] && rm -f ${LIST}* - -# Don't use our previous files if environment doesn't match -if [ -f $LIST.0_env ] -then - PREVIOUS_SEARCH_DIRS=$(. ${LIST}.0_env; echo "$SEARCH_DIRS") - PREVIOUS_SEARCH_DIRS_MASK=$(. ${LIST}.0_env; echo "$SEARCH_DIRS_MASK") - PREVIOUS_LD_LIBRARY_MASK=$(. ${LIST}.0_env; echo "$LD_LIBRARY_MASK") - PREVIOUS_PORTAGE_ROOT=$(. ${LIST}.0_env; echo "$PORTAGE_ROOT") - PREVIOUS_OPTIONS=$(. ${LIST}.0_env; echo "$CALLED_OPTIONS") - if [ "$PREVIOUS_SEARCH_DIRS" != "$SEARCH_DIRS" ] || \ - [ "$PREVIOUS_SEARCH_DIRS_MASK" != "$SEARCH_DIRS_MASK" ] || \ - [ "$PREVIOUS_LD_LIBRARY_MASK" != "$LD_LIBRARY_MASK" ] || \ - [ "$PREVIOUS_PORTAGE_ROOT" != "$PORTAGE_ROOT" ] || \ - [ "$PREVIOUS_OPTIONS" != "$CALLED_OPTIONS" ] - then - echo - echo "Environment mismatch from previous run, deleting temporary files..." - rm -f ${LIST}* - fi -fi - -# Clean up no longer needed environment variables -unset PREVIOUS_SEARCH_DIRS PREVIOUS_SEARCH_DIRS_MASK PREVIOUS_LD_LIBRARY_MASK PREVIOUS_PORTAGE_ROOT PREVIOUS_OPTIONS -unset PRELIMINARY_SEARCH_DIRS PRELIMINARY_SEARCH_DIRS_MASK PRELIMINARY_LD_LIBRARY_MASK PRELIMINARY_CALLED_OPTIONS - -# Log our environment -echo "SEARCH_DIRS=\"$SEARCH_DIRS\"" > $LIST.0_env -echo "SEARCH_DIRS_MASK=\"$SEARCH_DIRS_MASK\"" >> $LIST.0_env -echo "LD_LIBRARY_MASK=\"$LD_LIBRARY_MASK\"" >> $LIST.0_env -echo "PORTAGE_ROOT=\"$PORTAGE_ROOT\"" >> $LIST.0_env -echo "CALLED_OPTIONS=\"$CALLED_OPTIONS\"" >> $LIST.0_env -echo "EMERGE_OPTIONS=\"$EMERGE_OPTIONS\"" >> $LIST.0_env - -if $EXTRA_VERBOSE -then - echo - echo "revdep-rebuild environment:" - cat $LIST.0_env -fi - -echo -echo "Checking reverse dependencies..." -echo -echo "Packages containing binaries and libraries $HEAD_TEXT" -echo "will be emerged." - -echo -echo -n -e "${GR}Collecting system binaries and libraries...${NO}" - -if [ -f $LIST.1_files ] -then - echo " using existing $LIST.1_files." -else - # Be safe and remove any extraneous temporary files - rm -f ${LIST}.[1-9]_* - - set_trap "$LIST.1_*" - - # Hack for the different versions of find. - # Be extra paranoid and pipe results through sed to remove multiple slashes - find_results=$(find /usr/bin/revdep-rebuild -type f -perm /u+x 2>/dev/null) - if [ -z $find_results ] - then - find_results=$(find /usr/bin/revdep-rebuild -type f -perm +u+x 2>/dev/null) - if [ -z $find_results ] - then - echo -e "\n" - echo -e "${RD}Unable to determine how to use find to locate executable files${NO}" - echo -e "${RD}Open a bug at http://bugs.gentoo.org${NO}" - echo - exit 1 - else - # using -perm +u+x for find command - find $SEARCH_DIRS -type f \( -perm +u+x -o -name '*.so' -o -name '*.so.*' -o -name '*.la' \) 2>/dev/null | sort | uniq | sed 's:/\+:/:g' >$LIST.0_files - fi - else - # using -perm /u+x for find command - find $SEARCH_DIRS -type f \( -perm /u+x -o -name '*.so' -o -name '*.so.*' -o -name '*.la' \) 2>/dev/null | sort | uniq | sed 's:/\+:/:g' >$LIST.0_files - fi - - # Remove files that match SEARCH_DIR_MASK - for dir in $SEARCH_DIRS_MASK - do - grep -v "^$dir" $LIST.0_files > $LIST.1_files - mv $LIST.1_files $LIST.0_files - done - - mv $LIST.0_files $LIST.1_files - echo -e " done.\n ($LIST.1_files)" -fi - -if $SEARCH_BROKEN && $FULL_LD_PATH ; then - echo - echo -n -e "${GR}Collecting complete LD_LIBRARY_PATH...${NO}" - if [ -f $LIST.2_ldpath ] ; then - echo " using existing $LIST.2_ldpath." - else - set_trap "$LIST.2_ldpath" - # Ensure that the "trusted" lib directories are at the start of the path - ( - echo /lib* /usr/lib* | sed 's/ /:/g' - sed '/^#/d;s/#.*$//' $LIST.2_ldpath - echo -e " done.\n ($LIST.2_ldpath)" - fi - COMPLETE_LD_LIBRARY_PATH="$(cat $LIST.2_ldpath)" -fi - -echo -echo -n -e "${GR}Checking dynamic linking$WORKING_TEXT...${NO}" -if [ -f $LLIST.3_rebuild ] ; then - echo " using existing $LLIST.3_rebuild." -else - echo_v - set_trap "$LLIST.3_rebuild" - LD_MASK="\\( $(echo "$LD_LIBRARY_MASK" | sed 's/\./\\./g;s/ / \\| /g') \\)" - echo -n >$LLIST.3_rebuild - echo -n >$LLIST.3_ldd_errors - cat $LIST.1_files | egrep -v '*\.la$' | while read FILE ; do - # Note: double checking seems to be faster than single - # with complete path (special add ons are rare). - if ldd "$FILE" 2>>$LLIST.3_ldd_errors | grep -v "$LD_MASK" | $SONAME_GREP -q "$SONAME_SEARCH" ; then - if $SEARCH_BROKEN && $FULL_LD_PATH ; then - if LD_LIBRARY_PATH="$COMPLETE_LD_LIBRARY_PATH" ldd "$FILE" 2>/dev/null | grep -v "$LD_MASK" | $SONAME_GREP -q "$SONAME_SEARCH" ; then - # FIX: I hate duplicating code - # Only build missing direct dependencies - ALL_MISSING_LIBS=$(ldd "$FILE" 2>/dev/null | sort -u | sed -n 's/ \(.*\) => not found/\1/p' | tr '\n' ' ' | sed 's/ $//' ) - REQUIRED_LIBS=$(objdump -x $FILE | grep NEEDED | awk '{print $2}' | tr '\n' ' ' | sed 's/ $//') - MISSING_LIBS="" - for lib in $ALL_MISSING_LIBS - do - if echo $REQUIRED_LIBS | grep -q $lib - then - MISSING_LIBS="$MISSING_LIBS $lib" - fi - done - if [ "$MISSING_LIBS" != "" ] - then - echo "obj $FILE" >>$LLIST.3_rebuild - echo_v " broken $FILE (requires ${MISSING_LIBS})" - fi - fi - else - # FIX: I hate duplicating code - # Only rebuild for direct dependencies - ALL_MISSING_LIBS=$(ldd "$FILE" 2>/dev/null | sort -u | $SONAME_GREP "$SONAME_SEARCH" | awk '{print $1}' | tr '\n' ' ' | sed 's/ $//' ) - REQUIRED_LIBS=$(objdump -x $FILE | grep NEEDED | awk '{print $2}' | tr '\n' ' ' | sed 's/ $//') - MISSING_LIBS="" - for lib in $ALL_MISSING_LIBS - do - if echo $REQUIRED_LIBS | grep -q $lib - then - MISSING_LIBS="$MISSING_LIBS $lib" - fi - done - if [ "$MISSING_LIBS" != "" ] - then - echo "obj $FILE" >>$LLIST.3_rebuild - if $SEARCH_BROKEN ; then - echo_v " broken $FILE (requires ${MISSING_LIBS})" - else - echo_v " found $FILE" - fi - fi - fi - fi - done - if $SEARCH_BROKEN ; then - # Look for missing version - for FILE in $(grep "no version information available" $LLIST.3_ldd_errors | awk '{print $NF}' | sed 's/[()]//g' | sort -u) ; do - echo "obj $FILE" >>$LLIST.3_rebuild - echo_v " broken $FILE (no version information available)" - done - # Look for broken .la files - cat $LIST.1_files | egrep '*\.la$' | while read FILE ; do - for depend in $(grep '^dependency_libs' $FILE | awk -F'=' '{print $2}' | sed "s/'//g") ; do - [ ${depend:0:1} != '/' ] && continue - if [ ! -e $depend ] ; then - echo "obj $FILE" >>$LLIST.3_rebuild - echo_v " broken $FILE (requires ${depend})" - fi - done - done - fi - echo -e " done.\n ($LLIST.3_rebuild)" -fi - -if $PACKAGE_NAMES ; then - EXACT_EBUILDS=false - - echo - echo -n -e "${GR}Assigning files to packages...${NO}" - if [ -f $LLIST.4_packages_raw ] ; then - echo " using existing $LLIST.4_packages_raw." - else - set_trap "$LLIST.4_packages*" - echo -n >$LLIST.4_packages_raw - echo -n >$LLIST.4_package_owners - cat $LLIST.3_rebuild | while read obj FILE ; do - if $PORTAGE_UTILS ; then - EXACT_PKG="$(qfile -qvC ${FILE} )" - else - EXACT_PKG=$(find /var/db/pkg -name CONTENTS | xargs fgrep -l "obj $FILE " | sed -e 's:/var/db/pkg/\(.*\)/CONTENTS:\1:g') - fi - # Ugly sed hack to strip version information - PKG="$(echo $EXACT_PKG | sed 's/-r[0-9].*$//;s/\(^.*\/*\)-.*$/\1/')" - if [ -z "$PKG" ] ; then - echo -n -e "\n ${RD}*** $FILE not owned by any package is broken! ***${NO}" - echo "$FILE -> (none)" >> $LLIST.4_package_owners - echo_v -n -e "\n $FILE -> (none)" - else - echo "$EXACT_PKG" >> $LLIST.4_packages_raw - echo "$FILE -> $EXACT_PKG" >> $LLIST.4_package_owners - echo_v -n -e "\n $FILE -> $PKG" - fi - done - echo_v - echo -e " done.\n ($LLIST.4_packages_raw, $LLIST.4_package_owners)" - fi - - echo - echo -n -e "${GR}Cleaning list of packages to rebuild...${NO}" - if [ -f $LLIST.4_packages ] ; then - echo " using existing $LLIST.4_packages." - else - sort -u $LLIST.4_packages_raw >$LLIST.4_packages - echo -e " done.\n ($LLIST.4_packages)" - fi - - echo - echo -n -e "${GR}Assigning packages to ebuilds...${NO}" - if [ -f $LLIST.4_ebuilds ] ; then - echo " using existing $LLIST.4_ebuilds." - else - if [ -s "$LLIST.4_packages" ] - then - set_trap "$LLIST.4_ebuilds" - cat $LLIST.4_packages | while read EXACT_PKG - do - PKG="$(echo $EXACT_PKG | sed 's/-r[0-9].*$//;s/\(^.*\/*\)-.*$/\1/')" - SLOT=$(cat /var/db/pkg/${EXACT_PKG}/SLOT) - best_visible=$(portageq best_visible $PORTAGE_ROOT ${PKG}:${SLOT}) - [ "x" != "x$best_visible" ] && echo $best_visible - done > $LLIST.4_ebuilds - echo -e " done.\n ($LLIST.4_ebuilds)" - else - echo " Nothing to rebuild" - echo -n > $LLIST.4_ebuilds - fi - fi -else - EXACT_EBUILDS=true - - echo - echo -n -e "${GR}Assigning files to ebuilds...${NO}" - if [ -f $LLIST.4_ebuilds ] ; then - echo " using existing $LLIST.4_ebuilds." - else - if [ -s "$LLIST.3_rebuild" ] ; then - set_trap "$LLIST.4_ebuilds" - find /var/db/pkg -name CONTENTS | xargs fgrep -l -f $LLIST.3_rebuild | - sed 's:/var/db/pkg/\(.*\)/CONTENTS:\1:' > $LLIST.4_ebuilds - echo -e " done.\n ($LLIST.4_ebuilds)" - else - echo " Nothing to rebuild" - echo -n > $LLIST.4_ebuilds - fi - fi - -fi - -echo -echo -n -e "${GR}Evaluating package order...${NO}" -if [ -f $LLIST.5_order ] ; then - echo " using existing $LLIST.5_order." -else - set_trap "$LLIST.5_order" - RAW_REBUILD_LIST="$(cat $LLIST.4_ebuilds | sed s/^/=/ | tr '\n' ' ')" - if [ ! -z "$RAW_REBUILD_LIST" ] ; then - REBUILD_GREP="^\\($( (EMERGE_DEFAULT_OPTS="" emerge --nospinner --pretend --oneshot --nodeps --quiet $RAW_REBUILD_LIST ; echo $? >$LLIST.5a_status ) | sed -n 's/\./\\&/g;s/ //g;s/$/\\/;s/\[[^]]*\]//gp' | tr '\n' '|' | sed 's/|$//'))\$" - if [ $(cat $LLIST.5a_status) -gt 0 ] ; then - echo "" - echo -e "${RD}Warning: Failed to resolve package order." - echo -e "Will merge in \"random\" order!${NO}" - echo "Possible reasons:" - echo "- An ebuild is no longer in the portage tree." - echo "- An ebuild is masked, use /etc/portage/packages.keyword" - echo " and/or /etc/portage/package.unmask to unmask it" - for i in . . . . . ; do - echo -n -e '\a.' - sleep 1 - done - ln -f $LLIST.4_ebuilds $LLIST.5_order - else - (EMERGE_DEFAULT_OPTS="" emerge --nospinner --pretend --oneshot --deep --quiet $RAW_REBUILD_LIST ; echo $? >$LLIST.5b_status ) | sed -n 's/ *$//;s/^\[.*\] //p' | awk '{print $1}' | grep "$REBUILD_GREP" >$LLIST.5_order - if [ $(cat $LLIST.5b_status) -gt 0 ] ; then - echo "" - echo -e "${RD}Warning: Failed to resolve package order." - echo -e "Will merge in \"random\" order!${NO}" - echo "Possible reasons:" - echo "- An ebuild is no longer in the portage tree." - echo "- An ebuild is masked, use /etc/portage/packages.keyword" - echo " and/or /etc/portage/package.unmask to unmask it" - for i in . . . . . ; do - echo -n -e '\a.' - sleep 1 - done - rm -f $LLIST.5_order - ln -f $LLIST.4_ebuilds $LLIST.5_order - fi - fi - else - echo -n "" >$LLIST.5_order - fi - echo -e " done.\n ($LLIST.5_order)" -fi - -# Clean up no longer needed environment variables -unset COMPLETE_LD_LIBRARY_PATH SEARCH_DIRS SEARCH_DIRS_MASK LD_LIBRARY_MASK PORTAGE_ROOT CALLED_OPTIONS - -REBUILD_LIST="$(cat $LLIST.5_order | sed s/^/=/ | tr '\n' ' ')" - -trap - SIGHUP SIGINT SIGQUIT SIGABRT SIGTERM - -if [ -z "$REBUILD_LIST" ] ; then - echo -e "\n${GR}$OK_TEXT... All done.${NO} " - if [ ! $KEEPTEMP ] - then - rm $LIST.[0-2]_* - rm $LLIST.[3-9]_* - fi - exit 0 -fi - -IS_REAL_MERGE=true -echo " $EMERGE_OPTIONS " | grep -q '\( -p \| --pretend \| -f \| --fetchonly \)' && IS_REAL_MERGE=false - -echo -echo -e "${GR}All prepared. Starting rebuild...${NO}" - -echo "emerge --oneshot $EMERGE_OPTIONS $REBUILD_LIST" - -if $IS_REAL_MERGE ; then - for i in . . . . . . . . . . ; do - echo -n -e '\a.' - sleep 1 - done - echo -fi - -# Link file descriptor #6 with stdin -exec 6<&0 - -# Run in background to correctly handle Ctrl-C -( - EMERGE_DEFAULT_OPTS="" emerge --oneshot $EMERGE_OPTIONS $REBUILD_LIST <&6 - echo $? >$LLIST.6_status -) & -wait - -# Now restore stdin from fd #6, where it had been saved, and close fd #6 ( 6<&- ) to free it for other processes to use. -exec 0<&6 6<&- - -#if $EXACT_EBUILDS ; then -# mv -i /usr/portage/profiles/package.mask.hidden /usr/portage/profiles/package.mask -# trap - SIGHUP SIGINT SIGQUIT SIGABRT SIGTERM -#fi - -if [ "$(cat $LLIST.6_status)" -gt 0 ] ; then - echo - echo -e "${RD}revdep-rebuild failed to emerge all packages${NO}" - echo -e "${RD}you have the following choices:${NO}" - echo - echo "- if emerge failed during the build, fix the problems and re-run revdep-rebuild" - echo " or" - echo "- use -X or --package-names as first argument (trys to rebuild package, not exact" - echo " ebuild)" - echo " or" - echo "- set ACCEPT_KEYWORDS=\"~\" and/or /etc/portage/package.unmask" - echo " (and remove $LLIST.5_order to be evaluated again)" - echo " or" - echo "- modify the above emerge command and run it manually" - echo " or" - echo "- compile or unmerge unsatisfied packages manually, remove temporary files and" - echo " try again (you can edit package/ebuild list first)" - echo - echo -e "${GR}To remove temporary files, please run:${NO}" - echo "rm $LIST*.?_*" - exit $(cat $LLIST.6_status) -else - if $IS_REAL_MERGE ; then - trap "echo -e \" terminated. Please remove them manually:\nrm $LIST*.?_*\" ; exit 1" \ - SIGHUP SIGINT SIGQUIT SIGABRT SIGTERM - echo -n -e "${GR}Build finished correctly. Removing temporary files...${NO} " - echo - rm $LIST.[0-2]_* - rm $LLIST.[3-9]_* - echo "You can re-run revdep-rebuild to verify that all libraries and binaries" - echo "are fixed. If some inconsistency remains, it can be orphaned file, deep" - echo "dependency, binary package or specially evaluated library." - else - echo -e "${GR}Now you can remove -p (or --pretend) from arguments and re-run revdep-rebuild.${NO}" - fi -fi -exit 0 diff --git a/trunk/src/revdep-rebuild/revdep-rebuild-sh b/trunk/src/revdep-rebuild/revdep-rebuild-sh deleted file mode 100755 index c7acdc6..0000000 --- a/trunk/src/revdep-rebuild/revdep-rebuild-sh +++ /dev/null @@ -1,332 +0,0 @@ -#!/bin/sh -# Copyright 1999-2007 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 - -appname=${0##*/} - -# If baselayout is broken, define our own functions -[ -r /etc/init.d/functions.sh ] && . /etc/init.d/functions.sh -if ! type eend >/dev/null 2>&1 || ! eend 0 >/dev/null 2>&1; then - einfo() { echo " * $*"; } - eerror() { echo " * $*" >&2; return 1; } - eindent() { :; } - eoutdent() { :; } -fi - -# No temporary files used, so nothing to clean up :) -trap "export RC_EINDENT=; echo; eerror 'Caught interrupt'; exit 1" \ - SIGINT SIGQUIT - -print_usage() { - cat << EOF -Usage: ${appname} [OPTIONS] [--] [EMERGE_OPTIONS] - -Broken reverse dependency rebuilder. - - -h, --help Print this usage - -e, --exact Emerge based on exact package version - -C, --nocolor Turn off colored output - -L, --library NAME Emerge existing packages that use the library with NAME - --library=NAME NAME can be a full path to the library or a basic - regular expression (man grep) - -Calls emerge, all other options are used for it (e. g. -p, --pretend). - -Report bugs to -EOF -} - -# Have we linked to this library? -elf_linked() { - local f=$1 - shift - while [ -n "$1" ]; do - ldd "${f}" 2>/dev/null | grep -q "=> $1 " && return 0 - shift - done - return 1 -} - -# Work out of we really need this library or not -elf_needed() { - local f=$1 - shift - while [ -n "$1" ]; do - objdump -p "${f}" 2>/dev/null | \ - grep -vF "${ld_mask:=$'\a'}" | \ - grep -q "^ NEEDED ${1##*/}" && return 0 - shift - done - return 1 -} - -elf_broken() { - local lib= - - for lib in $(ldd "$1" 2>/dev/null | \ - sed -n -e 's/[[:space:]]*\(.*\) => not found.*/\1/p'); do - if elf_needed "$1" "${lib}"; then - echo "(missing ${lib})" - return 0 - fi - done - return 1 -} - -# Check that all direct files exist in .la files -la_broken() { - local x= - for x in $(sed -n -e "s/^dependency_libs=\'\(.*\)'\$/\1/p" "$1"); do - case "${x}" in - /*) - if [ ! -e "${x}" ]; then - echo "(missing ${x})" - return 0 - fi - ;; - esac - done - - return 1 -} - -# Return a $PATH style variable based on ld.so.conf -read_so_conf() { - local line= - while read line; do - case "${line}" in - "#"*) ;; - *) printf ":%s" "${line}";; - esac - done < /etc/ld.so.conf -} - -# Check to see if we have already scanned a dir or not -scanned() { - local dir=$1 IFS=: - set -- ${scanned} - - while [ -n "$1" ]; do - [ "$1" = "$dir" ] && return 0 - shift - done - - scanned="${scanned}${scanned:+:}${dir}" - return 1 -} - -# Hit the portage vdb to work out our ebuilds -# If everything is 100% then this happens in one very fast pass -# Otherwise we have to take the slow approach to inform the user which files -# are orphans -get_exact_ebuilds() { - local regex= ebuilds= x= IFS=: - set -- $@ - IFS=" " - - # Hit the vdb in one go - this is fast! - regex=$(printf "%s|" "$@") - regex=${regex%*|} - find /var/db/pkg -name CONTENTS | \ - xargs egrep "^obj (${regex}) " | \ - sed -e 's,/var/db/pkg/\(.*\/.*\)/CONTENTS:.*,=\1,g' | \ - tr '\n' ' ' -} - -# Get our args -libs= -exact=false -order=true -while [ -n "$1" ]; do - case "$1" in - --*=*) - arg1=${1%%=*} - arg2=${1#*=} - shift - set -- ${arg1} ${arg2} $@ - continue - ;; - -h|--help) print_usage; exit 0;; - -L|--library|--soname|--soname-regexp) - if [ -z "$2" ]; then - eerror "Missing expected argument to $1" - exit 1 - fi - libs="${libs}${libs:+ }$2" - shift - ;; - -e|--exact) exact=true;; - -X|--package-names) ;; #compat - --) shift; emerge_opts="$@"; break;; - *) eerror "$0: unknown option $1"; exit 1;; - esac - shift -done - -einfo "Configuring search environment for ${appname}" -# OK, this truely sucks. Paths can have spaces in, but our config format -# is space separated? -sdirs=$(unset SEARCH_DIRS; portageq envvar SEARCH_DIRS) -sdirs_mask=$(unset SEARCH_DIRS_MASK; portageq envvar SEARCH_DIRS_MASK) -ld_mask=$(unset LD_LIBRARY_MASK; portageq envvar LD_LIBRARY_MASK) - -if [ -d /etc/revdep-rebuild ]; then - for x in /etc/revdep-rebuild/*; do - sdirs="${sdirs}${sdirs:+ }$(unset SEARCH_DIRS; . "${x}"; echo "${SEARCH_DIRS}")" - sdirs_mask="${sdirs_mask}${sdirs_mask:+ }$(unset SEARCH_DIRS_MASK; . "${x}" ; echo "${SEARCH_DIRS_MASK}")" - ld_mask="${ld_mask}${ld_mask:+ }$(unset LD_LIBRARY_MASK; . "${x}"; echo "${LD_LIBRARY_MASK}")" - done -else - sdirs="${sdirs}${sdirs:+ }/bin /sbin /usr/bin /usr/sbin /lib* /usr/lib*" - sdirs_mask="${sdirs_mask}${sdirs_mask:+ }/opt/OpenOffice /usr/lib/openoffice" - ld_mask="${ld_mask}${ld_mask:+ }libodbcinst.so libodbc.so libjava.so libjvm.so" -fi - -sdirs=$(find ${sdirs} -type d) - -einfo "Starting scan" -eindent -# Mark our masked dirs already scanned -scanned= -for dir in ${sdirs_mask}; do - scanned "${dir}" -done - -# Now scan our dirs -for dir in ${sdirs}; do - scanned "${dir}" && continue - - einfo "in ${dir}" - eindent - for x in "${dir}"/*; do - [ -d "${x}" ] && continue - [ -L "${x}" ] && continue - - scan=true - process=false - reason= - case "${x}" in - *.so|*.so.*) process=true;; - *.la) - scan=false - if [ -z "${libs}" ]; then - reason=$(la_broken "${x}") - [ $? = 0 ] && process=true - fi - ;; - esac - [ -x "${x}" ] && ${scan} && process=true - ${process} || continue - - if ${scan}; then - process=false - if [ -n "${libs}" ]; then - for lib in ${libs}; do - if [ "${lib#/}" != "${lib}" ]; then - # If lib starts with / then check if the exact - # lib is linked - elf_linked "${x}" "${lib}" || continue - fi - if elf_needed "${x}" ${lib}; then - process=true - break - fi - done - else - reason=$(elf_broken "${x}") - [ $? = 0 ] && process=true - fi - fi - - ${process} || continue - einfo "found ${x} ${reason}" - files="${files}${files:+:}${x}" - done - eoutdent -done -eoutdent - -if [ -z "${files}" ]; then - if [ -z "${libs}" ]; then - einfo "Nothing found that needs rebuilding" - else - einfo "No dynamic binaries found with these libraries" - fi - exit 0 -fi - -einfo "Assigning files to packages" -eindent -ebuilds=$(get_exact_ebuilds "${files}") - -if [ -z "${ebuilds}" ]; then - eerror "No packages own these files" - exit 1 -fi - -# Work out the best visible package for the slot -if ! ${exact}; then - root=$(portageq envvar ROOT) - root=${root:-/} - - set -- ${ebuilds} - ebuilds= - for x in "$@"; do - x=${x#=*} - pkg=${x%-r[0-9]*} - pkg=${pkg%-*} - slot=$(cat "/var/db/pkg/${x}/SLOT") - ebd=$(portageq best_visible "${root}" "${pkg}:${slot}") - if [ -z "${ebd}" ]; then - eerror "Cannot find an ebuild visible for ${x}" - else - ebuilds="${ebuilds}${ebuilds:+ }=${ebd}" - fi - done -fi -eoutdent - -# Work out the build order -if ${order}; then - einfo "Ordering packages" - order="$(EMERGE_DEFAULT_OPTS="" \ - emerge --nospinner --pretend --deep --quiet ${ebuilds})" - if [ $? = 0 ]; then - ebuilds=$(echo "${order}" | \ - sed -e 's:^\[.*\] \([^ ]*\)[ ].*$:=\1:' | \ - grep -F "$(printf "%s\n" ${ebuilds})" | \ - tr '\n' ' ') - else - eerror "Unable to order packages!" - fi -fi - -if [ -z "${ebuilds}" ]; then - eerror "Don't know how to find which package owns what file :/" - exit 1 -fi - -echo -einfo "About to execute" -echo "emerge --oneshot ${emerge_opts} ${ebuilds}" -echo - -i=5 -printf "in" -while [ ${i} -gt 0 ]; do - printf " ${i}" - sleep 1 - i=$((${i} - 1)) -done -printf "\n\n" - -EMERGE_DEFAULT_OPTS="" emerge --oneshot ${emerge_opts} ${ebuilds} -retval=$? - -if [ "${retval}" = 0 ]; then - einfo "All done" - exit 0 -fi - -eerror "There was an error trying to emerge the broken packages" -exit "${retval}" diff --git a/trunk/src/revdep-rebuild/revdep-rebuild.1 b/trunk/src/revdep-rebuild/revdep-rebuild.1 deleted file mode 100644 index 267f7f1..0000000 --- a/trunk/src/revdep-rebuild/revdep-rebuild.1 +++ /dev/null @@ -1,101 +0,0 @@ -.TH "revdep\-rebuild" "1" "" "gentoolkit" "" -.SH "NAME" -revdep\-rebuild \- Gentoo: Reverse Dependency Rebuilder -.SH "SYNOPSIS" -.B revdep\-rebuild -[OPTIONS] [\-\-] [EMERGE OPTIONS] -.SH "DESCRIPTION" -revdep\-rebuild scans libraries and binaries for missing shared library dependencies and attempts to fix them by re\-emerging those broken binaries and shared libraries. It is useful when an upgraded package breaks other software packages that are dependent upon the upgraded package. -.SH "OPTIONS" -.TP -.B \-C | \-\-nocolor -Turn off colored output. (This option is also passed to portage.) -.TP -.B \-e | \-\-exact -Emerge the most recent version of found packages, without regard to SLOT. -.TP -.B \-h | \-\-help -Print usage. -.TP -.B \-i | \-\-ignore -Delete temporary files from previous runs. -.TP -.B \-k | \-\-keep\-temp -Force revdep\-rebuild not to delete temporary files after it successfully rebuilds packages. This option will NOT prevent revdep\-rebuild from deleting inconsistent or out\-of\-date temporary files. -.TP -.B \-\-library NAME | -L NAME -Search for reverse dependencies for a particular library or group of libraries, rather than every library on the system. Emerge packages that use the named library. NAME can be a full path to a library or basic regular expression. (See regex(7).) -.TP -.B \-l | \-\-no\-ld\-path -Do not set LD_LIBRARY_PATH. \fBNote:\fR Using this option will cause revdep-rebuild to report some false positives. -.TP -.B \-o | \-\-no-order -Do not check the build order against the deep dependency list. This will make revdep-rebuild faster, but it can cause emerge failures. Please try revdep\-rebuild without \-o before reporting any bugs. -.TP -.B \-p | \-\-pretend -Do a dry-run. Do not delete temporary files. (\-k \-p is redundant, but harmless.) \-\-pretend is assumed when not running revdep\-rebuild as root. -.TP -.B \-P | \-\-no\-progress -Turn off the progress meter -.TP -.B \-q | \-\-quiet -Print less output and disable the progress meter. (This option is also passed to portage.) -.TP -.B \-u UTIL | \-\-no-util UTIL -Do not use features provided by UTIL. -UTIL can be one of portage-utils or pkgcore, or it can be a \fBquoted\fR space-delimited list. -.TP -.B \-v | \-\-verbose -More output. (Prints the revdep\-rebuild search environment.) -.TP -.B All other options (including unrecognized ones) are passed to the emerge command. Single\-letter options may not be combined, so for example, \-pv is not valid. Please use \-p \-v. -.SH "CONFIGURATION" -revdep\-rebuild no longer uses hardcoded paths. To change the default behavior the following variables can be changed by the user. - -LD_LIBRARY_MASK \- Mask of specially evaluated libraries -.LP -SEARCH_DIRS \- List of directories to search for executables and libraries -.LP -SEARCH_DIRS_MASK \- List of directories to not search - -You can prepend to these variables by setting the variable in your environment prior to execution, by placing an entry in /etc/make.conf, or by placing a file in /etc/revdep\-rebuild containing the appropriate variables. - -The variables are read and set in the following order: - -environment settings \- one time changes by user -.br -/etc/make.conf \- persistent changes by user -.br -/etc/revdep\-rebuild/* \- persistent changes by ebuild authors - -While a user can edit and modify the files in the /etc/revdep\-rebuild directory, please be aware that the /etc/revdep\-rebuild directory is not under configuration protection and files can be removed and/or overwritten by an ebuild. To change this add /etc/revdep\-rebuild to the CONFIG_PROTECT variable in /etc/make.conf. - -An entry of "\-*" means to clear the variable from that point forward. -Example: SEARCH_DIRS="/usr/bin \-*" will set SEARCH_DIRS to contain only /usr/bin - -revdep\-rebuild honors the NOCOLOR and PORTAGE_NICENESS variables from /etc/make.conf -.SH "EXAMPLES" -It is recommended that when running revdep\-rebuild that the following command be used initially: -.br -\fBrevdep\-rebuild \-\-ignore \-\-pretend\fR - -To search the entire system, while excluding /mnt and /home: -.br -\fBenv SEARCH_DIRS="/ \-*" SEARCH_DIRS_MASK="/mnt /home" revdep\-rebuild\fR - -To rebuild packages that depend on libkdecore.so.4 from KDE 3.3: -.br -\fBrevdep\-rebuild \-\-library /usr/kde/3.3/lib/libkdecore.so.4\fR - -To rebuild packages that depend upon libImlib.so and libImlib2.so: -.br -\fBrevdep\-rebuild \-\-library libImlib[2]*.so.*\fR - -.SH "EXIT STATUS" -revdep\-rebuild returns a zero exit status if it \fBand emerge\fR succeeds, and a nonzero exit status otherwise. -.SH "BUGS" -.LP -Report bugs to . Please do not report emerge failures caused by \-o or \-e. Please include your .revdep\-rebuild* files, your emerge \-\-info, and patches. ;) - -.SH "SEE ALSO" -emerge(1), portage(5), regex(7) diff --git a/trunk/src/useflag/AUTHORS b/trunk/src/useflag/AUTHORS deleted file mode 100644 index e69de29..0000000 diff --git a/trunk/src/useflag/ChangeLog b/trunk/src/useflag/ChangeLog deleted file mode 100644 index e69de29..0000000 diff --git a/trunk/src/useflag/README b/trunk/src/useflag/README deleted file mode 100644 index e69de29..0000000 diff --git a/trunk/src/useflag/useflag b/trunk/src/useflag/useflag deleted file mode 100644 index fd4cc08..0000000 --- a/trunk/src/useflag/useflag +++ /dev/null @@ -1,610 +0,0 @@ -#!/bin/bash -# useflag v0.3.1 -# Script to help users manage USE flags in Gentoo Linux -# -# Distributed under the terms of the GNU General Public License, v2 or later -# Author: Michael Thompson , (c) 2002 - -run_name=`basename $0` -use_desc="/usr/portage/profiles/use.desc" -make_conf_dir="/etc" -make_conf="${make_conf_dir}/make.conf" -# Home directory was chosen as the use of /tmp allows for symlink attacks -make_temp="${HOME}/use.make.conf.tmp" -use_cache_parent="/var/cache" -use_cache_dir="${use_cache_parent}/use_desc" -use_cache="${use_cache_dir}/use.cache" -lock_cache="${use_cache_dir}/lock.cache" -changes="0" - - -# Get flag description -# parm1 = Use flag to get description of -do_get_desc() { - local parm1=$1 - # Strip the comments and find the flag. - local out_get_desc=`grep -v "#" ${use_desc} | grep -w -e "${parm1} -"` - if [ "${out_get_desc}" = "" ]; then - local lcl_avail=`grep -v "#" ${use_desc} | cut -d ' ' -f1 | \ - grep -w -e "${parm1}"` - if [ "${lcl_avail}" != "" ]; then - echo "${parm1} - No description available." - else - echo "!!! ${parm1} does not exist." - fi - else - echo "${out_get_desc}" - fi -} - -# Get the contents of the USE variable -# parm1 controls whether or not to include the '-' with each flag -do_get_make() { - local parm1=$1 - # Get the USE flags from make.conf - # using `source` now instead of brain-damaged grepping - source ${make_conf} - local get_make_out=${USE} - # If called with "nodashes", then strip the leading dashes - if [ "${parm1}" = "nodashes" ]; then - for tr_sucks in ${get_make_out}; do - if [ "${tr_sucks:0:1}" = "-" ]; then - local tr_out="${tr_out} ${tr_sucks:1}" - else - local tr_out="${tr_out} ${tr_sucks}" - fi - done - get_make_out="${tr_out}" - fi - echo "${get_make_out}" -} - -# Yes, it's pointless. But it could be used more than once in the future -# so it's a function. -# Gets the master list of available USE flags from use.desc -do_get_avail() { - grep -v "#" ${use_desc} | cut -d " " -f1 | tr '\n' ' ' -} - -# Get deprecated flags. -# parm1 = flag to check for deprecation -# parm2 = list of available flags -do_get_depr() { - local parm1=$1 - local parm2=${@:2} - # This next var can't be local - get_depr_tmp=`echo "${parm2}" | tr ' ' '\n' | grep -x -e "${parm1}"` - local ret_code=$? - if [ "${ret_code}" != "0" ]; then - echo "${parm1}" | tr '\n' ' ' - fi -} - -# Removes a USE flag from make.conf -# parm1 = flag to remove -# use_rm_out = list of available flags -do_use_rm() { - local parm1=$1 - local use_rm_out=${@:2} - # Strip matching USE flags. Yes, this is ugly, I know. - use_rm_out=`echo "${use_rm_out}" | tr ' ' '\n' | \ - grep -x -v -e "${parm1}" | tr '\n' ' '` - # Also strip the inverse. Even uglier... - if [ "${parm1:0:1}" = "-" ]; then - use_rm_out=`echo "${use_rm_out}" | tr ' ' '\n' | \ - grep -x -v -e "${parm1:1}" | tr '\n' ' '` - else - use_rm_out=`echo "${use_rm_out}" | tr ' ' '\n' | \ - grep -x -v -e "-${parm1}" | tr '\n' ' '` - fi - echo "${use_rm_out}" -} - -# Adds a USE flag to make.conf -# parm1 = flag to add -# use_add_out = list of available flags -do_use_add() { - local parm1=$1 - local use_add_out=${@:2} - # First strip existing flags (matching or inverse), then add. - # This is not the best way to do this. Better would be to replace a - # flag if it already exists. That turned out to be a real PITA. - # Maybe in a later version... - use_add_out=`do_use_rm ${parm1} ${use_add_out}` - use_add_out="${use_add_out} ${parm1}" - echo "${use_add_out}" -} - -# Adds a flag to the locked flag cache -# Pass list of flags to lock as parameter. -do_lock_flags() { - local flag_list=$@ - # Merge the new list of flags flags that are already locked. - if [ -r ${lock_cache} ]; then - local lock_old=`cat ${lock_cache}` - fi - flag_list="${lock_old} ${flag_list}" - # Remove duplicates. - echo "${flag_list}" | tr ' ' '\n' | sort | uniq | tr '\n' ' ' -} - -# Writes the list of locked flags to the cache file -# Pass list of flags to write as parameter. -do_write_lock() { - local write_flags=$@ - if [ -r ${make_conf} ]; then - local make_prune=`do_get_make nodashes` - else - do_report_err ${make_conf} read - fi - # Be sure and remove any locked flags that no longer exist in USE. - for prune in ${write_flags}; do - local prune_test=`do_get_depr ${prune} ${make_prune}` - if [ "$prune_test" = "" ]; then - local new_cache="${prune} ${new_cache}" - fi - done - if [ -w ${use_cache_parent} ]; then - mkdir -p ${use_cache_dir} - chmod 700 ${use_cache_dir} - echo "${new_cache}" > ${lock_cache} - chmod 600 ${lock_cache} - else - do_report_err ${lock_cache} write - fi -} - -# Writes new USE variable to make.conf -# Pass new list of USE flags as parameter. -do_write_make() { - local use_write="USE=\"$@\"" - local old_use="USE=\"`do_get_make dashes`\"" - if [ -w ${make_conf} ] && [ -w ${make_conf_dir} ]; then - local use_write="USE=\"$@\"" - local old_use=`grep "USE=\"" ${make_conf} | grep -v "#"` - local start_line=`grep -n "USE=\"" ${make_conf} | \ - grep -v "#" | cut -d ":" -f1` - if [ "${old_use:0-1}" != "\\" ]; then - sed -e "s/${old_use}/${use_write}/" ${make_conf} > \ - ${make_temp} - else - sed -e "s/${old_use}\\/${use_write}/" ${make_conf} > \ - ${make_temp} - fi - let start_line="${start_line} + 1" - if [ "${old_use:0-1}" != "\"" ]; then - del_line=`head -n ${start_line} ${make_temp} | \ - tail -n 1` - until [ "${del_line:0-1}" != "\\" ]; do - let del_length="${#del_line} - 1" - del_line="${del_line:0:${del_length}}" - grep -v -w "${del_line}" ${make_temp} > \ - ${make_temp}.2 - mv ${make_temp}.2 ${make_temp} - del_line=`head -n ${start_line} \ - ${make_temp} | tail -n 1` - done - let del_length="${#del_line} - 1" - del_line="${del_line:0:${del_length}}" - grep -v -x "${del_line}\"" ${make_temp} > \ - ${make_temp}.2 - mv ${make_temp}.2 ${make_temp} - fi - mv ${make_temp} ${make_conf} - else - do_report_err ${make_conf} write - fi -} - -# Reports a read/write error and exits -# parm1 = File to report on -# parm2 = read, write, etc -do_report_err() { - local parm1=$1 - local parm2=$2 - if [ "${parm2}" = "read" ]; then - echo "!!! Could not read ${parm1}" - echo -n "!!! Verify that file exists and that you have " - echo "appropriate permissions." - elif [ "${parm2}" = "write" ]; then - echo "!!! Could not write ${parm1}" - echo "!!! Got root?" - elif [ "${parm2}" = "nolock" ]; then - echo "!!! Could not read ${parm1}" - echo -n "!!! You have no locked flags or you have " - echo "insufficient permissions." - fi - exit 1 -} - - -# The main section of the script -# desc: -# This is the feature for getting USE descriptions. -if [ "$1" = "desc" ] || [ "$1" = "-i" ]; then - if [ -r ${use_desc} ]; then - for flag in ${@:2}; do - do_get_desc ${flag} - done - else - do_report_err ${use_desc} read - fi - -# show: -# This is the feature for showing the contents of the USE variable. -elif [ "$1" = "show" ] || [ "$1" = "-s" ]; then - if [ -r ${make_conf} ]; then - do_get_make dashes - else - do_report_err ${make_conf} read - fi - -# del: -# This is the feature for removing a USE flag. -elif [ "$1" = "del" ] || [ "$1" = "-d" ]; then - if [ -r ${make_conf} ]; then - make_use=`do_get_make dashes` - else - do_report_err ${make_conf} read - fi - for flag in ${@:2}; do - # Strip leading dashes. - if [ "${flag:0:1}" = "-" ]; then - flag="${flag:1}" - fi - del_test1=`do_get_depr ${flag} ${make_use}` - del_test2=`do_get_depr -${flag} ${make_use}` - if [ "${del_test1}" = "" ] || [ "${del_test2}" = "" ]; then - changes="1" - make_use=`do_use_rm ${flag} ${make_use}` - else - echo "!!! ${flag} is not in your USE variable." - fi - done - if [ "${changes}" != "0" ]; then - do_write_make ${make_use} - # Prune deleted USE flags from lock cache - lock_flags=`do_lock_flags $2` - do_write_lock ${lock_flags} - fi - -# add: -# This is the feature for explicitly enabling or disabling a USE flag. -elif [ "$1" = "add" ] || [ "$1" = "-a" ]; then - if [ -r ${make_conf} ]; then - make_use=`do_get_make dashes` - else - do_report_err ${make_conf} read - fi - for flag in ${@:2}; do - changes="1" - make_use=`do_use_add ${flag} ${make_use}` - done - if [ "${changes}" != "0" ]; then - do_write_make ${make_use} - fi - -# lock: -# This is the feature to lock a deprecated USE flag to prevent removal -elif [ "$1" = "lock" ] || [ "$1" = "-l" ]; then - if [ -r ${make_conf} ]; then - make_use=`do_get_make nodashes` - else - do_report_err ${make_conf} read - fi - for flag in ${@:2}; do - # Strip leading dashes. - if [ "${flag:0:1}" = "-" ]; then - flag="${flag:1}" - fi - lock_test=`do_get_depr ${flag} ${make_use}` - if [ "${lock_test}" = "" ]; then - lock_flags="${lock_flags} ${flag}" - else - echo "!!! ${flag} is not in your USE variable." - fi - done - lock_out=`do_lock_flags ${lock_flags}` - do_write_lock ${lock_out} - -# unlock: -# This is the feature to unlock a deprecated USE flag to allow removal -elif [ "$1" = "unlock" ] || [ "$1" = "-k" ]; then - if [ -r ${lock_cache} ]; then - lock_out=`cat ${lock_cache}` - else - do_report_err nolock - fi - for flag in ${@:2}; do - # Strip leading dashes. - if [ "${flag:0:1}" = "-" ]; then - flag="${flag:1}" - fi - lock_flag_check=`do_get_depr ${flag} ${lock_out}` - if [ "${lock_flag_check}" = "" ]; then - lock_out=`do_use_rm ${flag} ${lock_out}` - else - echo "!!! ${flag} is not a locked flag." - fi - done - do_write_lock ${lock_out} - -# showlock: -# This feature prints a list of USE flags that have been locked -elif [ "$1" = "showlock" ] || [ "$1" = "-w" ]; then - if [ -r ${lock_cache} ]; then - cat ${lock_cache} - else - do_report_err nolock - fi - -# update: -# This is the feature to update your USE by removing deprecated flags and -# handling new flags. -elif [ "$1" = "update" ] || [ "$1" = "-u" ]; then - if [ -r ${make_conf} ]; then - # Get our USE but strip leading dashes - make_use=`do_get_make nodashes` - else - do_report_err ${make_conf} read - fi - # Get available USE flags from use.desc - if [ -r ${use_desc} ]; then - use_avail=`do_get_avail` - else - do_report_err ${use_desc} read - fi - # First we check for deprecated flags. - echo "Your USE variable currently looks like this:" - echo - echo `do_get_make dashes` - echo - # Print the list of locked flags if any exist. - if [ -r ${lock_cache} ]; then - lock_test=`cat ${lock_cache} | tr -d ' '` - if [ "${lock_test}" != "" ]; then - echo "The following flags are locked:" - cat ${lock_cache} - echo - fi - fi - echo - echo "*** Checking for deprecated USE flags ..." - echo - for check_flag in ${make_use}; do - depr_ret=`do_get_depr ${check_flag} ${use_avail}` - flag_depr="${flag_depr}${depr_ret}" - done - # Filter out locked flags - if [ -r ${lock_cache} ] && [ "${lock_test}" != "" ]; then - lock_list=`cat ${lock_cache}` - for check_locks in ${flag_depr}; do - lock_ret=`do_get_depr ${check_locks} ${lock_list}` - lock_out="${lock_out}${lock_ret}" - done - flag_depr="${lock_out}" - fi - make_use=`do_get_make dashes` - if [ "${flag_depr}" = "" ]; then - echo "!!! No deprecated flags were found." - else - echo "The following USE flags appear to be deprecated:" - echo "${flag_depr}" - echo - echo "How would you like to handle them?" - echo "1) Handle them individually" - echo "2) Remove all deprecated flags" - echo "3) Don't remove any deprecated flags" - echo "4) Lock all deprecated flags" - echo - echo -n "Type (1, 2, 3, or 4): " - while [ "${luser_input}" = "" ]; do - read luser_input - case ${luser_input} in - "2") - changes="1" - for flag in ${flag_depr}; do - make_use=`do_use_rm \ - ${flag} ${make_use}` - done - echo - echo -n "*** All deprecated flags were " - echo "removed." - ;; - "3") - echo - echo "*** No flags were removed." - ;; - "1") - for flag in ${flag_depr}; do - echo -n "${flag} appears to be " - echo -n "deprecated. Remove it? " - echo -n "[Y]es/[N]o/[L]ock : " - luser_yn="" - while [ "${luser_yn}" = "" ]; do - read luser_yn - case ${luser_yn} in - "y" | "Y") - changes="1" - make_use=`do_use_rm \ - ${flag} \ - ${make_use}` - ;; - "n" | "N") - ;; - "l" | "L") - wlk="${flag} ${wlk}" - ;; - *) - luser_yn="" - ;; - esac - done - done - echo - echo -n "*** All deprecated flags " - echo "processed." - ;; - "4") - wlk="${flag_depr}" - echo - echo "*** All deprecated flags were locked." - ;; - *) - luser_input="" - ;; - esac - done - fi - if [ "${wlk}" != "" ]; then - do_write_lock ${wlk} - fi - # Now we check for new flags. - echo - echo - echo "*** Checking for new USE flags ..." - echo - # Load up our cached USE flags for comparison with use.desc - # Create the cache if it does not exist - if [ -w ${use_cache} ]; then - use_old=`cat ${use_cache}` - echo "${use_avail}" > ${use_cache} - chmod 600 ${use_cache} - elif [ -w ${use_cache_parent} ]; then - mkdir -p ${use_cache_dir} - chmod 700 ${use_cache_dir} - echo "${use_avail}" > ${use_cache} - chmod 600 ${use_cache} - use_old="" - else - do_report_err ${use_cache} write - fi - # Grab the contents of the USE variable. - make_cand=`do_get_make nodashes` - # Build a list of flags that do not exist in the USE variable. - for flag in ${use_avail}; do - new_cand="${new_cand}`do_get_depr ${flag} ${make_cand}`" - done - # Filter that list through the cached master list of flags. - for flag in ${new_cand}; do - new_flags="${new_flags}`do_get_depr ${flag} ${use_old}`" - done - if [ "${new_flags}" = "" ]; then - echo "!!! No new USE flags are available." - else - echo "The following new USE flags are available:" - echo "${new_flags}" - echo - echo "How would you like to handle them?" - echo "1) Handle them individually" - echo "2) Use Portage defaults (do not add to USE)" - echo "3) Explicitly enable all new flags" - echo "4) Explicitly disable all new flags" - echo - echo -n "Type (1, 2, 3, or 4): " - luser_input="" - while [ "${luser_input}" = "" ]; do - read luser_input - case ${luser_input} in - "1") - for h_flag in ${new_flags}; do - do_get_desc ${h_flag} - echo -n "How would you like to handle " - echo -n "${h_flag}? [e]nable, " - echo -n "[d]isable, [u]se default : " - luser_handle="" - while [ "${luser_handle}" = "" ]; do - read luser_handle - case ${luser_handle} in - "e" | "E") - changes="1" - make_use=`do_use_add \ - ${h_flag} \ - ${make_use}` - echo - ;; - "d" | "D") - changes="1" - make_use=`do_use_add \ - "-${h_flag}" \ - ${make_use}` - echo - ;; - "u" | "U") - echo - ;; - *) - luser_handle="" - ;; - esac - done - done - echo -n "*** All new flags have been " - echo "processed." - ;; - "2") - echo - echo -n "*** No new flags were added to " - echo "your USE." - ;; - "3") - changes="1" - for h_flag in ${new_flags}; do - make_use=`do_use_add ${h_flag} \ - ${make_use}` - done - echo - echo -n "*** All new flags were enabled in " - echo "your USE." - ;; - "4") - changes="1" - for h_flag in ${new_flags}; do - make_use=`do_use_add \ - "-${h_flag}" ${make_use}` - done - echo - echo -n "*** All new flags were disabled in " - echo "your USE." - ;; - *) - luser_input="" - ;; - esac - done - fi - # Write the changes if necessary. - if [ "${changes}" != "0" ]; then - do_write_make ${make_use} - # Prune any locked flags that do not exist in the USE variable - lock_prot=`do_lock_flags fakeflag` - do_write_lock ${lock_prot} - fi - echo - echo - echo "*** Script finished ..." - -# Display USAGE statement for unhandled parameters -else - echo "Usage:" - echo " ${run_name} action [flag] [...]" - echo - echo "Actions:" - echo "-s, show Displays the contents of the USE variable." - echo "-i, desc Displays a description of one or more USE flags." - echo -n "-a, add Adds the specified flag(s) to the USE " - echo "variable." - echo -n "-d, del Deletes the specified flag(s) from " - echo "the USE variable." - echo "-l, lock Locks the specified flag(s) to prevent deprecation." - echo -n "-k, unlock Unlocks the specified flags to allow " - echo "deprecation." - echo "-w, showlock Displays a list of locked flags." - echo -n "-u, update Interactively updates the USE variable to " - echo "reflect changes" - echo " to use.desc." - echo - exit 1 -fi -exit 0 - diff --git a/trunk/src/useflag/useflag.1 b/trunk/src/useflag/useflag.1 deleted file mode 100644 index d321861..0000000 --- a/trunk/src/useflag/useflag.1 +++ /dev/null @@ -1,69 +0,0 @@ -.TH useflag "1" "May 2002" "gentoolkit" -.SH NAME -useflag \- manage and update Gentoo Linux USE flags -.SH SYNOPSIS -.B useflag -\fIaction\fR [\fIflag\fR] [\fI...\fR] -.SH DESCRIPTION -The \fBuseflag\fR utility allows the user to manage Gentoo Linux USE flags through a simple command-line interface. It allows quick and easy, single-command manipulation of the USE variable defined in \fI/etc/make.conf\fR. It also simplifies the process of handling changes to the master list of USE flags defined in \fI/usr/portage/profile/use.desc\fR. -.br - -It is important to note that a USE variable must exist in \fImake.conf\fR for this utility to work. Be sure that the USE variable is uncommented. It is OK for the USE variable to be empty. Please be sure to back up \fImake.conf\fR before using this utility for the first time. -.PP -.SH ACTIONS -.TP -\fBshow, -s\fR -Displays the raw contents of the USE variable as defined in \fImake.conf\fR. The output contains only the flags themselves. -.TP -\fBdesc, -i [flag] ...\fR -Displays a description of one or more USE flags specified on the command line. The flags should be seperated by spaces and should not contain leading dashes. Specifying a flag that does not exist returns a non-fatal error. -.TP -\fBadd, -a [[\-]flag] ...\fR -Adds one or more specified flags to the USE variable defined in \fImake.conf\fR. The flags are appended to the USE variable exactly as they appear on the command line. If a specified flag already exists in the USE variable, it is removed before the new set of flags is appended. The utility removes existing flags regardless of whether they are in an enabled or disabled state, allowing the user to enable or disable a flag with a single command. The user may add flags that are not defined in the \fIuse.desc\fR master list. -.TP -\fBdel, -d [flag] ...\fR -Deletes one or more specified flags from the USE variable defined in \fImake.conf\fR. The enabled/disabled state of a flag in the USE variable as well as any dashes prepended to flags on the command line is ignored. Attempting to delete a flag that is not in the USE variable returns a non-fatal error. When a flag is deleted from the USE variable using this utility, it is automatically unlocked. -.TP -\fBlock, -l [flag] ...\fR -Locks one or more specified flags that exist in the USE variable defined in \fImake.conf\fR. Locked flags are not considered to be deprecated by the update function of this utility. This allows the user to avoid being queried by the utility about deprecated, undocumented, or custom flags that the user wishes to preserve when performing an update. A flag must exist in the USE variable in order to be locked. The enabled/disabled state of a flag in the USE variable as well as any dashes prepended to flags on the command line is ignored. -.TP -\fBunlock, -k [flag] ...\fR -Unlocks one or more specified USE flags. This allows the update function to consider a flag deprecated if it no longer exists in the master list defined in \fIuse.desc\fR. Any dashes prepended to flags on the command line are ignored. Attempting to unlock flags that are not locked returns a non-fatal error. -.TP -\fBshowlock, -w\fR -Displays the raw list of locked flags, seperated by spaces. -.TP -\fBupdate, -u\fR -Interactively updates the USE variable defined in \fImake.conf\fR to reflect changes to the master list of USE flags defined in \fI use.desc\fR. -.br - -First, the user is presented with the current raw contents of the USE variable. The user is also shown the list of locked flags if any exist. -.br - -Next, the USE variable is searched for flags that do not appear in the master list. If any are found and they are not locked, then they are considered to be deprecated and are displayed to the user along with a list of options for handling them. The user may choose to remove all of the flags, remove none of the flags, lock all of the flags, or handle each flag individually. -.br - -Last, the master list is searched for any new flags that have become available since the last time the update function was run, and these are displayed to the user. If this is the first time, then all flags not currently defined in the USE variable will be displayed. The user will then be presented with a list of options for handling these flags. The user may choose to add all of the new flags to the USE variable as enabled, add all of the new flags as disabled, use Portage defaults for all of the flags, or handle each flag individually. -.SH FILES -.TP -\fI/etc/make.conf\fR -Contains the USE variable that Portage uses to control build-time functionality. -.TP -\fI/usr/portage/profile/use.desc\fR -Contains a master list of all documented USE flags along with their descriptions. -.TP -\fI/var/cache/use_desc/use.cache\fR -Contains a cached list of flags from \fIuse.desc\fR. This prevents the user from being repeatedly queried about flags that exist in \fIuse.desc\fR but not in the USE variable. DO NOT EDIT THIS FILE MANUALLY. -.TP -\fI/var/cache/use_desc/lock.cache\fR -Contains a list of USE flags that have been locked. DO NOT EDIT THIS FILE MANUALLY. -.SH AUTHOR -Michael Thompson , 2002 -.SH SEE ALSO -ebuild(1), ebuild(5), emerge(1), make.conf(5). -.TP -See \fI/usr/share/doc/gentoolkit-/\fR for documentation on other gentoolkit utilities. -.SH TIPS -.TP -Deleting \fI/var/cache/use_desc/use.cache\fR will allow the utility to query about all flags not currently defined in the USE variable. - -- cgit v1.2.3