]> git.ipfire.org Git - pakfire.git/commitdiff
Bump package format to support files with spaces in their names.
authorMichael Tremer <michael.tremer@ipfire.org>
Thu, 26 Jul 2012 15:49:38 +0000 (17:49 +0200)
committerMichael Tremer <michael.tremer@ipfire.org>
Thu, 26 Jul 2012 15:49:38 +0000 (17:49 +0200)
po/pakfire.pot
python/pakfire/constants.py
python/pakfire/filelist.py
python/pakfire/packages/file.py
python/pakfire/packages/packager.py
python/pakfire/transaction.py

index db3a88f688c14c6708345da77471edcfb50978ed..495f5cd5ad7dc8e723d021f3fee2f1eb92390bc1 100644 (file)
@@ -8,7 +8,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2012-05-16 12:33+0000\n"
+"POT-Creation-Date: 2012-07-26 17:09+0200\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -120,7 +120,7 @@ msgstr ""
 
 #: ../python/pakfire/base.py:387 ../python/pakfire/base.py:455
 #: ../python/pakfire/base.py:491 ../python/pakfire/base.py:553
-#: ../python/pakfire/base.py:574 ../python/pakfire/transaction.py:390
+#: ../python/pakfire/base.py:574 ../python/pakfire/transaction.py:396
 msgid "Nothing to do"
 msgstr ""
 
@@ -420,7 +420,7 @@ msgstr ""
 msgid "Give name of at least one package to check."
 msgstr ""
 
-#: ../python/pakfire/cli.py:348 ../python/pakfire/transaction.py:399
+#: ../python/pakfire/cli.py:348 ../python/pakfire/transaction.py:405
 msgid "Repository"
 msgstr ""
 
@@ -744,7 +744,7 @@ msgid "Job: %(name)s"
 msgstr ""
 
 #: ../python/pakfire/cli.py:1078 ../python/pakfire/packages/base.py:107
-#: ../python/pakfire/transaction.py:398
+#: ../python/pakfire/transaction.py:404
 msgid "Arch"
 msgstr ""
 
@@ -813,70 +813,74 @@ msgstr ""
 msgid "Write the key to this file."
 msgstr ""
 
-#: ../python/pakfire/cli.py:1228
-msgid "Delete a key from the local keyring."
+#: ../python/pakfire/cli.py:1224
+msgid "Export the secret key, too."
 msgstr ""
 
 #: ../python/pakfire/cli.py:1230
+msgid "Delete a key from the local keyring."
+msgstr ""
+
+#: ../python/pakfire/cli.py:1232
 msgid "The ID of the key to delete."
 msgstr ""
 
-#: ../python/pakfire/cli.py:1236
+#: ../python/pakfire/cli.py:1238
 msgid "List all imported keys."
 msgstr ""
 
-#: ../python/pakfire/cli.py:1242
+#: ../python/pakfire/cli.py:1244
 msgid "Sign one or more packages."
 msgstr ""
 
-#: ../python/pakfire/cli.py:1244
+#: ../python/pakfire/cli.py:1246
 msgid "Key that is used sign the package(s)."
 msgstr ""
 
-#: ../python/pakfire/cli.py:1246
+#: ../python/pakfire/cli.py:1248
 msgid "Package(s) to sign."
 msgstr ""
 
-#: ../python/pakfire/cli.py:1252
+#: ../python/pakfire/cli.py:1254
 msgid "Verify one or more packages."
 msgstr ""
 
-#: ../python/pakfire/cli.py:1256
+#: ../python/pakfire/cli.py:1258
 msgid "Package(s) to verify."
 msgstr ""
 
-#: ../python/pakfire/cli.py:1263
+#: ../python/pakfire/cli.py:1265
 msgid "Generating the key may take a moment..."
 msgstr ""
 
-#: ../python/pakfire/cli.py:1311
+#: ../python/pakfire/cli.py:1314
 #, python-format
 msgid "Signing %s..."
 msgstr ""
 
-#: ../python/pakfire/cli.py:1328
+#: ../python/pakfire/cli.py:1331
 #, python-format
 msgid "Verifying %s..."
 msgstr ""
 
-#: ../python/pakfire/cli.py:1338
+#: ../python/pakfire/cli.py:1341
 msgid "This signature is valid."
 msgstr ""
 
-#: ../python/pakfire/cli.py:1341
+#: ../python/pakfire/cli.py:1344
 msgid "Unknown key"
 msgstr ""
 
