Hi, in my previous mail about this topic I sent a script to find out the build dependencies and their corresponding versions to a json file.
At the same time I was thinking about sharing my git-clone-all script to frameworks/plasma/apps repositories so it's a good time so submit it so you can use it to test the other script. The patch providing all the needed files is temporarily available here: http://gpul.grupos.udc.es/kubuntu_patches/kubuntu_automation_improvement_v2.diff and also attached to this mail.
=== added directory 'conf'
=== added file 'conf/git-clone-all.json'
--- conf/git-clone-all.json 1970-01-01 00:00:00 +0000
+++ conf/git-clone-all.json 2015-10-16 09:24:47 +0000
@@ -0,0 +1,13 @@
+{
+ "clone-this-one":"git-ssh-kubuntu",
+ "extra-remotes":["git-anon-siduction","git-anon-neon"],
+
+ "git-ssh-kubuntu":"git+ssh://git.debian.org/git/pkg-kde/%s/%s.git",
+ "git-anon-kubuntu":"git://anonscm.debian.org/pkg-kde/%s/%s.git",
+
+ "git-ssh-siduction":"[email protected]:siduction-kde-%s/%s.git",
+ "git-anon-siduction":"https://gitlab.com/siduction-kde-%s/%s.git",
+
+ "git-ssh-neon":"[email protected]:sample_url_please_replace_it_whenever_you_can/%s/%s.git",
+ "git-anon-neon":"git:/sample_url_please_replace_it_whenever_you_can/%s/%s.git"
+}
=== added file 'dev-package-name-list'
--- dev-package-name-list 1970-01-01 00:00:00 +0000
+++ dev-package-name-list 2015-10-16 09:46:35 +0000
@@ -0,0 +1,97 @@
+#!/usr/bin/python3
+# kate: space-indent on; indent-width 4; replace-tabs on; indent-mode python; remove-trailing-space modified;
+# vim: expandtab ts=4
+
+############################################################################
+# Copyright © 2015 Jonathan Riddell
+# Copyright © 2015 José Manuel Santamaría Lema <[email protected]> #
+# #
+# 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 2 of the License, or #
+# (at your option) any later version. #
+############################################################################
+
+from lib.utils import *
+
+import argparse
+import sys
+import os
+import json
+import re
+
+from debian import deb822
+from debian.changelog import Changelog, Version
+
+
+parser = argparse.ArgumentParser(description="Update -dev package name list used by bump-build-dep-versions")
+parser.add_argument("-d", "--dist", help="Distribution name", default="wily")
+parser.add_argument("-r", "--releasetype", help="KDE Release Type [frameworks,plasma,applications]", default="frameworks")
+parser.add_argument("-v", "--version", help="Version [latest]", required=True)
+args = parser.parse_args()
+
+def quit():
+ parser.print_help()
+ sys.exit(1)
+
+if len(sys.argv) < 2:
+ quit()
+
+try:
+ dist = args.dist
+ releaseType = args.releasetype
+ version = args.version
+except IndexError:
+ quit()
+
+upstream_package_version_map = getFtpVersionMap(releaseType,version)
+
+cwd = os.path.dirname(os.path.realpath(__file__))
+
+dev_package_version_map = {}
+
+dev_package_version_map["_comment"] = "This file was generated automatically by dev-package-name-list."
+
+#Populate the package version map inspecting the control files, changelogs and FTP
+src_package_list = readPackages(cwd + "/package-name-lists/" + releaseType + "-" + dist)
+for src_package in src_package_list:
+ #Find out source package version
+ src_package_version = upstream_package_version_map[upstreamName(src_package)]
+ #Find out if the package has epoch or not, if so preprend it to the version
+ changelog = Changelog()
+ changelog_file_name = repoName(src_package) + '/debian/changelog'
+ try:
+ changelog.parse_changelog(open(changelog_file_name, 'r'))
+ except FileNotFoundError:
+ print("WARNING: File " + changelog_file_name + " not found!")
+ continue
+ epoch = changelog.get_version().epoch
+ if epoch != None:
+ src_package_version = epoch + ":" + src_package_version
+ src_package_version += "~"
+ #Find out -dev package names
+ control_file_name = repoName(src_package) + '/debian/control'
+ try:
+ control_file = deb822.Packages.iter_paragraphs(open(control_file_name, 'r'));
+ except FileNotFoundError:
+ print("WARNING: File " + control_file_name + " not found!")
+ continue
+ for pkg in control_file:
+ if 'Package' in pkg:
+ bin_package_name = pkg['Package']
+ if re.match('.*-dev$', bin_package_name) != None:
+ dev_package_version_map[bin_package_name] = src_package_version
+ control_file.close()
+ #Packages contaning dev binary packages not ending in -dev
+ if src_package == "extra-cmake-modules":
+ dev_package_version_map["extra-cmake-modules"] = src_package_version
+ elif src_package == "kdesignerplugin":
+ dev_package_version_map["kgendesignerplugin"] = src_package_version
+
+
+json_str = json.dumps(dev_package_version_map, indent=4, sort_keys=True)
+
+outFile = cwd + "/dev-package-name-lists/" + releaseType + "-" + dist + ".json"
+f = open(outFile, 'w')
+f.write(json_str)
+print("write " + outFile)
=== added file 'git-clone-all'
--- git-clone-all 1970-01-01 00:00:00 +0000
+++ git-clone-all 2015-10-16 09:25:07 +0000
@@ -0,0 +1,85 @@
+#!/usr/bin/python3
+
+############################################################################
+# Copyright © 2015 José Manuel Santamaría Lema <[email protected]> #
+# #
+# 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 2 of the License, or #
+# (at your option) any later version. #
+############################################################################
+
+import os
+import sys
+import argparse
+import subprocess
+
+from lib.utils import *
+
+#Argument parser
+parser = argparse.ArgumentParser(
+ description="Clones all the frameworks or plasma or apps git repositories"
+ " to the current directory")
+parser.add_argument("-r", "--releasetype",
+ help="KDE Release Type [frameworks,plasma,applications]",
+ default="frameworks", required=True)
+parser.add_argument("-d", "--dist",
+ help="KDE Release Type [frameworks,plasma,applications]",
+ default="wily", required�lse)
+
+#Check arguments
+args = parser.parse_args()
+
+def quit():
+ parser.print_help()
+ sys.exit(1)
+
+if args.releasetype not in ["frameworks", "plasma", "applications"]:
+ print("Invalid releasetype %s" % args.releasetype)
+ print("Accepted release types are frameworks, plasma, applications")
+ quit()
+
+releaseType = args.releasetype
+dist = args.dist
+
+#Find out the base url to clone and the extra remotes
+cwd = os.path.dirname(os.path.realpath(__file__))
+config_file = open(cwd + "/conf/git-clone-all.json")
+config_map = json.load(config_file)
+template_url_clone = config_map[config_map["clone-this-one"]]
+print("Template url to clone: %s" % template_url_clone)
+remotes_list = config_map["extra-remotes"]
+
+#Get package list
+packages_file_path = cwd + "/package-name-lists/" + releaseType + "-" + dist
+package_name_list = readPackages(packages_file_path)
+
+#Clone the repositories and add the remotes
+for source_package in package_name_list:
+ repo_name = repoName(source_package)
+ command = "git clone " + (template_url_clone % (releaseType,repo_name))
+ print("Executing: " + command)
+ try:
+ subprocess.check_call(command.split())
+ except KeyboardInterrupt:
+ print("abort by user request")
+ sys.exit(130)
+ except:
+ #In any other exception we continue, this way we can use
+ #git-clone-all against a directory with some repositories already cloned.
+ continue
+ for i in remotes_list:
+ template_url_remote = str(config_map[i])
+ remote_name = i.split('-')[-1]
+ try:
+ command = "git remote add " + remote_name + " " + (template_url_remote % (releaseType,repo_name))
+ print("Executing: " + command)
+ old_cwd = os.getcwd()
+ os.chdir(repo_name)
+ subprocess.check_call(command.split())
+ os.chdir(old_cwd)
+ except TypeError:
+ print("The remote %s couldn't be added using the template url:\n%s" % (remote_name,template_url_remote))
+
+
+# vim: expandtab ts=4
=== modified file 'lib/utils.py'
--- lib/utils.py 2015-06-29 14:07:29 +0000
+++ lib/utils.py 2015-10-16 09:24:19 +0000
@@ -1,5 +1,20 @@
+############################################################################
+# Copyright © 2014 Harald Sitter #
+# Copyright © 2015 Philip Muskovac #
+# Copyright © 2015 Jonathan Riddell #
+# Copyright © 2015 José Manuel Santamaría Lema <[email protected]> #
+# #
+# 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 2 of the License, or #
+# (at your option) any later version. #
+############################################################################
+
+
import json
import os
+import subprocess
+import re
def readAllFromFile(filename):
f = open(filename, "r")
@@ -25,3 +40,47 @@
return pkgmap[package]
else:
return package
+
+def repoName(package):
+ cwd = os.path.dirname(os.path.realpath(__file__))
+ with open(cwd + "/../repo-names.json") as repofile:
+ pkgmap = json.load(repofile)
+ if package in pkgmap:
+ return pkgmap[package]
+ else:
+ return package
+
+# ReleaseType = [frameworks,plasma,applications]
+def getFtpVersionMap(releaseType,version):
+ #Find out which subdirectories we have to inspeact in the ftp
+ ftp_subdirs = []
+ if releaseType == "frameworks":
+ ftp_subdirs = ["","portingAids"]
+ elif releaseType == "plasma":
+ ftp_subdirs = [""]
+ elif releaseType == "applications":
+ ftp_subdirs = ["src"]
+ #Find out the stability
+ versionParts = version.split(".")
+ lastDigit = int(versionParts[-1])
+ if lastDigit >= 80:
+ stability = "unstable"
+ else:
+ stability = "stable"
+ #Populate and return the map
+ packageVersionMap = {}
+ for subdir in ftp_subdirs:
+ p = subprocess.Popen(["sftp", "-b", "-", "depot.kde.org:%s/%s/%s/%s" % (stability, releaseType, version, subdir)],
+ stdin=subprocess.PIPE, stdout=subprocess.PIPE)
+ output, _ = p.communicate(bytes("ls *xz", 'utf-8'))
+
+ for line in output.splitlines():
+ line = line.decode('utf-8')
+ match = re.search(r'([a-zA-Z0-9\-]+)-' + '([\d.]*)' + r'\.tar\.', line)
+ if match:
+ package = match.group(1)
+ package_version = match.group(2)
+ packageVersionMap[package] = package_version
+ return packageVersionMap
+
+# vim: expandtab ts=4
=== added file 'repo-names.json'
--- repo-names.json 1970-01-01 00:00:00 +0000
+++ repo-names.json 2015-10-16 09:27:15 +0000
@@ -0,0 +1,9 @@
+{
+ "__coment": "The attribute name is the source package and the value is the alioth repository name",
+ "attica-kf5": "attica",
+ "kactivities-kf5": "kactivities",
+ "kwallet-kf5": "kwallet",
+ "kdnssd-kf5": "kdnssd",
+ "baloo-kf5": "baloo",
+ "kfilemetadata-kf5": "kfilemetadata"
+}
signature.asc
Description: This is a digitally signed message part.
-- kubuntu-devel mailing list [email protected] Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/kubuntu-devel
