Skip to content

Commit 39a548f

Browse files
author
eliott
committed
Initial import for public release...
Special Note Prior to git import, approx 90% of the code was done by Judd Vinet. Thanks Judd!
0 parents  commit 39a548f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

109 files changed

+8206
-0
lines changed

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
*.pyc
2+
*.swp
3+
local_settings.py
4+

AUTHORS

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# AUTHORS
2+
Judd Vinet <[email protected]>
3+
Simo Leone <[email protected]>
4+
5+
6+

LICENSE

+339
Large diffs are not rendered by default.

README

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# License
2+
See LICENSE file.
3+
4+
# Authors
5+
See AUTHORS file.
6+
7+
# Installation
8+
9+
## Dependencies
10+
- python
11+
- mysql-python
12+
- Django >= 0.95
13+
14+

__init__.py

Whitespace-only changes.

common/__init__.py

Whitespace-only changes.

common/models.py

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
from django.db import models
2+
from django.contrib.auth.models import User
3+
4+
class Mirror(models.Model):
5+
id = models.AutoField(primary_key=True)
6+
domain = models.CharField(maxlength=255)
7+
country = models.CharField(maxlength=255)
8+
url = models.CharField(maxlength=255)
9+
protocol_list = models.CharField(maxlength=255, null=True, blank=True)
10+
admin_email = models.CharField(maxlength=255, null=True, blank=True)
11+
def __str__(self):
12+
return self.domain
13+
class Admin:
14+
list_display = ('domain', 'country')
15+
list_filter = ('country',)
16+
ordering = ['domain']
17+
search_fields = ('domain')
18+
pass
19+
20+
class Donator(models.Model):
21+
id = models.AutoField(primary_key=True)
22+
name = models.CharField(maxlength=255)
23+
def __str__(self):
24+
return self.name
25+
class Admin:
26+
ordering = ['name']
27+
search_fields = ('name')
28+
pass
29+
30+
class UserProfile(models.Model):
31+
id = models.AutoField(primary_key=True) # not technically needed
32+
notify = models.BooleanField("Send notifications", default=True, help_text="When enabled, user will recieve 'flag out of date' notifications")
33+
alias = models.CharField(core=True, maxlength=50, help_text="Required field")
34+
public_email = models.CharField(core=True, maxlength=50, help_text="Required field")
35+
other_contact = models.CharField(maxlength=100, null=True, blank=True)
36+
website = models.URLField(null=True, blank=True)
37+
yob = models.IntegerField(null=True, blank=True)
38+
location = models.CharField(maxlength=50, null=True, blank=True)
39+
languages = models.CharField(maxlength=50, null=True, blank=True)
40+
interests = models.CharField(maxlength=255, null=True, blank=True)
41+
occupation = models.CharField(maxlength=50, null=True, blank=True)
42+
roles = models.CharField(maxlength=255, null=True, blank=True)
43+
favorite_distros = models.CharField(maxlength=255, null=True, blank=True)
44+
picture = models.FileField(upload_to='devs', default='devs/silhouette.png')
45+
user = models.ForeignKey(User, edit_inline=models.STACKED, num_in_admin=1, min_num_in_admin=1, max_num_in_admin=1, num_extra_on_change=0, unique=True)
46+
class Meta:
47+
db_table = 'user_profiles'
48+
verbose_name = 'Additional Profile Data'
49+
verbose_name_plural = 'Additional Profile Data'
50+

common/templatetags/__init__.py

Whitespace-only changes.

common/templatetags/validation.py

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
from django import template
2+
3+
register = template.Library()
4+
5+
@register.inclusion_tag('errors.html')
6+
def print_errors(errors):
7+
errs = []
8+
for e,msg in errors.iteritems():
9+
errmsg = str(msg[0])
10+
# hack -- I'm a python idiot
11+
errs.append( (e, errmsg[2:-2]) )
12+
return {'errors': errs}

data/pkgmaint_guide.txt

