cesArgOmezits over for today ?00:58
=== AlienDev_ is now known as AlienDev
trickis there a pc suites for ubuntu?02:51
trickanyone in here?02:54
ubot2The Ubuntu Classroom is a project which aims to tutor users about Ubuntu, Kubuntu and Xubuntu through biweekly sessions in #ubuntu-classroom - For more information visit https://wiki.ubuntu.com/Classroom02:54
=== emma is now known as em
=== _LibertyZero is now known as LibertyZero
=== Igorot is now known as Knightlust
=== daker_ is now known as daker
=== msnsachin12 is now known as msnsachin
arunkumar413where is the class11:43
johnsgruberthe class will be here in about 3 hours from now (the first class of the day about QML. chat and ask questions in #ubuntu-classroom-chat12:56
=== fabio_ is now known as fabio-
dholbachHELLO EVERYBODY! Welcome to Day 4 of Ubuntu Developer Week!15:53
dholbachHow are you all doing?15:53
oSoMoNhey dholbach, hi everyone15:53
dholbachWe still have 7 minutes left until we start, but I just wanted to bring up a few organisational bits and pieces first:15:53
dholbach - If you can't make it to a session or missed one, logs to the sessions that already happened are linked from https://wiki.ubuntu.com/UbuntuDeveloperWeek15:53
dholbach - If you want to chat or ask questions, please make sure you also join #ubuntu-classroom-chat15:54
dholbach - If you ask questions, please prefix them with QUESTION:15:54
dholbach  ie: QUESTION: What does oSoMoN stand for?15:54
dholbach - if you are on twitter/identi.ca or facebook, follow @ubuntudev to get the latest development updates :)15:54
dholbachthat's it from me15:54
dholbachyou still have 5 minutes until oSoMoN will kick off today and talk about QML App development goodness!15:55
dholbachHave a great day!15:55
Cyberkilladholbach, bye15:55
oSoMoNthanks for the introduction dholbach15:55
oSoMoNlet’s wait for 18:00 sharp and we’ll start15:56
=== Cyberkilla is now known as CK|Spectating
=== ChanServ changed the topic of #ubuntu-classroom to: Welcome to the Ubuntu Classroom - https://wiki.ubuntu.com/Classroom || Support in #ubuntu || Upcoming Schedule: http://is.gd/8rtIi || Questions in #ubuntu-classroom-chat || Event: Ubuntu Developer Week - Current Session: From idea to app in no time with QML - Instructors: oSoMoN
oSoMoNlet’s get this rolling…16:00
ClassBotLogs for this session will be available at http://irclogs.ubuntu.com/2011/07/14/%23ubuntu-classroom.html following the conclusion of the session.16:00
oSoMoNlet’s get this rolling…16:00
oSoMoNHi everyone!16:01
oSoMoNIn this session I’m gonna show you how to write a cool application in QML in no time (in Ubuntu of course!)16:01
oSoMoNI’ll first start with a super quick introduction to QML and pointers to documentation for complete beginners, and then I’ll move on to writing an actual application step by step.16:01
oSoMoNIf you have contextual questions don’t hesitate to ask, myself and others (I hope) will be happy to answer as best as we can.16:01
oSoMoNIf a question is too general, keep it for the end of the session so as not to disrupt the flow too much, we’ll save some time at the end to answer them, and eventually if we go overflow the allocated time we can take the discussions offline.16:01
oSoMoNSo, on to the topic!16:01
oSoMoNThere’s a very good introduction of what QML is at http://doc.qt.nokia.com/qdeclarativeintroduction.html.16:01
oSoMoNThere’s also very good documentation, it’s one of the strong points of Qt in general.16:01
oSoMoNThere are official tutorials as well as plenty of unofficial ones on the interwebs.16:02
oSoMoNBasic tutorial: http://doc.qt.nokia.com/qml-tutorial.html16:02
oSoMoNAdvanced tutorial: http://doc.qt.nokia.com/qml-advtutorial.html16:02
=== Hutley_ is now known as Hutley
oSoMoNHere is a non exhaustive list of advantages that make it a great language to develop applications for Ubuntu:16:02
oSoMoNvery good documentation16:02
oSoMoNimplicit animations16:02
oSoMoNproperty bindings16:02
oSoMoNextensible in C++ or Python (using PySide)16:02
oSoMoNsupports touch input (e.g. kinetic scrolling for lists)16:02
oSoMoNFirst let’s install the packages we’re going to need: `sudo apt-get install qtcreator qt4-qmlviewer libqtwebkit-qmlwebkitplugin`16:03
oSoMoNMy purpose with this session is not to teach you QML from the very beginning, there’s plenty of great documentation out there for that.16:03
oSoMoNThe idea is more to show you how to use it to write a real application for Ubuntu, not the typical and useless Hello World.16:03
oSoMoNFor years I’ve been using liferea, a gnome feed reader, to aggregate and read RSS feeds. It does the job, but it’s been getting incredibly slow, to the point it takes more than a minute to start and display its main window, and that’s not even checking for new feeds. Not acceptable, let’s see if we can write a replacement in QML.16:04
oSoMoNFor the sake of the example it’s going to aggregate all feeds from Planet Ubuntu (http://planet.ubuntu.com/).16:04
oSoMoNThe desired layout is basic: a list of all recents entries in a left pane, and a view of the currently selected entry in a right pane.16:04
oSoMoNI’ll guide you through the code step by step, you can find it in the following bzr branch: lp:~osomon/+junk/qml-feedreader.16:04
oSoMoNEach revision in the branch corresponds to a step. For convenience, you can browse the revisions and see the diffs between each revision at http://bazaar.launchpad.net/~osomon/+junk/qml-feedreader/changes.16:05
oSoMoNLet’s fire up Qt Creator, and click on "Create Project".16:05
oSoMoNSelect "Qt Quick Project" > "Qt Quick UI".16:05
oSoMoNLet’s call it "feedreader" and create it in e.g. "~/dev/qml". Then click "Next" and then "Finish".16:05
oSoMoN(if I’m pasting too fast, someone please tell me and I’ll slow down)16:05
oSoMoNQt Creator created a skeleton application, which we can already run.16:06
oSoMoNWe will replace this code incrementally to implement the functionality of our feed reader.16:06
oSoMoNLet’s get started.16:06
oSoMoNWe’re starting by adding to the root element an XmlListModel that will be responsible for fetching the data from the RSS feed and exposing this data in the form of properties for each item in the model, using XPath queries to extract the relevant data.16:06
oSoMoNThen we’re adding a ListView to display the data from the list model. The delegate is the component responsible for displaying one item in the list, it is automatically instantiated and positioned correctly by the list view.16:07
oSoMoNAt this point we can already run this code, and tada! We get a list of the latest entries for the RSS feed.16:07
oSoMoNAs you can see, you can use the mouse wheel and do kinetic scrolling on the list. All of this comes for free with the ListView element.16:07
oSoMoNIt’s rather ugly and not very readable as no layout is applied to the delegates. We are going to remedy this in the next step.16:07
oSoMoNInstead of a simple Text element, we make the delegate a Rectangle containing two rows of text.16:08
oSoMoNThe first line displays the title of the entry, and the second line the publication date. We tweak the font size, add an ellipsis, margins and spacing.16:08
oSoMoNIt is much better already, but we can improve it visually by adding alternating colors to the rows.16:09
oSoMoNThe SystemPalette element exposes a palette of colors for the current theme, which allows us to give a consistent look’n’feel to our application.16:11
oSoMoNAs you can see, an interesting feature of QML is that we can assign an anonymous function to the value of a property, for non-trivial computations. This of course preserves property binding, meaning that whenever the value of a property used inside the body of this function changes, the property is updated in a transparent manner.16:11
oSoMoNQML items are not mouse-aware by default, but it is very easy to fix this: we just add an invisible MouseArea that covers the area of the item, and we can now connect to the various signals it emits when it receives mouse events.16:13
oSoMoNIn this case, clicking an item in the list will make it the current item. It will be highlighted with a different color for visual feedback.16:14
oSoMoNWe now want to display the contents of the current entry in a pane to the right of the list.16:15
oSoMoNThe contents are stored in the 'description' attribute, so we need to add it to the XmlListModel.16:16
oSoMoNThe contents are HTML, so we are going to display them in a WebView, which is basically a component embedding webkit to render a web page or arbitrary HTML. This requires an extra import.16:17
oSoMoNAs you can see here, property binding is a very powerful feature: unlike in imperative programming, I do not have to set the value of the 'html' property to the contents whenever I change the current entry in the list. All I need to do is bind it, and done!16:17
oSoMoNYou may have noticed that the web view cannot be scrolled. This can be annoying if the contents don’t fit in the frame. Putting the WebView inside a Flickable element fixes this.16:18
oSoMoNThe contents can now be scrolled vertically by clicking and dragging them. Note that a limitation of the Flickable element it that unfortunately it currently doesn’t handle mouse wheel events (this could be overcome by writing a custom Flickable element in C++, but is not the point of today’s session).16:18
oSoMoNWe now add a one-pixel separator between the list view and the webview.16:20
oSoMoNNote how QML stacks sibling elements: the last on top of the others. Which is why we add the separator at the end, after the listview and the flickable.16:20
oSoMoNTo handle keyboard focus properly, we make the top-level element a focus scope, meaning that when it gets the focus it transfers it to one and only one of its children (in our case, the listview).16:21
oSoMoNWe now add a fancy animation on the opacity of the webview whenever we click an entry in the list: the web view fades out, then the index is actually changed, then the webview fades in again.16:22
oSoMoNThis is achieved with a sequential animation; by default animations in QML are run in parallel.16:23
oSoMoNOur webview can be scrolled, that’s nice, but we don’t have any visual indicator of the position within the document.16:25
oSoMoNLet’s add a simple scrollbar that will act as a visual clue (it won’t be clickable to actually change the position).16:25
oSoMoNThe scrollbar is made up of two rectangles: the first one is a semi-transparent background, and the second one is the handle of the scrollbar.16:26
oSoMoNThe scrollbar defines custom properties for the position and the pageSize, those are bound the usual way, so whenever the position of the contents inside the flickable is updated, the properties of the scrollbar are updated accordingly.16:26
oSoMoNThis scrollbar is very nice, how about we extract it to a separate file so as to make it a reusable component?16:28
oSoMoNQML files representing components in the same directory as the main one are discovered automatically, no need to import anything else.16:28
oSoMoNWe name the file "ScrollBar.qml", and the component can be used under the name 'ScrollBar'. Easy, heh?16:28
oSoMoNIn the external component, we remove all references to the flickable. The properties of the scrollbar will be set wherever it is instantiated. This ensures our component is truly reusable and doesn’t rely on the implicit presence of other components.16:29
oSoMoNNow that we’ve done that, it is trivial to add a scrollbar to the listview as well. Almost too easy :)16:30
=== a is now known as Guest32986
oSoMoNFor the final touch, let’s add a header to the right pane, displaying two lines: one with the title of the current entry, and the second one with a link to the original blog entry.16:32
oSoMoNAs a bonus, we can very easily make the link clickable by using a MouseArea and invoking the handy helper function "Qt.openUrlExternally(…)".16:33
oSoMoNThat’s it for the code folks!16:34
oSoMoNWe have written a full-fledged real-word application in about half an hour and under 200 lines of code (158 lines if we exclude copyright and license headers and blank lines).16:34
oSoMoNHere is a screenshot of the application running: http://tilloy.net/olivier/qml/qml-feedreader.png, for those who haven’t tested it.16:35
oSoMoNThis is only a quick example of what QML can help you build, it’s by no means a complete overview of how rich the framework is.16:35
oSoMoNThe following page has lots of very interesting pointers to resources and documentation to take in on from here, including extending QML components with C++: http://doc.qt.nokia.com/qtquick.html16:36
oSoMoNIt looks like I went really fast (maybe too fast?), let’s open the floor for questions16:37
oSoMoNany questions? should I go back to one of the steps and explain in more details?16:38
ClassBotabhinav_singh asked: can you please give some links for including QML components with python16:43
ClassBotshadeslayer asked: what is the ideal way of communicating with DBus using QML ?16:44
nerochiaroshadeslayer: normally you create c++ classes that implement the DBUS interface and then you expose them to QML. to expose them you have two possibilities16:44
nerochiaroshadeslayer: one is to use QDeclarativeContext::setContextProperty (assuming you're not using qmlviewer)16:45
nerochiaroshadeslayer: the other is to create a plugin which exposes them, and then use the import directive in QML to import that plugin. after that you can use the classes exported by the plugin in QML. there's some good docs for that, let me find them16:46
nerochiaroshadeslayer: http://doc.qt.nokia.com/4.7-snapshot/qml-extending.html16:47
oSoMoNone could also probably write a generic DBus QML component that allows connecting to whatever object/interface on a given bus, but that may be overkill for most use-cases16:47
nerochiaroshadeslayer: QtCreator has also some templates to create these plugins easil16:48
oSoMoNif we’re done with questions, I’d like to mention two cools projects that use QML16:49
oSoMoNthe first one is unity-2d16:49
oSoMoNthe UI is almost entirely written in QML, and it makes it super easy and fun to prototype new ideas16:50
ClassBotThere are 10 minutes remaining in the current session.16:50
oSoMoNand the second one is an experiment of mine, a limited clone of the Ubuntu Software Center, written in QML and Python16:51
oSoMoNthis one is more like a playground at the moment16:51
oSoMoNbut you can already get the code form S-C’s trunk (lp:software-center) and play with it by running ./software-center-qml16:52
oSoMoNthat’s all I got for you today, we have 10 minutes left, more questions maybe?16:52
ClassBottsimpson asked: have there been any comparisons of the speed of native (C++) apps compared to QML apps?16:54
oSoMoNtsimpson: I recall reading a blog post about it, let me see if I can find the link for you16:55
ClassBotThere are 5 minutes remaining in the current session.16:55
oSoMoNtsimpson: http://labs.qt.nokia.com/2011/05/31/qml-scene-graph-in-master/ has some clues about performance, but apparently not compared with native C++ apps16:56
oSoMoNtsimpson: look at the numbers at the end of the article16:58
oSoMoNlooks like it’s time to wrap up, thanks everyone for following and the interesting questions16:59
=== ChanServ changed the topic of #ubuntu-classroom to: Welcome to the Ubuntu Classroom - https://wiki.ubuntu.com/Classroom || Support in #ubuntu || Upcoming Schedule: http://is.gd/8rtIi || Questions in #ubuntu-classroom-chat || Event: Ubuntu Developer Week - Current Session: Deploy your App to the cloud, Writing Ensemble formulas 101 - Instructors: kim0
ClassBotLogs for this session will be available at http://irclogs.ubuntu.com/2011/07/14/%23ubuntu-classroom.html following the conclusion of the session.17:01
kim0Good morning, good afternoon and good evening everyone17:01
kim0I'm here to introduce you to Ensemble → https://ensemble.ubuntu.com/17:02
kim0Ensemble is a cloud orchestration framework17:02
kim0I am assuming you know what cloud is, and maybe played around a bit with Amazon ec217:02
kim0if you'd like me to provide a quick intro about that as well .. let me know17:03
kim0just ping me in #ubuntu-classroom-chat or leave a question17:03
kim0I will be hosting a demo of Ensemble (yay!)17:03
kim0You can login to this shared screen session → ssh guest@ec2-107-20-18-151.compute-1.amazonaws.com17:04
kim0password: guest17:04
kim0or you may view the web UI → https://ec2-107-20-18-151.compute-1.amazonaws.com/17:04
kim0So .. as a developer, why would Ensemble interest you ?17:05
kim0- Ensemble enables you to quickly deploy your code to the cloud for testing/qa purposes17:05
kim0- You're able to easily test various different versions of operating systems17:05
kim0- And most importantly .. If deployment instructions for your application are not too simple, Ensemble provides an easy and consistent way17:06
kim0for your users to deploy your application17:06
kim0It's like having that big red "easy" button to hit, to deploy your code17:06
kim0As a developer, you're also ensured that users have deployed your application in exactly the way you would recommend17:07
kim0If there is any questions so far .. shoot17:07
kim0Let me jump over a couple of ensemble concepts quickly17:08
kim0then we'll do the demo17:08
kim0this session should be short and sweet17:08
kim0- Ensemble concepts17:08
kim0* The first thing to note, is that since Ensemble was written in the cloud age17:08
kim0it does not really care about "servers" ..17:09
kim0rather it focuses on "services"17:09
kim0services being ..17:09
kim0mysql : a database service17:09
kim0memcached : a high performance caching service17:09
kim0munin : a monitoring service17:09
kim0and so on and so forth17:09
kim0You application, of course interacts with many of those services17:09
kim0* The second important concept is that Ensemble completely "encapsulates" those services17:10
kim0that is, if you have no idea how to get munin running17:10
kim0if you ask ensemble to deploy it, you would have it running within minutes17:10
kim0and you can connect it (read: relate it) to other services17:11
kim0and it would start graphing performance metrics from all around your infrastructure17:11
kim0you do not need to know how to control munin, it is encapsulated17:11
kim0* The third important concept, is that with Ensemble services are "composable"17:12
kim0that is, services have well defined interfaces17:12
kim0such that you can connect/relate many services together .. to form a large infrastructure17:12
kim0you can replace infrastructure components with others .. such as replace mysql with pgsql if you so wish17:12
kim0and if both of them implement the same interface!17:13
kim0In the future, Ensemblse would even handle backing up and migrating your data!17:13
kim0Enough talk .. let's jump to demo land17:13
kim0If there's any questions pre demo .. shoot17:14
* kim0 waits a minute .. and prepares demo land17:14
kim0= demo begin =17:17
kim0Please make sure you're logged into the shared ssh session or web UI17:17
kim0for instructions, scroll up17:17
kim0Alright! let's get started17:17
kim0The very fist step, is as I just did in the shared screen17:18
kim0ensemble bootstrap17:18
kim0What this does, is it starts a "management" node for Ensemble17:18
kim0this is the brains for the deployment17:18
kim0it is a utility node17:18
kim0of course ec2 needs some time to create this node ..17:19
kim0so I need to check it is available and ready before proceeding17:19
kim0I can do this with17:19
kim0ensemble status17:19
kim0The node seems to be bootstrapping17:20
kim0While the node is bootstrapping17:21
kim0I would like to introduce "formulas"17:21
kim0Formulas, are Ensemble's way of codifying the experience of deploying code and orchestrating the full service17:22
kim0So, if you would like to deploy a mysql service17:22
kim0You would need a mysql formula17:22
kim0this is the same for any other service17:22
kim0and if you as a developer, would like your application to be deployable by Ensemble, you would need to write a formula for it17:23
kim0the "very cool" part!17:23
kim0is that formulas are language indepndant17:23
kim0that is, you do not need to learn yet another programming language17:23
kim0to write those formulas, formulas can be written in python, bash, php, c++ or whatever!17:24
kim0Very well .. the bootstrap has of course finish bootstrapping17:24
kim0I will paste ensemble commands and output here for archiving purposes17:24
kim0$ ensemble status17:24
kim02011-07-14 17:24:16,265 INFO Connecting to environment.17:24
kim0  0: {dns-name: ec2-50-17-153-3.compute-1.amazonaws.com, instance-id: i-f3c13e92}17:24
kim0services: {}17:25
kim02011-07-14 17:24:18,137 INFO 'status' command finished successfully17:25
kim0machine number "0" is our bootstrap node17:25
kim0let us now quickly deploy a wordpress service and a drupal application17:25
kim0How hard do you think that is?17:25
kim0Here it is17:26
kim0ensemble deploy --repository=. drupal mycms17:26
kim0This deploys an instance of "drupal" .. calls the instance "mycms"17:26
kim0$ ensemble deploy --repository=. mysql mydb17:27
kim0This also deploys mysql, calling it mydb!17:27
kim0doesn't really get much simpler than that!17:27
kim0let's check out ensemble status now17:27
kim0$ ensemble status17:27
kim02011-07-14 17:27:34,085 INFO Connecting to environment.17:27
kim0  0: {dns-name: ec2-50-17-153-3.compute-1.amazonaws.com, instance-id: i-f3c13e92}17:27
kim0  1: {dns-name: ec2-107-20-30-230.compute-1.amazonaws.com, instance-id: i-0537c864}17:27
kim0  2: {dns-name: ec2-50-19-190-104.compute-1.amazonaws.com, instance-id: i-e537c884}17:27
kim0  mycms:17:28
kim0    formula: local:drupal-917:28
kim0    relations: {}17:28
kim0    units:17:28
kim0      mycms/0:17:28
kim0        machine: 117:28
kim0        relations: {}17:28
kim0        state: null17:28
kim0  mydb:17:28
kim0    formula: local:mysql-9717:28
kim0    relations: {}17:28
kim0    units:17:28
kim0      mydb/0:17:28
kim0        machine: 217:28
kim0        relations: {}17:28
kim0        state: null17:28
kim02011-07-14 17:27:35,995 INFO 'status' command finished successfully17:28
kim0Let us quickly check out the meaning of this status message17:28
kim0In the machines section .. we now have 3 machines .. 0 1 and 217:28
kim0In the services section, we have two services deployed17:28
kim0mycms and mydb17:28
kim0You can see mycms (drupal) is running on machine 1 (from the machines section, it's url is ec2-107-20-30-230.compute-1.amazonaws.com)17:29
kim0and mydb (mysql) is running on machine 217:29
kim0Let me know paste an updated status17:30
kim0$ ensemble status17:30
kim02011-07-14 17:29:44,206 INFO Connecting to environment.17:30
kim0  0: {dns-name: ec2-50-17-153-3.compute-1.amazonaws.com, instance-id: i-f3c13e92}17:30
kim0  1: {dns-name: ec2-107-20-30-230.compute-1.amazonaws.com, instance-id: i-0537c864}17:30
kim0  2: {dns-name: ec2-50-19-190-104.compute-1.amazonaws.com, instance-id: i-e537c884}17:30
kim0  mycms:17:30
kim0    formula: local:drupal-917:30
kim0    relations: {}17:30
kim0    units:17:30
kim0      mycms/0:17:30
kim0        machine: 117:30
kim0        relations: {}17:30
kim0        state: started17:30
kim0  mydb:17:30
kim0    formula: local:mysql-9717:30
kim0    relations: {}17:30
kim0    units:17:30
kim0      mydb/0:17:30
kim0        machine: 217:30
kim0        relations: {}17:30
kim0        state: started17:30
kim02011-07-14 17:29:46,435 INFO 'status' command finished successfully17:30
kim0Now you can the state of both services is "started"17:31
kim0which means they have been successfully installed and started17:31
kim0Note however that till now, the two services are deployed "separately"17:31
kim0that is mysql knows nothing about drupal and vice versa17:31
kim0The big bang (a ha) moment happens when you connect both services together!17:31
kim0let's do just that17:31
kim0Here is how I just did it17:32
kim0$ ensemble add-relation mycms mydb:db17:32
kim02011-07-14 17:32:03,640 INFO Connecting to environment.17:32
kim02011-07-14 17:32:04,759 INFO Added mysql relation to all service units.17:32
kim02011-07-14 17:32:04,760 INFO 'add_relation' command finished successfully17:32
kim0I am using add-relation to connect the two services together17:32
kim0Once the connection happens17:32
kim0mysql recognizes drupal needs a database service17:33
kim0mysql creates a new database for drupal17:33
kim0sends over the connection information (ip, username, password) needed to connect to the newly created database! cool!17:33
kim0drupal receives this information, configures itself to connect to that service17:33
kim0the end result .. with that single command17:34
=== zyga is now known as zyga-afk
kim0and with Ensemble in the background17:34
kim0you have deployed a multi-tier service17:34
kim0As we just mentioned the url for the mycms machine is http://ec2-107-20-30-230.compute-1.amazonaws.com/ensemble/17:35
kim0and you can indeed hit that url with your browser right now17:35
kim0and you should get drupal waiting for you .. hurray17:35
kim0I'd like to quickly show you as well .. the formula for drupal17:36
kim0i.e. how simple it is to write such a formula17:36
kim0I chose to write this formula in bash, however as mentioned, you can use any language you fancy!17:36
kim0The install hook (what runs to install the service) is now shown in the shared screen17:38
kim0I am however .. pasting it as well for archiving purposes17:38
kim0set -eux # -x for verbose logging to ensemble debug-log17:38
kim0ensemble-log "Installing drush,apache2,php via apt-get"17:38
kim0apt-get -y install drush apache2 php5-gd libapache2-mod-php5 php5-cgi mysql-client-core-5.117:38
kim0a2enmod php517:38
kim0/etc/init.d/apache2 restart17:38
kim0ensemble-log "Using drush to download latest Drupal"17:38
kim0cd /var/www && drush dl drupal --drupal-project-rename=ensemble17:38
kim0As you can see, it simply uses apt-get to install some packages, enables php, restarts apache17:39
kim0and then uses "drush" the drupal shell, to download a fresh version of drupal17:39
kim0it's interesting to see that ensemble does NOT force you to only use ubuntu packages17:39
kim0you can mix and match like I just did17:39
kim0as a developer, you can grab any code branch and build it and mix that with package installations, if you so wish17:40
kim0Very well ..17:40
kim0remember the magic that happened when we connected the two services together17:40
kim0the "add-relation" command17:40
kim0let us see the code that runs from drupal's perspective17:40
kim0I have just displayed it on the shared screen17:41
kim0I will paste it in chunks17:41
kim0set -eux # -x for verbose logging to ensemble debug-log17:41
kim0user=`relation-get user`17:41
kim0password=`relation-get password`17:41
kim0host=`relation-get host`17:41
kim0database=`relation-get database`17:41
kim0these last 4 lines, read various settings from Ensemble provided communication channels17:42
kim0they read: user, password, host, database17:42
kim0these settings are provided by the mysql service upon establishing the connection.17:42
kim0drupal reads them, to configure itself to connect to that DB17:42
kim0let us see how the connection happens17:43
kim0    ensemble-log "Setting up Drupal for the first time"17:43
kim0    cd /var/www/ensemble && drush site-install -y standard \17:43
kim0    --db-url=mysql://$user:$password@$host/$database \17:43
kim0    --site-name=Ensemble --clean-url=017:43
kim0easy enough!17:43
kim0we just use drush to install drupal passing the need parameters we just consumed17:43
kim0What is really important to notice here17:43
kim0is that I might have never touched mysql before17:44
kim0I do not have to know how it works or how to configure it17:44
kim0or I cared about, was the Ensemble provided interface .. those 4 parameters in this case17:44
kim0The actual script is slightly longer, since it checks whether or not this is first time drupal is being set up17:45
kim0i.e. are we starting the very first drupal node, or just scaling it up17:45
kim0oh yeah .. because scaling it up is as simple as17:45
kim0ensemble add-unit mycms17:45
kim0yep .. that's it17:45
kim0So I hope this was a useful introduction to Ensemble17:46
kim0I'll provide a couple of pointers and answer question17:46
kim0You can read more about Ensemble at: https://ensemble.ubuntu.com/17:46
kim0Documentation: https://ensemble.ubuntu.com/docs/17:46
kim0Mailing list: https://lists.ubuntu.com/mailman/listinfo/ensemble17:46
kim0IRC Channel: #ubuntu-ensemble @ Freenode17:47
kim0we are a very welcoming community .. it's a party and everyone is invited :)17:47
kim0So start hacking on your own formula today!17:47
kim0You can see a list of existing formulas at: https://code.launchpad.net/principia17:47
kim0Our goal is to cover all of free software!17:48
kim0Alright .. taking questions17:48
ClassBotalexm asked: can emsemble be used to deploy outside the cloud?17:48
kim0alexm: Ensemble uses multiple "providers" to handle what to deploy to17:48
kim0ec2 cloud is currently the one that is ready, a provider for LXC (Linux container) is being worked on heavily17:49
kim0and myunderstanding is that it will be ready during this 11.10 cycle17:49
kim0you can also deploy to private clouds such as openstack or eucalyptus .. not sure how well tested that is, but should mostly work17:49
kim0Also, Ensemble is being currently integrated with Orchestra17:50
kim0the Ubuntu server hardware deployment tool17:50
kim0so you will be able to install to your own hardware farm as well17:50
kim0I hope that answers your question17:50
ClassBotThere are 10 minutes remaining in the current session.17:51
ClassBotchadadavis asked: Does ensemble have upstart's concepts of services vs tasks. Backup seems more like a service, whereas migration more like a task.17:51
kim0Things are a bit too early in Ensemble development right now .. Currently everything is a service17:51
kim0however the dev team recognize the need that some operation have special needs17:52
kim0"machine services" are being debated17:52
kim0various types of services (or whatever they'd be called) can definitely arise17:52
ClassBotahs3 asked: each service seems to be a separate machine; can i have multiple services on the same machine?17:52
kim0ahs3: good question .. With the LXC provider that will become possible17:53
kim0there is also design work currently to colocate chosen services together17:53
kim0interested code hackers are invited to hack on ensemble core to make this happen faster :)17:53
kim0Ensemble itself is written in python using twisted framework afaik17:54
ClassBotahs3 asked: how do i find out what services are available?17:54
kim0ahs3: As mentioned this is the current list17:54
kim0this only started a few weeks back17:54
kim0so it is growing rapidly17:54
=== janimo` is now known as janimo
kim0I am more than ready to help anyone write his own first formula17:55
kim0just grab me (kim0) on #ubuntu-ensemble17:55
kim0and start hacking on your own formula :)17:55
ClassBotalexm asked: how does mycms know that it has to use mydb? i.e. mycms is deployed with another db before connecting to mydb?17:55
kim0alexm: good question17:55
kim0it doesn't17:55
ClassBotThere are 5 minutes remaining in the current session.17:55
kim0I tell it to use mydb17:55
kim0when I issued17:55
kim0add-relation mycms mydb:db17:56
kim0This is exactly what "connects" or "relates" them together17:56
kim0before add-relation they have no idea about each other17:56
kim0and mycms does NOT have another DB .. in fact it has no db at all and is mostly misconfigured17:56
kim0Awesome .. that concludes this session17:57
kim0feel free to ask me any further questions in #ubuntu-ensemble17:57
kim0till next time .. c ya17:57
=== ChanServ changed the topic of #ubuntu-classroom to: Welcome to the Ubuntu Classroom - https://wiki.ubuntu.com/Classroom || Support in #ubuntu || Upcoming Schedule: http://is.gd/8rtIi || Questions in #ubuntu-classroom-chat || Event: Ubuntu Developer Week - Current Session: Fixing common ARM build failures - Instructors: janimo
ClassBotLogs for this session will be available at http://irclogs.ubuntu.com/2011/07/14/%23ubuntu-classroom.html following the conclusion of the session.18:01
janimoHello everybody18:01
janimoI am Jani Monoses, a member of the Canonical ARM team and will speak about ARM related build failures in this session18:01
janimofeel free to ask questions as we go, on the -chat channel18:02
janimoAs a reference and overview of today's discussion check out this wiki page https://wiki.ubuntu.com/ARM/FTBFS18:03
janimoARM only recently got popular enough so that enough developers have them, but still hw is  unavalable to most people18:03
janimothis is the reason why there are more build failures (FTBFS from now on) on ARM than on other architectures in Ubuntu18:04
janimothe situation has improved in the past cycles though, and none of these are very critical or unfixable, given developer attention18:05
janimoThe failures are so common and recurring that there's even a weekly 'portin jam' on #linaro every Wednesday, to deal with failing packages for a few hours18:05
janimoto get an idea of the number of failures, check the ARM column on this page18:06
janimoclick around on some packages which are only red for ARM, and it will take you to the LP build log page18:06
janimothere you'll encounter the reason for the FTBFS and it very likely falls into one of the categories I'll go over now18:07
janimoand which are mentioned on the wiki page18:07
janimoThe most innocent one, is that build server hardware has little RAM (<-=512M) so cannot cope with some packages without entering a swapstorm18:08
janimothese can be ignored as there's nothing we can do about them, short of waiting for the soon to be upgraded ARM build servers18:08
janimoThere are then porting issues, much like there used to be from x86 to big-endian hw, or from 32bit to 64 bit18:09
janimoonly there are different and a bit more varied18:09
janimomost problems and failing packages are C/C++ as that is where platform details are exposed, and are easy to overlook18:10
janimofor intance char on ARM is by default unsigned, whereas on x86 it is signed char, so such an assumption can lead to program failure at runtime18:11
janimowhen warnings are treated as errors during compiling, many such differences are caught by gcc though18:11
janimoeven if a bug would only manifest at runtime, the fact that many packages include a test-suite that is run as part of the build process means the build can fail on FAILed tests18:12
janimosegfaults ro assertions are an indication of such a bug18:12
janimothere are cases also where upstream just did not test on ARM, or made the build system work with x86/amd64 only18:13
janimothese should not be hard to fix either18:13
janimoMany of the current failures are for apps using Qt and OpenGL at the same time18:13
janimoARM platforms do not have hw accelerated OpenGL drivers, only accelerated GLES (which is a subset of modern GL)18:14
janimoso on ARM we make Qt use GLES as its OpenGL rendering backend (Qt does rely on GL for some accelerated rendering, which is transparent to the app developer)18:14
janimobut Qt also lets the developer use GL directly and provides a Qt surface to render onto18:15
janimowhen this is used and the app contains Qt code and explicit GL API calls it will break on ARM because of GLES and GL headers conflict18:15
janimothese are not easy to fix, and usually need upstream to port their code to GLES in addition to desktop GL18:16
janimoAnother Qt gotcha that is not uncommon is the use of the type qreal which is a typedef for a floating point type18:16
janimoon x86 this is a double but on ARM it is floart18:17
janimocode that treats 'qreal' and 'double' interchangeably will likely not build on ARM, so some explicit casts or rethinking of the types used is needed18:17
janimothis is simple for plain C code, but Qt - and especially bindings - use autogenerated code which can also rely on this assumption, so one may need to dig deeper in the Qt tools and bindings to fix a certain app18:18
janimoSometimes to expose different APIs some libs have slightly different symbols exported on ARM. So debian symbol files may need adjustment and customization from time to time, when upstream did not test ARM18:19
janimoA family of failures which are luckily getting fewer are ARM architecture incompatibilities18:20
janimoUbuntu builds for ARMv7 , currently the most modern variant of the ARM architecture18:20
janimoFor a while, since Debian defaulted to ARMv5, an older but still very widespread variant, some issues were apparent only on Ubuntu18:21
janimobut now with most mobile devices using ARMv7, and hw availability in the form of devel boards, upstream updates their build systems, and ifdefs in the code to include ARMv7 too18:21
janimostill if you find a package that FTBFS because it does not check for armv7 (but say only armv5) in it configure scripts, it should be a straightforward fi18:22
janimoMany of the failures, and the hardest to fix - as it requires toolchain expertise - are those caused by gcc/binutils bugs18:23
janimothe tools evolve fast and thus sometimes regressions occur18:23
janimothe package may fail due to a gcc ICE (internal compiler error) or worse have bad code generated and fail in the tests18:24
janimoor even worse successfully build but then cause weird segfaults in other unrelated packages, especially if it is a widely used library18:24
janimowhen you have one of the above scenarios, try rebuilding with a more mature version of gcc (gcc-4.4 or 4.5 currently) or without optimization (-O0) to see if it is indeed a new gcc optimization regression18:26
janimothen if so, pass it on the Linaro toolchain developers :)18:26
janimoI'll take a minute or two to see if there are questions18:26
janimoOr we can look randomly at any of the bugs listed on the failures page and see if it indeed fits the categories above or I lied18:28
janimothank you, what a terrific audience :)18:28
janimoQUESTION: are there good reasons to export different symbols on arm18:29
janimomicahg, good question. I think these are generally consequences of bugs (so accidental) or upstream need to do this because of some other libs being used on ARM18:30
janimoand so it exports a new API to reflect that backend18:30
janimoI did not encounter these often18:30
janimoIIRC clutter had such a case but cannot think of another offhand18:31
janimonow that micahg asked I remember there's another tricky case of failures18:32
janimothat of apps which generate native code or that use extensive asm code18:32
janimothe latter need porting and fixing for the ARM variant we use (removing use of deprecated ARMv5 instructions, constraints on register usage) but should be straightforward18:33
janimothe former though, which have their own JIT (mono, chromium, llvm) can be hard to debug18:33
janimoand are usually upstream work18:33
janimothe interaction and failure between gcc we use (which can have a regression), the one they used, and the generated JIT code needs very good knowledge of said project codebase18:34
janimoand does not fit any of the more generic categories above18:35
janimomicahg, I see in the next channel that you just wanted to ask this, nice :)18:35
janimoand when the situation is so complex, one cannot be sure if it is a toolchain issue, or upstream issue or more likely a combination. The JIT featuring apps, tend to be complex in many other ways too18:36
janimoSo it is not surprising that such bugs are the most long-lived and when they get fixed it is not always clear why they went away18:36
janimoMono used to be very broken till natty, until NCommander and upstream managed to fix it18:37
=== sean is now known as Guest89478
janimochromium keeps failing too18:37
janimoand Java, which is the ultimate JIT-based project is so broken that there is no suitable open source and fast enough JVM18:38
=== Guest89478 is now known as Secris
janimobut the vast majority of build failures are like other bugs, not too exciting and matching some patterns18:39
janimobut they can only be worked on effectively if people have ARM hardware18:39
janimoQUESTION: is there a guide for the register code cleanup?18:39
janimoanother question from micahg . You mean what I mentioned above - register constraints?18:40
janimogcc usually says something like r13 cannot be used here18:40
janimoor r7 or whatever. Which means that for the target ABI you are building that register is used by gcc18:41
janimoso I just fixed the 2 or 3 such cases by replacing with an obviously unused register and testing it work.18:41
janimoI do not have a link, but googling for ARM EABI resered registers or something like that should give the answers18:42
janimoARM, like x86 has reserved names for special purpose registers (stack pointer, program counter, frame pointer), but confusingly those can also be referenced by their generic names like r12, r15, r13 or similar18:43
janimoso the asm code using those may not obviously be using a reserved register for general purpose computation.18:43
janimogladk> QUESTION: What ARM-hardware do you usually use and can recommend?18:45
janimoI and most of the ARM team use TI pandaboards for development18:45
janimoas they are fast enough. But any ARMv7 that you can afford should be good. Other vendors are starting to offer <200$ devel boards18:46
janimoI am happy with the panda, but did not use something else extensively to recommend. There are also toshiba ac100 netbooks which have some ubuntu images for SD floating around, those to are ok for building18:47
janimoalthough they only have 512M of RAM compared to the panda's 1G18:47
janimo micahg has https://www.genesi-usa.com/store/details/12 which seems to do a decent job18:48
janimofor hw related question feel free to pop in #ubuntu-arm, there are many people with a variety of hw there, and you may get better answers18:48
janimoWith many ARM tablets and netbook appearing and being rooted, chances are that Ubuntu is going to find its way on many of them18:49
ClassBotThere are 10 minutes remaining in the current session.18:51
janimoWhile certainly not falling under the scratching their own itch category, devs can help with ARM FTBFS without actually fixing or owning hw but by bug triaging18:51
janimowe have over 100 failures and the wiki page describes how those can be easier to manage and keep at bay18:52
janimoClose invalid bugs: Some bugs may get out of date if they are filed automatically on FTBFS but then are forgotten and not closed when a new build succeeds.18:52
janimoCheck the issue with Debian/upstreams and forward upstream or link to upstream bugtracker patches18:52
janimoTag them for easier retrieval: they all have the ftbfs and arm-porting-queue tags, but there can be other good ways to tag (arm-build-timeout , qt-opengl-arm, etc)18:52
janimoalthough I honestly don't see why one would do such things enthusiastically if not owning ARM hw :)18:53
janimoThanks for the questions so far, any others?18:54
ClassBotThere are 5 minutes remaining in the current session.18:55
janimocheers, and thanks for reading.18:59
janimoThat includes those reading the irclogs later :)19:00
=== ChanServ changed the topic of #ubuntu-classroom to: Welcome to the Ubuntu Classroom - https://wiki.ubuntu.com/Classroom || Support in #ubuntu || Upcoming Schedule: http://is.gd/8rtIi || Questions in #ubuntu-classroom-chat || Event: Ubuntu Developer Week - Current Session: nux - visual rendering in UIs made easy - Instructors: jaytaoko
ClassBotLogs for this session will be available at http://irclogs.ubuntu.com/2011/07/14/%23ubuntu-classroom.html following the conclusion of the session.19:01
jcastrojaytaoko: go ahead and begin!19:04
jaytaokoMy name is Jay Taoko and I am a software developer at Canonical, in the Desktop Experience Team.19:05
jaytaokoI am the creator of Nux, the toolkit we use for unity's rendering!19:05
jaytaokoA bit about myself and how I ended at Canonical working on Unity:19:06
jaytaokoAt started working at Matrox, in Montreal, Canada, where I learned a great deal about GPUs and computer graphics.19:06
jaytaokoAfter that, I worked at other companies doing graphics, including EA and Ubisoft.19:07
jaytaokoAfter leaving Ubisoft, I started my own gig.19:07
jaytaokoAfter a few years, out of the blue, someone mentioned that Canonical is looking for an OpenGL developer.19:07
jaytaokoHaving used Linux in the past, I knew about Canonical, but it had been a while since I installed Linux on any of my machines.19:08
jaytaokoI was skeptic at first. Until I understood that Canonical was very serious about graphics.19:09
jaytaokoThat is when I decided to sign in!19:09
jaytaokoComing from the Windows operating system, I had to learn things on Ubuntu.19:09
jaytaokoI have to say that this hasn't been a big problem.19:10
jaytaokoI have been very welcomed at Canonical.19:10
jaytaokoI have annoyed my colleagues with end-of-lines issues in the code, but I  have found ways to fix this and now it has become a practical joke...19:10
jaytaokoNow, onto Unity and Nux!19:11
jaytaokoNux is the toolkit we for Unity's rendering.19:11
jaytaokowe use*19:11
jaytaokoI started Nux many years ago and I am very happy to see it used for such a great project.19:12
jaytaokoNux is written in C++ and it uses OpenGL for its rendering19:12
jaytaokoIt has a good widget set for writing graphics applications: http://i.imgur.com/ax1Q5.png19:13
jaytaokoAlthough Nux has been adapted to support Unity, its original intent (writing real-time graphics application user interface) will remain.19:14
jaytaokoThere are very talented people working on it. They are adding  support for C++0x and other features to it. This is really great!19:15
jaytaokoNux provides the rendering of Unity. To that end, Nux has to be facilitate direct access to OpenGL.19:15
ClassBotkamil_p asked: Which projects besides Unity uses Nux?19:16
jaytaokoOnly Unity uses it at the moment19:16
jaytaokoNux has a rendering API that is used for common rendering operation (rendering of widgets).19:16
jaytaokoIt also tries to hide the OpenGL API by providing convenience functions and objects.19:17
jaytaokoHowever, we are free to use raw OpenGL is we need to.19:18
jaytaokohowever, one has to know how cooperation between nux and raw opengl works19:18
jaytaokoBut I think that encapsulating OpenGL into a wrapper is the right thing to do for most cases.19:19
jaytaokoUnity is our flagship product. We want it to be great! We know what we want  Unity to be for this cycle. But we don't know yet what it will be in 2  years.19:20
jaytaokoWe have a design team working on new ideas all the time.19:20
jaytaokothe deal between Unity and Nux is like this:19:20
jaytaokoWherever we take Unity, the Nux has to offer flexibility and convenience to achieve Unity's goal.19:21
jaytaokoWith the DX team working on both Unity and Nux, we have more  opportunities to improve, optimize and react to any changes required.19:21
jaytaokoIt hasn't been easy though. They was some rough edges at first. We had  to modify Nux so that it can be embedded inside a Compiz plugin.19:22
jaytaokoAlso, we have had issues with graphics drivers.19:22
jaytaokoThis is a burning issue.19:23
jaytaokoWe try to get Unity working on as many systems as possible. We have  Unity running well on  Atom N270, or systems with older GPUs: ATI  X1950, NVidia 6600...19:24
jaytaokoAnd in Natty, we required less OpenGL features and GPU horse power than people think.19:24
jaytaokoOnly graphics features that have been around for at least 5 years were required.19:24
jaytaokoUnity is in this unique position that it is advancing desktop rendering on all systems that support it.19:25
jaytaokoIt is bound to reveal more issues with graphics than any other application on the desktop before.19:26
jaytaokoI have had some question regarding Unity support on geforce 2 cards!19:27
jaytaokoyes, that is old!19:27
jaytaokobut this is the challenge of Unity!19:27
jaytaokowe can't get it to run on old GPU and I hope people understand. But we try as much as possible.19:28
jaytaokoAnd there is Unity2D that Canonical is investing in!19:29
jaytaokoIf a system cannot run Unity with full opengl, there is always Unity2D.19:29
jaytaokoThe thing about the graphics issues is like this:19:30
jaytaokoThe more issues we find, the closer we get to  solutions and the better graphics rendering improves for everybody on  Ubuntu and across all Linux systems.19:31
jaytaokoWe are starting something new, but we are going to make things better.19:31
jaytaokoThis is what we started with almost a year ago:19:32
jaytaokoyes, that is Unity + Compiz + Nux!19:33
jaytaokoOur Alpha 0 prototype!19:33
jaytaokoJason Smith and Neil Patel and I got locked in a room for a week an prototyped the next iteration of Unity with Compiz and Nux...19:34
ClassBotjsjgruber asked: Unity's indicators disappeared for me under Oneiric sometime in June. Known problem or should I file a bug against nux or some other project?19:34
jaytaokoAs you can see, we have come a long way...19:34
=== yofel_ is now known as yofel
jaytaoko jsjgruber: probably a known issue19:36
=== sirmacik is now known as kichawa1
jaytaokoThe control we have over Nux has allowed us to add the necessary fixes to get Unity working on as many system as possible.19:36
jcastroGot a question: does nux only work with linux? ()19:36
jcastro(from the channel, the bot is busted or something)19:36
jaytaokoSometimes even at the last minutes before Ubuntu's release (thanks to our  superb Desktop team of packagers: seb128, didrocks and all).19:36
=== kichawa1 is now known as sirmacik
jaytaokonux also works on Windows. I am constantly keeping the windows and Linux version in sync. However, I haven't released the windows project files.19:38
jaytaokoit is quite easy to maintain both version. 95% of the code is the same.19:38
jaytaokoWe have had great support from GPU vendors to help us fix issues with Unity on some systems!19:39
jaytaokoWe also report bugs to open source drivers and our hope is that this will benefit everyone.19:39
jaytaokoNow, what is coming next in Nux?19:40
jaytaokoWe are improving Nux for unity.19:40
jaytaokoIn Natty, we were using mostly ARB shader programs on all systems except NVidia GPUs.19:41
jaytaokoWe couldn't do it for AMD GPUs in time with the fglrx driver.19:42
jaytaokoHowever we worked a great deal with AMD to resolve another issue and that is why we didn't have enough time in the end to test the GLSL shader code path19:43
jaytaokoFor Oneiric, we will enable the GLSL shader code path on a much system as possible.19:44
jaytaokoWhat we are going to get from it is the ability to do more in terms of visual quality19:45
jcastroQUESTION:What is the recommended way to start the project?19:45
jaytaokoThe best way is to approach Nux from Unity's side19:46
jaytaokoThe launcher, the Dash are all rendered with Nux19:46
jaytaokoDownload Unity's source code and take a look at the Launcher code. There you will see some shaders, rendering code...19:47
jaytaokoThat will show you how we use Nux in Unity.19:47
jaytaokoThe tests in Unity are a good sample of Nux programs...19:48
jaytaokoGive them a try.19:49
jaytaokoThen, there is Nux itself. It as a few test program of its own.19:49
jcastroQUESTION: Can I embed GTK+/Qt widgets?19:49
jaytaokoMaybe one way to start is to try and write a small Nux program. Nothing fancy, just get started.19:50
ClassBotThere are 10 minutes remaining in the current session.19:50
jaytaokoThat will also make you better at debugging in Unity if you choose to.19:51
jcastroQUESTION: Can I embed GTK+/Qt widgets?19:52
jaytaokoI think so, but I am not sure.19:53
jaytaokoNux uses the glib main loop.19:53
jaytaokoSo it should be compatible with Gtk+/Qt somehow, but I have never tried it19:53
jaytaokoHowever, some of us have been thinking about embedding Nux into Gtk+19:54
jaytaokoSomething that Nux is missing right now is documentation.19:54
ClassBotThere are 5 minutes remaining in the current session.19:55
jaytaokoWe are busy working on Unity but it would help people who want to learn if we have better documentation and tutorial on how to program in Nux.19:56
=== ChanServ changed the topic of #ubuntu-classroom to: Welcome to the Ubuntu Classroom - https://wiki.ubuntu.com/Classroom || Support in #ubuntu || Upcoming Schedule: http://is.gd/8rtIi || Questions in #ubuntu-classroom-chat || Event: Ubuntu Developer Week - Current Session: Java library packaging with maven-debian-helper - Instructors: jamespage
ClassBotLogs for this session will be available at http://irclogs.ubuntu.com/2011/07/14/%23ubuntu-classroom.html following the conclusion of the session.20:01
jamespageHi Everyone o/20:01
jamespageWelcome to the Java library packaging with maven-debian-helper Ubuntu Developer Week session20:02
jamespageSo - organisational bits first:20:02
jamespagePlease ask questions whenever you like on #ubuntu-classroom-chat and please prefix your question with 'QUESTION:'  I'll try to keep and eye out20:02
jamespageAll session logs will be uploaded and accessible from https://wiki.ubuntu.com/UbuntuDeveloperWeek - so if you need a reminder of something covered in the session then please look there.20:02
jamespageMy name is James Page and I've been contributing to Ubuntu since September last year20:03
jamespageI work for Canonical and I'm a member of the Ubuntu Server team so apologies if some of this session is a little server centric :-)20:03
jamespageThis session is intended to give you an overview of packaging Java libraries for Ubuntu - specifically Java projects that use the Maven build system.20:04
jamespageSo first things first - why package Java libraries for Ubuntu?20:04
ClassBotDaviey asked: Java tradionally has a bad reputation on Linux, why is this?20:05
jamespageTimely question - lets cover that one first20:05
jamespageI think it due to the way the Java projects are typically developed20:05
jamespageBecause the Java Virtual Machine abstracts the developer away from the underlying operating system20:06
jamespagethey are free to load that virtual machine with exactly the code they want20:06
jamespagedependent libraries are often bundled in a variety of nasty ways20:07
jamespagewhich means that its hard to pull out common libraries and base line in the way a Linux distro likes todo.20:07
jamespagenot impossible - just hard20:08
jamespageto a certain extent the toolsets exacerbate this behaviour20:08
jamespageso back to my original question - why package Java libraries for Ubuntu?20:09
jamespageWell from my perspective its about delivering Java applications onto the Ubuntu platform;20:09
jamespagethis would include things like Tomcat, Jenkins, Hadoop, Eclipse etc...20:09
jamespage(some of which we have in Ubuntu, some of which we don't - yet)20:09
jamespageHowever these applications need to rely on the Java libraries that are packaged for Ubuntu20:10
jamespagein the same way that other libraries are packaged once and then used by all applications that need them we aim todo the same with Java libraries.20:10
jamespageSo having a broad, well maintained set of libraries is key to both maintaining the existing Java applications and delivering new applications into Ubuntu.20:11
jamespageThis does not always align well with the way that most Java project work;20:11
jamespageas I just discussed each project can pretty much load the Java Virtual Machine with the code then want20:12
jamespagewhich means they don't have to give consideration to other Java projects - because they will be isolated in the same way20:12
jamespagehowever by maintaining a single set of libraries we try to bring some of the Linux distro goodness to the Java world20:13
jamespageSo - next bit is a little dull but important20:13
jamespageJava libraries should follow the Debian Java Policy - see http://www.debian.org/doc/packaging-manuals/java-policy/ for the full details.20:13
jamespageIn fact its probably worth pointing out now that 90%+ of the Java libraries come unchanged for Debian20:14
jamespageAs a quick 101:20:14
jamespageLibrary packages should be named libXXX-java - for example libcommons-io-java20:14
jamespageDocumentation should be in a separate package libXXX-java-doc20:14
jamespageLibraries (jars in the case of Java) should be installed into /usr/share/java - publishing Jar's into a single location aids with discover-ability etc...20:14
jamespageand where possible into /usr/share/maven-repo - more on this in a bit.20:14
jamespageFortunately the toolset around generating Java library packaging for Maven projects helps out quite alot with this so you should find it fairly easy to generate a policy compliant library.20:15
jamespageJust in case you are not familiar with Maven its probably the most popular software project management tool used by Java projects20:16
jamespageIts much more than just a build tool - hence 'Software Project Management'20:16
jamespagethrough a pretty extensive range of plugins it integrates with most SCM's and issue trackers allowing easy automation of defect tracking, release processes, publishing of project artefacts etc...20:17
jamespagehowever in Ubuntu it does get pretty much relegated to being a build tool - most of value add is not applicable and is mainly used by the upstream projects20:18
jamespageIt operates by convention; if you stick your code in the right place Maven will find it and build it; it will also have a look for test code and compile and run that as well.20:18
jamespageIts uses project object model files - POM's20:19
jamespageto define various metadata about the software project including its namespave, name, dependencies, build process, author, licensing ....20:19
jamespagethe list goes on and is incredibly rich - this information is really useful when packaging20:20
jamespagebut depth is not always great :-(20:20
jamespageSo I'm now going to give a quick demo of packaging a basic Java library using maven-debian-helper20:20
jamespageTo follow the demo you will need to log into the following server20:20
jamespagessh guest@ec2-46-137-134-25.eu-west-1.compute.amazonaws.com20:20
jamespagepassword should be guest20:20
jamespageI'm going to be using a tool called byobu so that we can all see the same session.20:21
jamespageSo as it takes a bit of time I've already setup the packaging environment on this Ubuntu server;20:21
jamespageIf you needed to do it20:22
jamespagesudo apt-get install packaging-dev default-jdk maven-debian-helper javahelper apt-file aptitude20:22
jamespagepackaging-dev (thanks bdrung) is a new package which is intended to setup all the basics for package development;20:22
jamespagewe also need the Java Dev Kit and the java specific helpers (plus some other tools)20:22
jamespageSo next step - generate some basic packaging using mh_make;20:22
jamespagewe are going to pull a upstream tarball from github and then do some basic packaging20:23
jamespagemetainf-services is a very simple library that helps generated metadata for jar files during packaging20:24
jamespageso as you can see we just have a pom.xml file and a src dir20:24
jamespagenext we use mh_make20:25
jamespagemh_make tries to guess most things but it does give you the option to change stuff20:25
jamespageso we are going to run tests and generate API docs20:26
jamespagemh_make uses apt-file to search for any missing dependencies20:26
jamespageif it can't find something it needs in /usr/share/maven-repo it will search using apt-file and try to make a recommendation20:26
jamespageSo this bit is quite important20:27
jamespagewhen the package is built it gets deployed into /usr/share/maven-repo twice20:27
jamespageonce under the original version - 1.2 in this case20:27
jamespageand once under a fixed label - this is normally debian or 1.x/2.x if multiple versions of a library are packaged20:28
jamespagethis means that other libraries can 'fix' on a version which can then be changed under the hood if a new version of the library is released20:28
jamespagewithout having to update all pom files20:28
jamespagemore on this in a bit20:28
jamespagemh_make also makes a guess as to with plugins are not useful for packaging20:29
jamespagethis last one is unknow - infact its used for publishing a micro-site to github - which we don't need either20:29
jamespagemh_make then generates the base packaging20:30
jamespageyou will notice that it used licensecheck to search for useful information on copyright and licensing - we'll see the results of that in a mo20:30
jamespageSo I'm going to make this into a bazaar branch to help out a bit20:31
jamespageSo lets take a look around:20:31
jamespageSo using the information that licensecheck found in the headers mh_make has had a stab at generating a copyright file20:32
jamespageits not bad - normally this needs a few tweaks to get it exactly right but it does most of the hard work20:32
jamespageThe maven.*rules files are used by maven-debian-helper to transform the Maven pom.xml files during the build of the project;20:32
jamespageso in maven.ignoreRules you can see the two plugins that we told mh_make to ignore - these get transformed out of the pom.xml during the build20:33
jamespagemaven.rules is pretty simple in this case - this will create a 1.x version alongside the 1.2 version in /usr/share/maven-repo20:34
jamespageso we also get a maven.cleanIgnoreRules20:34
jamespagethis is used when the clean target is called for the project20:34
jamespagetypically this requires alot less dependencies so it may be a longer list of exclusions20:35
jamespagefor this package its OK for it to be the same as maven.ignoreRules20:35
jamespageso I'll just do a quick change to the changelog and we are good to go20:35
jamespageYou will notice that mh_make has used  Java Demo <java.demo@ubuntu.com>20:36
jamespagethis gets picked up from DEBEMAIL and DEBFULLNAME environment variabled - I set these up earlier20:36
jamespageso source package build first20:37
jamespagemaven-debian-helper patches/unpatches the pom.xml file during the process20:38
jamespagethe default target for building the package is 'package' - however for more complex packages 'install' may be more appropriate.20:38
jamespagegenerating javadoc20:38
jamespage(twice - this is a bug!)20:38
jamespageautomatically determining dependencies for the binary packages20:39
jamespageand done - a few lintian warnings but nothing unsolvable20:40
jamespageso we now have a built package \o/20:40
jamespageas we discussed earlier the package deploys 1.2 and 1.x artefacts to /usr/share/maven-repo20:41
jamespageit also deploys to /usr/share/java - this is to support ant/javahelper based build and applications that require this library20:42
jamespageand also a -doc package containing the generated API20:42
jamespage just to prove that we have created something that at least installs20:42
jamespageObviously this is a relatively simple example;20:43
jamespagehowever the concepts covered in this session can be used to build up complex dependency chains of packages to support large Java applications like Jenkins.20:43
jamespageMaven actually makes packaging for Ubuntu easier;20:43
jamespagebecause it has a standard way of expressing dependencies and a rich metadata model it is easier to automate the production of packaging20:44
jamespagepackages that use ant are more challenging as they express dependencies in a million bespoke ways20:44
jamespage(unless they are using a dependency management system like ivy which can make things a little easier).20:44
ClassBotcoalitians asked: so mavens central repository is never used ?20:46
jamespagegood question - the local Debian repo in /usr/share/maven-repo is used and Maven is executed fully offline20:46
jamespagemaven-debian-helper handles this as part of the packaging build rules20:47
jamespageso if you switch back to the demo you can see that the debian/rules file is very simple - all of the logic in encapsulated in cdbs classes20:47
jamespageAny more for any more?20:48
jamespageI hope that you have found this session useful;20:48
jamespageI normally hang out on #ubuntu-server and #ubuntu-java so if you have any more questions please feel free to ping me.20:49
jamespageThankyou and goodnight!20:49
ClassBotThere are 10 minutes remaining in the current session.20:50
ClassBotThere are 5 minutes remaining in the current session.20:55
ClassBotLogs for this session will be available at http://irclogs.ubuntu.com/2011/07/14/%23ubuntu-classroom.html21:00
=== ChanServ changed the topic of #ubuntu-classroom to: Welcome to the Ubuntu Classroom - https://wiki.ubuntu.com/Classroom || Support in #ubuntu || Upcoming Schedule: http://is.gd/8rtIi || Questions in #ubuntu-classroom-chat ||
=== zyga-afk is now known as zyga
Nabeelhello guys23:03
NabeelNeed some help23:03
Nabeelhello !!!!23:04
pleia2the next class doesn't start until 16:00 UTC tomorrow23:04

Generated by irclog2html.py 2.7 by Marius Gedminas - find it at mg.pov.lt!