From c7f83cc86d28caa0e7bc85e287ca61eae07f7694 Mon Sep 17 00:00:00 2001
From: Britney Fransen <brfransen@gmail.com>
Date: Tue, 18 Oct 2022 12:36:09 -0400
Subject: chk_arch_pkg.py: use asp

---
 build_tools/bin/chk_arch_pkg.py | 31 ++++++++++++++++++-------------
 1 file changed, 18 insertions(+), 13 deletions(-)

diff --git a/build_tools/bin/chk_arch_pkg.py b/build_tools/bin/chk_arch_pkg.py
index 119084b..7af02bd 100755
--- a/build_tools/bin/chk_arch_pkg.py
+++ b/build_tools/bin/chk_arch_pkg.py
@@ -13,7 +13,8 @@ import re
 import subprocess
 
 def getArchVer():
-    repos=['testing', 'core', 'extra', 'community-testing', 'community', 'aur']
+#    repos=['testing', 'core', 'extra', 'community-testing', 'community', 'aur']
+    repos=['core', 'extra', 'community-testing', 'community', 'aur']
     website=""
     archVer=""
     aPKGBUILD=""
@@ -114,19 +115,20 @@ def getSource():
     else:
         str1 = raw_input("\n   Press any key to download source from arch, or N to cancel: ")
     if str1 != 'N' and str1 != 'n':
+        filename=currDirName + ".tar.gz"
         if repo == "aur":
             dlSource = sourceURL
+            subprocess.call(["curl", "-O", dlSource])
+            subprocess.call(["tar", "xvf", filename])
         else:
             if "community" in repo:
                 repoTag = "community"
             else:
                 repoTag = "packages"
-            dlSource = 'https://git.archlinux.org/svntogit/%s.git/snapshot/%s-packages/%s.tar.gz' %(repoTag, repoTag, currDirName)
+            subprocess.call(["asp", "update"])
+            subprocess.call(["asp", "export", currDirName])
 
-        print dlSource
-        subprocess.call(["curl", "-O", dlSource])
-        filename=currDirName + ".tar.gz"
-        subprocess.call(["tar", "xvf", filename])
+        #print dlSource
 
         if yes_all:
             str2 = "Y"
@@ -136,14 +138,15 @@ def getSource():
             if repo == "aur":
                 srcDir = os.getcwd() + "/" + currDirName
             else:
-                srcDir = os.getcwd() + "/" + repoTag + "-packages/" + currDirName + "/trunk/"
+                #srcDir = os.getcwd() + "/" + repoTag + "-packages/" + currDirName + "/trunk/"
+                srcDir = os.getcwd() + "/" + currDirName
             src_files = os.listdir(srcDir)
             for file_name in src_files:
                 if file_name != ".AURINFO" and file_name != ".SRCINFO":
                     full_file_name = os.path.join(srcDir, file_name)
                     if (os.path.isfile(full_file_name)):
                         shutil.copy(full_file_name, os.getcwd())
-            subprocess.call("diff -q -x '__arch_LH.diff' -x '__changelog' -x '.SRCINFO' -x '.AURINFO' -x 'pkg' -x 'src' -x '*.pkg.tar.xz' -x 'packages-packages' -x 'community-packages' -x %s -x '*-package.log' -x '*-build.log' -x '%s' ./ %s > ./__arch_LH.diff" % (currDirName,filename, srcDir), shell=True)
+            subprocess.call("diff -q -x '__arch_LH.diff' -x '__changelog' -x '.SRCINFO' -x '.AURINFO' -x 'pkg' -x 'src' -x '*.pkg.tar.xz' -x '*.pkg.tar.zst' -x 'packages-packages' -x 'community-packages' -x %s -x '*-package.log' -x '*-build.log' -x '%s' ./ %s > ./__arch_LH.diff" % (currDirName,filename, srcDir), shell=True)
             if os.stat(os.getcwd() + "/__arch_LH.diff").st_size == 0:
                 subprocess.call("rm __arch_LH.diff", shell=True)
         else:
@@ -154,11 +157,12 @@ def getSource():
         else:
             str3 = raw_input("\n   Press any key to remove downloads, or N to cancel: ")
         if str3 != 'N' and str3 != 'n':
-            subprocess.call(["rm", filename])
+            subprocess.call(["rm", "-r", currDirName])
             if repo == "aur":
-                subprocess.call(["rm", "-r", currDirName])
-            else:
-                subprocess.call(["rm", "-r", repoTag + "-packages"])
+                subprocess.call(["rm", filename])
+            #else:
+                #subprocess.call(["rm", "-r", repoTag + "-packages"])
+                #subprocess.call(["rm", "-r", currDirName])
         else:
             sys.exit(0)
 
@@ -180,7 +184,8 @@ def main():
     print "Searching for " + currDirName + " on archlinux.org..."
     archVer = getArchVer()
     getLHVer()
-    if archVer != "" and sourceURL != "":
+#    if archVer != "" and sourceURL != "":
+    if sourceURL != "":
         getSource()
 
 if __name__ == "__main__":
-- 
cgit v0.12