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] [362] fix sync
</TITLE>
<LINK REL="Index" HREF="index.html" >
<LINK REL="made" HREF="mailto:mageia-sysadm%40mageia.org?Subject=Re%3A%20%5BMageia-sysadm%5D%20%5B362%5D%20fix%20sync&In-Reply-To=%3C20110127224745.0CD3D4331F%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="002474.html">
<LINK REL="Next" HREF="002476.html">
</HEAD>
<BODY BGCOLOR="#ffffff">
<H1>[Mageia-sysadm] [362] fix sync</H1>
<B>root at mageia.org</B>
<A HREF="mailto:mageia-sysadm%40mageia.org?Subject=Re%3A%20%5BMageia-sysadm%5D%20%5B362%5D%20fix%20sync&In-Reply-To=%3C20110127224745.0CD3D4331F%40valstar.mageia.org%3E"
TITLE="[Mageia-sysadm] [362] fix sync">root at mageia.org
</A><BR>
<I>Thu Jan 27 23:47:45 CET 2011</I>
<P><UL>
<LI>Previous message: <A HREF="002474.html">[Mageia-sysadm] [361] rename binrepo_delete as it is not only for binrepo
</A></li>
<LI>Next message: <A HREF="002476.html">[Mageia-sysadm] [363] rename ci option to commit
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#2475">[ date ]</a>
<a href="thread.html#2475">[ thread ]</a>
<a href="subject.html#2475">[ subject ]</a>
<a href="author.html#2475">[ author ]</a>
</LI>
</UL>
<HR>
<!--beginarticle-->
<PRE>Revision: 362
Author: boklm
Date: 2011-01-27 23:47:44 +0100 (Thu, 27 Jan 2011)
Log Message:
-----------
fix sync
Modified Paths:
--------------
build_system/mgarepo/trunk/MgaRepo/rpmutil.py
Modified: build_system/mgarepo/trunk/MgaRepo/rpmutil.py
===================================================================
--- build_system/mgarepo/trunk/MgaRepo/rpmutil.py 2011-01-27 22:06:10 UTC (rev 361)
+++ build_system/mgarepo/trunk/MgaRepo/rpmutil.py 2011-01-27 22:47:44 UTC (rev 362)
@@ -499,9 +499,7 @@
names = os.listdir(path)
return (".svn" in names and "SPECS" in names and "SOURCES" in names)
-def sync(dryrun=False, ci=False, download=False):
- # TODO FIXME XXX fix it!
- raise Error, "sync is not expected to work these days"
+def sync(dryrun=False, commit=False, download=False):
svn = SVN()
topdir = getpkgtopdir()
# run svn info because svn st does not complain when topdir is not an
@@ -525,28 +523,22 @@
for name, no, flags in spec.sources())
sourcesst = dict((os.path.basename(path), (path, st))
for st, path in svn.status(sourcesdir, noignore=True))
- toadd_br = []
- toadd_svn = []
- toremove_svn = []
- toremove_br = []
+ toadd = []
+ toremove = []
# add the spec file itself, in case of a new package
specstl = svn.status(specpath, noignore=True)
if specstl:
specst, _ = specstl[0]
if specst == "?":
- toadd_svn.append(specpath)
+ toadd.append(specpath)
# add source files:
for source, url in sources.iteritems():
sourcepath = os.path.join(sourcesdir, source)
if sourcesst.get(source):
if not os.path.islink(sourcepath):
- if not binrepo.is_tracked(sourcepath):
- if binrepo.is_binary(sourcepath):
- toadd_br.append(sourcepath)
- else:
- toadd_svn.append(sourcepath)
- else:
- sys.stderr.write("warning: %s not found\n" % sourcepath)
+ toadd.append(sourcepath)
+ elif not download and not os.path.isfile(sourcepath):
+ sys.stderr.write("warning: %s not found\n" % sourcepath)
elif download and not os.path.isfile(sourcepath):
print "%s not found, downloading from %s" % (sourcepath, url)
fmt = config.get("global", "download-command",
@@ -559,42 +551,26 @@
"configuration option" % e
execcmd(cmd, show=True)
if os.path.isfile(sourcepath):
- if binrepo.is_binary(sourcepath):
- toadd_br.append(sourcepath)
- else:
- toadd_svn.append(sourcepath)
+ toadd.append(sourcepath)
else:
raise Error, "file not found: %s" % sourcepath
# rm entries not found in sources and still in svn
found = os.listdir(sourcesdir)
for entry in found:
- if entry == ".svn" or entry == "sources":
+ if entry == ".svn" or entry == binrepo.SOURCES_FILE:
continue
status = sourcesst.get(entry)
path = os.path.join(sourcesdir, entry)
if entry not in sources:
- if status is None: # file is tracked by svn
- toremove_svn.append(path)
- elif binrepo.is_tracked(path):
- toremove_br.append(path)
- for path in toremove_svn:
+ toremove.append(path)
+ for path in toremove:
print "D\t%s" % path
if not dryrun:
- svn.remove(path, local=True)
- for path in toremove_br:
- print "DB\t%s" % path
- if not dryrun:
- binrepo.delete_pending(path)
- for path in toadd_svn:
+ delete(path, commit=commit)
+ for path in toadd:
print "A\t%s" % path
if not dryrun:
- svn.add(path, local=True)
- for path in toadd_br:
- print "AB\t%s" % path
- if not dryrun:
- binrepo.upload_pending(path)
- if commit:
- commit(topdir)
+ upload(path, commit=commit)
def commit(target=".", message=None, logfile=None):
svn = SVN()
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/mageia-sysadm/attachments/20110127/5fba0d53/attachment.html>
</PRE>
<!--endarticle-->
<HR>
<P><UL>
<!--threads-->
<LI>Previous message: <A HREF="002474.html">[Mageia-sysadm] [361] rename binrepo_delete as it is not only for binrepo
</A></li>
<LI>Next message: <A HREF="002476.html">[Mageia-sysadm] [363] rename ci option to commit
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#2475">[ date ]</a>
<a href="thread.html#2475">[ thread ]</a>
<a href="subject.html#2475">[ subject ]</a>
<a href="author.html#2475">[ 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>
|