From: Michael Tremer Date: Sun, 28 Aug 2011 13:34:50 +0000 (+0200) Subject: Cleanup the package module by removing binary.py and source.py. X-Git-Tag: 0.9.9~29 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e0636b3178eecf75242de18beb37e8c7b7c67c2d;p=pakfire.git Cleanup the package module by removing binary.py and source.py. --- diff --git a/pakfire/builder.py b/pakfire/builder.py index dc30b263b..499ec9276 100644 --- a/pakfire/builder.py +++ b/pakfire/builder.py @@ -35,6 +35,7 @@ import base import chroot import logger import packages +import packages.packager import repository import util @@ -604,7 +605,7 @@ class BuildEnviron(object): # Make all these little package from the build environment. for pkg in reversed(self.pkg.packages): - packager = packages.BinaryPackager(self.pakfire, pkg, self) + packager = packages.packager.BinaryPackager(self.pakfire, pkg, self) packager.run([repo.path,]) self.log.info("") @@ -777,7 +778,7 @@ class Builder2(object): # Make all these little package from the build environment. logging.info(_("Creating packages:")) for pkg in reversed(self.pkg.packages): - packager = packages.BinaryPackager(self.pakfire, pkg, self.buildroot) + packager = packages.packager.BinaryPackager(self.pakfire, pkg, self.buildroot) packager.run([self.resultdir,]) logging.info("") diff --git a/pakfire/packages/__init__.py b/pakfire/packages/__init__.py index 377a95536..dc5fdaded 100644 --- a/pakfire/packages/__init__.py +++ b/pakfire/packages/__init__.py @@ -21,14 +21,11 @@ import tarfile -from binary import BinaryPackage -from file import InnerTarFile +from file import BinaryPackage, InnerTarFile, SourcePackage from installed import DatabasePackage, InstalledPackage from solv import SolvPackage -from source import SourcePackage from make import Makefile -from packager import BinaryPackager from pakfire.constants import * diff --git a/pakfire/packages/binary.py b/pakfire/packages/binary.py deleted file mode 100644 index b0b06ebbe..000000000 --- a/pakfire/packages/binary.py +++ /dev/null @@ -1,42 +0,0 @@ -#!/usr/bin/python -############################################################################### -# # -# Pakfire - The IPFire package management system # -# Copyright (C) 2011 Pakfire development team # -# # -# This program is free software: you can redistribute it and/or modify # -# it under the terms of the GNU General Public License as published by # -# the Free Software Foundation, either version 3 of the License, or # -# (at your option) any later version. # -# # -# This program is distributed in the hope that it will be useful, # -# but WITHOUT ANY WARRANTY; without even the implied warranty of # -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # -# GNU General Public License for more details. # -# # -# You should have received a copy of the GNU General Public License # -# along with this program. If not, see . # -# # -############################################################################### - -from file import FilePackage - -class BinaryPackage(FilePackage): - def get_scriptlet(self, type): - a = self.open_archive() - - # Path of the scriptlet in the tarball. - path = "scriptlets/%s" % type - - try: - f = a.extractfile(path) - except KeyError: - # If the scriptlet is not available, we just return. - return - - scriptlet = f.read() - - f.close() - a.close() - - return scriptlet diff --git a/pakfire/packages/file.py b/pakfire/packages/file.py index 2f322dc5b..c4cdacd88 100644 --- a/pakfire/packages/file.py +++ b/pakfire/packages/file.py @@ -654,3 +654,28 @@ class FilePackage(Package): return [] return conflicts.split() + + +class SourcePackage(FilePackage): + pass + + +class BinaryPackage(FilePackage): + def get_scriptlet(self, type): + a = self.open_archive() + + # Path of the scriptlet in the tarball. + path = "scriptlets/%s" % type + + try: + f = a.extractfile(path) + except KeyError: + # If the scriptlet is not available, we just return. + return + + scriptlet = f.read() + + f.close() + a.close() + + return scriptlet diff --git a/pakfire/packages/installed.py b/pakfire/packages/installed.py index 1cff99bea..95df5b98c 100644 --- a/pakfire/packages/installed.py +++ b/pakfire/packages/installed.py @@ -24,7 +24,7 @@ import os import pakfire.downloader from base import Package -from binary import BinaryPackage +from file import BinaryPackage import pakfire.util as util from pakfire.constants import * diff --git a/pakfire/packages/make.py b/pakfire/packages/make.py index 1b96b3b73..7163d9f16 100644 --- a/pakfire/packages/make.py +++ b/pakfire/packages/make.py @@ -34,7 +34,8 @@ import packager import pakfire.util as util from base import Package -from source import SourcePackage +from file import SourcePackage + from pakfire.constants import * from pakfire.i18n import _ diff --git a/pakfire/packages/packager.py b/pakfire/packages/packager.py index 3ab007fd4..3f33facc8 100644 --- a/pakfire/packages/packager.py +++ b/pakfire/packages/packager.py @@ -39,14 +39,11 @@ import zlib import pakfire.compress import pakfire.util as util -from pakfire.util import rm from pakfire.constants import * from pakfire.i18n import _ -from binary import BinaryPackage -from source import SourcePackage -from file import InnerTarFile +from file import BinaryPackage, InnerTarFile, SourcePackage class Packager(object): def __init__(self, pakfire, pkg): diff --git a/pakfire/packages/solv.py b/pakfire/packages/solv.py index 28d06da80..9030c2f9d 100644 --- a/pakfire/packages/solv.py +++ b/pakfire/packages/solv.py @@ -23,7 +23,7 @@ import os import re import base -import binary +import file class SolvPackage(base.Package): def __init__(self, pakfire, solvable, repo=None): @@ -200,7 +200,7 @@ class SolvPackage(base.Package): path = os.path.join(self.repo.path, i, self.filename) if os.path.exists(path): - return binary.BinaryPackage(self.pakfire, self.repo, path) + return file.BinaryPackage(self.pakfire, self.repo, path) else: filename = "packages/%s" % self.filename @@ -208,7 +208,7 @@ class SolvPackage(base.Package): path = self.repo.cache.abspath(filename) if path: - return binary.BinaryPackage(self.pakfire, self.repo, path) + return file.BinaryPackage(self.pakfire, self.repo, path) def download(self, text=""): if not self.repo.local: diff --git a/pakfire/packages/source.py b/pakfire/packages/source.py deleted file mode 100644 index ebda89db7..000000000 --- a/pakfire/packages/source.py +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/python -############################################################################### -# # -# Pakfire - The IPFire package management system # -# Copyright (C) 2011 Pakfire development team # -# # -# This program is free software: you can redistribute it and/or modify # -# it under the terms of the GNU General Public License as published by # -# the Free Software Foundation, either version 3 of the License, or # -# (at your option) any later version. # -# # -# This program is distributed in the hope that it will be useful, # -# but WITHOUT ANY WARRANTY; without even the implied warranty of # -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # -# GNU General Public License for more details. # -# # -# You should have received a copy of the GNU General Public License # -# along with this program. If not, see . # -# # -############################################################################### - -from file import FilePackage - -class SourcePackage(FilePackage): - pass diff --git a/pakfire/util.py b/pakfire/util.py index 66cbc1f71..1ba2992a2 100644 --- a/pakfire/util.py +++ b/pakfire/util.py @@ -97,7 +97,7 @@ def make_progress(message, maxval, eta=True): widgets = [ " ", - "%-40s" % message, + "%s" % message, " ", Bar(left="[", right="]"), " ", diff --git a/po/POTFILES.in b/po/POTFILES.in index 4bc1518a4..c9f23fc2c 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -14,7 +14,6 @@ pakfire/i18n.py pakfire/__init__.py pakfire/logger.py pakfire/packages/base.py -pakfire/packages/binary.py pakfire/packages/file.py pakfire/packages/__init__.py pakfire/packages/installed.py @@ -22,7 +21,6 @@ pakfire/packages/lexer.py pakfire/packages/make.py pakfire/packages/packager.py pakfire/packages/solv.py -pakfire/packages/source.py pakfire/repository/base.py pakfire/repository/cache.py pakfire/repository/database.py diff --git a/po/pakfire.pot b/po/pakfire.pot index fbb0b8c07..4ff0d1ec6 100644 --- a/po/pakfire.pot +++ b/po/pakfire.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-08-23 20:53+0200\n" +"POT-Creation-Date: 2011-08-28 14:33+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -77,31 +77,31 @@ msgstr "" msgid "Everything is fine." msgstr "" -#: ../pakfire/builder.py:122 +#: ../pakfire/builder.py:123 msgid "Package information:" msgstr "" #. Copy the makefile and load source tarballs. -#: ../pakfire/builder.py:306 +#: ../pakfire/builder.py:307 msgid "Extracting" msgstr "" -#: ../pakfire/builder.py:614 +#: ../pakfire/builder.py:615 msgid "Dumping created packages" msgstr "" -#: ../pakfire/builder.py:636 +#: ../pakfire/builder.py:637 msgid "The build command failed. See logfile for details." msgstr "" #. Package the result. #. Make all these little package from the build environment. -#: ../pakfire/builder.py:778 +#: ../pakfire/builder.py:779 msgid "Creating packages:" msgstr "" #. Execute the buildscript of this stage. -#: ../pakfire/builder.py:789 +#: ../pakfire/builder.py:790 #, python-format msgid "Running stage %s:" msgstr "" @@ -450,20 +450,20 @@ msgstr "" msgid "Filename: %s" msgstr "" -#: ../pakfire/packages/make.py:98 +#: ../pakfire/packages/make.py:99 msgid "Package name is undefined." msgstr "" -#: ../pakfire/packages/make.py:101 +#: ../pakfire/packages/make.py:102 msgid "Package version is undefined." msgstr "" #. Load progressbar. -#: ../pakfire/packages/packager.py:309 +#: ../pakfire/packages/packager.py:306 msgid "Packaging" msgstr "" -#: ../pakfire/packages/packager.py:602 +#: ../pakfire/packages/packager.py:599 #, python-format msgid "Building source package %s:" msgstr "" @@ -597,7 +597,7 @@ msgid "" msgstr "" #: ../scripts/pakfire:25 -msgid "Please your installation of Pakfire." +msgid "Please check your installation of Pakfire." msgstr "" #: ../scripts/pakfire:27 diff --git a/scripts/pakfire-build2 b/scripts/pakfire-build2 new file mode 120000 index 000000000..83bb50a42 --- /dev/null +++ b/scripts/pakfire-build2 @@ -0,0 +1 @@ +pakfire \ No newline at end of file