1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<TITLE> [Mageia-sysadm] [342] add binrepo remove function
</TITLE>
<LINK REL="Index" HREF="index.html" >
<LINK REL="made" HREF="mailto:mageia-sysadm%40mageia.org?Subject=Re%3A%20%5BMageia-sysadm%5D%20%5B342%5D%20add%20binrepo%20remove%20function&In-Reply-To=%3C20110125181400.D98CF43115%40valstar.mageia.org%3E">
<META NAME="robots" CONTENT="index,nofollow">
<META http-equiv="Content-Type" content="text/html; charset=us-ascii">
<LINK REL="Previous" HREF="002446.html">
<LINK REL="Next" HREF="002449.html">
</HEAD>
<BODY BGCOLOR="#ffffff">
<H1>[Mageia-sysadm] [342] add binrepo remove function</H1>
<B>root at mageia.org</B>
<A HREF="mailto:mageia-sysadm%40mageia.org?Subject=Re%3A%20%5BMageia-sysadm%5D%20%5B342%5D%20add%20binrepo%20remove%20function&In-Reply-To=%3C20110125181400.D98CF43115%40valstar.mageia.org%3E"
TITLE="[Mageia-sysadm] [342] add binrepo remove function">root at mageia.org
</A><BR>
<I>Tue Jan 25 19:14:00 CET 2011</I>
<P><UL>
<LI>Previous message: <A HREF="002446.html">[Mageia-sysadm] [341] update description
</A></li>
<LI>Next message: <A HREF="002449.html">[Mageia-sysadm] [343] don't set uses-binrepo svn property as every package is using binrepo
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#2447">[ date ]</a>
<a href="thread.html#2447">[ thread ]</a>
<a href="subject.html#2447">[ subject ]</a>
<a href="author.html#2447">[ author ]</a>
</LI>
</UL>
<HR>
<!--beginarticle-->
<PRE>Revision: 342
Author: boklm
Date: 2011-01-25 19:14:00 +0100 (Tue, 25 Jan 2011)
Log Message:
-----------
add binrepo remove function
Modified Paths:
--------------
build_system/mgarepo/trunk/MgaRepo/binrepo.py
build_system/mgarepo/trunk/MgaRepo/commands/del.py
build_system/mgarepo/trunk/MgaRepo/rpmutil.py
Modified: build_system/mgarepo/trunk/MgaRepo/binrepo.py
===================================================================
--- build_system/mgarepo/trunk/MgaRepo/binrepo.py 2011-01-25 17:00:15 UTC (rev 341)
+++ build_system/mgarepo/trunk/MgaRepo/binrepo.py 2011-01-25 18:14:00 UTC (rev 342)
@@ -287,7 +287,8 @@
entries = parse_sources(path)
f = open(path, "w") # open before calculating hashes
for name in removed:
- entries.pop(removed)
+ if name in entries:
+ del entries[name]
for added_path in added:
name = os.path.basename(added_path)
entries[name] = file_hash(added_path)
@@ -301,6 +302,29 @@
t.join()
return t
+def remove(path, message=None, commit=True):
+ from MgaRepo.rpmutil import getpkgtopdir
+ svn = SVN()
+ if not os.path.exists(path):
+ raise Error, "not found: %s" % path
+ bpath = os.path.basename(path)
+ topdir = getpkgtopdir()
+ bintopdir = translate_topdir(topdir)
+ update = update_sources_threaded(topdir, removed=[bpath])
+ sources = sources_path(topdir)
+ silent = config.get("log", "ignore-string", "SILENT")
+ if not message:
+ message = "%s: delete binary file %s" % (silent, bpath)
+ if commit:
+ svn.commit(topdir + " " + sources, log=message, nonrecursive=True)
+ binlink = os.path.join(topdir, "SOURCES", bpath)
+ if os.path.islink(binlink):
+ os.unlink(binlink)
+ binpath = os.path.join(topdir, BINARIES_CHECKOUT_NAME, bpath)
+ svn.remove(binpath)
+ if commit:
+ svn.commit(binpath, log=message)
+
def upload(path, message=None):
from MgaRepo.rpmutil import getpkgtopdir
svn = SVN()
Modified: build_system/mgarepo/trunk/MgaRepo/commands/del.py
===================================================================
--- build_system/mgarepo/trunk/MgaRepo/commands/del.py 2011-01-25 17:00:15 UTC (rev 341)
+++ build_system/mgarepo/trunk/MgaRepo/commands/del.py 2011-01-25 18:14:00 UTC (rev 342)
@@ -7,18 +7,13 @@
Remove a given file from the binary sources repository.
-Changes in the sources file will be left uncommited.
-
Options:
- -c automatically commit the 'sources' file
-h help
"""
def parse_options():
parser = OptionParser(help=HELP)
- parser.add_option("-c", dest="commit", default=False,
- action="store_true")
opts, args = parser.parse_args()
if len(args):
opts.paths = args
Modified: build_system/mgarepo/trunk/MgaRepo/rpmutil.py
===================================================================
--- build_system/mgarepo/trunk/MgaRepo/rpmutil.py 2011-01-25 17:00:15 UTC (rev 341)
+++ build_system/mgarepo/trunk/MgaRepo/rpmutil.py 2011-01-25 18:14:00 UTC (rev 342)
@@ -666,16 +666,10 @@
binrepo.upload(path)
def binrepo_delete(paths, commit=False):
- #TODO handle files tracked by svn
refurl = binrepo.svn_root(paths[0])
if not binrepo.enabled(refurl):
raise Error, "binary repository is not enabled for %s" % refurl
- added, deleted = binrepo.remove(paths)
- if commit:
- svn = SVN()
- spath = binrepo.sources_path(paths[0])
- log = _sources_log(added, deleted)
- svn.commit(spath, log=log)
+ binrepo.remove(paths[0])
def switch(mirrorurl=None):
svn = SVN()
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/mageia-sysadm/attachments/20110125/7a91e184/attachment-0001.html>
</PRE>
<!--endarticle-->
<HR>
<P><UL>
<!--threads-->
<LI>Previous message: <A HREF="002446.html">[Mageia-sysadm] [341] update description
</A></li>
<LI>Next message: <A HREF="002449.html">[Mageia-sysadm] [343] don't set uses-binrepo svn property as every package is using binrepo
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#2447">[ date ]</a>
<a href="thread.html#2447">[ thread ]</a>
<a href="subject.html#2447">[ subject ]</a>
<a href="author.html#2447">[ author ]</a>
</LI>
</UL>
<hr>
<a href="https://www.mageia.org/mailman/listinfo/mageia-sysadm">More information about the Mageia-sysadm
mailing list</a><br>
</body></html>
|