+164
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,164 @@
1+
=============================================================================
2+
THE QUICK AND DIRTY ON HOW TO BE A PACKAGE MAINTAINER
3+
=============================================================================
4+
questions to [email protected]
5+
6+
1. Follow Package Guidelines
7+
8+
Package guidelines can be found in the Arch Linux documentation.
9+
Please follow them closely.
10+
11+
2. How To Use CVS
12+
13+
The example commands below assume the module 'extra'.
14+
15+
2.1 Make sure your CVSROOT environment variable is set properly. If the
16+
CVS repository is on the same box:
17+
# export CVSROOT=/home/cvs-extra
18+
19+
If you want to access the repository from the different box via SSH:
20+
# export CVS_RSH=ssh
21+
# export CVSROOT=:ext:[email protected]:/home/cvs-extra
22+
23+
2.2 Checkout the repository. This will download the entire repository to
24+
your local machine:
25+
# cvs co extra
26+
27+
2.3 Updating the repository. This syncs your local repository with the
28+
master. You should do this often, especially if other people could be
29+
working on the same repository.
30+
# cd extra
31+
# cvs -q update -d
32+
33+
2.4 Adding files/directories to the repository. When you want to add a new
34+
package you should create a directory under the respective category and
35+
place the new PKGBUILD in it. For example, to add fvwm to the repo:
36+
# cd extra/x11
37+
# mkdir fvwm
38+
# cd fvwm
39+
# cp /var/abs/PKGBUILD.proto ./PKGBUILD
40+
<edit, test, build, etc>
41+
# cd ..
42+
# cvs add fvwm
43+
# cvs add fvwm/PKGBUILD
44+
45+
2.5 Committing changes. Files are not written to the master repository until
46+
you commit. Never forget to commit!
47+
# cd extra
48+
# cvs commit
49+
50+
This will find all modified files, then throw you into vi where you can
51+
add a log message describing your changes. Save and exit from vi when
52+
you're done and cvs will update the files in the master repository.
53+
54+
2.6 Removing files. If you need to remove a file (eg, an old patch that
55+
isn't needed anymore), you can do the following:
56+
# cd extra/x11/fvwm
57+
# rm old.patch
58+
# cvs remove old.patch
59+
# cvs commit -m "removed old.patch" old.patch
60+
also remove the CURRENT/STABLE tags from the file so it does not appear
61+
in ABS any more:
62+
# cvs tag -d CURRENT old.patch
63+
64+
Don't forget to commit afterwards! Remember that no changes are made
65+
to the master until you commit.
66+
67+
2.7 Removing directories cannot be done easily. If you really need to
68+
remove a directory, email the sysadmin (Judd) and I'll help you out.
69+
70+
2.8 Tagging files. Every file in CVS has tags associated with it, which
71+
allows us to select certain versions of scripts. The db generation
72+
scripts will only look at files that are tagged as CURRENT, so you need
73+
to tag all files after you commit them:
74+
# cd extra/x11/fvwm
75+
# cvs tag -c -F -R CURRENT
76+
77+
NOTE: When tagging, you should be sure to ONLY tag the updated files,
78+
not the entire repository. Otherwise, if parts of your checkout are
79+
out-of-date, you may actually be tagging an OLDER version of a file,
80+
reversing someone else's tag procedure.
81+
82+
3. The Process
83+
84+
3.1 Checkout/update your local repository from cvs.archlinux.org
85+
3.2 Make any changes you need to
86+
3.3 Put your new packages in your local staging directory on archlinux.org.
87+
Suggested syntax is:
88+
scp name-ver-rel.pkg.tar.gz [email protected]:staging/extra/add
89+
3.4 Commit your changes (section 2.5)
90+
3.5 Update the CURRENT tags to new revisions (section 2.8)
91+
3.6 Log in to archlinux.org and run the /arch/db-extra script, which
92+
will re-generate the sync db and place it in /home/ftp/extra, then
93+
move the new/updated packages from your staging directory to the
94+
FTP tree.
95+
3.7 Remove any older versions of packages from /home/ftp/extra to
96+
save diskspace, they should be noted when the db generation script
97+
finishes.
98+
99+
Make sure you do things in this order, mixing them up can break things
100+
temporarily. For example, if you remove older versions from the ftp
101+
tree before you update the database or update the database before
102+
uploading new packages, arch users trying to download the package at
103+
that time will get "file not found" errors.
104+
105+
4. Staging Directories
106+
107+
As mentioned in Section 3, packages need to be uploaded to the proper
108+
staging directory before running a db generation script. The staging
109+
area (located in your home dir) looks like so:
110+
111+
staging
112+
|-- arch
113+
| |-- add
114+
| `-- del
115+
|-- extra
116+
| |-- add
117+
| `-- del
118+
|-- testing
119+
| |-- add
120+
| `-- del
121+
`-- unstable
122+
|-- add
123+
`-- del
124+
125+
As you can see, each repository has two staging directories: "add" and
126+
"del". When you want to add or update a package, you'll place it in the
127+
"add" directory for the repository you're working in. Then run the db-gen
128+
script.
129+
130+
When you want to remove a package, you will move the package OUT OF the FTP
131+
directory (eg, /home/ftp/extra/os/i686/) and INTO the "del" directory for
132+
the repository you're working in. Once moved, you can run the db-gen
133+
script -- it will see that the file has left the FTP tree and will remove
134+
it from the package database.
135+
136+
5. Miscellaneous Stuff
137+
138+
5.1 If you are creating a daemon you need to include an rc.d startup
139+
script for it. Look at /var/abs/daemons/esd for a simple example.
140+
5.2 Please include a line that says '# $Id: pkgmaint_guide.txt,v 1.3 2006/10/05 20:52:01 judd Exp $' at the top of each
141+
PKGBUILD. This will be parsed by cvs during a commit, and replaced
142+
with user/timestamp data.
143+
5.3 Please do some rudimentary checks of the package before making it
144+
'live'. Try installing it and see if there are any file conflicts.
145+
Check for dependencies by running 'ldd' against the binaries and
146+
looking through the .so files it requires. For example,
147+
'ldd /usr/bin/gvim' returns a big list of libs, one of which is
148+
libgtk-x11-2.0.so.0, so gtk2 should be one of the dependencies for
149+
gvim. Also, namcap is available in the extra repository. Running it
150+
against a package will print dependancy warnings as well as possible
151+
configuration problems. Namcap is not the final word, if ldd or
152+
runtime show otherwise, believe them instead.
153+
5.4 When creating a package description for a package, do not include
154+
the package name in a self-referencing way, as it is redundant.
155+
For example, "Nedit is a text editor for X11" could be simplified to
156+
"A text editor for X11". Also try to keep the descriptions to ~80
157+
characters or less.
158+
5.5 When entering cvs log messages for new/upgraded packages, please use
159+
these tags so they can be easily parsed for changelog generation:
160+
if the package is upgrade use: 'upgpkg: pkgname newpkgver'
161+
if the package is new use: 'newpkg: pkgname newpkgver'
162+
163+
164+
$Id: pkgmaint_guide.txt,v 1.3 2006/10/05 20:52:01 judd Exp $

devel/__init__.py

Whitespace-only changes.

devel/views.py

+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
from django.http import HttpResponse, HttpResponseRedirect
2+
from django.contrib.auth.decorators import login_required
3+
from django.contrib.auth.models import User
4+
from django.core import validators
5+
from archlinux.utils import render_template
6+
from archlinux.packages.models import Package
7+
from archlinux.todolists.models import Todolist, TodolistPkg
8+
from archlinux.settings import DATA_DIR
9+
from archlinux.utils import validate
10+
from archlinux.common.models import UserProfile
11+
12+
@login_required
13+
def index(request):
14+
try:
15+
thismaint = User.objects.get(username=request.user.username)
16+
except User.DoesNotExist:
17+
# weird, we don't have a maintainer record for this logged-in user
18+
thismaint = None
19+
20+
# get a list of incomplete package todo lists
21+
todos = Todolist.objects.get_incomplete()
22+
# get flagged-package stats for all maintainers
23+
stats = Package.objects.get_flag_stats()
24+
if thismaint:
25+
# get list of flagged packages for this maintainer
26+
pkgs = Package.objects.filter(maintainer=thismaint.id).filter(needupdate=True).order_by('repo', 'pkgname')
27+
else:
28+
pkgs = None
29+
30+
return render_template('devel/index.html', request,
31+
{'stats':stats, 'pkgs':pkgs, 'todos':todos, 'maint':thismaint})
32+
33+
@login_required
34+
#@is_maintainer
35+
def change_notify(request):
36+
maint = User.objects.get(username=request.user.username)
37+
notify = request.POST.get('notify', 'no')
38+
try:
39+
maint.get_profile().notify = notify == 'yes'
40+
except UserProfile.DoesNotExist:
41+
UserProfile(user_id=maint.id ,notify=notify == 'yes').save()
42+
maint.get_profile().save()
43+
return HttpResponseRedirect('/devel/')
44+
45+
@login_required
46+
def change_profile(request):
47+
errors = {}
48+
if request.POST:
49+
passwd1, passwd2 = request.POST['passwd'], request.POST['passwd2']
50+
email = request.POST['email']
51+
# validate
52+
if passwd1 != passwd2:
53+
errors['password'] = [' Passwords do not match. ']
54+
validate(errors, 'Email', email, validators.isValidEmail, False, request)
55+
# apply changes
56+
if not errors:
57+
request.user.email = email
58+
if passwd1:
59+
request.user.set_password(passwd1)
60+
request.user.save()
61+
return HttpResponseRedirect('/devel/')
62+
return render_template('devel/profile.html', request, {'errors':errors,'email':request.user.email})
63+
64+
@login_required
65+
def guide(request):
66+
return HttpResponse(file(DATA_DIR + '/pkgmaint_guide.txt').read(),
67+
mimetype='text/plain')

feeds.py

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
from django.contrib.syndication.feeds import Feed
2+
from archlinux.packages.models import Package
3+
from archlinux.news.models import News
4+
#from datetime import datetime
5+
6+
class PackageFeed(Feed):
7+
title = 'Recent Package Updates'
8+
link = '/packages/'
9+
description = 'Recent Package Updates'
10+
11+
def items(self):
12+
return Package.objects.order_by('-last_update')[:10]
13+
14+
def item_pubdate(self, item):
15+
return item.last_update
16+
17+
def item_categories(self, item):
18+
return (item.repo.name,item.category.category)
19+
20+
class NewsFeed(Feed):
21+
title = 'Recent News Updates'
22+
link = '/news/'
23+
description = 'Recent News Updates'
24+
25+
def items(self):
26+
return News.objects.order_by('-postdate', '-id')[:10]
27+
28+
def item_pubdate(self, item):
29+
return item.postdate

lib/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)