summaryrefslogtreecommitdiff
path: root/UPGRADING
blob: 913da8d4c63060bbc269c2dface9052e746b91c2 (plain)
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
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
Upgrading
=========

From 1.9.1 to 2.0.0
-------------------

1. Add new "Users" table login date column:

----
ALTER TABLE Users ADD COLUMN LastLogin BIGINT NOT NULL DEFAULT 0;
ALTER TABLE Users ADD COLUMN PGPKey VARCHAR(40) NULL DEFAULT NULL;
----

2. Merge "web/lib/config.inc.php.proto" with "web/lib/config.inc.php".

3. Update Archive_Tar to version greater than 1.3.7.

4. Enable the PDO MySQL extension (pdo_mysql.so) in "php.ini".

From 1.9.0 to 1.9.1
-------------------

1. Merge "web/lib/config.inc.php.proto" with "web/lib/config.inc.php".

2. Install translations by running `make install` in "po/".

From 1.8.2 to 1.9.0
-------------------

1. Translation files are now gettext compatible and need to be compiled after
each AUR upgrade by running `make install` in the "po/" directory.

2. Remove the "NewPkgNotify" column from the "Users" table:

ALTER TABLE Users DROP COLUMN NewPkgNotify;

3. Fix up issues with depends performance on large dataset.

ALTER TABLE PackageDepends ADD INDEX (DepName);

4. Rename "web/lib/config.inc" to "web/lib/config.inc.php".

5. Merge "web/lib/config.inc.php.proto" with "web/lib/config.inc.php".

6. Run the upload directory transform script ("scripts/uploadbuckets.sh") and
rotate the converted directory structure into place.

7. In order to to provide backward compatible package URLs, enable mod_rewrite
and add the following to your Apache configuration (inside the "VirtualHost"
container or optionally create a ".htaccess" file in the upload directory):

----
RewriteEngine on
RewriteRule ^/packages/([^/]{1,2})([^/]*/(PKGBUILD|[^/]*\.tar\.gz|))$ /packages/$1/$1$2
----

The following equivalent rule can be used for lighttpd setups:

----
url.rewrite-once = ( "^/packages/([^/]{1,2})([^/]*/(PKGBUILD|[^/]*\.tar\.gz|))$" => "/packages/$1/$1$2" )
----

If you use a non-standard URL_DIR, slight modifications might be necessary.

8. Merge "scripts/aurblup/config.h.proto" with "scripts/aurblup/config.h".

From 1.8.1 to 1.8.2
-------------------

1. Update the modified package timestamp for new packages.

UPDATE Packages SET ModifiedTS = SubmittedTS WHERE ModifiedTS = 0;

2. Move to new method of storing package depends.

----
ALTER TABLE PackageDepends ADD COLUMN DepName VARCHAR(64) NOT NULL DEFAULT '' AFTER PackageID;
UPDATE PackageDepends SET DepName = (SELECT Name FROM Packages WHERE ID = DepPkgID);
ALTER TABLE PackageDepends MODIFY DepName VARCHAR(64) NOT NULL;
ALTER TABLE PackageDepends DROP FOREIGN KEY `PackageDepends_ibfk_2`;
ALTER TABLE PackageDepends DROP COLUMN DepPkgID;
DELETE FROM Packages WHERE DummyPkg = 1;
ALTER TABLE Packages DROP COLUMN DummyPkg;
----

3. The File_Find PEAR module is no longer required. You can safely uninstall it
if nothing else depends on it.

From 1.8.0 to 1.8.1
-------------------

1. Drop foreign keys from the "Sessions" table:

`ALTER TABLE Sessions DROP FOREIGN KEY Sessions_ibfk_1;` should work in most
cases. Otherwise, check the output of `SHOW CREATE TABLE Sessions;` and use the
foreign key name shown there.

2. Run the following MySQL statements:

----
ALTER TABLE Sessions
	ADD FOREIGN KEY (UsersID) REFERENCES Users(ID) ON DELETE CASCADE;
ALTER TABLE PackageDepends
	ADD FOREIGN KEY (PackageID) REFERENCES Packages(ID) ON DELETE CASCADE,
	ADD FOREIGN KEY (DepPkgID) REFERENCES Packages(ID) ON DELETE CASCADE;
ALTER TABLE PackageSources
	ADD FOREIGN KEY (PackageID) REFERENCES Packages(ID) ON DELETE CASCADE;
