Difference between revisions of "Newbie Guide for Windows People Working on Minor Bugs"
m |
|||
Line 15: | Line 15: | ||
* Get [http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html PuTTY] - choose the 'Windows installer for everything except PuTTYtel' .exe file - and install it. | * Get [http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html PuTTY] - choose the 'Windows installer for everything except PuTTYtel' .exe file - and install it. | ||
− | * Run PuTTY. In the configuration window, enter "hack.dreamwidth.net" for the host name. Go to Connection/Data and enter the username/login given to you in the welcome e-mail. It should be something like dh- | + | * Run PuTTY. In the configuration window, enter "hack.dreamwidth.net" for the host name. Go to Connection/Data and enter the username/login given to you in the welcome e-mail. It should be something like dh-username. |
: You may also want to change the Window/Appearance, Window/Colours and Window/Selection settings. | : You may also want to change the Window/Appearance, Window/Colours and Window/Selection settings. |
Revision as of 22:50, 31 October 2009
Contents
- 1 Install and Set Things Up
- 2 How All of This Works
- 3 Before You Fix Anything
- 4 Edit Files
- 5 Test Your Changes on Your Dreamhack
- 6 Upload Your Patch
- 7 Specific Topics for People Working on Styles Bugs
- 8 Tips and Tricks
Install and Set Things Up
You'll only have to do this once.
Get a Dreamhack and PuTTY
What's a Dreamhack? To put it simply, it's a mirror of the Dreamwidth site where you can test your changes.
- Apply for a Dreamhack by filling this form.
- Get PuTTY - choose the 'Windows installer for everything except PuTTYtel' .exe file - and install it.
- Run PuTTY. In the configuration window, enter "hack.dreamwidth.net" for the host name. Go to Connection/Data and enter the username/login given to you in the welcome e-mail. It should be something like dh-username.
- You may also want to change the Window/Appearance, Window/Colours and Window/Selection settings.
- Once you're done, go back to Session. Select Default Settings and click on Save.
- Click on Open. Click Yes on the pop-up message box.
- Enter the password given to you in the welcome e-mail when asked. Note that no characters are displayed and the cursor won't move. It's normal.
- Change your password by typing:
passwd
- On your Dreamhack, the default user is called 'system'. You need to set its password so you can access this account. Type:
$LJHOME/bin/upgrading/make_system.pl
- Once you're done type:
start-apache
- You can access your Dreamhack at http://yourusername.hack.dreamwidth.net/ and log in as 'system'.
Install WinSCP
What for? WinSCP will allow you to see and manage the files of your Dreamhack. You'll use it to edit the theme/layout files.
- Install WinSCP. I chose the Explorer mode because I don't need to access any files on my computer but choose what's best for you.
- Use "hack.dreamwidth.net" for the host name. Enter your username and password. Click on Save then on Login.
Set Up Your Dreamhack
Again?! Yes. This part is long and tedious but you need to do it. It will make everything easier afterwards.
- Follow the steps outlined at Back Up Your Configs.
- N.B. To create files, go to WinSCP, go to the right directory, right-click on New/File and edit.
- Create the dwu, dws and dwdb scripts as explained in Scripting.
- Now you can easily create other accounts with different levels to make testing easier on your Dreamhack:
- Go to
cvs/local/etc/
and openconfig.pl
. Find$USE_ACCT_CODES = 1;
and change 1 to0
. Save your file. This will get rid of invite codes.
- In PuTTY, type this to make the changes go live on your Dreamhack:
cd $LJHOME stop-apache dws dwdb start-apache
- Log in onto your Dreamhack and go to http://yourusername.hack.dreamwidth.net/create to create more accounts.
- Go to http://yourusername.hack.dreamwidth.net/admin/pay to give paid time to an account or make it a seed one.
- The last step is to create a directory where your patches will be put into:
- In PuTTY, type this then Enter:
cd $LJHOME/cvs/dw-free hg qinit -c
The newly created directory is: ~/dw/csv/dw-free/.hg/patches/
- Do the same thing with dw-nonfree if you're working with non-free styles:
cd $LJHOME/cvs/dw-nonfree hg qinit -c
The directory is: ~/dw/csv/dw-nonfree/.hg/patches/
Create a Bugzilla account
Simply click here.
How All of This Works
- Your Dreamhack has two parts:
- the live part (
~/dw/*
) - two main repository parts (
~/dw/cvs/dw-free/*
and~/dw/cvs/dw-nonfree/*
).
- the live part (
- What you see on http://yourusername.hack.dreamwidth.net/ is the live part.
- But you edit files in the repository parts and you create patches in the repository parts.
- To make the live part match the repository parts, you use 'synchronize' and 'update database':
cd $LJHOME stop-apache dws dwdb start-apache
- You mustn't forget to regularly update the repository parts by running 'update':
cd $LJHOME stop-apache dwu start-apache
Of course, you'll have to run dws
and dwdb
again after that. You'll do this often. :)
- To edit files, you use WinSCP.
- To create patches and update code, you use PuTTY.
- To find bugs, file bugs, upload patches, you use Bugzilla.
Before You Fix Anything
Find or File a Bug
- To find: use simple search, advanced search or predefined searches such as unassigned effort-minor.
- To file: use this form. Fill and edit the fields as needed and don't forget to change the e-mail address in Assign To.
Create a Patch
- First make sure nobody's working on the files you want to edit. If there are already patches up for review/commit, you may need to first import and apply these patches to your Dreamhack to avoid conflicts. You can see patches up for commit by clicking here.
- Open PuTTY and update everything. You need to work with the latest code.
- Go to dw-free by typing this then Enter:
cd $LJHOME tocvs
- To go to dw-nonfree, type this then Enter:
cd $LJHOME tocvs n
- Create a new patch by typing this then Enter (change NUMBER and PATCHNAME of course):
hg qnew -g bugNUMBER_PATCHNAME.diff
Import a Patch
- Go to Bugzilla, open the bug, click on the patch. Copy its URL.
- In PuTTY, go to dw-free:
cd $LJHOME tocvs
- Then type this to import the patch and name it patch:
wget -O patch URL
- Type this to apply the patch:
patch -p1 < patch
- Synchronize your live code (as explained above).
- To unapply the patch, type:
patch -R -p1 < patch
- Synchronize your live code again.
Edit Files
Use WinSCP to open the file(s) you need to edit. Chances are your file is in ~dw/cvs/dw-free/htdocs/
, ~dw/cvs/dw-free/cgi-bin/DW/
, ~dw/cvs/dw-free/cgi-bin/LJ/
or, if you're working on styles, in one of these folders. For text strings, also see ~dw/cvs/dw-free/bin/upgrading/en.dat
. For more specific search, see Dev_Finding_Things.
N.B. If WinSCP is not using your favorite editor, go to View/Preferences/Editor. Click on Add/External Editor and Browse. At the end don't forget to click on Up to make it the default editor.
Test Your Changes on Your Dreamhack
- In PuTTY, stop your Dreamhack:
cd $LJHOME stop-apache
- Synchronize your live code and update your database:
dws dwdb
- Start your Dreamhack again:
start-apache
- Go to your Dreamhack and test. Edit the files again in WinSCP if more changes are needed. Go through these steps again to resynchronize your live code and test your new changes.
Upload Your Patch
Update & Save Your Patch
- In PuTTY, go to your patch directory (see this section if you've forgotten how to)
- Type this to update your patch file:
hg qrefresh
- Go to your patch directory in WinSCP and save a copy of your patch on your computer (see this section if you've forgotten where the patch folder is).
- Go back to the default code by typing (PATCHNAME is full name with extension too):
hg qpop -a
hg qdelete PATCHNAME
For more commands, see https://developer.mozilla.org/en/Mercurial_Queues
Put Your Patch On Bugzilla
- Log in onto Bugzilla and open your bug.
- Click on 'Add an Attachment' to attach your patch. Add a description and check 'patch'. Set Flags/Commit and Flags/Review to ? then click on Commit.
- Wait for someone to review and commit your patch. :) You're done. Congrats!
Specific Topics for People Working on Styles Bugs
Where Are Styles Bugs?
How do I File a New Style Bug?
Use this template. Fill and edit the fields as needed and don't forget to change the e-mail address in Assign To.
People adding themes can use this template.
Where are Styles Files?
- core2.s2 is in
~/dw/cs/dw-free/bin/upgrading/s2layers/
- Theme and layout .s2 files are in
~/dw/cs/dw-free/bin/upgrading/s2layers/LAYERNAME/
or~/dw/cs/dw-nonfree/bin/upgrading/s2layers/LAYERNAME/
- .pm layout files are in
~/dw/cvs/dw-free/cgi-bin/LJ/S2Theme/
or~/dw/cs/dw-nonfree/bin/upgrading/s2layers/LAYERNAME/
- S2Theme.pm is in
~/dw/cvs/dw-free/cgi-bin/LJ/
- S2Theme_local.pm is in
~/dw/cvs/dw-nonfree/cgi-bin/LJ/
- s2layers.dat is in
~/dw/cs/dw-free/bin/upgrading/
- s2layers-local.dat is in
~/dw/cs/dw-nonfree/bin/upgrading/
How to Add a Layout
Edit s2layers.dat
- See this section to know where this file is located. Edit
s2layers-local.dat
for non-free layouts.
- If this is a new Core2 layout, add:
layoutname/layout layout core2 layoutname/themes theme+ layoutname/layout
- If this is a child of another layout, add:
layoutname/layout layout(core2base/layout) core2 layoutname/themes theme+ layoutname/layout
Edit S2Theme.pm
- See this section to know where this file is located. Edit
S2Theme_local.pm
for non-free layouts.
- Scroll down to
%default_themes
and add the layout and default theme:
layoutname => 'layoutname/defaulttheme',
Create LAYOUTNAME.pm
- Create LAYOUTNAME.pm in
~/dw/cvs/dw-free/cgi-bin/LJ/S2Theme/
.
- Add:
package LJ::S2Theme::layoutname; use base qw( LJ::S2Theme ); sub layouts { ( "1" => "one-column", "2l" => "two-columns-left", "2r" => "two-columns-right", "3" => "three-columns-sides", "3r" => "three-columns-right", "3l" => "three-columns-left" ) } sub layout_prop { "layout_type" } sub designer { "name" } 1;
Remove display options that don't apply to the layout of course.
Create the LAYOUTNAME directory
- Create a directory with the name of the layout in
~/dw/cs/dw-free/bin/upgrading/s2layers/
or~/dw/cs/dw-nonfree/bin/upgrading/s2layers/
.
Create layout.s2
- In the directory you've created, create a file named
layout.s2
.
layerinfo type = "layout"; layerinfo name = "layoutname"; layerinfo redist_uniq = "layoutname/layout"; layerinfo author_name = "someuser"; layerinfo lang = "en"; set layout_authors = [ { "name" => "someuser", "type" => "user" } ];
- Then add the layout code.
Create themes.s2
- In the directory you've created, create a file named
themes.s2
.
- Follow the steps outlined in this section.
How to Add a Theme
Edit themes.s2
- See this section to know where this file is located.
- Find the correct place in the file so that themes stay alphabetically sorted.
- Make sure your theme header is correctly formatted. As Afuna explained here in dw_dev_training, it should look like this:
#NEWLAYER: layoutname/themename layerinfo type = "theme"; layerinfo name = "Theme Name"; layerinfo redist_uniq = "layoutname/themename"; layerinfo author_name = "someuser"; set layout_authors = [ { "name" => "someuser", "type" => "user" } ]
- If you're the layout author, no need to add
set layout_authors
.
- Then add the theme code.
- If you need to add theme-specific CSS, use:
function Page::print_theme_stylesheet() { """ CSS HERE """; }
- If the theme has any images, name them like this:
themename_imagename.xxx
. Keep the image name used in other themes if there are any. If they're generic images used in other themes, simply useimagename.xxx
. In the theme, uselayoutname/themename_imagename.xxx
orlayoutname/imagename.xxx
for the URLs.
Edit LAYOUTNAME.pm
You must include the theme into the general layout file. Otherwise, people wouldn't be able to select it at Customize.
- See this section to know where this file is located.
- Find the correct place in the file so that themes stay alphabetically sorted.
- Add the following code:
package LJ::S2Theme::layoutname::themename; use base qw( LJ::S2Theme::layoutname ); sub cats { qw() } sub designer { "someuser" }
- If you're the layout author, no need to add
sub designer
.
On Bugzilla
- In addition to uploading your patch, comment on bug 680 to add a link to your bug so that Piranha can do a preview.
- Don't forget to zip images and attach them to your bug if there are any.
Tips and Tricks
- If your repositories won't update properly with
dwu
, you may need to first remove all your local changes withhg update -C
then rundwu
again.
- If there's something wrong with your patch queue (it says the patch is not in the series or you can't delete a patch) don't forget that you can start over: delete the patches folder with WinSCP and recreate it again in PuTTY using
hg qinit -c
.
- To see what's string of text is used in a page append
?uselang=debug
to the page URL.
- As denise explained here, you need to delete old text strings and create new ones when you edit .text files or en.dat instead of simply editing the text. See the comments for exceptions to that rule.
- If text you've modified doesn't appear on the site after a code push, append
?uselang=debug
to make sure it's using the right string. If it is then it may be that things haven't been updated yet.