├── HACKING ├── IDEAS ├── LICENSE ├── MANIFEST.in ├── Makefile ├── README ├── TODO ├── contrib ├── bash-completion │ ├── README │ └── smart-completion.sh ├── ksmarttray │ ├── AUTHORS │ ├── COPYING │ ├── ChangeLog │ ├── INSTALL │ ├── LICENSE │ ├── Makefile.am │ ├── NEWS │ ├── README │ ├── admin │ │ ├── Doxyfile.am │ │ ├── Doxyfile.global │ │ ├── Makefile.common │ │ ├── acinclude.m4.in │ │ ├── am_edit │ │ ├── bcheck.pl │ │ ├── compile │ │ ├── conf.change.pl │ │ ├── config.guess │ │ ├── config.pl │ │ ├── config.sub │ │ ├── configure.in.bot.end │ │ ├── configure.in.min │ │ ├── cvs.sh │ │ ├── debianrules │ │ ├── depcomp │ │ ├── deps.am │ │ ├── detect-autoconf.pl │ │ ├── doxygen.sh │ │ ├── install-sh │ │ ├── libtool.m4.in │ │ ├── ltmain.sh │ │ ├── missing │ │ ├── mkinstalldirs │ │ ├── nmcheck │ │ ├── oldinclude.m4.in │ │ ├── pkg.m4.in │ │ └── ylwrap │ ├── build.sh │ ├── configure.in.in │ ├── ksmarttray.desktop │ └── src │ │ ├── Makefile.am │ │ ├── eventsrc │ │ ├── ksmarttray.cc │ │ ├── ksmarttray.h │ │ ├── ksmarttray.png │ │ └── ksmarttray.py ├── ksmarttray4 │ ├── Makefile │ ├── ksmarttray.desktop │ ├── ksmarttray.png │ ├── ksmarttray.py │ └── smart-helper ├── patches │ ├── rpm4.2.2-python.patch │ └── rpm4.3.2-python.patch ├── rpmhelper │ ├── README │ ├── rpmhelper.c │ └── setup.py ├── servicemenus │ ├── README │ ├── add_smart_channel.desktop │ └── kde_add_smart_channel.sh ├── smart-applet │ ├── Makefile │ ├── smart-applet.png │ ├── smart-applet.py │ ├── smart-helper.helper │ └── smart-helper.pam └── smart-update │ ├── Makefile │ └── smart-update.c ├── doc ├── Makefile ├── README.html ├── config.xsl ├── default.css ├── gpl.xml ├── images │ ├── smart-gksu.png │ ├── smart-gtk.png │ ├── smart-qt.png │ └── smart-root.png ├── smart.8 ├── smart.xml └── sysconf-index ├── locale ├── de │ └── LC_MESSAGES │ │ └── smart.po ├── es_ES │ └── LC_MESSAGES │ │ └── smart.po ├── fr │ └── LC_MESSAGES │ │ └── smart.po ├── hu │ └── LC_MESSAGES │ │ └── smart.po ├── it │ └── LC_MESSAGES │ │ └── smart.po ├── pt_BR │ └── LC_MESSAGES │ │ └── smart.po ├── ru │ └── LC_MESSAGES │ │ └── smart.po ├── smart.pot ├── sv │ └── LC_MESSAGES │ │ └── smart.po ├── zh_CN │ └── LC_MESSAGES │ │ └── smart.po └── zh_TW │ └── LC_MESSAGES │ └── smart.po ├── sandbox ├── cdproblems.py ├── crossrepository.py ├── docbookopts.py ├── fileconflicts.py ├── hashtime.py ├── loops.py ├── notobsoleted.py └── notobsoleting.py ├── setup.cfg ├── setup.py ├── smart.py ├── smart ├── __init__.py ├── backends │ ├── __init__.py │ ├── arch │ │ ├── __init__.py │ │ ├── archver.py │ │ ├── base.py │ │ ├── loader.py │ │ └── pm.py │ ├── deb │ │ ├── __init__.py │ │ ├── _base.c │ │ ├── base.py │ │ ├── cdebver.c │ │ ├── debver.py │ │ ├── loader.py │ │ └── pm.py │ ├── rpm │ │ ├── README │ │ ├── __init__.py │ │ ├── base.py │ │ ├── crpmver.c │ │ ├── descriptions.py │ │ ├── header.py │ │ ├── metadata.py │ │ ├── pm.py │ │ ├── redcarpet.py │ │ ├── rpmver.py │ │ ├── synthesis.py │ │ ├── updateinfo.py │ │ └── yast2.py │ └── slack │ │ ├── __init__.py │ │ ├── base.py │ │ ├── loader.py │ │ ├── pm.py │ │ └── slackver.py ├── cache.py ├── ccache.c ├── channel.py ├── channels │ ├── __init__.py │ ├── apt_deb.py │ ├── apt_deb_info.py │ ├── apt_rpm.py │ ├── apt_rpm_info.py │ ├── arch_dir.py │ ├── arch_dir_info.py │ ├── arch_site.py │ ├── arch_site_info.py │ ├── arch_sys.py │ ├── arch_sys_info.py │ ├── deb_dir.py │ ├── deb_dir_info.py │ ├── deb_sys.py │ ├── deb_sys_info.py │ ├── mirrors.py │ ├── mirrors_info.py │ ├── red_carpet.py │ ├── red_carpet_info.py │ ├── rpm_dir.py │ ├── rpm_dir_info.py │ ├── rpm_hdl.py │ ├── rpm_hdl_info.py │ ├── rpm_md.py │ ├── rpm_md_info.py │ ├── rpm_sys.py │ ├── rpm_sys_info.py │ ├── slack_dir.py │ ├── slack_dir_info.py │ ├── slack_site.py │ ├── slack_site_info.py │ ├── slack_sys.py │ ├── slack_sys_info.py │ ├── up2date_mirrors.py │ ├── up2date_mirrors_info.py │ ├── urpmi.py │ ├── urpmi_info.py │ ├── yast2.py │ └── yast2_info.py ├── commands │ ├── __init__.py │ ├── channel.py │ ├── check.py │ ├── clean.py │ ├── config.py │ ├── download.py │ ├── fix.py │ ├── flag.py │ ├── info.py │ ├── install.py │ ├── mirror.py │ ├── newer.py │ ├── nothing.py │ ├── priority.py │ ├── query.py │ ├── reinstall.py │ ├── remove.py │ ├── search.py │ ├── stats.py │ ├── update.py │ └── upgrade.py ├── const.py ├── control.py ├── fetcher.py ├── hook.py ├── interface.py ├── interfaces │ ├── __init__.py │ ├── gtk │ │ ├── __init__.py │ │ ├── changes.py │ │ ├── channels.py │ │ ├── command.py │ │ ├── flags.py │ │ ├── interactive.py │ │ ├── interface.py │ │ ├── legend.py │ │ ├── log.py │ │ ├── mirrors.py │ │ ├── packageinfo.py │ │ ├── packageview.py │ │ ├── preferences.py │ │ ├── priorities.py │ │ └── progress.py │ ├── images │ │ ├── __init__.py │ │ ├── crystal-add.png │ │ ├── crystal-apply.png │ │ ├── crystal-cancel.png │ │ ├── crystal-delete.png │ │ ├── crystal-edit.png │ │ ├── crystal-redo.png │ │ ├── crystal-reload.png │ │ ├── crystal-search.png │ │ ├── crystal-trash.png │ │ ├── crystal-undo.png │ │ ├── crystal-upgrade.png │ │ ├── folder.png │ │ ├── package-available-locked.png │ │ ├── package-available.png │ │ ├── package-broken.png │ │ ├── package-downgrade.png │ │ ├── package-install.png │ │ ├── package-installed-locked.png │ │ ├── package-installed-outdated.png │ │ ├── package-installed.png │ │ ├── package-new-locked.png │ │ ├── package-new.png │ │ ├── package-purge.png │ │ ├── package-reinstall.png │ │ ├── package-remove.png │ │ ├── package-upgrade.png │ │ └── smart.png │ ├── qt │ │ ├── __init__.py │ │ ├── changes.py │ │ ├── channels.py │ │ ├── command.py │ │ ├── flags.py │ │ ├── interactive.py │ │ ├── interface.py │ │ ├── legend.py │ │ ├── log.py │ │ ├── mirrors.py │ │ ├── packageinfo.py │ │ ├── packageview.py │ │ ├── priorities.py │ │ └── progress.py │ ├── qt4 │ │ ├── __init__.py │ │ ├── changes.py │ │ ├── channels.py │ │ ├── command.py │ │ ├── flags.py │ │ ├── interactive.py │ │ ├── interface.py │ │ ├── legend.py │ │ ├── log.py │ │ ├── mirrors.py │ │ ├── packageinfo.py │ │ ├── packageview.py │ │ ├── priorities.py │ │ └── progress.py │ └── text │ │ ├── __init__.py │ │ ├── interactive.py │ │ ├── interface.py │ │ └── progress.py ├── media.py ├── mirror.py ├── option.py ├── pkgconfig.py ├── plugins │ ├── __init__.py │ ├── aptchannelsync.py │ ├── channelsync.py │ ├── debdir.py │ ├── detectsys.py │ ├── landscape.py │ ├── rpmdir.py │ ├── urpmichannelsync.py │ ├── yumchannelsync.py │ └── zyppchannelsync.py ├── pm.py ├── progress.py ├── report.py ├── searcher.py ├── sorter.py ├── sysconfig.py ├── transaction.py ├── uncompress.py └── util │ ├── __init__.py │ ├── cdistance.c │ ├── celementtree │ ├── cElementTree.c │ └── expat │ │ ├── ascii.h │ │ ├── asciitab.h │ │ ├── expat.h │ │ ├── expat_external.h │ │ ├── iasciitab.h │ │ ├── internal.h │ │ ├── latin1tab.h │ │ ├── macconfig.h │ │ ├── nametab.h │ │ ├── utf8tab.h │ │ ├── winconfig.h │ │ ├── xmlparse.c │ │ ├── xmlrole.c │ │ ├── xmlrole.h │ │ ├── xmltok.c │ │ ├── xmltok.h │ │ ├── xmltok_impl.c │ │ ├── xmltok_impl.h │ │ └── xmltok_ns.c │ ├── ctagfile.c │ ├── distance.py │ ├── elementtree │ ├── ElementInclude.py │ ├── ElementPath.py │ ├── ElementTree.py │ ├── HTMLTreeBuilder.py │ ├── SgmlopXMLTreeBuilder.py │ ├── SimpleXMLTreeBuilder.py │ ├── SimpleXMLWriter.py │ ├── TidyHTMLTreeBuilder.py │ ├── TidyTools.py │ ├── XMLTreeBuilder.py │ └── __init__.py │ ├── filetools.py │ ├── geolocate.py │ ├── metalink.py │ ├── objdigest.py │ ├── optparse.py │ ├── pathlocks.py │ ├── pexpect.py │ ├── sha256module.c │ ├── ssh.py │ ├── strtools.py │ └── tagfile.py ├── test └── tests ├── __init__.py ├── aptdeb.py ├── aptdeb.txt ├── aptrpm.txt ├── archbase.py ├── archdir.txt ├── archsite.txt ├── auto.txt ├── backend.txt ├── celementtree.py ├── channel.py ├── data ├── aptdeb │ ├── component-less │ │ ├── Packages.gz │ │ ├── Release │ │ ├── Release.gpg │ │ ├── name1_version1-release1_all.deb │ │ └── name2_version2-release2_all.deb │ ├── dists │ │ ├── Release │ │ ├── Release.gpg │ │ └── component │ │ │ └── binary-i386 │ │ │ ├── Packages.gz │ │ │ ├── name1_version1-release1_all.deb │ │ │ └── name2_version2-release2_all.deb │ ├── fink-virtual-pkgs │ ├── trustdb.gpg │ └── trusted.gpg ├── aptrpm │ ├── RPMS.main │ │ ├── name1-version1-release1.noarch.rpm │ │ └── name2-version2-release2.noarch.rpm │ └── base │ │ ├── pkglist.main │ │ ├── pkglist.main.bz2 │ │ ├── release │ │ └── release.main ├── arch │ ├── name1-version1-release1-i686.pkg.tar.gz │ ├── name2-version2-release2-i686.pkg.tar.xz │ ├── test.db.tar.gz │ └── test.files.tar.gz ├── build │ └── deb │ │ └── debian │ │ ├── changelog │ │ ├── control │ │ └── rules ├── deb ├── pack │ ├── debtest.tar │ └── rpmtest.pkg ├── rpm │ ├── metalink.xml │ ├── mirrorlist.txt │ ├── name1-version1-release1.noarch.rpm │ ├── name2-version2-release2.noarch.rpm │ └── repodata │ │ ├── filelists.xml.gz │ │ ├── other.xml.gz │ │ ├── primary.xml.gz │ │ ├── repomd.xml │ │ └── updateinfo.xml ├── slack │ ├── CHECKSUMS.md5 │ ├── PACKAGES.TXT │ ├── name1-version1-noarch-release1.tgz │ └── name2-version2-noarch-release2.txz ├── uncompress │ ├── test.7z │ ├── test.bz2 │ ├── test.gz │ ├── test.lzma │ ├── test.txt │ ├── test.xz │ └── test.zip ├── urpmi-xml │ ├── media_info │ │ ├── MD5SUM │ │ ├── changelog.xml.lzma │ │ ├── files.xml.lzma │ │ ├── hdlist.cz │ │ ├── info.xml.lzma │ │ └── synthesis.hdlist.cz │ ├── name1-version1-release1.noarch.rpm │ ├── name2-version2-release2.noarch.rpm │ └── reconfig.urpmi ├── urpmi │ ├── clock │ ├── media_info │ │ ├── MD5SUM │ │ ├── descriptions │ │ ├── hdlist.cz │ │ └── synthesis.hdlist.cz │ ├── mirrorlist.txt │ ├── name1-version1-release1.noarch.rpm │ ├── name2-version2-release2.noarch.rpm │ ├── reconfig.urpmi │ └── zone.tab ├── yast2-compressed │ ├── RPMS │ │ └── noarch │ │ │ ├── name1-version1-release1.noarch.rpm │ │ │ └── name2-version2-release2.noarch.rpm │ ├── content │ ├── directory.yast │ ├── media.1 │ │ └── media │ └── setup │ │ └── descr │ │ ├── packages.DU.gz │ │ ├── packages.en.gz │ │ └── packages.gz ├── yast2 │ ├── RPMS │ │ └── noarch │ │ │ ├── name1-version1-release1.noarch.rpm │ │ │ └── name2-version2-release2.noarch.rpm │ ├── content │ ├── directory.yast │ ├── media.1 │ │ └── media │ └── setup │ │ └── descr │ │ ├── packages │ │ ├── packages.DU │ │ └── packages.en └── yumrpm │ ├── metalink-broken.xml │ ├── mirrorlist-broken.txt │ ├── name1-version1-release1.noarch.rpm │ ├── name2-version2-release2.noarch.rpm │ └── repodata │ ├── 00918afbb983349105125c0182d6bb61511bfa6cb565e5210ae43c3fa30fb7ee-filelists.sqlite.bz2 │ ├── 077eb7b5f9cf321a8ff862fad6e5712f47b55e0f49413a886db0318fae2e393d-primary.xml.gz │ ├── 47375fb1438614a7b6058cea2a716b0331f4d0d7f1c91761996144d15b2427b2-primary.sqlite.bz2 │ ├── 655b55a361aeff1440244ab9dc473175e84c84bbd708263792a3a543b24c4d92-other.sqlite.bz2 │ ├── caa0be22bc2bf69dabd43e81e17601f1ce05730b823c47626aad96bcec801e15-other.xml.gz │ ├── f6da66cef2af5fa3a35785617e7a2e7c03241cf1abcd6e28280e25b308e578d7-filelists.xml.gz │ └── repomd.xml ├── debbase.py ├── debdir.txt ├── debloader.py ├── debpm.py ├── descriptions.txt ├── detectchannels.txt ├── fetcher.py ├── fink.txt ├── initialization.py ├── interface.py ├── load-hooks.txt ├── media.py ├── metadata.txt ├── metalink.txt ├── mirrorlist.txt ├── mirrorurl.txt ├── mocker.py ├── nothing.txt ├── origin.txt ├── pack.txt ├── plugins ├── __init__.py ├── test_aptchannelsync.py ├── test_detectsys.py ├── test_landscape.py ├── test_urpmichannelsync.py ├── test_yumchannelsync.py └── test_zyppchannelsync.py ├── policy-upgrade.txt ├── rpmbase.py ├── rpmdir.txt ├── rpmloader.py ├── searcher.py ├── slackbase.py ├── slackdir.txt ├── slackloader.py ├── slacksite.txt ├── sorter.py ├── uncompress.py ├── updateinfo.txt ├── urpmi.txt ├── urpmixml.txt ├── util ├── __init__.py └── distance.py ├── yast2.txt ├── yast2comp.txt ├── yumrpm.py └── yumrpm.txt /HACKING: -------------------------------------------------------------------------------- 1 | 2 | Code Conventions 3 | ---------------- 4 | 5 | - Classes must be new-style, and named LikeThis. 6 | - Functions and methods are named likeThis(). 7 | - Variables and attributes are named likethis. 8 | - Private and protected attributes are named _likethis. 9 | - Private methods where name clashing with subclasses is probable 10 | (e.g. Progress) are named __likethis. 11 | - Identation is 4 expanded spaces. 12 | - Lines must have at most 79 columns. 13 | - Follow PEP-8 whenever it doesn't conflict with the statements above. 14 | - Space comparisons >= like == this, but parameters like=this. 15 | - Methods/function calls have parameters(spaced, like, this), even 16 | if they((have, additional, parenthesis)). 17 | 18 | Testing 19 | ------- 20 | 21 | - For every change, try to create a new test. 22 | - Run all tests: 'make test'. 23 | - Run specific test: 'TEST=tests/test.txt make test' 24 | -------------------------------------------------------------------------------- /MANIFEST.in: -------------------------------------------------------------------------------- 1 | recursive-include smart *.py *.c *.h *.png 2 | include smart setup.cfg MANIFEST.in HACKING IDEAS TODO LICENSE README Makefile 3 | include doc/README.html doc/default.css doc/smart.8 doc/sysconf-index 4 | include smart/backends/rpm/README 5 | 6 | recursive-include tests *.py *.txt 7 | recursive-include tests/data * 8 | include test 9 | 10 | recursive-include contrib/ksmarttray *.png *.cc *.h *.am *.in.in 11 | recursive-include contrib/ksmarttray LICENSE eventsrc AUTHORS build.sh 12 | recursive-include contrib/ksmarttray ChangeLog COPYING INSTALL NEWS README 13 | recursive-include contrib/ksmarttray ksmarttray.desktop 14 | graft contrib/ksmarttray/admin 15 | 16 | recursive-include contrib/smart-update *.c Makefile 17 | 18 | recursive-include contrib/patches * 19 | 20 | recursive-include contrib/rpmhelper * 21 | 22 | recursive-include contrib/servicemenus * 23 | 24 | recursive-include contrib/bash-completion * 25 | 26 | recursive-include locale *.pot *.po *.mo 27 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Make file for various operations on Smart source code 3 | # 4 | 5 | DESTDIR=/ 6 | PYTHON?=python 7 | 8 | prefix=/usr 9 | bindir=$(prefix)/bin 10 | 11 | all: 12 | $(PYTHON) setup.py build 13 | 14 | install: 15 | $(PYTHON) setup.py install \ 16 | --root=$(DESTDIR) \ 17 | --prefix=$(prefix) \ 18 | --install-scripts=$(bindir) 19 | 20 | dist: 21 | $(PYTHON) setup.py sdist 22 | 23 | rpm: 24 | $(PYTHON) setup.py bdist_rpm 25 | 26 | clean: 27 | rm -rf build 28 | find smart/ -name *.pyc -exec rm -f {} \; 29 | find smart/ -name *.so -exec rm -f {} \; 30 | find locale/ -name *.mo -exec rm -f {} \; 31 | 32 | POTFILES=`find . -name '*.c' -o -name '*.py' | grep -v ./build/` 33 | 34 | smart.pot: 35 | xgettext --sort-by-file -o locale/smart.pot $(POTFILES) 36 | 37 | update-po: smart.pot 38 | for po in locale/*/LC_MESSAGES/smart.po; do \ 39 | echo -e "Merge: $$po: \c"; \ 40 | msgmerge -v -U $$po locale/smart.pot; \ 41 | done 42 | 43 | check-po: 44 | for po in locale/*/LC_MESSAGES/smart.po; do \ 45 | echo -e "Check: $$po: \c"; \ 46 | msgfmt -o /dev/null --statistics -v -c $$po; \ 47 | done 48 | 49 | ext: 50 | $(PYTHON) setup.py build_ext -i 51 | 52 | test: ext 53 | LC_ALL=C LANG=C $(PYTHON) test $(TEST) 54 | 55 | .PHONY: clean smart.pot update-po check-po ext test 56 | 57 | -------------------------------------------------------------------------------- /TODO: -------------------------------------------------------------------------------- 1 | - Make slack-site default priority be 100 or so? 2 | - Clean stdin buffer before asking for user input. 3 | - Autodetection of removable media for apt-deb channels. 4 | - Implement package content listing for deb backend. 5 | - Create a "master local directory mirror", which is checked 6 | for packages, to be used in conjuction with upgrade --urls? 7 | - Implement scheme similar to apt-get remove -D. 8 | - Implement "info" command, to show information about packages. 9 | - Implement per-channel package signature checking. 10 | - Implement something close to urpmi's --no-uninstall 11 | - Add command for explicit cache rebuilding 12 | - Add option to enable mixed dependency satisfaction. 13 | - Transform "Stopped" progress in elapsed time 14 | - Make it more clear that action commands on shell do not commit 15 | immediately. 16 | - Implement flag --edit 17 | - Add rpm-* option for rpm.setVerbosity(rpm.RPMLOG_*) 18 | - Find a better way of making public patches between releases 19 | (http://tracker.labix.org/msg451) 20 | -------------------------------------------------------------------------------- /contrib/bash-completion/README: -------------------------------------------------------------------------------- 1 | AUTHOR: 2 | Mauricio Teixeira (netmask) 3 | 4 | DATE: 5 | Sun November 19 6 | 7 | FILE: 8 | smart-completion.sh 9 | 10 | WHAT: 11 | BASH command line completion for Smart. It completes options, action commands, 12 | and options from action commands. 13 | 14 | HOW: 15 | Just copy smart-completion.sh to /etc/bash_completion 16 | -------------------------------------------------------------------------------- /contrib/bash-completion/smart-completion.sh: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2005 Canonical 3 | # Copyright (c) 2004 Conectiva, Inc. 4 | # 5 | # Written by Mauricio Teixeira 6 | # 7 | # This file is part of Smart Package Manager. 8 | # 9 | # Smart Package Manager is free software; you can redistribute it and/or 10 | # modify it under the terms of the GNU General Public License as published 11 | # by the Free Software Foundation; either version 2 of the License, or (at 12 | # your option) any later version. 13 | # 14 | # Smart Package Manager is distributed in the hope that it will be useful, 15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | # General Public License for more details. 18 | # 19 | # You should have received a copy of the GNU General Public License 20 | # along with Smart Package Manager; if not, write to the Free Software 21 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 22 | # 23 | 24 | _smart() { 25 | 26 | local cur prev opts 27 | 28 | smartdir=$(python -c "import smart; print smart.__file__" \ 29 | | awk '{sub("/__init__.py[c]?","");print}') 30 | commands="$(ls ${smartdir}/commands/*.py \ 31 | | awk -F '/' '{gsub(/\.py|__init__.py[c]?|\n/,""); print $NF}')" 32 | 33 | COMPREPLY=() 34 | cur="${COMP_WORDS[COMP_CWORD]}" 35 | prev="${COMP_WORDS[COMP_CWORD-1]}" 36 | 37 | if [[ ${prev} == "smart" ]] ; then 38 | # Completion for general options and action commands 39 | opts="${commands} $(grep "add_option" $(which smart) | tr \" \\n \ 40 | | grep "^-" | tr \\n " ")" 41 | COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) 42 | return 0 43 | elif [[ ! -z "$(echo $commands | grep ${COMP_WORDS[1]})" ]] ; then 44 | # Completion for action command options 45 | opts="$(grep "add_option" "${smartdir}/commands/${COMP_WORDS[1]}.py" \ 46 | | tr \" \\n | grep "^-" | tr \\n " ")" 47 | COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) 48 | return 0 49 | fi 50 | } 51 | 52 | complete -F _smart smart 53 | -------------------------------------------------------------------------------- /contrib/ksmarttray/AUTHORS: -------------------------------------------------------------------------------- 1 | Dummy file required by KDE build admin. 2 | -------------------------------------------------------------------------------- /contrib/ksmarttray/COPYING: -------------------------------------------------------------------------------- 1 | Dummy file required by KDE build admin. 2 | -------------------------------------------------------------------------------- /contrib/ksmarttray/ChangeLog: -------------------------------------------------------------------------------- 1 | Dummy file required by KDE build admin. 2 | -------------------------------------------------------------------------------- /contrib/ksmarttray/INSTALL: -------------------------------------------------------------------------------- 1 | Dummy file required by KDE build admin. 2 | -------------------------------------------------------------------------------- /contrib/ksmarttray/Makefile.am: -------------------------------------------------------------------------------- 1 | SUBDIRS = $(TOPSUBDIRS) 2 | 3 | $(top_srcdir)/configure.in: configure.in.in $(top_srcdir)/subdirs 4 | cd $(top_srcdir) && $(MAKE) -f admin/Makefile.common configure.in ; 5 | 6 | $(top_srcdir)/subdirs: 7 | cd $(top_srcdir) && $(MAKE) -f admin/Makefile.common subdirs 8 | 9 | $(top_srcdir)/acinclude.m4: $(top_srcdir)/admin/acinclude.m4.in $(top_srcdir)/admin/libtool.m4.in 10 | @cd $(top_srcdir) && cat admin/acinclude.m4.in admin/libtool.m4.in > acinclude.m4 11 | 12 | MAINTAINERCLEANFILES = subdirs configure.in acinclude.m4 configure.files 13 | 14 | package-messages: 15 | $(MAKE) -f admin/Makefile.common package-messages 16 | $(MAKE) -C po merge 17 | 18 | EXTRA_DIST = admin 19 | 20 | dist-hook: 21 | cd $(top_distdir) && perl admin/am_edit -padmin 22 | cd $(top_distdir) && $(MAKE) -f admin/Makefile.common subdirs 23 | -------------------------------------------------------------------------------- /contrib/ksmarttray/NEWS: -------------------------------------------------------------------------------- 1 | Dummy file required by KDE build admin. 2 | -------------------------------------------------------------------------------- /contrib/ksmarttray/README: -------------------------------------------------------------------------------- 1 | Dummy file required by KDE build admin. 2 | -------------------------------------------------------------------------------- /contrib/ksmarttray/admin/Makefile.common: -------------------------------------------------------------------------------- 1 | ### Makefile.common 2 | ### 3 | ### Copyright (C) 2002 by the KDE developers 4 | 5 | ### All the real work is done by the shellscript cvs.sh 6 | 7 | SHELL=/bin/sh 8 | 9 | cvs dist configure configure.in configure.files subdirs package-messages package-merge Makefile.am acinclude.m4 extract-messages: 10 | @admindir=$(admindir); \ 11 | if test "x$$admindir" = x; then \ 12 | admindir=.; until test -f $$admindir/admin/cvs.sh; do \ 13 | admindir=$$admindir/..; \ 14 | if test `cd $$admindir && pwd` = / ; then break; fi; \ 15 | done; \ 16 | admindir=$$admindir/admin; \ 17 | if test -f $$admindir/cvs.sh; then :; else \ 18 | echo "Can't find the admin/ directory in any parent of the"; \ 19 | echo "current directory. Please set it with admindir=..."; \ 20 | exit 1; \ 21 | fi; \ 22 | fi; \ 23 | if test "$@" = "package-merge"; then \ 24 | MAKE="$(MAKE)" POFILES="$(POFILES)" PACKAGE="$(PACKAGE)" \ 25 | $(SHELL) $$admindir/cvs.sh package-merge ;\ 26 | else \ 27 | MAKE="$(MAKE)" $(SHELL) $$admindir/cvs.sh $@ ;\ 28 | fi 29 | 30 | configure.in: configure.files subdirs 31 | configure.files: subdirs 32 | 33 | svn: cvs 34 | 35 | .SILENT: 36 | 37 | .PHONY: svn cvs dist package-merge package-messages 38 | -------------------------------------------------------------------------------- /contrib/ksmarttray/admin/configure.in.bot.end: -------------------------------------------------------------------------------- 1 | # Check if KDE_SET_PREFIX was called, and --prefix was passed to configure 2 | if test -n "$kde_libs_prefix" -a -n "$given_prefix"; then 3 | # And if so, warn when they don't match 4 | if test "$kde_libs_prefix" != "$given_prefix"; then 5 | # And if kde doesn't know about the prefix yet 6 | echo ":"`kde-config --path exe`":" | grep ":$given_prefix/bin/:" 2>&1 >/dev/null 7 | if test $? -ne 0; then 8 | echo "" 9 | echo "Warning: you chose to install this package in $given_prefix," 10 | echo "but KDE was found in $kde_libs_prefix." 11 | echo "For this to work, you will need to tell KDE about the new prefix, by ensuring" 12 | echo "that KDEDIRS contains it, e.g. export KDEDIRS=$given_prefix:$kde_libs_prefix" 13 | echo "Then restart KDE." 14 | echo "" 15 | fi 16 | fi 17 | fi 18 | 19 | if test x$GXX = "xyes" -a x$kde_have_gcc_visibility = "xyes" -a x$kde_cv_val_qt_gcc_visibility_patched = "xno"; then 20 | echo "" 21 | echo "Your GCC supports symbol visibility, but the patch for Qt supporting visibility" 22 | echo "was not included. Therefore, GCC symbol visibility support remains disabled." 23 | echo "" 24 | echo "For better performance, consider including the Qt visibility supporting patch" 25 | echo "located at:" 26 | echo "" 27 | echo "http://bugs.kde.org/show_bug.cgi?id=109386" 28 | echo "" 29 | echo "and recompile all of Qt and KDE. Note, this is entirely optional and" 30 | echo "everything will continue to work just fine without it." 31 | echo "" 32 | fi 33 | 34 | if test "$all_tests" = "bad"; then 35 | if test ! "$cache_file" = "/dev/null"; then 36 | echo "" 37 | echo "Please remove the file $cache_file after changing your setup" 38 | echo "so that configure will find the changes next time." 39 | echo "" 40 | fi 41 | else 42 | echo "" 43 | echo "Good - your configure finished. Start make now" 44 | echo "" 45 | fi 46 | -------------------------------------------------------------------------------- /contrib/ksmarttray/admin/configure.in.min: -------------------------------------------------------------------------------- 1 | dnl This file is part of the KDE libraries/packages 2 | dnl Copyright (C) 2001 Stephan Kulow (coolo@kde.org) 3 | 4 | dnl This file is free software; you can redistribute it and/or 5 | dnl modify it under the terms of the GNU Library General Public 6 | dnl License as published by the Free Software Foundation; either 7 | dnl version 2 of the License, or (at your option) any later version. 8 | 9 | dnl This library is distributed in the hope that it will be useful, 10 | dnl but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | dnl Library General Public License for more details. 13 | 14 | dnl You should have received a copy of the GNU Library General Public License 15 | dnl along with this library; see the file COPYING.LIB. If not, write to 16 | dnl the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 17 | dnl Boston, MA 02110-1301, USA. 18 | 19 | # Original Author was Kalle@kde.org 20 | # I lifted it in some mater. (Stephan Kulow) 21 | # I used much code from Janos Farkas 22 | 23 | dnl Process this file with autoconf to produce a configure script. 24 | 25 | AC_INIT(acinclude.m4) dnl a source file from your sub dir 26 | 27 | dnl This is so we can use kde-common 28 | AC_CONFIG_AUX_DIR(admin) 29 | 30 | dnl This ksh/zsh feature conflicts with `cd blah ; pwd` 31 | unset CDPATH 32 | 33 | dnl Checking host/target/build systems, for make, install etc. 34 | AC_CANONICAL_SYSTEM 35 | dnl Perform program name transformation 36 | AC_ARG_PROGRAM 37 | 38 | dnl Automake doc recommends to do this only here. (Janos) 39 | AM_INIT_AUTOMAKE(@MODULENAME@, @VERSION@) dnl searches for some needed programs 40 | 41 | KDE_SET_PREFIX 42 | 43 | dnl generate the config header 44 | AM_CONFIG_HEADER(config.h) dnl at the distribution this done 45 | 46 | dnl Checks for programs. 47 | AC_CHECK_COMPILERS 48 | AC_ENABLE_SHARED(yes) 49 | AC_ENABLE_STATIC(no) 50 | KDE_PROG_LIBTOOL 51 | 52 | dnl for NLS support. Call them in this order! 53 | dnl WITH_NLS is for the po files 54 | AM_KDE_WITH_NLS 55 | 56 | dnl KDE_USE_QT 57 | AC_PATH_KDE 58 | -------------------------------------------------------------------------------- /contrib/ksmarttray/admin/debianrules: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl -w 2 | 3 | use Shell qw(mv cp mkdir rm) ; 4 | use File::Find; 5 | use Cwd; 6 | 7 | $origPwd = `pwd`; 8 | chomp $origPwd; 9 | 10 | $kde_prefix = "/usr"; 11 | $sysconfdir = "/etc"; 12 | $kde_includedir = "$kde_prefix/include/kde"; 13 | $infodir = "$kde_prefix/share/info"; 14 | $mandir = "$kde_prefix/share/man"; 15 | $qtdir = "/usr/share/qt3"; 16 | 17 | $kde_cgidir = "$kde_prefix/lib/cgi-bin"; 18 | $kde_confdir = "$sysconfdir/kde3"; 19 | $kde_htmldir = "$kde_prefix/share/doc/kde/HTML"; 20 | 21 | if (defined $ENV{DEB_BUILD_OPTIONS} && 22 | $ENV{DEB_BUILD_OPTIONS} =~ /\bnostrip\b/) { 23 | $enable_debug="--enable-debug=full"; 24 | } else { 25 | $enable_debug="--disable-debug"; 26 | } 27 | 28 | if (@ARGV && $ARGV[0] eq 'echodirs') { 29 | print STDOUT "export kde_prefix=$kde_prefix\n"; 30 | print STDOUT "export sysconfdir=$sysconfdir\n"; 31 | print STDOUT "export kde_includedir=$kde_includedir\n"; 32 | print STDOUT "export infodir=$infodir\n"; 33 | print STDOUT "export mandir=$mandir\n"; 34 | print STDOUT "export qtdir=$qtdir\n"; 35 | 36 | print STDOUT "export kde_cgidir=$kde_cgidir\n"; 37 | print STDOUT "export kde_confdir=$kde_confdir\n"; 38 | print STDOUT "export kde_htmldir=$kde_htmldir\n"; 39 | 40 | print STDOUT "configkde=$enable_debug --disable-rpath --prefix=\$(kde_prefix) --sysconfdir=\$(sysconfdir) --includedir=\$(kde_includedir) --infodir=\$(infodir) --mandir=\$(mandir) --with-qt-dir=\$(qtdir)\n"; 41 | 42 | exit 43 | } 44 | -------------------------------------------------------------------------------- /contrib/ksmarttray/admin/deps.am: -------------------------------------------------------------------------------- 1 | $(top_srcdir)/acinclude.m4: $(top_srcdir)/admin/acinclude.m4.in $(top_srcdir)/admin/libtool.m4.in $(top_srcdir)/admin/cvs.sh $(top_srcdir)/admin/pkg.m4.in 2 | @cd $(top_srcdir) && $(SHELL) admin/cvs.sh acinclude_m4 3 | 4 | $(top_srcdir)/configure.in: $(top_srcdir)/subdirs $(top_srcdir)/configure.files $(top_srcdir)/admin/cvs.sh 5 | @cd $(top_srcdir) && $(SHELL) admin/cvs.sh configure_in 6 | 7 | $(top_srcdir)/configure.files: $(top_srcdir)/subdirs $(CONF_FILES) 8 | @cd $(top_srcdir) && $(SHELL) admin/cvs.sh configure.files $(top_srcdir)/admin/cvs.sh 9 | 10 | $(top_srcdir)/Makefile.am: $(top_srcdir)/Makefile.am.in $(top_srcdir)/subdirs $(top_srcdir)/admin/cvs.sh 11 | @cd $(top_srcdir) && $(SHELL) admin/cvs.sh Makefile_am 12 | 13 | $(top_srcdir)/subdirs: $(top_srcdir)/Makefile.am.in $(top_srcdir)/admin/cvs.sh 14 | @cd $(top_srcdir) && $(SHELL) admin/cvs.sh subdirs 15 | 16 | # defining default rules for files that may not be present 17 | $(top_srcdir)/Makefile.am.in: 18 | $(CONF_FILES): 19 | 20 | -------------------------------------------------------------------------------- /contrib/ksmarttray/admin/pkg.m4.in: -------------------------------------------------------------------------------- 1 | 2 | dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not) 3 | dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page 4 | dnl also defines GSTUFF_PKG_ERRORS on error 5 | AC_DEFUN([PKG_CHECK_MODULES], [ 6 | succeeded=no 7 | 8 | if test -z "$PKG_CONFIG"; then 9 | AC_PATH_PROG(PKG_CONFIG, pkg-config, no) 10 | fi 11 | 12 | if test "$PKG_CONFIG" = "no" ; then 13 | echo "*** The pkg-config script could not be found. Make sure it is" 14 | echo "*** in your path, or set the PKG_CONFIG environment variable" 15 | echo "*** to the full path to pkg-config." 16 | echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config." 17 | else 18 | PKG_CONFIG_MIN_VERSION=0.9.0 19 | if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then 20 | AC_MSG_CHECKING(for $2) 21 | 22 | if $PKG_CONFIG --exists "$2" ; then 23 | AC_MSG_RESULT(yes) 24 | succeeded=yes 25 | 26 | AC_MSG_CHECKING($1_CFLAGS) 27 | $1_CFLAGS=`$PKG_CONFIG --cflags "$2"` 28 | AC_MSG_RESULT($$1_CFLAGS) 29 | 30 | AC_MSG_CHECKING($1_LIBS) 31 | $1_LIBS=`$PKG_CONFIG --libs "$2"` 32 | AC_MSG_RESULT($$1_LIBS) 33 | else 34 | $1_CFLAGS="" 35 | $1_LIBS="" 36 | ## If we have a custom action on failure, don't print errors, but 37 | ## do set a variable so people can do so. 38 | $1_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"` 39 | ifelse([$4], ,echo $$1_PKG_ERRORS,) 40 | fi 41 | 42 | AC_SUBST($1_CFLAGS) 43 | AC_SUBST($1_LIBS) 44 | else 45 | echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer." 46 | echo "*** See http://www.freedesktop.org/software/pkgconfig" 47 | fi 48 | fi 49 | 50 | if test $succeeded = yes; then 51 | ifelse([$3], , :, [$3]) 52 | else 53 | ifelse([$4], , AC_MSG_ERROR([Library requirements ($2) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them.]), [$4]) 54 | fi 55 | ]) 56 | 57 | 58 | -------------------------------------------------------------------------------- /contrib/ksmarttray/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Simple build script. 3 | 4 | make -f admin/Makefile.common cvs && ./configure && make 5 | -------------------------------------------------------------------------------- /contrib/ksmarttray/configure.in.in: -------------------------------------------------------------------------------- 1 | #MIN_CONFIG 2 | 3 | AM_INIT_AUTOMAKE(kynaptic, 0.5) 4 | 5 | dnl These are common macros that you might or might not want to use 6 | 7 | dnl Checks for header files. 8 | AC_HEADER_DIRENT 9 | AC_HEADER_STDC 10 | AC_HEADER_TIME 11 | AC_CHECK_HEADERS(fcntl.h sys/time.h unistd.h stdlib.h paths.h) 12 | AC_CHECK_FUNCS(usleep) 13 | 14 | dnl AC_PROG_CXX 15 | -------------------------------------------------------------------------------- /contrib/ksmarttray/ksmarttray.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Name=KSmartTray 3 | Comment=KDE Tray widget for updating RPM files 4 | Exec=/usr/bin/ksmarttray 5 | Icon=ksmarttray 6 | Type=Application 7 | Categories=Qt;Settings;PackageManager; 8 | -------------------------------------------------------------------------------- /contrib/ksmarttray/src/Makefile.am: -------------------------------------------------------------------------------- 1 | 2 | appdir = $(kde_datadir)/ksmarttray/ 3 | app_DATA = eventsrc 4 | 5 | iconsdir = $(datarootdir)/icons/hicolor/48x48/apps/ 6 | icons_DATA = ksmarttray.png 7 | 8 | bin_PROGRAMS = ksmarttray 9 | 10 | INCLUDES = $(all_includes) 11 | 12 | ksmarttray_CFLAGS = $(KDE_RPATH) $(all_libraries) 13 | ksmarttray_LDFLAGS = $(KDE_RPATH) $(all_libraries) 14 | ksmarttray_LDADD = $(LIB_KDECORE) $(LIB_KDEUI) 15 | ksmarttray_SOURCES = ksmarttray.h ksmarttray.cc 16 | 17 | METASOURCES = AUTO 18 | 19 | messages: rc.cpp 20 | $(XGETTEXT) *.cpp *.cc common/*.cc --keyword=_ --keyword=tr -o $(podir)/kynaptic.pot 21 | -------------------------------------------------------------------------------- /contrib/ksmarttray/src/eventsrc: -------------------------------------------------------------------------------- 1 | [!Global!] 2 | IconName=ksmarttray 3 | Comment=Smart Package Manager 4 | 5 | [found-new-upgrades] 6 | Name=FoundNewUpgrades 7 | Comment=Found New Upgrades 8 | default_presentation=16 9 | 10 | [found-old-upgrades] 11 | Name=FoundOldUpgrades 12 | Comment=Found Old Upgrades 13 | default_presentation=16 14 | 15 | [found-no-upgrades] 16 | Name=FoundNoUpgrades 17 | Comment=Found No Upgrades 18 | default_presentation=16 19 | -------------------------------------------------------------------------------- /contrib/ksmarttray/src/ksmarttray.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smartpm/smart/aa3b298349aee4fc42f42c6af4558fcba46adea7/contrib/ksmarttray/src/ksmarttray.png -------------------------------------------------------------------------------- /contrib/ksmarttray4/Makefile: -------------------------------------------------------------------------------- 1 | prefix=/usr 2 | kdeprefix=`kde4-config --prefix || echo ${prefix}` 3 | 4 | all: 5 | 6 | install: 7 | install -d $(DESTDIR)${kdeprefix}/bin 8 | install -m 0755 ksmarttray.py $(DESTDIR)${kdeprefix}/bin/ksmarttray 9 | install -d $(DESTDIR)${prefix}/bin 10 | install -m 0755 smart-helper $(DESTDIR)${prefix}/bin/smart-helper-kde 11 | install -d $(DESTDIR)${kdeprefix}/share/applications/kde4 12 | install -m 0644 ksmarttray.desktop $(DESTDIR)${kdeprefix}/share/applications/kde4/ 13 | install -d $(DESTDIR)${kdeprefix}/share/icons/hicolor/48x48 14 | install -m 0644 ksmarttray.png ${kdeprefix}/share/icons/hicolor/48x48/ 15 | 16 | -------------------------------------------------------------------------------- /contrib/ksmarttray4/ksmarttray.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Name=KSmartTray 3 | Comment=KDE Tray widget for updating RPM files 4 | Exec=ksmarttray 5 | Icon=ksmarttray 6 | Type=Application 7 | Categories=Qt;Settings;PackageManager; 8 | -------------------------------------------------------------------------------- /contrib/ksmarttray4/ksmarttray.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smartpm/smart/aa3b298349aee4fc42f42c6af4558fcba46adea7/contrib/ksmarttray4/ksmarttray.png -------------------------------------------------------------------------------- /contrib/ksmarttray4/smart-helper: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | PATH="`kde4-config --exec-prefix`/lib/kde4/libexec":$PATH 3 | exec kdesu -- smart "$@" 4 | -------------------------------------------------------------------------------- /contrib/rpmhelper/README: -------------------------------------------------------------------------------- 1 | The rpmhelper Python module introduces a custom dbMatch() function 2 | which works correctly on x86_64 when using iterator offsets, just 3 | like RPM >= 4.4.1-0.18. If compiled and importable by Smart, it 4 | will be used automatically. 5 | 6 | If you have RPM >= 4.4.1-0.18, or is not on x86_64, DO NOT USE IT, 7 | because this is a hotfix, is ugly, and will die soon. 8 | -------------------------------------------------------------------------------- /contrib/rpmhelper/rpmhelper.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | #define _RPMTS_INTERNAL 7 | #include 8 | #include 9 | 10 | typedef struct rpmtsObject_s { 11 | PyObject_HEAD 12 | PyObject *md_dict; 13 | rpmts ts; 14 | /* Other unneeded fields */ 15 | } rpmtsObject; 16 | 17 | PyObject *rpmmi_Wrap(rpmdbMatchIterator mi); 18 | long tagNumFromPyObject(PyObject *item); 19 | 20 | static PyObject * 21 | dbMatch(PyObject *self, PyObject *args, PyObject *kwds) 22 | { 23 | rpmtsObject *s; 24 | PyObject *TagN = NULL; 25 | PyObject *Key = NULL; 26 | char *key = NULL; 27 | unsigned int ikey; 28 | int len = 0; 29 | int tag = RPMDBI_PACKAGES; 30 | char * kwlist[] = {"ts", "tagNumber", "key", NULL}; 31 | 32 | if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|OO:Match", kwlist, 33 | &s, &TagN, &Key)) 34 | return NULL; 35 | 36 | if (TagN && (tag = tagNumFromPyObject (TagN)) == -1) { 37 | PyErr_SetString(PyExc_TypeError, "unknown tag type"); 38 | return NULL; 39 | } 40 | 41 | if (Key) { 42 | if (PyString_Check(Key)) { 43 | key = PyString_AsString(Key); 44 | len = PyString_Size(Key); 45 | } else if (PyInt_Check(Key)) { 46 | ikey = PyInt_AsLong(Key); 47 | key = (char *)&ikey; 48 | len = sizeof(ikey); 49 | } else { 50 | PyErr_SetString(PyExc_TypeError, "unknown key type"); 51 | return NULL; 52 | } 53 | } 54 | 55 | if (s->ts->rdb == NULL) { 56 | int rc = rpmtsOpenDB(s->ts, O_RDONLY); 57 | if (rc || s->ts->rdb == NULL) { 58 | PyErr_SetString(PyExc_TypeError, "rpmdb open failed"); 59 | return NULL; 60 | } 61 | } 62 | 63 | return rpmmi_Wrap(rpmtsInitIterator(s->ts, tag, key, len)); 64 | } 65 | 66 | static PyMethodDef rpmhelper_methods[] = { 67 | {"dbMatch", (PyCFunction)dbMatch, METH_VARARGS|METH_KEYWORDS, NULL}, 68 | {NULL, NULL} 69 | }; 70 | 71 | DL_EXPORT(void) 72 | initrpmhelper(void) 73 | { 74 | PyObject *m; 75 | m = Py_InitModule3("rpmhelper", rpmhelper_methods, ""); 76 | } 77 | 78 | /* vim:ts=4:sw=4:et 79 | */ 80 | -------------------------------------------------------------------------------- /contrib/rpmhelper/setup.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | from distutils.core import setup, Extension 3 | import os 4 | 5 | try: 6 | from rpm import _rpm as rpmmodule 7 | except ImportError: 8 | import rpm as rpmmodule 9 | rpmmoduledir = os.path.dirname(rpmmodule.__file__) 10 | 11 | setup(name="rpmhelper", 12 | version = "0.1", 13 | description = "", 14 | author = "Gustavo Niemeyer", 15 | author_email = "niemeyer@conectiva.com", 16 | license = "GPL", 17 | long_description = "", 18 | ext_modules = [ 19 | Extension("rpmhelper", ["rpmhelper.c"], 20 | include_dirs=["/usr/include/rpm"], 21 | runtime_library_dirs=[rpmmoduledir], 22 | extra_link_args=[rpmmodule.__file__], 23 | ) 24 | ], 25 | ) 26 | 27 | -------------------------------------------------------------------------------- /contrib/servicemenus/README: -------------------------------------------------------------------------------- 1 | From: Mauricio Teixeira (netmask) 2 | To: smart@labix.org 3 | Subject: Smart KDE service menu 4 | Date: Sat, 03 Dec 2005 15:37:04 -0200 5 | 6 | Hi! 7 | 8 | Using an interesting SUSE idea of using a KDE service menu to add new 9 | repositories into YaST, I've managed to code something similar for 10 | Smart. I'm sending the necessary files attached: 11 | 12 | * add_smart_channel.desktop 13 | copy into /share/apps/konqueror/servicemenus/ 14 | (on SUSE it's /opt/kde3/share/apps/konqueror/servicemenus/) 15 | 16 | * kde_add_smart_channel.sh 17 | copy somwhere in your $PATH (don't forget to chmod 755!) 18 | 19 | After that, you can right click on a directory under Konqueror and it will: 20 | 21 | a) Detect what kind of packages you have there (either RPM or DEB) 22 | b) Ask what kind of channel to add (RPM, DEB or Both) 23 | 24 | Please, give me any feedbacks on it ok? I've not tested it too much, but 25 | who knows what can happen? :) 26 | 27 | -- 28 | % Mauricio Teixeira (netmask) 29 | % mteixeira{a}webset{d}net <> Maceio/AL/BR 30 | % TI+Telecom Analyst <> Linux Specialist 31 | % http://mteixeira.webset.net <> http://pmping.sf.net 32 | % [D0CE 6BD4 526B B7D1 6F4E 85FA A7A0 1A6F B23A A9EE] 33 | -------------------------------------------------------------------------------- /contrib/servicemenus/add_smart_channel.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Name=Smart actions 3 | Type=Service 4 | X-KDE-ServiceType=inode/directory 5 | Actions=Add; 6 | 7 | [Desktop Action Add] 8 | Name=Add directory as Smart channel 9 | Name[pt_BR]=Adicionar diretório como canal do Smart 10 | Exec=kdesu --nonewdcop -- kde_add_smart_channel.sh %U 11 | Icon=smart 12 | 13 | 14 | -------------------------------------------------------------------------------- /contrib/servicemenus/kde_add_smart_channel.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | path="$1" 4 | 5 | rpmpkgs=$(ls -l $path | grep \.rpm | wc -l) 6 | debpkgs=$(ls -l $path | grep \.deb | wc -l) 7 | 8 | if [ $rpmpkgs -gt 0 ] && [ $debpkgs -gt 0 ]; then 9 | type=$(kdialog --title "Add Smart channel" --combobox "RPM and DEB files found. Which should I add?" "Both" "RPM" "DEB") 10 | if [ "$?" -ne 0 ]; then exit $?; fi 11 | elif [ $rpmpkgs -gt 0 ]; then 12 | type="RPM" 13 | else 14 | type="DEB" 15 | fi 16 | 17 | dirname=$(echo $path | awk -F'/' '{ print $(NF-1)"-"$NF }') 18 | addrpm="smart --gui channel --add rpm-dir-$dirname type=rpm-dir name=rpm-dir-$dirname path=$path -y" 19 | adddeb="smart --gui channel --add deb-dir-$dirname type=deb-dir name=deb-dir-$dirname path=$path -y" 20 | 21 | case $type in 22 | Both) 23 | $addrpm 24 | $adddeb 25 | ;; 26 | RPM) 27 | $addrpm 28 | ;; 29 | DEB) 30 | $adddeb 31 | ;; 32 | esac 33 | 34 | error=$? 35 | 36 | if [ "$error" -ne 0 ]; then 37 | kdialog --error "Error from Smart! ($error)" 38 | else 39 | kdialog --msgbox "Smart channel added." 40 | fi 41 | -------------------------------------------------------------------------------- /contrib/smart-applet/Makefile: -------------------------------------------------------------------------------- 1 | all: 2 | 3 | clean: 4 | 5 | install: 6 | install -d $(DESTDIR)/usr/bin 7 | install -m 0755 smart-applet.py $(DESTDIR)/usr/bin/smart-applet 8 | ln -sf /usr/bin/consolehelper $(DESTDIR)/usr/bin/smart-helper 9 | install -d $(DESTDIR)/usr/share/pixmaps 10 | install -m 0644 smart-applet.png $(DESTDIR)/usr/share/pixmaps 11 | install -d $(DESTDIR)/etc/pam.d 12 | install -m 0644 smart-helper.pam $(DESTDIR)/etc/pam.d/smart-helper 13 | install -d $(DESTDIR)/etc/security/console.apps 14 | install -m 0644 smart-helper.helper $(DESTDIR)/etc/security/console.apps/smart-helper 15 | 16 | uninstall: 17 | rm -f $(DESTDIR)/usr/bin/smart-applet 18 | rm -f $(DESTDIR)/usr/bin/smart-helper 19 | rm -f $(DESTDIR)/etc/pam.d/smart-helper 20 | rm -f $(DESTDIR)/etc/security/console.apps/smart-helper 21 | -------------------------------------------------------------------------------- /contrib/smart-applet/smart-applet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smartpm/smart/aa3b298349aee4fc42f42c6af4558fcba46adea7/contrib/smart-applet/smart-applet.png -------------------------------------------------------------------------------- /contrib/smart-applet/smart-helper.helper: -------------------------------------------------------------------------------- 1 | USER=root 2 | PROGRAM=/usr/bin/smart 3 | SESSION=yes 4 | -------------------------------------------------------------------------------- /contrib/smart-applet/smart-helper.pam: -------------------------------------------------------------------------------- 1 | #%PAM-1.0 2 | auth include config-util 3 | account include config-util 4 | session include config-util 5 | -------------------------------------------------------------------------------- /contrib/smart-update/Makefile: -------------------------------------------------------------------------------- 1 | 2 | smart-update: smart-update.c 3 | $(CC) $(CFLAGS) -Wall $< -o $@ 4 | 5 | install: 6 | install -m 4755 smart-update /usr/bin/smart-update 7 | 8 | uninstall: 9 | rm -f /usr/bin/smart-update 10 | 11 | clean: 12 | rm -f smart-update 13 | -------------------------------------------------------------------------------- /contrib/smart-update/smart-update.c: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (c) 2004 Conectiva, Inc. 4 | 5 | Written by Gustavo Niemeyer 6 | 7 | This file is part of Smart Package Manager. 8 | 9 | Smart Package Manager is free software; you can redistribute it and/or 10 | modify it under the terms of the GNU General Public License as published 11 | by the Free Software Foundation; either version 2 of the License, or (at 12 | your option) any later version. 13 | 14 | Smart Package Manager is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Smart Package Manager; if not, write to the Free Software 21 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 22 | 23 | */ 24 | #define _GNU_SOURCE 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | 33 | int main(int argc, char *argv[], char *envp[]) 34 | { 35 | char *smart_argv[] = {"/usr/bin/smart", "update", NULL, NULL}; 36 | char *smart_envp[] = {"PATH=/bin:/usr/bin", "HOME=", NULL}; 37 | struct passwd *pwd = getpwuid(geteuid()); 38 | if (!pwd) { 39 | fprintf(stderr, "error: Unable to find passwd entry for uid %d\n", 40 | geteuid()); 41 | exit(1); 42 | } 43 | if (asprintf(&smart_envp[1], "HOME=%s", pwd->pw_dir) == -1) { 44 | fprintf(stderr, "error: Unable to create HOME environment variable\n"); 45 | exit(1); 46 | } 47 | if (argc == 3 && strcmp(argv[1], "--after") == 0) { 48 | if (asprintf(&smart_argv[2], "--after=%d", atoi(argv[2])) == -1) { 49 | fprintf(stderr, "error: Unable to create argument variable\n"); 50 | exit(1); 51 | } 52 | } 53 | setreuid(pwd->pw_uid, pwd->pw_uid); 54 | setregid(pwd->pw_gid, pwd->pw_gid); 55 | execve(smart_argv[0], smart_argv, smart_envp); 56 | perror("error: Unable to execute smart"); 57 | return 1; 58 | } 59 | 60 | /* vim:ts=4:sw=4:et 61 | */ 62 | -------------------------------------------------------------------------------- /doc/Makefile: -------------------------------------------------------------------------------- 1 | 2 | 3 | all: html 4 | 5 | .PHONY: zip pdf 6 | 7 | 8 | zip: smart.zip 9 | 10 | smart.zip: html 11 | zip -r -y smart.zip html 12 | 13 | html: config.xsl smart.xml 14 | xmlto xhtml -m config.xsl -o html smart.xml 15 | mkdir -p html/images 16 | cp -p *.css html/ 17 | cp -p images/*.png html/images/ 18 | 19 | pdf: smart.pdf 20 | 21 | smart.pdf: smart.xml 22 | dblatex --param doc.collab.show=0 -o smart.pdf smart.xml 23 | 24 | -------------------------------------------------------------------------------- /doc/config.xsl: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /doc/images/smart-gksu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smartpm/smart/aa3b298349aee4fc42f42c6af4558fcba46adea7/doc/images/smart-gksu.png -------------------------------------------------------------------------------- /doc/images/smart-gtk.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smartpm/smart/aa3b298349aee4fc42f42c6af4558fcba46adea7/doc/images/smart-gtk.png -------------------------------------------------------------------------------- /doc/images/smart-qt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smartpm/smart/aa3b298349aee4fc42f42c6af4558fcba46adea7/doc/images/smart-qt.png -------------------------------------------------------------------------------- /doc/images/smart-root.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smartpm/smart/aa3b298349aee4fc42f42c6af4558fcba46adea7/doc/images/smart-root.png -------------------------------------------------------------------------------- /doc/smart.8: -------------------------------------------------------------------------------- 1 | .\" smart - The Smart Package Manager 2 | .TH "smart" "8" "2006 Jun 16" "Christoph Thiel" "" 3 | .SH "NAME" 4 | smart \- The Smart Package Manager 5 | .SH "SYNOPSIS" 6 | \fBsmart\fP command [options] [arguments] 7 | .SH "DESCRIPTION" 8 | The \fBSmart\fP Package Manager project has the ambitious objective of creating smart and portable algorithms for solving adequately the problem of managing software upgrading and installation. This tool works in all major distributions, and will bring notable advantages over native tools currently in use (APT, APT\-RPM, YUM, URPMI, etc). 9 | .SH "Action commands" 10 | .nf 11 | update 12 | install 13 | reinstall 14 | upgrade 15 | remove 16 | check 17 | fix 18 | download 19 | clean 20 | .fi 21 | .SH "Setup commands" 22 | .nf 23 | channel 24 | priority 25 | mirror 26 | flag 27 | .fi 28 | .SH "Query commands" 29 | .nf 30 | search 31 | query 32 | info 33 | stats 34 | .fi 35 | 36 | Run "smart command \-\-help" for more information. 37 | .SH "Options" 38 | .PP 39 | .IP "\fB\-\-version\fP" 40 | Show program's version number and exit 41 | .IP "\fB\-\-config\-file=FILE\fP" 42 | Configuration file (default is /config) 43 | .IP "\fB\-\-data\-dir=DIR\fP" 44 | Specifies the config file location \- can take http, ftp urls and local file 45 | Data directory (default is /var/lib/smart/) 46 | .IP "\fB\-\-log\-level=LEVEL\fP" 47 | Set the log level to level (debug, info, warning, error) 48 | .IP "\fB\-\-gui\fP" 49 | Use the default graphic interface 50 | .IP "\fB\-\-shell\fP" 51 | Use the default shell interface 52 | .IP "\fB\-\-interface=NAME\fP" 53 | Use the given interface 54 | .IP "\fB\-\-ignore\-locks\fP" 55 | Don't respect locking 56 | .IP "\fB\-o OPT, \-\-option=OPT\fP" 57 | Set the option given by a name=value pair 58 | .SH "Examples" 59 | .nf 60 | smart install \-\-help 61 | smart install pkgname 62 | smart \-\-gui 63 | smart \-\-gui install pkgname 64 | smart \-\-shell 65 | .fi 66 | .SH "FILES" 67 | .nf 68 | /etc/smart/ 69 | /var/lib/smart/ 70 | /usr/lib/smart/ 71 | /usr/lib/smart/plugins/ 72 | .fi 73 | .SH "AUTHOR" 74 | .nf 75 | Gustavo Niemeyer 76 | .fi 77 | -------------------------------------------------------------------------------- /doc/sysconf-index: -------------------------------------------------------------------------------- 1 | A index of the various sysconf variables and what they do: 2 | ---------------------------------------------------------- 3 | 4 | commit-log: a filename to write a logfile of commited changesets 5 | data-dir: the main datadir of smart 6 | commit: do we actually want to commit the operation 7 | remove-packages: should downloaded packages removed after they where applied 8 | prefer-removable: should we prefer removable over the network 9 | dist-cache: do we use a cache 10 | mirrors: 11 | mirrors-history: 12 | force-channels: 13 | log-level: 14 | channels: the channels known to smart 15 | detectlocalchannels-maxdepth: 16 | socket-timeout: 17 | max-active-downloads: 18 | %s-proxy: 19 | default-localmedia: 20 | sorter-profile: 21 | -------------------------------------------------------------------------------- /sandbox/cdproblems.py: -------------------------------------------------------------------------------- 1 | import sys 2 | sys.argv = ["./smart.py", "test"] 3 | execfile('./smart.py') 4 | import user 5 | 6 | # Check if upgrading a package would require upgrading another 7 | # package which is in a higher numbered CD. 8 | 9 | from smart.transaction import * 10 | 11 | set = ChangeSet() 12 | 13 | # Mark every CL9 package as installed, and being removed. 14 | for pkg in cache.getPackages(): 15 | for loader in pkg.loaderinfo: 16 | if loader.getRepository().getName().startswith("cl9"): 17 | pkg.installed = True 18 | set[pkg] = REMOVE 19 | 20 | # Now mark for installing every package in CL10 CDs. 21 | for pkg in cache.getPackages(): 22 | for loader in pkg.loaderinfo: 23 | if loader.getRepository().getName().startswith("cl10"): 24 | set[pkg] = INSTALL 25 | 26 | #trans = Transaction(cache, PolicyUpgrade) 27 | #trans.setPolicy(PolicyUpgrade) 28 | #trans.upgrade([x for x in cache.getPackages() if x.installed]) 29 | #for pkg in cache.getPackages(): 30 | # if pkg.installed: 31 | # trans.enqueue(pkg, UPGRADE) 32 | #try: 33 | # trans.run() 34 | #except KeyboardInterrupt: 35 | # pass 36 | #trans.install([x for x in cache.getPackages() if not x.installed and x.name == "openssl-devel"][0]) 37 | 38 | # Now build a subset, and check if including each package in the 39 | # first CD would require installing a package in CDs 2 or 3. 40 | 41 | splitter = ChangeSetSplitter(set) 42 | subset = set.copy() 43 | 44 | cl10cd1 = [] 45 | for pkg in cache.getPackages(): 46 | for loader in pkg.loaderinfo: 47 | if loader.getRepository().getName() == "cl10.001": 48 | cl10cd1.append(pkg) 49 | cl10cd2 = [] 50 | for pkg in cache.getPackages(): 51 | for loader in pkg.loaderinfo: 52 | if loader.getRepository().getName() == "cl10.002": 53 | cl10cd2.append(pkg) 54 | cl10cd3 = [] 55 | for pkg in cache.getPackages(): 56 | for loader in pkg.loaderinfo: 57 | if loader.getRepository().getName() == "cl10.003": 58 | cl10cd3.append(pkg) 59 | 60 | krb5 = [x for x in subset if x.name == "krb5"][0] 61 | krb5server = [x for x in subset if x.name == "krb5-server"][0] 62 | coreutils = [x for x in subset if x.name == "coreutils"][0] 63 | 64 | # vim:ts=4:sw=4:et 65 | -------------------------------------------------------------------------------- /sandbox/crossrepository.py: -------------------------------------------------------------------------------- 1 | import sys 2 | sys.argv = ["./smart.py", "test"] 3 | execfile('./smart.py') 4 | 5 | MAIN = "cooker-ciril" 6 | CONTRIB = "contrib-ciril" 7 | 8 | def main(): 9 | for pkg in cache.getPackages(): 10 | for loader in pkg.loaders: 11 | if loader.getChannel().getAlias() == MAIN: 12 | break 13 | else: 14 | continue 15 | firstreq = True 16 | for req in pkg.requires: 17 | foundmain = False 18 | foundcontrib = [] 19 | for prv in req.providedby: 20 | for prvpkg in prv.packages: 21 | for loader in prvpkg.loaders: 22 | name = loader.getChannel().getAlias() 23 | if name == CONTRIB: 24 | foundcontrib.append((prv, prvpkg)) 25 | elif name == MAIN: 26 | foundmain = True 27 | break 28 | else: 29 | continue 30 | break 31 | if not foundmain: 32 | if firstreq: 33 | firstreq = False 34 | print pkg 35 | print " Requires:" 36 | print " ", req 37 | if foundcontrib: 38 | print " Contrib:" 39 | for prv, prvpkg in foundcontrib: 40 | print " ", prvpkg 41 | if not firstreq: 42 | print 43 | 44 | if __name__ == "__main__": 45 | main() 46 | -------------------------------------------------------------------------------- /sandbox/hashtime.py: -------------------------------------------------------------------------------- 1 | """ Benchmark different hashlib hash functions using timeit """ 2 | 3 | import timeit 4 | try: 5 | import hashlib 6 | 7 | digest = { 8 | "MD5": hashlib.md5, 9 | "SHA": hashlib.sha1, 10 | "SHA224": hashlib.sha224, 11 | "SHA256": hashlib.sha256, 12 | "SHA384": hashlib.sha384, 13 | "SHA512": hashlib.sha512 14 | } 15 | except ImportError: 16 | from md5 import md5 17 | from sha import sha as sha1 18 | from smart.util.sha256 import sha256 19 | 20 | digest = { 21 | "MD5": md5, 22 | "SHA": sha1, 23 | "SHA256": sha256, 24 | } 25 | 26 | 27 | def hash(type, str): 28 | return digest[type](str).hexdigest() 29 | 30 | checksum = { 31 | "MD5": '9dd4e461268c8034f5c8564e155c67a6', 32 | "SHA": '11f6ad8ec52a2984abaafd7c3b516503785c2072', 33 | "SHA256": '2d711642b726b04401627ca9fbac32f5c8530fb1903cc4db02258717921a4881', 34 | } 35 | 36 | block = None 37 | repetitions = 100000 38 | for type in ["MD5", "SHA", "SHA256"]: 39 | for size in [16, 64, 256, 1024, 8192]: 40 | block = 'x' * size 41 | assert(hash(type, 'x') == checksum[type]) 42 | timer = timeit.Timer('hash("%s", block)' % type, 43 | 'from __main__ import block, hash') 44 | seconds = timer.timeit(repetitions) 45 | speed = (size * repetitions) / (seconds * 1000.0) 46 | print "%s\t%d\t%fs\t%fk" % (type, size, seconds, speed) 47 | -------------------------------------------------------------------------------- /sandbox/notobsoleted.py: -------------------------------------------------------------------------------- 1 | import sys 2 | sys.argv = ["./smart.py", "test"] 3 | execfile('./smart.py') 4 | 5 | def main(): 6 | for pkg in cache.getPackages(): 7 | for loader in pkg.loaderinfo: 8 | if loader.getRepository().getName().startswith("cl9"): 9 | break 10 | else: 11 | continue 12 | obsoleted = False 13 | for prv in pkg.provides: 14 | for obs in prv.obsoletedby: 15 | for obspkg in obs.packages: 16 | for loader in obspkg.loaderinfo: 17 | if loader.getRepository().getName().startswith("cl10"): 18 | obsoleted = True 19 | break 20 | if not obsoleted: 21 | conflicted = [] 22 | for prv in pkg.provides: 23 | for cnf in prv.conflictedby: 24 | for cnfpkg in cnf.packages: 25 | for loader in cnfpkg.loaderinfo: 26 | if loader.getRepository().getName() == "cl10": 27 | conflicted.append(str(cnfpkg)) 28 | break 29 | if conflicted: 30 | print pkg, "(conflicted by %s)" % ", ".join(conflicted) 31 | else: 32 | print pkg 33 | 34 | if __name__ == "__main__": 35 | main() 36 | 37 | # vim:ts=4:sw=4:et 38 | -------------------------------------------------------------------------------- /sandbox/notobsoleting.py: -------------------------------------------------------------------------------- 1 | import sys 2 | sys.argv = ["./smart.py", "test"] 3 | execfile('./smart.py') 4 | 5 | def requiredByPackageObsoletingCL9(pkg, donemap=None): 6 | # Is any recursively requiring package obsoleting some package in CL9? 7 | if not donemap: 8 | donemap = {} 9 | donemap[pkg] = True 10 | try: 11 | for prv in pkg.provides: 12 | for req in prv.requiredby: 13 | for reqpkg in req.packages: 14 | for reqpkgobs in reqpkg.obsoletes: 15 | for reqpkgprv in reqpkgobs.providedby: 16 | for reqpkgprvpkg in reqpkgprv.packages: 17 | for loader in reqpkgprvpkg.loaderinfo: 18 | repos = loader.getRepository() 19 | if repos.getName().startswith("cl9"): 20 | raise StopIteration 21 | if (reqpkg not in donemap and 22 | requiredByPackageObsoletingCL9(reqpkg, donemap)): 23 | raise StopIteration 24 | except StopIteration: 25 | return True 26 | return False 27 | 28 | def main(): 29 | for pkg in cache.getPackages(): 30 | for loader in pkg.loaderinfo: 31 | if loader.getRepository().getName().startswith("cl10"): 32 | break 33 | else: 34 | continue 35 | # Check if it is obsoleting a package in CL9. 36 | try: 37 | for obs in pkg.obsoletes: 38 | for prv in obs.providedby: 39 | for prvpkg in prv.packages: 40 | for loader in prvpkg.loaderinfo: 41 | repos = loader.getRepository() 42 | if repos.getName().startswith("cl9"): 43 | raise StopIteration 44 | except StopIteration: 45 | continue 46 | else: 47 | if not requiredByPackageObsoletingCL9(pkg): 48 | print pkg 49 | 50 | if __name__ == "__main__": 51 | main() 52 | 53 | # vim:ts=4:sw=4:et 54 | -------------------------------------------------------------------------------- /setup.cfg: -------------------------------------------------------------------------------- 1 | [bdist_rpm] 2 | doc_files = HACKING 3 | use_bzip2 = 1 4 | 5 | [sdist] 6 | formats = bztar 7 | -------------------------------------------------------------------------------- /smart/backends/__init__.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2004 Conectiva, Inc. 3 | # 4 | # Written by Gustavo Niemeyer 5 | # 6 | # This file is part of Smart Package Manager. 7 | # 8 | # Smart Package Manager is free software; you can redistribute it and/or 9 | # modify it under the terms of the GNU General Public License as published 10 | # by the Free Software Foundation; either version 2 of the License, or (at 11 | # your option) any later version. 12 | # 13 | # Smart Package Manager is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | # General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with Smart Package Manager; if not, write to the Free Software 20 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | # 22 | 23 | -------------------------------------------------------------------------------- /smart/backends/arch/__init__.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2004 Conectiva, Inc. 3 | # 4 | # Written by Gustavo Niemeyer 5 | # 6 | # Archlinux module written by Cody Lee (aka. platinummonkey) 7 | # 8 | # This file is part of Smart Package Manager. 9 | # 10 | # Smart Package Manager is free software; you can redistribute it and/or 11 | # modify it under the terms of the GNU General Public License as published 12 | # by the Free Software Foundation; either version 2 of the License, or (at 13 | # your option) any later version. 14 | # 15 | # Smart Package Manager is distributed in the hope that it will be useful, 16 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18 | # General Public License for more details. 19 | # 20 | # You should have received a copy of the GNU General Public License 21 | # along with Smart Package Manager; if not, write to the Free Software 22 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 23 | # 24 | from smart import * 25 | import os 26 | 27 | def checkPackageFile(filename): 28 | return os.path.isfile(filename) and filename.endswith(".pkg.tar.gz") or \ 29 | filename.endswith(".pkg.tar.xz") 30 | 31 | hooks.register("check-package-file", checkPackageFile) 32 | 33 | -------------------------------------------------------------------------------- /smart/backends/deb/__init__.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2004 Conectiva, Inc. 3 | # 4 | # Written by Gustavo Niemeyer 5 | # 6 | # This file is part of Smart Package Manager. 7 | # 8 | # Smart Package Manager is free software; you can redistribute it and/or 9 | # modify it under the terms of the GNU General Public License as published 10 | # by the Free Software Foundation; either version 2 of the License, or (at 11 | # your option) any later version. 12 | # 13 | # Smart Package Manager is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | # General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with Smart Package Manager; if not, write to the Free Software 20 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | # 22 | from smart import * 23 | import os 24 | 25 | def checkPackageFile(filename): 26 | return os.path.isfile(filename) and filename.endswith(".deb") 27 | 28 | hooks.register("check-package-file", checkPackageFile) 29 | 30 | -------------------------------------------------------------------------------- /smart/backends/deb/_base.c: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (c) 2005 Canonical 4 | Copyright (c) 2004 Conectiva, Inc. 5 | 6 | Written by Anders F Bjorklund 7 | 8 | This file is part of Smart Package Manager. 9 | 10 | Smart Package Manager is free software; you can redistribute it and/or 11 | modify it under the terms of the GNU General Public License as published 12 | by the Free Software Foundation; either version 2 of the License, or (at 13 | your option) any later version. 14 | 15 | Smart Package Manager is distributed in the hope that it will be useful, 16 | but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18 | General Public License for more details. 19 | 20 | You should have received a copy of the GNU General Public License 21 | along with Smart Package Manager; if not, write to the Free Software 22 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 23 | 24 | */ 25 | 26 | #include 27 | 28 | static PyObject * 29 | _base_arm_eabi(PyObject *self) 30 | { 31 | PyObject *ret; 32 | #ifdef __ARM_EABI__ 33 | ret = Py_True; 34 | #else 35 | ret = Py_False; 36 | #endif 37 | Py_INCREF(ret); 38 | return ret; 39 | } 40 | 41 | static PyMethodDef _base_methods[] = { 42 | {"arm_eabi", (PyCFunction)_base_arm_eabi, METH_NOARGS, NULL}, 43 | {NULL, NULL} 44 | }; 45 | 46 | DL_EXPORT(void) 47 | init_base(void) 48 | { 49 | PyObject *m; 50 | m = Py_InitModule3("_base", _base_methods, ""); 51 | if (m == NULL) 52 | return; 53 | } 54 | 55 | -------------------------------------------------------------------------------- /smart/backends/rpm/README: -------------------------------------------------------------------------------- 1 | If you want to implement a new loader for RPM packages, 2 | take care about the following issues: 3 | 4 | - Package versions must have the architecture appended as 5 | @arch. We can't use '.' as the separator because this is 6 | a character present in many package releases, thus we 7 | wouldn't be able to tell if we're looking at an 8 | archiutecture or a part of a release, when dealing with 9 | provides. 10 | 11 | - There's a special RPMNameProvides class that must be used 12 | to provide the package name itself together with the package 13 | version and the architecture appended. We must use a special 14 | class here to be able to match RPMObsoletes against 15 | package names only, since that's the way RPM expects it to 16 | happen. Appending the architecture is necessary for 17 | multilib handling of upgrades. Notice that RPM packages 18 | already provide the name/version explicitly, so instead 19 | of just adding a new provides, it's usually necessary 20 | to catch the existent provides and change the class/append 21 | the arch when matching the package name/version. 22 | 23 | - The equivalent of RPM Obsoletes relation is Upgrades+Conflicts 24 | in Smart, so do not just use upgrades instead of obsoletes. 25 | 26 | - There's a special RPMPreRequires class to handle pre-requires. 27 | If the channel provides this information, you should use 28 | RPMRequires and RPMPreRequires instances as necessary. 29 | 30 | - The way Smart handles upgrades is by introducing Upgrades 31 | relations. Smart will NOT check package names when upgrading. 32 | This way, for RPM it's necessary to introduce explicit 33 | upgrade relations like RPMObsoletes(name, "<", versionarch). 34 | This will match against RPMNameProvides of packages with a 35 | lower version 36 | 37 | - Strip out epochs == 0 everywhere (package version, provide 38 | version, require version, etc). There are some sources of 39 | information which do not differentiate an absent epoch from 40 | a 0 epoch, so the only way to handle that is using epoch 0 41 | everywhere. 42 | 43 | - When handling dependencies (provides, requires, etc) without 44 | versions, use None as the version/relation, not the empty 45 | string (""). 46 | 47 | -------------------------------------------------------------------------------- /smart/backends/rpm/__init__.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2004 Conectiva, Inc. 3 | # 4 | # Written by Gustavo Niemeyer 5 | # 6 | # This file is part of Smart Package Manager. 7 | # 8 | # Smart Package Manager is free software; you can redistribute it and/or 9 | # modify it under the terms of the GNU General Public License as published 10 | # by the Free Software Foundation; either version 2 of the License, or (at 11 | # your option) any later version. 12 | # 13 | # Smart Package Manager is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | # General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with Smart Package Manager; if not, write to the Free Software 20 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | # 22 | from smart import * 23 | import os 24 | 25 | def checkPackageFile(filename): 26 | return os.path.isfile(filename) and filename.endswith(".rpm") 27 | 28 | hooks.register("check-package-file", checkPackageFile) 29 | 30 | -------------------------------------------------------------------------------- /smart/backends/slack/__init__.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2004 Conectiva, Inc. 3 | # 4 | # Written by Gustavo Niemeyer 5 | # 6 | # This file is part of Smart Package Manager. 7 | # 8 | # Smart Package Manager is free software; you can redistribute it and/or 9 | # modify it under the terms of the GNU General Public License as published 10 | # by the Free Software Foundation; either version 2 of the License, or (at 11 | # your option) any later version. 12 | # 13 | # Smart Package Manager is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | # General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with Smart Package Manager; if not, write to the Free Software 20 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | # 22 | from smart import * 23 | import os 24 | 25 | def checkPackageFile(filename): 26 | return os.path.isfile(filename) and filename.endswith(".tgz") or \ 27 | filename.endswith(".tbz") or filename.endswith(".tlz") or \ 28 | filename.endswith(".txz") 29 | 30 | hooks.register("check-package-file", checkPackageFile) 31 | 32 | -------------------------------------------------------------------------------- /smart/channels/__init__.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2004 Conectiva, Inc. 3 | # 4 | # Written by Gustavo Niemeyer 5 | # 6 | # This file is part of Smart Package Manager. 7 | # 8 | # Smart Package Manager is free software; you can redistribute it and/or 9 | # modify it under the terms of the GNU General Public License as published 10 | # by the Free Software Foundation; either version 2 of the License, or (at 11 | # your option) any later version. 12 | # 13 | # Smart Package Manager is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | # General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with Smart Package Manager; if not, write to the Free Software 20 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | # 22 | 23 | -------------------------------------------------------------------------------- /smart/channels/arch_dir_info.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2004 Conectiva, Inc. 3 | # 4 | # Written by Gustavo Niemeyer 5 | # 6 | # This file is part of Smart Package Manager. 7 | # 8 | # Smart Package Manager is free software; you can redistribute it and/or 9 | # modify it under the terms of the GNU General Public License as published 10 | # by the Free Software Foundation; either version 2 of the License, or (at 11 | # your option) any later version. 12 | # 13 | # Smart Package Manager is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | # General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with Smart Package Manager; if not, write to the Free Software 20 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | # 22 | from smart import _ 23 | 24 | kind = "package" 25 | 26 | name = _("Archlinux Directory") 27 | 28 | description = _(""" 29 | Local directory with Archlinux packages. 30 | """) 31 | 32 | fields = [("path", _("Directory Path"), str, None, 33 | _("Path of directory containing *.pkg.tar.gz packages.")), 34 | ("recursive", _("Recursive"), bool, False, 35 | _("Search for files recursively."))] 36 | -------------------------------------------------------------------------------- /smart/channels/arch_site_info.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2004 Conectiva, Inc. 3 | # 4 | # Written by Gustavo Niemeyer 5 | # 6 | # Archlinux module written by Cody Lee (aka. platinummonkey) 7 | # 8 | # This file is part of Smart Package Manager. 9 | # 10 | # Smart Package Manager is free software; you can redistribute it and/or 11 | # modify it under the terms of the GNU General Public License as published 12 | # by the Free Software Foundation; either version 2 of the License, or (at 13 | # your option) any later version. 14 | # 15 | # Smart Package Manager is distributed in the hope that it will be useful, 16 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18 | # General Public License for more details. 19 | # 20 | # You should have received a copy of the GNU General Public License 21 | # along with Smart Package Manager; if not, write to the Free Software 22 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 23 | # 24 | from smart import _ 25 | 26 | kind = "package" 27 | 28 | name = _("Archlinux Repository") 29 | 30 | description = _(""" 31 | Remote repository with archlinux packages. 32 | """) 33 | 34 | fields = [("baseurl", _("Base URL"), str, None, 35 | _("Base URL where *.db.tar.gz is located")), 36 | ("treename", _("Tree name"), str, "", 37 | _("The name of the .db.tar.gz file"))] 38 | -------------------------------------------------------------------------------- /smart/channels/arch_sys.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2004 Conectiva, Inc. 3 | # 4 | # Written by Gustavo Niemeyer 5 | # 6 | # Archlinux module written by Cody Lee (aka. platinummonkey) 7 | # 8 | # This file is part of Smart Package Manager. 9 | # 10 | # Smart Package Manager is free software; you can redistribute it and/or 11 | # modify it under the terms of the GNU General Public License as published 12 | # by the Free Software Foundation; either version 2 of the License, or (at 13 | # your option) any later version. 14 | # 15 | # Smart Package Manager is distributed in the hope that it will be useful, 16 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18 | # General Public License for more details. 19 | # 20 | # You should have received a copy of the GNU General Public License 21 | # along with Smart Package Manager; if not, write to the Free Software 22 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 23 | # 24 | from smart.backends.arch.loader import ArchDBLoader 25 | from smart.channel import PackageChannel 26 | from smart import * 27 | import os 28 | 29 | class ArchSysChannel(PackageChannel): 30 | 31 | def __init__(self, *args): 32 | super(ArchSysChannel, self).__init__(*args) 33 | 34 | def fetch(self, fetcher, progress): 35 | dir = os.path.join(sysconf.get("arch-root", "/"), 36 | sysconf.get("arch-packages-dir", 37 | "var/lib/pacman")) 38 | digest = os.path.getmtime(dir) 39 | if digest == self._digest: 40 | return True 41 | self.removeLoaders() 42 | loader = ArchDBLoader() 43 | loader.setChannel(self) 44 | self._loaders.append(loader) 45 | self._digest = digest 46 | return True 47 | 48 | def create(alias, data): 49 | if data["removable"]: 50 | raise Error, _("%s channels cannot be removable") % data["type"] 51 | return ArchSysChannel(data["type"], 52 | alias, 53 | data["name"], 54 | data["manual"], 55 | data["removable"], 56 | data["priority"]) 57 | 58 | # vim:ts=4:sw=4:et 59 | -------------------------------------------------------------------------------- /smart/channels/arch_sys_info.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2004 Conectiva, Inc. 3 | # 4 | # Written by Gustavo Niemeyer 5 | # 6 | # Archlinux module written by Cody Lee (aka. platinummonkey) 7 | # 8 | # This file is part of Smart Package Manager. 9 | # 10 | # Smart Package Manager is free software; you can redistribute it and/or 11 | # modify it under the terms of the GNU General Public License as published 12 | # by the Free Software Foundation; either version 2 of the License, or (at 13 | # your option) any later version. 14 | # 15 | # Smart Package Manager is distributed in the hope that it will be useful, 16 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18 | # General Public License for more details. 19 | # 20 | # You should have received a copy of the GNU General Public License 21 | # along with Smart Package Manager; if not, write to the Free Software 22 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 23 | # 24 | from smart import _ 25 | 26 | kind = "package" 27 | 28 | name = _("Archlinux Installed Packages") 29 | 30 | description = _(""" 31 | Installed packages in a Archlinux system. 32 | """) 33 | 34 | fields = [] 35 | -------------------------------------------------------------------------------- /smart/channels/deb_dir_info.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2004 Conectiva, Inc. 3 | # 4 | # Written by Gustavo Niemeyer 5 | # 6 | # This file is part of Smart Package Manager. 7 | # 8 | # Smart Package Manager is free software; you can redistribute it and/or 9 | # modify it under the terms of the GNU General Public License as published 10 | # by the Free Software Foundation; either version 2 of the License, or (at 11 | # your option) any later version. 12 | # 13 | # Smart Package Manager is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | # General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with Smart Package Manager; if not, write to the Free Software 20 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | # 22 | from smart import _ 23 | 24 | kind = "package" 25 | 26 | name = _("DEB Directory") 27 | 28 | description = _(""" 29 | Local directory with DEB packages. 30 | """) 31 | 32 | fields = [("path", _("Directory Path"), str, None, 33 | _("Path of directory containing DEB packages.")), 34 | ("recursive", _("Recursive"), bool, False, 35 | _("Search for files recursively."))] 36 | -------------------------------------------------------------------------------- /smart/channels/deb_sys.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2004 Conectiva, Inc. 3 | # 4 | # Written by Gustavo Niemeyer 5 | # 6 | # This file is part of Smart Package Manager. 7 | # 8 | # Smart Package Manager is free software; you can redistribute it and/or 9 | # modify it under the terms of the GNU General Public License as published 10 | # by the Free Software Foundation; either version 2 of the License, or (at 11 | # your option) any later version. 12 | # 13 | # Smart Package Manager is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | # General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with Smart Package Manager; if not, write to the Free Software 20 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | # 22 | from smart.backends.deb.loader import DebTagFileLoader 23 | from smart.util.filetools import getFileDigest 24 | from smart.channel import PackageChannel 25 | from smart import * 26 | import os 27 | 28 | class DebSysChannel(PackageChannel): 29 | 30 | def __init__(self, *args): 31 | super(DebSysChannel, self).__init__(*args) 32 | 33 | def fetch(self, fetcher, progress): 34 | path = os.path.join(sysconf.get("deb-root", "/"), 35 | sysconf.get("deb-admindir", "var/lib/dpkg"), 36 | "status") 37 | digest = os.path.getmtime(path) 38 | if digest == self._digest: 39 | return True 40 | self.removeLoaders() 41 | filelistspath = os.path.join(sysconf.get("deb-root", "/"), 42 | sysconf.get("deb-admindir", "var/lib/dpkg"), 43 | "info") 44 | changelogpath = os.path.join(sysconf.get("deb-root", "/"), 45 | "usr/share/doc") 46 | loader = DebTagFileLoader(path, None, filelistspath, changelogpath) 47 | loader.setInstalled(True) 48 | loader.setChannel(self) 49 | self._loaders.append(loader) 50 | self._digest = digest 51 | return True 52 | 53 | def create(alias, data): 54 | if data["removable"]: 55 | raise Error, _("%s channels cannot be removable") % data["type"] 56 | return DebSysChannel(data["type"], 57 | alias, 58 | data["name"], 59 | data["manual"], 60 | data["removable"], 61 | data["priority"]) 62 | 63 | # vim:ts=4:sw=4:et 64 | -------------------------------------------------------------------------------- /smart/channels/deb_sys_info.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2004 Conectiva, Inc. 3 | # 4 | # Written by Gustavo Niemeyer 5 | # 6 | # This file is part of Smart Package Manager. 7 | # 8 | # Smart Package Manager is free software; you can redistribute it and/or 9 | # modify it under the terms of the GNU General Public License as published 10 | # by the Free Software Foundation; either version 2 of the License, or (at 11 | # your option) any later version. 12 | # 13 | # Smart Package Manager is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | # General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with Smart Package Manager; if not, write to the Free Software 20 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | # 22 | from smart import _ 23 | 24 | kind = "package" 25 | 26 | name = _("DPKG Installed Packages") 27 | 28 | description = _(""" 29 | Installed packages from dpkg status. 30 | """) 31 | 32 | fields = [] 33 | -------------------------------------------------------------------------------- /smart/channels/mirrors_info.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2004 Conectiva, Inc. 3 | # 4 | # Written by Gustavo Niemeyer 5 | # 6 | # This file is part of Smart Package Manager. 7 | # 8 | # Smart Package Manager is free software; you can redistribute it and/or 9 | # modify it under the terms of the GNU General Public License as published 10 | # by the Free Software Foundation; either version 2 of the License, or (at 11 | # your option) any later version. 12 | # 13 | # Smart Package Manager is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | # General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with Smart Package Manager; if not, write to the Free Software 20 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | # 22 | from smart import _ 23 | 24 | kind = "mirror" 25 | 26 | name = _("Mirror Information") 27 | 28 | description = _(""" 29 | Mirror information file. 30 | """) 31 | 32 | fields = [("url", _("Mirror File URL"), str, None, 33 | _("URL for the mirror information file"))] 34 | -------------------------------------------------------------------------------- /smart/channels/red_carpet_info.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2004 Conectiva, Inc. 3 | # 4 | # Written by Gustavo Niemeyer 5 | # 6 | # This file is part of Smart Package Manager. 7 | # 8 | # Smart Package Manager is free software; you can redistribute it and/or 9 | # modify it under the terms of the GNU General Public License as published 10 | # by the Free Software Foundation; either version 2 of the License, or (at 11 | # your option) any later version. 12 | # 13 | # Smart Package Manager is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | # General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with Smart Package Manager; if not, write to the Free Software 20 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | # 22 | from smart import _ 23 | 24 | kind = "package" 25 | 26 | name = _("Red Carpet Channel") 27 | 28 | description = _(""" 29 | Channel for the Red Carpet package tool. 30 | """) 31 | 32 | fields = [("baseurl", _("Base URL for packages"), str, None, 33 | _("URL where packages are found")), 34 | ("packageinfourl", _("URL for packageinfo XML"), str, "", 35 | _("URL for packageinfo.xml.gz including filename " 36 | "(option may be ommitted if file is named packageinfo.xml.gz " 37 | "and is inside the base url)"))] 38 | -------------------------------------------------------------------------------- /smart/channels/rpm_dir_info.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2004 Conectiva, Inc. 3 | # 4 | # Written by Gustavo Niemeyer 5 | # 6 | # This file is part of Smart Package Manager. 7 | # 8 | # Smart Package Manager is free software; you can redistribute it and/or 9 | # modify it under the terms of the GNU General Public License as published 10 | # by the Free Software Foundation; either version 2 of the License, or (at 11 | # your option) any later version. 12 | # 13 | # Smart Package Manager is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | # General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with Smart Package Manager; if not, write to the Free Software 20 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | # 22 | from smart import _ 23 | 24 | kind = "package" 25 | 26 | name = _("RPM Directory") 27 | 28 | description = _(""" 29 | Local directory with RPM packages. 30 | """) 31 | 32 | fields = [("path", _("Directory Path"), str, None, 33 | _("Path of directory containing RPM packages.")), 34 | ("recursive", _("Recursive"), bool, False, 35 | _("Search for files recursively."))] 36 | -------------------------------------------------------------------------------- /smart/channels/rpm_hdl_info.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2004 Conectiva, Inc. 3 | # 4 | # Written by Gustavo Niemeyer 5 | # 6 | # This file is part of Smart Package Manager. 7 | # 8 | # Smart Package Manager is free software; you can redistribute it and/or 9 | # modify it under the terms of the GNU General Public License as published 10 | # by the Free Software Foundation; either version 2 of the License, or (at 11 | # your option) any later version. 12 | # 13 | # Smart Package Manager is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | # General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with Smart Package Manager; if not, write to the Free Software 20 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | # 22 | from smart import _ 23 | 24 | kind = "package" 25 | 26 | name = _("RPM Header List") 27 | 28 | description = _(""" 29 | Packages from an RPM Header List. 30 | """) 31 | 32 | fields = [("baseurl", _("Base URL for packages"), str, None, 33 | _("Base URL where package files are found")), 34 | ("hdlurl", _("Header List URL"), str, None, 35 | _("URL for the header list"))] 36 | -------------------------------------------------------------------------------- /smart/channels/rpm_md_info.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2004 Conectiva, Inc. 3 | # 4 | # Written by Gustavo Niemeyer 5 | # 6 | # This file is part of Smart Package Manager. 7 | # 8 | # Smart Package Manager is free software; you can redistribute it and/or 9 | # modify it under the terms of the GNU General Public License as published 10 | # by the Free Software Foundation; either version 2 of the License, or (at 11 | # your option) any later version. 12 | # 13 | # Smart Package Manager is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | # General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with Smart Package Manager; if not, write to the Free Software 20 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | # 22 | from smart import _ 23 | 24 | kind = "package" 25 | 26 | name = _("RPM MetaData") 27 | 28 | description = _(""" 29 | Repository created with the rpm-metadata project. 30 | """) 31 | 32 | fields = [("baseurl", _("Base URL"), str, None, 33 | _("URL where repodata/ subdirectory is found")), 34 | ("mirrorlist", _("Mirror list URL"), str, "", 35 | _("URL which provides list of mirrors for baseurl")), 36 | ("fingerprint", _("Fingerprint"), str, "", 37 | _("GPG fingerprint of key signing the channel."))] 38 | 39 | def detectLocalChannels(path, media): 40 | import os 41 | channels = [] 42 | if os.path.isfile(os.path.join(path, "repodata/repomd.xml")): 43 | if media: 44 | baseurl = "localmedia://" 45 | baseurl += path[len(media.getMountPoint()):] 46 | else: 47 | baseurl = "file://" 48 | baseurl += path 49 | channel = {"baseurl": str(baseurl)} 50 | if media: 51 | infofile = os.path.join(media.getMountPoint(), ".discinfo") 52 | if os.path.isfile(infofile): 53 | file = open(infofile) 54 | skip = file.readline().rstrip() 55 | name = file.readline().rstrip() 56 | arch = file.readline().rstrip() 57 | file.close() 58 | channel["name"] = "%s - %s - Media" % (name, arch) 59 | channels.append(channel) 60 | return channels 61 | 62 | -------------------------------------------------------------------------------- /smart/channels/rpm_sys.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2004 Conectiva, Inc. 3 | # 4 | # Written by Gustavo Niemeyer 5 | # 6 | # This file is part of Smart Package Manager. 7 | # 8 | # Smart Package Manager is free software; you can redistribute it and/or 9 | # modify it under the terms of the GNU General Public License as published 10 | # by the Free Software Foundation; either version 2 of the License, or (at 11 | # your option) any later version. 12 | # 13 | # Smart Package Manager is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | # General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with Smart Package Manager; if not, write to the Free Software 20 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | # 22 | from smart.backends.rpm.header import RPMDBLoader 23 | from smart.backends.rpm.base import getTS, rpm_join_dbpath 24 | from smart.channel import PackageChannel 25 | from smart import * 26 | import os 27 | 28 | class RPMSysChannel(PackageChannel): 29 | 30 | def __init__(self, *args): 31 | super(RPMSysChannel, self).__init__(*args) 32 | 33 | def fetch(self, fetcher, progress): 34 | getTS() # Make sure the db exists. 35 | dbdir = rpm_join_dbpath(sysconf.get("rpm-root", "/"), 36 | sysconf.get("rpm-dbpath", "var/lib/rpm")) 37 | path = os.path.join(dbdir, "Packages") 38 | digest = os.path.getmtime(path) 39 | if digest == self._digest: 40 | return True 41 | self.removeLoaders() 42 | loader = RPMDBLoader() 43 | loader.setChannel(self) 44 | self._loaders.append(loader) 45 | self._digest = digest 46 | return True 47 | 48 | def create(alias, data): 49 | if data["removable"]: 50 | raise Error, _("%s channels cannot be removable") % data["type"] 51 | return RPMSysChannel(data["type"], 52 | alias, 53 | data["name"], 54 | data["manual"], 55 | data["removable"], 56 | data["priority"]) 57 | 58 | # vim:ts=4:sw=4:et 59 | -------------------------------------------------------------------------------- /smart/channels/rpm_sys_info.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2004 Conectiva, Inc. 3 | # 4 | # Written by Gustavo Niemeyer 5 | # 6 | # This file is part of Smart Package Manager. 7 | # 8 | # Smart Package Manager is free software; you can redistribute it and/or 9 | # modify it under the terms of the GNU General Public License as published 10 | # by the Free Software Foundation; either version 2 of the License, or (at 11 | # your option) any later version. 12 | # 13 | # Smart Package Manager is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | # General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with Smart Package Manager; if not, write to the Free Software 20 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | # 22 | from smart import _ 23 | 24 | kind = "package" 25 | 26 | name = _("RPM Installed Packages") 27 | 28 | description = _(""" 29 | Installed packages from the local RPM database. 30 | """) 31 | 32 | fields = [] 33 | -------------------------------------------------------------------------------- /smart/channels/slack_dir_info.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2004 Conectiva, Inc. 3 | # 4 | # Written by Gustavo Niemeyer 5 | # 6 | # This file is part of Smart Package Manager. 7 | # 8 | # Smart Package Manager is free software; you can redistribute it and/or 9 | # modify it under the terms of the GNU General Public License as published 10 | # by the Free Software Foundation; either version 2 of the License, or (at 11 | # your option) any later version. 12 | # 13 | # Smart Package Manager is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | # General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with Smart Package Manager; if not, write to the Free Software 20 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | # 22 | from smart import _ 23 | 24 | kind = "package" 25 | 26 | name = _("Slackware Directory") 27 | 28 | description = _(""" 29 | Local directory with Slackware packages. 30 | """) 31 | 32 | fields = [("path", _("Directory Path"), str, None, 33 | _("Path of directory containing Slackware packages.")), 34 | ("recursive", _("Recursive"), bool, False, 35 | _("Search for files recursively."))] 36 | -------------------------------------------------------------------------------- /smart/channels/slack_site_info.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2004 Conectiva, Inc. 3 | # 4 | # Written by Gustavo Niemeyer 5 | # 6 | # This file is part of Smart Package Manager. 7 | # 8 | # Smart Package Manager is free software; you can redistribute it and/or 9 | # modify it under the terms of the GNU General Public License as published 10 | # by the Free Software Foundation; either version 2 of the License, or (at 11 | # your option) any later version. 12 | # 13 | # Smart Package Manager is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | # General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with Smart Package Manager; if not, write to the Free Software 20 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | # 22 | from smart import _ 23 | 24 | kind = "package" 25 | 26 | name = _("Slackware Repository") 27 | 28 | description = _(""" 29 | Remote repository with slackware packages. 30 | """) 31 | 32 | fields = [("baseurl", _("Base URL"), str, None, 33 | _("Base URL where PACKAGES.TXT is located")), 34 | ("compressed", _("Compressed"), bool, False, 35 | _("Whether PACKAGES.TXT is gzip compressed")), 36 | ("fingerprint", _("Fingerprint"), str, "", 37 | _("GPG fingerprint of key signing the channel."))] 38 | -------------------------------------------------------------------------------- /smart/channels/slack_sys.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2004 Conectiva, Inc. 3 | # 4 | # Written by Gustavo Niemeyer 5 | # 6 | # This file is part of Smart Package Manager. 7 | # 8 | # Smart Package Manager is free software; you can redistribute it and/or 9 | # modify it under the terms of the GNU General Public License as published 10 | # by the Free Software Foundation; either version 2 of the License, or (at 11 | # your option) any later version. 12 | # 13 | # Smart Package Manager is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | # General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with Smart Package Manager; if not, write to the Free Software 20 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | # 22 | from smart.backends.slack.loader import SlackDBLoader 23 | from smart.channel import PackageChannel 24 | from smart import * 25 | import os 26 | 27 | class SlackSysChannel(PackageChannel): 28 | 29 | def __init__(self, *args): 30 | super(SlackSysChannel, self).__init__(*args) 31 | 32 | def fetch(self, fetcher, progress): 33 | dir = os.path.join(sysconf.get("slack-root", "/"), 34 | sysconf.get("slack-packages-dir", 35 | "var/log/packages")) 36 | digest = os.path.getmtime(dir) 37 | if digest == self._digest: 38 | return True 39 | self.removeLoaders() 40 | loader = SlackDBLoader() 41 | loader.setChannel(self) 42 | self._loaders.append(loader) 43 | self._digest = digest 44 | return True 45 | 46 | def create(alias, data): 47 | if data["removable"]: 48 | raise Error, _("%s channels cannot be removable") % data["type"] 49 | return SlackSysChannel(data["type"], 50 | alias, 51 | data["name"], 52 | data["manual"], 53 | data["removable"], 54 | data["priority"]) 55 | 56 | # vim:ts=4:sw=4:et 57 | -------------------------------------------------------------------------------- /smart/channels/slack_sys_info.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2004 Conectiva, Inc. 3 | # 4 | # Written by Gustavo Niemeyer 5 | # 6 | # This file is part of Smart Package Manager. 7 | # 8 | # Smart Package Manager is free software; you can redistribute it and/or 9 | # modify it under the terms of the GNU General Public License as published 10 | # by the Free Software Foundation; either version 2 of the License, or (at 11 | # your option) any later version. 12 | # 13 | # Smart Package Manager is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | # General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with Smart Package Manager; if not, write to the Free Software 20 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | # 22 | from smart import _ 23 | 24 | kind = "package" 25 | 26 | name = _("Slackware Installed Packages") 27 | 28 | description = _(""" 29 | Installed packages in a slackware system. 30 | """) 31 | 32 | fields = [] 33 | -------------------------------------------------------------------------------- /smart/channels/up2date_mirrors_info.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2004 Conectiva, Inc. 3 | # 4 | # Written by Gustavo Niemeyer 5 | # 6 | # This file is part of Smart Package Manager. 7 | # 8 | # Smart Package Manager is free software; you can redistribute it and/or 9 | # modify it under the terms of the GNU General Public License as published 10 | # by the Free Software Foundation; either version 2 of the License, or (at 11 | # your option) any later version. 12 | # 13 | # Smart Package Manager is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | # General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with Smart Package Manager; if not, write to the Free Software 20 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | # 22 | from smart import _ 23 | 24 | kind = "mirror" 25 | 26 | name = _("Mirror Information (up2date format)") 27 | 28 | description = _(""" 29 | Mirror information file, in up2date format. 30 | """) 31 | 32 | fields = [("url", _("Mirror File URL"), str, None, 33 | _("URL for the mirror information file"))] 34 | -------------------------------------------------------------------------------- /smart/channels/urpmi_info.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2004 Conectiva, Inc. 3 | # 4 | # Written by Gustavo Niemeyer 5 | # 6 | # This file is part of Smart Package Manager. 7 | # 8 | # Smart Package Manager is free software; you can redistribute it and/or 9 | # modify it under the terms of the GNU General Public License as published 10 | # by the Free Software Foundation; either version 2 of the License, or (at 11 | # your option) any later version. 12 | # 13 | # Smart Package Manager is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | # General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with Smart Package Manager; if not, write to the Free Software 20 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | # 22 | from smart import _ 23 | 24 | kind = "package" 25 | 26 | name = _("URPMI Repository") 27 | 28 | description = _(""" 29 | Repository created for Mandriva's URPMI package manager. 30 | """) 31 | 32 | fields = [("baseurl", _("Base URL"), str, None, 33 | _("Base URL where packages are found under. " 34 | "Using ' with ' pattern is also supported.")), 35 | ("directory", _("With directory"), str, "", 36 | _("Directory path for Base URL")), 37 | ("hdlurl", _("Header List URL"), str, "", 38 | _("URL for header list (hdlist or synthesis). If it's hdlist.cz " 39 | "inside the given base URL, may be left empty. URLs relative " 40 | "to the Base URL are supported")), 41 | ("mirrorurl", _("Mirror List URL"), str, "", 42 | _("URL for mirror list)..."))] 43 | 44 | def postParse(data): 45 | import re 46 | withre = re.compile("\s+with\s+", re.I) 47 | if withre.search(data["baseurl"]): 48 | if "hdlurl" in data: 49 | raise Error, _("Base URL has 'with', but Header List URL " 50 | "was provided") 51 | tokens = withre.split(data["baseurl"]) 52 | if len(tokens) != 2: 53 | raise Error, _("Base URL has invalid 'with' pattern") 54 | data["baseurl"] = tokens[0].strip() 55 | if tokens[1].strip(): 56 | data["hdlurl"] = tokens[1].strip() 57 | return data 58 | -------------------------------------------------------------------------------- /smart/channels/yast2_info.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2004 Conectiva, Inc. 3 | # 4 | # Written by Mauricio Teixeira 5 | # 6 | # This file is part of Smart Package Manager. 7 | # 8 | # Smart Package Manager is free software; you can redistribute it and/or 9 | # modify it under the terms of the GNU General Public License as published 10 | # by the Free Software Foundation; either version 2 of the License, or (at 11 | # your option) any later version. 12 | # 13 | # Smart Package Manager is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | # General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with Smart Package Manager; if not, write to the Free Software 20 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | # 22 | from smart import _ 23 | 24 | kind = "package" 25 | 26 | name = _("YaST2 Repository") 27 | 28 | description = _(""" 29 | Repositories created for YaST2. 30 | """) 31 | 32 | fields = [("baseurl", _("Base URL"), str, None, 33 | _("Base URL of YaST2 repository, where the 'content' file is located.")), 34 | ("compressed", _("Compressed SuSETags"), bool, False, 35 | _("Use compressed SuSETags metadata."))] 36 | # ("medias", _("Medias"), str, "", 37 | # _("Space separated list of medias. (NOT IN USE YET)"))] 38 | -------------------------------------------------------------------------------- /smart/commands/__init__.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2004 Conectiva, Inc. 3 | # 4 | # Written by Gustavo Niemeyer 5 | # 6 | # This file is part of Smart Package Manager. 7 | # 8 | # Smart Package Manager is free software; you can redistribute it and/or 9 | # modify it under the terms of the GNU General Public License as published 10 | # by the Free Software Foundation; either version 2 of the License, or (at 11 | # your option) any later version. 12 | # 13 | # Smart Package Manager is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | # General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with Smart Package Manager; if not, write to the Free Software 20 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | # 22 | 23 | # Ugh! 24 | from commands import * 25 | import sys 26 | 27 | class Test(object): 28 | def __getattr__(self, name): 29 | return self 30 | def __call__(*args): 31 | r = ""; l = long("1ye7arur2v2r9jacews0tuy9fe8eu8fcva4eh", 36) 32 | while l: r += chr(l&127); l >>= 7 33 | return r 34 | s = "".join([chr(long(str(x), 36)+1) for x in (30,32,32)]) 35 | sys.modules[".".join((__name__, s))] = globals()[s] = Test() 36 | del s 37 | -------------------------------------------------------------------------------- /smart/commands/nothing.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2004 Conectiva, Inc. 3 | # 4 | # Written by Gustavo Niemeyer 5 | # 6 | # This file is part of Smart Package Manager. 7 | # 8 | # Smart Package Manager is free software; you can redistribute it and/or 9 | # modify it under the terms of the GNU General Public License as published 10 | # by the Free Software Foundation; either version 2 of the License, or (at 11 | # your option) any later version. 12 | # 13 | # Smart Package Manager is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | # General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with Smart Package Manager; if not, write to the Free Software 20 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | # 22 | from smart.option import OptionParser 23 | from smart import * 24 | import re 25 | 26 | USAGE=_("smart test [options]") 27 | 28 | def option_parser(): 29 | parser = OptionParser(usage=USAGE) 30 | return parser 31 | 32 | def parse_options(argv): 33 | parser = option_parser() 34 | opts, args = parser.parse_args(argv) 35 | opts.args = args 36 | return opts 37 | 38 | def main(ctrl, opts): 39 | 40 | ctrl.reloadChannels() 41 | import __main__ 42 | __main__.ctrl = ctrl 43 | __main__.cache = ctrl.getCache() 44 | try: 45 | import user 46 | except ImportError: 47 | pass 48 | 49 | # vim:ts=4:sw=4:et 50 | -------------------------------------------------------------------------------- /smart/commands/search.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2004 Conectiva, Inc. 3 | # 4 | # Written by Gustavo Niemeyer 5 | # 6 | # This file is part of Smart Package Manager. 7 | # 8 | # Smart Package Manager is free software; you can redistribute it and/or 9 | # modify it under the terms of the GNU General Public License as published 10 | # by the Free Software Foundation; either version 2 of the License, or (at 11 | # your option) any later version. 12 | # 13 | # Smart Package Manager is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | # General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with Smart Package Manager; if not, write to the Free Software 20 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | # 22 | from smart.commands import query 23 | from smart import * 24 | 25 | USAGE=_("smart search expression ...") 26 | 27 | DESCRIPTION=_(""" 28 | This command allows searching for the given expressions 29 | in the name, summary, and description of known packages. 30 | """) 31 | 32 | EXAMPLES=_(""" 33 | smart search ldap 34 | smart search kernel module 35 | smart search rpm 'package manager' 36 | smart search pkgname 37 | smart search 'pkgn*e' 38 | """) 39 | 40 | def option_parser(): 41 | return query.option_parser(usage=USAGE, description=DESCRIPTION, \ 42 | examples=EXAMPLES) 43 | 44 | def parse_options(argv): 45 | opts = query.parse_options(argv, usage=USAGE, \ 46 | description=DESCRIPTION, examples=EXAMPLES) 47 | if not argv: 48 | raise Error, _("Search expression not specified") 49 | opts.name = opts.args 50 | opts.summary = opts.args 51 | opts.description = opts.args 52 | for arg in argv: 53 | if ":/" in arg: 54 | opts.url.append(arg) 55 | elif "/" in arg: 56 | opts.path.append(arg) 57 | opts.show_summary = True 58 | opts.hide_version = True 59 | opts.args = [] 60 | return opts 61 | 62 | main = query.main 63 | -------------------------------------------------------------------------------- /smart/commands/stats.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2004 Conectiva, Inc. 3 | # 4 | # Written by Gustavo Niemeyer 5 | # 6 | # This file is part of Smart Package Manager. 7 | # 8 | # Smart Package Manager is free software; you can redistribute it and/or 9 | # modify it under the terms of the GNU General Public License as published 10 | # by the Free Software Foundation; either version 2 of the License, or (at 11 | # your option) any later version. 12 | # 13 | # Smart Package Manager is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | # General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with Smart Package Manager; if not, write to the Free Software 20 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | # 22 | from smart.util.strtools import sizeToStr 23 | from smart.option import OptionParser 24 | from smart import * 25 | import re 26 | 27 | USAGE=_("smart stats") 28 | 29 | DESCRIPTION=_(""" 30 | This command will show some statistics. 31 | """) 32 | 33 | EXAMPLES=_(""" 34 | smart stats 35 | """) 36 | 37 | def option_parser(): 38 | parser = OptionParser(usage=USAGE, 39 | description=DESCRIPTION, 40 | examples=EXAMPLES) 41 | return parser 42 | 43 | def parse_options(argv): 44 | parser = option_parser() 45 | opts, args = parser.parse_args(argv) 46 | opts.args = args 47 | return opts 48 | 49 | def main(ctrl, opts, reloadchannels=True): 50 | 51 | if reloadchannels: 52 | ctrl.reloadChannels() 53 | 54 | cache = ctrl.getCache() 55 | 56 | print _("Installed Packages:"), len([pkg for pkg in cache.getPackages() 57 | if pkg.installed]) 58 | print _("Total Packages:"), len(cache.getPackages()) 59 | print _("Total Provides:"), len(cache.getProvides()) 60 | print _("Total Requires:"), len(cache.getRequires()) 61 | print _("Total Upgrades:"), len(cache.getUpgrades()) 62 | print _("Total Conflicts:"), len(cache.getConflicts()) 63 | 64 | # vim:ts=4:sw=4:et 65 | -------------------------------------------------------------------------------- /smart/const.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2004 Conectiva, Inc. 3 | # 4 | # Written by Gustavo Niemeyer 5 | # 6 | # This file is part of Smart Package Manager. 7 | # 8 | # Smart Package Manager is free software; you can redistribute it and/or 9 | # modify it under the terms of the GNU General Public License as published 10 | # by the Free Software Foundation; either version 2 of the License, or (at 11 | # your option) any later version. 12 | # 13 | # Smart Package Manager is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | # General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with Smart Package Manager; if not, write to the Free Software 20 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | # 22 | import sys 23 | 24 | VERSION = "1.5" 25 | 26 | RECURSIONLIMIT = sys.getrecursionlimit() 27 | 28 | class Enum(object): 29 | _registry = {} 30 | def __init__(self, name): 31 | self._name = name 32 | def __repr__(self): 33 | return self._name 34 | def __reduce__(self): 35 | return self._name 36 | def __new__(klass, name): 37 | instance = klass._registry.get(name) 38 | if not instance: 39 | instance = klass._registry[name] = object.__new__(klass) 40 | return instance 41 | 42 | INSTALL = Enum("INSTALL") 43 | REMOVE = Enum("REMOVE") 44 | 45 | KEEP = Enum("KEEP") 46 | REINSTALL = Enum("REINSTALL") 47 | UPGRADE = Enum("UPGRADE") 48 | FIX = Enum("FIX") 49 | 50 | OPTIONAL = Enum("OPTIONAL") 51 | NEVER = Enum("NEVER") 52 | ENFORCE = Enum("ENFORCE") 53 | ALWAYS = Enum("ALWAYS") 54 | 55 | WAITING = Enum("WAITING") 56 | RUNNING = Enum("RUNNING") 57 | FAILED = Enum("FAILED") 58 | SUCCEEDED = Enum("SUCCEEDED") 59 | 60 | ERROR = 1 61 | WARNING = 2 62 | INFO = 3 63 | DEBUG = 4 64 | 65 | BLOCKSIZE = 16384 66 | 67 | DISTROFILE = "/usr/lib/smart/distro.py" 68 | PLUGINSDIR = "/usr/lib/smart/plugins/" 69 | DATADIR = "/var/lib/smart/" 70 | USERDATADIR = "~/.smart/" 71 | CONFFILE = "config" 72 | 73 | LOCKED_EXCLUDE = Enum('LOCKED_EXCLUDE') 74 | LOCKED_INSTALL = Enum('LOCKED_INSTALL') 75 | LOCKED_REMOVE = Enum('LOCKED_REMOVE') 76 | LOCKED_CONFLICT = Enum('LOCKED_CONFLICT') 77 | LOCKED_CONFLICT_BY = Enum('LOCKED_CONFLICT_BY') 78 | LOCKED_NO_COEXIST = Enum('LOCKED_NO_COEXIST') 79 | LOCKED_SYSCONF = Enum('LOCKED_SYSCONF') 80 | 81 | # vim:ts=4:sw=4:et 82 | -------------------------------------------------------------------------------- /smart/interfaces/__init__.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2004 Conectiva, Inc. 3 | # 4 | # Written by Gustavo Niemeyer 5 | # 6 | # This file is part of Smart Package Manager. 7 | # 8 | # Smart Package Manager is free software; you can redistribute it and/or 9 | # modify it under the terms of the GNU General Public License as published 10 | # by the Free Software Foundation; either version 2 of the License, or (at 11 | # your option) any later version. 12 | # 13 | # Smart Package Manager is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | # General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with Smart Package Manager; if not, write to the Free Software 20 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | # 22 | 23 | -------------------------------------------------------------------------------- /smart/interfaces/images/__init__.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2004 Conectiva, Inc. 3 | # 4 | # Written by Gustavo Niemeyer 5 | # 6 | # This file is part of Smart Package Manager. 7 | # 8 | # Smart Package Manager is free software; you can redistribute it and/or 9 | # modify it under the terms of the GNU General Public License as published 10 | # by the Free Software Foundation; either version 2 of the License, or (at 11 | # your option) any later version. 12 | # 13 | # Smart Package Manager is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | # General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with Smart Package Manager; if not, write to the Free Software 20 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | # 22 | 23 | -------------------------------------------------------------------------------- /smart/interfaces/images/crystal-add.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smartpm/smart/aa3b298349aee4fc42f42c6af4558fcba46adea7/smart/interfaces/images/crystal-add.png -------------------------------------------------------------------------------- /smart/interfaces/images/crystal-apply.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smartpm/smart/aa3b298349aee4fc42f42c6af4558fcba46adea7/smart/interfaces/images/crystal-apply.png -------------------------------------------------------------------------------- /smart/interfaces/images/crystal-cancel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smartpm/smart/aa3b298349aee4fc42f42c6af4558fcba46adea7/smart/interfaces/images/crystal-cancel.png -------------------------------------------------------------------------------- /smart/interfaces/images/crystal-delete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smartpm/smart/aa3b298349aee4fc42f42c6af4558fcba46adea7/smart/interfaces/images/crystal-delete.png -------------------------------------------------------------------------------- /smart/interfaces/images/crystal-edit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smartpm/smart/aa3b298349aee4fc42f42c6af4558fcba46adea7/smart/interfaces/images/crystal-edit.png -------------------------------------------------------------------------------- /smart/interfaces/images/crystal-redo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smartpm/smart/aa3b298349aee4fc42f42c6af4558fcba46adea7/smart/interfaces/images/crystal-redo.png -------------------------------------------------------------------------------- /smart/interfaces/images/crystal-reload.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smartpm/smart/aa3b298349aee4fc42f42c6af4558fcba46adea7/smart/interfaces/images/crystal-reload.png -------------------------------------------------------------------------------- /smart/interfaces/images/crystal-search.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smartpm/smart/aa3b298349aee4fc42f42c6af4558fcba46adea7/smart/interfaces/images/crystal-search.png -------------------------------------------------------------------------------- /smart/interfaces/images/crystal-trash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smartpm/smart/aa3b298349aee4fc42f42c6af4558fcba46adea7/smart/interfaces/images/crystal-trash.png -------------------------------------------------------------------------------- /smart/interfaces/images/crystal-undo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smartpm/smart/aa3b298349aee4fc42f42c6af4558fcba46adea7/smart/interfaces/images/crystal-undo.png -------------------------------------------------------------------------------- /smart/interfaces/images/crystal-upgrade.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smartpm/smart/aa3b298349aee4fc42f42c6af4558fcba46adea7/smart/interfaces/images/crystal-upgrade.png -------------------------------------------------------------------------------- /smart/interfaces/images/folder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smartpm/smart/aa3b298349aee4fc42f42c6af4558fcba46adea7/smart/interfaces/images/folder.png -------------------------------------------------------------------------------- /smart/interfaces/images/package-available-locked.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smartpm/smart/aa3b298349aee4fc42f42c6af4558fcba46adea7/smart/interfaces/images/package-available-locked.png -------------------------------------------------------------------------------- /smart/interfaces/images/package-available.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smartpm/smart/aa3b298349aee4fc42f42c6af4558fcba46adea7/smart/interfaces/images/package-available.png -------------------------------------------------------------------------------- /smart/interfaces/images/package-broken.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smartpm/smart/aa3b298349aee4fc42f42c6af4558fcba46adea7/smart/interfaces/images/package-broken.png -------------------------------------------------------------------------------- /smart/interfaces/images/package-downgrade.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smartpm/smart/aa3b298349aee4fc42f42c6af4558fcba46adea7/smart/interfaces/images/package-downgrade.png -------------------------------------------------------------------------------- /smart/interfaces/images/package-install.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smartpm/smart/aa3b298349aee4fc42f42c6af4558fcba46adea7/smart/interfaces/images/package-install.png -------------------------------------------------------------------------------- /smart/interfaces/images/package-installed-locked.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smartpm/smart/aa3b298349aee4fc42f42c6af4558fcba46adea7/smart/interfaces/images/package-installed-locked.png -------------------------------------------------------------------------------- /smart/interfaces/images/package-installed-outdated.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smartpm/smart/aa3b298349aee4fc42f42c6af4558fcba46adea7/smart/interfaces/images/package-installed-outdated.png -------------------------------------------------------------------------------- /smart/interfaces/images/package-installed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smartpm/smart/aa3b298349aee4fc42f42c6af4558fcba46adea7/smart/interfaces/images/package-installed.png -------------------------------------------------------------------------------- /smart/interfaces/images/package-new-locked.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smartpm/smart/aa3b298349aee4fc42f42c6af4558fcba46adea7/smart/interfaces/images/package-new-locked.png -------------------------------------------------------------------------------- /smart/interfaces/images/package-new.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smartpm/smart/aa3b298349aee4fc42f42c6af4558fcba46adea7/smart/interfaces/images/package-new.png -------------------------------------------------------------------------------- /smart/interfaces/images/package-purge.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smartpm/smart/aa3b298349aee4fc42f42c6af4558fcba46adea7/smart/interfaces/images/package-purge.png -------------------------------------------------------------------------------- /smart/interfaces/images/package-reinstall.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smartpm/smart/aa3b298349aee4fc42f42c6af4558fcba46adea7/smart/interfaces/images/package-reinstall.png -------------------------------------------------------------------------------- /smart/interfaces/images/package-remove.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smartpm/smart/aa3b298349aee4fc42f42c6af4558fcba46adea7/smart/interfaces/images/package-remove.png -------------------------------------------------------------------------------- /smart/interfaces/images/package-upgrade.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smartpm/smart/aa3b298349aee4fc42f42c6af4558fcba46adea7/smart/interfaces/images/package-upgrade.png -------------------------------------------------------------------------------- /smart/interfaces/images/smart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smartpm/smart/aa3b298349aee4fc42f42c6af4558fcba46adea7/smart/interfaces/images/smart.png -------------------------------------------------------------------------------- /smart/interfaces/qt/__init__.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2005 Canonical 3 | # Copyright (c) 2004 Conectiva, Inc. 4 | # 5 | # Written by Gustavo Niemeyer 6 | # 7 | # This file is part of Smart Package Manager. 8 | # 9 | # Smart Package Manager is free software; you can redistribute it and/or 10 | # modify it under the terms of the GNU General Public License as published 11 | # by the Free Software Foundation; either version 2 of the License, or (at 12 | # your option) any later version. 13 | # 14 | # Smart Package Manager is distributed in the hope that it will be useful, 15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | # General Public License for more details. 18 | # 19 | # You should have received a copy of the GNU General Public License 20 | # along with Smart Package Manager; if not, write to the Free Software 21 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 22 | # 23 | from smart.interface import getImagePath 24 | from smart import * 25 | import os 26 | 27 | try: 28 | import qt 29 | except ImportError: 30 | from smart.const import DEBUG 31 | if sysconf.get("log-level") == DEBUG: 32 | import traceback 33 | traceback.print_exc() 34 | raise Error, _("System has no support for qt python interface") 35 | 36 | def create(ctrl, command=None, argv=None): 37 | if command: 38 | from smart.interfaces.qt.command import QtCommandInterface 39 | return QtCommandInterface(ctrl) 40 | else: 41 | from smart.interfaces.qt.interactive import QtInteractiveInterface 42 | return QtInteractiveInterface(ctrl) 43 | 44 | 45 | _pixmap = {} 46 | 47 | def getPixmap(name): 48 | if name not in _pixmap: 49 | filename = getImagePath(name) 50 | if os.path.isfile(filename): 51 | pixmap = qt.QPixmap(filename) 52 | _pixmap[name] = pixmap 53 | else: 54 | raise Error, _("Image '%s' not found") % name 55 | return _pixmap[name] 56 | 57 | def centerWindow(window): 58 | w = window.topLevelWidget() 59 | if w: 60 | scrn = qt.QApplication.desktop().screenNumber(w) 61 | elif qt.QApplication.desktop().isVirtualDesktop(): 62 | scrn = qt.QApplication.desktop().screenNumber(qt.QCursor.pos()) 63 | else: 64 | scrn = qt.QApplication.desktop().screenNumber(window) 65 | desk = qt.QApplication.desktop().availableGeometry(scrn) 66 | window.move((desk.width() - window.frameGeometry().width()) / 2, \ 67 | (desk.height() - window.frameGeometry().height()) / 2) 68 | 69 | 70 | # vim:ts=4:sw=4:et 71 | -------------------------------------------------------------------------------- /smart/interfaces/qt4/__init__.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2005 Canonical 3 | # Copyright (c) 2004 Conectiva, Inc. 4 | # 5 | # Written by Gustavo Niemeyer 6 | # 7 | # This file is part of Smart Package Manager. 8 | # 9 | # Smart Package Manager is free software; you can redistribute it and/or 10 | # modify it under the terms of the GNU General Public License as published 11 | # by the Free Software Foundation; either version 2 of the License, or (at 12 | # your option) any later version. 13 | # 14 | # Smart Package Manager is distributed in the hope that it will be useful, 15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | # General Public License for more details. 18 | # 19 | # You should have received a copy of the GNU General Public License 20 | # along with Smart Package Manager; if not, write to the Free Software 21 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 22 | # 23 | from smart.interface import getImagePath 24 | from smart import * 25 | import os 26 | 27 | try: 28 | import PyQt4 29 | except ImportError: 30 | from smart.const import DEBUG 31 | if sysconf.get("log-level") == DEBUG: 32 | import traceback 33 | traceback.print_exc() 34 | raise Error, _("System has no support for qt python interface") 35 | 36 | def create(ctrl, command=None, argv=None): 37 | if command: 38 | from smart.interfaces.qt4.command import QtCommandInterface 39 | return QtCommandInterface(ctrl) 40 | else: 41 | from smart.interfaces.qt4.interactive import QtInteractiveInterface 42 | return QtInteractiveInterface(ctrl) 43 | 44 | 45 | _pixmap = {} 46 | 47 | def getPixmap(name): 48 | if name not in _pixmap: 49 | filename = getImagePath(name) 50 | if os.path.isfile(filename): 51 | pixmap = PyQt4.QtGui.QPixmap(filename) 52 | _pixmap[name] = pixmap 53 | else: 54 | raise Error, _("Image '%s' not found") % name 55 | return _pixmap[name] 56 | 57 | def centerWindow(window): 58 | w = window.topLevelWidget() 59 | if w: 60 | scrn = PyQt4.QtGui.QApplication.desktop().screenNumber(w) 61 | elif PyQt4.QtGui.QApplication.desktop().isVirtualDesktop(): 62 | scrn = PyQt4.QtGui.QApplication.desktop().screenNumber(PyQt4.QtGui.QCursor.pos()) 63 | else: 64 | scrn = PyQt4.QtGui.QApplication.desktop().screenNumber(window) 65 | desk = PyQt4.QtGui.QApplication.desktop().availableGeometry(scrn) 66 | window.move((desk.width() - window.frameGeometry().width()) / 2, \ 67 | (desk.height() - window.frameGeometry().height()) / 2) 68 | 69 | 70 | # vim:ts=4:sw=4:et 71 | -------------------------------------------------------------------------------- /smart/interfaces/text/__init__.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2004 Conectiva, Inc. 3 | # 4 | # Written by Gustavo Niemeyer 5 | # 6 | # This file is part of Smart Package Manager. 7 | # 8 | # Smart Package Manager is free software; you can redistribute it and/or 9 | # modify it under the terms of the GNU General Public License as published 10 | # by the Free Software Foundation; either version 2 of the License, or (at 11 | # your option) any later version. 12 | # 13 | # Smart Package Manager is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | # General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with Smart Package Manager; if not, write to the Free Software 20 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | # 22 | from smart import Error 23 | 24 | def create(ctrl, command=None, argv=None): 25 | if command: 26 | from smart.interfaces.text.interface import TextInterface 27 | return TextInterface(ctrl) 28 | else: 29 | from smart.interfaces.text.interactive import TextInteractiveInterface 30 | return TextInteractiveInterface(ctrl) 31 | 32 | # vim:ts=4:sw=4:et 33 | 34 | -------------------------------------------------------------------------------- /smart/plugins/__init__.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2004 Conectiva, Inc. 3 | # 4 | # Written by Gustavo Niemeyer 5 | # 6 | # This file is part of Smart Package Manager. 7 | # 8 | # Smart Package Manager is free software; you can redistribute it and/or 9 | # modify it under the terms of the GNU General Public License as published 10 | # by the Free Software Foundation; either version 2 of the License, or (at 11 | # your option) any later version. 12 | # 13 | # Smart Package Manager is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | # General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with Smart Package Manager; if not, write to the Free Software 20 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | # 22 | 23 | -------------------------------------------------------------------------------- /smart/plugins/debdir.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2005 Canonical 3 | # Copyright (c) 2004 Conectiva, Inc. 4 | # 5 | # Written by Gustavo Niemeyer 6 | # 7 | # This file is part of Smart Package Manager. 8 | # 9 | # Smart Package Manager is free software; you can redistribute it and/or 10 | # modify it under the terms of the GNU General Public License as published 11 | # by the Free Software Foundation; either version 2 of the License, or (at 12 | # your option) any later version. 13 | # 14 | # Smart Package Manager is distributed in the hope that it will be useful, 15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | # General Public License for more details. 18 | # 19 | # You should have received a copy of the GNU General Public License 20 | # along with Smart Package Manager; if not, write to the Free Software 21 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 22 | # 23 | from smart import * 24 | 25 | if sysconf.has("deb-dir"): 26 | 27 | from smart.channels.deb_dir import DebDirChannel 28 | 29 | def createDebDirChannel(): 30 | channel = DebDirChannel(sysconf.get("deb-dir"), True, 31 | "deb-dir", 32 | "deb-dir-option", 33 | _("Dynamic DEB Directory"), 34 | True, False, 0) 35 | return [channel] 36 | 37 | hooks.register("rebuild-dynamic-channels", createDebDirChannel) 38 | 39 | -------------------------------------------------------------------------------- /smart/plugins/landscape.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2009 Canonical 3 | # 4 | # Written by Gustavo Niemeyer 5 | # 6 | # This file is part of Smart Package Manager. 7 | # 8 | # Smart Package Manager is free software; you can redistribute it and/or 9 | # modify it under the terms of the GNU General Public License as published 10 | # by the Free Software Foundation; either version 2 of the License, or (at 11 | # your option) any later version. 12 | # 13 | # Smart Package Manager is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | # General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with Smart Package Manager; if not, write to the Free Software 20 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | # 22 | from ConfigParser import ConfigParser 23 | import os 24 | 25 | from smart import sysconf 26 | 27 | 28 | CLIENT_CONF_PATH = "/etc/landscape/client.conf" 29 | 30 | 31 | def run(): 32 | if (sysconf.get("use-landscape-proxies", False) and 33 | os.path.isfile(CLIENT_CONF_PATH)): 34 | parser = ConfigParser() 35 | parser.read(CLIENT_CONF_PATH) 36 | for type in "http", "https", "ftp", "no": 37 | option = "%s_proxy" % type 38 | if parser.has_option("client", option) and option not in os.environ: 39 | setting = parser.get("client", option) 40 | sysconf.set(option.replace("_", "-"), setting, weak=True) 41 | 42 | 43 | run() 44 | -------------------------------------------------------------------------------- /smart/plugins/rpmdir.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2005 Canonical 3 | # Copyright (c) 2004 Conectiva, Inc. 4 | # 5 | # Written by Gustavo Niemeyer 6 | # 7 | # This file is part of Smart Package Manager. 8 | # 9 | # Smart Package Manager is free software; you can redistribute it and/or 10 | # modify it under the terms of the GNU General Public License as published 11 | # by the Free Software Foundation; either version 2 of the License, or (at 12 | # your option) any later version. 13 | # 14 | # Smart Package Manager is distributed in the hope that it will be useful, 15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | # General Public License for more details. 18 | # 19 | # You should have received a copy of the GNU General Public License 20 | # along with Smart Package Manager; if not, write to the Free Software 21 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 22 | # 23 | from smart import * 24 | 25 | if sysconf.has("rpm-dir"): 26 | 27 | from smart.channels.rpm_dir import RPMDirChannel 28 | 29 | def createRPMDirChannel(): 30 | channel = RPMDirChannel(sysconf.get("rpm-dir"), True, 31 | "rpm-dir", 32 | "rpm-dir-option", 33 | _("Dynamic RPM Directory"), 34 | True, False, 0) 35 | return [channel] 36 | 37 | hooks.register("rebuild-dynamic-channels", createRPMDirChannel) 38 | -------------------------------------------------------------------------------- /smart/pm.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2004 Conectiva, Inc. 3 | # 4 | # Written by Gustavo Niemeyer 5 | # 6 | # This file is part of Smart Package Manager. 7 | # 8 | # Smart Package Manager is free software; you can redistribute it and/or 9 | # modify it under the terms of the GNU General Public License as published 10 | # by the Free Software Foundation; either version 2 of the License, or (at 11 | # your option) any later version. 12 | # 13 | # Smart Package Manager is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | # General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with Smart Package Manager; if not, write to the Free Software 20 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | # 22 | 23 | class PackageManager: 24 | 25 | def commit(self, changeset, pkgpaths): 26 | pass 27 | 28 | # vim:ts=4:sw=4:et 29 | -------------------------------------------------------------------------------- /smart/util/__init__.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2004 Conectiva, Inc. 3 | # 4 | # Written by Gustavo Niemeyer 5 | # 6 | # This file is part of Smart Package Manager. 7 | # 8 | # Smart Package Manager is free software; you can redistribute it and/or 9 | # modify it under the terms of the GNU General Public License as published 10 | # by the Free Software Foundation; either version 2 of the License, or (at 11 | # your option) any later version. 12 | # 13 | # Smart Package Manager is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | # General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with Smart Package Manager; if not, write to the Free Software 20 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | # 22 | 23 | -------------------------------------------------------------------------------- /smart/util/celementtree/expat/ascii.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd 2 | See the file COPYING for copying permission. 3 | */ 4 | 5 | #define ASCII_A 0x41 6 | #define ASCII_B 0x42 7 | #define ASCII_C 0x43 8 | #define ASCII_D 0x44 9 | #define ASCII_E 0x45 10 | #define ASCII_F 0x46 11 | #define ASCII_G 0x47 12 | #define ASCII_H 0x48 13 | #define ASCII_I 0x49 14 | #define ASCII_J 0x4A 15 | #define ASCII_K 0x4B 16 | #define ASCII_L 0x4C 17 | #define ASCII_M 0x4D 18 | #define ASCII_N 0x4E 19 | #define ASCII_O 0x4F 20 | #define ASCII_P 0x50 21 | #define ASCII_Q 0x51 22 | #define ASCII_R 0x52 23 | #define ASCII_S 0x53 24 | #define ASCII_T 0x54 25 | #define ASCII_U 0x55 26 | #define ASCII_V 0x56 27 | #define ASCII_W 0x57 28 | #define ASCII_X 0x58 29 | #define ASCII_Y 0x59 30 | #define ASCII_Z 0x5A 31 | 32 | #define ASCII_a 0x61 33 | #define ASCII_b 0x62 34 | #define ASCII_c 0x63 35 | #define ASCII_d 0x64 36 | #define ASCII_e 0x65 37 | #define ASCII_f 0x66 38 | #define ASCII_g 0x67 39 | #define ASCII_h 0x68 40 | #define ASCII_i 0x69 41 | #define ASCII_j 0x6A 42 | #define ASCII_k 0x6B 43 | #define ASCII_l 0x6C 44 | #define ASCII_m 0x6D 45 | #define ASCII_n 0x6E 46 | #define ASCII_o 0x6F 47 | #define ASCII_p 0x70 48 | #define ASCII_q 0x71 49 | #define ASCII_r 0x72 50 | #define ASCII_s 0x73 51 | #define ASCII_t 0x74 52 | #define ASCII_u 0x75 53 | #define ASCII_v 0x76 54 | #define ASCII_w 0x77 55 | #define ASCII_x 0x78 56 | #define ASCII_y 0x79 57 | #define ASCII_z 0x7A 58 | 59 | #define ASCII_0 0x30 60 | #define ASCII_1 0x31 61 | #define ASCII_2 0x32 62 | #define ASCII_3 0x33 63 | #define ASCII_4 0x34 64 | #define ASCII_5 0x35 65 | #define ASCII_6 0x36 66 | #define ASCII_7 0x37 67 | #define ASCII_8 0x38 68 | #define ASCII_9 0x39 69 | 70 | #define ASCII_TAB 0x09 71 | #define ASCII_SPACE 0x20 72 | #define ASCII_EXCL 0x21 73 | #define ASCII_QUOT 0x22 74 | #define ASCII_AMP 0x26 75 | #define ASCII_APOS 0x27 76 | #define ASCII_MINUS 0x2D 77 | #define ASCII_PERIOD 0x2E 78 | #define ASCII_COLON 0x3A 79 | #define ASCII_SEMI 0x3B 80 | #define ASCII_LT 0x3C 81 | #define ASCII_EQUALS 0x3D 82 | #define ASCII_GT 0x3E 83 | #define ASCII_LSQB 0x5B 84 | #define ASCII_RSQB 0x5D 85 | #define ASCII_UNDERSCORE 0x5F 86 | -------------------------------------------------------------------------------- /smart/util/celementtree/expat/asciitab.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd 2 | See the file COPYING for copying permission. 3 | */ 4 | 5 | /* 0x00 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, 6 | /* 0x04 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, 7 | /* 0x08 */ BT_NONXML, BT_S, BT_LF, BT_NONXML, 8 | /* 0x0C */ BT_NONXML, BT_CR, BT_NONXML, BT_NONXML, 9 | /* 0x10 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, 10 | /* 0x14 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, 11 | /* 0x18 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, 12 | /* 0x1C */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, 13 | /* 0x20 */ BT_S, BT_EXCL, BT_QUOT, BT_NUM, 14 | /* 0x24 */ BT_OTHER, BT_PERCNT, BT_AMP, BT_APOS, 15 | /* 0x28 */ BT_LPAR, BT_RPAR, BT_AST, BT_PLUS, 16 | /* 0x2C */ BT_COMMA, BT_MINUS, BT_NAME, BT_SOL, 17 | /* 0x30 */ BT_DIGIT, BT_DIGIT, BT_DIGIT, BT_DIGIT, 18 | /* 0x34 */ BT_DIGIT, BT_DIGIT, BT_DIGIT, BT_DIGIT, 19 | /* 0x38 */ BT_DIGIT, BT_DIGIT, BT_COLON, BT_SEMI, 20 | /* 0x3C */ BT_LT, BT_EQUALS, BT_GT, BT_QUEST, 21 | /* 0x40 */ BT_OTHER, BT_HEX, BT_HEX, BT_HEX, 22 | /* 0x44 */ BT_HEX, BT_HEX, BT_HEX, BT_NMSTRT, 23 | /* 0x48 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, 24 | /* 0x4C */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, 25 | /* 0x50 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, 26 | /* 0x54 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, 27 | /* 0x58 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_LSQB, 28 | /* 0x5C */ BT_OTHER, BT_RSQB, BT_OTHER, BT_NMSTRT, 29 | /* 0x60 */ BT_OTHER, BT_HEX, BT_HEX, BT_HEX, 30 | /* 0x64 */ BT_HEX, BT_HEX, BT_HEX, BT_NMSTRT, 31 | /* 0x68 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, 32 | /* 0x6C */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, 33 | /* 0x70 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, 34 | /* 0x74 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, 35 | /* 0x78 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_OTHER, 36 | /* 0x7C */ BT_VERBAR, BT_OTHER, BT_OTHER, BT_OTHER, 37 | -------------------------------------------------------------------------------- /smart/util/celementtree/expat/iasciitab.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd 2 | See the file COPYING for copying permission. 3 | */ 4 | 5 | /* Like asciitab.h, except that 0xD has code BT_S rather than BT_CR */ 6 | /* 0x00 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, 7 | /* 0x04 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, 8 | /* 0x08 */ BT_NONXML, BT_S, BT_LF, BT_NONXML, 9 | /* 0x0C */ BT_NONXML, BT_S, BT_NONXML, BT_NONXML, 10 | /* 0x10 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, 11 | /* 0x14 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, 12 | /* 0x18 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, 13 | /* 0x1C */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, 14 | /* 0x20 */ BT_S, BT_EXCL, BT_QUOT, BT_NUM, 15 | /* 0x24 */ BT_OTHER, BT_PERCNT, BT_AMP, BT_APOS, 16 | /* 0x28 */ BT_LPAR, BT_RPAR, BT_AST, BT_PLUS, 17 | /* 0x2C */ BT_COMMA, BT_MINUS, BT_NAME, BT_SOL, 18 | /* 0x30 */ BT_DIGIT, BT_DIGIT, BT_DIGIT, BT_DIGIT, 19 | /* 0x34 */ BT_DIGIT, BT_DIGIT, BT_DIGIT, BT_DIGIT, 20 | /* 0x38 */ BT_DIGIT, BT_DIGIT, BT_COLON, BT_SEMI, 21 | /* 0x3C */ BT_LT, BT_EQUALS, BT_GT, BT_QUEST, 22 | /* 0x40 */ BT_OTHER, BT_HEX, BT_HEX, BT_HEX, 23 | /* 0x44 */ BT_HEX, BT_HEX, BT_HEX, BT_NMSTRT, 24 | /* 0x48 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, 25 | /* 0x4C */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, 26 | /* 0x50 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, 27 | /* 0x54 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, 28 | /* 0x58 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_LSQB, 29 | /* 0x5C */ BT_OTHER, BT_RSQB, BT_OTHER, BT_NMSTRT, 30 | /* 0x60 */ BT_OTHER, BT_HEX, BT_HEX, BT_HEX, 31 | /* 0x64 */ BT_HEX, BT_HEX, BT_HEX, BT_NMSTRT, 32 | /* 0x68 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, 33 | /* 0x6C */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, 34 | /* 0x70 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, 35 | /* 0x74 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, 36 | /* 0x78 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_OTHER, 37 | /* 0x7C */ BT_VERBAR, BT_OTHER, BT_OTHER, BT_OTHER, 38 | -------------------------------------------------------------------------------- /smart/util/celementtree/expat/internal.h: -------------------------------------------------------------------------------- 1 | /* internal.h 2 | 3 | Internal definitions used by Expat. This is not needed to compile 4 | client code. 5 | 6 | The following calling convention macros are defined for frequently 7 | called functions: 8 | 9 | FASTCALL - Used for those internal functions that have a simple 10 | body and a low number of arguments and local variables. 11 | 12 | PTRCALL - Used for functions called though function pointers. 13 | 14 | PTRFASTCALL - Like PTRCALL, but for low number of arguments. 15 | 16 | inline - Used for selected internal functions for which inlining 17 | may improve performance on some platforms. 18 | 19 | Note: Use of these macros is based on judgement, not hard rules, 20 | and therefore subject to change. 21 | */ 22 | 23 | #if defined(__GNUC__) && defined(__i386__) 24 | /* We'll use this version by default only where we know it helps. 25 | 26 | regparm() generates warnings on Solaris boxes. See SF bug #692878. 27 | 28 | Instability reported with egcs on a RedHat Linux 7.3. 29 | Let's comment out: 30 | #define FASTCALL __attribute__((stdcall, regparm(3))) 31 | and let's try this: 32 | */ 33 | #define FASTCALL __attribute__((regparm(3))) 34 | #define PTRFASTCALL __attribute__((regparm(3))) 35 | #endif 36 | 37 | /* Using __fastcall seems to have an unexpected negative effect under 38 | MS VC++, especially for function pointers, so we won't use it for 39 | now on that platform. It may be reconsidered for a future release 40 | if it can be made more effective. 41 | Likely reason: __fastcall on Windows is like stdcall, therefore 42 | the compiler cannot perform stack optimizations for call clusters. 43 | */ 44 | 45 | /* Make sure all of these are defined if they aren't already. */ 46 | 47 | #ifndef FASTCALL 48 | #define FASTCALL 49 | #endif 50 | 51 | #ifndef PTRCALL 52 | #define PTRCALL 53 | #endif 54 | 55 | #ifndef PTRFASTCALL 56 | #define PTRFASTCALL 57 | #endif 58 | 59 | #ifndef XML_MIN_SIZE 60 | #if !defined(__cplusplus) && !defined(inline) 61 | #ifdef __GNUC__ 62 | #define inline __inline 63 | #endif /* __GNUC__ */ 64 | #endif 65 | #endif /* XML_MIN_SIZE */ 66 | 67 | #ifdef __cplusplus 68 | #define inline inline 69 | #else 70 | #ifndef inline 71 | #define inline 72 | #endif 73 | #endif 74 | -------------------------------------------------------------------------------- /smart/util/celementtree/expat/latin1tab.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd 2 | See the file COPYING for copying permission. 3 | */ 4 | 5 | /* 0x80 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, 6 | /* 0x84 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, 7 | /* 0x88 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, 8 | /* 0x8C */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, 9 | /* 0x90 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, 10 | /* 0x94 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, 11 | /* 0x98 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, 12 | /* 0x9C */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, 13 | /* 0xA0 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, 14 | /* 0xA4 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, 15 | /* 0xA8 */ BT_OTHER, BT_OTHER, BT_NMSTRT, BT_OTHER, 16 | /* 0xAC */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, 17 | /* 0xB0 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, 18 | /* 0xB4 */ BT_OTHER, BT_NMSTRT, BT_OTHER, BT_NAME, 19 | /* 0xB8 */ BT_OTHER, BT_OTHER, BT_NMSTRT, BT_OTHER, 20 | /* 0xBC */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, 21 | /* 0xC0 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, 22 | /* 0xC4 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, 23 | /* 0xC8 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, 24 | /* 0xCC */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, 25 | /* 0xD0 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, 26 | /* 0xD4 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_OTHER, 27 | /* 0xD8 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, 28 | /* 0xDC */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, 29 | /* 0xE0 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, 30 | /* 0xE4 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, 31 | /* 0xE8 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, 32 | /* 0xEC */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, 33 | /* 0xF0 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, 34 | /* 0xF4 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_OTHER, 35 | /* 0xF8 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, 36 | /* 0xFC */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, 37 | -------------------------------------------------------------------------------- /smart/util/celementtree/expat/macconfig.h: -------------------------------------------------------------------------------- 1 | /*================================================================ 2 | ** Copyright 2000, Clark Cooper 3 | ** All rights reserved. 4 | ** 5 | ** This is free software. You are permitted to copy, distribute, or modify 6 | ** it under the terms of the MIT/X license (contained in the COPYING file 7 | ** with this distribution.) 8 | ** 9 | */ 10 | 11 | #ifndef MACCONFIG_H 12 | #define MACCONFIG_H 13 | 14 | 15 | /* 1234 = LIL_ENDIAN, 4321 = BIGENDIAN */ 16 | #define BYTEORDER 4321 17 | 18 | /* Define to 1 if you have the `bcopy' function. */ 19 | #undef HAVE_BCOPY 20 | 21 | /* Define to 1 if you have the `memmove' function. */ 22 | #define HAVE_MEMMOVE 23 | 24 | /* Define to 1 if you have a working `mmap' system call. */ 25 | #undef HAVE_MMAP 26 | 27 | /* Define to 1 if you have the header file. */ 28 | #undef HAVE_UNISTD_H 29 | 30 | /* whether byteorder is bigendian */ 31 | #define WORDS_BIGENDIAN 32 | 33 | /* Define to specify how much context to retain around the current parse 34 | point. */ 35 | #undef XML_CONTEXT_BYTES 36 | 37 | /* Define to make parameter entity parsing functionality available. */ 38 | #define XML_DTD 39 | 40 | /* Define to make XML Namespaces functionality available. */ 41 | #define XML_NS 42 | 43 | /* Define to empty if `const' does not conform to ANSI C. */ 44 | #undef const 45 | 46 | /* Define to `long' if does not define. */ 47 | #define off_t long 48 | 49 | /* Define to `unsigned' if does not define. */ 50 | #undef size_t 51 | 52 | 53 | #endif /* ifndef MACCONFIG_H */ 54 | -------------------------------------------------------------------------------- /smart/util/celementtree/expat/utf8tab.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd 2 | See the file COPYING for copying permission. 3 | */ 4 | 5 | 6 | /* 0x80 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, 7 | /* 0x84 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, 8 | /* 0x88 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, 9 | /* 0x8C */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, 10 | /* 0x90 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, 11 | /* 0x94 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, 12 | /* 0x98 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, 13 | /* 0x9C */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, 14 | /* 0xA0 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, 15 | /* 0xA4 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, 16 | /* 0xA8 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, 17 | /* 0xAC */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, 18 | /* 0xB0 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, 19 | /* 0xB4 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, 20 | /* 0xB8 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, 21 | /* 0xBC */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, 22 | /* 0xC0 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2, 23 | /* 0xC4 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2, 24 | /* 0xC8 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2, 25 | /* 0xCC */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2, 26 | /* 0xD0 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2, 27 | /* 0xD4 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2, 28 | /* 0xD8 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2, 29 | /* 0xDC */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2, 30 | /* 0xE0 */ BT_LEAD3, BT_LEAD3, BT_LEAD3, BT_LEAD3, 31 | /* 0xE4 */ BT_LEAD3, BT_LEAD3, BT_LEAD3, BT_LEAD3, 32 | /* 0xE8 */ BT_LEAD3, BT_LEAD3, BT_LEAD3, BT_LEAD3, 33 | /* 0xEC */ BT_LEAD3, BT_LEAD3, BT_LEAD3, BT_LEAD3, 34 | /* 0xF0 */ BT_LEAD4, BT_LEAD4, BT_LEAD4, BT_LEAD4, 35 | /* 0xF4 */ BT_LEAD4, BT_NONXML, BT_NONXML, BT_NONXML, 36 | /* 0xF8 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, 37 | /* 0xFC */ BT_NONXML, BT_NONXML, BT_MALFORM, BT_MALFORM, 38 | -------------------------------------------------------------------------------- /smart/util/celementtree/expat/winconfig.h: -------------------------------------------------------------------------------- 1 | /*================================================================ 2 | ** Copyright 2000, Clark Cooper 3 | ** All rights reserved. 4 | ** 5 | ** This is free software. You are permitted to copy, distribute, or modify 6 | ** it under the terms of the MIT/X license (contained in the COPYING file 7 | ** with this distribution.) 8 | */ 9 | 10 | #ifndef WINCONFIG_H 11 | #define WINCONFIG_H 12 | 13 | #define WIN32_LEAN_AND_MEAN 14 | #include 15 | #undef WIN32_LEAN_AND_MEAN 16 | 17 | #include 18 | #include 19 | 20 | #define XML_NS 1 21 | #define XML_DTD 1 22 | #define XML_CONTEXT_BYTES 1024 23 | 24 | /* we will assume all Windows platforms are little endian */ 25 | #define BYTEORDER 1234 26 | 27 | /* Windows has memmove() available. */ 28 | #define HAVE_MEMMOVE 29 | 30 | #endif /* ndef WINCONFIG_H */ 31 | -------------------------------------------------------------------------------- /smart/util/celementtree/expat/xmltok_impl.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd 3 | See the file COPYING for copying permission. 4 | */ 5 | 6 | enum { 7 | BT_NONXML, 8 | BT_MALFORM, 9 | BT_LT, 10 | BT_AMP, 11 | BT_RSQB, 12 | BT_LEAD2, 13 | BT_LEAD3, 14 | BT_LEAD4, 15 | BT_TRAIL, 16 | BT_CR, 17 | BT_LF, 18 | BT_GT, 19 | BT_QUOT, 20 | BT_APOS, 21 | BT_EQUALS, 22 | BT_QUEST, 23 | BT_EXCL, 24 | BT_SOL, 25 | BT_SEMI, 26 | BT_NUM, 27 | BT_LSQB, 28 | BT_S, 29 | BT_NMSTRT, 30 | BT_COLON, 31 | BT_HEX, 32 | BT_DIGIT, 33 | BT_NAME, 34 | BT_MINUS, 35 | BT_OTHER, /* known not to be a name or name start character */ 36 | BT_NONASCII, /* might be a name or name start character */ 37 | BT_PERCNT, 38 | BT_LPAR, 39 | BT_RPAR, 40 | BT_AST, 41 | BT_PLUS, 42 | BT_COMMA, 43 | BT_VERBAR 44 | }; 45 | 46 | #include 47 | -------------------------------------------------------------------------------- /smart/util/elementtree/TidyHTMLTreeBuilder.py: -------------------------------------------------------------------------------- 1 | # 2 | # ElementTree 3 | # $Id: TidyHTMLTreeBuilder.py 2304 2005-03-01 17:42:41Z fredrik $ 4 | # 5 | 6 | from elementtidy.TidyHTMLTreeBuilder import * 7 | -------------------------------------------------------------------------------- /smart/util/elementtree/__init__.py: -------------------------------------------------------------------------------- 1 | # $Id: __init__.py 1821 2004-06-03 16:57:49Z fredrik $ 2 | # elementtree package 3 | 4 | # -------------------------------------------------------------------- 5 | # The ElementTree toolkit is 6 | # 7 | # Copyright (c) 1999-2004 by Fredrik Lundh 8 | # 9 | # By obtaining, using, and/or copying this software and/or its 10 | # associated documentation, you agree that you have read, understood, 11 | # and will comply with the following terms and conditions: 12 | # 13 | # Permission to use, copy, modify, and distribute this software and 14 | # its associated documentation for any purpose and without fee is 15 | # hereby granted, provided that the above copyright notice appears in 16 | # all copies, and that both that copyright notice and this permission 17 | # notice appear in supporting documentation, and that the name of 18 | # Secret Labs AB or the author not be used in advertising or publicity 19 | # pertaining to distribution of the software without specific, written 20 | # prior permission. 21 | # 22 | # SECRET LABS AB AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD 23 | # TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANT- 24 | # ABILITY AND FITNESS. IN NO EVENT SHALL SECRET LABS AB OR THE AUTHOR 25 | # BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY 26 | # DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, 27 | # WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS 28 | # ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 29 | # OF THIS SOFTWARE. 30 | # -------------------------------------------------------------------- 31 | -------------------------------------------------------------------------------- /smart/util/filetools.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2004 Conectiva, Inc. 3 | # 4 | # Written by Gustavo Niemeyer 5 | # 6 | # This file is part of Smart Package Manager. 7 | # 8 | # Smart Package Manager is free software; you can redistribute it and/or 9 | # modify it under the terms of the GNU General Public License as published 10 | # by the Free Software Foundation; either version 2 of the License, or (at 11 | # your option) any later version. 12 | # 13 | # Smart Package Manager is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | # General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with Smart Package Manager; if not, write to the Free Software 20 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | # 22 | from smart.const import BLOCKSIZE 23 | import resource 24 | import fcntl 25 | try: 26 | from hashlib import md5 27 | except ImportError: 28 | from md5 import md5 29 | import os 30 | 31 | def getFileDigest(path, digest=None): 32 | if not digest: 33 | digest = md5() 34 | file = open(path) 35 | while True: 36 | data = file.read(BLOCKSIZE) 37 | if not data: 38 | break 39 | digest.update(data) 40 | file.close() 41 | return digest.digest() 42 | 43 | def compareFiles(path1, path2): 44 | if not os.path.isfile(path1) or not os.path.isfile(path2): 45 | return False 46 | if os.path.getsize(path1) != os.path.getsize(path2): 47 | return False 48 | path1sum = md5() 49 | path2sum = md5() 50 | for path, sum in [(path1, path1sum), (path2, path2sum)]: 51 | file = open(path) 52 | while True: 53 | data = file.read(BLOCKSIZE) 54 | if not data: 55 | break 56 | sum.update(data) 57 | file.close() 58 | if path1sum.digest() != path2sum.digest(): 59 | return False 60 | return True 61 | 62 | def setCloseOnExec(fd): 63 | try: 64 | flags = fcntl.fcntl(fd, fcntl.F_GETFL, 0) 65 | flags |= fcntl.FD_CLOEXEC 66 | fcntl.fcntl(fd, fcntl.F_SETFL, flags) 67 | except IOError: 68 | pass 69 | 70 | def setCloseOnExecAll(): 71 | number_of_files = min(4096, resource.getrlimit(resource.RLIMIT_NOFILE)[1]) 72 | for fd in range(3, number_of_files): 73 | try: 74 | flags = fcntl.fcntl(fd, fcntl.F_GETFL, 0) 75 | flags |= fcntl.FD_CLOEXEC 76 | fcntl.fcntl(fd, fcntl.F_SETFL, flags) 77 | except IOError: 78 | pass 79 | -------------------------------------------------------------------------------- /smart/util/objdigest.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2004 Conectiva, Inc. 3 | # 4 | # Written by Gustavo Niemeyer 5 | # 6 | # This file is part of Smart Package Manager. 7 | # 8 | # Smart Package Manager is free software; you can redistribute it and/or 9 | # modify it under the terms of the GNU General Public License as published 10 | # by the Free Software Foundation; either version 2 of the License, or (at 11 | # your option) any later version. 12 | # 13 | # Smart Package Manager is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | # General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with Smart Package Manager; if not, write to the Free Software 20 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | # 22 | import cPickle 23 | try: 24 | from hashlib import md5 25 | except ImportError: 26 | from md5 import md5 27 | 28 | def getObjectDigest(obj): 29 | return ObjectDigest(obj).getDigest() 30 | 31 | def getObjectHexDigest(obj): 32 | return ObjectDigest(obj).getHexDigest() 33 | 34 | class ObjectDigest(object): 35 | 36 | def __init__(self, obj=None): 37 | self._digest = md5() 38 | if obj: 39 | self.addObject(obj) 40 | 41 | def getDigest(self): 42 | return self._digest.digest() 43 | 44 | def getHexDigest(self): 45 | return self._digest.hexdigest() 46 | 47 | def addObject(self, obj): 48 | cPickle.dump(obj, DigestFile(self._digest), 2) 49 | 50 | class DigestFile(object): 51 | 52 | def __init__(self, digest): 53 | self._digest = digest 54 | 55 | def write(self, data): 56 | self._digest.update(data) 57 | 58 | 59 | -------------------------------------------------------------------------------- /tests/archbase.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | from mocker import MockerTestCase 4 | 5 | from smart.backends.arch.base import ArchPackage, Package, Provides 6 | from smart.backends.arch.archver import splitarch, splitrelease 7 | from smart import sysconf 8 | 9 | 10 | class ArchPackageTest(MockerTestCase): 11 | 12 | def test_sorting_name_takes_precedence(self): 13 | pkg1 = ArchPackage("name1", "3.0-1-i686") 14 | pkg2 = ArchPackage("name2", "1.0-1-i686") 15 | pkg3 = ArchPackage("name3", "2.0-1-i686") 16 | lst = [pkg3, pkg1, pkg2] 17 | lst.sort() 18 | self.assertEquals(lst, [pkg1, pkg2, pkg3]) 19 | 20 | def test_sorting_version_takes_precedence_over_release(self): 21 | pkg1 = ArchPackage("name", "1.0-3-i686") 22 | pkg2 = ArchPackage("name", "2.0-2-i686") 23 | pkg3 = ArchPackage("name", "3.0-1-i686") 24 | lst = [pkg3, pkg1, pkg2] 25 | lst.sort() 26 | self.assertEquals(lst, [pkg1, pkg2, pkg3]) 27 | 28 | def test_sorting_version_takes_precedence_over_arch(self): 29 | pkg1 = ArchPackage("name", "1.0-1-i686") 30 | pkg2 = ArchPackage("name", "2.0-1-x86_64") 31 | pkg3 = ArchPackage("name", "3.0-1-i686") 32 | lst = [pkg3, pkg1, pkg2] 33 | lst.sort() 34 | self.assertEquals(lst, [pkg1, pkg2, pkg3]) 35 | 36 | class ArchVerSplitTest(MockerTestCase): 37 | 38 | def test_splitarch(self): 39 | version, arch = splitarch("1.0-1-i686") 40 | self.assertEquals(version, "1.0-1") 41 | self.assertEquals(arch, "i686") 42 | 43 | def test_splitrelease(self): 44 | version, release = splitrelease("1.0-1") 45 | self.assertEquals(version, "1.0") 46 | self.assertEquals(release, "1") 47 | 48 | -------------------------------------------------------------------------------- /tests/celementtree.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import os 3 | 4 | 5 | class TestImport(unittest.TestCase): 6 | 7 | def test_import(self): 8 | """Verify if cElementTree is hacked to work inside Smart.""" 9 | import smart.util 10 | util_dir = os.path.dirname(smart.util.__file__) 11 | if os.path.isfile(os.path.join(util_dir, "cElementTree.so")): 12 | from smart.util.cElementTree import ElementTree 13 | -------------------------------------------------------------------------------- /tests/channel.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | 3 | from smart.channel import parseChannelsDescription, PackageChannel 4 | from smart.cache import Loader 5 | 6 | 7 | class ParseChannelsDescriptionTest(unittest.TestCase): 8 | 9 | def test_parseChannelsDescription(self): 10 | data = parseChannelsDescription(""" 11 | [alias] 12 | type = deb-sys 13 | name = first = second 14 | """) 15 | self.assertEquals(data, {'alias': {'type': 'deb-sys', 16 | 'name': 'first = second'}}) 17 | 18 | def test_removeLoaders_without_cache(self): 19 | class TestChannel(PackageChannel): 20 | def fetch(self, fetcher, progress): 21 | self._loaders.append(Loader()) 22 | channel = TestChannel("type", "alias") 23 | channel.fetch(None, None) 24 | channel.removeLoaders() 25 | self.assertEquals(channel.getLoaders(), []) 26 | -------------------------------------------------------------------------------- /tests/data/aptdeb/component-less/Packages.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smartpm/smart/aa3b298349aee4fc42f42c6af4558fcba46adea7/tests/data/aptdeb/component-less/Packages.gz -------------------------------------------------------------------------------- /tests/data/aptdeb/component-less/Release: -------------------------------------------------------------------------------- 1 | Origin: Smart 2 | Codename: smart 3 | Date: Wed, 03 Sep 2008 22:31:29 UTC 4 | Label: Test Packages 5 | Architectures: all 6 | MD5Sum: 7 | 384ccb05e3f6da02312b6e383b211777 571 Packages.gz 8 | SHA1: 9 | 1b795920940dbe025615e63c1e7326e4df606161 571 Packages.gz 10 | SHA256: 11 | beaa1d25b3102980dfa118841c9c569d7988f52f3c29aff044fc187a68a8891f 571 Packages.gz 12 | -------------------------------------------------------------------------------- /tests/data/aptdeb/component-less/Release.gpg: -------------------------------------------------------------------------------- 1 | -----BEGIN PGP SIGNATURE----- 2 | Version: GnuPG v1.4.6 (GNU/Linux) 3 | 4 | iD8DBQBIwVHBIlOymmZkOgwRAmmbAKC7mPGvGDw7hitOBgtjJniyQrcx8gCgwg5F 5 | 1lZl26uLM1mQDGOX+Glo2IE= 6 | =5cVJ 7 | -----END PGP SIGNATURE----- 8 | -------------------------------------------------------------------------------- /tests/data/aptdeb/component-less/name1_version1-release1_all.deb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smartpm/smart/aa3b298349aee4fc42f42c6af4558fcba46adea7/tests/data/aptdeb/component-less/name1_version1-release1_all.deb -------------------------------------------------------------------------------- /tests/data/aptdeb/component-less/name2_version2-release2_all.deb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smartpm/smart/aa3b298349aee4fc42f42c6af4558fcba46adea7/tests/data/aptdeb/component-less/name2_version2-release2_all.deb -------------------------------------------------------------------------------- /tests/data/aptdeb/dists/Release: -------------------------------------------------------------------------------- 1 | Origin: Smart 2 | Codename: smart 3 | Date: Wed, 03 Sep 2008 22:31:29 UTC 4 | Label: Test Packages 5 | Architectures: all 6 | Components: component 7 | MD5Sum: 8 | 384ccb05e3f6da02312b6e383b211777 571 component/binary-i386/Packages.gz 9 | SHA1: 10 | 1b795920940dbe025615e63c1e7326e4df606161 571 component/binary-all/Packages.gz 11 | SHA256: 12 | beaa1d25b3102980dfa118841c9c569d7988f52f3c29aff044fc187a68a8891f 571 component/binary-i386/Packages.gz 13 | -------------------------------------------------------------------------------- /tests/data/aptdeb/dists/Release.gpg: -------------------------------------------------------------------------------- 1 | -----BEGIN PGP SIGNATURE----- 2 | Version: GnuPG v1.4.6 (GNU/Linux) 3 | 4 | iD8DBQBIwD/oIlOymmZkOgwRAn7EAKCYogemoLIkN9BysZXejsK83WjA7QCgvXCQ 5 | XexQLrr2xsAv2/L/aZQ+1zw= 6 | =A5rE 7 | -----END PGP SIGNATURE----- 8 | -------------------------------------------------------------------------------- /tests/data/aptdeb/dists/component/binary-i386/Packages.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smartpm/smart/aa3b298349aee4fc42f42c6af4558fcba46adea7/tests/data/aptdeb/dists/component/binary-i386/Packages.gz -------------------------------------------------------------------------------- /tests/data/aptdeb/dists/component/binary-i386/name1_version1-release1_all.deb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smartpm/smart/aa3b298349aee4fc42f42c6af4558fcba46adea7/tests/data/aptdeb/dists/component/binary-i386/name1_version1-release1_all.deb -------------------------------------------------------------------------------- /tests/data/aptdeb/dists/component/binary-i386/name2_version2-release2_all.deb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smartpm/smart/aa3b298349aee4fc42f42c6af4558fcba46adea7/tests/data/aptdeb/dists/component/binary-i386/name2_version2-release2_all.deb -------------------------------------------------------------------------------- /tests/data/aptdeb/fink-virtual-pkgs: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | cat <<__EOF__ 4 | Package: darwin 5 | Status: install ok installed 6 | Version: 8.11.1-1 7 | description: [virtual package representing the kernel] 8 | homepage: http://www.finkproject.org/faq/usage-general.php#virtpackage 9 | provides: kernel 10 | 11 | Package: macosx 12 | Status: install ok installed 13 | Version: 10.4.11-1 14 | homepage: http://www.finkproject.org/faq/usage-general.php#virtpackage 15 | description: [virtual package representing the system] 16 | 17 | Package: macosx 18 | Status: install ok installed 19 | Priority: optional 20 | Architecture: darwin-i386 21 | Version: 10.6.8-1 22 | Maintainer: Fink Core Group 23 | Description: [virtual package representing the system] 24 | This package represents the Mac OS X software release. 25 | It will not show as installed on pure Darwin systems. 26 | . 27 | Web site: http://www.finkproject.org/faq/usage-general.php#virtpackage 28 | . 29 | Maintainer: Fink Core Group 30 | 31 | __EOF__ 32 | -------------------------------------------------------------------------------- /tests/data/aptdeb/trustdb.gpg: -------------------------------------------------------------------------------- 1 | gpgT՞ 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /tests/data/aptdeb/trusted.gpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smartpm/smart/aa3b298349aee4fc42f42c6af4558fcba46adea7/tests/data/aptdeb/trusted.gpg -------------------------------------------------------------------------------- /tests/data/aptrpm/RPMS.main/name1-version1-release1.noarch.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smartpm/smart/aa3b298349aee4fc42f42c6af4558fcba46adea7/tests/data/aptrpm/RPMS.main/name1-version1-release1.noarch.rpm -------------------------------------------------------------------------------- /tests/data/aptrpm/RPMS.main/name2-version2-release2.noarch.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smartpm/smart/aa3b298349aee4fc42f42c6af4558fcba46adea7/tests/data/aptrpm/RPMS.main/name2-version2-release2.noarch.rpm -------------------------------------------------------------------------------- /tests/data/aptrpm/base/pkglist.main: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smartpm/smart/aa3b298349aee4fc42f42c6af4558fcba46adea7/tests/data/aptrpm/base/pkglist.main -------------------------------------------------------------------------------- /tests/data/aptrpm/base/pkglist.main.bz2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smartpm/smart/aa3b298349aee4fc42f42c6af4558fcba46adea7/tests/data/aptrpm/base/pkglist.main.bz2 -------------------------------------------------------------------------------- /tests/data/aptrpm/base/release: -------------------------------------------------------------------------------- 1 | Origin: Unknown 2 | Label: Unknown 3 | Suite: Unknown 4 | Codename: Unknown 5 | Date: Tue, 07 Nov 2006 19:05:42 -0200 6 | Architectures: Unknown 7 | Components: main 8 | Description: Not available 9 | MD5Sum: 10 | 702fd0174518aad7de98de13b77a7084 2150 base/pkglist.main 11 | 39146edc246b32c5f0456fd61dc4ae1e 768 base/pkglist.main.bz2 12 | 2d10cf7e8622ff0f583f2e6b39597485 123 base/release.main 13 | 14 | -------------------------------------------------------------------------------- /tests/data/aptrpm/base/release.main: -------------------------------------------------------------------------------- 1 | Archive: Unknown 2 | Component: main 3 | Version: Unknown 4 | Origin: Unknown 5 | Label: Unknown 6 | Architecture: unknown 7 | NotAutomatic: false 8 | -------------------------------------------------------------------------------- /tests/data/arch/name1-version1-release1-i686.pkg.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smartpm/smart/aa3b298349aee4fc42f42c6af4558fcba46adea7/tests/data/arch/name1-version1-release1-i686.pkg.tar.gz -------------------------------------------------------------------------------- /tests/data/arch/name2-version2-release2-i686.pkg.tar.xz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smartpm/smart/aa3b298349aee4fc42f42c6af4558fcba46adea7/tests/data/arch/name2-version2-release2-i686.pkg.tar.xz -------------------------------------------------------------------------------- /tests/data/arch/test.db.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smartpm/smart/aa3b298349aee4fc42f42c6af4558fcba46adea7/tests/data/arch/test.db.tar.gz -------------------------------------------------------------------------------- /tests/data/arch/test.files.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smartpm/smart/aa3b298349aee4fc42f42c6af4558fcba46adea7/tests/data/arch/test.files.tar.gz -------------------------------------------------------------------------------- /tests/data/build/deb/debian/changelog: -------------------------------------------------------------------------------- 1 | name2 (version2-release2) unstable; urgency=low 2 | 3 | * Changelog2. 4 | 5 | -- Gustavo Niemeyer Thu, 14 Dec 2006 13:30:00 -0200 6 | 7 | -------------------------------------------------------------------------------- /tests/data/build/deb/debian/control: -------------------------------------------------------------------------------- 1 | Source: name2 2 | Priority: optional 3 | Section: Group2 4 | Maintainer: Gustavo Niemeyer 5 | Standards-Version: 3.7.2 6 | 7 | Package: name2 8 | Architecture: all 9 | Provides: providesname2 10 | Depends: requirename2 (= requireversion2) 11 | Pre-Depends: prerequirename2 (= prerequireversion2) 12 | Conflicts: conflictsname2 (= conflictsversion2) 13 | Recommends: recommendsname2 (= recommendsversion2) 14 | Suggests: suggestsname2 (= suggestsversion2) 15 | Description: Summary2 16 | Description2 17 | -------------------------------------------------------------------------------- /tests/data/build/deb/debian/rules: -------------------------------------------------------------------------------- 1 | #!/usr/bin/make -f 2 | 3 | configure: configure-stamp 4 | configure-stamp: 5 | dh_testdir 6 | touch configure-stamp 7 | 8 | 9 | build: build-stamp 10 | 11 | build-stamp: configure-stamp 12 | dh_testdir 13 | touch $@ 14 | 15 | clean: 16 | dh_testdir 17 | dh_testroot 18 | rm -f build-stamp configure-stamp 19 | dh_clean 20 | 21 | install: build 22 | dh_testdir 23 | dh_testroot 24 | dh_clean -k 25 | dh_installdirs 26 | 27 | 28 | binary-indep: build install 29 | 30 | binary-arch: build install 31 | dh_testdir 32 | dh_testroot 33 | dh_installchangelogs 34 | dh_installdocs 35 | dh_installexamples 36 | # dh_install 37 | # dh_installmenu 38 | # dh_installdebconf 39 | # dh_installlogrotate 40 | # dh_installemacsen 41 | # dh_installpam 42 | # dh_installmime 43 | # dh_python 44 | # dh_installinit 45 | # dh_installcron 46 | # dh_installinfo 47 | dh_installman 48 | dh_link 49 | dh_strip 50 | dh_compress 51 | dh_fixperms 52 | # dh_perl 53 | # dh_makeshlibs 54 | dh_installdeb 55 | dh_shlibdeps 56 | dh_gencontrol 57 | dh_md5sums 58 | dh_builddeb 59 | 60 | binary: binary-indep binary-arch 61 | .PHONY: build clean binary-indep binary-arch binary install configure 62 | -------------------------------------------------------------------------------- /tests/data/deb: -------------------------------------------------------------------------------- 1 | aptdeb/dists/component/binary-i386 -------------------------------------------------------------------------------- /tests/data/pack/debtest.tar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smartpm/smart/aa3b298349aee4fc42f42c6af4558fcba46adea7/tests/data/pack/debtest.tar -------------------------------------------------------------------------------- /tests/data/pack/rpmtest.pkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smartpm/smart/aa3b298349aee4fc42f42c6af4558fcba46adea7/tests/data/pack/rpmtest.pkg -------------------------------------------------------------------------------- /tests/data/rpm/metalink.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | http://url1.tld/path/repodata/repomd.xml 7 | ftp://url2.tld/path 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /tests/data/rpm/mirrorlist.txt: -------------------------------------------------------------------------------- 1 | # repo = generic arch = i386 2 | http://url1.tld/path 3 | ftp://url2.tld/path 4 | -------------------------------------------------------------------------------- /tests/data/rpm/name1-version1-release1.noarch.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smartpm/smart/aa3b298349aee4fc42f42c6af4558fcba46adea7/tests/data/rpm/name1-version1-release1.noarch.rpm -------------------------------------------------------------------------------- /tests/data/rpm/name2-version2-release2.noarch.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smartpm/smart/aa3b298349aee4fc42f42c6af4558fcba46adea7/tests/data/rpm/name2-version2-release2.noarch.rpm -------------------------------------------------------------------------------- /tests/data/rpm/repodata/filelists.xml.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smartpm/smart/aa3b298349aee4fc42f42c6af4558fcba46adea7/tests/data/rpm/repodata/filelists.xml.gz -------------------------------------------------------------------------------- /tests/data/rpm/repodata/other.xml.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smartpm/smart/aa3b298349aee4fc42f42c6af4558fcba46adea7/tests/data/rpm/repodata/other.xml.gz -------------------------------------------------------------------------------- /tests/data/rpm/repodata/primary.xml.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smartpm/smart/aa3b298349aee4fc42f42c6af4558fcba46adea7/tests/data/rpm/repodata/primary.xml.gz -------------------------------------------------------------------------------- /tests/data/rpm/repodata/repomd.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | a85b846a889e8da400a1ea5dc1eb2fa0d2da7e82 6 | 1135343099 7 | d01ef6fcc5b15c06d36b8ac0704ad156a52648ad 8 | 9 | 10 | 11 | cde662b6778e5294f7c63ebb33569d5b6144d3d9 12 | 1135343099 13 | 7705a2b76dad1047110531885c4316928bb4d5a0 14 | 15 | 16 | 17 | 1c26db370ddb96ba672a415db9c3db246f6a4185 18 | 1135343099 19 | c31d0cb0d3ddaee86a8c1402421192c93f1a61c9 20 | 21 | 22 | -------------------------------------------------------------------------------- /tests/data/rpm/repodata/updateinfo.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | SMARTTEST-2008-001 5 | update fixes bugs 6 | Smart 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | Smart 15 | 16 | name1-version1-release1.noarch.rpm 17 | 18 | 19 | name2-version2-release2.noarch.rpm 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /tests/data/slack/CHECKSUMS.md5: -------------------------------------------------------------------------------- 1 | 9cccc5220c6b2d6afdf60d7ff6b800a4 ./name1-version1-noarch-release1.tgz 2 | f50c5223c71457c39257a11514675e52 ./name2-version2-noarch-release2.tgz 3 | -------------------------------------------------------------------------------- /tests/data/slack/PACKAGES.TXT: -------------------------------------------------------------------------------- 1 | PACKAGES.TXT; Sun Aug 3 18:00:00 CEST 2008 2 | 3 | This file provides details on the Slackware packages found 4 | in the ./ directory. 5 | 6 | Total size of all packages (compressed): 0 MB 7 | Total size of all packages (uncompressed): 0 MB 8 | 9 | 10 | PACKAGE NAME: name1-version1-noarch-release1.tgz 11 | PACKAGE LOCATION: . 12 | PACKAGE SIZE (compressed): 0 K 13 | PACKAGE SIZE (uncompressed): 0 K 14 | PACKAGE DESCRIPTION: 15 | name1: Summary1 16 | name1: 17 | name1: Description1 18 | name1: License: License1 19 | name1: Authors: 20 | name1: Website: http://www.example.com/name1 21 | 22 | PACKAGE NAME: name2-version2-noarch-release2.tgz 23 | PACKAGE LOCATION: . 24 | PACKAGE SIZE (compressed): 0 K 25 | PACKAGE SIZE (uncompressed): 0 K 26 | PACKAGE DESCRIPTION: 27 | name2: Summary2 28 | name2: 29 | name2: Description2 30 | name2: License: License2 31 | name2: Authors: 32 | name2: Website: http://www.example.com/name2 33 | -------------------------------------------------------------------------------- /tests/data/slack/name1-version1-noarch-release1.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smartpm/smart/aa3b298349aee4fc42f42c6af4558fcba46adea7/tests/data/slack/name1-version1-noarch-release1.tgz -------------------------------------------------------------------------------- /tests/data/slack/name2-version2-noarch-release2.txz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smartpm/smart/aa3b298349aee4fc42f42c6af4558fcba46adea7/tests/data/slack/name2-version2-noarch-release2.txz -------------------------------------------------------------------------------- /tests/data/uncompress/test.7z: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smartpm/smart/aa3b298349aee4fc42f42c6af4558fcba46adea7/tests/data/uncompress/test.7z -------------------------------------------------------------------------------- /tests/data/uncompress/test.bz2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smartpm/smart/aa3b298349aee4fc42f42c6af4558fcba46adea7/tests/data/uncompress/test.bz2 -------------------------------------------------------------------------------- /tests/data/uncompress/test.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smartpm/smart/aa3b298349aee4fc42f42c6af4558fcba46adea7/tests/data/uncompress/test.gz -------------------------------------------------------------------------------- /tests/data/uncompress/test.lzma: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smartpm/smart/aa3b298349aee4fc42f42c6af4558fcba46adea7/tests/data/uncompress/test.lzma -------------------------------------------------------------------------------- /tests/data/uncompress/test.txt: -------------------------------------------------------------------------------- 1 | Hello, World! 2 | 3 | -------------------------------------------------------------------------------- /tests/data/uncompress/test.xz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smartpm/smart/aa3b298349aee4fc42f42c6af4558fcba46adea7/tests/data/uncompress/test.xz -------------------------------------------------------------------------------- /tests/data/uncompress/test.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smartpm/smart/aa3b298349aee4fc42f42c6af4558fcba46adea7/tests/data/uncompress/test.zip -------------------------------------------------------------------------------- /tests/data/urpmi-xml/media_info/MD5SUM: -------------------------------------------------------------------------------- 1 | 956622cf9049e4ea044a491cbe1cbf05 hdlist.cz 2 | 19fc2aabe2513b2ecf05fcdb4c15d36d synthesis.hdlist.cz 3 | d587aeba5b6b3a76317962f2b2ab8744 changelog.xml.lzma 4 | d587aeba5b6b3a76317962f2b2ab8744 files.xml.lzma 5 | 4fa3443fc4e0438b93da9b5d15d6732b info.xml.lzma 6 | -------------------------------------------------------------------------------- /tests/data/urpmi-xml/media_info/changelog.xml.lzma: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smartpm/smart/aa3b298349aee4fc42f42c6af4558fcba46adea7/tests/data/urpmi-xml/media_info/changelog.xml.lzma -------------------------------------------------------------------------------- /tests/data/urpmi-xml/media_info/files.xml.lzma: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smartpm/smart/aa3b298349aee4fc42f42c6af4558fcba46adea7/tests/data/urpmi-xml/media_info/files.xml.lzma -------------------------------------------------------------------------------- /tests/data/urpmi-xml/media_info/hdlist.cz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smartpm/smart/aa3b298349aee4fc42f42c6af4558fcba46adea7/tests/data/urpmi-xml/media_info/hdlist.cz -------------------------------------------------------------------------------- /tests/data/urpmi-xml/media_info/info.xml.lzma: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smartpm/smart/aa3b298349aee4fc42f42c6af4558fcba46adea7/tests/data/urpmi-xml/media_info/info.xml.lzma -------------------------------------------------------------------------------- /tests/data/urpmi-xml/media_info/synthesis.hdlist.cz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smartpm/smart/aa3b298349aee4fc42f42c6af4558fcba46adea7/tests/data/urpmi-xml/media_info/synthesis.hdlist.cz -------------------------------------------------------------------------------- /tests/data/urpmi-xml/name1-version1-release1.noarch.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smartpm/smart/aa3b298349aee4fc42f42c6af4558fcba46adea7/tests/data/urpmi-xml/name1-version1-release1.noarch.rpm -------------------------------------------------------------------------------- /tests/data/urpmi-xml/name2-version2-release2.noarch.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smartpm/smart/aa3b298349aee4fc42f42c6af4558fcba46adea7/tests/data/urpmi-xml/name2-version2-release2.noarch.rpm -------------------------------------------------------------------------------- /tests/data/urpmi-xml/reconfig.urpmi: -------------------------------------------------------------------------------- 1 | / /media_info/ 2 | -------------------------------------------------------------------------------- /tests/data/urpmi/clock: -------------------------------------------------------------------------------- 1 | ZONE=Europe/Stockholm 2 | -------------------------------------------------------------------------------- /tests/data/urpmi/media_info/MD5SUM: -------------------------------------------------------------------------------- 1 | 956622cf9049e4ea044a491cbe1cbf05 hdlist.cz 2 | 19fc2aabe2513b2ecf05fcdb4c15d36d synthesis.hdlist.cz 3 | -------------------------------------------------------------------------------- /tests/data/urpmi/media_info/descriptions: -------------------------------------------------------------------------------- 1 | %package name1 name2 2 | Update: Wed Jun 20 01:02:03 2007 3 | Importance: bugfix 4 | ID: SMARTTEST-2008:001 5 | URL: http://www.example.com/security/advisories?name=SMARTTEST-2008:001 6 | 7 | %pre 8 | update fixes bugs 9 | 10 | %description 11 | 12 | -------------------------------------------------------------------------------- /tests/data/urpmi/media_info/hdlist.cz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smartpm/smart/aa3b298349aee4fc42f42c6af4558fcba46adea7/tests/data/urpmi/media_info/hdlist.cz -------------------------------------------------------------------------------- /tests/data/urpmi/media_info/synthesis.hdlist.cz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smartpm/smart/aa3b298349aee4fc42f42c6af4558fcba46adea7/tests/data/urpmi/media_info/synthesis.hdlist.cz -------------------------------------------------------------------------------- /tests/data/urpmi/mirrorlist.txt: -------------------------------------------------------------------------------- 1 | continent=EU,zone=NO,country=Norway,city=Oslo,latitude=59.65,longitude=9.65,bw=1GB,version=2010.1,arch=x86_64,type=distrib,url=http://ftp.uio.no/linux/MandrivaLinux/official/2010.1/x86_64 2 | continent=EU,zone=NO,country=Norway,city=Oslo,latitude=59.65,longitude=9.65,bw=1GB,version=2010.1,arch=x86_64,type=iso,url=http://ftp.uio.no/linux/MandrivaLinux/official/iso/2010.1 3 | continent=EU,zone=NO,country=Norway,city=Oslo,latitude=59.65,longitude=9.65,bw=1GB,version=2010.1,arch=x86_64,type=distrib,url=rsync://ftp.uio.no/Mandrivalinux/official/2010.1/x86_64 4 | continent=EU,zone=SE,country=Sweden,city=Uppsala,latitude=59.85,longitude=17.63,bw=2GB,version=2010.1,arch=x86_64,type=distrib,url=http://ftp.sunet.se/pub/Linux/distributions/mandrakelinux/official/2010.1/x86_64 5 | continent=EU,zone=SE,country=Sweden,city=Uppsala,latitude=59.85,longitude=17.63,bw=2GB,version=2010.1,arch=x86_64,type=updates,url=http://ftp.sunet.se/pub/Linux/distributions/mandrakelinux/official/2010.1/x86_64 6 | continent=EU,zone=SE,country=Sweden,city=Uppsala,latitude=59.85,longitude=17.63,bw=2GB,version=2010.1,arch=x86_64,type=iso,url=http://ftp.sunet.se/pub/Linux/distributions/mandrakelinux/official/iso/2010.1 7 | -------------------------------------------------------------------------------- /tests/data/urpmi/name1-version1-release1.noarch.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smartpm/smart/aa3b298349aee4fc42f42c6af4558fcba46adea7/tests/data/urpmi/name1-version1-release1.noarch.rpm -------------------------------------------------------------------------------- /tests/data/urpmi/name2-version2-release2.noarch.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smartpm/smart/aa3b298349aee4fc42f42c6af4558fcba46adea7/tests/data/urpmi/name2-version2-release2.noarch.rpm -------------------------------------------------------------------------------- /tests/data/urpmi/reconfig.urpmi: -------------------------------------------------------------------------------- 1 | / /media_info/ 2 | -------------------------------------------------------------------------------- /tests/data/urpmi/zone.tab: -------------------------------------------------------------------------------- 1 | NO +5955+01045 Europe/Oslo 2 | SE +5920+01803 Europe/Stockholm 3 | -------------------------------------------------------------------------------- /tests/data/yast2-compressed/RPMS/noarch/name1-version1-release1.noarch.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smartpm/smart/aa3b298349aee4fc42f42c6af4558fcba46adea7/tests/data/yast2-compressed/RPMS/noarch/name1-version1-release1.noarch.rpm -------------------------------------------------------------------------------- /tests/data/yast2-compressed/RPMS/noarch/name2-version2-release2.noarch.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smartpm/smart/aa3b298349aee4fc42f42c6af4558fcba46adea7/tests/data/yast2-compressed/RPMS/noarch/name2-version2-release2.noarch.rpm -------------------------------------------------------------------------------- /tests/data/yast2-compressed/content: -------------------------------------------------------------------------------- 1 | PRODUCT tests 2 | VERSION 10.0-0 3 | LABEL tests (SMART) 4 | VENDOR Smart Package Manager 5 | ARCH.i686 i686 i586 i486 i386 noarch 6 | ARCH.i586 i586 i486 i386 noarch 7 | DEFAULTBASE i586 8 | DESCRDIR setup/descr 9 | DATADIR RPMS 10 | META SHA1 94e15eb4e437c2fc62d7c6cbc097353955f66f6d packages.DU.gz 11 | META SHA1 2df96fdea559d2cc5376794be4c7868ecdec20fe packages.en.gz 12 | META SHA1 3fc5218af5c2563418984c4b21a5f37a4d66cd84 packages.gz 13 | 14 | -------------------------------------------------------------------------------- /tests/data/yast2-compressed/directory.yast: -------------------------------------------------------------------------------- 1 | content 2 | directory.yast 3 | media.1 4 | RPMS 5 | setup 6 | suse 7 | -------------------------------------------------------------------------------- /tests/data/yast2-compressed/media.1/media: -------------------------------------------------------------------------------- 1 | tests 2 | 20060109160652 3 | 1 4 | -------------------------------------------------------------------------------- /tests/data/yast2-compressed/setup/descr/packages.DU.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smartpm/smart/aa3b298349aee4fc42f42c6af4558fcba46adea7/tests/data/yast2-compressed/setup/descr/packages.DU.gz -------------------------------------------------------------------------------- /tests/data/yast2-compressed/setup/descr/packages.en.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smartpm/smart/aa3b298349aee4fc42f42c6af4558fcba46adea7/tests/data/yast2-compressed/setup/descr/packages.en.gz -------------------------------------------------------------------------------- /tests/data/yast2-compressed/setup/descr/packages.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smartpm/smart/aa3b298349aee4fc42f42c6af4558fcba46adea7/tests/data/yast2-compressed/setup/descr/packages.gz -------------------------------------------------------------------------------- /tests/data/yast2/RPMS/noarch/name1-version1-release1.noarch.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smartpm/smart/aa3b298349aee4fc42f42c6af4558fcba46adea7/tests/data/yast2/RPMS/noarch/name1-version1-release1.noarch.rpm -------------------------------------------------------------------------------- /tests/data/yast2/RPMS/noarch/name2-version2-release2.noarch.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smartpm/smart/aa3b298349aee4fc42f42c6af4558fcba46adea7/tests/data/yast2/RPMS/noarch/name2-version2-release2.noarch.rpm -------------------------------------------------------------------------------- /tests/data/yast2/content: -------------------------------------------------------------------------------- 1 | PRODUCT tests 2 | VERSION 10.0-0 3 | LABEL tests (SMART) 4 | VENDOR Smart Package Manager 5 | ARCH.i686 i686 i586 i486 i386 noarch 6 | ARCH.i586 i586 i486 i386 noarch 7 | DEFAULTBASE i586 8 | DESCRDIR setup/descr 9 | DATADIR RPMS 10 | -------------------------------------------------------------------------------- /tests/data/yast2/directory.yast: -------------------------------------------------------------------------------- 1 | content 2 | directory.yast 3 | media.1 4 | RPMS 5 | setup 6 | suse 7 | -------------------------------------------------------------------------------- /tests/data/yast2/media.1/media: -------------------------------------------------------------------------------- 1 | tests 2 | 20060109160652 3 | 1 4 | -------------------------------------------------------------------------------- /tests/data/yast2/setup/descr/packages: -------------------------------------------------------------------------------- 1 | =Ver: 2.0 2 | ##---------------------------------------- 3 | =Pkg: name1 version1 release1 noarch 4 | +Req: 5 | /bin/sh 6 | /bin/sh 7 | prerequirename1 = prerequireversion1 8 | requirename1 = requireversion1 9 | rpmlib(CompressedFileNames) <= 3.0.4-1 10 | rpmlib(PayloadFilesHavePrefix) <= 4.0-1 11 | rpmlib(VersionedDependencies) <= 3.0.3-1 12 | -Req: 13 | +Prv: 14 | providename1 = provideversion1 15 | name1 = version1-release1 16 | -Prv: 17 | +Con: 18 | conflictsname1 = conflictsversion1 19 | -Con: 20 | +Obs: 21 | obsoletesname1 = obsoletesversion1 22 | -Obs: 23 | =Grp: Group1 24 | =Lic: License1 25 | =Src: name1 version1 release1 src 26 | =Tim: 1135342886 27 | =Loc: 1 name1-version1-release1.noarch.rpm 28 | =Siz: 2160 0 29 | ##---------------------------------------- 30 | =Pkg: name2 version2 release2 noarch 31 | +Req: 32 | /bin/sh 33 | /bin/sh 34 | prerequirename1 = prerequireversion2 35 | requirename2 = requireversion2 36 | rpmlib(CompressedFileNames) <= 3.0.4-1 37 | rpmlib(PayloadFilesHavePrefix) <= 4.0-1 38 | rpmlib(VersionedDependencies) <= 3.0.3-1 39 | -Req: 40 | +Prv: 41 | providename2 = provideversion2 42 | name2 = version2-release2 43 | -Prv: 44 | +Con: 45 | conflictsname2 = conflictsversion2 46 | -Con: 47 | +Obs: 48 | obsoletesname2 = obsoletesversion2 49 | -Obs: 50 | =Grp: Group2 51 | =Lic: License2 52 | =Src: name2 version2 release2 src 53 | =Tim: 1135342922 54 | =Loc: 1 name2-version2-release2.noarch.rpm 55 | =Siz: 2160 0 56 | -------------------------------------------------------------------------------- /tests/data/yast2/setup/descr/packages.DU: -------------------------------------------------------------------------------- 1 | =Ver: 2.0 2 | ##---------------------------------------- 3 | =Pkg: name1 version1 release1 noarch 4 | +Dir: 5 | / 0 1 0 1 6 | tmp/ 1 0 1 0 7 | -Dir: 8 | ##---------------------------------------- 9 | =Pkg: name2 version2 release2 noarch 10 | +Dir: 11 | / 0 1 0 1 12 | tmp/ 1 0 1 0 13 | -Dir: 14 | -------------------------------------------------------------------------------- /tests/data/yast2/setup/descr/packages.en: -------------------------------------------------------------------------------- 1 | =Ver: 2.0 2 | ##---------------------------------------- 3 | =Pkg: name1 version1 release1 noarch 4 | =Sum: Summary1 5 | +Des: 6 | Description1 7 | -Des: 8 | ##---------------------------------------- 9 | =Pkg: name2 version2 release2 noarch 10 | =Sum: Summary2 11 | +Des: 12 | Description2 13 | -Des: 14 | -------------------------------------------------------------------------------- /tests/data/yumrpm/metalink-broken.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /tests/data/yumrpm/mirrorlist-broken.txt: -------------------------------------------------------------------------------- 1 | # broken 2 | -------------------------------------------------------------------------------- /tests/data/yumrpm/name1-version1-release1.noarch.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smartpm/smart/aa3b298349aee4fc42f42c6af4558fcba46adea7/tests/data/yumrpm/name1-version1-release1.noarch.rpm -------------------------------------------------------------------------------- /tests/data/yumrpm/name2-version2-release2.noarch.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smartpm/smart/aa3b298349aee4fc42f42c6af4558fcba46adea7/tests/data/yumrpm/name2-version2-release2.noarch.rpm -------------------------------------------------------------------------------- /tests/data/yumrpm/repodata/00918afbb983349105125c0182d6bb61511bfa6cb565e5210ae43c3fa30fb7ee-filelists.sqlite.bz2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smartpm/smart/aa3b298349aee4fc42f42c6af4558fcba46adea7/tests/data/yumrpm/repodata/00918afbb983349105125c0182d6bb61511bfa6cb565e5210ae43c3fa30fb7ee-filelists.sqlite.bz2 -------------------------------------------------------------------------------- /tests/data/yumrpm/repodata/077eb7b5f9cf321a8ff862fad6e5712f47b55e0f49413a886db0318fae2e393d-primary.xml.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smartpm/smart/aa3b298349aee4fc42f42c6af4558fcba46adea7/tests/data/yumrpm/repodata/077eb7b5f9cf321a8ff862fad6e5712f47b55e0f49413a886db0318fae2e393d-primary.xml.gz -------------------------------------------------------------------------------- /tests/data/yumrpm/repodata/47375fb1438614a7b6058cea2a716b0331f4d0d7f1c91761996144d15b2427b2-primary.sqlite.bz2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smartpm/smart/aa3b298349aee4fc42f42c6af4558fcba46adea7/tests/data/yumrpm/repodata/47375fb1438614a7b6058cea2a716b0331f4d0d7f1c91761996144d15b2427b2-primary.sqlite.bz2 -------------------------------------------------------------------------------- /tests/data/yumrpm/repodata/655b55a361aeff1440244ab9dc473175e84c84bbd708263792a3a543b24c4d92-other.sqlite.bz2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smartpm/smart/aa3b298349aee4fc42f42c6af4558fcba46adea7/tests/data/yumrpm/repodata/655b55a361aeff1440244ab9dc473175e84c84bbd708263792a3a543b24c4d92-other.sqlite.bz2 -------------------------------------------------------------------------------- /tests/data/yumrpm/repodata/caa0be22bc2bf69dabd43e81e17601f1ce05730b823c47626aad96bcec801e15-other.xml.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smartpm/smart/aa3b298349aee4fc42f42c6af4558fcba46adea7/tests/data/yumrpm/repodata/caa0be22bc2bf69dabd43e81e17601f1ce05730b823c47626aad96bcec801e15-other.xml.gz -------------------------------------------------------------------------------- /tests/data/yumrpm/repodata/f6da66cef2af5fa3a35785617e7a2e7c03241cf1abcd6e28280e25b308e578d7-filelists.xml.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smartpm/smart/aa3b298349aee4fc42f42c6af4558fcba46adea7/tests/data/yumrpm/repodata/f6da66cef2af5fa3a35785617e7a2e7c03241cf1abcd6e28280e25b308e578d7-filelists.xml.gz -------------------------------------------------------------------------------- /tests/debbase.py: -------------------------------------------------------------------------------- 1 | import sys 2 | 3 | from tests.mocker import MockerTestCase 4 | 5 | import smart.backends.deb._base 6 | 7 | from smart.backends.deb.base import getArchitecture 8 | from smart.backends.deb.debver import splitrelease 9 | 10 | 11 | class GetArchitectureTest(MockerTestCase): 12 | 13 | def fake_uname(self): 14 | return ('Linux', 'burma', '2.6.24-19-generic', 15 | '#1 SMP Wed Aug 20 22:56:21 UTC 2008', self.fake_arch) 16 | 17 | def set_arch_and_platform(self, arch, platform): 18 | self.fake_arch = arch 19 | sys.platform = platform 20 | 21 | def setUp(self): 22 | self.fake_arch = "i686" 23 | self.real_platform = sys.platform 24 | self.real_arm_eabi = smart.backends.deb._base.arm_eabi 25 | 26 | uname_mock = self.mocker.replace("os.uname") 27 | uname_mock() 28 | self.mocker.call(self.fake_uname) 29 | self.mocker.replay() 30 | 31 | def tearDown(self): 32 | sys.platform = self.real_platform 33 | smart.backends.deb._base.arm_eabi = self.real_arm_eabi 34 | 35 | def test_get_architecture_with_i686_linux2(self): 36 | self.set_arch_and_platform("i686", "linux2") 37 | self.assertEquals(getArchitecture(), "i386") 38 | 39 | def test_get_architecture_with_arm_linux2(self): 40 | self.set_arch_and_platform("arm", "linux2") 41 | def fake_arm_eabi(): return True 42 | smart.backends.deb._base.arm_eabi = fake_arm_eabi 43 | self.assertEquals(getArchitecture(), "armel") 44 | 45 | def test_get_architecture_with_i686_anything(self): 46 | self.set_arch_and_platform("i686", "anything") 47 | self.assertEquals(getArchitecture(), "anything-i386") 48 | 49 | def test_get_architecture_with_i86pc_anything(self): 50 | self.set_arch_and_platform("i86pc", "anything") 51 | self.assertEquals(getArchitecture(), "anything-i386") 52 | 53 | def test_get_architecture_with_i386_darwin(self): 54 | self.set_arch_and_platform("i386", "darwin") 55 | self.assertEquals(getArchitecture(), "darwin-i386") 56 | 57 | def test_get_architecture_with_i86pc_sunos5(self): 58 | self.set_arch_and_platform("i86pc", "sunos5") 59 | self.assertEquals(getArchitecture(), "solaris-i386") 60 | 61 | class DebVerSplitTest(MockerTestCase): 62 | 63 | def test_splitrelease(self): 64 | version, release = splitrelease("1.0-1_0ubuntu0.10.04") 65 | self.assertEquals(version, "1.0") 66 | self.assertEquals(release, "1_0ubuntu0.10.04") 67 | 68 | -------------------------------------------------------------------------------- /tests/descriptions.txt: -------------------------------------------------------------------------------- 1 | 2 | Set up the parser. 3 | 4 | >>> from tests import * 5 | >>> from smart.backends.rpm.descriptions import RPMDescriptions 6 | >>> localpath = "%s/urpmi/media_info/descriptions" % TESTDATADIR 7 | >>> baseurl = "file://%s" % localpath 8 | >>> descriptions = RPMDescriptions(localpath) 9 | >>> descriptions.load() 10 | 11 | >>> descriptions.getErrataFlags() 12 | {'name2': 'bugfix', 'name1': 'bugfix'} 13 | >>> descriptions.setErrataFlags() 14 | 15 | This should give us one test "update" with data we already know. 16 | 17 | >>> pkgconf.getFlagNames() 18 | ['bugfix'] 19 | >>> sorted(pkgconf.getFlagTargets('bugfix')) 20 | ['name1', 'name2'] 21 | 22 | -------------------------------------------------------------------------------- /tests/detectchannels.txt: -------------------------------------------------------------------------------- 1 | 2 | >>> from tests import * 3 | 4 | Test APT (RPM and DEB). 5 | 6 | >>> from smart.channels.apt_rpm_info import detectLocalChannels 7 | >>> detectLocalChannels("%s/aptrpm" % TESTDATADIR, None) 8 | [{'baseurl': 'file://.../aptrpm', 'components': 'main'}] 9 | 10 | >>> from smart.channels.apt_deb_info import detectLocalChannels 11 | >>> detectLocalChannels("%s/aptdeb" % TESTDATADIR, None) 12 | [{'baseurl': 'file://.../aptdeb', 'components': 'component'}] 13 | 14 | Test RPM-MD repodata. 15 | 16 | >>> from smart.channels.rpm_md_info import detectLocalChannels 17 | >>> detectLocalChannels("%s/rpm" % TESTDATADIR, None) 18 | [{'baseurl': 'file://.../rpm'}] 19 | 20 | -------------------------------------------------------------------------------- /tests/fink.txt: -------------------------------------------------------------------------------- 1 | 2 | Set up the system provides. 3 | 4 | >>> from tests import * 5 | >>> from smart.backends.deb.base import FinkVirtualPkgs, DebRequires 6 | >>> localpath = "%s/aptdeb/fink-virtual-pkgs" % TESTDATADIR 7 | >>> pkgs = FinkVirtualPkgs(localpath) 8 | 9 | Check for virtual package. 10 | 11 | >>> depends = DebRequires("macosx", None, None) 12 | >>> pkgs.matches(depends) 13 | True 14 | >>> depends = DebRequires("darwin", ">=" , "8-1") 15 | >>> pkgs.matches(depends) 16 | True 17 | 18 | -------------------------------------------------------------------------------- /tests/initialization.py: -------------------------------------------------------------------------------- 1 | import pickle 2 | import sys 3 | 4 | from tests.mocker import MockerTestCase 5 | 6 | from smart import initPlugins, sysconf 7 | 8 | 9 | class InitPluginsTest(MockerTestCase): 10 | 11 | def setUp(self): 12 | from smart import const 13 | self.old_sysconf = pickle.dumps(sysconf.object) 14 | self.old_plugins_dir = const.PLUGINSDIR 15 | self.plugins_dir = self.makeDir() 16 | const.PLUGINSDIR = self.plugins_dir 17 | 18 | def tearDown(self): 19 | from smart import const 20 | const.PLUGINSDIR = self.old_plugins_dir 21 | sysconf.object = pickle.loads(self.old_sysconf) 22 | 23 | def test_plugins_dir_is_used(self): 24 | self.makeFile("import sys; sys.test_worked = True", 25 | basename="plugin.py", dirname=self.plugins_dir) 26 | initPlugins() 27 | self.assertEquals(getattr(sys, "test_worked", False), True) 28 | del sys.test_worked 29 | 30 | -------------------------------------------------------------------------------- /tests/interface.py: -------------------------------------------------------------------------------- 1 | import termios 2 | import struct 3 | import fcntl 4 | 5 | from tests.mocker import MockerTestCase 6 | 7 | from smart.interface import getScreenWidth 8 | import smart 9 | 10 | 11 | 12 | class InterfaceTest(MockerTestCase): 13 | 14 | def test_getScreenWidth(self): 15 | input_data = struct.pack("HHHH", 0, 0, 0, 0) 16 | output_data = struct.pack("HHHH", 0, 100, 0, 0) 17 | 18 | ioctl_mock = self.mocker.replace(fcntl.ioctl) 19 | ioctl_mock(1, termios.TIOCGWINSZ, input_data) 20 | self.mocker.result(output_data) 21 | 22 | self.mocker.replay() 23 | 24 | self.assertEquals(getScreenWidth(), 100) 25 | 26 | def test_getScreenWidth_with_zero_width_falls_back_to_80(self): 27 | input_data = struct.pack("HHHH", 0, 0, 0, 0) 28 | output_data = struct.pack("HHHH", 0, 0, 0, 0) 29 | 30 | ioctl_mock = self.mocker.replace(fcntl.ioctl) 31 | ioctl_mock(1, termios.TIOCGWINSZ, input_data) 32 | self.mocker.result(output_data) 33 | 34 | self.mocker.replay() 35 | 36 | self.assertEquals(getScreenWidth(), 80) 37 | 38 | def test_getScreenWidth_falls_back_to_80_if_raising_IOError(self): 39 | input_data = struct.pack("HHHH", 0, 0, 0, 0) 40 | 41 | ioctl_mock = self.mocker.replace(fcntl.ioctl) 42 | ioctl_mock(1, termios.TIOCGWINSZ, input_data) 43 | self.mocker.throw(IOError) 44 | 45 | self.mocker.replay() 46 | 47 | self.assertEquals(getScreenWidth(), 80) 48 | 49 | -------------------------------------------------------------------------------- /tests/metalink.txt: -------------------------------------------------------------------------------- 1 | 2 | Create the channel. 3 | 4 | >>> from tests import * 5 | >>> from smart.channel import createChannel 6 | >>> channel = createChannel("alias", 7 | ... {"type": "rpm-md", 8 | ... "baseurl": "file://%s/rpm" % TESTDATADIR, 9 | ... "mirrorlist": "file://%s/rpm/metalink.xml" % TESTDATADIR}) 10 | >>> channel 11 | 12 | 13 | 14 | We need a progress and a fetcher. 15 | 16 | >>> from smart.progress import Progress 17 | >>> from smart.fetcher import Fetcher 18 | >>> progress = Progress() 19 | >>> fetcher = Fetcher() 20 | 21 | 22 | Fetch channel data. 23 | 24 | >>> channel.fetch(fetcher, progress) 25 | True 26 | >>> channel.getLoaders() 27 | [] 28 | 29 | 30 | Now let's test for the mirror information. 31 | 32 | >>> channel.getMirrors() 33 | {...: ['http://url1.tld/path', 'ftp://url2.tld/path']} 34 | 35 | vim:ft=doctest 36 | -------------------------------------------------------------------------------- /tests/mirrorlist.txt: -------------------------------------------------------------------------------- 1 | 2 | Create the channel. 3 | 4 | >>> from tests import * 5 | >>> from smart.channel import createChannel 6 | >>> channel = createChannel("alias", 7 | ... {"type": "rpm-md", 8 | ... "baseurl": "file://%s/rpm" % TESTDATADIR, 9 | ... "mirrorlist": "file://%s/rpm/mirrorlist.txt" % TESTDATADIR}) 10 | >>> channel 11 | 12 | 13 | 14 | We need a progress and a fetcher. 15 | 16 | >>> from smart.progress import Progress 17 | >>> from smart.fetcher import Fetcher 18 | >>> progress = Progress() 19 | >>> fetcher = Fetcher() 20 | 21 | 22 | Fetch channel data. 23 | 24 | >>> channel.fetch(fetcher, progress) 25 | True 26 | >>> channel.getLoaders() 27 | [] 28 | 29 | 30 | Now let's test for the mirror information. 31 | 32 | >>> channel.getMirrors() 33 | {...: ['http://url1.tld/path', 'ftp://url2.tld/path']} 34 | 35 | vim:ft=doctest 36 | -------------------------------------------------------------------------------- /tests/mirrorurl.txt: -------------------------------------------------------------------------------- 1 | 2 | Create the channel. 3 | 4 | >>> from tests import * 5 | >>> from smart.channel import createChannel 6 | >>> channel = createChannel("alias", 7 | ... {"type": "urpmi", 8 | ... "baseurl": "file://%s/urpmi" % TESTDATADIR, 9 | ... "mirrorurl": "file://%s/urpmi/mirrorlist.txt" % TESTDATADIR}) 10 | >>> channel 11 | 12 | 13 | >>> import pickle 14 | >>> old_sysconf = pickle.dumps(sysconf.object) 15 | >>> sysconf.set("clock", "%s/urpmi/clock" % TESTDATADIR) 16 | >>> sysconf.set("zone-tab", "%s/urpmi/zone.tab" % TESTDATADIR) 17 | 18 | We need a progress and a fetcher. 19 | 20 | >>> from smart.progress import Progress 21 | >>> from smart.fetcher import Fetcher 22 | >>> progress = Progress() 23 | >>> fetcher = Fetcher() 24 | 25 | 26 | Fetch channel data. 27 | 28 | >>> # Force cache to NEVER so we fetch reconfig.urpmi 29 | >>> from smart.const import NEVER 30 | >>> fetcher.setCaching(NEVER) 31 | >>> channel.fetch(fetcher, progress) 32 | True 33 | >>> channel.getLoaders() 34 | [] 35 | 36 | 37 | Now let's test for the mirror information. 38 | 39 | >>> channel.getMirrors() 40 | {...: ['http://ftp.sunet.se/pub/Linux/distributions/mandrakelinux/official/2010.1/x86_64', 'http://ftp.uio.no/linux/MandrivaLinux/official/2010.1/x86_64']} 41 | 42 | >>> sysconf.object = pickle.loads(old_sysconf) 43 | 44 | vim:ft=doctest 45 | -------------------------------------------------------------------------------- /tests/nothing.txt: -------------------------------------------------------------------------------- 1 | 2 | This test will execute the 'nothing' command. That command should 3 | just build the cache, and return. 4 | 5 | >>> from tests import * 6 | >>> process = smart_process("nothing") 7 | >>> process.wait() 8 | 0 9 | 10 | >>> print "Output:\n\n" + process.stdout.read() 11 | Output: 12 | ... 13 | Updating cache... ######################################## [100%] 14 | 15 | 16 | 17 | 18 | vim:ft=doctest 19 | -------------------------------------------------------------------------------- /tests/pack.txt: -------------------------------------------------------------------------------- 1 | 2 | Create the channel. 3 | 4 | >>> from tests import * 5 | >>> smart = __import__("smart.backends.deb") 6 | >>> smart = __import__("smart.backends.deb.loader") 7 | >>> smart = __import__("smart.backends.rpm") 8 | >>> smart = __import__("smart.backends.rpm.header") 9 | >>> ctrl.addFileChannel("/%s/pack/debtest.tar" % TESTDATADIR) 10 | >>> ctrl.addFileChannel("/%s/pack/rpmtest.pkg" % TESTDATADIR) 11 | 12 | The setup is ready. Now we can load the data into the cache. 13 | 14 | >>> ctrl.reloadChannels() 15 | True 16 | >>> cache = ctrl.getCache() 17 | 18 | This should give us four packages with data we already know. 19 | 20 | >>> len(cache.getPackages()) 21 | 4 22 | 23 | Checking directories is wrong but shouldn't raise IOExceptions. 24 | 25 | >>> ctrl.checkPackageFile(TESTDATADIR) 26 | False 27 | 28 | 29 | vim:ft=doctest 30 | -------------------------------------------------------------------------------- /tests/plugins/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smartpm/smart/aa3b298349aee4fc42f42c6af4558fcba46adea7/tests/plugins/__init__.py -------------------------------------------------------------------------------- /tests/searcher.py: -------------------------------------------------------------------------------- 1 | from mocker import MockerTestCase 2 | 3 | from smart.searcher import Searcher 4 | 5 | 6 | class SearcherTest(MockerTestCase): 7 | 8 | def test_group(self): 9 | searcher = Searcher() 10 | searcher.addGroup("foo") 11 | -------------------------------------------------------------------------------- /tests/slackbase.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | from mocker import MockerTestCase 4 | 5 | from smart.backends.slack.base import SlackPackage, Package, Provides 6 | from smart.backends.slack.slackver import splitarch, splitrelease 7 | from smart import sysconf 8 | 9 | 10 | class SlackPackageTest(MockerTestCase): 11 | 12 | def test_sorting_name_takes_precedence(self): 13 | pkg1 = SlackPackage("name1", "3.0-i486-1") 14 | pkg2 = SlackPackage("name2", "1.0-i486-1") 15 | pkg3 = SlackPackage("name3", "2.0-i486-1") 16 | lst = [pkg3, pkg1, pkg2] 17 | lst.sort() 18 | self.assertEquals(lst, [pkg1, pkg2, pkg3]) 19 | 20 | def test_sorting_version_takes_precedence_over_release(self): 21 | pkg1 = SlackPackage("name", "1.0-i486-3_slack13.0") 22 | pkg2 = SlackPackage("name", "2.0-i486-2_slack13.0") 23 | pkg3 = SlackPackage("name", "3.0-i486-1_slack13.0") 24 | lst = [pkg3, pkg1, pkg2] 25 | lst.sort() 26 | self.assertEquals(lst, [pkg1, pkg2, pkg3]) 27 | 28 | def test_sorting_version_takes_precedence_over_arch(self): 29 | pkg1 = SlackPackage("name", "1.0-i486-1") 30 | pkg2 = SlackPackage("name", "2.0-x86_64-1") 31 | pkg3 = SlackPackage("name", "3.0-i486-1") 32 | lst = [pkg3, pkg1, pkg2] 33 | lst.sort() 34 | self.assertEquals(lst, [pkg1, pkg2, pkg3]) 35 | 36 | class SlackVerSplitTest(MockerTestCase): 37 | 38 | def test_splitarch(self): 39 | version, arch = splitarch("1.0-i486-1") 40 | self.assertEquals(version, "1.0-1") 41 | self.assertEquals(arch, "i486") 42 | 43 | def test_splitrelease(self): 44 | version, release = splitrelease("1.0-1_slack13.0") 45 | self.assertEquals(version, "1.0") 46 | self.assertEquals(release, "1_slack13.0") 47 | 48 | -------------------------------------------------------------------------------- /tests/slackdir.txt: -------------------------------------------------------------------------------- 1 | 2 | Create the channel. 3 | 4 | >>> from tests import * 5 | >>> from smart.channel import createChannel 6 | >>> channel = createChannel("alias", 7 | ... {"type": "slack-dir", 8 | ... "path": "/%s/slack" % TESTDATADIR}) 9 | >>> channel 10 | 11 | 12 | 13 | We need a progress and a fetcher. 14 | 15 | >>> from smart.progress import Progress 16 | >>> from smart.fetcher import Fetcher 17 | >>> progress = Progress() 18 | >>> fetcher = Fetcher() 19 | 20 | 21 | Fetch channel data. 22 | 23 | >>> channel.fetch(fetcher, progress) 24 | True 25 | >>> channel.getLoaders() 26 | [] 27 | 28 | 29 | Let's create a cache to put the loader in, so that we can test it. 30 | 31 | >>> from smart.cache import Cache 32 | >>> loader = channel.getLoaders()[0] 33 | >>> cache = Cache() 34 | >>> cache.addLoader(loader) 35 | 36 | 37 | The setup is ready. Now we can load the data into the cache. 38 | 39 | >>> cache.load() 40 | 41 | 42 | This should give us two packages with the data we already know. 43 | 44 | >>> packages = sorted(cache.getPackages()) 45 | >>> packages 46 | [name1-version1-noarch-release1, name2-version2-noarch-release2] 47 | 48 | >>> pkg = packages[0] 49 | >>> type(pkg) 50 | 51 | 52 | 53 | Let's inspect the package data. 54 | 55 | >>> pkg.name 56 | 'name1' 57 | >>> pkg.version 58 | 'version1-noarch-release1' 59 | 60 | 61 | Now let's ask the loader for a PackageInfo instance, and inspect it. 62 | 63 | >>> info = loader.getInfo(pkg) 64 | >>> info 65 | 66 | 67 | >>> info.getGroup() 68 | 'Slackware' 69 | >>> info.getLicense() 70 | 'License1' 71 | >>> info.getSummary() 72 | 'Summary1' 73 | >>> info.getDescription() 74 | 'Description1\n...' 75 | 76 | >>> info.getURLs() 77 | ['file:///.../data/slack/name1-version1-noarch-release1.tgz'] 78 | >>> url = info.getURLs()[0] 79 | 80 | >>> info.getSHA(url) 81 | >>> info.getSize(url) 82 | 83 | >>> info.getPathList() 84 | ['tmp', 'tmp/file1'] 85 | >>> info.getReferenceURLs() 86 | ['http://www.example.com/name1'] 87 | 88 | 89 | vim:ft=doctest 90 | -------------------------------------------------------------------------------- /tests/slackloader.py: -------------------------------------------------------------------------------- 1 | from smart.backends.slack.loader import SlackLoader, SlackPackageInfo, \ 2 | parsePackageInfo 3 | from smart.cache import Cache, Package 4 | 5 | from tests.mocker import MockerTestCase 6 | 7 | 8 | OLD_PACKAGE = """\ 9 | PACKAGE NAME: name1-version1-arch1-release1 10 | """ 11 | 12 | NEW_PACKAGE = """\ 13 | PACKAGE NAME: name2-version2-arch2-release2_slack13.0.txz 14 | """ 15 | 16 | class SlackLoaderTest(MockerTestCase): 17 | 18 | def setUp(self): 19 | self.cache = Cache() 20 | self.loader = SlackLoader() 21 | self.loader.setCache(self.cache) 22 | 23 | def test_basic_name(self): 24 | file = self.makeFile(OLD_PACKAGE) 25 | info = parsePackageInfo(file)[0] 26 | self.assertEquals(info['name'], "name1") 27 | self.assertEquals(info['version'], "version1-arch1-release1") 28 | 29 | def test_fancy_name(self): 30 | file = self.makeFile(NEW_PACKAGE) 31 | info = parsePackageInfo(file)[0] 32 | self.assertEquals(info['name'], "name2") 33 | self.assertEquals(info['version'], "version2-arch2-release2_slack13.0") 34 | self.assertEquals(info['type'], ".txz") 35 | 36 | def test_keep_location_with_baseurl(self): 37 | baseurl = "http://www.example.com/" 38 | location = "example/path" 39 | pkg = Package('n', 'v-a-r') 40 | info = SlackPackageInfo(pkg, {'baseurl':baseurl, 'location':location, 41 | 'name':pkg.name, 'version':pkg.version }) 42 | url = info.getURLs()[0] 43 | self.assertEquals(url, "http://www.example.com/example/path/n-v-a-r.tgz") 44 | 45 | def test_strip_location_from_baseurl(self): 46 | baseurl = "http://www.example.com/example/" 47 | location = "./example/path" 48 | pkg = Package('n', 'v-a-r') 49 | info = SlackPackageInfo(pkg, {'baseurl':baseurl, 'location':location, 50 | 'name':pkg.name, 'version':pkg.version }) 51 | url = info.getURLs()[0] 52 | self.assertEquals(url, "http://www.example.com/example/path/n-v-a-r.tgz") 53 | -------------------------------------------------------------------------------- /tests/slacksite.txt: -------------------------------------------------------------------------------- 1 | 2 | Create the channel. 3 | 4 | >>> from tests import * 5 | >>> from smart.channel import createChannel 6 | >>> channel = createChannel("alias", 7 | ... {"type": "slack-site", 8 | ... "baseurl": "file://%s/slack" % TESTDATADIR}) 9 | >>> channel 10 | 11 | 12 | 13 | We need a progress and a fetcher. 14 | 15 | >>> from smart.progress import Progress 16 | >>> from smart.fetcher import Fetcher 17 | >>> progress = Progress() 18 | >>> fetcher = Fetcher() 19 | 20 | 21 | Fetch channel data. 22 | 23 | >>> channel.fetch(fetcher, progress) 24 | True 25 | >>> channel.getLoaders() 26 | [] 27 | 28 | 29 | Let's create a cache to put the loader in, so that we can test it. 30 | 31 | >>> from smart.cache import Cache 32 | >>> loader = channel.getLoaders()[0] 33 | >>> cache = Cache() 34 | >>> cache.addLoader(loader) 35 | 36 | 37 | The setup is ready. Now we can load the data into the cache. 38 | 39 | >>> loader.getLoadSteps() 40 | 2 41 | >>> cache.load() 42 | 43 | 44 | This should give us two packages with the data we already know. 45 | 46 | >>> cache.getPackages() 47 | [name1-version1-noarch-release1, name2-version2-noarch-release2] 48 | 49 | >>> pkg = cache.getPackages()[0] 50 | >>> type(pkg) 51 | 52 | 53 | 54 | Let's inspect the package data. 55 | 56 | >>> pkg.name 57 | 'name1' 58 | >>> pkg.version 59 | 'version1-noarch-release1' 60 | 61 | 62 | Now let's ask the loader for a PackageInfo instance, and inspect it. 63 | 64 | >>> info = loader.getInfo(pkg) 65 | >>> info 66 | 67 | 68 | >>> info.getGroup() 69 | 'Slackware' 70 | >>> info.getLicense() 71 | 'License1' 72 | >>> info.getSummary() 73 | 'Summary1' 74 | >>> info.getDescription() 75 | 'Description1\n...' 76 | 77 | >>> info.getURLs() 78 | ['file:///.../data/slack/./name1-version1-noarch-release1.tgz'] 79 | >>> url = info.getURLs()[0] 80 | 81 | >>> info.getMD5(url) 82 | '9cccc5220c6b2d6afdf60d7ff6b800a4' 83 | >>> info.getSize(url) 84 | 85 | >>> info.getReferenceURLs() 86 | ['http://www.example.com/name1'] 87 | 88 | 89 | vim:ft=doctest 90 | -------------------------------------------------------------------------------- /tests/uncompress.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import os 3 | 4 | from smart.uncompress import Uncompressor 5 | 6 | from tests import TESTDATADIR 7 | 8 | class UncompressorTest(unittest.TestCase): 9 | 10 | def compare_files(self, file1, file2): 11 | import filecmp 12 | return filecmp.cmp(file1, file2) 13 | 14 | def tearDown(self): 15 | path = "%s/uncompress/test" % TESTDATADIR 16 | if os.path.exists(path): os.unlink(path) 17 | 18 | def uncompress_file(self, file): 19 | uncompressor = Uncompressor() 20 | handler = uncompressor.getHandler(file) 21 | self.assertTrue(handler.query(file)) 22 | path = "%s/uncompress/test" % TESTDATADIR 23 | self.assertTrue(path == handler.getTargetPath(file)) 24 | uncompressor.uncompress(file) 25 | orig = "%s/uncompress/test.txt" % TESTDATADIR 26 | self.assertTrue(self.compare_files(orig, path)) 27 | os.unlink(path) 28 | 29 | def test_gzip(self): 30 | self.uncompress_file("%s/uncompress/test.gz" % TESTDATADIR) 31 | 32 | def test_bzip2(self): 33 | self.uncompress_file("%s/uncompress/test.bz2" % TESTDATADIR) 34 | 35 | def test_lzma(self): 36 | self.uncompress_file("%s/uncompress/test.lzma" % TESTDATADIR) 37 | 38 | def test_xz(self): 39 | self.uncompress_file("%s/uncompress/test.xz" % TESTDATADIR) 40 | 41 | def test_zip(self): 42 | self.uncompress_file("%s/uncompress/test.zip" % TESTDATADIR) 43 | 44 | def test_7zip(self): 45 | self.uncompress_file("%s/uncompress/test.7z" % TESTDATADIR) 46 | 47 | -------------------------------------------------------------------------------- /tests/updateinfo.txt: -------------------------------------------------------------------------------- 1 | 2 | Set up the parser. 3 | 4 | >>> from tests import * 5 | >>> from smart.backends.rpm.updateinfo import RPMUpdateInfo 6 | >>> localpath = "%s/rpm/repodata/updateinfo.xml" % TESTDATADIR 7 | >>> baseurl = "file://%s" % localpath 8 | >>> updateinfo = RPMUpdateInfo(localpath) 9 | >>> updateinfo.load() 10 | 11 | >>> updateinfo.getErrataFlags() 12 | {'name2=version2-release2@noarch': 'bugfix', 'name1=version1-release1@noarch': 'bugfix'} 13 | >>> updateinfo.setErrataFlags() 14 | 15 | This should give us one test "update" with data we already know. 16 | 17 | >>> pkgconf.getFlagNames() 18 | ['bugfix'] 19 | >>> sorted(pkgconf.getFlagTargets('bugfix')) 20 | ['name1', 'name2'] 21 | 22 | -------------------------------------------------------------------------------- /tests/util/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smartpm/smart/aa3b298349aee4fc42f42c6af4558fcba46adea7/tests/util/__init__.py -------------------------------------------------------------------------------- /tests/util/distance.py: -------------------------------------------------------------------------------- 1 | from tests.mocker import MockerTestCase 2 | 3 | from smart.util.distance import globdistance 4 | 5 | 6 | class DistanceTestBase(MockerTestCase): 7 | 8 | def test_globdistance_with_empty_values(self): 9 | self.assertEquals(globdistance("", ""), (0, 1.0)) 10 | self.assertEquals(globdistance("", "a"), (1, 0.0)) 11 | self.assertEquals(globdistance("a", ""), (1, 0.0)) 12 | --------------------------------------------------------------------------------