ALTER TABLE TU_VoteInfo
	ADD FOREIGN KEY (SubmitterID) REFERENCES Users(ID) ON DELETE CASCADE;
ALTER TABLE TU_Votes
	ADD FOREIGN KEY (VoteID) REFERENCES TU_VoteInfo(ID) ON DELETE CASCADE,
	ADD FOREIGN KEY (UserID) REFERENCES Users(ID) ON DELETE CASCADE;
ALTER TABLE PackageComments
	MODIFY DelUsersID INTEGER UNSIGNED NULL DEFAULT NULL;
UPDATE PackageComments SET DelUsersID = NULL WHERE DelUsersID = 0;
ALTER TABLE Packages
	MODIFY SubmitterUID INTEGER UNSIGNED NULL DEFAULT NULL,
	MODIFY MaintainerUID INTEGER UNSIGNED NULL DEFAULT NULL;
UPDATE Packages SET SubmitterUID = NULL WHERE SubmitterUID = 0;
UPDATE Packages SET MaintainerUID = NULL WHERE MaintainerUID = 0;
----

3. (optional) If you converted your database from MyISAM to InnoDB during the
upgrade process from 1.7.0 to 1.8.0 or from 1.8.0 to 1.8.1 without completely
rebuilding the database from the MySQL schema, you should additionally run the
following MySQL statements to add missing foreign keys:

----
ALTER TABLE Users
	ADD FOREIGN KEY (AccountTypeID) REFERENCES AccountTypes(ID) ON DELETE NO ACTION;
ALTER TABLE Packages
	ADD FOREIGN KEY (CategoryID) REFERENCES PackageCategories(ID) ON DELETE NO ACTION,
	ADD FOREIGN KEY (SubmitterUID) REFERENCES Users(ID) ON DELETE NO ACTION,
	ADD FOREIGN KEY (MaintainerUID) REFERENCES Users(ID) ON DELETE NO ACTION;
ALTER TABLE PackageVotes
	ADD FOREIGN KEY (UsersID) REFERENCES Users(ID) ON DELETE CASCADE,
	ADD FOREIGN KEY (PackageID) REFERENCES Packages(ID) ON DELETE CASCADE;
ALTER TABLE PackageComments
	ADD FOREIGN KEY (UsersID) REFERENCES Users(ID) ON DELETE CASCADE,
	ADD FOREIGN KEY (DelUsersID) REFERENCES Users(ID) ON DELETE CASCADE,
	ADD FOREIGN KEY (PackageID) REFERENCES Packages(ID) ON DELETE CASCADE;
ALTER TABLE CommentNotify
	ADD FOREIGN KEY (PkgID) REFERENCES Packages(ID) ON DELETE CASCADE,
	ADD FOREIGN KEY (UserID) REFERENCES Users(ID) ON DELETE CASCADE;
----

4. Merge "web/lib/config.inc.proto" with "web/lib/config.inc".

From 1.7.0 to 1.8.0
-------------------

1. Run the following MySQL statements:

----
ALTER TABLE Packages ADD OutOfDateTS BIGINT UNSIGNED NULL DEFAULT NULL;
UPDATE Packages SET OutOfDateTS = UNIX_TIMESTAMP() WHERE OutOfDate = 1;
ALTER TABLE Packages DROP OutOfDate, DROP FSPath, DROP URLPath, DROP LocationID;
DROP TABLE PackageLocations, PackageContents;
ALTER TABLE AccountTypes MODIFY AccountType VARCHAR(32) NOT NULL DEFAULT '';
ALTER TABLE Users MODIFY Username VARCHAR(32) NOT NULL,
	MODIFY Email VARCHAR(64) NOT NULL,
	MODIFY RealName VARCHAR(64) NOT NULL DEFAULT '',
	MODIFY LangPreference VARCHAR(5) NOT NULL DEFAULT 'en',
	MODIFY IRCNick VARCHAR(32) NOT NULL DEFAULT '';
ALTER TABLE PackageCategories MODIFY Category VARCHAR(32) NOT NULL;
ALTER TABLE Packages MODIFY Name VARCHAR(64) NOT NULL,
	MODIFY Version VARCHAR(32) NOT NULL DEFAULT '',
	MODIFY Description VARCHAR(255) NOT NULL DEFAULT "An Arch Package",
	MODIFY URL VARCHAR(255) NOT NULL DEFAULT "http://www.archlinux.org",
	MODIFY License VARCHAR(40) NOT NULL DEFAULT '';