-#: ../python/pakfire/cli.py:1342
+#: ../python/pakfire/cli.py:1345
 msgid "Could not check if this signature is valid."
 msgstr ""
 
-#: ../python/pakfire/cli.py:1345 ../python/pakfire/keyring.py:96
+#: ../python/pakfire/cli.py:1348 ../python/pakfire/keyring.py:96
 #, python-format
 msgid "Created: %s"
 msgstr ""
 
-#: ../python/pakfire/cli.py:1349 ../python/pakfire/keyring.py:99
+#: ../python/pakfire/cli.py:1352 ../python/pakfire/keyring.py:99
 #, python-format
 msgid "Expires: %s"
 msgstr ""
@@ -996,7 +1000,7 @@ msgstr ""
 msgid "Running pakfire-build in a pakfire container?"
 msgstr ""
 
-#: ../python/pakfire/errors.py:94 ../python/pakfire/transaction.py:469
+#: ../python/pakfire/errors.py:94 ../python/pakfire/transaction.py:475
 msgid "Transaction test was not successful"
 msgstr ""
 
@@ -1089,7 +1093,7 @@ msgstr ""
 msgid "Name"
 msgstr ""
 
-#: ../python/pakfire/packages/base.py:110 ../python/pakfire/transaction.py:398
+#: ../python/pakfire/packages/base.py:110 ../python/pakfire/transaction.py:404
 msgid "Version"
 msgstr ""
 
@@ -1097,7 +1101,7 @@ msgstr ""
 msgid "Release"
 msgstr ""
 
-#: ../python/pakfire/packages/base.py:115 ../python/pakfire/transaction.py:399
+#: ../python/pakfire/packages/base.py:115 ../python/pakfire/transaction.py:405
 msgid "Size"
 msgstr ""
 
@@ -1237,12 +1241,12 @@ msgid "Filter '%(pattern)s' filtered %(dep)s."
 msgstr ""
 
 #. Load progressbar.
-#: ../python/pakfire/packages/packager.py:391
-#: ../python/pakfire/packages/packager.py:686
+#: ../python/pakfire/packages/packager.py:394
+#: ../python/pakfire/packages/packager.py:689
 msgid "Packaging"
 msgstr ""
 
-#: ../python/pakfire/packages/packager.py:714
+#: ../python/pakfire/packages/packager.py:717
 #, python-format
 msgid "Building source package %s:"
 msgstr ""
@@ -1359,7 +1363,7 @@ msgstr ""
 msgid "    Solutions:"
 msgstr ""
 
-#: ../python/pakfire/server.py:279 ../python/pakfire/system.py:131
+#: ../python/pakfire/server.py:279 ../python/pakfire/system.py:132
 msgid "Could not be determined"
 msgstr ""
 
@@ -1373,100 +1377,105 @@ msgstr ""
 msgid "file %(name)s from %(pkg)s conflicts with files from %(pkgs)s"
 msgstr ""
 
-#: ../python/pakfire/transaction.py:108
+#: ../python/pakfire/transaction.py:106
+#, python-format
+msgid "file %(name)s causes the transaction test to fail for an unknown reason"
+msgstr ""
+
+#: ../python/pakfire/transaction.py:114
 #, python-format
 msgid ""
 "There is not enough space left on %(name)s. Need at least %(size)s to "
 "perform transaction."
 msgstr ""
 
-#: ../python/pakfire/transaction.py:321
+#: ../python/pakfire/transaction.py:327
 #, python-format
 msgid "Not enough space to download %s of packages."
 msgstr ""
 
-#: ../python/pakfire/transaction.py:324
+#: ../python/pakfire/transaction.py:330
 msgid "Downloading packages:"
 msgstr ""
 
-#: ../python/pakfire/transaction.py:398
+#: ../python/pakfire/transaction.py:404
 msgid "Package"
 msgstr ""
 
-#: ../python/pakfire/transaction.py:403
+#: ../python/pakfire/transaction.py:409
 msgid "Installing:"
 msgstr ""
 
-#: ../python/pakfire/transaction.py:404
+#: ../python/pakfire/transaction.py:410
 msgid "Reinstalling:"
 msgstr ""
 
-#: ../python/pakfire/transaction.py:405
+#: ../python/pakfire/transaction.py:411
 msgid "Updating:"
 msgstr ""
 
-#: ../python/pakfire/transaction.py:406
+#: ../python/pakfire/transaction.py:412
 msgid "Downgrading:"
 msgstr ""
 
-#: ../python/pakfire/transaction.py:407
+#: ../python/pakfire/transaction.py:413
 msgid "Removing:"
 msgstr ""
 
