Mageia Bugzilla – Attachment 5878 Details for
Bug 15251
Implement backports checkout in mgarepo
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
New Account
|
Forgot Password
[patch]
Implement support for mgarepo co backports/4/pkgname if branch exists
0001-backports-support-for-checkout-with-mgarepo-co-backp.patch (text/plain), 5.61 KB, created by
Rémi Verschelde
on 2015-02-10 11:38:14 CET
(
hide
)
Description:
Implement support for mgarepo co backports/4/pkgname if branch exists
Filename:
MIME Type:
Creator:
Rémi Verschelde
Created:
2015-02-10 11:38:14 CET
Size:
5.61 KB
patch
obsolete
>From cc83bbb32f6723eb6992514ab8f021bd8eec0ffc Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= <remi@verschelde.fr> >Date: Tue, 10 Feb 2015 11:37:14 +0100 >Subject: [PATCH] backports: support for checkout with mgarepo co > backports/1/mutt if the corresponding branch exists > >--- > MgaRepo/commands/co.py | 4 +++- > MgaRepo/layout.py | 25 +++++++++++++++++-------- > mgarepo.8 | 4 ++++ > 3 files changed, 24 insertions(+), 9 deletions(-) > >diff --git a/MgaRepo/commands/co.py b/MgaRepo/commands/co.py >index 0a111e2..93c5ed4 100644 >--- a/MgaRepo/commands/co.py >+++ b/MgaRepo/commands/co.py >@@ -14,6 +14,7 @@ If the 'mirror' option is enabled, the package is obtained from the mirror > repository. > > You can specify the distro branch to checkout from by using distro/pkgname. >+For backports, you can specify the target branch by using backports/distro/pkgname. > > Options: > -d The distribution branch to checkout from >@@ -26,7 +27,8 @@ Options: > Examples: > mgarepo co pkgname > mgarepo co -d 1 pkgname >- mgarepo co 1/pkgame >+ mgarepo co 1/pkgname >+ mgarepo co backports/1/pkgname > mgarepo co http://repos/svn/cnc/snapshot/foo > mgarepo co http://repos/svn/cnc/snapshot/foo foo-pkg > """ >diff --git a/MgaRepo/layout.py b/MgaRepo/layout.py >index 093b276..0eb0100 100644 >--- a/MgaRepo/layout.py >+++ b/MgaRepo/layout.py >@@ -13,7 +13,9 @@ def layout_dirs(): > devel_branch = os.path.normpath(devel_branch) > branches_dir = config.get("global", "branches-dir", "updates/") > branches_dir = os.path.normpath(branches_dir) >- return devel_branch, branches_dir >+ backports_dir = config.get("global", "backports-dir", "backports/") >+ backports_dir = os.path.normpath(backports_dir) >+ return devel_branch, branches_dir, backports_dir > > def get_url_revision(url, retrieve=True): > """Get the revision from a given URL >@@ -150,14 +152,20 @@ def package_url(name_or_url, version=None, release=None, distro=None, > repository_url(), pkgdirurl) > else: > name = name_or_url >- devel_branch, branches_dir = layout_dirs() >- if distro or "/" in name: >- default_branch = branches_dir >+ devel_branch, branches_dir, backports_dir = layout_dirs() >+ if "backports/" in name: >+ default_branch = backports_dir > if distro: > default_branch = os.path.join(default_branch, distro) >+ path = os.path.join(default_branch, name.replace("backports/", "", 1)) > else: >- default_branch = devel_branch # cauldron >- path = os.path.join(default_branch, name) >+ if distro or "/" in name: >+ default_branch = branches_dir >+ if distro: >+ default_branch = os.path.join(default_branch, distro) >+ else: >+ default_branch = devel_branch # cauldron >+ path = os.path.join(default_branch, name) > parsed = list(urlparse.urlparse(repository_url(mirrored=mirrored))) > parsed[2] = os.path.join(parsed[2], path) > pkgdirurl = urlparse.urlunparse(parsed) >@@ -187,17 +195,18 @@ def distro_branch(pkgdirurl): > found = None > repo = repository_url() > if same_base(repo, pkgdirurl): >- devel_branch, branches_dir = layout_dirs() >+ devel_branch, branches_dir, backports_dir = layout_dirs() > repo_path = urlparse.urlparse(repo)[2] > devel_path = os.path.join(repo_path, devel_branch) > branches_path = os.path.join(repo_path, branches_dir) >+ backports_path = os.path.join(repo_path, backports_dir) > parsed = urlparse.urlparse(pkgdirurl) > path = os.path.normpath(parsed[2]) > if path.startswith(devel_path): > # devel_branch must be before branches_dir in order to allow > # devel_branch to be inside branches_dir, as in /branches/cauldron > _, found = os.path.split(devel_branch) >- elif path.startswith(branches_path): >+ elif path.startswith(branches_path) or path.startswith(backports_path): > comps = path.split("/") > if branches_path == "/": > found = comps[1] >diff --git a/mgarepo.8 b/mgarepo.8 >index 03b6ee4..8cd6596 100644 >--- a/mgarepo.8 >+++ b/mgarepo.8 >@@ -26,6 +26,8 @@ Users that don't have an ssh account in the default repository URL can set the o > Obtains a working copy of the package foo. > .IP "\fBmgarepo co 1/mutt\fP" > Obtains a working copy of the package mutt of from the 1 branch. >+.IP "\fBmgarepo co backports/1/mutt\fP" >+Obtains a working copy of the package mutt of from the backports/1 branch. > .IP "\fBmgarepo ci\fP" > Commits pending changes in the working copy. > .IP "\fBmgarepo submit foo \-r 12345\fP" >@@ -144,6 +146,8 @@ Increase the verbosity of mgarepo output, printing commands being run and comple > Points to the default branch of the distro used in commands that do not have their branch or URL specified. > .IP "\fBbranches-dir\fP" > The directory inside the repository which contains all the branches of the distro. It is used to build the URL of packages referred using the branch notation BRANCH/PACKAGE, as in \fBmgarepo co 1/mutt\fP. >+.IP "\fBbackports_dir\fP" >+The directory inside the repository which contains all backports branches of the distro. It is used to build the URL of packages referred using the branch notation backports/BRANCH/PACKAGE, as in \fBmgarepo co backports/1/mutt\fP. > .SS "[submit-groups] section" > This section contains aliases to groups of packages to be submitted at once. For example, a line with \fBmy-python-packages = bzr bzrtools bzr-gtk\fP would allow the user to simply run \fBmgarepo submit my-python-packages\fP. > >-- >2.3.0 >
From cc83bbb32f6723eb6992514ab8f021bd8eec0ffc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= <remi@verschelde.fr> Date: Tue, 10 Feb 2015 11:37:14 +0100 Subject: [PATCH] backports: support for checkout with mgarepo co backports/1/mutt if the corresponding branch exists --- MgaRepo/commands/co.py | 4 +++- MgaRepo/layout.py | 25 +++++++++++++++++-------- mgarepo.8 | 4 ++++ 3 files changed, 24 insertions(+), 9 deletions(-) diff --git a/MgaRepo/commands/co.py b/MgaRepo/commands/co.py index 0a111e2..93c5ed4 100644 --- a/MgaRepo/commands/co.py +++ b/MgaRepo/commands/co.py @@ -14,6 +14,7 @@ If the 'mirror' option is enabled, the package is obtained from the mirror repository. You can specify the distro branch to checkout from by using distro/pkgname. +For backports, you can specify the target branch by using backports/distro/pkgname. Options: -d The distribution branch to checkout from @@ -26,7 +27,8 @@ Options: Examples: mgarepo co pkgname mgarepo co -d 1 pkgname - mgarepo co 1/pkgame + mgarepo co 1/pkgname + mgarepo co backports/1/pkgname mgarepo co http://repos/svn/cnc/snapshot/foo mgarepo co http://repos/svn/cnc/snapshot/foo foo-pkg """ diff --git a/MgaRepo/layout.py b/MgaRepo/layout.py index 093b276..0eb0100 100644 --- a/MgaRepo/layout.py +++ b/MgaRepo/layout.py @@ -13,7 +13,9 @@ def layout_dirs(): devel_branch = os.path.normpath(devel_branch) branches_dir = config.get("global", "branches-dir", "updates/") branches_dir = os.path.normpath(branches_dir) - return devel_branch, branches_dir + backports_dir = config.get("global", "backports-dir", "backports/") + backports_dir = os.path.normpath(backports_dir) + return devel_branch, branches_dir, backports_dir def get_url_revision(url, retrieve=True): """Get the revision from a given URL @@ -150,14 +152,20 @@ def package_url(name_or_url, version=None, release=None, distro=None, repository_url(), pkgdirurl) else: name = name_or_url - devel_branch, branches_dir = layout_dirs() - if distro or "/" in name: - default_branch = branches_dir + devel_branch, branches_dir, backports_dir = layout_dirs() + if "backports/" in name: + default_branch = backports_dir if distro: default_branch = os.path.join(default_branch, distro) + path = os.path.join(default_branch, name.replace("backports/", "", 1)) else: - default_branch = devel_branch # cauldron - path = os.path.join(default_branch, name) + if distro or "/" in name: + default_branch = branches_dir + if distro: + default_branch = os.path.join(default_branch, distro) + else: + default_branch = devel_branch # cauldron + path = os.path.join(default_branch, name) parsed = list(urlparse.urlparse(repository_url(mirrored=mirrored))) parsed[2] = os.path.join(parsed[2], path) pkgdirurl = urlparse.urlunparse(parsed) @@ -187,17 +195,18 @@ def distro_branch(pkgdirurl): found = None repo = repository_url() if same_base(repo, pkgdirurl): - devel_branch, branches_dir = layout_dirs() + devel_branch, branches_dir, backports_dir = layout_dirs() repo_path = urlparse.urlparse(repo)[2] devel_path = os.path.join(repo_path, devel_branch) branches_path = os.path.join(repo_path, branches_dir) + backports_path = os.path.join(repo_path, backports_dir) parsed = urlparse.urlparse(pkgdirurl) path = os.path.normpath(parsed[2]) if path.startswith(devel_path): # devel_branch must be before branches_dir in order to allow # devel_branch to be inside branches_dir, as in /branches/cauldron _, found = os.path.split(devel_branch) - elif path.startswith(branches_path): + elif path.startswith(branches_path) or path.startswith(backports_path): comps = path.split("/") if branches_path == "/": found = comps[1] diff --git a/mgarepo.8 b/mgarepo.8 index 03b6ee4..8cd6596 100644 --- a/mgarepo.8 +++ b/mgarepo.8 @@ -26,6 +26,8 @@ Users that don't have an ssh account in the default repository URL can set the o Obtains a working copy of the package foo. .IP "\fBmgarepo co 1/mutt\fP" Obtains a working copy of the package mutt of from the 1 branch. +.IP "\fBmgarepo co backports/1/mutt\fP" +Obtains a working copy of the package mutt of from the backports/1 branch. .IP "\fBmgarepo ci\fP" Commits pending changes in the working copy. .IP "\fBmgarepo submit foo \-r 12345\fP" @@ -144,6 +146,8 @@ Increase the verbosity of mgarepo output, printing commands being run and comple Points to the default branch of the distro used in commands that do not have their branch or URL specified. .IP "\fBbranches-dir\fP" The directory inside the repository which contains all the branches of the distro. It is used to build the URL of packages referred using the branch notation BRANCH/PACKAGE, as in \fBmgarepo co 1/mutt\fP. +.IP "\fBbackports_dir\fP" +The directory inside the repository which contains all backports branches of the distro. It is used to build the URL of packages referred using the branch notation backports/BRANCH/PACKAGE, as in \fBmgarepo co backports/1/mutt\fP. .SS "[submit-groups] section" This section contains aliases to groups of packages to be submitted at once. For example, a line with \fBmy-python-packages = bzr bzrtools bzr-gtk\fP would allow the user to simply run \fBmgarepo submit my-python-packages\fP. -- 2.3.0
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 15251
: 5878