ALTER TABLE PackageSources
	MODIFY Source VARCHAR(255) NOT NULL DEFAULT "/dev/null";
ALTER TABLE TU_VoteInfo
	MODIFY User VARCHAR(32) collate latin1_general_ci NOT NULL;
CREATE TABLE PackageBlacklist (
	ID INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
	Name VARCHAR(64) NOT NULL,
	PRIMARY KEY (ID),
	UNIQUE (Name)
);
----

2. Drop all fulltext indexes from the "Packages" table:

Please do this with care. `ALTER TABLE Packages DROP INDEX Name;` will work in
most cases but might remove the wrong index if your indexes have been created
in a non-standard order (e.g. during some update process). You'd better run
`SHOW INDEX FROM Packages;` before to ensure that your setup doesn't use a
different naming.

3. You will need to update all packages which are stored in the incoming dir as
in 1.8.0, source tarballs are no longer extracted automatically and PKGBUILDs
are from now on located in the same subdirectories as the tarballs themselves.
The following script will do the conversion automatically when being run inside
"$INCOMING_DIR":

----
#!/bin/bash

for pkg in *; do
	if [ -d "${pkg}" -a ! -f "${pkg}/PKGBUILD" ]; then
		pkgbuild_file=$(find -P "${pkg}" -name PKGBUILD)
		[ -n "${pkgbuild_file}" ] && \
			cp "${pkgbuild_file}" "${pkg}/PKGBUILD"
	fi
done
----

4. (optional): 1.8.0 includes a helper utility called "aurblup" that can be
used to prevent users from uploading source packages with names identical to
packages in predefined binary repos, e.g. the official repositories of your
distribution. In order to build and install aurblup, enter the following
commands:

	cd scripts/aurblup/
	make config.h
	$EDITOR config.h
	make install  # as root

Add something like "0 * * * * /usr/local/bin/aurblup" to root's crontab to make
aurblup update the package blacklist every hour.

NOTE: You can run aurblup as non-privileged user as well. Make sure that the
user has read-write access to "/var/lib/aurblup/" (or whatever you defined with
"ALPM_DBPATH") tho.

5. (optional): As of 1.8.0, all MySQL tables should be InnoDB compatible. To
convert a table, you can use this statement: `ALTER TABLE $foo ENGINE=InnoDB;`.
If you want to stick with MyISAM or another storage engine that doesn't support
transactions, you will need to disable the "MYSQL_USE_TRANSACTIONS" setting in
"config.h" when setting up aurblup.

From 1.6.0 to 1.7.0
-------------------
ALTER TABLE Users ADD Salt CHAR(32) NOT NULL DEFAULT '';
ALTER TABLE Users ADD ResetKey CHAR(32) NOT NULL DEFAULT '';
ALTER TABLE Users MODIFY LangPreference CHAR(5) NOT NULL DEFAULT 'en';


From 1.5.2 to 1.5.3
-------------------
1. Ensure this appears in config.inc:
   define("DEFAULT_LANG", "en");


From 1.5.1 to 1.5.2
-------------------
1. Ensure Pear and File/Find.php are in the path. See web/README.txt.

2. Update your running copy of support/scripts/newpackage-notify.

3. Run this in web/lib:
<?php

# Run the script from within lib
include('config.inc');
include('aur.inc');

$query = "UPDATE Packages SET " .
         "FSPath = CONCAT('" . INCOMING_DIR . "', Name, '/', Name,
'.tar.gz'), " .
         "URLPath = CONCAT('" . URL_DIR . "', Name, '/', Name, '.tar.gz') " .
         "WHERE DummyPKG = 0 AND LocationID = 2;";

$dbh = db_connect();
db_query($query, $dbh);

$query = "ALTER TABLE Packages DROP COLUMN AURMaintainerUID;";
db_query($query, $dbh);


1.3.0
-----
ALTER TABLE PackageDepends ADD COLUMN DepCondition VARCHAR(20) AFTER DepPkgID;
ALTER TABLE Packages ADD License CHAR(40) NOT NULL DEFAULT '';


1.2.10
------
ALTER TABLE Packages MODIFY Description CHAR(255) NOT NULL DEFAULT "An Arch Package";


longerpkgname
-------------
ALTER TABLE Packages MODIFY Name CHAR(64) NOT NULL;