-#: ../python/pakfire/transaction.py:413
+#: ../python/pakfire/transaction.py:419
 msgid "Transaction Summary"
 msgstr ""
 
-#: ../python/pakfire/transaction.py:420
+#: ../python/pakfire/transaction.py:426
 msgid "package"
 msgstr ""
 
-#: ../python/pakfire/transaction.py:426
+#: ../python/pakfire/transaction.py:432
 #, python-format
 msgid "Total download size: %s"
 msgstr ""
 
-#: ../python/pakfire/transaction.py:430
+#: ../python/pakfire/transaction.py:436
 #, python-format
 msgid "Installed size: %s"
 msgstr ""
 
-#: ../python/pakfire/transaction.py:433
+#: ../python/pakfire/transaction.py:439
 #, python-format
 msgid "Freed size: %s"
 msgstr ""
 
-#: ../python/pakfire/transaction.py:444
+#: ../python/pakfire/transaction.py:450
 msgid "Is this okay?"
 msgstr ""
 
-#: ../python/pakfire/transaction.py:450
+#: ../python/pakfire/transaction.py:456
 msgid "Running Transaction Test"
 msgstr ""
 
-#: ../python/pakfire/transaction.py:462
+#: ../python/pakfire/transaction.py:468
 msgid "Transaction Test Succeeded"
 msgstr ""
 
 #. Make a nice progressbar.
-#: ../python/pakfire/transaction.py:495
+#: ../python/pakfire/transaction.py:501
 msgid "Verifying signatures..."
 msgstr ""
 
-#: ../python/pakfire/transaction.py:527
+#: ../python/pakfire/transaction.py:533
 #, python-format
 msgid "Found %s signature error(s)!"
 msgstr ""
 
-#: ../python/pakfire/transaction.py:532
+#: ../python/pakfire/transaction.py:538
 msgid "Going on because we are running in permissive mode."
 msgstr ""
 
-#: ../python/pakfire/transaction.py:533
+#: ../python/pakfire/transaction.py:539
 msgid "This is dangerous!"
 msgstr ""
 
-#: ../python/pakfire/transaction.py:554
+#: ../python/pakfire/transaction.py:560
 msgid "Running transaction"
 msgstr ""
 
index 44d1d021835d53b940339e202063efc0280ecf7c..45b1b40c52426959b5c22e0e54b8c9cf85da2045 100644 (file)
@@ -69,9 +69,9 @@ METADATA_DOWNLOAD_PATH  = "repodata"
 METADATA_DOWNLOAD_FILE  = "repomd.json"
 METADATA_DATABASE_FILE  = "packages.solv"
 
-PACKAGE_FORMAT = 3
+PACKAGE_FORMAT = 4
 # XXX implement this properly
-PACKAGE_FORMATS_SUPPORTED = [0, 1, 2, 3]
+PACKAGE_FORMATS_SUPPORTED = [0, 1, 2, 3, 4]
 PACKAGE_EXTENSION = "pfm"
 MAKEFILE_EXTENSION = "nm"
 
index 4bac6eff7244f1111f1fb067dcb46f0e761b1d34..79df2c4cf76c0533347f4ae51a9f40d5c491810d 100644 (file)
@@ -31,6 +31,8 @@ TYPE_DIR  = tarfile.DIRTYPE   # directory
 TYPE_FIFO = tarfile.FIFOTYPE   # fifo special device
 TYPE_CONT = tarfile.CONTTYPE   # contiguous file
 
+TYPE_DIR_INT = int(TYPE_DIR)
+
 class _File(object):
        def __init__(self, pakfire):
                self.pakfire = pakfire
@@ -69,6 +71,10 @@ class File(_File):
                self.mtime = 0
                self.capabilities = None
 
+       def is_dir(self):
+               return self.type == TYPE_DIR_INT \
+                       or self.name.endswith("/")
+
        def is_config(self):
                return self.config
 
@@ -95,6 +101,10 @@ class FileDatabase(_File):
 
                return self.__row
 
+       def is_dir(self):
+               return self.type == TYPE_DIR_INT \
+                       or self.name.endswith("/")
+
        def is_config(self):
                return self.row["config"] == 1
 
index 4f5696080bb691fbd0c44549da547b007accfaf0..070c763b74f508770401537e41eba54216194c83 100644 (file)
@@ -232,7 +232,7 @@ class FilePackage(Package):
 
                name2file = {}
                for file in self.filelist:
