public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/toolchain:master commit in: scripts/
@ 2014-06-15  0:55 Mike Frysinger
  0 siblings, 0 replies; 11+ messages in thread
From: Mike Frysinger @ 2014-06-15  0:55 UTC (permalink / raw
  To: gentoo-commits

commit:     92256ca6c455c92e9932cbdebd66138749ca3ae0
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Sun Jun 15 00:55:15 2014 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Sun Jun 15 00:55:15 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/toolchain.git;a=commit;h=92256ca6

drop the -a flag when committing

---
 scripts/cronjob.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/cronjob.sh b/scripts/cronjob.sh
index a009055..5295f0f 100755
--- a/scripts/cronjob.sh
+++ b/scripts/cronjob.sh
@@ -9,7 +9,7 @@ cd "${0%/*}"/..
 
 commit() {
 	git add .
-	git commit -a -m "$1" .
+	git commit -m "$1" .
 }
 
 doit() {


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [gentoo-commits] proj/toolchain:master commit in: scripts/
@ 2014-06-15  0:57 Mike Frysinger
  0 siblings, 0 replies; 11+ messages in thread
From: Mike Frysinger @ 2014-06-15  0:57 UTC (permalink / raw
  To: gentoo-commits

commit:     fae64a8cb1e2665ffe1652d4a053145e8850295f
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Sun Jun 15 00:57:30 2014 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Sun Jun 15 00:57:30 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/toolchain.git;a=commit;h=fae64a8c

skip commit if there are no new files

---
 scripts/cronjob.sh | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/scripts/cronjob.sh b/scripts/cronjob.sh
index 5295f0f..843089e 100755
--- a/scripts/cronjob.sh
+++ b/scripts/cronjob.sh
@@ -15,7 +15,9 @@ commit() {
 doit() {
 	./scripts/update-$1
 	cd sys-devel/$1
-	commit "update $1 snapshots"
+	if [[ -n $(git status --porcelain) ]] ; then
+		commit "update $1 snapshots"
+	fi
 	cd ../..
 }
 


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [gentoo-commits] proj/toolchain:master commit in: scripts/
@ 2014-06-15  0:58 Mike Frysinger
  0 siblings, 0 replies; 11+ messages in thread
From: Mike Frysinger @ 2014-06-15  0:58 UTC (permalink / raw
  To: gentoo-commits

commit:     c0e84deb2d31fed514d71397cf9034c2f5d29cd0
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Sun Jun 15 00:57:30 2014 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Sun Jun 15 00:57:30 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/toolchain.git;a=commit;h=c0e84deb

skip commit if there are no new files

---
 scripts/cronjob.sh | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/scripts/cronjob.sh b/scripts/cronjob.sh
index 5295f0f..417c7c6 100755
--- a/scripts/cronjob.sh
+++ b/scripts/cronjob.sh
@@ -8,8 +8,10 @@ set -e
 cd "${0%/*}"/..
 
 commit() {
-	git add .
-	git commit -m "$1" .
+	if [[ -n $(git status --porcelain) ]] ; then
+		git add .
+		git commit -m "$1" .
+	fi
 }
 
 doit() {


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [gentoo-commits] proj/toolchain:master commit in: scripts/
@ 2014-10-17  4:05 Mike Frysinger
  0 siblings, 0 replies; 11+ messages in thread
From: Mike Frysinger @ 2014-10-17  4:05 UTC (permalink / raw
  To: gentoo-commits

commit:     a899f18da2a22db25019fe1b2efa6b239e372b32
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Fri Oct 17 04:05:01 2014 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Fri Oct 17 04:05:01 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/toolchain.git;a=commit;h=a899f18d

update-gcc: handle gcc-5.x snapshots

---
 scripts/update-gcc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/update-gcc b/scripts/update-gcc
index 1d4d126..a84f724 100755
--- a/scripts/update-gcc
+++ b/scripts/update-gcc
@@ -37,7 +37,7 @@ for e in ${ebuilds} ; do
 done
 
 # Then load new ones.
-majors=$(awk '$(NF-2) ~ /^LATEST-/ { print gensub("LATEST-", "", "", $(NF-2)) }' ${l})
+majors=$(awk '$(NF-2) ~ /^LATEST-/ { print gensub("LATEST-", "", "", $(NF-2)) }' ${l} | sort -V)
 echo "${PN} majors:" ${majors}
 
 lm=


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [gentoo-commits] proj/toolchain:master commit in: scripts/
@ 2014-10-17  4:06 Mike Frysinger
  0 siblings, 0 replies; 11+ messages in thread
From: Mike Frysinger @ 2014-10-17  4:06 UTC (permalink / raw
  To: gentoo-commits

commit:     f417beb2151f52db48764c52c5a3a5b18155a397
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Fri Oct 17 04:06:53 2014 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Fri Oct 17 04:06:53 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/toolchain.git;a=commit;h=f417beb2

cronjob: tweak commit messages

---
 scripts/cronjob.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/scripts/cronjob.sh b/scripts/cronjob.sh
index 417c7c6..3efcec0 100755
--- a/scripts/cronjob.sh
+++ b/scripts/cronjob.sh
@@ -17,7 +17,7 @@ commit() {
 doit() {
 	./scripts/update-$1
 	cd sys-devel/$1
-	commit "update $1 snapshots"
+	commit "$1: update snapshots"
 	cd ../..
 }
 
@@ -31,7 +31,7 @@ main() {
 
 	egencache --repo=toolchain --update --portdir-overlay="${PWD}" -j ${NCPUS:-1}
 	cd metadata
-	commit "update metadata"
+	commit "cache: regen"
 
 	# Just in case someone else made a commit before we did.
 	git pull --rebase


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [gentoo-commits] proj/toolchain:master commit in: scripts/
@ 2014-10-24  5:26 Mike Frysinger
  0 siblings, 0 replies; 11+ messages in thread
From: Mike Frysinger @ 2014-10-24  5:26 UTC (permalink / raw
  To: gentoo-commits

commit:     5cdf1fee959700fd0ce38e7e57a324f77ae4a2bc
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Fri Oct 24 05:26:37 2014 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Fri Oct 24 05:26:37 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/toolchain.git;a=commit;h=5cdf1fee

gcc: handle gcc-5.x

---
 scripts/update-gcc | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/scripts/update-gcc b/scripts/update-gcc
index a84f724..2fa5412 100755
--- a/scripts/update-gcc
+++ b/scripts/update-gcc
@@ -51,6 +51,8 @@ for m in ${majors} ; do
 			exit 1
 		fi
 	fi
+	# Pad out to 2 versions if the listing doesn't have it.
+	[[ ${m} != *.* ]] && m+=".0"
 	echo "### ${m}: ${curr}"
 	for s in ${snaps} ; do
 		s="${PN}-${m}.0_alpha${s}.ebuild"


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [gentoo-commits] proj/toolchain:master commit in: scripts/
@ 2015-04-13  4:14 Mike Frysinger
  0 siblings, 0 replies; 11+ messages in thread
From: Mike Frysinger @ 2015-04-13  4:14 UTC (permalink / raw
  To: gentoo-commits

commit:     cb91c820d26023cb0bcaa20dae4ddcd6db914064
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Mon Apr 13 03:49:55 2015 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Mon Apr 13 04:09:02 2015 +0000
URL:        https://gitweb.gentoo.org/proj/toolchain.git/commit/?id=cb91c820

scripts: rewrite in python

The bash scripts are getting hard to maintain.

 scripts/.gitignore |   1 +
 scripts/.pylintrc  |  24 ++++++++++
 scripts/common.py  | 126 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 scripts/update-gcc | 122 ++++++++++++++++++++++++++------------------------
 scripts/update-gdb | 127 ++++++++++++++++++++++++++++++-----------------------
 5 files changed, 286 insertions(+), 114 deletions(-)

diff --git a/scripts/.gitignore b/scripts/.gitignore
index 913d141..57e2a4e 100644
--- a/scripts/.gitignore
+++ b/scripts/.gitignore
@@ -1 +1,2 @@
 cronjob.log
+*.pyc

diff --git a/scripts/.pylintrc b/scripts/.pylintrc
new file mode 100644
index 0000000..d91e935
--- /dev/null
+++ b/scripts/.pylintrc
@@ -0,0 +1,24 @@
+[MESSAGES CONTROL]
+disable=C0103,C0111,C0302,E1103,I0011,R0201,R0902,R0903,R0911,R0912,R0913,R0914,R0915,W0122,W0141,W0142,W0403,W0511,W0703,R0904,R0921,R0922,bad-continuation
+
+[REPORTS]
+reports=no
+
+[FORMAT]
+indent-string='	'
+
+[TYPECHECK]
+ignored-classes=hashlib,numpy
+
+[BASIC]
+function-rgx=([A-Z_][a-zA-Z0-9]{2,30}|main)$
+method-rgx=((_|test)?[A-Z][a-zA-Z0-9]{2,30}|__[a-z]+__|setUp|tearDown)$
+
+[SIMILARITIES]
+min-similarity-lines=20
+
+[VARIABLES]
+dummy-variables-rgx=_|unused_
+
+[DESIGN]
+max-parents=10

diff --git a/scripts/common.py b/scripts/common.py
new file mode 100644
index 0000000..2da9139
--- /dev/null
+++ b/scripts/common.py
@@ -0,0 +1,126 @@
+#!/usr/bin/python
+
+"""Utility funcs"""
+
+from __future__ import print_function
+
+import argparse
+import distutils.version
+import ftplib
+import locale
+import logging
+import os
+import re
+import subprocess
+import sys
+import time
+import urlparse
+
+
+dry_run = False
+
+
+def cd(cat, pn):
+	"""Change to the $CATAGORY/$PN subdir for this package"""
+	path = os.path.join(os.path.dirname(os.path.dirname(
+		os.path.realpath(__file__))), cat, pn)
+	logging.info('processing %s', path)
+	os.chdir(path)
+	assert os.path.exists('metadata.xml')
+
+
+def list_snaps(url, debug=False):
+	"""Get a listing of all the snapshots for this package"""
+	if debug:
+		if os.path.exists('.listing'):
+			return open('.listing').read().splitlines()
+	o = urlparse.urlparse(url)
+	logging.info('listing %s', url)
+	ftp = ftplib.FTP(o.netloc)
+	ftp.login()
+	ftp.cwd(o.path)
+	nlst = ftp.nlst()
+	if debug:
+		with open('.listing', 'w') as f:
+			f.write('\n'.join(nlst))
+	return nlst
+
+
+ver_sort = lambda x: sorted(x, key=lambda v: distutils.version.LooseVersion(v))
+
+
+def run(cmd, **kwargs):
+	logging.info('running: %s', ' '.join(cmd))
+	if not dry_run:
+		subprocess.check_call(cmd, **kwargs)
+
+
+def run_ebuild(ebuild, command):
+	"""Run `ebuild |ebuild| |command|`"""
+	env = os.environ.copy()
+	env.update({
+		'FEATURES': 'assume-digests -strict digest',
+		'GENTOO_MIRRORS': ' ',
+	})
+	run(['ebuild', ebuild, command], env=env)
+
+
+def git(args):
+	"""Run `git |args|`"""
+	run(['git'] + args)
+
+
+def setup_logging(debug=False):
+	"""Setup the logging module"""
+	fmt = '%(asctime)s: %(levelname)-7s: '
+	if debug:
+		fmt += '%(filename)s:%(funcName)s: '
+	fmt += '%(message)s'
+	datefmt = '%a, %d %b %Y %H:%M:%S ' + time.tzname[0]
+
+	level = logging.DEBUG if debug else logging.INFO
+
+	handler = logging.StreamHandler(stream=sys.stdout)
+	formatter = logging.Formatter(fmt, datefmt)
+	handler.setFormatter(formatter)
+
+	logger = logging.getLogger()
+	logger.addHandler(handler)
+	logger.setLevel(level)
+
+
+def get_ver(ebuild):
+	"""Given an ebuild name, return the version"""
+	m = re.match(r'[a-z-]+-(([0-9]+\.?)+)(_alpha([0-9]+))?\.ebuild', ebuild)
+	if not m:
+		raise ValueError('could not parse %s' % ebuild)
+	dots = m.group(1)
+	stamp = m.group(4)
+	return distutils.version.LooseVersion('%s-%s' % (dots, stamp))
+
+
+def parse_args(argv):
+	parser = argparse.ArgumentParser()
+	parser.add_argument('-d', '--debug', default=False, action='store_true')
+	parser.add_argument('-n', '--dry-run', default=False, action='store_true')
+	return parser.parse_args(argv)
+
+
+def common_main(argv, cat, pn):
+	locale.setlocale(locale.LC_ALL, 'C')
+
+	opts = parse_args(argv)
+	global dry_run
+	dry_run = opts.dry_run
+
+	setup_logging(debug=opts.debug)
+	logging.info('running %s', pn)
+	cd(cat, pn)
+
+	# Clean the paths.
+	git(['reset', 'HEAD', '.'])
+	git(['checkout', '-f', '.'])
+	git(['clean', '-q', '-f', '.'])
+	git(['status', '.'])
+
+	return opts

diff --git a/scripts/update-gcc b/scripts/update-gcc
index 2fa5412..da82ec6 100755
--- a/scripts/update-gcc
+++ b/scripts/update-gcc
@@ -1,69 +1,75 @@
-#!/bin/bash -e
+#!/usr/bin/python
 
-export LC_ALL=C
-PN="gcc"
+"""Update gcc snapshots"""
 
-sudo=
+from __future__ import print_function
 
-[ -d sys-devel ] && cd sys-devel/${PN}
-[ -d ../sys-devel ] && cd ../sys-devel/${PN}
-if [ ! -e metadata.xml ] ; then
-	echo "Run this in the ${PN} dir"
-	exit 1
-fi
+import distutils.version
+import glob
+import logging
+import re
+import shutil
+import sys
 
-export FEATURES="assume-digests -strict digest"
-fetch() {
-	${sudo} env GENTOO_MIRRORS=" " FEATURES="${FEATURES}" ebuild $1 fetch
-}
-manifest() {
-	${sudo} ebuild $1 manifest
-}
+from common import * # pylint: disable=wildcard-import,unused-wildcard-import
 
-date
 
-wget -nv --no-remove-listing -O /dev/null ftp://gcc.gnu.org/pub/gcc/snapshots/
-l=".listing"
-sed -i 's/\r$//' ${l}
+CATEGORY = 'sys-devel'
+PN = 'gcc'
+URL = 'ftp://gcc.gnu.org/pub/gcc/snapshots/'
 
-# First unload ones that no longer exist.
-ebuilds=$(echo ${PN}-*_alpha*.ebuild)
-for e in ${ebuilds} ; do
-	v=$(echo "${e}" | sed -e 's:^gcc-::g' -e 's:.ebuild::g' -e 's:.._alpha:-:g')
-	if grep -q "\<${v}$" ${l} ; then
-		continue
-	fi
-	git rm -f ${e}
-done
 
-# Then load new ones.
-majors=$(awk '$(NF-2) ~ /^LATEST-/ { print gensub("LATEST-", "", "", $(NF-2)) }' ${l} | sort -V)
-echo "${PN} majors:" ${majors}
+def main(argv):
+	opts = common_main(argv, CATEGORY, PN)
 
-lm=
-for m in ${majors} ; do
-	snaps=$(awk '$NF ~ /^'${m}'-/ { print gensub("'${m}'-", "", "", $NF) }' ${l})
-	curr=$(ls ${PN}-${m}.0_alpha* | sort | tail -n 1)
-	if [[ -z ${curr} ]] ; then
-		curr=$(ls ${PN}-${lm}.0_alpha* | sort | tail -n 1)
-		if [[ -z ${curr} ]] ; then
-			echo "no current ebuild for major ${m}"
-			exit 1
-		fi
-	fi
-	# Pad out to 2 versions if the listing doesn't have it.
-	[[ ${m} != *.* ]] && m+=".0"
-	echo "### ${m}: ${curr}"
-	for s in ${snaps} ; do
-		s="${PN}-${m}.0_alpha${s}.ebuild"
-		[[ -e ${s} ]] && continue
-		echo " ${s}"
-		cp ${curr} ${s}
-		fetch ${s}
-	done
-	lm=${m}
-done
+	remote_list = ver_sort(
+		x for x in list_snaps(URL, debug=opts.debug)
+		if not x.startswith('LATEST-') and '-' in x)
 
-rm -f ${l}
+	# Create the lists of curr/new versions.
+	old_pkgs = set(glob.glob('%s-*.ebuild' % PN))
+	new_pkgs = set()
+	for snap in remote_list:
+		m = re.match(r'([0-9.]+)-([0-9.]+)$', snap)
+		if m:
+			# Turn "5" into "5.0.0" and "4.3" into "4.3.0".
+			dots = '.'.join((m.group(1).split('.') + (['0'] * 3))[0:3])
+			ebuild = '%s-%s_alpha%s.ebuild' % (PN, dots, m.group(2))
+			new_pkgs.add(ebuild)
+			logging.debug('found remote %s', ebuild)
+		else:
+			logging.warning('skipping reomte %s', snap)
 
-manifest ${s}
+	# Create ebuilds for the new versions we found.
+	closest_ver = distutils.version.LooseVersion('0')
+	for pkg in new_pkgs - old_pkgs:
+		logging.info('adding %s', pkg)
+		ver = get_ver(pkg)
+		for opkg in old_pkgs:
+			if '_alpha' not in opkg:
+				continue
+			over = get_ver(opkg)
+			if over < ver and over > closest_ver:
+				closest_ver = over
+		logging.info(' copying from %s', closest_ver)
+		dots, stamp = str(closest_ver).split('-')
+		ebuild = '%s-%s_alpha%s.ebuild' % (PN, dots, stamp)
+		if not opts.dry_run:
+			shutil.copy(ebuild, pkg)
+		git(['add', pkg])
+		run_ebuild(pkg, 'fetch')
+		#run_ebuild(pkg, 'manifest')
+
+	# Clean out the old snapshots.
+	for pkg in ver_sort(old_pkgs - new_pkgs):
+		if '_alpha' not in pkg:
+			continue
+		logging.info('cleaning old %s', pkg)
+		git(['rm', '-f', pkg])
+
+	run(['repoman', 'manifest'])
+	git(['add', 'Manifest'])
+
+
+if __name__ == '__main__':
+	main(sys.argv[1:])

diff --git a/scripts/update-gdb b/scripts/update-gdb
index a6d64c2..08cfcb2 100755
--- a/scripts/update-gdb
+++ b/scripts/update-gdb
@@ -1,56 +1,71 @@
-#!/bin/bash -e
-
-export LC_ALL=C
-PN="gdb"
-
-sudo=
-
-[ -d sys-devel ] && cd sys-devel/${PN}
-[ -d ../sys-devel ] && cd ../sys-devel/${PN}
-if [ ! -e metadata.xml ] ; then
-	echo "Run this in the ${PN} dir"
-	exit 1
-fi
-
-export FEATURES="assume-digests -strict digest"
-fetch() {
-	${sudo} env GENTOO_MIRRORS=" " FEATURES="${FEATURES}" ebuild $1 fetch
-}
-manifest() {
-	${sudo} ebuild $1 manifest
-}
-
-date
-
-wget -nv --no-remove-listing -O /dev/null ftp://sources.redhat.com/pub/${PN}/snapshots/current/
-l=".listing"
-sed -i 's/\r$//' ${l}
-
-# First unload ones that no longer exist.
-ebuilds=$(echo ${PN}-?.?.50.*.ebuild)
-for e in ${ebuilds} ; do
-	f=$(echo "${e}" | sed -e 's:^gdb-:gdb-weekly-:g' -e 's:.ebuild:.tar.(bz2|xz):g')
-	if grep -qE "\<${f}$" ${l} ; then
-		continue
-	fi
-	git rm -f ${e}
-done
-
-# Then load new ones.
-snaps=$(grep -o ${PN}-weekly-'[[:digit:]]'.*.tar.* ${l} | \
-	sed -e 's:.*-::' -e 's:.tar.*::')
-
-src=$(ls ${PN}-*.ebuild | sort | tail -n 1)
-for s in ${snaps} ; do
-	dst="${PN}-${s}.ebuild"
-	[[ ! -e ${dst} ]] || continue
-	echo "### found ${s}"
-	cp ${src} ${dst}
-	fetch ${dst}
-done
-
-rm -f ${l}
-
-if [[ -n ${src} ]] ; then
-	manifest ${src}
-fi
+#!/usr/bin/python
+
+"""Update gdb snapshots"""
+
+from __future__ import print_function
+
+import distutils.version
+import glob
+import logging
+import re
+import shutil
+import sys
+
+from common import * # pylint: disable=wildcard-import,unused-wildcard-import
+
+
+CATEGORY = 'sys-devel'
+PN = 'gdb'
+URL = 'ftp://sources.redhat.com/pub/gdb/snapshots/current/'
+
+
+def main(argv):
+	opts = common_main(argv, CATEGORY, PN)
+
+	remote_list = ver_sort(
+		x for x in list_snaps(URL, debug=opts.debug)
+		if x.startswith('%s-weekly-' % PN) and '.tar' in x)
+
+	# Create the lists of curr/new versions.
+	old_pkgs = set(glob.glob('%s-*.ebuild' % PN))
+	new_pkgs = set()
+	for snap in remote_list:
+		m = re.match(r'%s-weekly-([0-9.]+)\.tar' % PN, snap)
+		if m:
+			ebuild = '%s-%s.ebuild' % (PN, m.group(1))
+			new_pkgs.add(ebuild)
+			logging.debug('found remote %s', ebuild)
+		else:
+			logging.warning('skipping reomte %s', snap)
+
+	# Create ebuilds for the new versions we found.
+	closest_ver = distutils.version.LooseVersion('0')
+	for pkg in new_pkgs - old_pkgs:
+		logging.info('adding %s', pkg)
+		ver = get_ver(pkg)
+		for opkg in old_pkgs:
+			if '.50.' not in opkg:
+				continue
+			over = get_ver(opkg)
+			if over < ver and over > closest_ver:
+				closest_ver = over
+		logging.info(' copying from %s', closest_ver)
+		ebuild = '%s-%s.ebuild' % (PN, closest_ver)
+		shutil.copy(ebuild, pkg)
+		git(['add', pkg])
+		run_ebuild(pkg, 'fetch')
+		#run_ebuild(pkg, 'manifest')
+
+	# Clean out the old snapshots.
+	for pkg in ver_sort(old_pkgs - new_pkgs):
+		if '.50.' not in pkg:
+			continue
+		logging.info('cleaning old %s', pkg)
+		git(['rm', '-f', pkg])
+
+	run(['repoman', 'manifest'])
+	git(['add', 'Manifest'])
+
+
+if __name__ == '__main__':
+	main(sys.argv[1:])


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [gentoo-commits] proj/toolchain:master commit in: scripts/
@ 2015-04-23 19:42 Mike Frysinger
  0 siblings, 0 replies; 11+ messages in thread
From: Mike Frysinger @ 2015-04-23 19:42 UTC (permalink / raw
  To: gentoo-commits

commit:     5b66092319411b31a66e8c69bc8d0599bf99c255
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Thu Apr 23 19:42:20 2015 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Thu Apr 23 19:42:20 2015 +0000
URL:        https://gitweb.gentoo.org/proj/toolchain.git/commit/?id=5b660923

scripts: fix gdb ebuild parsing

 scripts/common.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/scripts/common.py b/scripts/common.py
index 2da9139..892834c 100644
--- a/scripts/common.py
+++ b/scripts/common.py
@@ -96,7 +96,11 @@ def get_ver(ebuild):
 		raise ValueError('could not parse %s' % ebuild)
 	dots = m.group(1)
 	stamp = m.group(4)
-	return distutils.version.LooseVersion('%s-%s' % (dots, stamp))
+	if stamp:
+		v = '%s-%s' % (dots, stamp)
+	else:
+		v = dots
+	return distutils.version.LooseVersion(v)
 
 
 def parse_args(argv):


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [gentoo-commits] proj/toolchain:master commit in: scripts/
@ 2015-07-15  4:11 Mike Frysinger
  0 siblings, 0 replies; 11+ messages in thread
From: Mike Frysinger @ 2015-07-15  4:11 UTC (permalink / raw
  To: gentoo-commits

commit:     d03a3bd28534dd43685a3ab582265e59aa705473
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Wed Jul 15 04:08:21 2015 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Wed Jul 15 04:08:21 2015 +0000
URL:        https://gitweb.gentoo.org/proj/toolchain.git/commit/?id=d03a3bd2

update-gdb: use same ftp site as the ebuilds

While sources.redhat.com & sourceware.org are usually in sync, sometimes
they can be slightly off leading to desync in which snapshots are available.

 scripts/update-gdb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/update-gdb b/scripts/update-gdb
index 08cfcb2..5d11637 100755
--- a/scripts/update-gdb
+++ b/scripts/update-gdb
@@ -16,7 +16,7 @@ from common import * # pylint: disable=wildcard-import,unused-wildcard-import
 
 CATEGORY = 'sys-devel'
 PN = 'gdb'
-URL = 'ftp://sources.redhat.com/pub/gdb/snapshots/current/'
+URL = 'ftp://sourceware.org/pub/gdb/snapshots/current/'
 
 
 def main(argv):


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [gentoo-commits] proj/toolchain:master commit in: scripts/
@ 2016-01-14 21:40 Mike Frysinger
  0 siblings, 0 replies; 11+ messages in thread
From: Mike Frysinger @ 2016-01-14 21:40 UTC (permalink / raw
  To: gentoo-commits

commit:     5d9ba54c16b893fa7d50217c5f365273444c10b8
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Thu Jan 14 15:48:38 2016 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Thu Jan 14 15:48:38 2016 +0000
URL:        https://gitweb.gentoo.org/proj/toolchain.git/commit/?id=5d9ba54c

scripts: add pylint helper

 scripts/pylint | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/scripts/pylint b/scripts/pylint
new file mode 100755
index 0000000..dae1ba4
--- /dev/null
+++ b/scripts/pylint
@@ -0,0 +1,2 @@
+#!/bin/sh
+exec pylint --rcfile "${0%/*}/.pylintrc" "$@"


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [gentoo-commits] proj/toolchain:master commit in: scripts/
@ 2016-01-14 21:40 Mike Frysinger
  0 siblings, 0 replies; 11+ messages in thread
From: Mike Frysinger @ 2016-01-14 21:40 UTC (permalink / raw
  To: gentoo-commits

commit:     d1dffc9e207c2fa935520c1f3aadabbc629a0ee2
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Thu Jan 14 15:22:52 2016 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Thu Jan 14 15:22:52 2016 +0000
URL:        https://gitweb.gentoo.org/proj/toolchain.git/commit/?id=d1dffc9e

scripts: update for py3

 scripts/common.py  | 13 +++++++++++--
 scripts/update-gcc | 24 ++++++++++++------------
 scripts/update-gdb | 19 +++++++++----------
 3 files changed, 32 insertions(+), 24 deletions(-)

diff --git a/scripts/common.py b/scripts/common.py
index 892834c..1ae5955 100644
--- a/scripts/common.py
+++ b/scripts/common.py
@@ -1,4 +1,5 @@
 #!/usr/bin/python
+# -*- coding:utf-8 -*-
 
 """Utility funcs"""
 
@@ -14,7 +15,10 @@ import re
 import subprocess
 import sys
 import time
-import urlparse
+try:
+	import urlparse
+except ImportError:
+	import urllib.parse as urlparse
 
 
 dry_run = False
@@ -46,7 +50,12 @@ def list_snaps(url, debug=False):
 	return nlst
 
 
-ver_sort = lambda x: sorted(x, key=lambda v: distutils.version.LooseVersion(v))
+# Newer python distutils modules are crap and crash when you try to compare
+# something like "gdb-3.8.1" and "gdb-3.8-r1".  Filter out the -r# since we
+# don't need them for this code.  Even python 2 is crap and returns the wrong
+# result.
+ver_filter = re.compile(r'(-r[0-9]+)?([.]ebuild)?$')
+ver_sort = lambda x: sorted(x, key=lambda v: distutils.version.LooseVersion(ver_filter.sub('', v)))
 
 
 def run(cmd, **kwargs):

diff --git a/scripts/update-gcc b/scripts/update-gcc
index da82ec6..27f6f06 100755
--- a/scripts/update-gcc
+++ b/scripts/update-gcc
@@ -1,4 +1,5 @@
 #!/usr/bin/python
+# -*- coding:utf-8 -*-
 
 """Update gcc snapshots"""
 
@@ -21,24 +22,23 @@ URL = 'ftp://gcc.gnu.org/pub/gcc/snapshots/'
 
 def main(argv):
 	opts = common_main(argv, CATEGORY, PN)
+	ver_match = re.compile(r'([0-9.]+)-([0-9.]+)$')
 
-	remote_list = ver_sort(
-		x for x in list_snaps(URL, debug=opts.debug)
-		if not x.startswith('LATEST-') and '-' in x)
+	all_snaps = list_snaps(URL, debug=opts.debug)
+	snaps = [x for x in all_snaps
+	         if not x.startswith('LATEST-') and ver_match.match(x)]
+	remote_list = ver_sort(snaps)
 
 	# Create the lists of curr/new versions.
 	old_pkgs = set(glob.glob('%s-*.ebuild' % PN))
 	new_pkgs = set()
 	for snap in remote_list:
-		m = re.match(r'([0-9.]+)-([0-9.]+)$', snap)
-		if m:
-			# Turn "5" into "5.0.0" and "4.3" into "4.3.0".
-			dots = '.'.join((m.group(1).split('.') + (['0'] * 3))[0:3])
-			ebuild = '%s-%s_alpha%s.ebuild' % (PN, dots, m.group(2))
-			new_pkgs.add(ebuild)
-			logging.debug('found remote %s', ebuild)
-		else:
-			logging.warning('skipping reomte %s', snap)
+		m = ver_match.match(snap)
+		# Turn "5" into "5.0.0" and "4.3" into "4.3.0".
+		dots = '.'.join((m.group(1).split('.') + (['0'] * 3))[0:3])
+		ebuild = '%s-%s_alpha%s.ebuild' % (PN, dots, m.group(2))
+		new_pkgs.add(ebuild)
+		logging.debug('found remote %s', ebuild)
 
 	# Create ebuilds for the new versions we found.
 	closest_ver = distutils.version.LooseVersion('0')

diff --git a/scripts/update-gdb b/scripts/update-gdb
index 5d11637..e5ca9e5 100755
--- a/scripts/update-gdb
+++ b/scripts/update-gdb
@@ -1,4 +1,5 @@
 #!/usr/bin/python
+# -*- coding:utf-8 -*-
 
 """Update gdb snapshots"""
 
@@ -21,22 +22,20 @@ URL = 'ftp://sourceware.org/pub/gdb/snapshots/current/'
 
 def main(argv):
 	opts = common_main(argv, CATEGORY, PN)
+	ver_match = re.compile(r'%s-weekly-([0-9.]+)\.tar' % PN)
 
-	remote_list = ver_sort(
-		x for x in list_snaps(URL, debug=opts.debug)
-		if x.startswith('%s-weekly-' % PN) and '.tar' in x)
+	all_snaps = list_snaps(URL, debug=opts.debug)
+	snaps = [x for x in all_snaps if ver_match.match(x)]
+	remote_list = ver_sort(snaps)
 
 	# Create the lists of curr/new versions.
 	old_pkgs = set(glob.glob('%s-*.ebuild' % PN))
 	new_pkgs = set()
 	for snap in remote_list:
-		m = re.match(r'%s-weekly-([0-9.]+)\.tar' % PN, snap)
-		if m:
-			ebuild = '%s-%s.ebuild' % (PN, m.group(1))
-			new_pkgs.add(ebuild)
-			logging.debug('found remote %s', ebuild)
-		else:
-			logging.warning('skipping reomte %s', snap)
+		m = ver_match.match(snap)
+		ebuild = '%s-%s.ebuild' % (PN, m.group(1))
+		new_pkgs.add(ebuild)
+		logging.debug('found remote %s', ebuild)
 
 	# Create ebuilds for the new versions we found.
 	closest_ver = distutils.version.LooseVersion('0')


^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2016-01-14 21:40 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-15  0:58 [gentoo-commits] proj/toolchain:master commit in: scripts/ Mike Frysinger
  -- strict thread matches above, loose matches on Subject: below --
2016-01-14 21:40 Mike Frysinger
2016-01-14 21:40 Mike Frysinger
2015-07-15  4:11 Mike Frysinger
2015-04-23 19:42 Mike Frysinger
2015-04-13  4:14 Mike Frysinger
2014-10-24  5:26 Mike Frysinger
2014-10-17  4:06 Mike Frysinger
2014-10-17  4:05 Mike Frysinger
2014-06-15  0:57 Mike Frysinger
2014-06-15  0:55 Mike Frysinger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox