From 286c69461d049049a0b2d5ab48578808b7c3d2ee Mon Sep 17 00:00:00 2001
From: Britney Fransen <brfransen@gmail.com>
Date: Tue, 18 Oct 2022 12:39:30 -0400
Subject: mpv2.py: add zst support

---
 build_tools/bin/mpv2.py | 30 ++++++++++++++++++++----------
 1 file changed, 20 insertions(+), 10 deletions(-)

diff --git a/build_tools/bin/mpv2.py b/build_tools/bin/mpv2.py
index b3d5cf2..51a9cb7 100755
--- a/build_tools/bin/mpv2.py
+++ b/build_tools/bin/mpv2.py
@@ -156,6 +156,7 @@ class Packagefile(object):
         self.TOTALPKG = ""
         self.GZPKG = ""
         self.XZPKG = ""
+        self.ZSTPKG = ""
         self.repolist=["core", "extra",
                         "chroot-devel", "mv-core", "xmpl", "local"]
         self.mydir = os.getcwd()
@@ -540,10 +541,14 @@ class Packagefile(object):
 
             self.GZPKG = i + "-" + self.epoch + self.pkgver + "-" + self.pkgrel + "-" + self.CARCH + ".pkg.tar.gz"
             self.XZPKG = i + "-" + self.epoch + self.pkgver + "-" + self.pkgrel + "-" + self.CARCH + ".pkg.tar.xz"
+            self.ZSTPKG = i + "-" + self.epoch + self.pkgver + "-" + self.pkgrel + "-" + self.CARCH + ".pkg.tar.zst"
             print self.GZPKG
             print self.XZPKG
+            print self.ZSTPKG
 
-            if os.path.isfile(self.PKGDEST + "/" + self.XZPKG):
+            if os.path.isfile(self.PKGDEST + "/" + self.ZSTPKG):
+                self.TOTALPKG = self.ZSTPKG
+            elif os.path.isfile(self.PKGDEST + "/" + self.XZPKG):
                 self.TOTALPKG = self.XZPKG
             elif os.path.isfile(self.PKGDEST + "/" + self.GZPKG):
                 self.TOTALPKG = GZPKG
@@ -565,13 +570,14 @@ class Packagefile(object):
                         print n,"does not match"
                         continue
                     else:
-                        OLDPKG = glob.glob(oldpkgcheck.search(n).group() + "*.pkg.tar.?z")
+                        OLDPKG = glob.glob(oldpkgcheck.search(n).group() + "*.pkg.tar.*")
                     print "OLDPKG =",OLDPKG
                     if OLDPKG:
                         for DELPKG in OLDPKG:
                             if "--rmold" in self.cli_list:
                                 print "Deleting old package:",DELPKG
                                 os.remove(DELPKG)
+                                #subprocess.call(["repo-remove", self.DOCROOT+ "/" + self.REPO + ".db.tar.gz", DELPKG])
                         # Remove any symlinks to old packages
                         # We make it conditional on "--force" because force will overwrite
                         # an existing package and we want the symlink to stay, pointing to
@@ -583,6 +589,10 @@ class Packagefile(object):
             print "    Updating " + self.DOCROOT + " with " + self.TOTALPKG
             print "    Copying " + self.PKGDEST + "/" + self.TOTALPKG
             shutil.copy2(self.PKGDEST + "/" + self.TOTALPKG, self.DOCROOT)
+            print "    Creating symlink " + self.PKGDEST + "/" + self.TOTALPKG
+            if os.path.islink(self.mydir + "/" + self.TOTALPKG):
+                os.remove(self.mydir + "/" + self.TOTALPKG)
+            os.symlink(self.DOCROOT + "/" + self.TOTALPKG, self.mydir + "/" + self.TOTALPKG)
             subprocess.call(["repo-add", self.DOCROOT+ "/" + self.REPO + ".db.tar.gz", self.DOCROOT + "/" + self.TOTALPKG])
             print "    Updating pacman database"
             subprocess.call(["pacman","-Syyyyy" ])
@@ -1020,15 +1030,15 @@ def main():
     print "\n\n\n\n"
     print "#######################################################"
 
-    print "\n"
-    print "Successful updated from ABS:"
-    print "----------------------------"
-    pprint.pprint(update_pkg)
+#    print "\n"
+#    print "Successful updated from ABS:"
+#    print "----------------------------"
+#    pprint.pprint(update_pkg)
 
-    print "\n"
-    print "Failed updated from ABS:"
-    print "----------------------------"
-    pprint.pprint(failed_update)
+#    print "\n"
+#    print "Failed updated from ABS:"
+#    print "----------------------------"
+#    pprint.pprint(failed_update)
 
 
     print "\n"
-- 
cgit v0.12