-                       if file.is_dir():
+                       if file.is_dir() and file.name.endswith("/"):
                                name = file.name[:-1]
                        else:
                                name = file.name
@@ -424,8 +424,7 @@ class FilePackage(Package):
                        file = pakfire.filelist.File(self.pakfire)
 
                        if self.format >= 1:
-                               line = line.rstrip()
-                               line = line.split()
+                               line = line.split(None, 8)
 
                                # Check if fields do have the correct length.
                                if self.format >= 3 and len(line) <= 7:
@@ -433,7 +432,11 @@ class FilePackage(Package):
                                elif len(line) <= 6:
                                        continue
 
-                               name = line[0]
+                               # Switch the first and last argument in the line.
+                               if self.format < 4:
+                                       line.append(line.pop(0))
+
+                               name = line[-1]
 
                                if not name.startswith("/"):
                                        name = "/%s" % name
@@ -444,37 +447,37 @@ class FilePackage(Package):
 
                                # Parse file type.
                                try:
-                                       file.type = int(line[1])
+                                       file.type = int(line[0])
                                except ValueError:
                                        file.type = 0
 
                                # Parse the size information.
                                try:
-                                       file.size = int(line[2])
+                                       file.size = int(line[1])
                                except ValueError:
                                        file.size = 0
 
                                # Parse user and group.
-                               file.user, file.group = line[3], line[4]
+                               file.user, file.group = line[2], line[3]
 
                                # Parse mode.
                                try:
-                                       file.mode = int(line[5])
+                                       file.mode = int(line[4])
                                except ValueError:
                                        file.mode = 0
 
                                # Parse time.
                                try:
-                                       file.mtime = line[6]
+                                       file.mtime = line[5]
                                except ValueError:
                                        file.mtime = 0
 
                                # Parse hash1 (sha512).
-                               if not line[7] == "-":
-                                       file.hash1 = line[7]
+                               if not line[6] == "-":
+                                       file.hash1 = line[6]
 
-                               if self.format >= 3 and len(line) >= 9 and not line[8] == "-":
-                                       file.capabilities = line[8]
+                               if self.format >= 3 and len(line) >= 9 and not line[7] == "-":
+                                       file.capabilities = line[7]
 
                        else:
                                name = line
index 0895c55f8923d55e5c3e09d71e38cfbc23354acb..d44a6dc1984f9515553a779cb98500cc96875bb5 100644 (file)
@@ -157,7 +157,7 @@ class Packager(object):
                                "%d-%02d-%02d %02d:%02d:%02d" % time.localtime(m.mtime)[:6],
                                util.format_size(m.size), m.name))
 
-                       f.write("%(name)-40s %(type)1s %(size)-10d %(uname)-10s %(gname)-10s %(mode)-6d %(mtime)-12d" \
+                       f.write("%(type)1s %(size)-10d %(uname)-10s %(gname)-10s %(mode)-6d %(mtime)-12d" \
                                % m.get_info(tarfile.ENCODING, "strict"))
 
                        # Calculate SHA512 hash of regular files.
@@ -182,6 +182,9 @@ class Packager(object):
                        else:
                                f.write(" -")
 
+                       # The file name must be the last argument to contain spaces.
+                       f.write(" %s" % m.name)
+
                        f.write("\n")
 
                log.info("")
index 10a1277c2658e2325e479c61eba8ad5ce334141d..4dadd4f8d3bc7d05adac455e5e4a5e8e1bbdc1ef 100644 (file)
@@ -92,13 +92,19 @@ class TransactionCheck(object):
                        if len(pkgs) == 2:
                                logger.critical(
                                        _("file %(name)s from %(pkg1)s conflicts with file from package %(pkg2)s") % \
-                                               { "name" : name, "pkg1" : pkgs[0], "pkg2" : pkgs[1] }
+                                               { "name" : file, "pkg1" : pkgs[0], "pkg2" : pkgs[1] }
                                )
 
                        elif len(pkgs) >= 3:
                                logger.critical(
                                        _("file %(name)s from %(pkg)s conflicts with files from %(pkgs)s") % \
-                                               { "name" : name, "pkg" : pkgs[0], "pkgs" : i18n.list(pkgs[1:])}
+                                               { "name" : file, "pkg" : pkgs[0], "pkgs" : i18n.list(pkgs[1:])}
+                               )
+
+                       else:
+                               logger.critical(
+                                       _("file %(name)s causes the transaction test to fail for an unknown reason") % \
+                                               { "name" : file }
                                )
 
                for mp in self.mountpoints: