Pages

Sunday, 20 November 2011

Easy one-time git subtree merge

The situation:

  • Have a git project (A)

  • Have a second git project (B) that I want to merge to A under a directory

  • This needs to be done once. After that, project B will not be re-sync to A's subdirectory

  • Need to preserve history


The actual situation: I have a git project that is named "drlaunch" and another git project that is named "debian". "debian" is the packaging directory for drlaunch. The problem occurred because I used to have two svn trees, one for the project and one for the debian/ directory for making this a package for maemo.

I found a number of related things but all of them were complicated because they were doing more than I wanted. Finally, I came to this simple solution:

Under project drlaunch, there is a subdir drlaunch. I want to include the project debian under a directory named debian in the drlaunch project. The tree looks like this:
drlaunch (project)
\-- drlaunch (dir)

debian (project)

And at the end I want it to look like this:
drlaunch (project)
|-- drlaunch (dir)
\-- debian (dir)

The solution is as simple as this:

  1. Go to the debian's project dir and export all changes with format-patch:[shell]
    cd debian/
    mkdir ../1
    git format-patch --root -o ../1/
    rm ../1/0000-*
    [/shell]

    (Note: The removal of the first file is required. The file should be empty and for me it triggers a git bug causing it to use 100% cpu indefinitely. Feel free to check it yourself)

  2. Go to the drlaunch's project dir and import all changes to a directory:
    [shell]
    cd drlaunch/
    git am --directory=debian/ ../1/*
    [/shell]

  3. Ta-da! Ready! Now compare the tree to be sure that nothing bad happend:
    [shell]
    diff -uR debian ../debian/
    [/shell]


Don't forget to commit your changes.

$

Friday, 6 May 2011

Multiple Monitors with Opensource Radeon Driver and Xorg

Setting up multiple monitors is currently a nice experience. Doing this from krandrtray, which is a very very nice front-end, is easy. But doing it via xorg.conf can be ... well ... interesting. That's mostly because each driver has its own method of properly setting up multiple monitors.

Here's how to setup multiple monitors with xorg.conf when using the opensource radeon driver (tested with 6.14.1). The tricky part (and the one that took me aprox. 1 hour to figure) is to name the Monitors with the exact same name as the card's outputs.

First, you need to launch X at least once with both monitors connected just to find out the output names. Look at /var/log/Xorg.0.log:
[code language="bash"]
$ grep 'Output.*connected' /var/log/Xorg.0.log
(II) RADEON(0): Output HDMI-0 connected
(II) RADEON(0): Output DIN disconnected
(II) RADEON(0): Output VGA-0 disconnected
(II) RADEON(0): Output DVI-0 connected
[/code]
From the above search you can see that the connected outputs are named HDMI-0 and DVI-0. You may be able to determine which monitor is connected to which output either by looking up its resolution:
[code]
(II) RADEON(0): Output HDMI-0 using initial mode 1920x1200
[/code]
or other information in Xorg.0.log

Next you need to create or update /etc/X11/xorg.conf. The required relevant sections are as follows:
[code]
Section "Monitor"
Identifier "HDMI-0"
Option "Primary" "On"
EndSection

Section "Monitor"
Identifier "DVI-0"
Option "LeftOf" "HDMI-0"
EndSection

Section "Device"
Identifier "Card0"
Driver "radeon"
BusID "PCI:1:0:0"
Screen 1
EndSection

Section "Device"
Identifier "Card1"
Driver "radeon"
BusID "PCI:1:0:1"
Screen 1
EndSection

Section "Screen"
Identifier "Screen0"
Device "Card0"
Monitor "HDMI-0"
DefaultDepth 24
SubSection "Display"
Depth 24
Modes "1920x1200"
EndSubSection
EndSection

Section "Screen"
Identifier "Screen1"
Device "Card1"
Monitor "DVI-0"
DefaultDepth 24
SubSection "Display"
Depth 24
Modes "1440x900"
EndSubSection
EndSection

Section "ServerLayout"
Identifier "Layout0"
Screen "Screen0" 1440 0
Screen "Screen1" LeftOf "Screen0"
EndSection
[/code]

Now I'm not sure about the second "LeftOf" because I stopped restarting X and KDM after it worked, but IIRC, it is not required.
As it was mentioned earlier, the tricky part is to named the Monitors as the outputs of the card (HDMI-0 and DVI-0 in my case).
Also, I remember that using the above naming for PciIDs is also required (observer that they are different) and I believe tht the "Monitor" statement inside the "Screen" section doesn't affect anything.

If everything is setup correctly you should see this in Xorg.0.log:
[code]
(II) RADEON(0): Output HDMI-0 using monitor section HDMI-0
(II) RADEON(0): Output DVI-0 using monitor section DVI-0
[/code]
which indicates that monitor sections where properly matched with outputs.

Friday, 18 February 2011

pyzor problem after debian squeeze upgrade

After upgrading some servers to Debian squeeze, the following log was filling the logs:
[code]
Feb 18 12:49:38 aetos check[982]: pyzor: [19952] error: TERMINATED, signal 15 (000f)
[/code]

The problem was caused by wrong pyzor servers. Unfortunately, pyzor keeps a servers list in each home directory in file ~/.pyzor/servers. This is what this file used to have:
[code]
82.94.255.100:24441
[/code]

This file is created automatically (with a proper value) so it is safe to remove it. That's what it should have (for now):
[code]
public.pyzor.org:24441
[/code]

In order to get rid of the error message all users' files should be deleted:
[code]
find /home -name servers | grep pyzor/servers > /tmp/lst
# examine /tmp/lst by hand to verify that nothing bad is there
cd /home
cat /tmp/lst | xargs rm
[/code]

That's it. There should be no more "TERMINATED" messages.