aboutsummaryrefslogtreecommitdiffstats
path: root/admin
diff options
context:
space:
mode:
authorPhillip Lord2019-06-04 15:02:33 +0100
committerPhillip Lord2019-09-18 18:10:35 +0100
commit61c2183a440c94ab797696d0f0c76a7dc4007eeb (patch)
tree0d73195cbd8f92c85c44c0334f9fd40297e0f11b /admin
parent37a4233a366797360c2f4f475591a3406586bcfb (diff)
downloademacs-61c2183a440c94ab797696d0f0c76a7dc4007eeb.tar.gz
emacs-61c2183a440c94ab797696d0f0c76a7dc4007eeb.zip
Improve logic for dependencies checking
* admin/nt/dist-build/build-dep-zips.py:
Diffstat (limited to 'admin')
-rwxr-xr-xadmin/nt/dist-build/build-dep-zips.py103
1 files changed, 75 insertions, 28 deletions
diff --git a/admin/nt/dist-build/build-dep-zips.py b/admin/nt/dist-build/build-dep-zips.py
index f0e96f43c8c..5698f5179c8 100755
--- a/admin/nt/dist-build/build-dep-zips.py
+++ b/admin/nt/dist-build/build-dep-zips.py
@@ -28,13 +28,33 @@ from subprocess import check_output
28## Constants 28## Constants
29EMACS_MAJOR_VERSION="27" 29EMACS_MAJOR_VERSION="27"
30 30
31# This list derives from the features we want Emacs to compile with.
32PKG_REQ='''mingw-w64-x86_64-giflib
33mingw-w64-x86_64-gnutls
34mingw-w64-x86_64-lcms2
35mingw-w64-x86_64-libjpeg-turbo
36mingw-w64-x86_64-libpng
37mingw-w64-x86_64-librsvg
38mingw-w64-x86_64-libtiff
39mingw-w64-x86_64-libxml2
40mingw-w64-x86_64-xpm-nox'''.split()
41
31 42
32## Options 43## Options
33DRY_RUN=False 44DRY_RUN=False
34 45
35## Packages to fiddle with 46## Packages to fiddle with
36SKIP_PKGS=["mingw-w64-gcc-libs"] 47## Source for gcc-libs is part of gcc
37MUNGE_PKGS ={"mingw-w64-libwinpthread-git":"mingw-w64-winpthreads-git"} 48SKIP_SRC_PKGS=["mingw-w64-gcc-libs"]
49SKIP_DEP_PKGS=["mingw-w64-x86_64-glib2"]
50MUNGE_SRC_PKGS={"mingw-w64-libwinpthread-git":"mingw-w64-winpthreads-git"}
51MUNGE_DEP_PKGS={
52 "mingw-w64-i686-libwinpthread":"mingw-w64-i686-libwinpthread-git",
53 "mingw-w64-x86_64-libwinpthread":"mingw-w64-x86_64-libwinpthread-git",
54
55 "mingw-w64-x86_64-libtre": "mingw-w64-x86_64-libtre-git",
56 "mingw-w64-i686-libtre": "mingw-w64-i686-libtre-git"
57}
38 58
39## Currently no packages seem to require this! 59## Currently no packages seem to require this!
40ARCH_PKGS=[] 60ARCH_PKGS=[]
@@ -47,28 +67,40 @@ def check_output_maybe(*args,**kwargs):
47 else: 67 else:
48 return check_output(*args,**kwargs) 68 return check_output(*args,**kwargs)
49 69
70def immediate_deps(pkg):
71 package_info = check_output(["pacman", "-Si", pkg]).decode("utf-8").split("\n")
72
73 ## Extract the "Depends On" line
74 depends_on = [x for x in package_info if x.startswith("Depends On")][0]
75 ## Remove "Depends On" prefix
76 dependencies = depends_on.split(":")[1]
77
78 ## Split into dependencies
79 dependencies = dependencies.strip().split(" ")
80
81 ## Remove > signs TODO can we get any other punctation here?
82 dependencies = [d.split(">")[0] for d in dependencies if d]
83 dependencies = [d for d in dependencies if not d == "None"]
84
85 dependencies = [MUNGE_DEP_PKGS.get(d, d) for d in dependencies]
86 return dependencies
87
88
50def extract_deps(): 89def extract_deps():
51 90
52 print( "Extracting deps" ) 91 print( "Extracting deps" )
53 # This list derives from the features we want Emacs to compile with.
54 PKG_REQ='''mingw-w64-x86_64-giflib
55mingw-w64-x86_64-gnutls
56mingw-w64-x86_64-harfbuzz
57mingw-w64-x86_64-lcms2
58mingw-w64-x86_64-libjpeg-turbo
59mingw-w64-x86_64-libpng
60mingw-w64-x86_64-librsvg
61mingw-w64-x86_64-libtiff
62mingw-w64-x86_64-libxml2
63mingw-w64-x86_64-xpm-nox'''.split()
64 92
65 # Get a list of all dependencies needed for packages mentioned above. 93 # Get a list of all dependencies needed for packages mentioned above.
66 # Run `pactree -lu' for each element of $PKG_REQ. 94 pkgs = PKG_REQ[:]
67 pkgs = set() 95 print("Initial pkgs", pkgs)
68 for x in PKG_REQ: 96 n = 0
69 pkgs.update( 97 while n < len(pkgs):
70 check_output(["pactree", "-lu", x]).decode("utf-8").split() 98 subdeps = immediate_deps(pkgs[n])
71 ) 99 for p in subdeps:
100 if not (p in pkgs or p in SKIP_DEP_PKGS):
101 print("adding", p)
102 pkgs.append(p)
103 n = n + 1
72 104
73 return sorted(pkgs) 105 return sorted(pkgs)
74 106
@@ -112,13 +144,20 @@ def gather_deps(deps, arch, directory):
112 144
113 145
114def download_source(tarball): 146def download_source(tarball):
115 print("Downloading {}...".format(tarball)) 147 print("Acquiring {}...".format(tarball))
116 check_output_maybe( 148
117 "wget -a ../download.log -O {} {}/{}/download" 149 if os.path.exists("../emacs-src-cache/{}".format(tarball)):
118 .format(tarball, SRC_REPO, tarball), 150 print("Copying {} from local".format(tarball))
119 shell=True 151 shutil.copyfile("../emacs-src-cache/{}".format(tarball),
120 ) 152 "{}".format(tarball))
121 print("Downloading {}... done".format(tarball)) 153 else:
154 print("Downloading {}...".format(tarball))
155 check_output_maybe(
156 "wget -a ../download.log -O {} {}/{}/download"
157 .format(tarball, SRC_REPO, tarball),
158 shell=True
159 )
160 print("Downloading {}... done".format(tarball))
122 161
123def gather_source(deps): 162def gather_source(deps):
124 163
@@ -146,7 +185,7 @@ def gather_source(deps):
146 ## make a simple name to make lookup easier 185 ## make a simple name to make lookup easier
147 simple_pkg_name = re.sub(r"x86_64-","",pkg_name) 186 simple_pkg_name = re.sub(r"x86_64-","",pkg_name)
148 187
149 if(simple_pkg_name in SKIP_PKGS): 188 if(simple_pkg_name in SKIP_SRC_PKGS):
150 continue 189 continue
151 190
152 ## Some packages have different source files for different 191 ## Some packages have different source files for different
@@ -159,7 +198,7 @@ def gather_source(deps):
159 198
160 for d in downloads: 199 for d in downloads:
161 ## Switch names if necessary 200 ## Switch names if necessary
162 d = MUNGE_PKGS.get(d,d) 201 d = MUNGE_SRC_PKGS.get(d,d)
163 202
164 tarball = "{}-{}.src.tar.gz".format(d,pkg_version) 203 tarball = "{}-{}.src.tar.gz".format(d,pkg_version)
165 204
@@ -209,6 +248,9 @@ parser.add_argument("-c", help="clean only",
209parser.add_argument("-d", help="dry run", 248parser.add_argument("-d", help="dry run",
210 action="store_true") 249 action="store_true")
211 250
251parser.add_argument("-l", help="list dependencies only",
252 action="store_true")
253
212args = parser.parse_args() 254args = parser.parse_args()
213do_all=not (args.c or args.r or args.f or args.t) 255do_all=not (args.c or args.r or args.f or args.t)
214 256
@@ -216,6 +258,11 @@ deps=extract_deps()
216 258
217DRY_RUN=args.d 259DRY_RUN=args.d
218 260
261if( args.l ):
262 print("List of dependencies")
263 print( extract_deps() )
264 exit(0)
265
219if args.s: 266if args.s:
220 DATE="{}-".format(check_output(["date", "+%Y-%m-%d"]).decode("utf-8").strip()) 267 DATE="{}-".format(check_output(["date", "+%Y-%m-%d"]).decode("utf-8").strip())
221else: 268else: