Adding Information To pluto media

From LinuxMCE
Revision as of 13:34, 9 September 2009 by Marie.o (Talk | contribs) (Update local svn checkout)

Jump to: navigation, search

pluto_media contains a mix of media information relevant for the local install, and configuration information relevant for the building of packages. pluto_media updates to the configuration, like the MediaSource table, needs to be re-done on the main mysql server (currently located at schema.linuxmce.org).

After amending the MySQL database pluto_media on schema.linuxmce.org, sqlCVS needs to be run on schema and the psc IDs need to be updated by selecting update-psc

sqlCVS -D pluto_media update-psc

Example of adding a record to pluto_media.MediaSource

Adding the record on the main MySQL server (schema.linuxmce.org as of this writing)

We need to add a new type of MediaSource to the system. This is, how it was done:

[root@lmce-svn ~]# mysql pluto_media
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 68301
Server version: 5.0.45 Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> select * from MediaSource;
+----------------+-------------------+--------+--------+-----------+----------+------------+---------------------+--------------+
| PK_MediaSource | Description       | Define | psc_id | psc_batch | psc_user | psc_frozen | psc_mod             | psc_restrict |
+----------------+-------------------+--------+--------+-----------+----------+------------+---------------------+--------------+
|              1 | Hard Drives       | NULL   |      1 |      NULL |     NULL |          0 | 0000-00-00 00:00:00 |         NULL |
|              2 | Discs & Jukeboxes | NULL   |      2 |      NULL |     NULL |          0 | 0000-00-00 00:00:00 |         NULL |
|              3 | Bookmarks         | NULL   |      3 |      NULL |     NULL |          0 | 0000-00-00 00:00:00 |         NULL |
+----------------+-------------------+--------+--------+-----------+----------+------------+---------------------+--------------+
3 rows in set (0.00 sec)

mysql> insert into MediaSource (Description) Values ("Downloadable");
Query OK, 1 row affected (0.01 sec)

mysql> select * from MediaSource;
+----------------+-------------------+--------+--------+-----------+----------+------------+---------------------+--------------+
| PK_MediaSource | Description       | Define | psc_id | psc_batch | psc_user | psc_frozen | psc_mod             | psc_restrict |
+----------------+-------------------+--------+--------+-----------+----------+------------+---------------------+--------------+
|              1 | Hard Drives       | NULL   |      1 |      NULL |     NULL |          0 | 0000-00-00 00:00:00 |         NULL |
|              2 | Discs & Jukeboxes | NULL   |      2 |      NULL |     NULL |          0 | 0000-00-00 00:00:00 |         NULL |
|              3 | Bookmarks         | NULL   |      3 |      NULL |     NULL |          0 | 0000-00-00 00:00:00 |         NULL |
|              4 | Downloadable      | NULL   |   NULL |      NULL |     NULL |          0 | 2009-09-09 12:26:05 |         NULL |
+----------------+-------------------+--------+--------+-----------+----------+------------+---------------------+--------------+
4 rows in set (0.00 sec)

mysql> \q
Bye
[root@lmce-svn ~]# /usr/pluto/bin/sqlCVS -D pluto_media update-psc
 Copyright (C) 2004 Pluto, Inc., a Florida Corporation
 www.plutohome.com
 Phone: +1 (877) 758-8648
This program is distributed according to the terms
of the Pluto Public License, available at:
 http://plutohome.com/index.php?section=public_license
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the Pluto Public License for more details.

-------

Database host:localhost user:root pass: name:pluto_media port:3306
Users:
Updating repository 'media' schema version from: 43
[root@lmce-svn ~]# mysql pluto_media -e "select * from MediaSource"
+----------------+-------------------+--------+--------+-----------+----------+------------+---------------------+--------------+
| PK_MediaSource | Description       | Define | psc_id | psc_batch | psc_user | psc_frozen | psc_mod             | psc_restrict |
+----------------+-------------------+--------+--------+-----------+----------+------------+---------------------+--------------+
|              1 | Hard Drives       | NULL   |      1 |      NULL |     NULL |          0 | 0000-00-00 00:00:00 |         NULL |
|              2 | Discs & Jukeboxes | NULL   |      2 |      NULL |     NULL |          0 | 0000-00-00 00:00:00 |         NULL |
|              3 | Bookmarks         | NULL   |      3 |      NULL |     NULL |          0 | 0000-00-00 00:00:00 |         NULL |
|              4 | Downloadable      | NULL   |      4 |      NULL |     NULL |          0 | 2009-09-09 12:26:34 |         NULL |
+----------------+-------------------+--------+--------+-----------+----------+------------+---------------------+--------------+
[root@lmce-svn ~]#

Update SVN to know about this new media source

Update builder's database

On our builder, we do an import of the database

root@Ubuntu-904-jaunty-64-minimal:/usr/local/lmce-build# /usr/local/lmce-build/build-scripts/import-databases.sh

Now we have the updated databases on the builder. Let's verify

root@Ubuntu-904-jaunty-64-minimal:/usr/local/lmce-build# mysql pluto_media -e "select * from MediaSource;"
+----------------+-------------------+--------+--------+-----------+----------+------------+---------------------+--------------+
| PK_MediaSource | Description       | Define | psc_id | psc_batch | psc_user | psc_frozen | psc_mod             | psc_restrict |
+----------------+-------------------+--------+--------+-----------+----------+------------+---------------------+--------------+
|              1 | Hard Drives       | NULL   |      1 |      NULL |     NULL |          0 | 0000-00-00 00:00:00 |         NULL |
|              2 | Discs & Jukeboxes | NULL   |      2 |      NULL |     NULL |          0 | 0000-00-00 00:00:00 |         NULL |
|              3 | Bookmarks         | NULL   |      3 |      NULL |     NULL |          0 | 0000-00-00 00:00:00 |         NULL |
|              4 | Downloadable      | NULL   |      4 |      NULL |     NULL |          0 | 2009-09-09 10:26:34 |         NULL |
+----------------+-------------------+--------+--------+-----------+----------+------------+---------------------+--------------+

That looks good.

Update local svn checkout

Now, we need to update the codebase to reflect the new MediaSource. We use sql2cpp for this.

root@Ubuntu-904-jaunty-64-minimal:/usr/local/lmce-build# LD_LIBRARY_PATH=/var/lmce-build/MakeRelease /var/lmce-build/svn/branches/LinuxMCE-0810/src/sql2cpp/sql2cpp -i \
/var/lmce-build/svn/branches/LinuxMCE-0810/src/sql2cpp/ -o /var/lmce-build/svn/branches/LinuxMCE-0810/src/pluto_media \
-D pluto_media -h localhost

Update central svn

svn commit /var/lmce-build/svn/branches/LinuxMCE-0810/src/pluto_media -m "Additional MediaSource entry for downloadable media"