From: "Mike Gilbert" <floppym@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/chromium-tools:master commit in: /
Date: Thu, 13 Aug 2015 20:53:45 +0000 (UTC) [thread overview]
Message-ID: <1439499206.70a26591a5872c48a140edd2256e89a88b24b9de.floppym@gentoo> (raw)
commit: 70a26591a5872c48a140edd2256e89a88b24b9de
Author: Mike Gilbert <floppym <AT> gentoo <DOT> org>
AuthorDate: Thu Aug 13 20:53:26 2015 +0000
Commit: Mike Gilbert <floppym <AT> gentoo <DOT> org>
CommitDate: Thu Aug 13 20:53:26 2015 +0000
URL: https://gitweb.gentoo.org/proj/chromium-tools.git/commit/?id=70a26591
Add my script for bumping google-chrome
chrome-bump | 140 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 140 insertions(+)
diff --git a/chrome-bump b/chrome-bump
new file mode 100755
index 0000000..b3f82a5
--- /dev/null
+++ b/chrome-bump
@@ -0,0 +1,140 @@
+#!/usr/bin/env python
+
+from __future__ import print_function
+
+import argparse
+from contextlib import closing
+from debian import deb822
+from glob import glob
+import os
+import os.path
+import portage
+import shutil
+import subprocess
+import sys
+try:
+ from urllib.request import urlopen
+except ImportError:
+ from urllib2 import urlopen
+
+ARCHIVE = 'https://dl.google.com/linux/chrome/deb'
+DIST = 'stable'
+COMP = 'main'
+ARCH = 'amd64'
+
+PORTDIR = portage.settings.repositories['gentoo'].location
+
+PKGMAP = {
+ 'www-client/google-chrome': {
+ '*.ebuild': ('_p', 'google-chrome-stable'),
+ },
+ 'www-client/google-chrome-beta': {
+ '*.ebuild': ('_p', 'google-chrome-beta'),
+ },
+ 'www-client/google-chrome-unstable': {
+ '*.ebuild': ('_p', 'google-chrome-unstable'),
+ },
+ 'www-plugins/chrome-binary-plugins': {
+ '*_p*.ebuild': ('_p', 'google-chrome-stable'),
+ '*_beta*.ebuild': ('_beta', 'google-chrome-beta'),
+ '*_alpha*.ebuild': ('_alpha', 'google-chrome-unstable'),
+ },
+}
+
+ARGS = None
+
+def get_deb_release(archive, dist):
+ url = '%s/dists/%s/Release' % (archive, dist)
+ with closing(urlopen(url)) as fp:
+ return deb822.Release(fp)
+
+def get_deb_packages(archive, dist, comp, arch):
+ url = '%s/dists/%s/%s/binary-%s/Packages' % (archive, dist, comp, arch)
+ with closing(urlopen(url)) as fp:
+ return list(deb822.Packages.iter_paragraphs(fp))
+
+def ebuild_pvr(pn, ebuild):
+ return ebuild[len(pn) + 1 : -7]
+
+def ebuild_pv(pn, ebuild):
+ return ebuild_pvr(pn, ebuild).split('-r')[0]
+
+def ebuild_version(pn, ebuild):
+ return ebuild_pv(pn, ebuild).split('_')[0]
+
+def new_ebuild(pn, version, sep, revision):
+ return pn + '-' + version + sep + revision + '.ebuild'
+
+def copy_ebuild(src, dest):
+ print('cp ' + src + ' ' + dest)
+ if not ARGS.dry_run:
+ shutil.copyfile(src, dest)
+ print('git add ' + dest)
+ if not ARGS.dry_run:
+ subprocess.check_call(['git', 'add', dest])
+
+def remove_ebuild(ebuild):
+ print('git rm ' + ebuild)
+ if not ARGS.dry_run:
+ subprocess.check_call(['git', 'rm', ebuild])
+
+def sync_ebuilds(pkg, debs):
+ os.chdir(os.path.join(PORTDIR, pkg))
+ pn = pkg.split('/')[1]
+ changed = False
+
+ for pattern in PKGMAP[pkg]:
+ (sep, name) = PKGMAP[pkg][pattern]
+ ebuilds = sorted(glob(pattern), reverse=True)
+
+ for deb in debs:
+ if deb['Package'] != name:
+ continue
+
+ (version, revision) = deb['Version'].split('-')
+ found = False
+ for ebuild in ebuilds:
+ if version == ebuild_version(pn, ebuild):
+ found = True
+ break
+ if not found:
+ copy_ebuild(ebuilds[0], new_ebuild(pn, version, sep, revision))
+ changed = True
+
+ for ebuild in ebuilds:
+ found = False
+ for deb in debs:
+ if deb['Package'] != name:
+ continue
+
+ (version, revision) = deb['Version'].split('-')
+ if version == ebuild_version(pn, ebuild):
+ found = True
+ break
+ if not found:
+ remove_ebuild(ebuild)
+ changed = True
+
+ if changed:
+ if ARGS.commit:
+ print('repoman commit')
+ if not ARGS.dry_run:
+ subprocess.check_call(['repoman', 'commit', '-S', '-m', pkg + ': automated update'])
+ else:
+ print('repoman manifest')
+ if not ARGS.dry_run:
+ subprocess.check_call(['repoman', 'manifest'])
+
+def main():
+ parser = argparse.ArgumentParser()
+ parser.add_argument('--commit', '-c', action='store_true')
+ parser.add_argument('--dry-run', '-n', action='store_true')
+ global ARGS
+ ARGS = parser.parse_args()
+
+ debs = get_deb_packages(ARCHIVE, DIST, COMP, ARCH)
+ for pkg in PKGMAP:
+ sync_ebuilds(pkg, debs)
+
+if __name__ == '__main__':
+ main()
next reply other threads:[~2015-08-13 20:53 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-13 20:53 Mike Gilbert [this message]
-- strict thread matches above, loose matches on Subject: below --
2024-10-23 3:50 [gentoo-commits] proj/chromium-tools:master commit in: / Matt Jolly
2024-10-23 3:50 Matt Jolly
2024-10-10 21:52 Matt Jolly
2024-10-10 10:03 Matt Jolly
2024-09-27 0:52 Matt Jolly
2024-09-27 0:52 Matt Jolly
2024-09-27 0:52 Matt Jolly
2024-09-26 7:25 Matt Jolly
2024-09-26 5:29 Matt Jolly
2024-09-26 5:21 Matt Jolly
2024-09-26 3:03 Matt Jolly
2024-09-26 2:39 Matt Jolly
2024-09-26 2:36 Matt Jolly
2024-08-30 3:39 Matt Jolly
2024-06-01 7:22 Matt Jolly
2024-05-31 23:02 Matt Jolly
2024-03-28 2:39 Matt Jolly
2024-03-20 21:45 Matt Jolly
2024-03-20 21:45 Matt Jolly
2024-03-20 21:45 Matt Jolly
2024-03-20 21:45 Matt Jolly
2023-02-05 15:09 Stephan Hartmann
2022-09-01 19:33 Mike Gilbert
2022-09-01 19:24 Mike Gilbert
2022-05-06 9:55 Stephan Hartmann
2022-05-03 16:54 Mike Gilbert
2022-05-03 16:54 Mike Gilbert
2022-02-11 17:16 Stephan Hartmann
2022-02-05 16:29 Stephan Hartmann
2022-01-31 20:20 Stephan Hartmann
2020-11-21 19:34 Stephan Hartmann
2020-10-26 17:48 Mike Gilbert
2016-09-15 16:15 Mike Gilbert
2016-09-15 16:11 Mike Gilbert
2012-07-31 23:27 Mike Gilbert
2012-07-31 20:39 Mike Gilbert
2012-06-18 7:38 Paweł Hajdan
2011-10-25 16:36 Paweł Hajdan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1439499206.70a26591a5872c48a140edd2256e89a88b24b9de.floppym@gentoo \
--to=floppym@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox